/* ==============================================================================
   WACLIS MAIL — DESIGN SYSTEM & TOKENS OFICIALES
   Basado en la arquitectura visual de work.waclis.com y research.waclis.com
   ============================================================================== */

:root {
  /* Paleta oficial de marca Waclis */
  --magenta: #ec1895;
  --magenta-dark: #d80e84;
  --magenta-soft: #fdf0f8;
  --magenta-glow: rgba(236, 24, 149, 0.18);
  
  --ink: #1e293b;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #ffffff;
  --canvas: #f8fafc;
  --column: #f1f5f9;
  
  --green: #10b981;
  --green-soft: #ecfdf5;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --purple: #8b5cf6;
  --purple-soft: #f5f3ff;
  --cyan: #06b6d4;
  --cyan-soft: #ecfeff;

  /* Espaciado Estandarizado (Sección 30) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Dimensiones y Radius */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-pill: 9999px;

  /* Sombras y Superficies */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-floating: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 20px 45px -10px rgba(15, 23, 42, 0.22), 0 12px 16px -8px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);

  /* Bordes Refinados (Sección 33) */
  --border-subtle: #f1f5f9;
  --border-normal: #e2e8f0;
  --border-focused: var(--magenta);

  /* Escala Tipográfica (Sección 30) */
  --text-title: 17px;
  --text-section: 14px;
  --text-body: 13.5px;
  --text-secondary: 12px;
  --text-metadata: 11px;

  --font-family: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 2px;
}

/* ==============================================================================
   LAYOUT PRINCIPAL
   ============================================================================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden !important;
  overflow-y: hidden;
}

/* TOPBAR HEADER */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
  max-width: 100vw;
  overflow-x: hidden;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: var(--sidebar-width);
  transition: min-width 0.15s ease;
}

.sidebar-collapsed .topbar-left {
  min-width: var(--sidebar-collapsed, 64px);
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all 0.15s;
}

.menu-toggle:hover {
  background: var(--canvas);
  color: var(--ink);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-logo-full {
  height: 32px;
  width: auto;
  display: block;
}

.brand-badge-qa {
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(116, 88, 232, 0.2);
  text-transform: uppercase;
}

/* BUSCADOR GLOBAL GMAIL-STYLE */
.topbar-center {
  flex: 1;
  max-width: 720px;
  margin: 0 24px;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  height: 42px;
  padding: 0 12px;
  transition: all 0.15s;
}

.search-box:focus-within {
  background: var(--surface);
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px var(--magenta-glow);
}

.search-box svg {
  color: var(--subtle);
  margin-right: 10px;
}

.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--ink);
}

.search-box input::placeholder {
  color: var(--subtle);
}

.ctrl-k-hint-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  margin-right: 6px;
  background: var(--canvas, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1;
}

.ctrl-k-hint-btn:hover {
  background: var(--surface, #ffffff);
  border-color: var(--magenta, #ec1895);
  color: var(--magenta, #ec1895);
  box-shadow: 0 1px 4px rgba(236, 24, 149, 0.15);
  transform: translateY(-0.5px);
}

.search-filter-btn {
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}

.search-filter-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--ink);
}

/* TOPBAR RIGHT */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.org-selector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--line);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.org-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--magenta);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  position: relative;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--canvas);
  color: var(--ink);
}

.icon-btn .badge-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--magenta);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  padding: 1px 5px;
  border: 2px solid var(--surface);
}

.wcc-launcher-btn {
  color: var(--ink);
}

.user-avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--magenta) 0%, var(--purple) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}

/* ==============================================================================
   CUERPO PRINCIPAL: SIDEBAR + LISTA DE CORREO + PANEL DE HILO
   ============================================================================== */

.main-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ==============================================================================
   SIDEBAR DE NAVEGACIÓN — ARQUITECTURA AISLADA
   ============================================================================== */

.sidebar {
  width: var(--sidebar-width, 240px);
  background: var(--surface, #ffffff);
  border-right: 1px solid var(--line, #e2e8f0);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden !important;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

/* ==============================================================================
   SIDEBAR EXPANDIDO (MODO NORMAL) — REGLAS CANÓNICAS VERTICALES
   ============================================================================== */
.sidebar:not(.collapsed) {
  width: var(--sidebar-width, 240px) !important;
  min-width: var(--sidebar-width, 240px) !important;
  max-width: var(--sidebar-width, 240px) !important;
  padding: 14px 10px !important;
  overflow-x: hidden !important;
}

.sidebar:not(.collapsed) .compose-btn-wrapper {
  width: 100% !important;
  margin-bottom: 12px !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.sidebar:not(.collapsed) .compose-btn {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  width: 100% !important;
  height: 44px !important;
  background: var(--magenta, #ec1895) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 22px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(236, 24, 149, 0.22) !important;
  transition: all 0.15s ease !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
}

.sidebar:not(.collapsed) .compose-btn:hover {
  background: var(--magenta-dark, #d80e84) !important;
  box-shadow: 0 4px 14px rgba(236, 24, 149, 0.35) !important;
  transform: translateY(-1px);
}

.sidebar:not(.collapsed) .compose-btn span {
  display: inline-block !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
}

.sidebar:not(.collapsed) .compose-btn svg {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
}

/* Nav Sections en modo expandido: flex column estricto */
.sidebar:not(.collapsed) .nav-section {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 2px !important;
  margin-bottom: 8px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Cada Nav Item en modo expandido: UNA FILA POR ITEM de 100% de ancho */
.sidebar:not(.collapsed) .nav-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  width: 100% !important;
  height: 38px !important;
  padding: 0 12px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  color: var(--ink, #1e293b) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-align: left !important;
  box-sizing: border-box !important;
  transition: background 0.15s ease, color 0.15s ease !important;
  position: relative !important;
  outline: none !important;
}

.sidebar:not(.collapsed) .nav-item:hover {
  background: var(--canvas, #f1f5f9) !important;
  color: var(--ink, #0f172a) !important;
}

.sidebar:not(.collapsed) .nav-item.active {
  background: var(--magenta-soft, #fdf0f8) !important;
  color: var(--magenta, #ec1895) !important;
  font-weight: 700 !important;
}

.sidebar:not(.collapsed) .nav-item.active svg {
  color: var(--magenta, #ec1895) !important;
}

.sidebar:not(.collapsed) .nav-item .nav-item-content {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.sidebar:not(.collapsed) .nav-item .nav-item-content svg {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
  color: var(--muted, #64748b);
  transition: color 0.15s ease;
}

.sidebar:not(.collapsed) .nav-item:hover .nav-item-content svg {
  color: var(--ink, #0f172a);
}

.sidebar:not(.collapsed) .nav-item .nav-item-title {
  display: inline-block !important;
  font-size: 13px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 1 1 auto !important;
}

.sidebar:not(.collapsed) .nav-item .nav-item-badge {
  margin-left: auto !important;
  flex-shrink: 0 !important;
  background: var(--magenta, #ec1895) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  padding: 2px 7px !important;
  border-radius: 10px !important;
  box-shadow: 0 1px 3px rgba(236, 24, 149, 0.25) !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
}

.sidebar:not(.collapsed) .nav-item .nav-item-badge:empty,
.sidebar:not(.collapsed) .nav-item .nav-item-badge[style*="display: none"],
.sidebar:not(.collapsed) .nav-item .nav-item-badge[style*="display:none"],
.sidebar:not(.collapsed) .nav-item .nav-item-badge[data-count="0"] {
  display: none !important;
}

.sidebar:not(.collapsed) .sidebar-section-title {
  display: block !important;
  padding: 14px 12px 6px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--muted, #64748b) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  border-top: 1px solid var(--border-color, #e7e8ec) !important;
  margin-top: 6px !important;
}

.sidebar:not(.collapsed) .sidebar-labels-section,
.sidebar:not(.collapsed) .accounts-section {
  display: block !important;
}

.sidebar:not(.collapsed) .sidebar-footer {
  margin-top: auto !important;
  padding: 10px 0 0 0 !important;
  border-top: 1px solid var(--border-color, #e7e8ec) !important;
  width: 100% !important;
}

/* ==============================================================================
   SIDEBAR COLAPSADO (MODO COMPACTO 64PX) — ALINEACIÓN ÓPTICA ESTRICTA
   ============================================================================== */
.sidebar.collapsed {
  width: var(--sidebar-collapsed, 64px) !important;
  min-width: var(--sidebar-collapsed, 64px) !important;
  max-width: var(--sidebar-collapsed, 64px) !important;
  padding: 14px 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

.sidebar.collapsed .compose-btn-wrapper {
  margin-bottom: 14px !important;
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.sidebar.collapsed .compose-btn {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  position: relative !important;
  margin: 0 auto !important;
  background: var(--magenta, #ec1895) !important;
  color: #ffffff !important;
  border: none !important;
  cursor: pointer !important;
}

.sidebar.collapsed .compose-btn span {
  display: none !important;
}

.sidebar.collapsed .compose-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  z-index: 99999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.sidebar.collapsed .compose-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Ocultar secciones expandidas */
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-labels-header,
.sidebar.collapsed .section-header,
.sidebar.collapsed .sidebar-labels-section,
.sidebar.collapsed .accounts-section {
  display: none !important;
}

.sidebar.collapsed .nav-section {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  margin-bottom: 8px !important;
  padding: 0 !important;
}

.sidebar.collapsed .nav-item {
  width: 44px !important;
  height: 40px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  padding: 0 !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  border-radius: 8px !important;
  background: transparent;
  border: none;
  cursor: pointer;
  box-sizing: border-box !important;
}

.sidebar.collapsed .nav-item:hover {
  background: var(--canvas, #f1f5f9) !important;
}

.sidebar.collapsed .nav-item.active {
  background: var(--magenta-soft, #fdf0f8) !important;
  color: var(--magenta, #ec1895) !important;
}

.sidebar.collapsed .nav-item.active svg {
  color: var(--magenta, #ec1895) !important;
}

.sidebar.collapsed .nav-item .nav-item-content {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  gap: 0 !important;
  margin: 0 !important;
}

.sidebar.collapsed .nav-item .nav-item-content svg {
  width: 18px !important;
  height: 18px !important;
  margin: 0 auto !important;
  display: block !important;
  flex-shrink: 0 !important;
}

.sidebar.collapsed .nav-item-title {
  display: none !important;
}

/* Tooltip accesible flotante en colapsado */
.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 99999;
  box-shadow: 0 6px 16px rgba(0,0,0,0.22);
}

.sidebar.collapsed .nav-item:hover::after,
.sidebar.collapsed .nav-item:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(2px);
}

/* Badge dot cuando colapsado */
.sidebar.collapsed .nav-item-badge {
  position: absolute !important;
  top: 6px !important;
  right: 6px !important;
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  padding: 0 !important;
  font-size: 0 !important;
  border-radius: 50% !important;
  background: var(--magenta, #ec1895) !important;
  border: 1.5px solid #ffffff !important;
  display: block !important;
}

.sidebar.collapsed .nav-item-badge:empty,
.sidebar.collapsed .nav-item-badge[style*="display: none"],
.sidebar.collapsed .nav-item-badge[style*="display:none"],
.sidebar.collapsed .nav-item-badge[data-count="0"] {
  display: none !important;
}

/* Footer de Configuración en colapsado — EXACTAMENTE MISMO CENTRO ÓPTICO */
.sidebar-footer {
  margin-top: auto;
  width: 100%;
  border-top: 1px solid var(--border-color, #e7e8ec);
  padding: 10px 0 0 0;
  box-sizing: border-box;
}

.sidebar.collapsed .sidebar-footer {
  padding: 10px 0 0 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}

.sidebar.collapsed #btn-sidebar-settings {
  width: 44px !important;
  height: 40px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  padding: 0 !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}

.sidebar.collapsed #btn-sidebar-settings .nav-item-content {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  gap: 0 !important;
}

.sidebar.collapsed #btn-sidebar-settings .nav-item-content svg {
  margin: 0 auto !important;
  width: 18px !important;
  height: 18px !important;
}

/* SECCIÓN DE CUENTAS / CASILLAS CONECTADAS */
.accounts-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.add-account-btn {
  color: var(--magenta);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.add-account-btn:hover {
  background: var(--magenta-soft);
}

.account-plan-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
}

/* ==============================================================================
   BANDEJA CENTRAL DE CORREOS (GMAIL STYLE)
   ============================================================================== */

.mail-list-panel {
  flex: 1;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-width: 320px;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

/* TOOLBAR DE ACCIONES DE BANDEJA */
.mail-toolbar {
  height: 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #fafafa;
  flex-shrink: 0;
}

.mail-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  accent-color: var(--magenta);
  cursor: pointer;
}

.toolbar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.12s;
}

.toolbar-action-btn:hover {
  background: var(--canvas);
  color: var(--ink);
}

.mail-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.mail-toolbar-right .toolbar-action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* BANNERS DE ACCIÓN DE CARPETA Y SELECCIÓN MASIVA */
.mail-folder-banner {
  padding: 10px 18px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
  font-weight: 500;
  animation: fadeIn 0.15s ease-in;
}

.mail-folder-banner.trash-banner {
  background: #fef2f2;
  border-bottom-color: #fee2e2;
  color: #991b1b;
}

.mail-folder-banner.spam-banner {
  background: #fffbeb;
  border-bottom-color: #fef3c7;
  color: #92400e;
}

.mail-folder-banner .btn-banner-action {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mail-folder-banner.trash-banner .btn-banner-action {
  color: #dc2626;
  border-color: #fca5a5;
}

.mail-folder-banner.trash-banner .btn-banner-action:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

.mail-folder-banner.spam-banner .btn-banner-action {
  color: #b45309;
  border-color: #fde68a;
}

.mail-folder-banner.spam-banner .btn-banner-action:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

.mail-selection-banner {
  padding: 9px 18px;
  font-size: 12.5px;
  text-align: center;
  border-bottom: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: fadeIn 0.15s ease-in;
}

.mail-selection-banner .btn-selection-action {
  background: none;
  border: none;
  padding: 0;
  color: var(--magenta, #ec1895);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  font-size: 12.5px;
}

.mail-selection-banner .btn-selection-action:hover {
  color: #be185d;
}

/* LISTA DE CORREOS VIRTUALIZADA */
.mail-list-container {
  flex: 1;
  overflow-y: auto;
}

.mail-row {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
  user-select: none;
}

.mail-row:hover {
  background: #fbfbfc;
  box-shadow: inset 1px 0 0 var(--line), inset -1px 0 0 var(--line);
}

.mail-row.selected {
  background: var(--magenta-soft);
}

.mail-row.unread {
  font-weight: 700;
  color: var(--ink);
  background: #ffffff;
}

.mail-row.unread .mail-subject {
  font-weight: 700;
  color: var(--ink);
}

.mail-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 14px;
}

.star-btn {
  color: #ccc;
  transition: color 0.15s;
}

.star-btn.starred {
  color: var(--amber);
}

.mail-account-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mail-sender {
  width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  margin-right: 16px;
}

.mail-body-preview {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  margin-right: 16px;
}

.mail-subject {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--ink);
}

.mail-snippet {
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 8px;
}

.mail-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
}

.tag-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.attachment-indicator {
  color: var(--muted);
  margin-left: 8px;
}

.mail-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  min-width: 75px;
}

/* ESTADO VACÍO DE BANDEJA */
.empty-mail-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.empty-mail-state svg {
  width: 64px;
  height: 64px;
  color: var(--subtle);
  margin-bottom: 16px;
}

.empty-mail-state h3 {
  color: var(--ink);
  font-size: 18px;
  margin-bottom: 6px;
}

/* ==============================================================================
   PANEL LATERAL DERECHO DE HILO (THREAD VIEWER)
   ============================================================================== */

.thread-viewer-panel {
  width: 55%;
  min-width: 480px;
  max-width: 850px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.03);
}

.thread-header {
  min-height: 64px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}

.thread-title-area {
  flex: 1;
  min-width: 0;
  margin-right: 14px;
}

.thread-subject {
  font-size: 18px;
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.thread-labels-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thread-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PESTAÑAS CONTEXTUALES DEL ECOSISTEMA */
.thread-tabs-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
  padding: 0 16px;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
}

.context-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.context-tab-btn:hover {
  color: var(--ink);
}

.context-tab-btn.active {
  color: var(--magenta);
  border-bottom-color: var(--magenta);
  background: #fff;
}

.thread-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* MENSAJE INDIVIDUAL DENTRO DEL HILO */
.thread-message-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.message-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fbfbfc;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.message-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e4e5ea;
  color: var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.author-names {
  display: flex;
  flex-direction: column;
}

.author-display-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

.author-email {
  font-size: 11px;
  color: var(--muted);
}

.message-date-and-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.message-body-container {
  padding: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  overflow-x: auto;
}

/* ADJUNTOS */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 14px 20px;
  background: #fafafa;
  border-top: 1px solid var(--line);
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.attachment-chip:hover {
  border-color: var(--magenta);
  box-shadow: var(--shadow-sm);
}

.attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 10px;
  color: var(--muted);
}

/* RESPUESTA RÁPIDA DENTRO DEL HILO */
.quick-reply-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

/* ==============================================================================
   MODAL / DOCK DE REDACCIÓN DE CORREO (COMPOSER)
   ============================================================================== */

.composer-dock {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 620px;
  height: 580px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: all 0.2s ease-in-out;
}

.composer-dock.minimized {
  height: 44px;
}

.composer-dock.fullscreen {
  inset: 20px;
  width: auto;
  height: auto;
  border-radius: var(--radius);
}

.composer-header {
  height: 44px;
  background: var(--surface, #f8fafc);
  color: var(--ink, #1e293b);
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  cursor: move;
  border-top-left-radius: var(--radius, 10px);
  border-top-right-radius: var(--radius, 10px);
}

.composer-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #1e293b);
}

.composer-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-header-actions button {
  color: var(--muted, #64748b);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.composer-header-actions button:hover {
  color: var(--ink, #0f172a);
  background: var(--canvas, #f1f5f9);
}

.composer-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.composer-fields {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.composer-field-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 6px 14px;
  min-height: 40px;
}

.composer-field-label {
  width: 50px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.composer-field-input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 13px;
  color: var(--ink);
}

.composer-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.composer-field-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.btn-toggle-field {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-field:hover {
  background: var(--line);
  color: var(--magenta);
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-width: 440px;
  max-height: 250px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 1050;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s ease;
  border-bottom: 1px solid #f1f5f9;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: #fdf0f8;
}

.autocomplete-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--magenta);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.autocomplete-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.autocomplete-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: #e0e7ff;
  color: #3730a3;
  text-transform: uppercase;
  flex-shrink: 0;
}

.autocomplete-badge.core {
  background: #fce7f3;
  color: #9d174d;
}

/* TOOLBAR DEL EDITOR */
.composer-rich-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 14px;
  background: #fafafa;
  border-bottom: 1px solid var(--line);
}

.rich-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: #5f5b66;
}

.rich-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}

.composer-editor-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  outline: none;
  font-size: 13px;
  line-height: 1.6;
  background: #ffffff !important;
  color: var(--ink);
}

/* ELIMINAR LÍNEAS DIVISORIAS ENTRE PÁRRAFOS EN EL COMPOSITOR */
.composer-editor-content p,
.composer-editor-content div,
.composer-editor-content span,
.composer-editor-content br {
  border: none !important;
  border-bottom: none !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.composer-editor-content p,
.composer-editor-content div {
  margin: 0 0 0.5em 0;
  padding: 0;
}

/* ZONA DE ADJUNTOS DEBAJO DEL CUERPO DEL EMAIL */
.composer-attachments-list {
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  background: #fbfbfc;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 110px;
  overflow-y: auto;
}

.composer-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.composer-att-chip svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.composer-att-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.composer-att-name {
  font-weight: 550;
}

.composer-att-size {
  font-size: 11px;
  color: var(--muted);
}

.btn-remove-att {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.btn-remove-att:hover {
  color: var(--red);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.composer-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.send-button-group {
  display: inline-flex;
  position: relative;
  overflow: visible !important;
  box-shadow: 0 4px 12px rgba(236, 24, 149, 0.25);
}

.send-primary-btn {
  background: var(--magenta);
  color: #fff;
  font-weight: 700;
  padding: 0 16px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

.send-primary-btn:hover {
  background: var(--magenta-dark);
}

.send-schedule-dropdown-btn {
  background: var(--magenta-dark);
  color: #fff;
  padding: 0 10px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  border-left: 1px solid rgba(255,255,255,0.2);
}

.composer-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==============================================================================
   LANZADOR WCC (UNIVERSAL APP SWITCHER)
   ============================================================================== */

.wcc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 23, 30, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 68px 24px;
}

.wcc-popover-card {
  width: 340px;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wcc-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.wcc-popover-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.wcc-apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.wcc-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-radius: 12px;
  transition: all 0.14s;
  text-align: center;
  color: var(--ink);
}

.wcc-app-item:hover {
  background: var(--canvas);
  transform: translateY(-1px);
}

.wcc-app-item.current {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.wcc-app-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.wcc-app-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.wcc-app-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.wcc-app-badge-current {
  font-size: 9px;
  font-weight: 600;
  color: var(--magenta);
  background: var(--magenta-soft);
  border: 1px solid rgba(224, 0, 77, 0.2);
  padding: 1px 5px;
  border-radius: 4px;
  margin-top: 3px;
}

/* ==============================================================================
   TOASTS & DESHACER ENVÍO (UNDO SEND)
   ============================================================================== */

.undo-send-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #25232a;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 2000;
  font-size: 13px;
  animation: slideUpToast 0.2s ease-out;
}

@keyframes slideUpToast {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.undo-send-btn {
  color: var(--magenta);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.undo-send-btn:hover {
  text-decoration: underline;
}

/* ==============================================================================
   RESPONSIVE (MÓVIL Y TABLET)
   ============================================================================== */

@media (max-width: 900px) {
  .thread-viewer-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    z-index: 100;
  }
  
  .composer-dock {
    inset: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

/* ==============================================================================
   MODALES DE CONFIGURACIÓN & ASISTENTE DE ONBOARDING
   ============================================================================== */

.settings-modal-backdrop,
.onboarding-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 23, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Modal superior (Miembros de casilla, sub-modales) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 23, 0.65);
  backdrop-filter: blur(5px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line, #e7e8ec);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-modal-container {
  background: #ffffff;
  width: 950px;
  max-width: 96vw;
  height: 640px;
  max-height: 90vh;
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line, #e7e8ec);
}

.settings-modal-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line, #e7e8ec);
  background: #ffffff;
}

.settings-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-header-title h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, #121117);
  margin: 0;
}

.settings-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted, #74717d);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.settings-close-btn:hover {
  background: var(--canvas, #f3f3f6);
  color: var(--ink, #121117);
}

.settings-modal-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.settings-tabs-sidebar {
  width: 230px;
  border-right: 1px solid var(--line, #e7e8ec);
  background: #fbfbfc;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.settings-tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--ink-secondary, #3a3842);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.14s;
}

.settings-tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted, #74717d);
}

.settings-tab-btn:hover {
  background: var(--canvas, #f3f3f6);
  color: var(--ink, #121117);
}

.settings-tab-btn.active {
  background: #ffffff;
  color: var(--magenta, #ec1895);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.settings-tab-btn.active svg {
  color: var(--magenta, #ec1895);
}

.settings-content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #ffffff;
}

.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #121117);
  margin-bottom: 6px;
}

.settings-section-desc {
  font-size: 12.5px;
  color: var(--muted, #74717d);
  margin-bottom: 18px;
}

/* CARDS & TABLAS DENTRO DE CONFIGURACIÓN */
.account-card-item {
  border: 1px solid var(--line, #e7e8ec);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  transition: border-color 0.15s;
}

.account-card-item:hover {
  border-color: #cbd0d8;
}

.account-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.account-details h4 {
  margin: 0 0 3px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #121117);
}

.account-details p {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #74717d);
}

.badge-pill-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pill-status.connected {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.badge-pill-status.default {
  background: rgba(236, 24, 149, 0.12);
  color: var(--magenta, #ec1895);
}

/* ASISTENTE DE ONBOARDING */
.onboarding-modal-card {
  background: #ffffff;
  width: 520px;
  max-width: 94vw;
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.2);
  padding: 24px;
  border: 1px solid var(--line, #e7e8ec);
}

.onboarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.onboarding-title-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
}

.onboarding-title-lockup h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, #121117);
}

.onboarding-title-lockup p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted, #74717d);
}

.oauth-quick-providers {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
}

.oauth-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line, #e7e8ec);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #121117);
  cursor: pointer;
  transition: all 0.14s;
}

.oauth-provider-btn:hover {
  background: #f8f8fa;
  border-color: #cbd0d8;
}

.onboarding-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0;
  color: var(--muted, #74717d);
  font-size: 11px;
}

.onboarding-divider::before,
.onboarding-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--line, #e7e8ec);
}

.onboarding-divider span {
  padding: 0 10px;
}

.form-group-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #121117);
}

.form-group-field input,
.form-group-field select,
.form-group-field textarea {
  height: 38px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--line, #e7e8ec);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group-field textarea {
  height: auto;
  padding: 10px 12px;
}

.form-group-field input:focus,
.form-group-field select:focus,
.form-group-field textarea:focus {
  border-color: var(--magenta, #ec1895);
}

.field-hint {
  font-size: 11px;
  color: var(--muted, #74717d);
}

.grid-2-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.onboarding-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--muted, #74717d);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.btn-text-link:hover {
  color: var(--ink, #121117);
  text-decoration: underline;
}

.btn-primary-action {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--magenta, #ec1895);
  color: #ffffff;
  border: none;
  height: 40px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary-action:hover {
  opacity: 0.92;
}

.detection-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(236, 24, 149, 0.2);
  border-top-color: var(--magenta, #ec1895);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* MENÚS DESPLEGABLES Y POPOVERS INTERACTIVOS */
.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  font-size: 12px;
  color: var(--ink, #121117);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
}

.dropdown-item:hover {
  background: var(--canvas, #f4f4f7);
  color: var(--magenta, #ec1895);
}

.dropdown-separator {
  height: 1px;
  background: var(--line, #e7e8ec);
  margin: 4px 0;
}

.dropdown-header-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted, #74717d);
  padding: 6px 12px 2px;
  letter-spacing: 0.5px;
}

.schedule-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 250px;
  background: #ffffff;
  border: 1px solid var(--line, #e7e8ec);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  z-index: 10005;
  padding: 6px;
}

/* BARRA COLABORATIVA EN VISOR DE HILOS (SHARED MAILBOX) */
.thread-collab-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 16px;
  background: #fbfbfc;
  border-bottom: 1px solid var(--line, #e7e8ec);
  font-size: 12px;
}

.collab-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.collab-label {
  font-weight: 600;
  color: var(--muted, #74717d);
}

.collab-select {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line, #e7e8ec);
  background: #ffffff;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink, #121117);
  outline: none;
  cursor: pointer;
}

.collab-select:focus {
  border-color: var(--magenta, #ec1895);
}

/* NOTAS INTERNAS PRIVADAS */
.internal-note-banner {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
}

.internal-note-card {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-left: 3px solid #eab308;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.timeline-event-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line, #e7e8ec);
  font-size: 12px;
}

.timeline-event-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.attachment-chip-removable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 11px;
  margin: 4px;
}

.btn-remove-chip {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: bold;
}

.btn-remove-chip:hover {
  color: #ef4444;
}

/* Banners y Toasts Globales */
.undo-send-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  background: #1e1e24;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  display: none;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.undo-send-btn {
  background: transparent;
  border: none;
  color: #f472b6;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  outline: none;
}
.undo-send-btn:hover {
  text-decoration: underline;
}

.global-toast-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9998;
  background: #1e1e24;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ==============================================================================
   RENDERIZADO DE EMAIL AISLADO Y METADATOS TÉCNICOS
   ============================================================================== */

.mail-html-body {
  max-width: 100%;
  overflow-x: auto;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a24;
}

.mail-html-body img {
  max-width: 100% !important;
  height: auto !important;
}

.mail-html-body table {
  max-width: 100% !important;
  border-collapse: collapse;
}

.mail-plain-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  color: #1a1a24;
}

.mail-plain-body a, .mail-html-body a {
  color: var(--magenta, #ec1895);
  text-decoration: underline;
}

.message-details-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-details-row {
  display: flex;
  gap: 8px;
}

.message-details-label {
  width: 90px;
  font-weight: 700;
  color: #64748b;
  flex-shrink: 0;
}

.message-details-val {
  flex: 1;
  word-break: break-all;
}

.quoted-reply-container {
  margin-top: 14px;
}

.quoted-reply-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s;
}

.quoted-reply-toggle:hover {
  background: #e2e8f0;
}

.quoted-reply-content {
  border-left: 3px solid #94a3b8;
  padding-left: 12px;
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

/* ==============================================================================
   COMPONENTE: BOTÓN FLOTANTE FAB CIRCULAR (INBOX STYLE)
   ============================================================================== */

.mobile-floating-fab {
  display: none;
  position: fixed;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  left: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, background-color 0.15s;
}

.mobile-floating-fab:hover {
  background: #f8fafc;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18), 0 3px 8px rgba(0, 0, 0, 0.1);
}

.mobile-floating-fab:active {
  transform: scale(0.92);
  background: #f1f5f9;
}

.mobile-floating-fab svg {
  width: 25px;
  height: 25px;
  stroke: #1e293b;
}

/* ==============================================================================
   COMPONENTE: DRAWER LATERAL MOBILE Y OVERLAY
   ============================================================================== */

.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 20, 0.62);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-drawer-backdrop.active {
  display: block;
  opacity: 1;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 84vw;
  max-width: 320px;
  height: 100dvh;
  background: #ffffff;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.25);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-header {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  background: #fafafa;
}

.drawer-account-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.drawer-acc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--magenta) 0%, #7458e8 100%);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.drawer-acc-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-acc-name {
  font-weight: 750;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-acc-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-acc-status {
  font-size: 10px;
  font-weight: 700;
  color: #059669;
  margin-top: 1px;
}

.mobile-drawer-compose {
  padding: 12px 14px;
}

.mobile-drawer-compose-btn {
  width: 100%;
  height: 42px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 13px;
}

.mobile-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 550;
  color: #4b4854;
  width: 100%;
  text-align: left;
  transition: all 0.12s;
}

.drawer-nav-item:hover, .drawer-nav-item:active {
  background: #f3f4f6;
  color: var(--ink);
}

.drawer-nav-item.active {
  background: var(--magenta-soft);
  color: var(--magenta);
  font-weight: 700;
}

.drawer-nav-item svg {
  width: 18px;
  height: 18px;
}

.drawer-nav-item .nav-item-badge {
  margin-left: auto;
  background: var(--magenta);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
}

.mobile-drawer-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.drawer-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-user-name {
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==============================================================================
   RESPONSIVE MOBILE / PWA BREAKPOINTS (< 768px)
   ============================================================================== */

@media (max-width: 768px) {
  /* 1. Sidebar desktop Oculta al 100% */
  .sidebar, #app-sidebar {
    display: none !important;
  }

  /* 2. Botón flotante FAB visible */
  .mobile-floating-fab {
    display: flex !important;
  }

  /* Menú de opciones de envío en mobile */
  .schedule-dropdown-menu {
    position: fixed !important;
    bottom: 60px !important;
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    max-width: 340px !important;
    margin: 0 auto !important;
    z-index: 10005 !important;
  }

  /* 3. Topbar adaptada a mobile */
  .topbar {
    height: 52px;
    padding: 0 10px;
  }

  .topbar-left {
    min-width: auto;
    gap: 8px;
  }

  .menu-toggle {
    display: none !important;
  }

  .brand-logo-full {
    height: 26px;
  }

  .topbar-center {
    margin: 0 8px;
    max-width: none;
  }

  .search-box {
    height: 36px;
    padding: 0 8px;
  }

  .search-box input {
    font-size: 12px;
  }

  .search-filter-btn {
    display: none;
  }

  .org-selector-pill {
    display: none !important;
  }

  #btn-notifications {
    display: inline-flex;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .user-avatar-btn {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  /* 4. Bandeja de correos 100% viewport width y cero scroll horizontal */
  .main-body {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .mail-list-panel {
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    border-right: none !important;
    overflow-x: hidden !important;
  }

  .mail-toolbar {
    height: 42px;
    padding: 0 10px;
  }

  .mail-list-container {
    padding-bottom: 88px !important;
    overflow-x: hidden !important;
  }

  .mail-row {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    border-bottom: 1px solid #f0f1f4;
  }

  .mail-row-actions {
    gap: 6px;
  }

  .mail-sender {
    width: auto;
    flex: 1;
    font-size: 13px;
    font-weight: 700;
  }

  .mail-date {
    font-size: 11px;
    min-width: auto;
  }

  .mail-body-preview {
    width: 100%;
    margin-top: 2px;
    padding-left: 28px;
    font-size: 12px;
  }

  .mail-subject {
    font-weight: 600;
  }

  .thread-viewer-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    z-index: 1050 !important;
    border-left: none !important;
    box-shadow: none !important;
    overflow-y: auto !important;
  }

  .mobile-back-btn {
    display: inline-flex !important;
  }

  .thread-header {
    padding: 8px 12px;
    min-height: 48px;
  }

  .thread-subject {
    font-size: 15px;
  }

  .thread-collab-bar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  #composer-dock {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 2000 !important;
    box-shadow: none !important;
    border: none !important;
    display: flex;
    flex-direction: column;
  }

  .composer-body {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  #compose-body-html {
    flex: 1;
    min-height: 200px;
  }

  .modal-card {
    width: 94vw !important;
    max-width: 94vw !important;
    max-height: 90vh !important;
    margin: 10px !important;
  }
}

/* Soporte directo para clase .is-mobile en cualquier viewport */
body.is-mobile .sidebar, body.is-mobile #app-sidebar {
  display: none !important;
}

body.is-mobile .mobile-floating-fab {
  display: flex !important;
}

body.is-mobile .menu-toggle {
  display: none !important;
}

body.is-mobile .org-selector-pill {
  display: none !important;
}

body.is-mobile #btn-notifications {
  display: inline-flex !important;
}

body.is-mobile .main-body {
  width: 100vw !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

body.is-mobile .mail-list-panel {
  width: 100vw !important;
  min-width: 100vw !important;
  max-width: 100vw !important;
  border-right: none !important;
  overflow-x: hidden !important;
}

body.is-mobile .mail-list-container {
  padding-bottom: 88px !important;
  overflow-x: hidden !important;
}

body.is-mobile .mobile-back-btn {
  display: inline-flex !important;
}

body.is-mobile .thread-viewer-panel {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  min-width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  z-index: 1050 !important;
  border-left: none !important;
  box-shadow: none !important;
  overflow-y: auto !important;
}

body.is-mobile #composer-dock {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  z-index: 2000 !important;
  box-shadow: none !important;
  border: none !important;
}

body.is-mobile .modal-card {
  width: 94vw !important;
  max-width: 94vw !important;
  max-height: 90vh !important;
  margin: 10px !important;
}

/* ==============================================================================
   REGLA ESTRICTA: DESKTOP NUNCA MUESTRA BOTÓN FAB FLOTANTE
   ============================================================================== */
@media (min-width: 769px) {
  .mobile-floating-fab,
  #btn-mobile-fab {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* ==============================================================================
   SETTINGS MOBILE P0: PANTALLA COMPLETA NATIVA SIN COLUMNAS NI OVERFLOW
   ============================================================================== */
@media (max-width: 768px) {
  .settings-modal-backdrop {
    padding: 0 !important;
  }

  .settings-modal-container {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .settings-modal-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* En mobile: o se ve la lista de pestañas o se ve el contenido con botón Volver */
  .settings-tabs-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 10px 14px !important;
    gap: 6px !important;
    overflow-y: auto !important;
  }

  .settings-tab-btn {
    padding: 12px 14px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
  }

  .settings-content-area {
    flex: 1 !important;
    padding: 16px !important;
    overflow-y: auto !important;
  }

  .mobile-settings-back-header {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 0 !important;
    margin-bottom: 14px !important;
    border-bottom: 1px solid var(--line) !important;
  }

  .btn-back-settings-sections {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--magenta) !important;
    background: var(--magenta-soft) !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
  }
}

/* ==============================================================================
   USER MENU POPOVER (WACLIS ID + MAILBOX SWITCHER)
   ============================================================================== */
.user-profile-popover {
  position: fixed;
  top: 66px;
  right: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.user-profile-header {
  padding: 18px;
  text-align: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.user-profile-avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--magenta);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px auto;
  box-shadow: 0 3px 10px rgba(236, 24, 149, 0.25);
}

.user-profile-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.user-profile-email {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.user-profile-badge {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
}

.user-profile-mailboxes {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.user-profile-mailboxes-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.user-profile-mailbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.user-profile-mailbox-item:hover {
  background: #f4f4f7;
}

.user-profile-mailbox-item.active {
  background: #fdf0f8;
  font-weight: 600;
  color: var(--magenta);
}

.user-profile-actions {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-profile-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}

.user-profile-action-btn:hover {
  background: #f4f4f7;
}

.user-profile-action-btn svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

/* ==============================================================================
   SISTEMA DE ETIQUETAS (LABELS)
   ============================================================================== */
.sidebar-labels-section {
  padding: 12px 14px 6px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

.sidebar-labels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.label-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.label-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

/* ==============================================================================
   RIGHT RAIL VERTICAL (ECOSISTEMA WACLIS - CONTEXTUAL AL CORREO ABIERTO)
   ============================================================================== */
.right-rail {
  width: 48px;
  background: var(--surface, #ffffff);
  border-left: 1px solid var(--line, #e2e8f0);
  display: none; /* Oculto sin correo abierto: libera todo el ancho */
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
  flex-shrink: 0;
  z-index: 50;
  transition: opacity 0.2s ease;
}

.right-rail.visible {
  display: flex !important;
}

.rail-item-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted, #64748b);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.rail-item-btn:hover {
  background: #f1f5f9;
  color: var(--ink, #0f172a);
}

.rail-item-btn.active {
  background: rgba(236, 24, 149, 0.1);
  color: var(--magenta, #ec1895);
  border-left: 3px solid var(--magenta, #ec1895);
}

/* Iconos oficiales de Connect: Escala de grises por defecto, color en hover y active */
.rail-app-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.75;
  transition: filter 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
  user-select: none;
  pointer-events: none;
}

.rail-item-btn:hover .rail-app-icon {
  filter: none;
  opacity: 1;
  transform: scale(1.08);
}

.rail-item-btn.active .rail-app-icon {
  filter: none;
  opacity: 1;
}

.rail-item-btn[disabled] .rail-app-icon,
.rail-item-btn.disabled .rail-app-icon {
  opacity: 0.35;
  filter: grayscale(100%);
}

.rail-item-btn svg {
  width: 18px;
  height: 18px;
  filter: grayscale(100%);
  opacity: 0.75;
  transition: filter 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.rail-item-btn:hover svg {
  filter: none;
  opacity: 1;
  color: var(--ink, #0f172a);
}

.rail-item-btn.active svg {
  filter: none;
  opacity: 1;
  color: var(--magenta, #ec1895);
}

/* ==============================================================================
   CARPETAS PERSONALIZADAS (CUSTOM FOLDERS) EN SIDEBAR
   ============================================================================== */
.sidebar:not(.collapsed) .sidebar-custom-folders-section {
  padding: 12px 14px 6px;
  border-top: 1px solid var(--border-color, #e7e8ec);
  margin-top: 10px;
}

.sidebar-custom-folders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.sidebar-custom-folders-header .btn-add-folder {
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted, #64748b);
  transition: all 0.15s ease;
}

.sidebar-custom-folders-header .btn-add-folder:hover {
  background: #f1f5f9;
  color: var(--ink, #0f172a);
}

.custom-folder-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
  box-sizing: border-box;
}

.custom-folder-item:hover {
  background: var(--hover-bg, #f1f5f9);
}

.custom-folder-item.active {
  background: rgba(236, 24, 149, 0.08);
  color: var(--magenta, #ec1895);
  font-weight: 600;
}

.custom-folder-item-content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.custom-folder-title {
  font-size: 13px;
  color: var(--ink, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-folder-item.active .custom-folder-title {
  color: var(--magenta, #ec1895);
  font-weight: 600;
}

.custom-folder-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.custom-folder-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #64748b);
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 10px;
}

.custom-folder-menu-trigger {
  opacity: 0;
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.custom-folder-item:hover .custom-folder-menu-trigger {
  opacity: 1;
}

.custom-folder-menu-trigger:hover {
  background: #e2e8f0;
  color: var(--ink, #0f172a);
}

/* Modo Sidebar Colapsado */
.sidebar.collapsed .sidebar-custom-folders-section {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

.sidebar.collapsed .sidebar-custom-folders-header,
.sidebar.collapsed .custom-folders-nav {
  display: none !important;
}

.sidebar.collapsed .custom-folders-collapsed-wrapper {
  display: flex !important;
  justify-content: center;
  width: 100%;
  position: relative;
  margin-bottom: 4px;
}

.sidebar:not(.collapsed) .custom-folders-collapsed-wrapper {
  display: none !important;
}

.custom-folders-collapsed-btn {
  width: 44px !important;
  height: 40px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  border-radius: 8px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted, #64748b);
}

.custom-folders-collapsed-btn:hover {
  background: #f1f5f9;
  color: var(--ink, #0f172a);
}

.custom-folders-popover {
  position: fixed;
  left: 68px;
  top: auto;
  width: 220px;
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  padding: 8px;
  z-index: 9999;
}

.rail-divider {
  width: 24px;
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

/* ==============================================================================
   PANEL CONTEXTUAL DERECHO (RIGHT CONTEXT PANEL)
   ============================================================================== */
.right-context-panel {
  width: 380px;
  min-width: 360px;
  max-width: 420px;
  background: #fff;
  border-left: 1px solid var(--line);
  display: none;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  z-index: 60;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.04);
}

.right-context-panel.open {
  display: flex;
}

.right-panel-header {
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.right-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Elementos dentro del panel contextual */
.rail-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.rail-timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
}

.rail-tl-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f4f4f7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
}

.rail-tl-content {
  flex: 1;
}

.rail-tl-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.rail-tl-header strong {
  font-size: 12px;
  color: var(--ink);
}

.rail-tl-time {
  font-size: 10px;
  color: var(--muted);
}

.rail-tl-desc {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.rail-contact-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
}

.rail-contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--magenta);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-contact-info h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.rail-contact-email {
  margin: 2px 0 0 0;
  font-size: 11px;
  color: var(--muted);
}

.rail-section-block {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.rail-block-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.rail-field-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.rail-field-label {
  color: var(--muted);
}

.rail-field-value {
  font-weight: 600;
  color: var(--ink);
}

/* Modales y Popovers Reutilizables */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 17, 23, 0.45);
  backdrop-filter: blur(4px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleIn 0.15s ease-out;
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.color-option-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s;
}

.color-option-dot:hover {
  transform: scale(1.15);
}

.color-option-dot.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px #fff inset;
}

@media (max-width: 768px) {
  .right-rail {
    display: none !important;
  }

  .right-context-panel {
    position: fixed;
    inset: 0;
    width: 100vw !important;
    max-width: 100vw !important;
    z-index: 2200;
  }
}

/* ============================================================================
   PULL TO REFRESH (PWA ANDROID / MOBILE)
   ============================================================================ */

.ptr-indicator {
  height: 0px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #ffffff);
  border-bottom: 1px solid var(--line, #e5e7eb);
  transition: height 0.2s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s ease;
  opacity: 0;
  width: 100%;
}

.ptr-spinner-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ptr-spinner-icon {
  width: 18px;
  height: 18px;
  color: var(--magenta, #ec1895);
  transition: transform 0.1s linear;
}

.ptr-indicator.refreshing .ptr-spinner-icon {
  animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================================
   AVATARES EN LISTA DE CORREOS
   ============================================================================ */

.mail-avatar-circle {
  user-select: none;
}

.mail-avatar-img {
  user-select: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ============================================================================
   UTILIDAD DE VISIBILIDAD ESTRICTA
   ============================================================================ */
.hidden {
  display: none !important;
}

/* ============================================================================
   RECIPIENT CHIPS ESTILO GMAIL
   ============================================================================ */
.recipient-chips-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 32px;
  cursor: text;
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-hover, #f1f3f5);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 16px;
  padding: 2px 8px 2px 4px;
  font-size: 12px;
  color: var(--text-primary, #1e293b);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  max-width: 240px;
}

.recipient-chip:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.recipient-chip:focus {
  outline: 2px solid var(--magenta, #ec1895);
  outline-offset: 1px;
}

.recipient-chip.pending-delete {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.recipient-chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--magenta, #ec1895);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.recipient-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.recipient-chip-remove {
  background: none;
  border: none;
  color: var(--text-tertiary, #94a3b8);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s ease;
}

.recipient-chip-remove:hover {
  color: #ef4444;
}

.recipient-inline-input {
  flex: 1;
  min-width: 140px;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 13px;
  color: var(--text-primary, #1e293b);
  padding: 4px 0 !important;
}

/* ============================================================================
   FECHA Y HORA EN LISTADO DE MENSAJES
   ============================================================================ */
.thread-datetime-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  font-size: 11.5px;
  color: var(--text-tertiary, #64748b);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.thread-datetime-primary {
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

.thread-datetime-secondary {
  font-size: 10.5px;
  opacity: 0.85;
}

/* ============================================================================
   POPOVER DE ETIQUETAS MULTISELECT
   ============================================================================ */
.labels-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1050;
  width: 240px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 8px;
  display: none;
}

.labels-popover.active {
  display: block;
}

.label-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 6px;
  outline: none;
}

.label-search-input:focus {
  border-color: var(--magenta, #ec1895);
}

.label-options-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.label-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}

.label-option-row:hover {
  background: var(--bg-hover, #f8fafc);
}

.label-option-row input[type="checkbox"] {
  accent-color: var(--magenta, #ec1895);
  cursor: pointer;
}

.label-color-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.labels-popover-divider {
  height: 1px;
  background: var(--line, #e2e8f0);
  margin: 6px 0;
}

.btn-create-label-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: none;
  border: none;
  color: var(--magenta, #ec1895);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
}

.btn-create-label-action:hover {
  background: rgba(236, 24, 149, 0.08);
}

/* ============================================================================
   COMMAND PALETTE (CTRL+K / CMD+K)
   ============================================================================ */
.command-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.command-palette-backdrop.active {
  display: flex;
}

.command-palette-box {
  width: 580px;
  max-width: 92vw;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.command-palette-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  gap: 10px;
}

.command-palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--text-primary, #0f172a);
}

.command-palette-badge {
  font-size: 11px;
  background: var(--bg-hover, #f1f5f9);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-tertiary, #64748b);
  border: 1px solid var(--line, #e2e8f0);
}

.command-palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.command-palette-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary, #94a3b8);
  padding: 6px 8px 4px;
}

.command-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  font-size: 13.5px;
  color: var(--text-primary, #1e293b);
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--bg-hover, #f1f5f9);
}

.command-palette-item.active {
  color: var(--magenta, #ec1895);
}

.command-palette-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary, #64748b);
  flex-shrink: 0;
}

.command-palette-item.active .command-palette-icon {
  color: var(--magenta, #ec1895);
}

.command-palette-desc {
  font-size: 11px;
  color: var(--text-tertiary, #64748b);
  margin-left: auto;
}

/* ============================================================================
   PANEL DE FILTROS AVANZADOS DE BÚSQUEDA
   ============================================================================ */
.search-advanced-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  padding: 16px;
  z-index: 1020;
  display: none;
}

.search-advanced-panel.active {
  display: block;
}

.search-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.search-filter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-filter-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary, #475569);
}

.search-filter-input {
  padding: 6px 10px;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  font-size: 12.5px;
  outline: none;
}

.search-filter-input:focus {
  border-color: var(--magenta, #ec1895);
}

.search-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ==================================================================== */
/* NOTIFICATION CENTER & DEEP LINK HIGHLIGHT                            */
/* ==================================================================== */
#notifications-popover {
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: notifPopoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifPopoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes highlightTargetPulse {
  0% {
    background-color: rgba(236, 24, 149, 0.2);
  }
  60% {
    background-color: rgba(236, 24, 149, 0.08);
  }
  100% {
    background-color: transparent;
  }
}

.highlight-target-message {
  animation: highlightTargetPulse 2.5s ease-out;
  border-left: 3px solid #ec1895 !important;
}

@media (max-width: 768px) {
  #notifications-popover {
    top: 52px !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
  }
}

/* ============================================================================
   FICHA DE CONTACTO ESTILO WACLIS INBOX (UX HUMANA Y LIMPIA)
   ============================================================================ */
.contact-header-waclis {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, #fdf2f8 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line, #e2e8f0);
  margin-bottom: 14px;
  position: relative;
}

.contact-avatar-wrapper {
  position: relative;
  margin-bottom: 10px;
}

.contact-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec1895 0%, #a21caf 100%);
  color: #ffffff;
  font-size: 24px;
  font-weight: 750;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(236, 24, 149, 0.2);
  object-fit: cover;
}

.btn-avatar-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.contact-name-title {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 750;
  color: var(--ink, #1e293b);
}

.contact-company-subtitle {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 8px;
}

.contact-quick-meta {
  font-size: 11.5px;
  color: var(--ink, #1e293b);
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.contact-action-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.contact-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.contact-action-btn:hover {
  border-color: #ec1895;
  color: #ec1895;
  background: #fdf2f8;
}

.contact-action-btn.primary {
  background: #ec1895;
  color: #ffffff;
  border-color: #ec1895;
}

.contact-action-btn.primary:hover {
  background: #d81585;
}

.contact-accordion-item {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  background: #ffffff;
}

.contact-accordion-header {
  padding: 10px 14px;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #1e293b);
  cursor: pointer;
  user-select: none;
}

.contact-accordion-header:hover {
  background: #f1f5f9;
}

.contact-accordion-body {
  padding: 14px;
  font-size: 12px;
}

.contact-field-group {
  margin-bottom: 10px;
}

.contact-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #64748b);
  margin-bottom: 2px;
}

.contact-field-value {
  font-size: 12px;
  color: var(--ink, #1e293b);
}

.connected-app-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fafbfc;
}

.connected-app-card:last-child {
  margin-bottom: 0;
}

.connected-app-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connected-app-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.connected-app-badge.active {
  background: #dcfce7;
  color: #15803d;
}

.connected-app-badge.inactive {
  background: #f1f5f9;
  color: #64748b;
}

/* ============================================================================
   WACLISMAIL — EPOS UX EVOLUTION: DENSIDADES & JERARQUÍA DE LISTADO
   ============================================================================ */

/* 1. Modo Cómodo (Default) */
.mail-list-panel.density-comfortable .mail-row,
.mail-row {
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  transition: background 0.12s ease, box-shadow 0.12s ease;
  position: relative;
}

.mail-row:hover {
  background: #f8fafc;
  box-shadow: inset 2px 0 0 var(--border-normal, #cbd5e1);
}

.mail-row.unread {
  background: #ffffff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--magenta, #ec1895);
}

.mail-row.unread:hover {
  background: #faf5f8;
}

.mail-row.selected {
  background: var(--magenta-soft, #fdf2f8) !important;
  box-shadow: inset 3px 0 0 var(--magenta, #ec1895);
}

/* 2. Modo Compacto */
.mail-list-panel.density-compact .mail-row {
  height: 38px;
  padding: 0 14px;
  font-size: 12px;
}

.mail-list-panel.density-compact .mail-avatar-circle,
.mail-list-panel.density-compact .mail-avatar-img {
  width: 20px !important;
  height: 20px !important;
  font-size: 8.5px !important;
  margin-right: 6px !important;
}

.mail-list-panel.density-compact .mail-sender {
  width: 150px;
  font-size: 12px;
}

.mail-list-panel.density-compact .mail-subject {
  font-size: 12px;
}

.mail-list-panel.density-compact .mail-snippet {
  font-size: 11.5px;
}

.mail-list-panel.density-compact .mail-badges {
  margin-left: 4px;
  gap: 4px;
}

/* Acciones rápidas flotantes en hover */
.mail-row-hover-actions {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  border: 1px solid var(--border-normal, #e2e8f0);
  border-radius: 6px;
  padding: 2px 4px;
  box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,0.06));
  align-items: center;
  gap: 2px;
  z-index: 10;
}

.mail-row:hover .mail-row-hover-actions {
  display: flex;
}

.btn-row-hover {
  background: none;
  border: none;
  color: var(--muted, #64748b);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.btn-row-hover:hover {
  background: var(--canvas, #f1f5f9);
  color: var(--magenta, #ec1895);
}

/* ============================================================================
   SNOOZE / POSPONER — POPOVER & COMPONENTES
   ============================================================================ */

.snooze-popover-dropdown {
  width: 255px;
  background: #ffffff;
  border: 1px solid var(--border-normal, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 14px 35px -5px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 8px 6px;
  z-index: 99999;
  animation: snoozeFadeIn 0.12s ease-out;
  font-family: inherit;
}

@keyframes snoozeFadeIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.snooze-popover-header {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #64748b);
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  margin-bottom: 4px;
}

.snooze-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.4px;
  padding: 6px 10px 2px;
}

.snooze-option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink, #1e293b);
  font-size: 12.5px;
  font-family: inherit;
  transition: all 0.1s ease;
  text-align: left;
}

.snooze-option-btn:hover {
  background: var(--canvas, #f8fafc);
  color: var(--magenta, #ec1895);
}

.snooze-option-btn.custom-trigger {
  color: var(--magenta, #ec1895);
  font-weight: 600;
  padding: 9px 10px;
}

.snooze-option-btn.custom-trigger:hover {
  background: var(--magenta-soft, #fdf2f8);
}

.snooze-opt-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.snooze-opt-left svg {
  color: var(--muted, #64748b);
  flex-shrink: 0;
  transition: color 0.1s;
}

.snooze-option-btn:hover .snooze-opt-left svg {
  color: var(--magenta, #ec1895);
}

.snooze-opt-time {
  font-size: 11px;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.snooze-divider {
  height: 1px;
  background: var(--border-subtle, #f1f5f9);
  margin: 6px 4px;
}

.snooze-return-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
}

.snooze-return-badge svg {
  color: #3b82f6;
}

/* ============================================================================
   MOVER A... — POPOVER & COMPONENTES
   ============================================================================ */

.waclis-move-popover-dropdown {
  width: 270px;
  background: #ffffff;
  border: 1px solid var(--border-normal, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 14px 35px -5px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 8px 6px;
  z-index: 99999;
  animation: snoozeFadeIn 0.12s ease-out;
  font-family: inherit;
  display: flex;
  flex-direction: column;
}

.move-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
}

.move-popover-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #64748b);
}

.move-popover-title svg {
  color: var(--magenta, #ec1895);
}

.btn-popover-close {
  background: none;
  border: none;
  color: var(--muted, #94a3b8);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.btn-popover-close:hover {
  background: #f1f5f9;
  color: var(--ink, #1e293b);
}

.move-popover-search-box {
  display: flex;
  align-items: center;
  position: relative;
  margin: 6px 4px;
}

.move-popover-search-box .search-icon {
  position: absolute;
  left: 8px;
  color: var(--muted, #94a3b8);
  pointer-events: none;
}

.move-popover-search-input {
  width: 100%;
  height: 30px;
  padding: 0 8px 0 26px;
  border: 1px solid var(--border-normal, #e2e8f0);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink, #1e293b);
  box-sizing: border-box;
  outline: none;
  background: #f8fafc;
  transition: all 0.15s ease;
}

.move-popover-search-input:focus {
  background: #ffffff;
  border-color: var(--magenta, #ec1895);
  box-shadow: 0 0 0 2px rgba(236, 24, 149, 0.12);
}

.move-popover-scroll-area {
  max-height: 220px;
  overflow-y: auto;
  padding: 2px 2px;
}

.move-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
  letter-spacing: 0.4px;
  padding: 6px 8px 3px;
}

.move-folder-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink, #1e293b);
  font-size: 12px;
  font-family: inherit;
  transition: all 0.1s ease;
  text-align: left;
  box-sizing: border-box;
  position: relative;
}

.move-folder-item:hover,
.move-folder-item.highlighted {
  background: var(--canvas, #f8fafc);
  color: var(--magenta, #ec1895);
}

.move-folder-item svg {
  color: var(--muted, #64748b);
  flex-shrink: 0;
}

.move-folder-item:hover svg,
.move-folder-item.highlighted svg {
  color: var(--magenta, #ec1895);
}

.move-folder-item .folder-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.move-folder-item .folder-count {
  font-size: 10.5px;
  color: var(--muted, #94a3b8);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.folder-actions-hover {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
}

.move-folder-item:hover .folder-actions-hover {
  display: flex;
}

.btn-folder-action {
  background: none;
  border: none;
  color: var(--muted, #94a3b8);
  padding: 2px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-folder-action:hover {
  background: #e2e8f0;
  color: var(--ink, #1e293b);
}

.btn-folder-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.move-popover-divider {
  height: 1px;
  background: var(--border-subtle, #f1f5f9);
  margin: 4px 4px;
}

.move-popover-loading,
.move-popover-empty {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted, #94a3b8);
  text-align: center;
  font-style: italic;
}

.move-popover-footer {
  padding: 4px 4px 2px;
}

.btn-toggle-new-folder {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--magenta, #ec1895);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.1s ease;
}

.btn-toggle-new-folder:hover {
  background: var(--magenta-soft, #fdf2f8);
}

.move-new-folder-subpanel {
  padding: 4px 4px 2px;
  animation: snoozeFadeIn 0.1s ease-out;
}

.subpanel-input {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--magenta, #ec1895);
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink, #1e293b);
  box-sizing: border-box;
  outline: none;
  margin-bottom: 6px;
}

.subpanel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.btn-subpanel-cancel {
  background: #f1f5f9;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted, #64748b);
  cursor: pointer;
}

.btn-subpanel-cancel:hover {
  background: #e2e8f0;
  color: var(--ink, #1e293b);
}

.btn-subpanel-create {
  background: var(--magenta, #ec1895);
  border: none;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-subpanel-create:hover {
  opacity: 0.9;
}

.btn-subpanel-create:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================
   WACLIS ATTACHMENT VIEWER & CARDS (PDF.JS + SHEETJS + IMAGES)
   ============================================================================ */

.waclis-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
}

.viewer-container {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #f8fafc;
}

.viewer-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.viewer-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  overflow: hidden;
}

.viewer-type-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.viewer-file-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-filename {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-meta {
  font-size: 11px;
  color: #94a3b8;
}

.viewer-toolbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-viewer-action {
  height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.12s ease;
}

.btn-viewer-action:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-viewer-action.primary {
  background: var(--magenta, #ec1895);
  border-color: var(--magenta, #ec1895);
  color: #ffffff;
}

.btn-viewer-action.primary:hover {
  background: var(--magenta-dark, #db168a);
}

.btn-viewer-action.icon-only {
  width: 34px;
  padding: 0;
  justify-content: center;
  font-size: 16px;
}

.viewer-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.viewer-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
  z-index: 10;
}

.viewer-nav-btn:hover {
  background: rgba(236, 24, 149, 0.85);
  border-color: rgba(236, 24, 149, 1);
  transform: translateY(-50%) scale(1.05);
}

.viewer-nav-btn.prev { left: 24px; }
.viewer-nav-btn.next { right: 24px; }

.viewer-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #cbd5e1;
  font-size: 13px;
}

.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--magenta, #ec1895);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Controles de Zoom */
.viewer-zoom-controls,
.pdf-viewer-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 3px 6px;
}

.btn-zoom,
.btn-pdf-page {
  background: none;
  border: none;
  color: #f8fafc;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  transition: background 0.1s;
}

.btn-zoom:hover,
.btn-pdf-page:hover {
  background: rgba(255, 255, 255, 0.15);
}

.zoom-level,
.pdf-page-display {
  font-size: 11.5px;
  color: #cbd5e1;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.pdf-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 4px;
}

/* Tabs de hojas de cálculo */
.sheet-tabs-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
}

.btn-sheet-tab {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.1s;
}

.btn-sheet-tab:hover {
  color: #ffffff;
}

.btn-sheet-tab.active {
  background: var(--magenta, #ec1895);
  color: #ffffff;
}

/* ============================================================================
   EXPERIENCIA MÓVIL DEDICADA (ICEWARP EPOS BENCHMARK INSPIRATION)
   ============================================================================ */

@media (max-width: 768px) {
  /* Header móvil dedicado */
  .mobile-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 12px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle, #f1f5f9);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  /* Listado móvil con filas optimizadas al tacto */
  .mail-row {
    height: auto !important;
    min-height: 64px;
    padding: 10px 14px !important;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .mail-row-actions {
    margin-right: 8px;
    align-self: center;
  }

  .mail-sender-wrapper {
    flex: 1;
    min-width: 140px;
  }

  .mail-avatar-circle,
  .mail-avatar-img {
    width: 32px !important;
    height: 32px !important;
    font-size: 11px !important;
  }

  .mail-date {
    margin-left: auto;
    font-size: 11px !important;
  }

  .mail-body-preview {
    width: 100%;
    margin-top: 4px;
    margin-left: 40px;
    margin-right: 0;
  }

  /* Compositor full-screen en móvil */
  .composer-dock {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 10000 !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
  }

  .composer-header {
    height: 52px;
    padding: 0 16px;
  }

  .composer-footer {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  /* Reading pane: barra de acciones fija abajo con safe area */
  .reading-pane-mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #ffffff;
    border-top: 1px solid var(--border-subtle, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
  }

  .btn-mobile-bottom-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted, #64748b);
    cursor: pointer;
  }

  .btn-mobile-bottom-action:hover,
  .btn-mobile-bottom-action.primary {
    color: var(--magenta, #ec1895);
  }
}

/* ==============================================================================
   PLANTILLAS — RIGHT DRAWER FULL HEIGHT (EXPERIENCIA WACLIS ANCLADA DERECHA)
   ============================================================================== */
.templates-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 10000;
  display: none !important;
  justify-content: flex-end;
  align-items: stretch;
  padding: 0;
  pointer-events: none !important;
}

.templates-drawer-backdrop.open {
  display: flex !important;
  pointer-events: auto !important;
  animation: fadeInBackdrop 0.2s ease;
}

.templates-drawer-backdrop:not(.open),
.templates-drawer-backdrop[style*="display: none"],
.templates-drawer-backdrop[style*="display:none"] {
  display: none !important;
  pointer-events: none !important;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.templates-drawer-panel {
  width: 1040px !important;
  max-width: 95vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  margin: 0 0 0 auto !important;
  background: #ffffff !important;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.22) !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 0 !important;
  border: none !important;
  border-left: 1px solid var(--line, #e2e8f0) !important;
  animation: slideInDrawer 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

@keyframes slideInDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@media (max-width: 900px) {
  .templates-drawer-panel {
    width: 95vw;
    max-width: 95vw;
  }
}

@media (max-width: 768px) {
  .templates-drawer-panel {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
  }
}
