/* ============================================================
   LexIA — Internal Dashboard Stylesheet
   ============================================================ */

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;

  --bg: #f4f5f7;
  --bg-alt: #eef0f4;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --muted: #6b7280;

  /* LexIA brand colours */
  --navy:       #1B2B4A;
  --navy-dark:  #13203A;
  --navy-light: #243659;
  --gold:       #C9A84C;
  --gold-dark:  #A8872C;
  --gold-bg:    rgba(201,168,76,.15);

  /* Priority colours */
  --p0-bg: #fef2f2;   --p0-border: #fca5a5;   --p0-badge: #dc2626;  --p0-text: #7f1d1d;
  --p1-bg: #fff7ed;   --p1-border: #fdba74;   --p1-badge: #ea580c;  --p1-text: #7c2d12;
  --p2-bg: #fefce8;   --p2-border: #fde047;   --p2-badge: #ca8a04;  --p2-text: #713f12;
  --p3-bg: #f0fdf4;   --p3-border: #86efac;   --p3-badge: #16a34a;  --p3-text: #14532d;

  --primary: var(--gold);
  --primary-dark: var(--gold-dark);
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
}

/* ============================================================
   Dark Mode
   ============================================================ */
[data-theme="dark"] {
  --bg:         #0f1117;
  --bg-alt:     #191d27;
  --surface:    #1c2131;
  --border:     #2d3347;
  --text:       #dde2ed;
  --text-muted: #8892a4;
  --text-light: #5f6b7c;
  --muted:      #8892a4;

  /* Gold stays the same — it works great on dark */
  --gold-bg:    rgba(201,168,76,.20);

  /* Priority colours — darker tints for dark mode */
  --p0-bg: #2d1212;   --p0-border: #7f1d1d;   --p0-text: #fca5a5;
  --p1-bg: #2c1a0a;   --p1-border: #7c2d12;   --p1-text: #fdba74;
  --p2-bg: #2a2209;   --p2-border: #713f12;   --p2-text: #fde047;
  --p3-bg: #0d2318;   --p3-border: #14532d;   --p3-text: #86efac;

  --danger: #f87171;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.6);
}

/* Inputs & selects on dark mode */
[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--border);
  color-scheme: dark;
}

/* ============================================================
   Lucide Icons
   ============================================================ */
.icon {
  display: inline-block; vertical-align: middle; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon svg { display: block; }

/* Group label icons (VISTAS, PRIORIDADES…) */
.icon--group { width: 15px; height: 15px; margin-right: .45rem; }

/* Nav item icons (Clientes, Asistente…) */
.icon--item  { width: 15px; height: 15px; margin-right: .55rem; }

/* ── Icon color modifiers ─────────────────────────────── */
.icon--blue   { color: #3B82F6; }
.icon--red    { color: #EF4444; }
.icon--orange { color: #F97316; }
.icon--green  { color: #10B981; }
.icon--amber  { color: #F59E0B; }
.icon--gold   { color: #C9A84C; }
.icon--violet { color: #8B5CF6; }
.icon--slate  { color: #6B7280; }
.icon--rose   { color: #EC4899; }

/* Dark mode: bump to -400 tones for brightness */
[data-theme="dark"] .icon--blue   { color: #60A5FA; }
[data-theme="dark"] .icon--red    { color: #F87171; }
[data-theme="dark"] .icon--orange { color: #FB923C; }
[data-theme="dark"] .icon--green  { color: #34D399; }
[data-theme="dark"] .icon--amber  { color: #FBBF24; }
[data-theme="dark"] .icon--gold   { color: #D4A853; }
[data-theme="dark"] .icon--violet { color: #A78BFA; }
[data-theme="dark"] .icon--slate  { color: #94A3B8; }
[data-theme="dark"] .icon--rose   { color: #F472B6; }

/* Top favorites bar icons */
.icon--fav   { width: 13px; height: 13px; margin-right: .28rem; vertical-align: -1px; }

/* Bottom nav tab icons */
.icon--nav   { width: 22px; height: 22px; }

/* Theme toggle icon */
.icon--theme { width: 17px; height: 17px; }

/* ── v90: Urgency dot — inline colored circle, replaces emojis ── */
.urg-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
  vertical-align: middle; margin-right: .35rem;
}
.urg-dot-p0     { background: var(--p0-badge); }
.urg-dot-p1     { background: var(--p1-badge); }
.urg-dot-p2     { background: var(--p2-badge); }
.urg-dot-p3     { background: #9ca3af; }
.urg-dot-red    { background: #dc2626; }
.urg-dot-orange { background: #ea580c; }
.urg-dot-yellow { background: #ca8a04; }

/* Priority colored dots (replace emoji circles) */
.ntp-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: .55rem; flex-shrink: 0; vertical-align: middle;
}
.nav-tree-priority--p0 .ntp-dot { background: var(--p0-badge); }
.nav-tree-priority--p1 .ntp-dot { background: var(--p1-badge); }
.nav-tree-priority--p2 .ntp-dot { background: var(--p2-badge); }
.nav-tree-priority--p3 .ntp-dot { background: #9ca3af; }

/* Bottom nav: center the SVG icon */
.bottom-nav-icon {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; line-height: 1;
}

/* Toggle button (top bar, desktop) */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; cursor: pointer;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-size: 1.05rem; line-height: 1;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
[data-theme="dark"] .theme-toggle { color: rgba(255,255,255,.8); }
[data-theme="dark"] .theme-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }

/* Próximas funciones card en el drawer */
.drawer-proximas-card {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 12px 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 100%);
  border-radius: 10px;
  text-decoration: none;
  transition: opacity .15s;
  flex-shrink: 0;
}
.drawer-proximas-card:hover { opacity: .88; }
.drawer-proximas-icon {
  width: 30px; height: 30px; border-radius: 7px;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.drawer-proximas-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.drawer-proximas-title { font-size: .82rem; font-weight: 700; color: #fff; line-height: 1.2; }
.drawer-proximas-sub   { font-size: .7rem; color: rgba(255,255,255,.7); margin-top: 1px; }

/* Theme row at drawer footer */
.nav-drawer-theme-row {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; padding: .85rem 1.3rem;
  background: none; border: none; border-top: 1px solid var(--border);
  color: var(--text); font-size: .9rem; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .12s;
}
.nav-drawer-theme-row:hover { background: var(--bg-alt); }
.nav-drawer-theme-label { font-size: 1.05rem; flex-shrink: 0; }
.nav-drawer-theme-text  { flex: 1; }
/* Pill toggle visual */
.nav-drawer-theme-toggle-pill {
  position: relative; display: inline-block;
  width: 36px; height: 20px; flex-shrink: 0;
  background: var(--border); border-radius: 10px;
  transition: background .25s;
}
.nav-drawer-theme-toggle-pill::after {
  content: ''; position: absolute;
  left: 3px; top: 3px;
  width: 14px; height: 14px;
  background: var(--surface); border-radius: 50%;
  transition: transform .25s, background .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
[data-theme="dark"] .nav-drawer-theme-toggle-pill {
  background: var(--gold);
}
[data-theme="dark"] .nav-drawer-theme-toggle-pill::after {
  transform: translateX(16px);
}

/* Dark mode — drawer specific fixes */
[data-theme="dark"] .nav-group-label { color: var(--gold); }
[data-theme="dark"] .nav-tree-item:hover { background: var(--bg-alt); color: var(--gold); }
[data-theme="dark"] .nav-tree-sub-item:hover { background: var(--bg-alt); color: var(--gold); }
[data-theme="dark"] .nav-drawer-search-input:focus { border-color: var(--gold); }
[data-theme="dark"] .nav-drawer-logout:hover { background: rgba(220,38,38,.15); color: #f87171; }
[data-theme="dark"] .nav-tree-priority--p0:hover { background: var(--p0-bg) !important; color: var(--p0-text) !important; }
[data-theme="dark"] .nav-tree-priority--p1:hover { background: var(--p1-bg) !important; color: var(--p1-text) !important; }
[data-theme="dark"] .nav-tree-priority--p2:hover { background: var(--p2-bg) !important; color: var(--p2-text) !important; }
[data-theme="dark"] .nav-tree-priority--p3:hover { background: var(--p3-bg) !important; color: var(--p3-text) !important; }

html {
  overflow-x: hidden;
  background: var(--bg);
}
/* Escala global de texto vía html — sin zoom en ningún elemento */
html[data-fontsize="small"] { font-size: 100%; }
html[data-fontsize="normal"] { font-size: 108%; }
html[data-fontsize="large"] { font-size: 115%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  max-width: 100%;
  overflow-x: hidden;
}

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

/* --- Layout ------------------------------------------------ */
.site-header {
  background: var(--navy);
  border-bottom: 2px solid var(--navy-dark);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  width: 100%;
  padding: 0 1.5rem;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  box-sizing: border-box;
}

.logo {
  font-size: 1.1rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: .4rem;
}
.logo-img { height: 40px; width: auto; display: block; border-radius: 4px; }
.logo-text { font-weight: 700; font-size: 1.15rem; color: #fff; letter-spacing: -.01em; }
.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-brand .logo-img { height: 130px; width: 130px; border-radius: 50%; display: inline-block; object-fit: cover; background: transparent; }

/* ── Barra de favoritos ─────────────────────────────────── */
.nav-favorites {
  display: flex; align-items: center; gap: .35rem;
  flex: 1; overflow: hidden;
}
.nav-fav-link {
  color: rgba(255,255,255,.82); font-size: .82rem;
  padding: .28rem .6rem; border-radius: 4px;
  white-space: nowrap; flex-shrink: 0;
  transition: color .15s, background .15s;
}
.nav-fav-link:hover { color: #fff; background: rgba(255,255,255,.14); }

/* ── Búsqueda en header ─────────────────────────────────── */

/* ── Botón hamburguesa ──────────────────────────────────── */
.nav-hamburger {
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; gap: 5px;
  width: 38px; height: 38px; flex-shrink: 0;
  background: transparent; border: none; cursor: pointer;
  border-radius: 6px; padding: 6px;
  transition: background .15s;
}
.nav-hamburger:hover { background: rgba(255,255,255,.14); }
.nav-hamburger span {
  display: block; width: 20px; height: 2px;
  background: rgba(255,255,255,.85); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* ── Overlay (fondo oscuro) ─────────────────────────────── */
.nav-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,.45);
  animation: overlay-in .2s ease;
}
.nav-overlay.open { display: block; }
#swipe-open-handle {
  position: fixed; top: 0; left: 0;
  width: 48px; height: 100%; z-index: 198;
  touch-action: none;
  display: flex; align-items: center; justify-content: flex-start;
  cursor: pointer;
}
body.drawer-open #swipe-open-handle { display: none; }

#swipe-tab {
  width: 20px; height: 64px;
  background: var(--sidebar-bg, #1B2B4A);
  border-radius: 0 10px 10px 0;
  box-shadow: 3px 0 12px rgba(0,0,0,.22);
  display: flex; align-items: center; justify-content: center;
  transition: width .18s ease, opacity .18s ease;
  opacity: .85;
}
#swipe-open-handle:active #swipe-tab { width: 28px; opacity: 1; }

.swipe-tab-lines {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.swipe-tab-lines span {
  display: block; width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Drawer lateral ─────────────────────────────────────── */
.nav-drawer {
  position: fixed; top: 0; left: 0; z-index: 200;
  width: 280px; max-width: 90vw; height: 100dvh;
  background: var(--surface); display: flex; flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,.18);
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden; /* nav-tree scrolls internally */
}
.nav-drawer.open { transform: translateX(0); }
body.drawer-open { overflow: hidden; }

.nav-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem .75rem;
  background: var(--navy); color: #fff;
  flex-shrink: 0;
}
.nav-drawer-user { font-weight: 600; font-size: .95rem; flex: 1; min-width: 0; }

.nav-drawer-close {
  background: transparent; border: none; color: rgba(255,255,255,.7);
  font-size: 1.1rem; cursor: pointer; padding: .2rem .4rem;
  border-radius: 4px; line-height: 1;
  transition: color .15s, background .15s;
}
.nav-drawer-close:hover { color: #fff; background: rgba(255,255,255,.15); }

/* ── Búsqueda en el drawer ──────────────────────────────── */
.nav-drawer-search {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-drawer-search-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-alt); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px;
  padding: .4rem .75rem; font-size: .88rem;
}
.nav-drawer-search-input:focus {
  outline: none; border-color: var(--navy);
  background: var(--surface);
}

/* ── Árbol del menú ─────────────────────────────────────── */
.nav-tree {
  display: block !important;   /* fuerza block (anula nav { flex }) */
  flex: 1; padding: .5rem 0; overflow-y: auto;
}
.nav-group { display: block; margin-bottom: .1rem; }
.nav-group-label {
  display: block;
  font-size: .72rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--navy);
  padding: .9rem 1.1rem .3rem 1rem;
  border-top: 1px solid var(--border);
}
.nav-group:first-child .nav-group-label { border-top: none; }
.nav-tree-item {
  display: block; padding: .55rem 1.1rem .55rem 1rem;
  color: var(--text); font-size: .9rem;
  transition: background .12s, color .12s;
}
.nav-tree-item:hover { background: var(--bg-alt); color: var(--navy); }

/* ── Colapsar / Expandir todo ────────────────────────────── */
.nav-tree-controls {
  display: flex; gap: .5rem;
  padding: .25rem 1rem .4rem;
  justify-content: flex-end;
}
.nav-ctrl-btn {
  font-size: .73rem; font-weight: 600; letter-spacing: .01em;
  padding: .28rem .75rem;
  border-radius: 20px; border: none;
  cursor: pointer; transition: opacity .15s, transform .1s;
  line-height: 1.5;
}
.nav-ctrl-btn:active { transform: scale(.95); }
.nav-ctrl-btn--collapse {
  background: var(--navy); color: #fff;
}
.nav-ctrl-btn--collapse:hover { opacity: .85; }
.nav-ctrl-btn--expand {
  background: var(--gold); color: var(--navy);
}
.nav-ctrl-btn--expand:hover { opacity: .88; }

/* ── Divisor dentro del nav ───────────────────────────────── */
.nav-divider {
  height: 1px; background: var(--border);
  margin: .3rem 1.8rem .3rem 1.8rem;
  opacity: .55;
}

/* ── Salir — al pie del drawer, aislado ──────────────────── */
/* TEMPORAL PRUEBAS — botón limpiar datos. Eliminar con el endpoint. Ver replit.md */
.nav-drawer-clear-test {
  display: flex; align-items: center; gap: .7rem;
  width: 100%; padding: .75rem 1.3rem;
  background: none; border: none; border-top: 1px solid var(--border);
  color: #92400e; font-size: .85rem; text-align: left; cursor: pointer;
  transition: background .12s;
}
.nav-drawer-clear-test:hover { background: #fef3c7; }
.nav-drawer-clear-test-text { display: flex; flex-direction: column; gap: .1rem; }
.nav-drawer-clear-test-title { font-weight: 600; font-size: .85rem; }
.nav-drawer-clear-test-hint  { font-size: .73rem; color: #b45309; opacity: .85; }
[data-theme="dark"] .nav-drawer-clear-test { color: #fbbf24; }
[data-theme="dark"] .nav-drawer-clear-test:hover { background: rgba(251,191,36,.08); }
[data-theme="dark"] .nav-drawer-clear-test-hint  { color: #d97706; }

.nav-drawer-logout {
  display: block;
  padding: .85rem 1.3rem;
  color: #c0392b; font-size: .9rem; font-weight: 500;
  border-top: 1px solid var(--border);
  text-decoration: none;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.nav-drawer-logout:hover { background: #fdf0ef; color: #922b21; }
/* L2 (sub-items directly in group, e.g. Vistas sub-items) */
.nav-tree-sub-item {
  display: block; padding: .38rem 1.1rem .38rem 1.5rem;
  color: var(--text-muted); font-size: .83rem;
  border-left: 2px solid var(--border);
  margin-left: 1rem;
  transition: background .12s, color .12s;
}
/* L4 (sub-items inside section-children: Gmail, Importar correos…) */
.nav-section-children .nav-tree-sub-item {
  margin-left: 2.5rem;
  padding-left: .5rem;
  border-left: 2px solid var(--border);
}
.nav-tree-sub-item:hover { background: var(--bg-alt); color: var(--navy); }

/* L3: Email, WhatsApp, Gestión */
.nav-tree-subgroup {
  display: block;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .55rem 1.1rem .3rem .5rem;
  margin-left: 2rem;
  border-left: 2px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: color .12s, background .12s;
}
.nav-tree-subgroup:hover { color: var(--navy); background: var(--bg-alt); }
[data-theme="dark"] .nav-tree-subgroup:hover { color: var(--gold); }

/* ── L2: Mini section header — Mensajes, Notificaciones, Personalización */
.nav-tree-section {
  display: flex; align-items: center; gap: .35rem;
  padding: .55rem 1rem .2rem .5rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid var(--border);
  margin-left: 1rem;
  margin-top: .25rem;
  transition: color .12s;
}
.nav-group-label + .nav-tree-section { margin-top: 0; }
.nav-tree-section:hover { color: var(--navy); }
[data-theme="dark"] .nav-tree-section:hover { color: var(--gold); }
.nav-tree-section.nav-section-toggle { cursor: pointer; user-select: none; }
.nav-section-chevron {
  margin-left: auto; flex-shrink: 0;
  opacity: .5; transition: transform .2s ease, opacity .15s;
}
.nav-tree-section.open .nav-section-chevron { transform: rotate(90deg); opacity: .85; }
.nav-section-children {
  overflow: hidden; max-height: 0;
  transition: max-height .25s ease;
}
.nav-section-children.open { max-height: 800px; }

/* ── Biometric offer bottom sheet ────────────────────────── */
.bio-offer-overlay {
  position: fixed; inset: 0; z-index: 2999;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.bio-offer-overlay.open { opacity: 1; pointer-events: all; }
.bio-offer-sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 3000;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.18);
  padding: 1.5rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.bio-offer-sheet.open { transform: translateY(0); }

/* ── Collapsible nav children ─────────────────────────────── */
.nav-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s ease;
}
.nav-children.nav-open { max-height: 800px; }

/* Level 1: group labels become toggles */
.nav-group-label.nav-collapsible {
  display: flex; align-items: center;
  cursor: pointer; user-select: none;
}

/* Level 2: item parents */
.nav-tree-item.nav-has-children {
  display: flex; align-items: center;
  cursor: pointer; user-select: none;
}

/* Shared chevron — gold, right after the text */
.nav-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: .95rem; font-weight: 700;
  color: var(--gold);
  margin-left: auto;
  padding: .25rem .5rem;
  line-height: 1;
  transition: transform .2s ease;
  transform: rotate(0deg);
  cursor: pointer;
  min-width: 32px; min-height: 32px;
}
.nav-chevron.open { transform: rotate(90deg); }

/* ── Items de prioridad en el drawer ────────────────────── */
.nav-tree-priority {
  display: flex !important;
  justify-content: space-between; align-items: center;
}
.ntp-label { flex: 1; }
.ntp-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 .4rem;
  border-radius: 20px; font-size: .75rem; font-weight: 700;
  margin-left: .5rem;
}
.nav-tree-priority--p0 .ntp-count { background: #c0392b; color: #fff; }
.nav-tree-priority--p1 .ntp-count { background: #e67e22; color: #fff; }
.nav-tree-priority--p2 .ntp-count { background: #d4ac0d; color: #fff; }
.nav-tree-priority--p3 .ntp-count { background: #95a5a6; color: #fff; }
.nav-tree-priority--p0:hover { background: #fdf0ef !important; color: #c0392b !important; }
.nav-tree-priority--p1:hover { background: #fef5ec !important; color: #e67e22 !important; }
.nav-tree-priority--p2:hover { background: #fefde7 !important; color: #b7950b !important; }
.nav-tree-priority--p3:hover { background: var(--bg-alt) !important; }

/* ── Botón CTA "Nuevo mensaje" en drawer ────────────────── */


/* ═══════════════════════════════════════════════════════════
   Feedback form
   ═══════════════════════════════════════════════════════════ */
.feedback-page {
  max-width: 640px; margin: 0 auto; padding: 1.5rem 1rem 3rem;
}
.feedback-header { text-align: center; margin-bottom: 2rem; }
.feedback-header-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.feedback-title {
  font-size: 1.5rem; font-weight: 800; color: var(--navy);
  margin: 0 0 .4rem;
}
.feedback-subtitle {
  color: var(--text-muted); font-size: .95rem; margin: 0;
  line-height: 1.5;
}
.feedback-success {
  display: flex; align-items: flex-start; gap: .8rem;
  background: #f0fdf4; border: 1px solid #86efac;
  border-radius: 10px; padding: 1rem 1.2rem;
  margin-bottom: 1.5rem; color: #15803d;
}
.feedback-success-icon { font-size: 1.2rem; flex-shrink: 0; }
.feedback-form { display: flex; flex-direction: column; gap: 1.5rem; }

.feedback-vote-link {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--text-muted);
}
.fvl-link {
  color: #7c3aed; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.fvl-link:hover { text-decoration: underline; }

/* Type selector */
.fb-type-fieldset { border: none; margin: 0; padding: 0; }
.fb-legend {
  font-weight: 700; color: var(--navy); margin-bottom: .75rem;
  font-size: .95rem; display: block;
}
.fb-type-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .65rem;
}
@media (max-width: 480px) { .fb-type-grid { grid-template-columns: 1fr; } }
.fb-type-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: .2rem; padding: .85rem 1rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; background: var(--surface);
  transition: border-color .12s, box-shadow .12s, background .12s;
  position: relative;
}
.fb-type-card input[type="radio"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.fb-type-card:hover {
  border-color: var(--navy); background: var(--bg-alt);
}
.fb-type-card--selected {
  border-color: var(--gold) !important;
  background: #fffbeb !important;
  box-shadow: 0 0 0 3px rgba(201,168,76,.18);
}
.fb-type-icon { font-size: 1.4rem; line-height: 1; }
.fb-type-label {
  font-weight: 700; font-size: .9rem; color: var(--navy);
}
.fb-type-desc {
  font-size: .78rem; color: var(--text-muted); line-height: 1.3;
}

/* Textarea */
.fb-field { display: flex; flex-direction: column; gap: .4rem; }
.fb-label {
  font-weight: 700; color: var(--navy); font-size: .95rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.fb-label-hint {
  font-weight: 400; font-size: .8rem; color: var(--text-muted);
}
.fb-textarea {
  width: 100%; padding: .85rem 1rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: .95rem; resize: vertical;
  color: var(--text); background: var(--surface);
  transition: border-color .12s;
  box-sizing: border-box;
}
.fb-textarea:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27,43,74,.08);
}
.fb-char-count {
  font-size: .78rem; color: var(--text-muted); text-align: right;
}
.fb-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.fb-submit { min-width: 180px; }
.fb-cancel { background: var(--bg-alt); color: var(--text); }
.fb-cancel:hover { background: var(--border); }

/* ── Admin feedback page ─────────────────────────────────── */
.fb-admin-page { display: flex; flex-direction: column; gap: 1.5rem; }

/* Hero / cabecera */
.fb-admin-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  background: linear-gradient(135deg, #0a2342 0%, #143054 100%);
  border-radius: 16px; padding: 1.4rem 1.6rem;
  box-shadow: 0 4px 18px rgba(10,35,66,.18);
}
.fb-admin-hero-left { display: flex; align-items: center; gap: 1rem; }
.fb-admin-hero-icon {
  flex-shrink: 0;
  background: rgba(255,255,255,.08); border-radius: 12px;
  padding: .5rem; display: flex;
}
.fb-admin-hero-title {
  font-size: 1.2rem; font-weight: 800; color: #fff;
  margin: 0 0 .18rem; letter-spacing: -.01em;
}
.fb-admin-hero-sub { font-size: .8rem; color: rgba(255,255,255,.6); margin: 0; }
.fb-admin-unread-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--gold); color: #0a2342;
  padding: .35rem .9rem; border-radius: 999px;
  font-size: .82rem; font-weight: 800;
  box-shadow: 0 2px 8px rgba(201,162,39,.35);
}

/* Empty state profesional */
.fb-empty-wrap { display: flex; justify-content: center; padding: 1rem 0 2rem; }
.fb-empty-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 20px; max-width: 540px; width: 100%;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(10,35,66,.07);
}
.fb-empty-illustration {
  background: linear-gradient(160deg, #f0f4fb 0%, #e8eef8 100%);
  padding: 2.5rem 2rem 2rem;
  display: flex; justify-content: center;
  border-bottom: 1.5px solid var(--border);
}
.fb-empty-svg { width: 100%; max-width: 260px; height: auto; }
.fb-empty-body { padding: 2rem 2rem 2.2rem; }
.fb-empty-title {
  font-size: 1.22rem; font-weight: 800; color: var(--navy);
  margin: 0 0 .6rem; letter-spacing: -.01em;
}
.fb-empty-desc {
  font-size: .92rem; color: var(--text-muted);
  line-height: 1.65; margin: 0 0 1.4rem;
}
.fb-empty-tags {
  display: flex; flex-wrap: wrap; gap: .5rem;
}

/* Tarjetas de mensajes */
.fb-admin-list { display: flex; flex-direction: column; gap: 1rem; }
.fb-admin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.1rem 1.25rem;
  transition: box-shadow .12s, transform .1s;
}
.fb-admin-card--unread {
  border-left: 4px solid var(--gold); background: #fffdf5;
}
.fb-admin-card:hover { box-shadow: 0 4px 16px rgba(10,35,66,.09); transform: translateY(-1px); }
.fb-admin-card-top {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem;
}
.fb-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .78rem; font-weight: 700;
  padding: .2rem .65rem; border-radius: 999px;
}
.fb-tag--idea    { background: #eff6ff; color: #1d4ed8; }
.fb-tag--feature { background: #f0fdf4; color: #15803d; }
.fb-tag--bug     { background: #fef2f2; color: #dc2626; }
.fb-tag--comment { background: #f5f3ff; color: #6d28d9; }
.fb-tag--other   { background: #f1f5f9; color: #475569; }
.fb-admin-meta {
  display: flex; align-items: center; gap: .6rem;
  font-size: .82rem; color: var(--text-muted);
}
.fb-admin-author { font-weight: 600; color: var(--navy); }
.fb-admin-date   { color: var(--text-muted); }
.fb-admin-new-dot { color: var(--gold); font-size: .7rem; }
.fb-admin-message {
  color: var(--text); line-height: 1.6;
  white-space: pre-wrap; margin: 0;
}
.fb-admin-read-label {
  font-size: .8rem; color: var(--text-muted);
  margin-top: .5rem; display: inline-block;
}

/* ── Autocomplete remitente ─────────────────────────────── */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 300;
  background: var(--surface); border: 1.5px solid var(--navy);
  border-top: none; border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
  max-height: 220px; overflow-y: auto;
}
.autocomplete-item {
  padding: .55rem 1rem; cursor: pointer;
  font-size: .9rem; color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.active { background: #eef2f8; color: var(--navy); }
.autocomplete-hint {
  font-size: .78rem; margin-top: .25rem;
  display: block; min-height: 1.1em;
}

/* ── Badges de prioridad en barra ──────────────────────── */
.nav-priority-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
  transition: background .15s, color .15s, opacity .15s;
  opacity: .55; letter-spacing: .02em;
}
.nav-priority-badge--active { opacity: 1; }
.nav-badge-count {
  display: inline-block; min-width: 1.1em; text-align: center;
  font-size: .8em;
}
/* P0 siempre rojo */
.nav-priority-badge--p0 {
  background: rgba(192,57,43,.25); color: #ff7a6b;
  border: 1px solid rgba(192,57,43,.4);
}
.nav-priority-badge--p0.nav-priority-badge--active {
  background: rgba(192,57,43,.55); color: #fff;
  border-color: transparent;
}
/* P1 naranja */
.nav-priority-badge--p1 {
  background: rgba(211,84,0,.22); color: #ffaa55;
  border: 1px solid rgba(211,84,0,.35);
}
.nav-priority-badge--p1.nav-priority-badge--active {
  background: rgba(211,84,0,.55); color: #fff;
  border-color: transparent;
}
/* P2 amarillo */
.nav-priority-badge--p2 {
  background: rgba(180,140,0,.22); color: #d4b840;
  border: 1px solid rgba(180,140,0,.35);
}
.nav-priority-badge--p2.nav-priority-badge--active {
  background: rgba(180,140,0,.5); color: #fff;
  border-color: transparent;
}
/* P3 gris */
.nav-priority-badge--p3 {
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.2);
}
.nav-priority-badge--p3.nav-priority-badge--active {
  background: rgba(255,255,255,.25); color: #fff;
  border-color: transparent;
}

/* ── Drag-and-drop orden de grupos del menú ────────────── */
.go-sortable {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .4rem;
  max-width: 320px;
}
.go-item {
  display: flex; align-items: center; gap: .65rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .6rem .9rem;
  cursor: grab; user-select: none;
  transition: box-shadow .12s, background .12s;
  font-size: .95rem; font-weight: 500; color: var(--text);
}
.go-item:active { cursor: grabbing; }
.go-item.go-dragging {
  opacity: .45; box-shadow: 0 4px 14px rgba(27,43,74,.15);
}
.go-item.go-over {
  background: var(--bg-alt); border-color: var(--gold);
}
.go-handle {
  font-size: 1.1rem; color: #b0bac8;
  flex-shrink: 0; line-height: 1;
}
.go-label { flex: 1; }

/* ── Numeración automática de favoritos (móvil = 1-3) ──── */
#favSortable { counter-reset: fav-pos; }
#favSortable .go-item { counter-increment: fav-pos; }
#favSortable .go-item::before {
  content: counter(fav-pos);
  font-size: .68rem; font-weight: 700; line-height: 1;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--border); color: var(--text-muted);
}
#favSortable .go-item:nth-child(1)::before,
#favSortable .go-item:nth-child(2)::before,
#favSortable .go-item:nth-child(3)::before {
  background: var(--gold); color: var(--navy);
}

/* ── Selector de favoritos (Configuración) ──────────────── */
.nav-fav-picker {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-top: .75rem;
}
.nav-fav-option {
  display: flex; align-items: center; gap: .45rem;
  padding: .45rem .85rem; border-radius: 20px;
  border: 1.5px solid var(--border); cursor: pointer;
  background: var(--surface); font-size: .88rem;
  transition: border-color .15s, background .15s, color .15s;
  user-select: none;
}
.nav-fav-option input[type=checkbox] { display: none; }
.nav-fav-option:hover { border-color: var(--gold); background: var(--bg-alt); }
.nav-fav-option--checked {
  border-color: var(--gold); background: var(--gold);
  color: var(--navy);
}
.nav-fav-option-label { pointer-events: none; }

/* ── Compat: clases antiguas (por si quedan referencias) ── */
nav { display: flex; align-items: center; gap: .75rem; }

.main-content {
  max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem;
}

.site-footer {
  text-align: center; padding: 2rem 4rem;
  color: var(--text-muted); font-size: .8rem;
  border-top: 1px solid var(--border); margin-top: 3rem;
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem 1rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-marcar-visto { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-marcar-visto:hover { background: #15803d; border-color: #15803d; }
.btn-reactivar {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 4px;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #166534;
  cursor: pointer;
  transition: background .15s;
  line-height: 1;
}
.btn-reactivar:hover {
  background: #dcfce7;
  color: #14532d;
  border-color: #4ade80;
}
.btn-large { padding: .6rem 1.5rem; font-size: 1rem; }
.btn-gold {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.35rem;
  background: var(--navy); color: var(--gold);
  border: 1.5px solid var(--gold-dark);
  border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; letter-spacing: .015em;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  transition: background .15s, box-shadow .15s, color .15s;
}
.btn-gold:hover {
  background: var(--navy-light); color: #e8c96a;
  box-shadow: 0 3px 10px rgba(0,0,0,.22);
}
.btn-gold:disabled { opacity: .55; cursor: not-allowed; }

/* --- Page header ------------------------------------------- */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.subtitle { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* --- Kanban board ------------------------------------------ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
}
.kanban-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2.5rem 1rem;
  color: var(--text-light);
  text-align: center;
}
.kanban-empty-icon {
  width: 32px; height: 32px;
  opacity: .35;
}
.kanban-empty-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}
.kanban-empty-hint {
  font-size: .82rem;
  color: var(--text-light);
  margin: 0;
}

@media (max-width: 900px) {
  .kanban-board { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .kanban-board { grid-template-columns: 1fr; }
}

.kanban-col {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}

.col-header {
  padding: .75rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.kanban-p0 .col-header,
.kanban-p1 .col-header,
.kanban-p2 .col-header,
.kanban-p3 .col-header { background: var(--bg); border-color: var(--border); }

/* ── Scroll offset so sticky header doesn't cover the anchor ── */
#kanban-board { scroll-margin-top: 70px; }
.kanban-col { scroll-margin-top: 70px; }

/* ── Acento lateral de prioridad en columnas Kanban ─────── */
.kanban-p0 { border-left: 4px solid var(--p0-badge) !important; }
.kanban-p1 { border-left: 4px solid var(--p1-badge) !important; }
.kanban-p2 { border-left: 4px solid var(--p2-badge) !important; }
.kanban-p3 { border-left: 4px solid var(--p3-badge) !important; }

/* ── Punto identificador en header de sección ───────────── */
.col-header::before {
  content: "●";
  font-size: .7rem; flex-shrink: 0; margin-right: .4rem;
  line-height: 1; align-self: center;
}
.kanban-p0 .col-header::before { color: var(--p0-badge); }
.kanban-p1 .col-header::before { color: var(--p1-badge); }
.kanban-p2 .col-header::before { color: var(--p2-badge); }
.kanban-p3 .col-header::before { color: var(--p3-badge); }

.col-count {
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
  background: var(--surface); padding: .1rem .5rem; border-radius: 999px;
  border: 1px solid var(--border);
}

/* ── Collapsible kanban columns ───────────────────────────── */
.col-chevron {
  width: 15px; height: 15px; flex-shrink: 0; margin-left: auto;
  color: var(--text-muted); transition: transform .25s ease;
}
.col-body-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .3s ease;
}
.col-body-wrap > .card-list { min-height: 0; }
.col-collapsed .col-body-wrap { grid-template-rows: 0fr; }
.col-collapsed .col-body-wrap > .card-list { overflow: hidden; }
.col-collapsed .col-chevron { transform: rotate(-90deg); }

@media (max-width: 768px) {
  .col-header-toggle { cursor: pointer; user-select: none; }
  .col-header-toggle:hover { background: var(--bg-alt); }
}
@media (min-width: 769px) {
  .col-chevron { display: none; }
}

.card-list { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; align-items: stretch; min-width: 0; width: 100%; }

/* --- Message cards ----------------------------------------- */
.message-card {
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: box-shadow .15s, border-color .15s;
  overflow: hidden;
  position: relative;
  min-height: 160px;
}
.message-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.card-link-area {
  display: block;
  padding: .75rem;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.card-link-area::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}
.card-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: .3rem;
  padding: .35rem .5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
  min-width: 0;
  margin-top: auto;
  position: relative;
}
.card-snooze-wrap { margin-left: auto; flex-shrink: 0; position: relative; display: inline-block; }
.btn-card-resolve {
  font-size: .74rem; font-weight: 600;
  padding: .25rem .55rem;
  border: 1px solid #86efac; border-radius: 6px;
  background: #f0fdf4; color: #166534;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  letter-spacing: .01em; white-space: nowrap;
}
.btn-card-resolve:hover {
  background: #22c55e; border-color: #16a34a; color: #fff;
}
.btn-card-delete {
  font-size: .72rem; font-weight: 600;
  padding: .25rem .6rem;
  border: 1px solid #f87171; border-radius: 4px;
  background: #fff5f5; color: #991b1b;
  cursor: pointer; transition: background .15s;
}
.btn-card-delete:hover { background: #fee2e2; }

.btn-card-exclude {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 600;
  padding: .25rem .6rem;
  border: 1px solid #fca5a5; border-radius: 4px;
  background: #fff1f2; color: #b91c1c;
  cursor: pointer; transition: background .15s;
}
.btn-card-exclude:hover { background: #fee2e2; }
.btn-card-exclude .btn-icon { width: 12px; height: 12px; }

.btn-card-detail {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .74rem; font-weight: 600;
  padding: .25rem .55rem;
  border: 1px solid var(--gold); border-radius: 6px;
  background: var(--gold-bg); color: var(--gold-dark);
  text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  letter-spacing: .01em;
}
.btn-card-detail .btn-icon { width: 13px; height: 13px; }
.btn-card-detail:hover { background: var(--gold); color: #fff; border-color: var(--gold-dark); }

.urgency-p0.message-card { border-left: 3px solid var(--p0-badge); }
.urgency-p1.message-card { border-left: 3px solid var(--p1-badge); }
.urgency-p2.message-card { border-left: 3px solid var(--p2-badge); }
.urgency-p3.message-card { border-left: 3px solid var(--p3-badge); }

.card-top { display: flex; align-items: center; margin-bottom: .3rem; gap: .3rem; overflow: visible; }
.card-channel {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); background: var(--bg); padding: .1rem .4rem; border-radius: 4px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-audio-badge {
  font-size: .68rem; font-weight: 600;
  color: #15803d;
  white-space: nowrap; cursor: default;
  flex-shrink: 0;
}
.card-date { font-size: .7rem; color: var(--text-light); flex-shrink: 0; white-space: nowrap; margin-left: auto; }
.card-sender { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-subject { font-size: .8rem; color: var(--text-muted); margin-bottom: .35rem; white-space: normal; overflow: visible; text-overflow: clip; }
.card-summary { font-size: .8rem; color: var(--text); margin-bottom: .4rem; line-height: 1.4; overflow: visible; white-space: normal; word-break: break-word; }
.card-ai-summary {
  font-size: .78rem; color: var(--text-muted); line-height: 1.45;
  margin-bottom: .4rem; border-left: 2px solid var(--border); padding-left: .5rem;
}
.card-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.card-ai-request    { background: #f0f4ff; color: #2a4080; }
.attachment-analysis { color: #1a5c38; }
.audio-analysis {
  background: #f0fdf4; border-left: 3px solid #4ade80;
  padding: .5rem .75rem; border-radius: 0 6px 6px 0;
  font-weight: 400 !important; color: #15803d;
}
/* ── Risk analysis block — Kanban card ─────────────────────────────────── */
.card-risk-block {
  margin-top: .4rem; padding: .35rem .5rem; border-radius: 5px;
  background: #fff8f8; border-left: 3px solid #c0392b;
  display: flex; flex-direction: column; gap: .3rem;
  overflow: hidden; min-width: 0;
}
.card-risk-header {
  display: flex; align-items: center; gap: .35rem;
}

/* ── Risk timing badges ──────────────────────────────────────────────── */
.risk-timing-badge {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .63rem; font-weight: 600; white-space: nowrap;
  cursor: default;
}
.risk-timing-inmediato   { color: #a93226; }
.risk-timing-proximo     { color: #7e5109; }
.risk-timing-indeterminado { color: #888; }

/* ── Micro-label: action type next to timing badge ───────────────────── */
.card-action-label {
  font-size: .58rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Primary action (P0/P1) — most prominent element ────────────────── */
.card-action-primary {
  font-size: .74rem; font-weight: 600; color: #1B2B4A;
  background: #eef2fb; border-radius: 4px;
  padding: .25rem .45rem; line-height: 1.5;
  white-space: normal; overflow: visible;
  overflow-wrap: break-word;
  min-width: 0; max-width: 100%;
}

/* ── Evidence quote — subtle, compact ───────────────────────────────── */
.card-risk-evidence-quote {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; font-style: italic; font-size: .68rem;
  border-left: 2px solid #e8a090; padding: .1rem .35rem;
  color: #8b4a3a; line-height: 1.35;
  word-break: break-word; overflow-wrap: break-word;
  quotes: "\201C" "\201D";
}
.card-risk-evidence-quote::before { content: open-quote; }
.card-risk-evidence-quote::after  { content: close-quote; }

/* ── Secondary note (explanation) — minimal, light ──────────────────── */
/* ── P2/P3 action (no risk block) ───────────────────────────────────── */
.card-action { font-size: .75rem; color: var(--text-muted); font-style: italic; margin-top: .3rem; }

/* ── Deadline tag ────────────────────────────────────────────────────── */
.tag-deadline { background: #fff3cd; color: #7e5109; font-size: .65rem; font-weight: 600; }

.empty-col {
  text-align: center; padding: 2rem 1rem;
  color: var(--text-light); font-size: .875rem;
}

/* --- Badges & tags ----------------------------------------- */
.badge {
  display: inline-block; font-size: .7rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 999px; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-p0 { background: none; padding-left: 0; color: var(--p0-text); }
.badge-p0::before { content: '●'; color: var(--p0-badge); margin-right: .3em; font-size: .75em; }
.badge-p1 { background: none; padding-left: 0; color: var(--p1-text); }
.badge-p1::before { content: '●'; color: var(--p1-badge); margin-right: .3em; font-size: .75em; }
.badge-p2 { background: none; padding-left: 0; color: var(--p2-text); }
.badge-p2::before { content: '●'; color: var(--p2-badge); margin-right: .3em; font-size: .75em; }
.badge-p3 { background: none; padding-left: 0; color: var(--p3-text); }
.badge-p3::before { content: '●'; color: var(--p3-badge); margin-right: .3em; font-size: .75em; }

.tag {
  display: inline-block; font-size: .67rem; padding: 0;
  font-weight: 500; cursor: default;
}
.tag-category { color: #1d4ed8; }
.tag-action   { color: #be123c; }
.tag-deadline { color: #7e5109; font-size: .67rem; font-weight: 500; background: none; }
.tag-status-filled {
  background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
  font-size: .65rem; font-weight: 500; border-radius: 4px;
  padding: .15rem .45rem; display: inline-block; margin-top: .25rem;
}
.tag-status-empty {
  background: none; color: #cbd5e1; border: 1px dashed #cbd5e1;
  font-size: .65rem; font-weight: 400; border-radius: 4px;
  padding: .15rem .45rem; display: inline-block; margin-top: .25rem;
  text-decoration: none; cursor: pointer;
}
.tag-status-empty:hover { color: #94a3b8; border-color: #94a3b8; }

/* --- Forms ------------------------------------------------- */
.form-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 600px) {
  .form-container { grid-template-columns: 1fr; }
}

.message-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-group label { font-size: .875rem; font-weight: 500; color: var(--text); }

.form-check {
  flex-direction: row !important; align-items: center; gap: .5rem !important;
}
.form-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--navy); }
[data-theme="dark"] .form-check input[type=checkbox] { accent-color: var(--gold); }

input[type="text"],
input[type="email"],
textarea {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: .875rem; color: var(--text);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 160px; line-height: 1.6; }

.required { color: var(--danger); }
.optional { color: var(--text-light); font-size: .8rem; font-weight: 400; }

.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }

.form-hint {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: 1.25rem;
  font-size: .85rem; color: #1e40af;
}
.form-hint h3 { font-size: .925rem; margin-bottom: .5rem; }
.form-hint p { margin-bottom: .5rem; line-height: 1.5; }
.form-hint p:last-child { margin-bottom: 0; }

/* --- Alerts ------------------------------------------------ */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius);
  font-size: .875rem; margin-bottom: 1.25rem;
  border: 1px solid;
}
.alert-error { background: #fef2f2; color: #7f1d1d; border-color: #fca5a5; }

/* --- Detail page ------------------------------------------- */
.urgency-banner {
  padding: .75rem 1.25rem; border-radius: var(--radius);
  font-size: .9rem; margin-bottom: 1.5rem; border: 1px solid;
}
.urgency-p0 { background: var(--p0-bg); border-color: var(--p0-border); color: var(--p0-text); }
.urgency-p1 { background: var(--p1-bg); border-color: var(--p1-border); color: var(--p1-text); }
.urgency-p2 { background: var(--p2-bg); border-color: var(--p2-border); color: var(--p2-text); }
.urgency-p3 { background: var(--p3-bg); border-color: var(--p3-border); color: var(--p3-text); }

.action-flag { font-weight: 600; }

.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.detail-section + .detail-section { margin-top: 1.5rem; }
.detail-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.detail-section h3 { font-size: .875rem; font-weight: 600; color: var(--text-muted); margin: 1rem 0 .5rem; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.section-header-row h2 { margin-bottom: 0; }
.section-count { display: inline-flex; align-items: center; justify-content: center; margin-left: .4rem; min-width: 20px; height: 20px; padding: 0 6px; background: var(--navy); color: #fff; border-radius: 10px; font-size: .72rem; font-weight: 700; vertical-align: middle; }
[data-theme="dark"] .section-count { background: var(--gold); color: #1a1a2e; }

/* ── Area suggestion (inline, under the dropdown) ───────────────── */
.area-sugerencia-inline {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .76rem; color: var(--text-muted);
  padding: .3rem .1rem .4rem;
}
.area-sugerencia-inline strong { color: var(--text); }
.area-sug-btn {
  font-size: .72rem; font-weight: 700; border-radius: 12px;
  padding: .15rem .55rem; cursor: pointer; border: 1.5px solid transparent; line-height: 1.5;
}
.area-sug-ok { background: var(--navy); color: #fff; border-color: var(--navy); }
.area-sug-ok:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.area-sug-dismiss { background: none; color: var(--text-muted); border-color: var(--border); }
.area-sug-dismiss:hover { background: var(--bg); color: var(--text); }
[data-theme="dark"] .area-sug-ok { background: var(--gold); color: #1a1a2e; border-color: var(--gold); }
[data-theme="dark"] .area-sug-ok:hover { background: var(--gold-dark); border-color: var(--gold-dark); }

/* ── Document section ───────────────────────────────────────────── */
.doc-notice {
  display: flex; align-items: flex-start; gap: .4rem; font-size: .78rem; color: #0f766e;
  background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 8px;
  padding: .55rem .75rem; margin-bottom: .9rem; line-height: 1.45;
}
[data-theme="dark"] .doc-notice { background: #134e4a; color: #5eead4; border-color: #0f766e; }
.doc-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .75rem; }
.doc-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: .82rem;
}
.doc-item-icon {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: #e0f2fe; color: #0369a1;
}
.doc-type-pdf    { background: #fee2e2; color: #b91c1c; }
.doc-type-docx   { background: #dbeafe; color: #1d4ed8; }
.doc-type-whatsapp { background: #dcfce7; color: #16a34a; }
.doc-type-eml    { background: #fef9c3; color: #a16207; }
.doc-type-image  { background: #f3e8ff; color: #7c3aed; }
.doc-type-audio  { background: #fff7ed; color: #c2410c; }
.doc-item-info { flex: 1; min-width: 0; }
.doc-item-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-item-meta { display: block; font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }
.doc-empty { font-size: .83rem; color: var(--text-muted); font-style: italic; margin: .25rem 0 .75rem; }
.doc-upload-zone { background: var(--bg); border: 1.5px dashed var(--border); border-radius: 10px; padding: 1rem; margin-top: .75rem; }
.doc-upload-inner { display: flex; flex-direction: column; gap: .6rem; }
.doc-upload-notice {
  display: flex; align-items: flex-start; gap: .4rem; font-size: .75rem; color: #065f46;
  background: #d1fae5; border-radius: 6px; padding: .4rem .65rem; line-height: 1.4;
}
[data-theme="dark"] .doc-upload-notice { background: #064e3b; color: #6ee7b7; }
.doc-upload-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed #0d9488; border-radius: 10px; padding: 1.5rem 1rem;
  cursor: pointer; transition: background .15s; gap: .3rem; user-select: none;
}
.doc-upload-label:hover { background: #f0fdfa; }
[data-theme="dark"] .doc-upload-label:hover { background: #134e4a22; }
.doc-drop-over { background: #ccfbf1 !important; }
.doc-upload-label-text { font-size: .85rem; font-weight: 600; color: #0d9488; }
.doc-upload-hint { font-size: .72rem; color: var(--text-muted); }
.doc-upload-progress { display: flex; align-items: center; gap: .6rem; font-size: .83rem; color: var(--text-muted); padding: .4rem 0; }
.doc-upload-result { font-size: .83rem; padding: .3rem 0; }
.doc-result-ok   { color: #16a34a; font-weight: 600; }
.doc-result-skip { color: var(--text-muted); }
.doc-result-err  { color: #dc2626; font-weight: 600; }

.meta-list { display: grid; grid-template-columns: 100px 1fr; gap: .4rem .75rem; margin-bottom: 1rem; font-size: .875rem; }
.meta-list dt { color: var(--text-muted); font-weight: 500; }
.meta-list dd { color: var(--text); }

.raw-text {
  font-family: var(--font-mono); font-size: .8rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: .75rem 1rem; white-space: pre-wrap; word-break: break-word; line-height: 1.6;
  max-height: 400px; overflow-y: auto;
}
.raw-text.clean { background: #f0fdf4; border-color: #86efac; }
.audio-transcription-box {
  background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: .5rem;
}
.audio-header {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .65rem; padding-bottom: .5rem; border-bottom: 1px solid #bbf7d0;
}
.audio-icon { font-size: 1.2rem; }
.audio-label { font-size: .8rem; font-weight: 600; color: #15803d; }
.audio-quote {
  margin: 0; font-size: .875rem; color: var(--text);
  line-height: 1.7; font-style: normal;
  border-left: 3px solid #4ade80; padding-left: .85rem;
}

.classification-list { display: grid; grid-template-columns: 140px 1fr; gap: .6rem .75rem; font-size: .875rem; }
.classification-list dt { color: var(--text-muted); font-weight: 500; padding-top: .1rem; }
.classification-list dd { color: var(--text); }
.classification-list dt.full-span,
.classification-list dd.full-span { grid-column: 1 / -1; }
.classification-list dt.full-span { margin-top: .3rem; }


.summary-text { font-style: italic; }
.ai-summary-long-block {
  background: linear-gradient(135deg,#f5f3ff 0%,#eff6ff 100%);
  border-left: 3px solid #7c3aed;
  border-radius: 0 8px 8px 0;
  padding: .65rem .9rem;
  font-size: .85rem; line-height: 1.65;
  color: #1e1b4b; white-space: pre-wrap;
}
.highlight { font-weight: 600; }
.reasoning { font-style: italic; color: var(--text-muted); line-height: 1.5; }
.reasoning-dt, .reasoning-dd { grid-column: 1 / -1; }
.reasoning-dt { border-top: 1px solid var(--border); padding-top: .55rem; margin-top: .15rem; }
.suggested-action-bold {
  grid-column: 1 / -1;
  font-weight: 700;
  font-size: .95rem;
  color: var(--navy);
  padding: .5rem .75rem;
  background: var(--bg-alt);
  border-left: 3px solid var(--gold);
  border-radius: 0 6px 6px 0;
  line-height: 1.45;
}
/* ── Risk analysis block — Detail view ─────────────────────────────────── */
.legal-risk-block {
  background: #fff0f0; border-left: 3px solid #c0392b;
  padding: .45rem .6rem; border-radius: 4px;
}
.legal-risk-timing-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  margin-bottom: .4rem;
}
.legal-risk-block .legal-risk-explanation {
  font-weight: 600; color: #c0392b; margin: 0 0 .4rem;
  font-size: .875rem; line-height: 1.5;
}
.legal-risk-evidence-block {
  margin-bottom: .4rem;
}
.legal-risk-evidence-quote {
  display: block; margin: .2rem 0 0;
  font-style: italic; font-size: .85rem; line-height: 1.5;
  border-left: 3px solid #e8a090; padding: .2rem .55rem;
  background: #fff8f7; border-radius: 0 4px 4px 0; color: #6b2118;
  quotes: "\201C" "\201D";
}
.legal-risk-evidence-quote::before { content: open-quote; }
.legal-risk-evidence-quote::after  { content: close-quote; }
.legal-risk-meta { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .4rem; }
.legal-risk-row  { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .78rem; color: #5a2d25; }
.legal-risk-label { font-weight: 700; flex-shrink: 0; }
.legal-risk-kw    { font-style: italic; }
.legal-risk-action-row {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start;
  border-top: 1px solid #f0c0b8; padding-top: .35rem; margin-top: .1rem;
  font-size: .82rem;
}
.legal-risk-action {
  font-weight: 700; color: #1B2B4A;
  background: #eef2fb; border-radius: 3px; padding: .1rem .4rem;
}
.muted { color: var(--text-muted); }

.risk { font-weight: 600; }
.risk-alto  { color: var(--danger); }
.risk-medio { color: #ea580c; }
.risk-bajo  { color: #16a34a; }

.confidence-bar-wrap {
  height: 8px; width: 100%; background: var(--bg);
  border-radius: 999px; overflow: hidden; margin-bottom: .25rem;
}
.confidence-bar { height: 100%; background: var(--primary); border-radius: 999px; }
.confidence-pct { font-size: .75rem; color: var(--text-muted); }

/* ============================================================
   Top Priority Section
   ============================================================ */
/* Contador inline dentro del badge de sección — mismo tamaño y color que el texto */
.col-count-inline {
  margin-left: .3rem;
  font-size: 1em;
  opacity: 1;
  font-weight: inherit;
}
/* Ocultar el antiguo contador separado si aún existe */
.col-count { display: none; }

.top-priority-section {
  max-width: 1400px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
}

.top-priority-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.top-priority-count {
  font-size: .75rem;
  font-weight: 600;
  background: var(--text-muted);
  color: #fff;
  border-radius: 999px;
  padding: .1rem .45rem;
}

.tp-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.tp-search-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .28rem .65rem;
  flex-shrink: 0;
  align-self: center;
  transition: border-color .15s, box-shadow .15s;
}
.tp-search-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(180,148,74,.15);
}
.tp-search-icon { color: var(--text-muted); width: 13px; height: 13px; flex-shrink: 0; }
.tp-search-input {
  border: none;
  background: transparent;
  font-size: .8rem;
  color: var(--text);
  outline: none;
  width: 170px;
}
.tp-search-input::placeholder { color: var(--text-muted); }

.top-priority-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.top-priority-row {
  display: grid;
  grid-template-columns: auto auto minmax(8rem, 1fr) 2fr auto auto;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background .15s, border-color .15s;
  text-decoration: none;
  color: var(--text);
}

.top-priority-row:hover {
  background: #f8f9fb;
  border-color: #c5c9d4;
}

/* Left border coloured by urgency */
.top-priority-row.urgency-p0 { border-left: 4px solid var(--p0-badge); }
.top-priority-row.urgency-p1 { border-left: 4px solid var(--p1-badge); }
.top-priority-row.urgency-p2 { border-left: 4px solid var(--p2-badge); }
.top-priority-row.urgency-p3 { border-left: 4px solid var(--p3-badge); }

.tp-score {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
}

.tp-badge {
  font-size: .7rem;
  min-width: 80px;
  flex-shrink: 0;
}

.tp-sender {
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-summary {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.tp-date {
  font-size: .75rem;
  color: var(--text-light);
  white-space: nowrap;
  margin-left: auto;
}

/* --- Auth pages (login / register) --------------------------------- */
.auth-wrapper {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 1rem;
  box-sizing: border-box;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  margin-bottom: .25rem;
}

.auth-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-size: .85rem;
  margin-bottom: 1rem;
}

.auth-notice {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .84rem;
  margin-bottom: 1.1rem;
  line-height: 1.45;
}
.auth-notice-icon { font-size: 1.15rem; flex-shrink: 0; margin-top: .05rem; }
.auth-notice--warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #78350f;
}
.auth-notice--success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-form .form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.auth-form .form-group input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s;
}

.auth-form .form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: .25rem;
  padding: .6rem 1rem;
}

/* Password eye toggle */
.pw-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.pw-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.pw-wrap input {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  padding: .55rem .5rem .55rem .75rem;
  width: auto !important;
}
.pw-eye {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem .55rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  line-height: 1;
  transition: color .15s;
}
.pw-eye:hover { color: var(--navy); }
.pw-eye svg { width: 18px; height: 18px; display: block; }

/* Forgot password row + hint */
.pw-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin: .6rem 0 0;
}
.pw-forgot-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: .78rem;
  color: var(--text-muted);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pw-forgot-link:hover { color: var(--navy); }
/* Forgot password inline form */
.forgot-divider {
  border-top: 1px solid var(--border);
  margin: 1.25rem 0 1rem;
}
.forgot-form-hint {
  font-size: .82rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.5;
}

/* ── Demo banner ──────────────────────────────────────────────────────── */
.demo-banner {
  background: linear-gradient(90deg, #1d4ed8, #2563eb);
  color: #fff;
  padding: .5rem 1rem;
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.demo-banner-row1 {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 1;
  min-width: 0;
}
.demo-banner-text {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.demo-banner-title {
  font-weight: 600;
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-banner-desc {
  font-size: .74rem;
  font-weight: 400;
  color: rgba(255,255,255,.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .demo-banner-desc { display: none; }
  .demo-banner-title { font-size: .8rem; }
}
.demo-badge {
  background: var(--surface);
  color: #1d4ed8;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}
.demo-banner-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.demo-exit {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.4);
  transition: color .15s, background .15s;
  font-size: .8rem;
  white-space: nowrap;
}
.demo-exit:hover { color: #fff; border-bottom-color: #fff; }
@keyframes demo-cta-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes demo-cta-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201,168,76,.55); }
  50%       { box-shadow: 0 0 0 5px rgba(201,168,76,.0); }
}
.demo-exit-cta {
  position: relative;
  background: linear-gradient(
    105deg,
    #C9A84C 0%,
    #C9A84C 38%,
    #f0d882 50%,
    #C9A84C 62%,
    #C9A84C 100%
  );
  background-size: 250% auto;
  color: #0a0f1e !important;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  padding: .32rem .85rem;
  font-size: .8rem;
  letter-spacing: .02em;
  animation:
    demo-cta-shimmer 3.2s linear infinite,
    demo-cta-glow    2.6s ease-in-out infinite;
  transition: filter .15s, transform .12s;
}
.demo-exit-cta:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  border-bottom: none;
  animation-play-state: paused;
}
.demo-exit-out {
  color: rgba(255,255,255,.7) !important;
  border-bottom: 1px solid rgba(255,255,255,.3);
  font-size: .77rem;
}
.demo-exit-out:hover { color: #fff !important; border-bottom-color: rgba(255,255,255,.7); }

/* Drawer footer row when in demo mode */
.nav-drawer-footer-row {
  display: flex;
  align-items: stretch;
}
.nav-drawer-footer-row .nav-drawer-logout {
  flex: 1;
}
.nav-drawer-register {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem 1rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--gold, #C9A84C);
  text-decoration: none;
  border-top: 1px solid var(--border, #e2e8f0);
  border-right: 1px solid var(--border, #e2e8f0);
  background: transparent;
  transition: background .15s;
  flex: 1;
  white-space: nowrap;
}
.nav-drawer-register:hover { background: rgba(201,168,76,.08); }
[data-theme="dark"] .nav-drawer-register { border-color: rgba(255,255,255,.08); }

/* ── Demo login button (login page) ─────────────────────────────────── */
.btn-demo-login {
  display: block;
  text-align: center;
  margin-top: .75rem;
  padding: .7rem 1rem;
  border: 1.5px dashed #2563eb;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: none;
  background: #eff6ff;
  transition: background .15s, color .15s;
}
.btn-demo-login:hover {
  background: #dbeafe;
  color: #1e40af;
}

/* Password reset sent confirmation */
.reset-sent-box {
  text-align: center;
  padding: .5rem 0 1rem;
}
.reset-sent-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.reset-sent-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 .5rem;
}
.reset-sent-msg {
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.auth-footer {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

.auth-footer a {
  color: var(--primary);
  font-weight: 500;
}

.auth-footer a:hover { text-decoration: underline; }

/* --- User info in header ------------------------------------------- */

/* ---- Flash messages ---------------------------------------- */
.flash-message {
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
}
.flash-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}
.flash-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
}
.flash-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

/* ---- Gmail status bar -------------------------------------- */
.gmail-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gmail-dot-on   { background: #16a34a; box-shadow: 0 0 0 2px #dcfce7; }
.gmail-dot-off  { background: #ef4444; box-shadow: 0 0 0 2px #fee2e2; }
.gmail-dot-warn { background: #f59e0b; box-shadow: 0 0 0 2px #fef3c7; }
.gmail-token-expired { color: #d97706; font-weight: 600; }
.gmail-warn-icon {
  width: 16px;
  height: 16px;
  color: #f59e0b;
  flex-shrink: 0;
  stroke-width: 2;
}

.btn-gmail-connect,
.btn-gmail-disconnect,
.btn-gmail-sync {
  padding: .3rem .75rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
.btn-gmail-connect {
  background: transparent;
  color: var(--gold);
  border: 1.5px solid var(--gold) !important;
  transition: background .15s, color .15s;
}
.btn-gmail-connect:hover { background: rgba(201,168,76,.1); }
.btn-gmail-connect.btn-red:hover { background: #c0392b !important; color: #fff !important; }
.btn-gmail-disconnect {
  background: #fee2e2;
  color: var(--danger);
}
.btn-gmail-disconnect:hover { background: #fecaca; }
.btn-gmail-unlink {
  display: inline-flex; align-items: center;
  background: none; border: 1px solid var(--border); cursor: pointer;
  padding: .15rem .5rem; border-radius: 4px; margin-left: .5rem;
  font-size: .7rem; font-weight: 600; color: var(--text-muted);
  transition: color .15s, background .15s, border-color .15s; vertical-align: middle;
}
.btn-gmail-unlink:hover { color: var(--danger); background: #fee2e2; border-color: #fca5a5; }
[data-theme="dark"] .btn-gmail-unlink:hover { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4); }
.btn-gmail-sync {
  background: var(--gold);
  color: #fff;
  transition: background .15s, box-shadow .15s;
  box-shadow: 0 1px 6px rgba(201,168,76,.35);
}
.btn-gmail-sync:hover { background: #b8943e; box-shadow: 0 2px 8px rgba(201,168,76,.45); }
.btn-gmail-sync--loading {
  background: var(--gold, #C9A84C);
  cursor: wait;
  box-shadow: 0 1px 6px rgba(201,168,76,.35);
}
.btn-gmail-sync--disabled,
.btn-gmail-sync:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}
/* ===== Modal confirmación Desconectar Gmail ===== */
.gd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity .22s;
}
.gd-modal-overlay--open {
  display: flex;
}
.gd-modal-overlay--visible { opacity: 1; }
.gd-modal-box {
  background: var(--surface, #fff);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 1.8rem 1.5rem 1.5rem;
  max-width: 320px;
  width: 100%;
  text-align: center;
  transform: translateY(8px);
  transition: transform .22s;
}
.gd-modal-overlay--visible .gd-modal-box { transform: translateY(0); }
.gd-modal-icon { margin-bottom: .75rem; }
.gd-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #111827);
  margin: 0 0 .5rem;
}
.gd-modal-body {
  font-size: .82rem;
  color: var(--text-muted, #6b7280);
  margin: 0 0 1.4rem;
  line-height: 1.5;
}
.gd-modal-actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
}
.gd-btn-cancel {
  flex: 1;
  padding: .55rem .8rem;
  border-radius: 8px;
  border: 1.5px solid var(--border, #e5e7eb);
  background: transparent;
  color: var(--text-muted, #6b7280);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.gd-btn-cancel:hover { background: var(--bg-alt, #f3f4f6); }
.gd-btn-confirm {
  flex: 1;
  padding: .55rem .8rem;
  border-radius: 8px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}
.gd-btn-confirm:hover { background: #dc2626; }
.gd-btn-gold {
  flex: 1;
  padding: .55rem .8rem;
  border-radius: 8px;
  border: none;
  background: var(--gold,#C9A84C);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  display: block;
  line-height: 1.3;
}
.gd-btn-gold:hover { background: #b8923e; color: #fff; }

/* ===== Toast global ===== */
#lexia-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 9999;
  background: #1e293b;
  color: #f8fafc;
  font-size: .82rem;
  font-weight: 600;
  padding: .55rem 1.1rem;
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(0,0,0,.28);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s, transform .22s;
  display: flex;
  align-items: center;
  gap: .6rem;
}
#lexia-toast.lexia-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.lexia-toast-action {
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 700;
  padding: .25rem .7rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.lexia-toast-action:hover { background: #2563eb; }
/* Badge ✉ en tarjeta kanban tras enviar respuesta */
.replied-sent-badge {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .74rem;
  font-weight: 600;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: .2rem .55rem;
  margin: .25rem .75rem .1rem;
  width: fit-content;
}
@keyframes _spin-cw { to { transform: rotate(360deg); } }
.sync-icon-spin {
  display: inline-block;
  animation: _spin-cw .75s linear infinite;
}
.btn-gmail-import {
  background: #fef9ec;
  color: #92700a;
  border: 1px solid #f0d98a;
  padding: .3rem .75rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-gmail-import:hover { background: #fef3c7; color: #78580a; }
.gmail-label-sm { font-size: .8rem; color: var(--text-muted); }
.gmail-label-sm strong { color: var(--text); }

/* --- Inbox status bar (unified) ---------------------------- */
.inbox-status-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .85rem .6rem;
  margin-bottom: 1rem;
}
.section-details > .inbox-status-bar { margin-bottom: 0; }
.inbox-status-counts {
  display: flex;
  align-items: center;
  gap: .5rem;
}
/* Fila de proveedores (Gmail | Outlook) al 50/50 */
.inbox-status-providers {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.inbox-status-providers .inbox-status-gmail {
  flex: 1;
  min-width: 0;
  padding: .3rem .6rem .3rem 0;
  flex-direction: column;
  align-items: flex-start;
}
.inbox-status-providers .inbox-status-gmail--outlook {
  padding-left: .6rem;
  border-left: 2px solid #0078d4;
}
.inbox-status-providers .inbox-status-gmail--whatsapp {
  padding-left: .6rem;
  border-left: 2px solid #25D366;
}
.wa-home-conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .38rem .45rem;
  border-radius: 5px;
  text-decoration: none;
  color: var(--text);
  font-size: .84rem;
  transition: background .12s;
  overflow: hidden;
  min-height: 2rem;
}
.wa-home-conv-row:hover { background: #f0fdf4; }
.wa-home-conv-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.wa-home-conv-right {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-shrink: 0;
}
.wa-home-conv-time {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.wa-home-urgency {
  font-size: .65rem;
  font-weight: 700;
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.4;
}
.wa-home-urgency--p0 { background: #fee2e2; color: #dc2626; }
.wa-home-urgency--p1 { background: #ffedd5; color: #ea580c; }
.inbox-count-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--navy, #1B2B4A);
  color: #fff;
  border-radius: 999px;
  padding: .3rem .85rem;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.inbox-count-badge:hover { opacity: .85; }
.inbox-count-item { white-space: nowrap; }
.inbox-count-sep { opacity: .5; }
.inbox-count-label { opacity: .75; font-weight: 400; font-size: .78rem; }
.inbox-count-empty { font-size: .82rem; color: var(--text-muted); }
.inbox-status-gmail {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .8rem;
}

/* --- Gmail card rows (home) -------------------------------- */
.gmail-row-top {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: .45rem;
}
.gmail-row-top-left {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
}
.gmail-row-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
}
.gmail-sync-time {
  color: var(--text-muted);
  font-size: .75rem;
}

/* Filter row (labels) */
.gmail-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .3rem;
  width: 100%;
  margin-top: .3rem;
  padding: .3rem .4rem;
  background: var(--bg-alt);
  border-radius: 7px;
  border: 1px solid var(--border);
}
.gmail-filter-row--empty { opacity: .8; }
.gmail-filter-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: .1rem;
}
.gmail-filter-icon--link {
  text-decoration: none;
  border-radius: 5px;
  padding: .2rem;
  margin: -.2rem .1rem -.2rem -.2rem;
  transition: background .15s, color .15s;
}
.gmail-filter-icon--link:hover,
.gmail-filter-icon--link:active { background: var(--bg-alt); color: var(--navy); }
.gmail-filter-hint {
  font-size: .7rem;
  color: var(--text-muted);
  padding: .2rem .1rem 0 .15rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity .4s, max-height .4s;
  pointer-events: none;
}
.gmail-filter-hint--visible {
  opacity: 1;
  max-height: 2rem;
}

/* Importar / Desconectar row */
.gmail-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: .3rem;
  gap: .4rem;
}

/* Label pills */
.gmail-label-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .18rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  text-decoration: none;
  user-select: none;
  line-height: 1.3;
  white-space: nowrap;
  overflow: visible;
  max-width: none;
}
.gmail-label-pill .pill-text {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}
.gmail-label-pill--on {
  background: #16a34a;
  color: #fff;
}
/* Variante azul Outlook para pastillas de carpeta */
.gmail-label-pill--on-blue {
  background: #0078d4;
  border-color: #0078d4;
  color: #fff;
  font-weight: 600;
}
[data-theme="dark"] .gmail-label-pill--on-blue { background: #005fa3; border-color: #0078d4; }
.gmail-label-pill--on:hover { background: #15803d; border-color: #15803d; }
.gmail-label-pill:not(.gmail-label-pill--on):hover { background: var(--bg-alt); color: var(--text); border-color: var(--text-muted); }
.gmail-label-pill--more { cursor: pointer; font-size: .66rem; padding: .18rem .4rem; }
.gmail-label-pill--loading { opacity: .55; pointer-events: none; }
.gmail-pill-check {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  stroke: #fff;
}
.gmail-label-pill .remove-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: .75rem;
  padding: 0 0 0 3px;
  cursor: pointer;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}
.gmail-label-pill .remove-btn:hover {
  color: #fca5a5;
}

/* Dark mode */
[data-theme="dark"] .gmail-filter-row { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .gmail-label-pill { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }
[data-theme="dark"] .gmail-label-pill--on { background: #16a34a; border-color: #16a34a; }

/* --- Import source pills (etiqueta/carpeta selector en importar correos) --- */
.import-source-pill {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .2rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .73rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.import-source-pill:hover { border-color: #16a34a; color: #16a34a; background: #f0fdf4; }
.import-source-pill--active { background: #16a34a; border-color: #16a34a; color: #fff; font-weight: 600; }
.import-source-pill--outlook:hover { border-color: #0078d4; color: #0078d4; background: #eff6ff; }
.import-source-pill--outlook.import-source-pill--active { background: #0078d4; border-color: #0078d4; color: #fff; }
[data-theme="dark"] .import-source-pill { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--text-muted); }
[data-theme="dark"] .import-source-pill--active { background: #16a34a; border-color: #16a34a; color: #fff; }
[data-theme="dark"] .import-source-pill--outlook.import-source-pill--active { background: #0078d4; border-color: #0078d4; color: #fff; }

/* --- Gmail label sortable rows (Configuración) ------------ */
.label-row-sortable { list-style: none; padding: 0; margin: 0; }
.label-row-sortable .label-row-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  border-radius: 6px;
  cursor: grab;
  transition: background .1s;
}
.label-row-sortable .label-row-item:hover { background: var(--bg-alt); }
.label-row-sortable .label-row-item.sortable-ghost { opacity: .35; }
.label-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  line-height: 1;
  flex-shrink: 0;
}
.label-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .65rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.label-order-badge--top { background: rgba(201,168,76,.18); border-color: rgba(201,168,76,.4); color: var(--gold); }

/* --- Recibidos hoy section --------------------------------- */
.recibidos-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1.25rem;
  scroll-margin-top: 70px;
}
.recibidos-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .85rem;
}
.recibidos-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}
.recibidos-badge {
  background: var(--navy, #1B2B4A);
  color: #fff;
  border-radius: 999px;
  padding: .1rem .55rem;
  font-size: .75rem;
  font-weight: 700;
}
.recibidos-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-width: 0;
  overflow: hidden;
}
.recibidos-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .5rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.recibidos-col-count {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .05rem .45rem;
  font-size: .72rem;
}
.recibidos-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.recibidos-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .7rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
  overflow: hidden;
}
.recibidos-card:hover {
  border-color: var(--navy, #1B2B4A);
  box-shadow: 0 2px 8px rgba(27,43,74,.08);
}
.recibidos-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .2rem;
}
.recibidos-sender {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recibidos-time {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.recibidos-subject {
  font-size: .78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: .3rem;
}
.recibidos-card-bottom {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .25rem;
}
.recibidos-pill {
  font-size: .7rem;
  font-weight: 700;
  border-radius: 4px;
  padding: .1rem .35rem;
  flex-shrink: 0;
}
.pill-p0 { background: #fef2f2; color: #dc2626; }
.pill-p1 { background: #fff7ed; color: #ea580c; }
.pill-p2 { background: #fefce8; color: #ca8a04; }
.pill-p3 { background: #f0fdf4; color: #16a34a; }
.recibidos-rtype {
  font-size: .72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recibidos-empty {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  padding: .75rem 0;
}
@media (max-width: 640px) {
  .recibidos-cols { grid-template-columns: 1fr; }
  .inbox-status-bar { align-items: flex-start; }
  .inbox-status-providers { flex-direction: column; gap: .5rem; }
  .inbox-status-providers .inbox-status-gmail { padding: .3rem 0; }
  .inbox-status-providers .inbox-status-gmail--outlook { border-left: none; padding-left: 0; border-top: 1px solid #0078d4; padding-top: .4rem; }
  /* Page hero: wrap action buttons onto a second row on mobile */
  .page-hero-top { flex-wrap: wrap; }
  .casos-hero-search { width: 100%; order: 3; }
  .page-hero-action {
    width: 100%;
    justify-content: flex-start;
    padding-top: .35rem;
    border-top: 1px solid rgba(255,255,255,.12);
    margin-top: .1rem;
  }
}

/* ── Recibidos hoy: acordeones por urgencia ─────────────────── */
.rxd-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: .45rem;
  overflow: hidden;
}
.rxd-group:last-child { margin-bottom: 0; }
.rxd-summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .8rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--bg-alt);
  transition: background .12s;
}
.rxd-summary::-webkit-details-marker { display: none; }
.rxd-summary:hover { background: var(--border); }
.rxd-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rxd-dot-p0 { background: #ef4444; }
.rxd-dot-p1 { background: #f97316; }
.rxd-dot-p2 { background: #3b82f6; }
.rxd-dot-p3 { background: #9ca3af; }
.rxd-dot-nc  { background: #d1d5db; }
.rxd-level {
  flex: 1;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}
.rxd-count {
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .08rem .48rem;
  color: #fff;
}
.rxd-count-p0 { background: #ef4444; }
.rxd-count-p1 { background: #f97316; }
.rxd-count-p2 { background: #3b82f6; }
.rxd-count-p3 { background: #9ca3af; }
.rxd-count-nc  { background: #d1d5db; color: #374151; }
.rxd-chevron {
  width: 14px; height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .2s;
}
details.rxd-group[open] .rxd-chevron { transform: rotate(180deg); }
.rxd-body {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .55rem .65rem .65rem;
  background: var(--surface);
}
.rxd-channel-icon {
  font-size: .75rem;
  flex-shrink: 0;
  margin-right: .15rem;
}

/* --- Section collapsible toggles (Atención, Plazos, Mensajes) ------- */
.section-details {
  margin-bottom: 1rem;
}
.section-toggle {
  font-size: .85rem; font-weight: 700; color: var(--text);
  cursor: pointer; user-select: none;
  padding: .5rem .85rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; list-style: none;
  display: flex; align-items: center; gap: .55rem;
  margin-bottom: .6rem;
}
.section-toggle::-webkit-details-marker { display: none; }
.section-chevron {
  width: 15px; height: 15px; color: var(--text-muted);
  transition: transform .2s ease; flex-shrink: 0;
  margin-left: auto;
}
details.section-details[open] > summary .section-chevron,
details[open] > summary .section-chevron {
  transform: rotate(-180deg);
}
.section-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold); color: #fff;
  font-size: .7rem; font-weight: 700;
  border-radius: 10px; padding: .05rem .45rem; min-width: 1.2rem;
}
.section-desc {
  font-size: .72rem; font-weight: 400; color: var(--text-muted);
}
.section-toggle .dl-strip-link {
  font-size: .78rem;
}
.section-toggle-body {
  display: flex; flex-direction: column; gap: .1rem;
  flex: 1; min-width: 0;
}
.section-toggle-row1 {
  display: flex; align-items: center; gap: .4rem;
  white-space: nowrap; font-size: .85rem; font-weight: 700;
}
.section-breakdown {
  font-size: .75rem; font-weight: 500; color: var(--text-muted);
}
.section-toggle-row2 {
  font-size: .72rem; font-weight: 400; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Resueltos section ------------------------------------- */
.resolved-section {
  margin-top: 2rem;
}
.resolved-toggle {
  font-size: .85rem; font-weight: 700; color: var(--text);
  cursor: pointer; user-select: none;
  padding: .5rem .85rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; list-style: none;
  display: flex; align-items: flex-start; gap: .55rem;
  margin-bottom: .6rem;
}
.resolved-toggle::-webkit-details-marker { display: none; }
.resolved-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text-light); color: #fff;
  font-size: .7rem; font-weight: 700;
  border-radius: 10px; padding: .05rem .45rem; min-width: 1.2rem;
}
.resolved-desc {
  font-size: .7rem; font-weight: 400; color: var(--text-muted);
  margin-left: .1rem;
}
.resolved-list {
  margin-top: .5rem; display: flex; flex-direction: column; gap: .25rem;
}
.resolved-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .75rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
  opacity: .75;
}
.resolved-link {
  flex: 1; display: flex; align-items: center; gap: .6rem;
  text-decoration: none; color: var(--text-muted); font-size: .8rem;
}
.resolved-channel {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  background: var(--bg); padding: .1rem .35rem; border-radius: 3px;
  color: var(--text-light);
}
.resolved-sender { font-weight: 600; color: var(--text); }
.resolved-subject { color: var(--text-muted); }
.resolved-date { margin-left: auto; font-size: .7rem; color: var(--text-light); white-space: nowrap; }
.resolved-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }

/* ── Bloqueados section ─────────────────────────────────────── */
.bloqueados-section { margin-top: 1.25rem; }
.bloqueados-toggle {
  font-size: .85rem; font-weight: 700; color: var(--text);
  cursor: pointer; user-select: none;
  padding: .5rem .85rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; list-style: none;
  display: flex; align-items: flex-start; gap: .55rem;
  margin-bottom: .6rem;
}
.bloqueados-toggle::-webkit-details-marker { display: none; }
.bloqueados-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: #dc2626; color: #fff;
  font-size: .7rem; font-weight: 700;
  border-radius: 10px; padding: .05rem .45rem; min-width: 1.2rem;
}
.btn-desbloquear {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 600;
  padding: .25rem .6rem;
  border: 1px solid #fca5a5; border-radius: 4px;
  background: #fff1f2; color: #b91c1c;
  cursor: pointer; transition: background .15s;
  text-decoration: none;
}
.btn-desbloquear:hover { background: #fee2e2; }

/* ── Reactivar modal ────────────────────────────────────────── */
.reactivar-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.reactivar-modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.35rem;
  width: 100%; max-width: 380px;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
}
.reactivar-modal-body {
  font-size: .88rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 1.25rem;
  padding-top: .75rem;
}
.reactivar-btn-confirm {
  padding: .52rem 1.2rem;
  font-size: .85rem; font-weight: 600;
  border-radius: 9px; border: none;
  background: #b45309; color: #fff;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: opacity .15s;
}
.reactivar-btn-confirm:hover { opacity: .88; }
@media (max-width: 640px) {
  .reactivar-modal-overlay { align-items: flex-end; padding: 0; }
  .reactivar-modal-box {
    border-radius: 20px 20px 0 0; max-width: 100%;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    animation: archiveSlideUp .22s cubic-bezier(.32,.72,0,1);
  }
}

/* --- Detail page header ------------------------------------ */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.detail-header-left { flex: 1; min-width: 0; }
.detail-header-right { flex-shrink: 0; padding-top: .25rem; }
.detail-title { font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin-bottom: .2rem; }
.detail-meta { font-size: .78rem; color: var(--text-light); margin-top: .3rem; }

/* --- Detail page footer actions ---------------------------- */
.detail-footer-actions {
  display: flex;
  gap: .75rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.detail-footer-actions form:last-child { margin-left: auto; }
.btn-detail-delete {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .82rem; font-weight: 600;
  padding: .4rem .85rem;
  border: 1px solid #fca5a5; border-radius: 6px;
  background: #fff5f5; color: #991b1b;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-detail-delete:hover { background: #fee2e2; border-color: #f87171; }

/* ============================================================
   BOTTOM NAVIGATION (móvil)
   ============================================================ */
.bottom-nav {
  display: none; /* visible solo en móvil via media query */
}
.bottom-nav-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: .5rem .2rem .4rem;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  border: none; background: none;
  cursor: pointer; position: relative;
  transition: color .15s;
  min-height: 56px;
}
.bottom-nav-tab.active { color: var(--gold); }
.bottom-nav-tab.active .icon { color: var(--gold); }
.bottom-nav-tab:hover  { color: #fff; }
.bottom-nav-tab:hover .icon { color: #fff; }
.bottom-nav-label { font-size: .62rem; margin-top: .25rem; font-weight: 700;
                    letter-spacing: .02em; display: block; }
/* Badge rojo sobre icono */
.bottom-nav-badge {
  position: absolute; top: .35rem;
  left: calc(50% + .45rem);
  min-width: 15px; height: 15px;
  background: #e74c3c; color: #fff; border-radius: 8px;
  font-size: .58rem; font-weight: 700;
  display: none; align-items: center; justify-content: center;
  padding: 0 .22rem; border: 1.5px solid var(--navy);
}
.bottom-nav-badge.has-count { display: inline-flex; }

/* ============================================================
   RESPONSIVE — TABLET & MOBILE
   ============================================================ */

/* ---- Tablet (≤ 768px) ------------------------------------ */
@media (max-width: 600px) {
  /* Ocultar top bar, mostrar bottom nav */
  .site-header { display: none; }
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--navy);
    border-top: 1px solid rgba(255,255,255,.12);
    z-index: 150;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  /* Reduce outer spacing + espacio para bottom nav */
  .main-content { padding: .9rem .75rem calc(68px + env(safe-area-inset-bottom, 0px)); }
  /* Footer no queda pegado al bottom nav */
  .site-footer { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px) + 1.5rem); }

  /* Header: single row con favoritos + hamburguesa */
  .header-inner {
    height: 52px;
    padding: 0 .75rem;
    flex-wrap: nowrap;
    gap: .4rem;
  }
  .logo { flex-shrink: 0; }
  .nav-favorites { gap: .15rem; }
  .nav-fav-link { font-size: .78rem; padding: .22rem .45rem; }
  .nav-fav-link:nth-child(n+4) { display: none; }

  /* Top-priority: en móvil mostrar lista con paginador JS (initTopPriorityPager) */
  .top-priority-title { display: none; }

  /* Top-priority row: collapse to two meaningful columns */
  .top-priority-row {
    grid-template-columns: auto auto 1fr auto;
  }
  .tp-summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    grid-column: 1 / -1;
    overflow: hidden;
    white-space: normal;
    font-size: .82rem;
    margin-top: -.25rem;
  }
  .tp-date { display: none; }

  /* Page header */
  .page-header h1 { font-size: 1.2rem; }

  /* Gmail status bar: allow wrapping */

  /* Meta/classification lists: narrower label column */
  .meta-list { grid-template-columns: 80px 1fr; }
  .classification-list { grid-template-columns: 120px 1fr; }

  /* Detail section padding */
  .detail-section { padding: 1.1rem; }
}

/* ---- Mobile (≤ 480px) ------------------------------------ */
@media (max-width: 480px) {
  body { font-size: 13px; }

  /* Further reduce outer spacing */
  .main-content { padding: .9rem .75rem; }
  .header-inner { padding: .5rem .75rem; }

  /* Hide nav-user badge, keep dashboard + logout */

  /* Top-priority row: minimal on very small screens */
  .top-priority-row {
    grid-template-columns: auto auto 1fr;
    gap: .5rem;
    padding: .5rem .75rem;
  }
  .tp-score { display: none; }
  .tp-summary {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    grid-column: 1 / -1;
    overflow: hidden;
    white-space: normal;
    font-size: .8rem;
    margin-top: -.2rem;
  }

  /* Page header: stack vertically */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: 1.25rem;
  }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Cards: slightly more padding on touch targets */
  .card-link-area { padding: .9rem; }
  .card-actions { gap: .3rem; padding: .4rem .6rem; }
  .btn-card-resolve,
  .btn-card-detail { font-size: .75rem; padding: .35rem .5rem; }

  /* Kanban col headers: centrado y más grande en móvil */
  .col-header {
    padding: .65rem .75rem;
    justify-content: center;
  }
  .col-header::before { display: none; } /* el borde lateral ya da el color */
  .col-header .badge {
    font-size: .92rem;
    padding: .32rem 1rem;
    letter-spacing: .01em;
  }

  /* (handled at 640px breakpoint above) */

  /* Meta/classification lists: keep two columns but narrower on small screens */
  .meta-list { grid-template-columns: 80px 1fr; gap: .35rem .6rem; }
  .meta-list dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }

  /* Detail section */
  .detail-section { padding: .9rem .75rem; }
  .urgency-banner { padding: .6rem .9rem; }

  /* Auth card on small phones */
  .auth-card { padding: 1.75rem 1.25rem; }

  /* Raw text box */
  .raw-text { max-height: 250px; font-size: .75rem; }

  /* Gmail status: hide less important parts */
  .btn-gmail-disconnect { font-size: .72rem; padding: .25rem .55rem; }

  /* Resolved rows: truncate on small screens */
  .resolved-subject { display: none; }
  .resolved-row { padding: .35rem .6rem; }

  /* Form actions stack vertically */
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { justify-content: center; }

  /* Detail footer actions — 2×2 grid en móvil */
  .detail-footer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 1fr;
    gap: .6rem;
    align-items: stretch;
  }
  .detail-footer-actions form {
    margin-left: 0 !important;
    display: flex;
    width: 100%;
  }
  .detail-footer-actions .btn,
  .detail-footer-actions .btn-pdf,
  .detail-footer-actions .btn-posponer,
  .detail-footer-actions .btn-detail-delete,
  .detail-footer-actions .btn-marcar-visto,
  .detail-footer-actions .btn-reactivar {
    flex: 1;
    width: 100%;
    justify-content: center;
    text-align: center;
    white-space: normal;
    box-sizing: border-box;
    height: 100%;
  }

  /* Draft on cards — single column */
  .card-draft-actions { flex-direction: column; gap: .4rem; }
  .btn-draft-copy, .btn-draft-edit { justify-content: center; width: 100%; text-align: center; }

  /* Draft section */
  .draft-form-actions { flex-direction: row; gap: .5rem; flex-wrap: wrap; }

  /* Onboarding wizard — reduce card padding on small screens */
  #ob-card { padding: 1.25rem 1.25rem 1.5rem !important; }
  #ob-overlay { padding: .5rem !important; }
}

/* ============================================================
   Notes pill on Kanban cards
   ============================================================ */
.card-notes-pill {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  padding: .4rem .75rem;
  border-top: 1px solid #fde68a;
  background: #fffbeb;
  font-size: .78rem;
  color: #92400e;
  text-decoration: none;
  transition: background .15s;
  line-height: 1.4;
}
.card-notes-pill:hover { background: #fef3c7; }
.card-notes-preview {
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Deadline date badge next to deadline text */
.deadline-date-badge {
  display: inline-block;
  margin-left: .35rem;
  padding: .1rem .45rem;
  font-size: .72rem;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border-radius: 20px;
  border: 1px solid #fde68a;
}

/* ============================================================
   Notes — Detail page
   ============================================================ */
.notes-section {
  background: #fffdf0;
  border: 1px solid #fde68a;
}
.notes-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: .3rem;
}
.notes-hint {
  font-size: .78rem;
  color: #a16207;
  margin-bottom: .7rem;
}
.notes-textarea {
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text);
  resize: vertical;
  background: var(--surface);
  margin-bottom: .55rem;
  transition: border-color .15s;
}
.notes-textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}
.notes-textarea::placeholder { color: var(--text-light); font-style: italic; }
.notes-form-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.btn-notes-save {
  padding: .4rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
}
.btn-notes-save:hover { background: #d97706; }
.notes-saved-indicator {
  font-size: .8rem;
  color: #16a34a;
  font-weight: 500;
}

/* ============================================================
   Draft Reply — Kanban cards
   ============================================================ */
.card-draft-wrap {
  border-top: 2px solid var(--navy);
  background: #f5f6f9;
}
.card-draft-send-form {
  padding: .45rem .75rem .3rem;
}
.card-draft-send-form .btn-draft-send {
  width: 100%;
  justify-content: center;
}
.card-draft {
  background: transparent;
}
.card-draft-toggle {
  cursor: pointer;
  padding: .45rem .75rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--navy);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.card-draft-toggle::-webkit-details-marker { display: none; }
.card-draft-chevron {
  transition: transform .18s ease;
}
details.card-draft[open] .card-draft-chevron {
  transform: rotate(180deg);
}
.card-draft-body {
  padding: .5rem .75rem .6rem;
}
.card-draft-text {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .65rem;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}
.card-draft-textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: .82rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: .4rem;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: .5rem .65rem;
  resize: vertical;
  font-family: inherit;
  outline: none;
}
.card-draft-edit-controls {
  display: flex;
  gap: .4rem;
  margin-bottom: .4rem;
}
.btn-draft-edit-save {
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: inherit;
}
.btn-draft-edit-cancel {
  font-size: .75rem;
  padding: .25rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.card-draft-actions {
  display: flex;
  gap: .5rem;
}
.btn-draft-copy,
.btn-draft-edit {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  font-size: .77rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-draft-copy:hover { background: var(--bg); }
.btn-draft-edit { color: var(--primary); border-color: var(--primary); }
.btn-draft-edit:hover { background: #eff6ff; }
.btn-draft-send {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  font-size: .77rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .15s;
}
.btn-draft-send-wa {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.btn-draft-send-wa:hover { background: #bbf7d0; }
.btn-draft-send-email {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}
.btn-draft-send-email:hover { background: #dbeafe; }
.btn-draft-send-inline {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .7rem;
  font-size: .77rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid #5eead4;
  background: #f0fdfa;
  color: #0f766e;
  cursor: pointer;
  transition: background .15s;
}
.btn-draft-send-inline:hover { background: #ccfbf1; }

.draft-replied-notice {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .73rem;
  font-weight: 600;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #5eead4;
  border-radius: var(--radius);
  padding: .25rem .55rem;
  margin-bottom: .4rem;
}

/* ============================================================
   Draft Reply — Detail page
   ============================================================ */
.draft-section {
  background: #f8faff;
  border: 1px solid #c7d9f8;
}
.draft-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: .35rem;
}
.draft-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.draft-textarea {
  width: 100%;
  min-height: 120px;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .88rem;
  line-height: 1.55;
  color: var(--text);
  resize: vertical;
  background: var(--surface);
  margin-bottom: .6rem;
  transition: border-color .15s;
  /* M-05 móvil: garantizar interacción táctil — algún overlay/elemento
     hermano podía interceptar eventos en pantallas pequeñas. */
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
  pointer-events: auto;
}
.draft-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.draft-form-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: .75rem;
}
.btn-draft-save,
.btn-draft-clipboard {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-draft-save {
  background: var(--gold);
  color: #fff;
}
.btn-draft-save:hover { background: var(--gold-dark); }
.btn-draft-clipboard {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-draft-clipboard:hover { background: var(--bg); }

.btn-generate-draft {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.2rem;
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  background: var(--gold);
  color: #fff;
  transition: background .15s, opacity .15s;
  margin-top: .5rem;
}
.btn-generate-draft:hover { background: var(--gold-dark); }
.btn-generate-draft:disabled { opacity: .6; cursor: not-allowed; }
.btn-regenerate-draft {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .15s, color .15s;
  white-space: nowrap;
  margin-left: auto;
}
.btn-regenerate-draft:hover { background: var(--bg-alt); color: var(--text); }
.btn-regenerate-draft:disabled { opacity: .6; cursor: not-allowed; }
.btn-spinner {
  display: inline-block; vertical-align: middle; flex-shrink: 0;
  animation: spin .75s linear infinite;
}
.draft-generate-error {
  margin-top: .5rem;
  font-size: .85rem;
  color: #dc2626;
}
.reclassify-bar {
  margin-top: .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.btn-reclassify {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .35rem .75rem;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-reclassify:hover:not(:disabled) {
  background: var(--card-bg);
  color: var(--navy);
  border-color: var(--navy);
}
.btn-reclassify:disabled {
  opacity: .65;
  cursor: not-allowed;
}
.reclassify-error {
  font-size: .82rem;
  color: #dc2626;
  margin: 0;
}

/* ============================================================
   Calendar page — header + layout
   ============================================================ */
.cal-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.cal-page-title h1 { font-size: 1.5rem; font-weight: 700; }
.cal-header-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.btn-hoy {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .15s;
}
.btn-hoy:hover { background: var(--primary-dark); }

/* Two-column layout: calendar grids | deadline list */
.cal-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.cal-months-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

/* ============================================================
   Calendar empty state
   ============================================================ */
.cal-empty {
  max-width: 500px;
  margin: 5rem auto;
  text-align: center;
  color: var(--text-muted);
}
.cal-empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.cal-empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .5rem;
}
.cal-empty-hint { font-size: .85rem; line-height: 1.6; }

/* ============================================================
   Month grid card
   ============================================================ */
.cal-month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem .75rem;
  box-shadow: var(--shadow);
}
.cal-month-current {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow);
}
.cal-month-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .65rem;
}
.cal-month-name {
  font-weight: 700;
  font-size: .92rem;
  color: var(--text);
  text-transform: capitalize;
}
.cal-month-year {
  font-size: .78rem;
  color: var(--text-muted);
}
.cal-month-current-badge {
  margin-left: auto;
  font-size: .65rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: .1rem .45rem;
  border-radius: 20px;
  letter-spacing: .04em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.cal-day-name {
  font-size: .6rem;
  font-weight: 600;
  color: var(--text-light);
  text-align: center;
  padding: .2rem 0 .35rem;
}
.cal-cell {
  min-height: 32px;
  padding: .15rem .1rem .2rem;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  transition: background .12s;
}
.cal-cell:hover:not([style*="pointer-events:none"]) { background: var(--bg); }
.cal-cell-out { opacity: .25; }
.cal-cell-past .cal-day-num { color: var(--text-light); }
.cal-cell-past.cal-cell-has-deadline { opacity: .6; }
.cal-cell-today { background: var(--primary) !important; border-radius: 4px; }
.cal-cell-today .cal-day-num { color: #fff !important; font-weight: 700; }
.cal-cell-has-deadline { background: #fef9c3; }
.cal-cell-today.cal-cell-has-deadline { background: var(--primary) !important; }
.cal-day-num {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}
.cal-today-dot {
  width: 4px; height: 4px;
  background: rgba(255,255,255,.7);
  border-radius: 50%;
  margin-top: 1px;
}
.cal-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1px;
}
.cal-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
}
.cal-dot-p0 { background: var(--p0-badge); }
.cal-dot-p1 { background: var(--p1-badge); }
.cal-dot-p2 { background: var(--p2-badge); }
.cal-dot-p3 { background: var(--p3-badge); }

/* ============================================================
   Deadline list (right column)
   ============================================================ */
.cal-list-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.cal-list-section { }
.cal-list-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .65rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}
.cal-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

/* "HOY" divider in the list */
.cal-today-marker {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem 0;
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.cal-today-marker::before,
.cal-today-marker::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--primary);
  opacity: .35;
}

.cal-list-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .1s;
}
.cal-list-row:hover { box-shadow: var(--shadow-md); transform: translateX(2px); }
.cal-list-row.urgency-p0 { border-left-color: var(--p0-badge); }
.cal-list-row.urgency-p1 { border-left-color: var(--p1-badge); }
.cal-list-row.urgency-p2 { border-left-color: var(--p2-badge); }
.cal-list-row.urgency-p3 { border-left-color: var(--p3-badge); }
.cal-row-past { opacity: .55; }
.cal-row-today { background: #fffbeb; border-color: #fde68a; }

.cal-row-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 42px;
  gap: 1px;
}
.cal-row-day {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.cal-row-month {
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em;
}
.cal-row-badge-label {
  font-size: .56rem;
  font-weight: 700;
  letter-spacing: .06em;
  border-radius: 20px;
  padding: .05rem .35rem;
  margin-top: 1px;
}
.cal-today-label  { background: #dbeafe; color: var(--primary); }
.cal-past-label   { background: #fee2e2; color: var(--danger); }
.cal-label-red    { background: #fee2e2; color: #b91c1c; }
.cal-label-orange { background: #ffedd5; color: #c2410c; }
.cal-label-yellow { background: #fef9c3; color: #a16207; }
.cal-label-green  { background: #dcfce7; color: #15803d; }

.cal-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .12rem;
  min-width: 0;
}
.cal-row-sender {
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-row-deadline {
  font-size: .75rem;
  color: var(--text-muted);
}
.cal-row-summary {
  font-size: .75rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .2rem;
  flex-shrink: 0;
}
.cal-row-channel {
  font-size: .65rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cal-row-date-label {
  font-size: .65rem;
  color: var(--text-light);
}
.cal-row-note-icon { font-size: .8rem; }

/* Fuzzy (no exact date) section */
.cal-fuzzy-section .cal-list-title { color: #92400e; border-bottom-color: #fde68a; }
.cal-fuzzy-hint {
  font-size: .8rem;
  color: #1a1a1a;
  margin-bottom: .65rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: .4rem .65rem;
}
.cal-fuzzy-row { background: #fffdf5; }
.cal-row-date-fuzzy {
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-fuzzy-icon {
  width: 32px; height: 32px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 240px 1fr; }
}
@media (max-width: 700px) {
  .cal-layout { grid-template-columns: 1fr; max-width: 100%; overflow: hidden; }
  .cal-list-col { order: -1; max-width: 100%; overflow: hidden; }
  .cal-months-col { position: static; flex-direction: column; overflow: hidden; max-width: 100%; }
  .cal-month { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; overflow: hidden; }
  .cal-grid { max-width: 100%; }
  .cal-list-row { max-width: 100%; overflow: hidden; box-sizing: border-box; }
  .cal-page-header { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .cal-month { padding: .6rem .4rem; }
  .cal-day-name { font-size: .55rem; padding: .15rem 0 .25rem; }
  .cal-day-num { font-size: .75rem; }
  .cal-cell { min-height: 26px; padding: .1rem .05rem .15rem; }
  .cal-list-row { padding: .5rem .6rem; gap: .5rem; }
  .cal-row-summary { display: block; font-size: .7rem; }
  .cal-row-day { font-size: 1.1rem; }
  .cal-row-right { display: none; }
  .btn-hoy { padding: .35rem .7rem; }
}

/* ── Ver meses anteriores — botón ── */
.cal-prev-btn {
  display: flex; align-items: center; gap: .4rem;
  width: 100%; background: var(--surface); border: 1px dashed var(--border);
  border-radius: 8px; padding: .45rem .85rem;
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: background .12s, color .12s;
}
.cal-prev-btn:hover { background: var(--bg-alt); color: var(--text); }

/* ── Past month calendars — tono atenuado ── */
.cal-past-month { opacity: .85; }
.cal-past-month .cal-month-header { border-bottom: 1px solid var(--border); padding-bottom: .45rem; margin-bottom: .45rem; }

/* ── Día activo en el calendario — aro azul ── */
.cal-cell-active {
  background: #eff6ff !important;
  outline: 2px solid #2563eb;
  border-radius: 4px;
}
.cal-cell-active .cal-day-num { color: #1d4ed8 !important; font-weight: 700; }

/* ── Clickable: cursor pointer en días con plazos ── */
.cal-cell-has-deadline { cursor: pointer; }

/* ── Tooltip JS (#cal-js-tip) — gestionado por JS, position:fixed ── */
#cal-js-tip {
  position: fixed;
  background: rgba(17,24,39,.9); color: #fff;
  font-size: .68rem; font-weight: 500; white-space: nowrap;
  padding: .28rem .55rem; border-radius: 5px;
  pointer-events: none; z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  display: none;
}

/* ── Separador de mes en panel derecho ── */
.cal-month-sep {
  display: flex; align-items: center; gap: .5rem;
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: .06em; text-transform: uppercase;
  padding: .6rem 0 .25rem; margin-top: .35rem;
}
.cal-month-sep::before, .cal-month-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Botón colapsar/expandir plazos pasados ── */
.cal-past-toggle-btn {
  display: flex; align-items: center; gap: .45rem;
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .45rem .85rem;
  font-size: .8rem; font-weight: 600; color: var(--text);
  cursor: pointer; text-align: left; transition: background .12s;
  margin-bottom: .35rem;
}
.cal-past-toggle-btn:hover { background: var(--bg-alt); }
.cal-past-toggle-unattended { color: #dc2626; font-weight: 700; }
.cal-past-toggle-arrow { font-size: .85rem; }

/* ── Métricas hero ── */
.cal-hero-metrics {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: .45rem;
  font-size: .74rem; color: rgba(255,255,255,.78);
}
.cal-hero-sep { opacity: .5; }
.cal-hero-metrics strong { font-weight: 700; color: #fff; }
.cal-hero-warn { color: #fca5a5 !important; }

/* ── Barra de filtros combinada ── */
.cal-filter-row {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .75rem;
}
.cal-filter-row:empty { display: none; }

/* ── Input búsqueda de cliente ── */
.cal-search-input {
  flex: 1; min-width: 0;
  height: 34px; padding: 0 .7rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: .78rem; outline: none;
  transition: border-color .15s;
}
.cal-search-input::placeholder { color: var(--text-muted); }
.cal-search-input:focus { border-color: var(--gold); }

/* ── Botón "Sin atender" ── */
.cal-unresolved-btn {
  display: inline-flex; align-items: center; gap: .35rem; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .4rem .75rem;
  font-size: .78rem; font-weight: 600; color: var(--text);
  cursor: pointer; transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.cal-unresolved-btn:hover { background: var(--bg-alt); }
.cal-unresolved-btn--active {
  background: #fef2f2; border-color: #fca5a5; color: #b91c1c;
}
.cal-unresolved-btn--active:hover { background: #fee2e2; }

/* ── Botón "Mes actual" — aspecto clickable ── */
.cal-month-current-badge {
  background: none; border: none; cursor: pointer;
  margin-left: auto;
  font-size: .65rem; font-weight: 700;
  background: var(--primary); color: #fff;
  padding: .1rem .45rem; border-radius: 20px;
  letter-spacing: .04em; transition: opacity .15s;
}
.cal-month-current-badge:hover { opacity: .8; }

/* ============================================================
   Dashboard — Filter bar
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.kanban-toolbar-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem;
  margin-bottom: .35rem;
  margin-top: .2rem;
}
.kanban-toolbar-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}
.kanban-toolbar-sub {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.kanban-toolbar {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .45rem .85rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .6rem;
  flex-wrap: wrap;
}

/* Search field */
.filter-search-wrap {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .25rem .55rem;
  flex: 1;
  min-width: 160px;
  transition: border-color .15s;
}
.filter-search-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.filter-search-icon { font-size: .85rem; flex-shrink: 0; color: var(--text-muted); }
.filter-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .84rem;
  color: var(--text);
  outline: none;
  font-family: var(--font-sans);
}
.filter-search-input::placeholder { color: var(--text-light); }
.filter-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--text-light);
  color: #fff;
  font-size: .6rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  transition: background .15s;
}
.filter-clear-btn:hover { background: var(--text-muted); }

/* Urgency button group */
.filter-urgency-group {
  display: flex;
  gap: .3rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}
.filter-urg-btn {
  padding: .28rem .7rem;
  font-size: .78rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .01em;
  display: inline-flex; align-items: center;
}
.filter-urg-btn:hover { border-color: var(--text-muted); color: var(--text); }
.filter-urg-active { background: var(--text) !important; color: #fff !important; border-color: var(--text) !important; }
.filter-urg-count {
  margin-right: .3rem;
  font-size: .82em;
  font-weight: 700;
}
.filter-urg-btn { white-space: nowrap; }
/* Chips de prioridad: estilo sobrio con borde de color */
.filter-urg-btn.filter-urg-p0 { background: rgba(220,38,38,.08); border-color: var(--p0-badge); color: var(--p0-badge); opacity: .75; }
.filter-urg-btn.filter-urg-p1 { background: rgba(234,88,12,.08); border-color: var(--p1-badge); color: var(--p1-badge); opacity: .75; }
.filter-urg-btn.filter-urg-p2 { background: rgba(202,138,4,.08); border-color: var(--p2-badge); color: var(--p2-badge); opacity: .75; }
.filter-urg-btn.filter-urg-p3 { background: rgba(22,163,74,.08); border-color: var(--p3-badge); color: var(--p3-badge); opacity: .75; }

/* Activo: fondo suave + opacidad completa */
.filter-urg-btn.filter-urg-p0.filter-urg-active { opacity: 1 !important; background: rgba(220,38,38,.15) !important; box-shadow: 0 2px 8px rgba(220,38,38,.25) !important; }
.filter-urg-btn.filter-urg-p1.filter-urg-active { opacity: 1 !important; background: rgba(234,88,12,.15) !important; box-shadow: 0 2px 8px rgba(249,115,22,.25) !important; }
.filter-urg-btn.filter-urg-p2.filter-urg-active { opacity: 1 !important; background: rgba(202,138,4,.15) !important; box-shadow: 0 2px 8px rgba(234,179,8,.25) !important; }
.filter-urg-btn.filter-urg-p3.filter-urg-active { opacity: 1 !important; background: rgba(22,163,74,.15) !important; box-shadow: 0 2px 8px rgba(107,114,128,.25) !important; }


/* Date window filter buttons */
.filter-date-sep {
  flex-basis: 100%;
  height: 0;
  width: 0;
  background: none;
}
.filter-date-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  padding-left: .1rem;
  align-self: center;
}
.filter-date-btn {
  padding: .18rem .5rem;
  font-size: .73rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filter-date-btn:hover { border-color: var(--text-muted); color: var(--text); }
.filter-date-btn.filter-date-active {
  background: var(--bg-alt);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
}

/* Status filter row */
.filter-status-group {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  align-items: center;
  padding: .3rem .75rem .4rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.filter-status-btn {
  padding: .2rem .6rem;
  font-size: .74rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.filter-status-btn:hover { border-color: var(--text-muted); color: var(--text); }
.filter-status-active {
  background: var(--navy) !important;
  color: #fff !important;
  border-color: var(--navy) !important;
}
.filter-status-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95em;
  font-weight: 700;
  background: rgba(0,0,0,.09);
  border-radius: 999px;
  padding: 0 .38rem;
  min-width: 1.3rem;
  line-height: 1.6;
}
.filter-status-active .filter-status-count {
  background: rgba(255,255,255,.22);
}

/* ── Archive modal ─────────────────────────────────────────── */
.archive-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.archive-modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.35rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
}
.archive-modal-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
}
.archive-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}
.archive-modal-warning {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: .65rem .85rem;
  font-size: .83rem;
  color: #92400e;
  line-height: 1.45;
  margin-bottom: 1rem;
}
.archive-modal-warning i { margin-top: 1px; color: #d97706; flex-shrink: 0; }
.archive-modal-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0 0 .55rem;
}
/* Status list — replaces chips */
.archive-chips-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: .85rem;
}
.archive-chip {
  width: 100%;
  text-align: left;
  padding: .7rem 1rem;
  font-size: .88rem;
  font-weight: 500;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.archive-chip:last-child { border-bottom: none; }
.archive-chip:hover:not(.archive-chip-active) { background: var(--bg-alt); }
/* "Sin estado" — first row, visually softer */
.archive-chip:first-child {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}
.archive-chip-active {
  background: var(--navy) !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-style: normal !important;
}
.archive-chip-active::after {
  content: '✓';
  font-size: .85rem;
  opacity: .9;
}
.archive-modal-hint {
  font-size: .74rem;
  color: var(--text-muted);
  margin: 0 0 1.1rem;
  line-height: 1.4;
}
.archive-modal-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.archive-btn-cancel {
  padding: .52rem 1rem;
  font-size: .85rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
  transition: all .15s;
}
.archive-btn-cancel:hover { border-color: var(--text-muted); color: var(--text); }
.archive-btn-confirm {
  padding: .52rem 1.2rem;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 9px;
  border: none;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: opacity .15s;
}
.archive-btn-confirm:hover { opacity: .88; }

/* Mobile: bottom sheet */
@media (max-width: 640px) {
  .archive-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .archive-modal-box {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    animation: archiveSlideUp .22s cubic-bezier(.32,.72,0,1);
  }
  @keyframes archiveSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

/* Subtle result count */
.filter-results-count {
  display: none;
  font-size: .76rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

/* "Ver más" pager button inside kanban column */
.card-pager-btn {
  display: block;
  width: 100%;
  margin-top: .5rem;
  padding: .6rem 1rem;
  background: transparent;
  border: 1px dashed #ccc;
  border-radius: 6px;
  color: var(--text-muted, #666);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color .2s, color .2s, background .2s;
}
.card-pager-btn:hover {
  border-color: var(--gold, #C9A84C);
  color: var(--gold, #C9A84C);
  background: rgba(201, 168, 76, 0.05);
}
.card-pager-btn--collapse {
  border-style: dashed;
  border-color: #ccc;
  color: var(--text-muted, #666);
  background: transparent;
}
.card-pager-btn--collapse:hover {
  border-color: var(--gold, #C9A84C);
  color: var(--gold, #C9A84C);
  background: rgba(201, 168, 76, 0.05);
}

/* "Sin coincidencias" inside a column */
.filter-no-results {
  text-align: center;
  padding: 1rem;
  font-size: .82rem;
  color: var(--text-light);
  font-style: italic;
}

/* Responsive filter bar */
@media (max-width: 600px) {
  .filter-bar { gap: .5rem; }
  .filter-search-wrap { min-width: 100%; }
  .filter-urgency-group { width: 100%; gap: .3rem; }
  .filter-urg-btn { padding: .28rem .5rem; }
}

/* ============================================================
   Dashboard — Deadline proximity strip
   ============================================================ */
.dl-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dl-strip-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem;
  background: #f8faff;
  border-bottom: 1px solid var(--border);
}
.dl-strip-icon { font-size: 1rem; }
.dl-strip-title {
  font-weight: 700;
  font-size: .88rem;
  color: var(--text);
  flex: 1;
}
.dl-strip-link {
  font-size: .78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.dl-strip-link:hover { text-decoration: underline; }

/* Clear / all-good state */
.dl-strip-clear {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem 1rem;
  font-size: .84rem;
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.dl-strip-clear .dl-strip-icon { font-size: .95rem; }

.dl-strip-body {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

/* Each urgency bucket */
.dl-bucket {
  flex: 1;
  min-width: 0;
  padding: .6rem .85rem;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.dl-bucket:last-child { border-right: none; }
.dl-bucket-red   { background: #fff5f5; }
.dl-bucket-orange { background: #fffaf5; }
.dl-bucket-yellow { background: #fffef5; }

.dl-bucket-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .45rem;
  text-transform: uppercase;
  display: flex; align-items: center;
  letter-spacing: .04em;
  gap: .35rem;
}
.dl-bucket-toggle { cursor: pointer; user-select: none; }
.dl-bucket-toggle:hover { opacity: .8; }
.dl-bucket-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 .3rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; font-size: .68rem; font-weight: 700;
  color: var(--text-muted); margin-left: .1rem;
}
.dl-bucket-red    .dl-bucket-count { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.dl-bucket-orange .dl-bucket-count { background: #ffedd5; border-color: #fdba74; color: #92400e; }
.dl-bucket-yellow .dl-bucket-count { background: #fef9c3; border-color: #fde047; color: #713f12; }
.dl-bucket-chevron {
  width: 13px; height: 13px; margin-left: auto; flex-shrink: 0;
  color: var(--text-muted); transition: transform .25s ease;
}
.dl-bucket-collapsed .dl-bucket-chevron { transform: rotate(-90deg); }

/* Collapse animation */
.dl-chips-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .3s ease;
}
.dl-chips-wrap > .dl-chips { min-height: 0; }
.dl-bucket-collapsed .dl-chips-wrap { grid-template-rows: 0fr; }
.dl-bucket-collapsed .dl-chips-wrap > .dl-chips { overflow: hidden; }

.dl-chips {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.dl-chip {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  padding: .35rem .55rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: filter .15s;
  border: 1px solid transparent;
  overflow: hidden;
  min-width: 0;
}
.dl-chip:hover { filter: brightness(.95); }
.dl-chip-red    { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
.dl-chip-orange { background: #ffedd5; color: #7c2d12; border-color: #fdba74; }
.dl-chip-yellow { background: #fef9c3; color: #713f12; border-color: #fde047; }

.dl-chip-time {
  font-weight: 800;
  font-size: .72rem;
  min-width: 42px;
  flex-shrink: 0;
  letter-spacing: -.01em;
  padding-top: .1rem;
}
.dl-chip-body {
  display: flex;
  flex-direction: column;
  gap: .08rem;
  min-width: 0;
  flex: 1;
}
.dl-chip-sender {
  font-size: .78rem;
  font-weight: 600;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}
.dl-chip-summary {
  font-size: .71rem;
  opacity: .8;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  font-weight: 400;
}

/* Responsive */
@media (max-width: 600px) {
  .dl-strip-body { flex-direction: column; }
  .dl-bucket { border-right: none; border-bottom: 1px solid var(--border); }
  .dl-bucket:last-child { border-bottom: none; }
}

/* ============================================================
   Document analysis — kanban card badge
   ============================================================ */
/* ============================================================
   Document analysis — detail page section
   ============================================================ */
.doc-analysis-section {
  border-top: 3px solid #2563eb;
}
.doc-analysis-hint {
  font-size: .82rem;
  color: var(--text-muted);
  margin: -.25rem 0 1.1rem;
  font-style: italic;
}

/* Document type header bar */
.doc-analysis-type {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .9rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.doc-type-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #1d4ed8;
  flex-shrink: 0;
}
.doc-type-value {
  font-size: .94rem;
  font-weight: 700;
  color: var(--text);
}

/* Generic content block */
.doc-analysis-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: .75rem;
}
.doc-block-title {
  padding: .45rem .85rem;
  font-size: .78rem;
  font-weight: 700;
  background: #f8faff;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  letter-spacing: .01em;
}
.doc-block-body {
  padding: .65rem .85rem;
  font-size: .88rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* Lists */
.doc-list {
  margin: 0;
  padding: .5rem .85rem .65rem 1.8rem;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.doc-list li {
  font-size: .86rem;
  color: var(--text);
  line-height: 1.55;
}

/* Risk block — amber tint */
.doc-block-risks {
  border-color: #fde68a;
}
.doc-block-risks .doc-block-title {
  background: #fffbeb;
  border-bottom-color: #fde68a;
  color: #92400e;
}
.doc-list-risks li { color: #78350f; }

/* Dates block — blue tint */
.doc-block-dates {
  border-color: #bfdbfe;
}
.doc-block-dates .doc-block-title {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
  color: #1e40af;
}
.doc-list-dates li { color: #1e3a8a; font-family: var(--font-mono, monospace); font-size: .82rem; }

/* Lawyer request — green tint */
.doc-block-request {
  border-color: #86efac;
}
.doc-block-request .doc-block-title {
  background: #f0fdf4;
  border-bottom-color: #86efac;
  color: #14532d;
}
.doc-block-body-request {
  font-weight: 600;
  color: #15803d;
}

/* ============================================================
   Admin — User management panel
   ============================================================ */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.admin-card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.admin-card-narrow { max-width: 480px; }
.admin-create-form { display: flex; flex-direction: column; gap: 1rem; }
.admin-role-cell { display: flex; flex-direction: column; gap: .4rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; }
.form-group { margin-bottom: 1.1rem; }
.form-hint { font-size: .75rem; color: var(--text-light); margin-top: .25rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; color: var(--text); }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--navy); }
[data-theme="dark"] .checkbox-label input[type=checkbox] { accent-color: var(--gold); }


.you-badge {
  font-size: .65rem; font-weight: 700; background: #dbeafe;
  color: var(--primary); padding: .05rem .4rem; border-radius: 20px; margin-left: .35rem;
}
.role-badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  padding: .15rem .55rem; border-radius: 20px;
}
.role-admin   { background: #fef9c3; color: #92400e; }
.role-manager { background: #fef3c7; color: #b45309; }
.role-lawyer  { background: #dcfce7; color: #166534; }

.form-input-sm { width: 160px; font-size: .8rem; padding: .3rem .5rem; }
.btn-sm { font-size: .78rem; padding: .3rem .65rem; }
.btn-danger {
  background: #fee2e2; color: #dc2626; border: 1px solid #fecaca;
  border-radius: var(--radius); font-size: .875rem; font-weight: 600;
  padding: .4rem .9rem; cursor: pointer; transition: background .15s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.btn-danger:hover { background: #fecaca; }

@media (max-width: 600px) {
  .form-input-sm { width: 110px; }
  .admin-card { padding: 1rem; }
}

/* ============================================================
   DETAIL PAGE — sender link + PDF button
   ============================================================ */
.detail-title-link {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--navy);
  text-decoration: none;
  margin-bottom: .4rem;
  word-break: break-all;
  overflow-wrap: break-word;
  letter-spacing: -.01em;
  transition: color .15s;
}
.detail-title-link:hover { color: var(--gold-dark); text-decoration: underline; }

/* Subtitle: AI summary — italic, readable, clearly secondary */
.detail-header-left .subtitle {
  font-size: .88rem;
  font-weight: 400;
  font-style: italic;
  color: #445;
  line-height: 1.45;
  margin: 0 0 .4rem 0;
  padding-left: .7rem;
  border-left: 2px solid var(--gold);
}

/* Meta line: date · channel — small caps, muted */
.detail-header-left .detail-meta {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-top: .1rem;
}

.detail-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .55rem;
}
.btn-header-delete {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600;
  padding: .22rem .65rem;
  border: 1px solid #fca5a5; border-radius: 5px;
  background: #fff5f5; color: #991b1b;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-header-delete:hover { background: #fee2e2; border-color: #f87171; }
.btn-header-delete .btn-icon { width: 12px; height: 12px; }

/* dl pair row — two fields side by side inside classification-list */
.dl-pair-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .75rem;
}
.dl-pair-item { display: flex; flex-direction: column; gap: .2rem; }
.dl-pair-item dt { color: var(--text-muted); font-weight: 500; font-size: .875rem; }
.dl-pair-item dd { color: var(--text); font-size: .875rem; margin: 0; }
/* PDF secondary action bar */
.detail-secondary-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin: .6rem 0 1.1rem;
}

/* dl-pair-item: tags y badges como texto simple sin apariencia de botón */
.dl-pair-item .tag,
.dl-pair-item [class*="tag-"] {
  background: none; border: none; padding: 0;
  font-weight: 600; font-size: .9rem;
}
.dl-pair-item .tag-category { color: var(--navy); }
.dl-pair-item [class*="badge-"] {
  background: none; border: none; padding: 0;
  font-weight: 700; font-size: .9rem;
}
.dl-pair-item .badge-p0 { color: var(--p0-text); }
.dl-pair-item .badge-p1 { color: var(--p1-text); }
.dl-pair-item .badge-p2 { color: var(--p2-text); }
.dl-pair-item .badge-p3 { color: var(--p3-text); }

.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-pdf:hover {
  background: var(--navy);
  color: var(--gold);
  border-color: var(--navy);
  box-shadow: 0 2px 8px rgba(27,43,74,.15);
}

/* ============================================================
   VISTA DE CLIENTE
   ============================================================ */
.client-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.client-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: .25rem;
}
.client-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  padding-top: .2rem;
}
.client-urg-label { font-size: .72rem; color: var(--text-light); }

.client-stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.client-stat {
  flex: 1;
  min-width: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  text-align: center;
}
.client-stat-resolved { border-color: #bbf7d0; background: #f0fdf4; }
.client-stat-number { display: block; font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.client-stat-label  { font-size: .72rem; color: var(--text-muted); font-weight: 500; }

.client-timeline { display: flex; flex-direction: column; gap: .5rem; }
.client-msg-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s;
}
.client-msg-card:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(201,168,76,.15); }
.client-msg-resolved { background: #fafafa; opacity: .78; }
.client-msg-left { flex-shrink: 0; }
.client-msg-body { flex: 1; min-width: 0; }
.client-msg-summary { font-size: .9rem; font-weight: 500; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-msg-no-summary { color: var(--text-muted); font-style: italic; }
.client-msg-meta { font-size: .75rem; color: var(--text-light); }
.client-msg-right { flex-shrink: 0; }
.client-msg-status { font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 20px; white-space: nowrap; }
.client-msg-status.open     { background: #fef3c7; color: #92400e; }
.client-msg-status.resolved { background: #dcfce7; color: #166534; }

/* ============================================================
   PANEL DE ESTADÍSTICAS
   ============================================================ */
.stats-page-header { margin-bottom: 1.5rem; }
.stats-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: .25rem; }

.stats-kpi-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.stats-kpi {
  flex: 1;
  min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stats-kpi-icon {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto .35rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.stats-kpi-open     { border-color: #fde68a; background: #fffbeb; }
.stats-kpi-resolved { border-color: #bbf7d0; background: #f0fdf4; }
.stats-kpi-rate     { border-color: #bfdbfe; background: #eff6ff; }
.stats-kpi-conf     { border-color: #e9d5ff; background: #faf5ff; }

.stats-kpi-link {
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.stats-kpi-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(27,43,74,.12);
  border-color: var(--navy);
}
.stats-kpi-link .stats-kpi-number,
.stats-kpi-link .stats-kpi-label { color: inherit; }
.stats-kpi-number { display: block; font-size: 1.8rem; font-weight: 700; color: var(--navy); }
.stats-kpi-label  { font-size: .72rem; color: var(--text-muted); font-weight: 500; }

.stats-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.stats-chart-card, .stats-bar-card, .stats-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.stats-chart-title { font-size: .9rem; font-weight: 700; color: var(--navy); margin-bottom: 1rem; }
/* "Por canal" wrap: contenedor de altura acotada para que el canvas no
   crezca cuando Chart.js tarda en pintar o hay pocas series. */
.stats-chart-wrap { position: relative; height: 180px; min-height: 140px; max-height: 220px; margin-bottom: .75rem; }
.stats-chart-wrap > canvas { max-height: 100%; }
.stats-bar-wrap   { position: relative; height: 200px; }

.stats-legend { list-style: none; padding: 0; margin: 0; font-size: .78rem; color: var(--text); display: flex; flex-direction: column; gap: .3rem; }
.stats-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; flex-shrink: 0; }
.stats-legend li  { display: flex; align-items: center; }

.stats-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.stats-table th { text-align: left; padding: .5rem .6rem; font-size: .75rem; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid var(--border); }
.stats-table td { padding: .65rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-sender-link { color: var(--navy); font-weight: 500; text-decoration: none; }
.stats-sender-link:hover { color: var(--gold-dark); text-decoration: underline; }

.stats-sender-client { display: flex; flex-direction: column; gap: .1rem; text-decoration: none; }
.stats-sender-name   { font-weight: 700; color: var(--navy); font-size: .88rem; }
.stats-sender-sub    { font-size: .73rem; color: var(--text-muted); font-weight: 400; }
.stats-sender-client:hover .stats-sender-name { color: var(--gold-dark); }
.stats-sender-client:hover .stats-sender-sub  { color: var(--text); }
.stats-bar-inline { width: 100px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.stats-bar-fill { height: 100%; background: var(--gold); border-radius: 3px; }

@media (max-width: 640px) {
  .stats-charts-row { grid-template-columns: 1fr; }
  .stats-kpi { min-width: 80px; }
  .stats-kpi-number { font-size: 1.4rem; }
  .client-msg-right { display: none; }
  .detail-header-right   { width: 100%; flex-shrink: 0; padding-top: 0; }
  .detail-header-actions { flex-direction: row; align-items: center; justify-content: space-between; gap: .5rem; }
}

/* ============================================================
   FICHAS DE CLIENTE — directorio (/clientes)
   ============================================================ */
.cl-page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.5rem; gap: 1rem;
}
.cl-page-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin: 0; display: flex; align-items: center; gap: .55rem; }
.cl-page-sub   { font-size: .82rem; color: var(--text-muted); margin: .2rem 0 0; }

.cl-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff;
  font-size: .72rem; font-weight: 700; border-radius: 20px;
  padding: .1rem .55rem; min-width: 1.6rem; letter-spacing: .02em;
}

/* Search bar — mismo patrón flex que el home */
.cl-search-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .75rem;
  margin-bottom: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.cl-search-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,.18);
}
.cl-search-icon {
  font-size: .85rem; flex-shrink: 0; color: var(--text-muted); pointer-events: none;
}
.cl-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: .9rem;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.cl-search-input::placeholder { color: var(--text-light); }
.cl-search-clear {
  cursor: pointer; flex-shrink: 0;
  color: var(--text-muted); font-size: .8rem;
  background: none; border: none; padding: 0 .1rem;
  line-height: 1;
}
.cl-search-clear:hover { color: var(--navy); }
.cl-no-results { font-size: .875rem; color: var(--text-muted); text-align: center; padding: 1.5rem 0; }

.cl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .75rem;
  margin-bottom: 2rem;
}
.cl-card {
  display: flex; align-items: center; gap: .85rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; text-decoration: none; color: inherit;
  transition: box-shadow .15s, border-color .15s;
}
.cl-card:hover { border-color: var(--gold); box-shadow: 0 2px 10px rgba(201,168,76,.18); }

.cl-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0; letter-spacing: .03em;
}
.cl-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.cl-card-name { font-size: .95rem; font-weight: 700; color: var(--navy); }
.cl-card-contact {
  font-size: .75rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cl-card-phone {
  font-size: .75rem; color: var(--text-muted); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cl-card-count { font-size: .72rem; color: var(--text-light); font-weight: 500; }
.cl-card-urg   { flex-shrink: 0; align-self: flex-start; }

/* Unlinked senders section */
.cl-unlinked-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.cl-unlinked-title { font-size: 1rem; font-weight: 700; color: var(--navy); margin: 0 0 .25rem; }
.cl-unlinked-sub   { font-size: .8rem; color: var(--text-muted); margin: 0 0 .9rem; }
.cl-unlinked-list  { display: flex; flex-direction: column; gap: .4rem; }
.cl-unlinked-row {
  display: flex; align-items: center; gap: .75rem;
  background: #fafafa; border: 1px solid var(--border); border-radius: var(--radius);
  padding: .6rem .9rem; text-decoration: none; color: inherit;
  transition: border-color .15s;
}
.cl-unlinked-row:hover { border-color: var(--gold); }
.cl-unlinked-sender { flex: 1; font-size: .85rem; font-weight: 500; }
.cl-unlinked-count  { font-size: .75rem; color: var(--text-muted); }
.cl-unlinked-arrow  { font-size: .8rem; color: var(--gold-dark); }

/* ============================================================
   PERFIL DE CLIENTE (/clientes/{id})
   ============================================================ */
.cp-header {
  display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem; margin-bottom: 1rem;
}
.cp-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2rem; flex-shrink: 0; letter-spacing: .03em;
}
.cp-info { flex: 1; min-width: 0; }
.cp-name { font-size: 1.35rem; font-weight: 800; color: var(--text); margin: 0 0 .35rem; }
.cp-priority-text {
  background: none; border: none; padding: 0;
  font-weight: 700; text-transform: uppercase;
  font-size: .82rem; letter-spacing: .04em;
  vertical-align: middle; margin-left: .45rem;
}
.cp-priority-p0 { color: #dc2626; }
.cp-priority-p1 { color: #ea580c; }
.cp-priority-p2 { color: #2563eb; }
.cp-priority-p3 { color: #6b7280; }
.cp-contacts { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin-bottom: .4rem; }
.cp-contact  { font-size: .82rem; color: var(--text-muted); }
.cp-notes    { font-size: .82rem; font-style: italic; color: var(--text-muted); margin: .3rem 0 0; }
.cp-notes-full { flex-basis: 100%; width: 100%; margin-top: .1rem; }

.cp-contact-link {
  text-decoration: none;
  color: var(--text-muted);
  border-bottom: 1px dashed transparent;
  transition: color .15s, border-color .15s;
}
.cp-contact-link:hover {
  color: var(--navy);
  border-bottom-color: var(--gold);
}
.cp-actions  { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; flex-shrink: 0; }
.cp-btn-edit { margin-top: .4rem; }

/* Edit form */
.hidden { display: none !important; }
.cp-edit-wrap {
  background: #f7f8fc; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem;
}
.cp-edit-form { display: flex; flex-direction: column; gap: .85rem; }
.cp-edit-row  { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-group   { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group textarea { padding: .45rem .7rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .875rem; background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.form-group input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,168,76,.18); }
.form-group small { font-size: .72rem; color: var(--text-muted); }
.req         { color: #dc2626; }
.contact-hint { font-size: .75rem; color: var(--text-muted); margin: -.4rem 0 .5rem; }
.form-error-banner {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius);
  color: #b91c1c; font-size: .875rem; font-weight: 500;
  padding: .75rem 1rem; margin-bottom: 1rem;
}
.cp-edit-footer { display: flex; gap: .5rem; padding-top: .25rem; }

/* New client form card */
.cp-form-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; max-width: 680px;
}

/* Sub-line in detail header when client is linked */
.detail-sender-sub {
  font-size: .75rem; color: var(--text-muted); margin: -.25rem 0 .4rem;
  font-weight: 500; letter-spacing: .01em;
}

/* Clickable stat filter boxes */
.cp-filter-empty {
  text-align: center; color: var(--text-muted);
  font-size: .875rem; padding: 1.5rem 0;
}

/* Channel tag in client message timeline */
/* ── Sender action bar (remitente sin ficha) ─────────────────────── */
.sender-action-bar {
  display: flex; flex-direction: column; gap: .75rem;
  background: #fffbf0; border: 1px solid #f0d98a;
  border-radius: 10px; padding: .9rem 1rem; margin-bottom: 1rem;
}
.sender-action-hint { display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: #555; flex-wrap: wrap; }
.sender-no-ficha-pill { background: #fef3c7; color: #92400e; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .15rem .6rem; white-space: nowrap; }
.sender-action-btns { display: flex; gap: .75rem; justify-content: space-between; flex-wrap: nowrap; }
.btn-sm { font-size: .82rem; padding: .35rem .8rem; white-space: nowrap; }
.btn-outline-navy {
  background: transparent; color: #4A5568;
  border: 1.5px solid #A0AEC0; border-radius: 7px;
  font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.btn-outline-navy:hover { background: #EDF2F7; border-color: #718096; color: #2D3748; }

.vincular-panel {
  background: #f8f9fb; border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.vincular-hint { font-size: .88rem; color: #555; margin-bottom: .75rem; }
.vincular-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.vincular-select { flex: 1; min-width: 200px; padding: .42rem .65rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); font-size: .88rem; }

.tl-channel-pill {
  display: inline-block; font-size: .7rem; font-weight: 700;
  border-radius: 999px; padding: .1rem .6rem; margin-bottom: .22rem;
}
.tl-channel-email    { background: #EAF2FF; color: #1A5CB8; }
.tl-channel-whatsapp { background: #E6F9EF; color: #1A7A40; }
.client-msg-subject {
  font-size: .82rem; font-weight: 600; color: var(--text);
  margin: .05rem 0 .12rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .cl-grid          { grid-template-columns: 1fr; }
  .cp-edit-row      { grid-template-columns: 1fr; }
  .cp-avatar        { width: 44px; height: 44px; font-size: 1rem; }
  .cp-name          { font-size: 1.1rem; }
  .cl-page-header   { flex-direction: column; }
}

/* ===== Bulk selection (v33) ===== */
.msg-select-wrap {
  position: absolute; top: .6rem; right: .6rem;
  width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
  z-index: 2;
}
.message-card:hover .msg-select-wrap,
.message-card:has(.msg-checkbox:checked) .msg-select-wrap { opacity: 1; }
/* Checkboxes siempre visibles en modo selección */
body.select-mode-active .msg-select-wrap { opacity: 1; }
body.select-mode-active .message-card    { cursor: pointer; }

/* ── Tarjeta seleccionada: tinte dorado + ring ── */
.message-card:has(.msg-checkbox:checked) {
  background: rgba(201,168,76,.09) !important;
  outline: 1.5px solid rgba(201,168,76,.55);
  outline-offset: -1px;
}
.message-card:has(.msg-checkbox:checked) .msg-checkbox {
  accent-color: #b8923a;
}

/* En móvil: ocultar completamente el checkbox hasta que se active la selección */
@media (max-width: 600px) {
  .msg-select-wrap { display: none; }
  body.select-mode-active .msg-select-wrap { display: flex; }
}
.msg-checkbox {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--navy);
}

/* ---- Bulk action bar ---- */
.bulk-bar {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; border-radius: 2rem;
  display: flex; align-items: center; gap: .6rem; padding: .65rem 1.1rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.45); z-index: 999;
  font-size: .875rem; font-weight: 500; white-space: nowrap;
}
.bulk-info    { display: flex; align-items: center; min-width: 0; }
.bulk-actions { display: flex; align-items: center; gap: .45rem; }
.bulk-count { font-size: .85rem; color: #fff; font-weight: 600; white-space: nowrap; }
.bulk-hint  { font-size: .78rem; color: rgba(255,255,255,.65); white-space: nowrap; }

.btn-bulk {
  border: none; border-radius: 1.5rem; padding: .42rem .85rem;
  font-size: .82rem; font-weight: 600; cursor: pointer; transition: opacity .15s;
  white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem;
}
.btn-icon { width: 14px; height: 14px; flex-shrink: 0; }
.btn-bulk:hover    { opacity: .85; }
.btn-bulk-resolve  { background: var(--gold); color: var(--navy); padding: .45rem 1rem; font-size: .85rem; }
.btn-bulk-delete   { background: transparent; color: #fca5a5;
                     border: 1px solid rgba(220,38,38,.35); padding: .42rem .85rem; font-weight: 500; }
.btn-bulk-delete:hover { background: rgba(220,38,38,.3); border-color: #dc2626; opacity: 1; }
/* Cancelar: solo icono, pequeño y en esquina */
.btn-bulk-cancel   {
  background: transparent; color: rgba(255,255,255,.5);
  padding: .25rem .3rem; border-radius: .5rem;
  line-height: 1;
}
.btn-bulk-cancel:hover { color: #fff; background: rgba(255,255,255,.1); opacity: 1; }
.btn-bulk-cancel .btn-icon { width: 16px; height: 16px; }

/* En móvil: barra anclada en dos filas sobre la nav inferior */
@media (max-width: 600px) {
  .bulk-bar {
    left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    transform: none; border-radius: 0;
    border-top: 2px solid rgba(255,255,255,.1);
    padding: .55rem .9rem .65rem; gap: .3rem .5rem;
    flex-wrap: wrap;
  }
  /* Fila 1: info a la izq + cancelar (solo X) a la dcha */
  .bulk-info       { flex: 1; order: 1; }
  .btn-bulk-cancel { order: 2; flex-shrink: 0; }
  /* Fila 2: delete (discreto, izq) + resolve (grande, dcha) */
  .bulk-actions    { order: 3; width: 100%; gap: .5rem; }
  .bulk-actions .btn-bulk-delete  {
    flex: 0 0 38%; justify-content: center;
    padding: .55rem .4rem; font-size: .82rem;
  }
  .bulk-actions .btn-bulk-resolve {
    flex: 1; justify-content: center;
    padding: .6rem .5rem; font-size: .88rem;
  }
}

/* ---- Select button in filter bar (solo escritorio) ---- */
.filter-select-btn {
  display: flex; align-items: center; gap: .35rem;
  background: none; border: 1.5px solid var(--border); border-radius: 2rem;
  color: var(--text-muted); font-size: .8rem; padding: .32rem .85rem; cursor: pointer;
  white-space: nowrap; transition: border-color .15s, color .15s, background .15s;
  font-weight: 500;
}
.filter-select-btn:hover { border-color: var(--navy); color: var(--navy); }
.filter-select-btn--active {
  background: var(--navy); border-color: var(--navy); color: #fff;
}
.filter-select-btn--active:hover { background: var(--navy-dark); border-color: var(--navy-dark); color: #fff; }
@media (max-width: 600px) { .filter-select-btn { display: none; } }

/* ---- Long press feedback ---- */
.message-card,
.top-priority-row {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.message-card.card-pressing {
  transform: scale(.975);
  box-shadow: 0 0 0 2px var(--navy);
  transition: transform .12s, box-shadow .12s;
}
.message-card.card-selected-flash {
  animation: card-flash .35s ease forwards;
}
@keyframes card-flash {
  0%   { background: rgba(27,43,74,.12); }
  100% { background: inherit; }
}

/* ---- Botón "Todos" dentro del hint de la barra ---- */
.bulk-hint-selall {
  background: none; border: none; color: var(--gold);
  font-size: .78rem; font-weight: 700; cursor: pointer; padding: 0;
  text-decoration: underline; text-underline-offset: 2px;
}

/* Push notification bell in nav */

/* Stats bar inline */
.stats-bar-inline {
  background: #e2e8f0; border-radius: 4px; height: 8px; width: 90px; overflow: hidden;
}
.stats-bar-fill { height: 8px; border-radius: 4px; transition: width .4s; }

/* Stats per-lawyer table enhancements */
.stats-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.stats-table th { text-align: left; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  padding: .5rem .75rem; border-bottom: 2px solid var(--border); }
.stats-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
.stats-table tbody tr:hover { background: #f8fafc; }
.stats-table-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
}

/* ===== Stats v34 additions ===== */
.stats-kpi-hint {
  display: block;
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: .25rem;
  line-height: 1.3;
  font-style: italic;
}
a.stats-kpi.stats-kpi-link { text-decoration: none; }
a.stats-kpi.stats-kpi-link::after {
  content: '→';
  display: block;
  text-align: right;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: .3rem;
  opacity: 0;
  transition: opacity .15s;
}
a.stats-kpi.stats-kpi-link:hover::after { opacity: 1; }

.stats-chart-subtitle {
  font-size: .78rem;
  color: var(--text-muted);
  margin: -.3rem 0 .75rem;
  font-style: italic;
}

/* ===== Context filter banner (v35) ===== */
.filter-context-banner {
  background: var(--navy); color: #fff;
  font-size: .82rem; font-weight: 500;
  padding: .55rem 1.25rem;
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap;
}
.filter-context-clear {
  color: rgba(255,255,255,.75); text-decoration: none;
  font-size: .78rem; margin-left: auto;
  transition: color .15s;
}
.filter-context-clear:hover { color: var(--gold); }

/* ===== PWA Splash screen (v36) ===== */
#pwa-splash {
  position: fixed; inset: 0; z-index: 99999;
  background: var(--navy, #1B2B4A);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease;
}
/* ===== Recordatorios / snooze (v37) ===== */
.reminder-banner {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  background: #fff8e1; border: 1px solid #ffe082;
  border-radius: 8px; padding: .65rem 1rem; margin-bottom: .9rem;
  font-size: .88rem; color: #5a4000;
}
.btn-reminder-cancel {
  margin-left: auto; background: none; border: 1px solid #e0c050;
  border-radius: 5px; padding: .25rem .6rem; cursor: pointer;
  font-size: .8rem; color: #7a5800; transition: background .15s;
}
.btn-reminder-cancel:hover { background: #ffe082; }

.posponer-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
.posponer-hint { font-size: .72rem; color: var(--text-light); padding-left: .1rem; }
.btn-posponer {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--gold-bg); border: 1px solid var(--gold);
  color: var(--gold-dark); border-radius: 6px;
  padding: .45rem 1rem; cursor: pointer; font-size: .82rem;
  font-weight: 600; transition: background .15s, color .15s, border-color .15s;
}
.btn-posponer .btn-icon { width: 14px; height: 14px; }
.btn-posponer:hover { background: var(--gold); color: #fff; border-color: var(--gold-dark); }

/* Modal dialog (native <dialog>) */
.modal-dialog {
  border: none; border-radius: 12px; padding: 1.5rem;
  width: min(460px, 95vw); box-shadow: 0 8px 32px rgba(0,0,0,.22);
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.modal-dialog::backdrop { background: rgba(0,0,0,.45); }

.snooze-options { display: flex; flex-direction: column; gap: .45rem; }
.snooze-radio { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.snooze-radio input { accent-color: var(--navy); }

/* Toast notification */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9000;
  padding: .8rem 1.25rem; border-radius: 8px; font-size: .88rem;
  font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: opacity .45s ease, transform .45s ease;
  animation: toastIn .3s ease;
}
.toast-success { background: #e6f4ea; color: #2e7d32; border: 1px solid #a5d6a7; }
.toast--hiding  { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* Import spinner */
@keyframes lexia-spin { to { transform: rotate(360deg); } }
.import-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid #e0d5a8;
  border-top-color: #b8962e;
  border-radius: 50%;
  animation: lexia-spin .75s linear infinite;
  flex-shrink: 0;
}

/* Import result banner (inline, near import button) */
.import-result-banner {
  margin-top: 1rem;
  padding: .7rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  background: #e6f4ea;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-left: 4px solid #43a047;
}
.zip-import-notice {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  color: #78350f;
}
.zip-notice-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }

/* ===== Configuración personal (v37) ===== */
.config-page-wrap {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Layout dos columnas ────────────────────────────────────── */
.cfg-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  width: 100%;
  padding: 1.5rem;
  box-sizing: border-box;
}

.cfg-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 1rem;
  overflow: hidden;
  align-self: flex-start;
  max-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
}

.cfg-search-wrap {
  position: relative;
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cfg-search-icon {
  position: absolute;
  left: 1.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.cfg-search-input {
  width: 100%;
  padding: .42rem .6rem .42rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .82rem;
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}

.cfg-search-input:focus { border-color: var(--gold); }

.cfg-no-results {
  padding: .6rem .9rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
  display: none;
  flex-shrink: 0;
}

.cfg-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
}

.cfg-nav-group {
  display: block;
  width: 100%;
  flex-shrink: 0;
}

.cfg-nav-group-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .6rem .9rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  cursor: pointer;
  text-align: left;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
}

.cfg-nav-group-btn:hover { background: var(--bg-alt); }

.cfg-nav-group--active .cfg-nav-group-btn {
  color: var(--gold);
  background: rgba(201,168,76,.07);
}

.cfg-nav-group-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cfg-nav-group-label { flex: 1; }

.cfg-nav-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.cfg-nav-group--open .cfg-nav-chevron { transform: rotate(180deg); }

.cfg-nav-group-items {
  display: none;
  flex-direction: column;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.cfg-nav-group--open .cfg-nav-group-items { display: flex; }

.cfg-nav-item {
  display: block;
  padding: .38rem .9rem .38rem 2.4rem;
  font-size: .81rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  text-align: left;
  transition: color .1s, background .1s;
}

.cfg-nav-item:hover { color: var(--text); background: rgba(0,0,0,.04); }
.cfg-nav-item.active { color: var(--gold); font-weight: 500; }

/* Sub-group label inside sidebar accordion (INTERFAZ / SEGURIDAD / DESPACHO…) */
.cfg-nav-subgroup {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .75rem 1rem .2rem;
  pointer-events: none;
  user-select: none;
}
.cfg-nav-subgroup:first-child { padding-top: .35rem; }

/* Group separator in the right panel */
.cfg-panel-group-sep {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.5rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.cfg-group-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 2rem 0 1rem;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.cfg-group-title::before,
.cfg-group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── WA mode cards (2×2 grid, plan-pricing style) ───────────────── */
.wa-mode-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: .25rem;
}
@media (max-width: 540px) {
  .wa-mode-cards-grid { grid-template-columns: 1fr; }
}
.wa-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: 1rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}
.wa-mode-card:hover {
  border-color: #9ca3af;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.wa-mode-card--active {
  border-color: #C9A84C !important;
  background: #fffbeb !important;
  box-shadow: 0 0 0 1px #C9A84C33;
}
.wa-mode-card-icon {
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.wa-mode-card--active .wa-mode-card-icon {
  color: #C9A84C;
}
.wa-mode-card-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.wa-mode-card-desc {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.3;
}
/* Cards del modal de conexión Gmail post-OAuth */
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* ── #gmail-connected-modal — light white theme ────────────────── */
#gmail-connected-modal .gd-modal-box {
  animation: modalSlideUp 0.3s ease;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12) !important;
  color: #1B2B4A;
}
@media (max-width: 720px) {
  #gmail-connected-modal .gd-modal-box {
    min-width: unset !important;
    width: 95vw !important;
  }
}
#gmail-connected-modal .gd-modal-title {
  color: #1B2B4A !important;
  font-weight: 700;
}
#gmail-connected-modal .gd-modal-body { color: #6b7280 !important; }
#gmail-connected-modal .gd-modal-icon i { color: #22c55e !important; }

/* ── Cards selección inicial ── */
.gc-connect-card {
  position: relative !important;
  border-radius: 12px !important;
  padding: 1.5rem !important;
  transition: all 0.2s ease !important;
  border: 1.5px solid #e5e7eb !important;
  background: #f8fafc !important;
  color: #1B2B4A !important;
  box-shadow: none !important;
}
.gc-connect-card:hover {
  transform: translateY(-2px) !important;
  border-color: #C9A84C !important;
  background: rgba(201,168,76,0.06) !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08) !important;
}
a.gc-connect-card:hover, button.gc-connect-card:hover {
  background: rgba(201,168,76,0.06) !important;
}
.gmail-card-icon-navy { background: #1B2B4A !important; }
.gmail-card-icon-navy svg { stroke: #fff !important; }
.gmail-card-icon-gold  { background: #FDF8EC !important; }
.gmail-card-icon-gold  svg { stroke: #C9A84C !important; }
.gc-title-navy { color: #1B2B4A !important; }
.gc-title-gold { color: #1B2B4A !important; }
#gmail-connected-modal .gc-connect-card span[style*="#6b7280"] { color: #6b7280 !important; }
#gmail-connected-modal p[style*="color:#6b7280"],
#gmail-connected-modal p[style*="color: #6b7280"] { color: #6b7280 !important; }
#gmail-connected-modal p[style*="#9ca3af"] { color: #9ca3af !important; }
#gmail-connected-modal hr[style*="border-top:1px solid #C9A84C"] { opacity: 1; }

/* ── Modal box: relative para el sheet absoluto ── */
#gmail-connected-modal .gd-modal-box { position: relative !important; }

/* ── Label picker: estructura principal ── */
.gc-picker-header {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-bottom: .9rem;
}
.gc-back-btn { display: none; }
.gc-picker-titles { text-align: center; }
.gc-picker-title {
  color: #1B2B4A;
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 .2rem;
}
.gc-picker-subtitle {
  color: #6b7280;
  font-size: .8rem;
  margin: 0;
  line-height: 1.45;
}

/* ── Bloque etiquetas seleccionadas (vista principal) ── */
.gc-sel-block {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .7rem .85rem;
  margin-bottom: .75rem;
}
.gc-sel-block-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .55rem;
}
.gc-sel-block-label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.gc-open-sel-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .75rem;
  background: transparent;
  border: 1.5px solid #C9A84C;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  color: #C9A84C;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.gc-open-sel-btn:hover {
  background: rgba(201,168,76,0.10);
}
.gc-sel-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-height: 1.6rem;
  align-items: center;
}
.gc-sel-pill {
  display: inline-flex;
  align-items: center;
  padding: .22rem .45rem .22rem .65rem;
  background: rgba(201,168,76,0.12);
  border: 1px solid #C9A84C;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  color: #1B2B4A;
  white-space: nowrap;
}
.gc-sel-pill .remove-btn {
  background: none;
  border: none;
  color: rgba(0,0,0,0.4);
  font-size: .75rem;
  padding: 0 0 0 4px;
  cursor: pointer;
  line-height: 1;
  transition: color .15s;
}
.gc-sel-pill .remove-btn:hover {
  color: #dc2626;
}
.gc-sel-empty {
  font-size: .8rem;
  color: #9ca3af;
  font-style: italic;
}

/* ── Sheet selector (overlay interno sobre el modal) ── */
.gc-sel-sheet {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: #fff;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.35rem 1rem;
  box-sizing: border-box;
  animation: gcSheetIn 0.22s ease;
  overflow: hidden;
}
@keyframes gcSheetIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.gc-sel-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .85rem;
  flex-shrink: 0;
}
.gc-sel-sheet-title {
  font-size: .95rem;
  font-weight: 700;
  color: #1B2B4A;
  margin: 0 0 .15rem;
}
.gc-sel-sheet-sub {
  font-size: .78rem;
  color: #6b7280;
  margin: 0;
}
.gc-sel-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.gc-sel-sheet-close:hover { background: #e5e7eb; color: #1B2B4A; }
.gc-sel-sheet-footer {
  margin-top: .5rem;
  flex-shrink: 0;
}
.gc-sel-apply-btn {
  width: 100%;
  display: block;
  padding: .6rem 1rem;
  background: #C9A84C;
  color: #1B2B4A;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.gc-sel-apply-btn:hover { background: #b8923e; }

/* Pills dentro del sheet: scroll flex-wrap */
#gmail-connected-modal .gc-pills-wrap {
  flex: 1;
  flex-wrap: wrap;
  align-content: flex-start;
  max-height: 260px;
  overflow-y: auto;
  min-height: 80px;
  padding: .5rem;
}

/* ── Preview etiquetas seleccionadas (sobre el botón Apply) ── */
.gc-selected-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
  padding: .45rem .25rem;
  min-height: 2rem;
  flex-shrink: 0;
  border-top: 1px solid #f0f0f0;
  margin-top: .2rem;
}
.gc-no-selection {
  font-size: .8rem;
  color: #9ca3af;
  font-style: italic;
}
.gc-sheet-sel-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem .2rem .65rem;
  background: rgba(201,168,76,0.15);
  border: 1.5px solid #C9A84C;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 600;
  color: #1B2B4A;
  white-space: nowrap;
}
.gc-pill-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .75rem;
  line-height: 1;
  color: rgba(0,0,0,0.4);
  padding: 0 0 0 4px;
  margin-left: 0;
  transition: color .15s;
}
.gc-pill-x:hover { color: #dc2626; }

/* ── Barra de búsqueda ── */
.gc-search-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding-bottom: .6rem;
}
.gc-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}
.gc-search-icon {
  position: absolute !important;
  left: .65rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 14px !important;
  height: 14px !important;
  color: #9ca3af;
  pointer-events: none !important;
  flex-shrink: 0;
}
/* Fuerza al SVG hijo de .gc-search-icon la misma dimensión */
.gc-search-icon svg {
  width: 14px !important;
  height: 14px !important;
  display: block;
}
#gc-label-search {
  padding-left: 2.5rem !important;
}
.gc-search-input {
  width: 100%;
  padding: .5rem 2rem .5rem 2.5rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: .83rem;
  color: #1B2B4A;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, background .15s;
}
.gc-search-input::placeholder { color: #9ca3af; }
.gc-search-input:focus {
  border-color: #C9A84C;
  background: #fff;
}
.gc-search-clear {
  position: absolute;
  right: .55rem;
  display: none;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
}
.gc-search-clear:hover { background: #d1d5db; color: #1B2B4A; }

/* ── Loading ── */
.gc-picker-loading {
  display: block;
  text-align: center;
  padding: 1.2rem 0;
  color: #6b7280;
  font-size: .82rem;
}
.gc-picker-loading .spinner-sm {
  display: inline-block;
  vertical-align: middle;
  margin-right: .35rem;
}

/* ── Pills ── */
.gc-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .65rem;
  max-height: 200px;
  overflow-y: auto;
  padding: .75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,168,76,0.3) transparent;
}
.gc-pills-wrap::-webkit-scrollbar { width: 4px; }
.gc-pills-wrap::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.35); border-radius: 4px; }
.gc-label-pill {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid #e5e7eb;
  background: #f9fafb;
  color: #1B2B4A;
  border-radius: 99px;
  padding: .25rem .8rem;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.3;
}
.gc-label-pill:hover {
  border-color: #C9A84C;
  background: rgba(201,168,76,0.08);
}
.gc-label-pill.selected {
  border-color: #C9A84C;
  background: rgba(201,168,76,0.18);
  font-weight: 600;
}

/* ── Crear etiqueta inline ── */
.gc-create-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .6rem;
}
.gc-create-input {
  flex: 1;
  padding: .42rem .7rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: .82rem;
  color: #1B2B4A;
  outline: none;
  min-width: 0;
  transition: border-color .15s;
}
.gc-create-input::placeholder { color: #9ca3af; }
.gc-create-input:focus { border-color: #C9A84C; }
.gc-create-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .42rem .85rem;
  background: #C9A84C;
  color: #1B2B4A;
  border: none;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: .45;
  transition: opacity .15s, background .15s;
}
.gc-create-btn:not([disabled]) { opacity: 1; }
.gc-create-btn:not([disabled]):hover { background: #b8923e; }

/* ── Resumen etiquetas ── */
.gc-summary {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  margin-bottom: .55rem;
  padding: .45rem .7rem;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 8px;
  font-size: .78rem;
  color: #1B2B4A;
  line-height: 1.5;
}

/* ── Success banner ── */
.gc-success-banner {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .8rem;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 600;
  color: #4ade80;
  margin-bottom: .55rem;
}

/* ── Bloque frecuencia sincronización — fila compacta ── */
.gc-sync-block {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .85rem;
  padding: .45rem .75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: .85rem;
  color: #4b5563;
}
.gc-sync-icon-wrap { display: none; }
.gc-sync-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .5rem;
  flex: 1;
  flex-wrap: wrap;
}
.gc-sync-label {
  font-size: .85rem;
  font-weight: 500;
  color: #4b5563;
}
.gc-sync-freq {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: #4b5563;
}
.gc-sync-select {
  padding: 2px 8px;
  background: #fff;
  border: 1px solid #C9A84C;
  border-radius: 6px;
  font-size: .85rem;
  color: #1B2B4A;
  cursor: pointer;
  outline: none;
}
.gc-sync-select option { background: #fff; color: #1B2B4A; }

/* ── Botones acción principales ── */
.gc-picker-actions {
  display: flex;
  gap: .5rem;
}
.gc-confirm-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1rem;
  background: #C9A84C;
  color: #1B2B4A;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.gc-confirm-btn:hover { background: #b8923e; transform: translateY(-1px); }
.gc-skip-btn {
  padding: .65rem 1rem;
  background: transparent;
  border: 1.5px solid #1B2B4A;
  border-radius: 10px;
  font-size: .84rem;
  color: #1B2B4A;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.gc-skip-btn:hover { background: rgba(27,43,74,0.05); }

/* No-results text override (tenia color blanc inline) */
#gc-label-no-results { color: #9ca3af !important; }

/* ── Animación cards ── */
@keyframes gcCardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
#gc-modal-cards a.gc-connect-card {
  animation: gcCardIn 0.35s ease both;
  animation-delay: 0.05s;
}
#gc-modal-cards button.gc-connect-card {
  animation: gcCardIn 0.35s ease both;
  animation-delay: 0.15s;
}

/* ── Tooltip cards ── */
.gc-connect-card[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(calc(-100% - 10px));
  background: #1B2B4A;
  color: #fff;
  font-size: .78rem;
  font-weight: 400;
  border-radius: 8px;
  padding: 8px 12px;
  width: 220px;
  line-height: 1.45;
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 300;
}
.gc-connect-card[data-tooltip]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(calc(-100% + 2px));
  border: 6px solid transparent;
  border-top-color: #1B2B4A;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 300;
}
.gc-connect-card[data-tooltip]:hover::before,
.gc-connect-card[data-tooltip]:hover::after { opacity: 1; }

/* ── Informe semanal — card ON/OFF + secciones ──────────────────── */
.report-enable-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  margin-bottom: 1rem;
}
.report-enable-card:hover { border-color: #9ca3af; }
.report-enable-card--active {
  border-color: #C9A84C !important;
  background: #fffbeb !important;
  box-shadow: 0 0 0 1px #C9A84C33;
}
.report-enable-card-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.report-enable-card-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.report-enable-card--active .report-enable-card-icon { color: #C9A84C; }

.report-sections-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.report-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.report-section-row--last { border-bottom: none; }
.report-section-row-title {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}
.report-section-row-desc {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.report-inline-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .75rem;
}
.report-inline-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  min-width: 110px;
}

/* Hint discreta "sin suscripción push" */
.no-push-hint {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .45rem .7rem;
  margin-top: .5rem;
  line-height: 1.4;
}
.link-subtle {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-subtle:hover { color: var(--text); }

.cfg-panels-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Highlight al hacer scroll hacia una sección */
.cfg-section-highlight {
  outline: 2px solid var(--gold) !important;
  outline-offset: 3px;
  transition: outline .15s;
}

/* Botón móvil — oculto en desktop */
.cfg-mobile-btn {
  display: none;
  align-items: center;
  gap: .45rem;
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: .84rem;
  color: var(--text);
  cursor: pointer;
  margin-bottom: .5rem;
}

.cfg-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}

.cfg-sidebar-overlay.open { display: block; }

@media (max-width: 640px) {
  .config-page-wrap { max-width: 100%; }
  .cfg-layout { display: block; }
  .cfg-mobile-btn { display: flex; }
  .cfg-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 200;
    width: 280px;
    border-radius: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,.18);
  }
  .cfg-sidebar.open { display: flex; }
  .cfg-panels-wrap { padding-left: 0; }
}
/* form es transparente al flex para que las secciones cojan el gap */
.config-form-flat { display: contents; }

/* ── Pestañas de configuración ──────────────────────────────── */
.cfg-tabs {
  display: flex;
  gap: .6rem;
  margin-bottom: .25rem;
}
.cfg-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .8rem .5rem .7rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  font-family: inherit;
}
.cfg-tab:hover {
  border-color: #c9a84c88;
  background: #fdfcf8;
}
.cfg-tab.active {
  border-color: var(--gold);
  background: #faf9f6;
  box-shadow: 0 2px 10px rgba(201,168,76,.18);
}
.cfg-tab-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--cfg-tab-color, var(--gold)) 13%, transparent);
  color: var(--cfg-tab-color, var(--gold));
  transition: background .15s;
}
.cfg-tab.active .cfg-tab-icon {
  background: color-mix(in srgb, var(--cfg-tab-color, var(--gold)) 20%, transparent);
}
.cfg-tab-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.cfg-tab.active .cfg-tab-label { color: var(--navy); }

/* ── Section icon box ── */
.cfg-section-icon {
  --si-color: #475569;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: color-mix(in srgb, var(--si-color) 13%, transparent);
  color: var(--si-color);
}

/* Paneles de contenido */
.cfg-panel { display: none; }
.cfg-panel.active { display: flex; flex-direction: column; gap: 1rem; }

.config-section {
  background: #faf9f6;
  border: 1px solid #e5e1d8;
  border-left: 3.5px solid var(--navy);
  border-radius: 14px;
  padding: 1.35rem 1.4rem;
  box-shadow: 0 1px 6px rgba(27,43,74,.06);
}
[data-theme="dark"] .config-section {
  background: var(--surface);
  border-color: var(--border);
  border-left-color: var(--gold);
}

/* Checkbox nativo dentro de ajustes — color navy */
.config-section input[type="checkbox"]:not(.toggle-switch input) {
  accent-color: var(--navy);
  width: 16px; height: 16px; cursor: pointer;
}
[data-theme="dark"] .config-section input[type="checkbox"]:not(.toggle-switch input) {
  accent-color: var(--gold);
}
.config-section-title {
  font-size: 1rem; font-weight: 700; color: var(--navy);
  margin: 0 0 .45rem;
  display: flex; align-items: center; gap: .5rem;
}
[data-theme="dark"] .config-section-title { color: var(--text); }

/* ── Visibilidad condicional por dispositivo ────────────────────── */
@media (max-width: 768px) { .desktop-only { display: none !important; } }
@media (min-width: 769px) { .mobile-only  { display: none !important; } }

/* ── Selector de archivo personalizado ─────────────────────────── */
.file-pick-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.file-pick-btn { display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.file-pick-name {
  font-size: .85rem; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.file-pick-name--set { color: var(--navy); font-weight: 600; }
[data-theme="dark"] .file-pick-name--set { color: var(--gold); }
.config-desc { font-size: .88rem; color: var(--text); margin: 0 0 1rem; line-height: 1.55; }
.config-hint  { font-size: .84rem; color: var(--text-muted); line-height: 1.5; }
.form-label   { color: var(--text); font-weight: 600; }
.range-badge  { color: var(--navy); font-weight: 700; }
[data-theme="dark"] .range-badge { color: var(--gold); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap:1rem;
}
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #ccc;
  border-radius: 24px; cursor: pointer; transition: .25s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  left: 3px; bottom: 3px; background: var(--surface); transition: .25s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--navy); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }


/* --- Range slider row ---------------------------------- */
.range-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .35rem;
}
.range-row input[type=range] {
  flex: 1;
  accent-color: var(--navy, #1B2B4A);
}
.range-badge {
  display: inline-block;
  background: var(--navy, #1B2B4A);
  color: #fff;
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 4rem;
  text-align: center;
  flex-shrink: 0;
}
.form-select { padding: .45rem .7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }

/* ===== Expediente de cliente — tabs + plazos + docs (v38) ===== */

/* KPI strip */
.cp-kpi-strip {
  display: flex; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; margin-bottom: 1.2rem;
}
.cp-kpi {
  flex: 1; background: var(--surface); padding: .75rem .5rem; text-align: center;
  cursor: pointer; transition: background .15s;
}
.cp-kpi:hover { background: #f5f7fb; }
.cp-kpi-active { background: var(--navy) !important; }
.cp-kpi-active .cp-kpi-n { color: #fff; }
.cp-kpi-active .cp-kpi-l { color: rgba(255,255,255,.7); }
.cp-kpi-n { display: block; font-size: 1.5rem; font-weight: 800; color: var(--navy); line-height: 1; }
.cp-kpi-l { display: block; font-size: .72rem; color: var(--text-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .04em; }

/* Tabs */
.exp-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 1.2rem;
}
.exp-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; padding: .6rem 1.1rem;
  font-size: .88rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: .4rem;
}
.exp-tab:hover { color: var(--navy); }
.exp-tab-active { color: var(--navy) !important; border-bottom-color: var(--navy) !important; }
.exp-tab-badge {
  background: var(--navy); color: #fff;
  font-size: .68rem; font-weight: 700;
  border-radius: 10px; padding: .1rem .42rem; min-width: 1.3rem; text-align: center;
}
.exp-tab-active .exp-tab-badge { background: var(--gold); }

/* Panel */
.exp-panel { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Timeline filter row */

/* Month groups in timeline */
.tl-month-group { margin-bottom: 1.4rem; }
.tl-month-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  padding: .3rem 0 .5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .6rem;
}
.tl-attach-icon { font-size: .85rem; margin-right: .25rem; opacity: .7; }

/* Plazos list */
.exp-plazos-list { display: flex; flex-direction: column; gap: .65rem; }
.plazo-card {
  display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1rem; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; color: inherit;
  transition: box-shadow .15s, border-color .15s;
}
.plazo-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); border-color: #c5cde0; }
.plazo-vencido { border-left: 4px solid #e53935 !important; background: #fff8f8; }
.plazo-hoy     { border-left: 4px solid #f57c00 !important; background: #fff8f0; }
.plazo-proximo { border-left: 4px solid var(--gold) !important; }
.plazo-resolved { opacity: .55; }
.plazo-date-col { min-width: 52px; text-align: center; flex-shrink: 0; }
.plazo-day { display: block; font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
.plazo-mon { display: block; font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.plazo-body { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.plazo-summary { font-size: .88rem; color: var(--text); margin: 0; }
.plazo-days-col { flex-shrink: 0; text-align: right; }
.plazo-pill {
  display: inline-block; border-radius: 12px; padding: .22rem .65rem;
  font-size: .75rem; font-weight: 700;
}
.plazo-pill-late  { background: #fde8e8; color: #c62828; }
.plazo-pill-today { background: #fff3e0; color: #e65100; }
.plazo-pill-soon  { background: #fff8e1; color: #b45000; }
.plazo-pill-ok    { background: #e8f5e9; color: #2e7d32; }
.plazo-check      { display: block; font-size: .75rem; color: var(--text-muted); margin-top: .2rem; text-align: center; }

/* Documentos list */
.exp-docs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.doc-card {
  display: flex; flex-direction: column; gap: .5rem;
  padding: 1rem; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; color: inherit;
  transition: box-shadow .15s, border-color .15s;
}
.doc-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.09); border-color: #c5cde0; }
.doc-card-head { display: flex; align-items: center; gap: .5rem; }
.doc-icon { font-size: 1.1rem; }
.doc-date { font-size: .78rem; color: var(--text-muted); flex: 1; }
.doc-summary { font-size: .88rem; font-weight: 600; color: var(--text); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-analysis { font-size: .8rem; color: var(--text-muted); margin: 0; line-height: 1.45; flex: 1; }
.doc-analysis-muted { font-style: italic; }
.doc-link-hint { font-size: .75rem; color: var(--gold); font-weight: 600; margin-top: auto; }

/* ── Plazos alert strip (client profile) ── */
.cp-plazos-strip {
  background: #fffbf0; border: 1.5px solid #f0d070;
  border-radius: 10px; margin-bottom: 1rem; overflow: hidden;
}
.cpps-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .9rem; background: #fef9e7;
  border-bottom: 1px solid #f0d070;
}
.cpps-icon { font-size: .95rem; }
.cpps-title { font-size: .8rem; font-weight: 700; color: #92400e; flex: 1; }
.cpps-ver-todos {
  background: none; border: none; cursor: pointer;
  font-size: .75rem; font-weight: 600; color: var(--navy);
  text-decoration: underline; padding: 0;
}
.cpps-row {
  display: flex; align-items: center; gap: .65rem;
  padding: .5rem .9rem; text-decoration: none; color: inherit;
  border-bottom: 1px solid #fce9a0; transition: background .12s;
}
.cpps-row:last-child { border-bottom: none; }
.cpps-row:hover { background: #fef3c7; }
.cpps-row.cpps-late  { background: #fff1f1; }
.cpps-row.cpps-today { background: #fff7ed; }
.cpps-row.cpps-soon  { background: #fffbeb; }
.cpps-date { font-size: .75rem; color: var(--text-muted); white-space: nowrap; min-width: 72px; }
.cpps-pill {
  font-size: .7rem; font-weight: 700; border-radius: 999px;
  padding: .12rem .55rem; white-space: nowrap;
}
.cpps-pill-late  { background: #fee2e2; color: #991b1b; }
.cpps-pill-today { background: #fed7aa; color: #9a3412; }
.cpps-pill-soon  { background: #fef9c3; color: #713f12; }
.cpps-pill-ok    { background: #dcfce7; color: #166534; }
.cpps-summary { font-size: .82rem; color: #444; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Subtitle warning span (plazos page) */
.subtitle-warn { color: #b45309; font-weight: 600; }

/* ── Admin users list ── */
.admin-list-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-list-header h2 { margin: 0; }
.admin-search-input { width: 100%; }
.admin-user-list { display: flex; flex-direction: column; gap: .5rem; }
.admin-user-row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .7rem .9rem; border-radius: 9px;
  border: 1px solid var(--border); background: #fafbfc;
  transition: background .12s;
}
.admin-user-row:hover { background: #f1f5f9; }
.aur-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.aur-info { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 140px; }
.aur-name { font-weight: 600; font-size: .9rem; color: var(--navy); display: flex; align-items: center; gap: .4rem; }
.aur-email { font-size: .78rem; color: var(--text-muted); }
.aur-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.aur-date { font-size: .72rem; color: var(--text-muted); }
.aur-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.aur-reset-form { display: flex; gap: .4rem; align-items: center; }
.admin-no-results { text-align: center; color: var(--text-muted); font-size: .88rem; padding: 1rem; }
.admin-user-row--link { text-decoration: none; cursor: pointer; }
.admin-user-row--link:hover { background: #f1f5f9; }
.aur-chevron { margin-left: auto; flex-shrink: 0; }
.admin-card-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.page-hero-back {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; font-weight: 600; color: rgba(255,255,255,.8);
  text-decoration: none; margin-bottom: .5rem;
}
.page-hero-back:hover { color: #fff; }
.detail-stats-grid { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.detail-stat-item { display: flex; flex-direction: column; gap: .15rem; }
.detail-stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-stat-value { font-size: .95rem; font-weight: 600; color: var(--navy); }

/* ── Usuario tab card ── */
.admin-tab-card { padding: 0; overflow: hidden; }
.utab-header {
  display: flex; border-bottom: 2px solid var(--border);
  background: #f8fafc;
}
.utab-btn {
  flex: 1; padding: .85rem 1.25rem;
  border: none; background: transparent; cursor: pointer;
  font-size: .9rem; font-weight: 600; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  transition: color .15s, background .15s;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.utab-btn:hover { color: var(--navy); background: #f1f5f9; }
.utab-btn.utab-active { color: var(--navy); border-bottom-color: var(--gold); background: var(--surface); }
.utab-count {
  background: var(--navy); color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
}
.utab-panel { padding: 1.25rem 1.5rem; }
.admin-list-header { margin-bottom: .9rem; }
.admin-search-input { width: 100%; }

/* ── Password reset toggle ── */
.aur-reset-wrap { display: flex; flex-direction: column; gap: .35rem; }
.aur-reset-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.btn-ghost { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: .25rem .4rem; font-size: .85rem; }
.btn-ghost:hover { color: var(--navy); }

/* ── Clientes sort toolbar ── */
.cl-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.cl-toolbar .cl-search-wrap { flex: 1; min-width: 200px; }
.cl-sort-wrap { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.cl-sort-label { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.cl-sort-btn {
  font-size: .78rem; padding: .3rem .65rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); cursor: pointer; transition: all .12s;
}
.cl-sort-btn:hover { border-color: var(--navy); color: var(--navy); }
.cl-sort-btn.cl-sort-active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Búsqueda global (nav) ── */
/* ── Búsqueda global (página /buscar) ── */
.gsearch-form { margin-bottom: .5rem; }
.gsearch-wrap { display: flex; gap: .6rem; }
.gsearch-input { flex: 1; font-size: 1rem; }
.gsearch-smart-box {
  margin-bottom: 1.2rem;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.gsearch-smart-box:empty { display: none; }
.gsearch-empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.gsearch-empty p { margin: .25rem 0; }
.gsearch-empty-hint { font-size: .85rem; }
.gsearch-section { margin-bottom: 2rem; }
.gsearch-section-title {
  font-size: .88rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); padding-bottom: .4rem;
  margin-bottom: .9rem; display: flex; align-items: center; gap: .5rem;
}
.gsearch-count {
  background: var(--navy); color: #fff;
  font-size: .72rem; padding: 1px 7px; border-radius: 999px;
}
.gsearch-msg-list { display: flex; flex-direction: column; gap: .4rem; }
.gsearch-msg-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem; border-radius: 9px;
  border: 1px solid var(--border); background: #fafbfc;
  text-decoration: none; color: inherit; transition: background .12s;
}
.gsearch-msg-row:hover { background: #f1f5f9; }
.urgency-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.urgency-dot-p0 { background: #dc2626; }
.urgency-dot-p1 { background: #f97316; }
.urgency-dot-p2 { background: #eab308; }
.urgency-dot-p3 { background: #6b7280; }
.gsearch-msg-body { flex: 1; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.gsearch-msg-sender { font-weight: 600; font-size: .85rem; color: var(--navy); }
.gsearch-msg-preview { font-size: .8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsearch-msg-date { font-size: .75rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ── User active / inactive states ── */
.aur-inactive { opacity: .65; background: #f8f8f8; }
.aur-avatar-inactive { background: #94a3b8; }
.aur-inactive-badge {
  font-size: .68rem; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; background: #f1f5f9;
  color: #64748b; border: 1px solid #cbd5e1; margin-left: .25rem;
}
.btn-deactivate {
  border: 1px solid #f59e0b; color: #92400e;
  background: #fffbeb;
}
.btn-deactivate:hover { background: #fef3c7; }
.btn-activate {
  border: 1px solid #22c55e; color: #15803d;
  background: #f0fdf4;
}
.btn-activate:hover { background: #dcfce7; }

/* ── Admin Stats ── */
.ast-kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .75rem; margin-bottom: 1.25rem;
}
.ast-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.1rem 1rem; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.ast-kpi-num { display: block; font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.ast-kpi-label { display: block; font-size: .72rem; color: var(--text-muted); margin-top: .3rem; text-transform: uppercase; letter-spacing: .04em; }

.ast-chart-card h2 { margin-bottom: .9rem; }
.ast-bar-chart { display: flex; align-items: flex-end; gap: 2px; height: 80px; }
.ast-bar-wrap { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.ast-bar { width: 100%; background: var(--navy); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .75; transition: opacity .1s; }
.ast-bar-wrap:hover .ast-bar { opacity: 1; }
.ast-chart-labels { display: flex; justify-content: space-between; font-size: .7rem; color: var(--text-muted); margin-top: .35rem; }

.ast-lawyer-list { display: flex; flex-direction: column; gap: .5rem; }
.ast-lawyer-row {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .75rem 1rem; border-radius: 10px;
  border: 1px solid var(--border); background: #fafbfc;
}
.ast-row-inactive { opacity: .55; background: #f5f5f5; }
.ast-lw-info { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 150px; }
.ast-lw-name { font-weight: 600; font-size: .9rem; color: var(--navy); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ast-lw-since { font-size: .72rem; color: var(--text-muted); }
.ast-lw-stat { display: flex; flex-direction: column; align-items: center; min-width: 60px; }
.ast-stat-num { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.ast-stat-label { font-size: .67rem; color: var(--text-muted); text-align: center; text-transform: uppercase; letter-spacing: .03em; }
.ast-fresh { color: #16a34a; }
.ast-warn  { color: #d97706; }
.ast-cold  { color: #94a3b8; }
.ast-privacy-note {
  text-align: center; font-size: .78rem; color: var(--text-muted);
  margin-top: 1.5rem; padding: .6rem; background: #f8fafc;
  border-radius: 8px; border: 1px solid var(--border);
}

/* ── AI usage table ── */
.ast-ia-table-wrap { overflow-x: auto; }
.ast-ia-table {
  width: 100%; border-collapse: collapse; font-size: .85rem;
}
.ast-ia-table th {
  text-align: left; padding: .5rem .75rem; font-size: .75rem; font-weight: 600;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  background: #f8fafc; white-space: nowrap;
}
.ast-ia-table td {
  padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ast-ia-table th.ast-ia-num,
.ast-ia-table td.ast-ia-num { text-align: right; }
.ast-ia-table .ast-ia-total { font-weight: 700; color: var(--text); }
.ast-ia-table .ast-ia-cost  { font-weight: 700; color: var(--gold-dark); font-family: monospace; }
.ast-ia-table .ast-ia-row-zero td { color: var(--text-muted); }
.ast-ia-table .ast-lw-name  { display: block; font-weight: 600; }
.ast-ia-table .ast-lw-email { display: block; font-size: .75rem; color: var(--text-muted); }
.ast-ia-note {
  font-size: .75rem; color: var(--text-muted); margin-top: .75rem;
  padding: .5rem .75rem; background: #f8fafc; border-radius: 6px;
  border: 1px solid var(--border);
}
.ast-ia-row-admin { background: #fafaf7; }
.ast-ia-admin-badge {
  display: inline-block; font-size: .65rem; font-weight: 700;
  background: var(--gold); color: #fff; border-radius: 4px;
  padding: 1px 5px; margin-left: .35rem; vertical-align: middle;
  letter-spacing: .03em;
}

/* ── IA cell: llamadas + coste apilados ── */
.ast-ia-cell { line-height: 1.2; }
.ast-ia-calls { display: block; font-weight: 600; color: var(--text); }
.ast-ia-cell-cost {
  display: block; font-size: .7rem; color: var(--text-muted);
  font-family: monospace; letter-spacing: -.01em;
}

/* ── Online indicator ── */
.ast-online-dot {
  display: inline-block; width: 9px; height: 9px;
  background: #22c55e; border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
  animation: ast-pulse-online 2s infinite;
  flex-shrink: 0;
}
.ast-online-dot-avatar {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  border: 2px solid var(--surface);
}
@keyframes ast-pulse-online {
  0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(34,197,94,.2); }
  50%       { box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(34,197,94,.0); }
}
.ast-online-badge {
  display: inline-block; font-size: .62rem; font-weight: 700;
  background: #dcfce7; color: #15803d; border-radius: 4px;
  padding: 1px 5px; margin-left: .3rem; vertical-align: middle;
  letter-spacing: .03em; border: 1px solid #bbf7d0;
}
.ast-kpi-online {
  border-color: #bbf7d0 !important;
  background: #f0fdf4;
}
.ast-kpi-online .ast-kpi-num { color: #15803d; }
.ast-kpi-online .ast-kpi-label { color: #166534; }

/* ── Admin Stats v2 ── */
.ast-kpi-alert { border-color: #fca5a5 !important; background: #fff5f5; }
.ast-kpi-alert .ast-kpi-num { color: #dc2626; }
.ast-global-trend { font-size: .85rem; font-weight: 600; margin-left: .35rem; }
.ast-trend-up   { color: #16a34a; }
.ast-trend-down { color: #dc2626; }
.ast-trend-stable { color: #94a3b8; }
.ast-trend-new  { color: #7c3aed; }
.ast-trend-ico  { font-size: .8rem; }

.ast-middle-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.ast-flex-grow  { flex: 2; min-width: 280px; }
.ast-side-panel { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 1rem; }
.ast-chart-compare { font-size: .75rem; color: var(--text-muted); margin-top: .5rem; }

/* Section descriptions */
.ast-section-desc { font-size: .75rem; color: var(--text-muted); margin: -.15rem 0 .7rem; line-height: 1.4; }

/* Channel bars */
.ast-channel-row  { display: flex; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.ast-channel-name { font-size: .8rem; min-width: 120px; flex-shrink: 0; }
.ast-channel-bar-wrap { flex: 1; height: 10px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.ast-channel-bar  { height: 100%; border-radius: 6px; transition: width .4s; }
.ast-ch-wa { background: #25D366; }
.ast-ch-gm { background: #EA4335; }
.ast-ch-ol { background: #0078D4; }
.ast-ch-ic { background: #003DA5; }
.ast-ch-mn { background: #9ca3af; }
.ast-channel-pct  { font-size: .75rem; color: var(--text-muted); min-width: 32px; text-align: right; }

/* Feature adoption bars */
.ast-feat-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.ast-feat-label { font-size: .78rem; min-width: 130px; flex-shrink: 0; }
.ast-feat-bar-wrap { flex: 1; height: 10px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.ast-feat-bar  { height: 100%; background: var(--navy); border-radius: 6px; opacity: .7; transition: width .4s; }
.ast-feat-count { font-size: .75rem; color: var(--text-muted); min-width: 36px; text-align: right; }
.ast-no-data { font-size: .82rem; color: var(--text-muted); }

/* Risk row */
.ast-row-risk { border-color: #fca5a5; background: #fff8f8; }
.ast-risk-badge {
  font-size: .68rem; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; background: #fee2e2;
  color: #dc2626; border: 1px solid #fca5a5;
}
/* Feature badges */
.ast-feat-badges { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .25rem; }
.ast-fbadge { font-size: .67rem; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); background: #f8fafc; color: var(--text-muted); display: inline-flex; align-items: center; gap: .2rem; }
.ast-fbadge-gm { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.ast-fbadge-wa { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.ast-fbadge-pl { border-color: #fed7aa; background: #fff7ed; color: #c2410c; }

/* Onboarding stat */
.ast-lw-since { font-size: .72rem; color: var(--text-muted); }

/* ── Privacy page ── */
.priv-card h2 { font-size: 1rem; color: var(--navy); margin: 1.5rem 0 .5rem; border-bottom: 1px solid var(--border); padding-bottom: .25rem; }
.priv-card p, .priv-card li { font-size: .9rem; line-height: 1.65; color: var(--text); }
.priv-card ul { padding-left: 1.4rem; margin-bottom: .75rem; }
.priv-card a { color: var(--navy); text-decoration: underline; }
.priv-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .75rem 0 1rem; }
.priv-table th, .priv-table td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.priv-table th { background: var(--sidebar-bg); font-weight: 600; }
/* M-05 piloto cookies.html — sustitutos de inline styles reutilizables
   por privacidad.html / terminos.html / derechos_rgpd.html. */
.priv-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1px; }
.priv-table--wide { min-width: 520px; }
.priv-note { margin-top: 1rem; }
/* M-05 piloto privacidad.html — tabla detallada de retención (sec 7) */
.priv-retention-wrap { overflow-x: auto; margin: .5rem 0 1rem; }
.priv-retention-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.priv-retention-table thead tr { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.priv-retention-table th { text-align: left; padding: .5rem .65rem; }
.priv-retention-table tbody tr { border-bottom: 1px solid var(--border); }
.priv-retention-table tbody tr:last-child { border-bottom: 0; }
.priv-retention-table td { padding: .5rem .65rem; }
.priv-fineprint { font-size: .85rem; color: var(--text-muted); }
/* H3 dentro de priv-card — alineado con la regla previa de h2 */
.priv-card h3 { margin-top: 1.2rem; margin-bottom: .5rem; font-size: 1rem; color: var(--navy); }
.priv-updated { font-size: .78rem; color: var(--text-muted); margin-top: 1.5rem; }
.footer-priv-link { color: var(--text-muted); font-size: .8rem; text-decoration: none; }
.footer-priv-link:hover { text-decoration: underline; }

/* ── Delete client panel ── */
.cp-delete-wrap { margin-bottom: 1rem; }
.cp-delete-box { background: #fff5f5; border: 1px solid #fca5a5; border-radius: 8px; padding: 1.25rem 1.5rem; }
.cp-delete-title { font-weight: 700; color: #dc2626; margin-bottom: .5rem; }
.cp-delete-desc { font-size: .88rem; color: var(--text); margin-bottom: 1rem; line-height: 1.6; }
.btn-danger { background: #dc2626; color: #fff; border: none; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline-danger { background: transparent; color: #dc2626; border: 1.5px solid #dc2626; }
.btn-outline-danger:hover { background: #fef2f2; }

/* ── Admin Panel v283 — Status cards ── */
.ast-status-cards {
  display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.ast-status-card {
  display: flex; align-items: center; gap: .75rem;
  flex: 1; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .85rem 1rem; text-decoration: none;
  transition: box-shadow .18s, border-color .18s;
  color: var(--text);
}
.ast-status-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); border-color: var(--navy); }
.ast-status-card-icon { color: var(--navy); opacity: .55; flex-shrink: 0; }
.ast-status-card-body { display: flex; flex-direction: column; }
.ast-status-card-num {
  font-size: 1.45rem; font-weight: 800; color: var(--text);
  line-height: 1.1; display: flex; align-items: center;
}
.ast-status-card-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; margin-top: .1rem; }
.ast-status-card--online { border-color: #bbf7d0; background: #f0fdf4; }
.ast-status-card--online .ast-status-card-num { color: #15803d; }
.ast-status-card--online .ast-status-card-icon { color: #22c55e; opacity: 1; }
.ast-status-card--alert { border-color: #fca5a5; background: #fff5f5; }
.ast-status-card--alert .ast-status-card-num { color: #dc2626; }
.ast-status-card--alert .ast-status-card-icon { color: #dc2626; opacity: 1; }

/* ── Admin nav group — admin blocks ── */
.nav-group--admin-block { border-top: 2px solid var(--navy); margin-top: .25rem; }
.nav-group-label--admin { color: var(--navy) !important; font-weight: 700; }

/* ── Lawyer row — last action stats ── */
.ast-lw-stat--action { min-width: 110px; }
.ast-stat-action-name {
  display: block; font-size: .72rem; font-weight: 600;
  color: var(--navy); font-family: monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px;
}

/* ── Function usage bar chart ── */
.ast-action-chart { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }
.ast-ac-row { display: flex; align-items: center; gap: .75rem; }
.ast-ac-label {
  font-size: .8rem; min-width: 140px; flex-shrink: 0;
  color: var(--text); white-space: nowrap;
}
.ast-ac-bar-wrap {
  flex: 1; height: 12px; background: #f1f5f9;
  border-radius: 6px; overflow: hidden;
}
.ast-ac-bar {
  height: 100%; background: var(--navy); border-radius: 6px;
  opacity: .75; transition: width .5s;
}
.ast-ac-calls { font-size: .78rem; font-weight: 700; min-width: 30px; text-align: right; color: var(--text); }
.ast-ac-cost  { font-size: .72rem; color: var(--text-muted); font-family: monospace; min-width: 70px; text-align: right; }

/* ── Activity log table ── */
.ast-actlog-wrap { overflow-x: auto; margin-top: .75rem; }
.ast-actlog-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.ast-actlog-table th {
  text-align: left; padding: .5rem .75rem; font-size: .73rem; font-weight: 600;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  background: #f8fafc; white-space: nowrap;
}
.ast-actlog-table td {
  padding: .55rem .75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ast-actlog-table .ast-actlog-inactive td { opacity: .5; }
.ast-actlog-sub { display: block; font-size: .72rem; color: var(--text-muted); }

/* ── Admin Panel v284 — Session time + page badges ── */
.ast-actlog-sesstime {
  font-size: .82rem; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ast-actlog-page-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe; border-radius: 12px;
  padding: 1px 7px; margin: 1px 2px;
  white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.ast-actlog-page-count {
  background: #1d4ed8; color: #fff;
  border-radius: 8px; padding: 0 5px; font-size: .65rem; font-weight: 700;
  flex-shrink: 0;
}

/* ── Top pages bar — distinct color from IA chart ── */
.ast-ac-bar--pages { background: #0ea5e9; }

/* ── Response time status card variants ── */
.ast-status-card--resp-fast { border-color: #bbf7d0; background: #f0fdf4; }
.ast-status-card--resp-fast .ast-status-card-num { color: #15803d; }
.ast-status-card--resp-fast .ast-status-card-icon { color: #22c55e; opacity: 1; }
.ast-status-card--resp-slow { border-color: #fca5a5; background: #fff5f5; }
.ast-status-card--resp-slow .ast-status-card-num { color: #dc2626; }
.ast-status-card--resp-slow .ast-status-card-icon { color: #dc2626; opacity: 1; }

/* ── Projection status card variants ── */
.ast-status-card--proj-ok    { border-color: #bbf7d0; background: #f0fdf4; }
.ast-status-card--proj-ok    .ast-status-card-num  { color: #15803d; }
.ast-status-card--proj-ok    .ast-status-card-icon { color: #22c55e; opacity: 1; }
.ast-status-card--proj-warn  { border-color: #fde68a; background: #fffbeb; }
.ast-status-card--proj-warn  .ast-status-card-num  { color: #b45309; }
.ast-status-card--proj-warn  .ast-status-card-icon { color: #f59e0b; opacity: 1; }
.ast-status-card--proj-alert { border-color: #fca5a5; background: #fff5f5; }
.ast-status-card--proj-alert .ast-status-card-num  { color: #dc2626; }
.ast-status-card--proj-alert .ast-status-card-icon { color: #dc2626; opacity: 1; }

/* ── Saldo Anthropic widget ── */
.ast-saldo-card { padding: 1rem 1.25rem; }
.ast-saldo-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .75rem;
}
.ast-saldo-header-left { display: flex; align-items: center; gap: .5rem; }
.ast-saldo-title { font-weight: 600; font-size: .9rem; color: var(--text-primary); }
.ast-saldo-badge {
  display: inline-block; padding: 1px 7px; border-radius: 99px;
  font-size: .7rem; font-weight: 600;
}
.ast-saldo-badge--ok  { background: #dcfce7; color: #15803d; }
.ast-saldo-badge--warn { background: #fef3c7; color: #92400e; }
.ast-saldo-toggle-btn {
  display: flex; align-items: center; gap: .35rem;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .65rem; font-size: .78rem; cursor: pointer; color: var(--text-muted);
  transition: border-color .15s, color .15s;
}
.ast-saldo-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.ast-saldo-body { margin-bottom: .75rem; }
.ast-saldo-kpis { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.ast-saldo-kpi { display: flex; flex-direction: column; }
.ast-saldo-kpi-val { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ast-saldo-kpi-label { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.ast-saldo-ok   { color: #15803d; }
.ast-saldo-warn { color: #b45309; }
.ast-saldo-bar-wrap {
  width: 100%; height: 8px; border-radius: 4px;
  background: var(--border); overflow: hidden; margin-bottom: .3rem;
}
.ast-saldo-bar { height: 100%; border-radius: 4px; transition: width .4s ease; }
.ast-saldo-bar-labels {
  display: flex; justify-content: space-between;
  font-size: .7rem; color: var(--text-muted);
}
.ast-saldo-empty { font-size: .85rem; color: var(--text-muted); margin: .25rem 0 .75rem; }
.ast-saldo-form { border-top: 1px solid var(--border); padding-top: .85rem; margin-top: .5rem; }
.ast-hidden { display: none !important; }
.ast-saldo-form-row {
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start;
}
.ast-saldo-form-row label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .8rem; color: var(--text-muted); min-width: 160px;
}
.ast-saldo-form-row input {
  padding: .4rem .6rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .85rem; background: var(--surface); color: var(--text-primary);
  width: 100%;
}
.ast-saldo-form-row input:focus { outline: none; border-color: var(--accent); }
.ast-saldo-info-note {
  display: flex; align-items: flex-start; gap: .45rem;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 7px;
  padding: .55rem .75rem; font-size: .78rem; color: #1e40af;
  margin-bottom: .75rem; line-height: 1.45;
}
.ast-saldo-info-note a { color: #1d4ed8; font-weight: 600; }
.ast-saldo-info-note a:hover { text-decoration: underline; }

/* ── Asistente IA chat ── */
/* ── v90: Asistente hero header ─────────────────────────── */
.chat-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a6e 100%);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex; flex-direction: column; gap: .65rem;
}
.chat-hero-top {
  display: flex; align-items: center; gap: .9rem;
}
.chat-hero-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  background: rgba(255,255,255,.13); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.chat-hero-text { flex: 1; min-width: 0; }
.chat-hero-title { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.2; }
.chat-hero-sub   { font-size: .75rem; color: rgba(255,255,255,.72); margin-top: .15rem; }
.chat-hero-badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.chat-hero-badge {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 600; padding: .18rem .55rem;
  border-radius: 999px; background: rgba(255,255,255,.13); color: rgba(255,255,255,.9);
}
.chat-hero-badge--p0 .urg-dot { background: #fca5a5; }
.chat-hero-badge--p1 .urg-dot { background: #fdba74; }

/* ── Page Hero ── cabecera navy reutilizable para todas las páginas ── */
.page-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a6e 100%);
  border-radius: var(--radius); padding: 1.1rem 1.25rem 1rem;
  margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem;
}
.page-hero-top { display: flex; align-items: center; gap: .9rem; }
.casos-hero-search {
  display: flex; align-items: center; gap: .45rem;
  flex: 1; min-width: 0;
  background: rgba(255,255,255,.15); backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255,255,255,.25); border-radius: 20px;
  padding: .38rem .75rem;
}
.casos-hero-search-input {
  flex: 1; min-width: 0; border: none; background: transparent;
  font-size: .875rem; color: #fff; font-family: inherit;
  outline: none;
}
.casos-hero-search-input::placeholder { color: rgba(255,255,255,.65); }
.casos-hero-search-clear {
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,.75); padding: 2px; border-radius: 50%;
  transition: background .15s;
}
.casos-hero-search-clear:hover { background: rgba(255,255,255,.2); }
.page-hero-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  background: rgba(255,255,255,.13); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.page-hero-text { flex: 1; min-width: 0; }
.page-hero-title { font-size: 1.05rem; font-weight: 700; color: #fff; line-height: 1.25; }
.page-hero-sub   { font-size: .78rem; color: rgba(255,255,255,.72); margin-top: .1rem; line-height: 1.35; }
.page-hero-action {
  flex-shrink: 0;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end;
}
.page-hero-action .btn { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.25); }
.page-hero-action .btn:hover { background: rgba(255,255,255,.25); }
.page-hero-action .btn-primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.page-hero-action .btn-primary:hover { filter: brightness(.88); }
/* Seleccionar button — teal/blue tint so se distingue del secundario */
.page-hero-action .btn-select {
  background: rgba(20,184,166,.30);
  border-color: rgba(20,184,166,.55);
  color: #fff;
}
.page-hero-action .btn-select:hover { background: rgba(20,184,166,.48); }
/* Floating select bar — compact on small screens */
@media (max-width: 480px) {
  .cl-select-bar { padding: .6rem 1rem; }
  .cl-select-info { font-size: .82rem; }
}
.btn-hero-danger {
  background: rgba(220,38,38,.18) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(220,38,38,.45) !important;
  transition: background .15s, border-color .15s;
}
.btn-hero-danger:hover {
  background: rgba(220,38,38,.32) !important;
  border-color: rgba(220,38,38,.7) !important;
}
.page-hero-row { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-top: .1rem; }
.page-hero-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600; padding: .22rem .65rem;
  border-radius: 999px; background: rgba(255,255,255,.13); color: rgba(255,255,255,.9);
}
.page-hero-count {
  background: rgba(255,255,255,.2); color: #fff; font-size: .72rem;
  font-weight: 700; border-radius: 999px; padding: .1rem .5rem; margin-left: .35rem;
}

.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 220px); max-width: 780px; margin: 0 auto; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem 0; display: flex; flex-direction: column; gap: .75rem; scrollbar-width: none; }
.chat-messages::-webkit-scrollbar { display: none; }
.chat-msg { display: flex; }
.chat-msg-ai   { justify-content: flex-start; }
.chat-msg-user { justify-content: flex-end; }
.chat-bubble {
  padding: .75rem 1rem; border-radius: 16px; font-size: .92rem;
  line-height: 1.6; word-break: break-word;
}
.chat-msg-ai .chat-bubble {
  max-width: 88%;
  background: linear-gradient(135deg, #eef2ff 0%, #f8faff 100%);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid #dde4f5;
  border-left: 3px solid var(--navy);
}
.chat-msg-user .chat-bubble {
  max-width: 80%;
  background: var(--navy);
  color: #fff;
  border-bottom-right-radius: 4px;
}
/* Empty state centrado */
.chat-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: .5rem; padding: 1.5rem 1rem; opacity: .55;
  pointer-events: none; user-select: none;
}
.chat-empty-icon { font-size: 2rem; }
.chat-empty-text { font-size: .9rem; color: var(--text-muted); text-align: center; }
.chat-bubble code { background: #e2e8f0; padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.chat-msg-ai .chat-bubble a { color: var(--navy); text-decoration: underline; font-weight: 500; }
.chat-msg-ai .chat-bubble a:hover { opacity: .75; }

/* Typing dots */
.chat-typing { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.chat-typing span { width: 7px; height: 7px; background: #94a3b8; border-radius: 50%; animation: chatBounce .9s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Saludo inicial (fuera del área scrollable) */
.chat-greeting-static { padding: .5rem 0 .25rem; }

/* Suggestions */
.chat-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .5rem 0; }
.chat-sug-btn {
  font-size: .75rem; padding: .38rem .6rem; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  font-weight: 500; line-height: 1.3; text-align: center;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.chat-sug-btn:nth-child(1) { border-color: #dc2626; color: #dc2626; }
.chat-sug-btn:nth-child(2) { border-color: var(--p1-badge); color: var(--p1-badge); }
.chat-sug-btn:nth-child(3) { border-color: #16a34a; color: #16a34a; }
.chat-sug-btn:nth-child(4) { border-color: #7c3aed; color: #7c3aed; }
.chat-sug-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Input */
.chat-input-row { display: flex; gap: .5rem; align-items: flex-end; padding-top: .5rem; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1; resize: none; padding: .65rem .9rem; border-radius: 10px;
  border: 1.5px solid var(--border); font-size: .92rem; font-family: inherit;
  line-height: 1.5; transition: border-color .2s;
  max-height: 140px; overflow-y: auto;
}
.chat-input:focus { outline: none; border-color: var(--navy); }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--navy);
  color: #fff; border: none; font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.chat-send-btn:hover:not(:disabled) { background: var(--gold); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.chat-disclaimer { font-size: .73rem; color: var(--text-muted); text-align: center; margin-top: 1.1rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.chat-legal-hint { font-size: .72rem; color: var(--text-muted); text-align: center; margin-top: .35rem; }
.chat-legal-hint strong { color: var(--text); font-weight: 600; }

/* ── Legal example chips ── */
.chat-legal-examples { padding: .3rem 0 .5rem; }
.chat-legal-examples-label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; padding-left: .1rem; }
.chat-legal-examples-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.chat-lex-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: .4rem .7rem;
  font-size: .75rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: border-color .15s, color .15s, background .15s;
}
.chat-lex-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--bg-alt); border-style: solid; }

/* =====================================================================
   v50 — NUEVAS FUNCIONALIDADES: Estado, Plantillas, Tiempo, Casos,
         Exportar Plazos, Métricas de Resolución
   ===================================================================== */

/* ── Estado + Expediente bar (message_detail) ────────────────────── */
.msg-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
}
.meta-bar-form {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.meta-bar-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.meta-bar-select {
  padding: .3rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .82rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.meta-bar-select:focus { outline: 2px solid var(--gold); }

/* ── Custom select (Estado) ─────────────────────────────────────── */
.cst-select {
  position: relative;
}
.cst-select-trigger {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .28rem .55rem .28rem .7rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-size: .83rem; font-weight: 500; cursor: pointer;
  min-width: 210px; max-width: 300px;
  transition: border-color .15s, box-shadow .15s;
  white-space: nowrap; overflow: hidden;
}
.cst-select-trigger:hover  { border-color: var(--gold); }
.cst-select.open .cst-select-trigger { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,168,76,.18); }
.cst-select-val { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.cst-select-chevron {
  width: 14px; height: 14px; flex-shrink: 0; color: var(--text-light);
  transition: transform .18s;
}
.cst-select.open .cst-select-chevron { transform: rotate(180deg); }

.cst-select-panel {
  display: none;
  position: absolute; top: calc(100% + 5px); left: 0;
  min-width: 200px; max-width: 280px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.14);
  z-index: 320; overflow: hidden;
}
.cst-select.open .cst-select-panel { display: block; }
.cst-select-options { max-height: 220px; overflow-y: auto; padding: .3rem 0; }

.cst-select-opt {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .85rem; font-size: .86rem; cursor: pointer;
  color: var(--text); transition: background .12s;
}
.cst-select-opt:hover { background: var(--gold-bg, rgba(201,168,76,.12)); }
.cst-select-opt--active { font-weight: 600; color: var(--navy); }
.cst-opt-check {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--gold); opacity: 0;
  display: flex; align-items: center; justify-content: center;
}
.cst-select-opt--active .cst-opt-check { opacity: 1; }

.cst-select-footer {
  border-top: 1px solid var(--border);
  padding: .5rem .85rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.cst-select-manage {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .76rem; font-weight: 600; color: var(--gold-dark, #A8872C);
  text-decoration: none; transition: color .15s;
  background: none; border: none; cursor: pointer; padding: 0;
}
.cst-select-manage:hover { color: var(--navy); }

[data-theme="dark"] .cst-select-panel { background: #1e2a3a; border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .cst-select-opt { color: #e5e7eb; }
[data-theme="dark"] .cst-select-opt:hover { background: rgba(201,168,76,.1); }
[data-theme="dark"] .cst-select-opt--active { color: var(--gold); }

/* ── Plantillas (message_detail) ────────────────────────────────── */
.plantillas-bar {
  position: relative;
  margin-bottom: .5rem;
}
.btn-plantilla-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .35rem .75rem;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text);
  transition: background .15s;
}
.btn-plantilla-toggle:hover { background: var(--border); }
.plantillas-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 260px;
  max-width: 380px;
  padding: .4rem;
  margin-top: .25rem;
}
.plantilla-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .85rem;
  cursor: pointer;
  color: var(--text);
  transition: background .12s;
}
.plantilla-item:hover { background: var(--surface); }

/* ── Tiempo (message_detail) ────────────────────────────────────── */
.tiempo-section { margin-top: 1.5rem; }
.tiempo-summary { margin-bottom: .75rem; }
.tiempo-total {
  font-size: .85rem;
  color: var(--muted);
  display: block;
  margin-bottom: .4rem;
}
.tiempo-entries { display: flex; flex-wrap: wrap; gap: .4rem; }
.tiempo-entry-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .2rem .65rem;
  font-size: .78rem;
  color: var(--text);
}
.tiempo-entry-date { color: var(--muted); margin-left: .2rem; }
.tiempo-form { margin-top: .75rem; }
.tiempo-quick-btns {
  display: flex;
  gap: .4rem;
  align-items: center;
  margin-bottom: .5rem;
}
.tiempo-quick-label { font-size: .8rem; color: var(--muted); }
.btn-tiempo-quick {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn-tiempo-quick:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.tiempo-inputs { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tiempo-input {
  padding: .4rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
}
.tiempo-input:focus { outline: 2px solid var(--gold); }

/* ── Plantillas (configuracion) ─────────────────────────────────── */
.config-hint {
  font-size: .85rem;
  color: var(--muted);
  margin: -.25rem 0 1rem;
}
.plantillas-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.plantilla-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .65rem .85rem;
}
.plantilla-row-info { flex: 1; min-width: 0; }
.plantilla-row-title { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.plantilla-row-body { display: block; font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plantilla-new-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }
.btn-remove-small {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .2rem .5rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  transition: color .12s, border-color .12s;
}
.btn-remove-small:hover { color: #dc2626; border-color: #dc2626; }
.btn.btn-sm { padding: .25rem .65rem; font-size: .82rem; }

/* ── Casos / Expedientes (client_profile) ───────────────────────── */
.cases-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.cases-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.cases-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.cases-time-total {
  font-size: .82rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .2rem .65rem;
}
.cases-list { display: flex; flex-direction: column; gap: .6rem; }
.cases-empty { color: var(--muted); font-size: .9rem; }
.case-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  border-left: 3px solid var(--gold);
}
.case-card-main { flex: 1; min-width: 0; }
.case-title { display: block; font-weight: 600; font-size: .9rem; }
.case-desc { display: block; font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.case-meta { display: block; font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.case-card-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.case-status-select {
  padding: .25rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.caso-new-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}
.caso-new-form.hidden { display: none; }
.form-textarea {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.form-textarea:focus { outline: 2px solid var(--gold); }

/* ── Exportar plazos (calendar) ─────────────────────────────────── */
.cal-export-bar {
  padding: .3rem 1rem .45rem 2.5rem;
  background: var(--bg);
  border-left: 3px solid var(--border);
  border-radius: 0 0 4px 4px;
  margin-top: -1px;
}
/* ── Fila deadline + botón calendario (inline) ────────────────── */
.cal-row-deadline-wrap {
  display: inline-flex; align-items: center; gap: .3rem;
}
/* ── Botón ícono calendario ───────────────────────────────────── */
.cal-export-menu { position: relative; display: inline-flex; align-items: center; }
.btn-cal-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  border: 1.5px solid rgba(201,168,76,.4);
  background: rgba(201,168,76,.1);
  color: var(--gold); cursor: pointer; transition: all .15s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-cal-icon:hover,
.cal-export-menu.open .btn-cal-icon {
  border-color: var(--gold); background: rgba(201,168,76,.2);
}
.cal-export-panel {
  display: none; position: absolute; top: calc(100% + .3rem);
  min-width: 215px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.15); z-index: 300; overflow: hidden;
}
.cal-export-panel--right { right: 0; left: auto; }
.cal-export-menu.open .cal-export-panel { display: block; }
.cal-export-opt {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .65rem 1rem; font-size: .83rem; color: var(--text);
  background: none; border: none; text-align: left;
  cursor: pointer; transition: background .12s;
}
.cal-export-opt:hover { background: var(--bg-alt); }
.cal-export-opt-google { border-top: 1px solid var(--border); }
.cal-export-opt-google:hover { color: #1a73e8; }

/* ── Métricas resolución por prioridad (estadisticas) ───────────── */
.stats-resolution-row {
  margin: 1.25rem 0;
}
.stats-section-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}
.stats-resolution-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .6rem;
}
@media (max-width: 640px) { .stats-resolution-grid { grid-template-columns: repeat(2, 1fr); } }
.stats-res-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  text-align: center;
  border-top: 3px solid var(--border);
}
.stats-res-card.stats-res-p0 { border-top-color: #dc2626; }
.stats-res-card.stats-res-p1 { border-top-color: #ea580c; }
.stats-res-card.stats-res-p2 { border-top-color: #2563eb; }
.stats-res-card.stats-res-p3 { border-top-color: #9ca3af; }
.stats-res-urg { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.stats-res-value { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.stats-res-count { font-size: .75rem; color: var(--muted); }

/* ── Página de Tiempo (/tiempo) ─────────────────────────────────── */
.tiempo-page-header { margin-bottom: 1.5rem; }
.tiempo-page-title { font-size: 1.6rem; font-weight: 800; color: var(--navy); margin-bottom: .25rem; }
.tiempo-kpi-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.tiempo-kpi {
  --kpi-c: #4f46e5;
  flex: 1; min-width: 130px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--kpi-c);
  border-radius: 12px;
  padding: 1.1rem 1rem 1rem;
  text-align: center;
  transition: box-shadow .2s;
}
.tiempo-kpi:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.tiempo-kpi--total    { --kpi-c: #4f46e5; }
.tiempo-kpi--mes      { --kpi-c: #7c3aed; }
.tiempo-kpi--registros{ --kpi-c: #0891b2; }
.tiempo-kpi-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; margin: 0 auto .55rem;
  background: color-mix(in srgb, var(--kpi-c) 12%, transparent);
  color: var(--kpi-c);
}
.tiempo-kpi-n { display: block; font-size: 1.6rem; font-weight: 800; color: var(--kpi-c); }
.tiempo-kpi-l { display: block; font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.tiempo-section { margin-bottom: 2rem; }
.tiempo-section-title { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.tiempo-client-list { display: flex; flex-direction: column; gap: .45rem; }
.tiempo-client-row { display: flex; align-items: center; gap: .75rem; }
.tiempo-client-name { min-width: 150px; font-size: .85rem; font-weight: 500; text-decoration: none; color: var(--navy); }
.tiempo-client-bar-wrap { flex: 1; background: var(--border); border-radius: 4px; height: 8px; overflow: hidden; }
.tiempo-client-bar { height: 100%; background: var(--gold); border-radius: 4px; transition: width .3s; }
.tiempo-client-val { min-width: 65px; text-align: right; font-size: .82rem; color: var(--muted); }
.tiempo-entries-table { display: flex; flex-direction: column; gap: 0; }
.tiempo-table-head {
  display: grid;
  grid-template-columns: 90px 70px 1fr 1fr;
  gap: .5rem;
  padding: .4rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.tiempo-table-row {
  display: grid;
  grid-template-columns: 90px 70px 1fr 1fr;
  gap: .5rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-top: none;
  font-size: .83rem;
  align-items: center;
}
.tiempo-table-row:last-child { border-radius: 0 0 6px 6px; }
.tiempo-table-row:hover { background: var(--surface); }
.tiempo-table-date { color: var(--muted); }
.tiempo-table-dur { font-weight: 600; }
.tiempo-table-ref a { color: var(--navy); text-decoration: none; }
.tiempo-table-ref a:hover { text-decoration: underline; }
.tiempo-table-note { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ── Estados personalizados (configuracion) ────────────────────── */
.estados-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.estado-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .85rem;
}
.estado-row-default { opacity: .75; }
.estado-label { font-size: .88rem; flex: 1; }
.estado-default-badge {
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .15rem .5rem;
}
.estado-new-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.estado-new-form .form-input { flex: 1; min-width: 200px; }
.cfg-drag-handle {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  cursor: grab;
  padding: 0 .25rem 0 0;
  flex-shrink: 0;
  opacity: .5;
  transition: opacity .15s;
}
.cfg-drag-handle:hover { opacity: 1; }
.cfg-dragging { opacity: .45; border-style: dashed !important; }
.cfg-dragover { border-color: var(--gold) !important; background: rgba(201,168,76,.08) !important; }
.cfg-defaults-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}
.btn-sm {
  font-size: .78rem;
  padding: .3rem .75rem;
  border-radius: 6px;
  white-space: nowrap;
}
.btn-link-muted {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .82rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.btn-link-muted:hover { color: var(--text); }

/* ── Banner ficha incompleta (cliente auto-creado desde WhatsApp) ── */
.cp-incomplete-banner {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: .85rem 1rem;
  margin: 0 0 .75rem;
}
.cp-incomplete-banner-left {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.cp-incomplete-icon {
  width: 20px;
  height: 20px;
  color: #b45309;
  flex-shrink: 0;
  margin-top: .1rem;
}
.cp-incomplete-banner strong {
  display: block;
  font-size: .9rem;
  color: #92400e;
  margin-bottom: .15rem;
}
.cp-incomplete-banner span {
  font-size: .82rem;
  color: #78350f;
  line-height: 1.4;
}
.cp-incomplete-btn {
  width: 100%;
  background: #f59e0b;
  border: none;
  border-radius: 7px;
  color: #fff;
  font-size: .84rem;
  font-weight: 600;
  padding: .6rem .9rem;
  cursor: pointer;
  transition: background .15s;
  text-align: center;
}
.cp-incomplete-btn:hover { background: #d97706; }

/* ── Missing field chips (header) ──────────────────────── */
.cp-missing-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; font-weight: 600;
  color: #92400e; background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 4px; padding: .1rem .45rem;
  margin-left: .4rem; vertical-align: middle;
  white-space: nowrap;
}
[data-theme="dark"] .cp-missing-chip {
  color: #fbbf24; background: #3b1f00; border-color: #92400e;
}

/* ── Missing field tags inside banner ──────────────────── */
.cp-missing-tags {
  display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem;
}
.cp-missing-tag {
  font-size: .74rem; font-weight: 700;
  background: #fff7ed; color: #c2410c;
  border: 1.5px solid #fb923c;
  border-radius: 5px; padding: .1rem .5rem;
}
[data-theme="dark"] .cp-missing-tag {
  background: #3b1500; color: #fb923c; border-color: #c2410c;
}

/* ── Form fields with missing data ─────────────────────── */
.field-missing > input,
.field-missing > textarea {
  border-color: #ef4444 !important;
  background: #fff5f5;
}
[data-theme="dark"] .field-missing > input,
[data-theme="dark"] .field-missing > textarea {
  border-color: #f87171 !important;
  background: #2d1515;
}
.field-missing > label { color: #dc2626; }
[data-theme="dark"] .field-missing > label { color: #f87171; }

.cp-delete-trigger-row {
  display: flex;
  justify-content: flex-start;
  padding: .35rem var(--card-px, 1.25rem) .6rem;
}
.btn-delete-subtle {
  display: inline-flex; align-items: center; gap: .35rem;
  background: none;
  border: none;
  color: #ef4444;
  font-size: .78rem;
  cursor: pointer;
  padding: .25rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: .01em;
  opacity: .55;
  transition: color .15s, opacity .15s;
}
.btn-delete-subtle:hover { color: #b91c1c; opacity: 1; }

/* ── KPI cards clicables (Panel de uso) ──────────────────────────── */
.ast-kpi-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.ast-kpi-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(27,43,74,.12);
  text-decoration: none;
  color: inherit;
}
.ast-kpi-hint {
  display: block;
  font-size: .7rem;
  color: #b91c1c;
  margin-top: .2rem;
  font-weight: 500;
}

/* ── Botón Registrar tiempo ──────────────────────────────────────── */
.btn-registrar {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem 1.1rem;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn-registrar:hover { background: #253d6b; transform: translateY(-1px); }
.btn-registrar:active { transform: translateY(0); }

/* ── Descripción del widget de tiempo ───────────────────────────── */
.tiempo-desc {
  font-size: .82rem;
  color: var(--muted);
  margin: -.25rem 0 .75rem;
  line-height: 1.4;
}
.tiempo-desc-link {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Asistente: voz ─────────────────────────────────────────────── */
.chat-mic-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.chat-mic-btn:hover {
  background: #f0f0f0;
  box-shadow: 0 3px 12px rgba(0,0,0,.22);
  transform: scale(1.05);
}
.chat-mic-btn.chat-mic-active {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 2px 12px rgba(239,68,68,.45);
  animation: mic-pulse 1s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.35); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,.0); }
}

.chat-voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .85rem;
  border-radius: 20px;
  border: 1.5px solid var(--navy);
  background: transparent;
  color: var(--navy);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.chat-voice-toggle:hover { background: var(--navy); color: #fff; }
.chat-voice-toggle-off {
  border-color: var(--border);
  color: var(--muted);
}
.chat-voice-toggle-off:hover { background: var(--border); color: var(--text); }

/* ── Rediseño input area: textarea arriba, botones abajo ─────────── */
.chat-input-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}
.chat-input {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  padding: .65rem .9rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: .92rem;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .2s;
  max-height: 140px;
  overflow-y: auto;
  flex: unset;
}
.chat-input:focus { outline: none; border-color: var(--navy); }
.chat-input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem .1rem .1rem;
  width: 100%;
  box-sizing: border-box;
}

/* Mic con color azul claro */
.chat-mic-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #dbeafe;
  color: #1e40af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 1px 4px rgba(30,64,175,.15);
}
.chat-mic-btn:hover {
  background: #bfdbfe;
  transform: scale(1.06);
}
.chat-mic-btn.chat-mic-active {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 2px 12px rgba(239,68,68,.45);
  animation: mic-pulse 1s infinite;
}

/* Send con color dorado */
.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  box-shadow: 0 1px 4px rgba(201,168,76,.35);
}
.chat-send-btn:hover:not(:disabled) {
  background: #b8913e;
  transform: scale(1.06);
}
.chat-send-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Barra de controles de voz (bajo el input) ──────────────────── */
.chat-voice-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .5rem .1rem .2rem;
  text-align: center;
}
.chat-voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .75rem;
  border-radius: 20px;
  border: 1.5px solid var(--navy);
  background: transparent;
  color: var(--navy);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.chat-voice-toggle:hover { background: var(--navy); color: #fff; }
.chat-voice-toggle-off {
  border-color: var(--border);
  color: var(--muted);
}
.chat-voice-toggle-off:hover { background: var(--border); color: var(--text); }
.chat-controls-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.chat-detail-seg {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
}
.chat-seg-btn {
  padding: .28rem .8rem;
  font-size: .76rem;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.chat-seg-btn.active { background: var(--navy); color: #fff; }
.chat-seg-btn:not(.active):hover { background: var(--bg-alt); color: var(--text); }
.chat-hints-row {
  display: flex;
  gap: .3rem .9rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.chat-hints-row .chat-voice-hint + .chat-voice-hint::before {
  content: '·';
  margin-right: .9rem;
  opacity: .4;
}
/* ── Quick Actions (configuración) ── */
.qa-row { display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.5rem .6rem; border:1px solid var(--border); border-radius:8px; background:var(--surface); transition:opacity .2s; }
.qa-row--off { opacity:.45; }
.qa-row.qa-dragging { opacity:.4; }
.qa-row.qa-dragover { border-color:var(--gold); background:var(--bg-alt); }
.qa-left { display:flex; align-items:center; gap:.4rem; flex:1; min-width:0; }
.qa-handle { cursor:grab; font-size:1rem; color:var(--text-muted); flex-shrink:0; line-height:1; }
.qa-num { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; border-radius:50%; background:var(--gold); color:#fff; font-size:.62rem; font-weight:700; flex-shrink:0; }
.qa-text { font-size:.82rem; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.qa-badge { font-size:.65rem; background:var(--bg-alt); color:var(--text-muted); border:1px solid var(--border); border-radius:4px; padding:.1rem .35rem; flex-shrink:0; }
.qa-actions { display:flex; gap:.3rem; flex-shrink:0; }
.qa-btn { background:none; border:1px solid var(--border); border-radius:6px; padding:.25rem .35rem; cursor:pointer; color:var(--text-muted); display:flex; align-items:center; transition:background .15s,color .15s; }
.qa-btn:hover { background:var(--bg-alt); color:var(--text); }
.qa-btn-delete:hover { border-color:#dc2626; color:#dc2626; }
/* ── Quick Action tip banner ── */
.qa-tip { display:flex; align-items:center; gap:.5rem; padding:.45rem .7rem; border:1px solid rgba(201,168,76,.35); border-radius:8px; background:rgba(201,168,76,.07); font-size:.78rem; color:var(--text-muted); margin:.25rem 0 .1rem; }
.qa-tip-icon { flex-shrink:0; font-size:.88rem; }
.qa-tip-text { flex:1; line-height:1.4; }
.qa-tip-link { color:var(--gold,#C9A84C); font-weight:600; text-decoration:none; }
.qa-tip-link:hover { text-decoration:underline; }
.qa-tip-close { background:none; border:none; font-size:1.1rem; color:var(--text-muted); cursor:pointer; padding:0 .1rem; line-height:1; flex-shrink:0; opacity:.7; }
.qa-tip-close:hover { opacity:1; }
/* ── end Quick Actions ── */

/* ── AI Usage section ── */
.ia-kpi-row { display:grid; grid-template-columns:repeat(4,1fr); gap:.6rem; margin:.5rem 0 .25rem; }
@media(max-width:520px){ .ia-kpi-row { grid-template-columns:repeat(2,1fr); } }
.ia-kpi { background:var(--bg-alt); border:1px solid var(--border); border-radius:10px; padding:.6rem .7rem; display:flex; flex-direction:column; gap:.15rem; }
.ia-kpi-val { font-size:1.05rem; font-weight:700; color:var(--text); }
.ia-kpi-lbl { font-size:.68rem; color:var(--text-muted); line-height:1.3; }
.ia-table { width:100%; border-collapse:collapse; font-size:.78rem; }
.ia-table th { text-align:left; font-weight:600; color:var(--text-muted); padding:.35rem .5rem; border-bottom:2px solid var(--border); white-space:nowrap; }
.ia-table td { padding:.35rem .5rem; border-bottom:1px solid var(--border); color:var(--text); vertical-align:middle; }
.ia-table tr:last-child td { border-bottom:none; }
.ia-table tr:hover td { background:var(--bg-alt); }
.ia-num { text-align:right; font-variant-numeric:tabular-nums; }
.ia-lbl { font-weight:500; }
.ia-cost { font-weight:600; color:var(--navy); }
.ia-model-badge { display:inline-block; font-size:.65rem; background:rgba(8,145,178,.12); color:#0891b2; border-radius:6px; padding:.1rem .4rem; font-weight:600; white-space:nowrap; }
/* ── Admin AI period filter ── */
.ast-ia-period-btns { display:flex; gap:.3rem; flex-wrap:wrap; }
.ast-ia-period-btn { font-size:.72rem; padding:.2rem .55rem; border-radius:6px; border:1px solid var(--border); color:var(--text-muted); text-decoration:none; transition:background .15s,color .15s; white-space:nowrap; }
.ast-ia-period-btn:hover { background:var(--bg-alt); color:var(--text); }
.ast-ia-period-btn.active { background:var(--navy); color:#fff; border-color:var(--navy); font-weight:600; }
/* ── end AI Usage ── */
.chat-detail-col { display:flex; flex-direction:column; align-items:center; gap:.2rem; }
.chat-detail-hint { font-weight: 700; font-size:.72rem; text-align:center; color:var(--text-muted); }
.chat-voice-hint {
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.3;
}

/* ── Notificaciones push (configuracion) ────────────────────────── */
.push-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem 1rem;
  flex-wrap: wrap;
}
.push-device-info { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.push-device-label { font-size: .88rem; font-weight: 600; }
.push-device-hint  { font-size: .78rem; color: var(--muted); }
.push-device-note  { font-size: .78rem; color: var(--muted); margin: .4rem 0 0; }

.btn-push-toggle {
  padding: .45rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.btn-push-toggle:hover { background: #253d6b; }
.btn-push-toggle.btn-push-toggle-off {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-push-toggle.btn-push-toggle-off:hover { background: var(--border); color: var(--text); }

/* ── Bloque de ayuda "notificaciones bloqueadas" ─────────────── */
.push-blocked-block {
  margin-top: .75rem;
  border: 1.5px solid #fca5a5;
  border-radius: 12px;
  background: #fff7f7;
  padding: 1rem 1.1rem;
}
[data-theme="dark"] .push-blocked-block {
  background: rgba(185,28,28,.08);
  border-color: rgba(248,113,113,.35);
}
.pbb-header {
  display: flex; align-items: center; gap: .5rem;
  font-size: .88rem; color: #b91c1c; margin-bottom: .6rem;
}
[data-theme="dark"] .pbb-header { color: #fca5a5; }
.pbb-intro {
  font-size: .82rem; color: var(--text-muted);
  margin: 0 0 .75rem; line-height: 1.5;
}
.pbb-browsers { display: flex; flex-direction: column; gap: .5rem; }
.pbb-browser {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .65rem .85rem;
}
.pbb-browser-name {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: .45rem;
}
.pbb-steps {
  margin: 0; padding-left: 1.25rem;
  font-size: .82rem; color: var(--text); line-height: 1.7;
}
.pbb-steps li { margin-bottom: .15rem; }
.pbb-retry-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .85rem;
  background: #1d4ed8; color: #fff;
  border: none; border-radius: 8px;
  padding: .55rem 1rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.pbb-retry-btn:hover { background: #1e40af; }

/* ── Botón flotante "volver arriba" ──────────────────────────── */
#scroll-top-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.25rem;
  z-index: 998;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(27,43,74,.25);
  opacity: 0;
  transform: translateY(12px) scale(.9);
  pointer-events: none;
  transition: opacity .3s, transform .3s, background .15s;
}
#scroll-top-btn.scroll-top-visible {
  opacity: .52;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#scroll-top-btn:hover,
#scroll-top-btn:active {
  opacity: 1;
  background: var(--gold);
  color: var(--navy);
  box-shadow: 0 4px 16px rgba(201,168,76,.40);
}
@media (max-width: 600px) {
  #scroll-top-btn {
    width: 38px; height: 38px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px) + 8px);
  }
}

/* ============================================================
   EXPEDIENTES / CASOS
   ============================================================ */

/* ── Shared modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 1rem;
}
.modal-box, .modal-card {
  background: var(--card); border-radius: 14px;
  width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-height: 90vh; overflow-y: auto;
}
.modal-card > form {
  padding: 1rem 1.5rem 1.5rem;
}
.modal-body {
  padding: 1rem 1.5rem;
}
.modal-footer {
  padding: .75rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; font-size: 1.1rem;
  cursor: pointer; color: var(--text-muted); padding: .2rem .4rem;
}
.modal-form { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; padding-top: .5rem; }

/* ── Page header row ────────────────────────────────────────── */
.page-header-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--navy); margin: 0; }
.page-subtitle { font-size: .85rem; color: var(--text-muted); margin: .2rem 0 0; }

/* ── Filters bar ────────────────────────────────────────────── */
.casos-filters {
  display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap;
}
.casos-filter-btn {
  padding: .35rem .85rem; border-radius: 20px; font-size: .82rem; font-weight: 600;
  border: 1.5px solid var(--border); color: var(--text-muted);
  text-decoration: none; transition: all .15s;
}
.casos-filter-btn:hover { border-color: var(--gold); color: var(--gold); }
.casos-filter-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .casos-filter-btn.active { background: var(--gold); color: #1a1a2e; border-color: var(--gold); }

/* ── Tooltip genérico [data-tooltip] ────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; pointer-events: none;
  background: #1e293b; color: #f1f5f9;
  font-size: .73rem; font-weight: 500; font-family: inherit; line-height: 1.3;
  padding: .32rem .65rem; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .15s, transform .15s;
  transform: translateX(-50%) translateY(-3px);
  z-index: 9999;
  max-width: 260px; white-space: normal; text-align: center;
}
[data-tooltip]:hover::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
/* flecha del tooltip */
[data-tooltip]::before {
  content: ''; position: absolute; top: calc(100% + 2px); left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-bottom-color: #1e293b;
  opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 9999;
}
[data-tooltip]:hover::before { opacity: 1; }

/* ── Unified filter toolbar (pills + area + search) ─────────── */
.casos-toolbar {
  display: flex; align-items: center; gap: .6rem;
  flex-wrap: wrap; margin-bottom: 1.5rem;
}
.casos-filter-pills {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
}
.casos-area-wrap {
  display: flex; align-items: center; gap: .45rem; flex-shrink: 0;
}
.casos-search-wrap {
  display: flex; align-items: center; gap: .45rem;
  flex: 1; min-width: 160px; max-width: 280px;
}
/* legacy — kept for fallback */
.casos-filters-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.casos-area-filter-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.casos-area-select {
  flex: 1; max-width: 260px;
  appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right .65rem center;
  border: 1.5px solid var(--border); border-radius: 20px;
  padding: .35rem 2rem .35rem .85rem;
  font-size: .82rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: border-color .15s, color .15s;
  font-family: inherit;
}
.casos-area-select:hover { border-color: #0d9488; color: #0d9488; }
.casos-area-select:focus { outline: none; border-color: #0d9488; color: var(--text); }
.casos-area-select option { color: var(--text); background: var(--surface); }
[data-theme="dark"] .casos-area-select {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.caso-area-tag {
  display: inline-flex; align-items: center;
  margin-left: .4rem; padding: .1rem .45rem;
  background: #ccfbf1; color: #0f766e;
  border-radius: 6px; font-size: .7rem; font-weight: 600;
}
[data-theme="dark"] .caso-area-tag { background: #134e4a; color: #5eead4; }
.cst-opt-muted { color: var(--text-muted); font-style: italic; }

/* ── Cases grid ─────────────────────────────────────────────── */
.casos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.caso-card {
  background: var(--card); border-radius: 12px;
  border: 1.5px solid var(--border);
  padding: 1.5rem 1.6rem; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: .65rem;
  transition: box-shadow .15s, border-color .15s;
}
.caso-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); border-color: var(--gold); }
.caso-card-top { display: flex; align-items: center; justify-content: space-between; }
.caso-title { font-size: 1rem; font-weight: 700; margin: 0; line-height: 1.3; }
.caso-client { font-size: .82rem; color: var(--text-muted); margin: 0; }
.caso-desc { font-size: .82rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.caso-date { font-size: .75rem; color: var(--text-muted); }
.caso-meta-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }
.caso-meta-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; color: var(--text-muted);
  background: var(--bg); border-radius: 6px; padding: .2rem .5rem;
}

/* ── Client search bar ──────────────────────────────────────── */
.casos-search-row { display: flex; align-items: center; gap: .55rem; margin-bottom: .6rem; }
.casos-search-input {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: .38rem .75rem; font-size: .85rem;
  transition: border-color .15s;
  outline: none;
}
.casos-search-input:focus { border-color: var(--gold); }
.casos-search-input::placeholder { color: var(--text-muted); }
.casos-search-clear {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-alt); border: none; cursor: pointer;
  color: var(--text-muted); transition: background .15s;
}
.casos-search-clear:hover { background: var(--border); }
.casos-sort-wrap {
  display: flex; align-items: center; gap: .4rem; flex-shrink: 0;
}
.casos-sort-select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right .6rem center;
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: .37rem 1.8rem .37rem .7rem;
  font-size: .82rem; font-weight: 500; color: var(--text-muted);
  cursor: pointer; outline: none; font-family: inherit;
  transition: border-color .15s;
}
.casos-sort-select:hover, .casos-sort-select:focus { border-color: var(--gold); color: var(--text); }
[data-theme="dark"] .casos-sort-select {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ── Suggest-area button (card list) ────────────────────────── */
.caso-suggest-area-btn {
  display: inline-flex; align-items: center; gap: .28rem;
  background: rgba(201,168,76,.12); border: none; color: var(--gold);
  border-radius: 20px; padding: .22rem .7rem .22rem .55rem;
  font-size: .71rem; font-weight: 700; letter-spacing: .01em;
  cursor: pointer; transition: background .15s;
  align-self: flex-start; margin-top: .15rem; width: fit-content;
}
.caso-suggest-area-btn:hover:not(:disabled) { background: rgba(201,168,76,.25); }
.caso-suggest-area-btn:disabled { opacity: .6; cursor: wait; }
[data-theme="dark"] .caso-suggest-area-btn { background: rgba(201,168,76,.15); }
[data-theme="dark"] .caso-suggest-area-btn:hover:not(:disabled) { background: rgba(201,168,76,.28); }

/* ── Status badges ──────────────────────────────────────────── */
.caso-status-badge {
  font-size: .7rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 10px; text-transform: uppercase; letter-spacing: .04em;
}
.caso-status--abierto    { background: #d1fae5; color: #065f46; }
.caso-status--en_tramite { background: #dbeafe; color: #1e40af; }
.caso-status--cerrado    { background: #f3f4f6; color: #374151; }
.caso-status--archivado  { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .caso-status--abierto    { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .caso-status--en_tramite { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .caso-status--cerrado    { background: #374151; color: #9ca3af; }
[data-theme="dark"] .caso-status--archivado  { background: #451a03; color: #fcd34d; }

/* ── Empty state ────────────────────────────────────────────── */
.casos-empty {
  text-align: center; padding: 4rem 1.5rem;
  color: var(--text-muted);
}
.casos-empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.casos-empty h3 { font-size: 1.1rem; color: var(--text); margin-bottom: .5rem; }
.casos-empty p { font-size: .9rem; margin-bottom: 1.5rem; }

/* ── Case detail ────────────────────────────────────────────── */
.caso-detail-header { margin-bottom: .75rem; }
#cst-select-caso-estado .cst-select-trigger { min-width: 160px; }
#cst-select-caso-estado .cst-select-panel { min-width: 220px; }
#cst-select-caso-area .cst-select-trigger { min-width: 200px; }
#cst-select-caso-area .cst-select-panel  { min-width: 265px; max-width: 340px; }

/* ── Barra de acciones (Estado + Resumen IA) ── */
.caso-actions-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1.25rem; flex-wrap: nowrap;
}

/* ── Botón Resumen IA ── */
.btn-resumen-ia {
  display: inline-flex; align-items: center; gap: .4rem;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff; border: none; border-radius: 9px;
  padding: .4rem .85rem; font-size: .8rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s, transform .1s;
}
.btn-resumen-ia:hover { opacity: .88; transform: translateY(-1px); }
.btn-resumen-ia:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-resumen-ia--done:disabled {
  background: linear-gradient(135deg, #059669, #0d9488);
  opacity: .82; cursor: default;
}
.btn-resumen-ia--empty:disabled {
  background: var(--surface); color: var(--text-muted);
  border: 1.5px dashed var(--border);
  opacity: 1; cursor: default;
}
.btn-resumen-ia--empty:disabled i[data-lucide] { opacity: .4; }
.btn-resumen-ia-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.btn-resumen-ia-sub { font-size: .65rem; font-weight: 400; opacity: .82; letter-spacing: .01em; }
.caso-resumen-ia-row { display: flex; justify-content: center; margin-top: 1.25rem; margin-bottom: 1rem; }

/* ── Panel resumen IA ── */
.caso-resumen-panel {
  background: linear-gradient(135deg, #f5f3ff 0%, #eff6ff 100%);
  border: 1.5px solid #c4b5fd;
  border-radius: 14px; padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(124,58,237,.1);
}
.caso-resumen-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.caso-resumen-header-left { display: flex; align-items: flex-start; gap: .5rem; }
.caso-resumen-desc { font-size: .75rem; color: #6d28d9; opacity: .8; margin: .2rem 0 0; line-height: 1.4; }
.caso-resumen-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#7c3aed,#2563eb); color: #fff;
}
.caso-resumen-title { font-size: .95rem; font-weight: 800; color: #4c1d95; }
.caso-resumen-close {
  background: none; border: none; cursor: pointer; color: #7c3aed;
  padding: .25rem; border-radius: 6px; display: flex;
  transition: background .12s;
}
.caso-resumen-close:hover { background: #ede9fe; }
.caso-resumen-body { font-size: .875rem; color: #1e1b4b; line-height: 1.65; }
.caso-resumen-section { margin-bottom: 1rem; }
.caso-resumen-section:last-child { margin-bottom: 0; }
.caso-resumen-section-title {
  font-size: .78rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: #7c3aed; margin-bottom: .3rem;
  display: flex; align-items: center; gap: .35rem;
}
.caso-resumen-section-body { color: #1e1b4b; }
.caso-resumen-section-body ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.caso-resumen-section-body li { margin-bottom: .2rem; }
.caso-resumen-loading {
  display: flex; align-items: center; gap: .6rem;
  color: #7c3aed; font-size: .875rem; font-weight: 600; padding: .5rem 0;
}
.resumen-spinner {
  width: 18px; height: 18px; border: 2.5px solid #c4b5fd;
  border-top-color: #7c3aed; border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
.caso-detail-title { font-size: 1.5rem; font-weight: 800; margin: .25rem 0; color: var(--navy); }
.caso-detail-client { font-size: .875rem; color: var(--text-muted); margin: 0; }
.caso-detail-desc {
  background: var(--bg); border-radius: 8px; padding: .75rem 1rem;
  font-size: .875rem; color: var(--text); margin-bottom: 1.25rem;
  border-left: 3px solid var(--gold);
}
.caso-detail-desc-label {
  display: flex; align-items: center; gap: .3rem;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gold-dark);
  margin-bottom: .4rem;
}
.back-link {
  font-size: .8rem; color: var(--text-muted); text-decoration: none;
  display: inline-block; margin-bottom: .4rem;
}
.back-link:hover { color: var(--gold); }
.link-subtle { color: inherit; text-decoration: underline; text-decoration-style: dotted; }
.link-subtle:hover { color: var(--gold); }

/* ── Stats row ──────────────────────────────────────────────── */
.caso-stats-row {
  display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.caso-stat-chip {
  --chip-color: var(--navy);
  background: var(--card); border: 1.5px solid var(--border);
  border-top: 3px solid var(--chip-color);
  border-radius: 10px; padding: .65rem 1rem;
  display: flex; flex-direction: column; align-items: center; min-width: 90px;
}
.caso-stat-icon {
  width: 30px; height: 30px; border-radius: 8px; margin-bottom: .3rem;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--chip-color) 12%, transparent);
  color: var(--chip-color);
}
.caso-stat-chip--msgs   { --chip-color: #2563eb; }
.caso-stat-chip--time   { --chip-color: #d97706; }
.caso-stat-chip--open   { --chip-color: #dc2626; }
.caso-stat-chip--link   { text-decoration: none; cursor: pointer; transition: opacity .15s, transform .1s; }
.caso-stat-chip--link:hover { opacity: .85; transform: translateY(-1px); }
.caso-stat-num { font-size: 1.2rem; font-weight: 800; color: var(--chip-color); }
.caso-stat-label { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }

/* ── Messages list inside case ──────────────────────────────── */
.section-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.section-title { font-size: 1rem; font-weight: 700; margin: 0; }
.section-title--danger { color: #dc2626; }
.caso-messages-list { display: flex; flex-direction: column; gap: .5rem; }
.caso-msg-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .65rem .9rem;
  background: var(--bg); border-radius: 8px; border: 1px solid var(--border);
}
.caso-msg-row.caso-msg--resolved { opacity: .65; }
.caso-msg-left { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.caso-msg-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.caso-msg-info { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.caso-msg-subject {
  font-size: .87rem; font-weight: 600; color: var(--navy);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.caso-msg-subject:hover { color: var(--gold); }
.caso-msg-meta { font-size: .72rem; color: var(--text-muted); }
.text-resolved { color: #10b981; }

/* Desvincular button */
.btn-icon-sm {
  background: none; border: 1.5px solid var(--border);
  border-radius: 6px; cursor: pointer; font-size: .75rem;
  padding: .15rem .4rem; color: var(--text-muted);
  transition: all .15s;
}
.btn-icon-sm:hover { border-color: #dc2626; color: #dc2626; }

/* ── Danger zone ────────────────────────────────────────────── */
.detail-section--danger {
  border-color: #fecaca;
  margin-top: 2rem;
}
[data-theme="dark"] .detail-section--danger { border-color: #7f1d1d; }
.danger-hint { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; }
.detail-section--danger form { display: flex; justify-content: center; }
.detail-section--danger .btn-danger {
  font-size: .78rem; padding: .35rem 1.1rem; border-radius: 7px;
}
.empty-hint { font-size: .85rem; color: var(--text-muted); margin: 0; }

/* ── Form inputs (shared for modal forms) ───────────────────── */
.form-label {
  display: flex; flex-direction: column; gap: .35rem;
  font-size: .85rem; font-weight: 600; color: var(--text);
}
.form-input {
  padding: .55rem .8rem; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--bg);
  color: var(--text); font-size: .9rem; width: 100%;
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--gold); }
select.form-input { appearance: auto; }

/* Mobile */
@media (max-width: 600px) {
  .casos-grid { grid-template-columns: 1fr; }
  .page-header-row { flex-direction: column; }
  .caso-actions-bar { flex-wrap: wrap; }
  .caso-stats-row { gap: .5rem; }
  .caso-stat-chip { min-width: 70px; padding: .5rem .75rem; }
}

/* =====================================================================
   v87 — Hoja de Ruta (proximas) + Guía (guia)
   ===================================================================== */

/* ── Page header ────────────────────────────────────────────────────── */
.roadmap-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem;
}
.roadmap-header-left { flex: 1; }
.page-subtitle {
  font-size: .9rem; color: var(--text-muted); margin: .25rem 0 0; line-height: 1.5;
}
.roadmap-admin-chip {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: .3rem .75rem; white-space: nowrap;
  align-self: flex-start; margin-top: .25rem;
}

/* ── Banner de conflictos pendientes (index.html, Task #53) ──────────────
   Aviso proactivo cuando counts.atencion > 0 en /casos/conflictos. */
.conflict-pending-banner {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 1.15rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #1B2B4A 0%, #243a6a 100%);
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(27,43,74,.30);
  color: #fff;
  text-decoration: none;
  flex-wrap: wrap;
  transition: transform .15s, box-shadow .15s;
}
.conflict-pending-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(127,29,29,.28);
}
.conflict-pending-banner .cpb-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  background: rgba(255,255,255,.18);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.conflict-pending-banner .cpb-body {
  flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: .2rem;
}
.conflict-pending-banner .cpb-title {
  color: #fff; font-size: .95rem; font-weight: 700; line-height: 1.3;
}
.conflict-pending-banner .cpb-sub {
  color: rgba(255,255,255,.88); font-size: .8rem; line-height: 1.45;
  font-weight: 400;
}
.conflict-pending-banner .cpb-cta {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: .35rem;
  background: #fff; color: #b91c1c;
  font-size: .82rem; font-weight: 700;
  padding: .5rem 1rem; border-radius: 8px;
  white-space: nowrap;
}

/* ── Banner de votación (index.html, mostrado por JS tras 3 días activos) ── */
.lexia-vote-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
  border-radius: 14px;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 18px rgba(79,70,229,.25);
  animation: lvb-slide-in .3s ease;
}
@keyframes lvb-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lvb-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
}
.lvb-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.lvb-body {
  flex: 1; min-width: 180px;
  display: flex; flex-direction: column; gap: .2rem;
}
.lvb-title {
  color: #fff; font-size: .95rem; font-weight: 700; line-height: 1.3;
}
.lvb-sub {
  color: rgba(255,255,255,.82); font-size: .82rem; line-height: 1.45;
}
.lvb-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: .4rem;
  background: #fff; color: #4f46e5;
  font-size: .82rem; font-weight: 700;
  padding: .55rem 1.1rem; border-radius: 8px;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.lvb-btn:hover { background: #eef2ff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.lvb-close {
  flex-shrink: 0;
  background: rgba(255,255,255,.15); border: none;
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
  transition: background .15s;
}
.lvb-close:hover { background: rgba(255,255,255,.28); }

/* ── CTA feedback al pie de la página de votación ──────────────────── */
.proximas-feedback-cta {
  margin: 2rem 0 1.5rem;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, #7c3aed 4%, var(--surface));
  transition: border-color .2s;
}
.proximas-feedback-cta:hover { border-color: #7c3aed; }
.pfc-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.25rem; flex-wrap: wrap;
}
.pfc-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  background: color-mix(in srgb, #7c3aed 12%, transparent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.pfc-body {
  flex: 1; min-width: 180px;
  display: flex; flex-direction: column; gap: .2rem;
}
.pfc-title {
  font-size: .92rem; font-weight: 700; color: var(--text);
}
.pfc-sub {
  font-size: .81rem; color: var(--text-muted); line-height: 1.5;
}
.pfc-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: .4rem;
  background: #7c3aed; color: #fff;
  font-size: .82rem; font-weight: 700;
  padding: .55rem 1.1rem; border-radius: 8px;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, box-shadow .15s;
}
.pfc-btn:hover { background: #6d28d9; box-shadow: 0 2px 8px rgba(124,58,237,.35); }
/* Clase utilitaria: cualquier botón CTA que la lleve
   ocupa todo el ancho y se centra automáticamente en móvil */
.btn-cta-mobile { }
@media (max-width: 640px) {
  .btn-cta-mobile { width: 100%; justify-content: center; }
}

/* ── Votes-used pips ────────────────────────────────────────────────── */
.roadmap-votes-row {
  display: flex; align-items: center; gap: .5rem; margin-bottom: 1.5rem;
}
.roadmap-vote-pip {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--gold); background: transparent; transition: background .2s;
}
.roadmap-vote-pip.filled { background: var(--gold); }
.roadmap-votes-label { font-size: .8rem; color: var(--text-muted); }

/* ── Feature cards grid ─────────────────────────────────────────────── */
.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}
.roadmap-card {
  --card-color: #475569;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--card-color);
  border-radius: 14px; padding: 1.25rem 1.25rem 1rem;
  display: flex; flex-direction: column; gap: .65rem;
  transition: box-shadow .2s, border-color .2s;
}
.roadmap-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  border-color: var(--card-color);
}
.roadmap-card--voted {
  border-color: var(--card-color);
  background: color-mix(in srgb, var(--card-color) 4%, var(--surface));
}
.roadmap-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.roadmap-cat-tag {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--card-color);
  background: color-mix(in srgb, var(--card-color) 10%, transparent);
  border-radius: 6px; padding: .2rem .55rem;
}
.roadmap-voted-badge {
  display: flex; align-items: center; gap: .25rem;
  font-size: .72rem; font-weight: 700; color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  border-radius: 6px; padding: .15rem .5rem;
}
.roadmap-card-icon { display: flex; align-items: center; }
.roadmap-icon-box {
  width: 46px; height: 46px; border-radius: 12px;
  background: color-mix(in srgb, var(--card-color) 12%, transparent);
  color: var(--card-color);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.roadmap-card-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin: 0; line-height: 1.25;
}
.roadmap-card-desc {
  font-size: .85rem; color: var(--text-muted); line-height: 1.55; margin: 0;
  flex: 1;
}

/* ── Progress bar ───────────────────────────────────────────────────── */
.roadmap-progress-row {
  display: flex; align-items: center; gap: .6rem;
}
.roadmap-progress-bar {
  flex: 1; height: 5px; background: var(--border); border-radius: 99px; overflow: hidden;
}
.roadmap-progress-fill {
  height: 100%; border-radius: 99px;
  background: var(--card-color);
  transition: width .4s ease;
  min-width: 3px;
}
.roadmap-progress-label {
  font-size: .78rem; color: var(--text-muted); white-space: nowrap;
}

/* ── Vote button ────────────────────────────────────────────────────── */
.roadmap-vote-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .84rem; font-weight: 600; cursor: pointer;
  border-radius: 9px; padding: .55rem .9rem;
  border: 1.5px solid color-mix(in srgb, var(--card-color) 35%, transparent);
  background: color-mix(in srgb, var(--card-color) 6%, var(--surface));
  color: var(--card-color);
  transition: all .15s; width: 100%; justify-content: center;
}
.roadmap-vote-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--card-color) 14%, var(--surface));
  border-color: var(--card-color);
}
.roadmap-vote-btn--active {
  background: var(--card-color);
  border-color: var(--card-color);
  color: #fff;
}
.roadmap-vote-btn--active:hover {
  background: color-mix(in srgb, #dc2626 80%, var(--card-color));
  border-color: #dc2626; color: #fff;
}
.roadmap-vote-btn--disabled {
  opacity: .4; cursor: not-allowed;
}

/* ── Admin ranking table ────────────────────────────────────────────── */
.roadmap-admin-table {
  display: flex; flex-direction: column; gap: .5rem;
}
.roadmap-admin-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center; gap: .75rem;
  font-size: .85rem;
}
.roadmap-admin-title { font-weight: 600; color: var(--text); }
.roadmap-admin-pct { font-size: .8rem; color: var(--text-muted); text-align: right; }

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .roadmap-grid { grid-template-columns: 1fr; }
  .roadmap-admin-row { grid-template-columns: 1fr 60px; }
  .roadmap-admin-title { grid-column: 1 / -1; }
}

/* =====================================================================
   Guía de la app (guia.html)
   ===================================================================== */
.guia-controls {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.guia-doc {
  max-width: 820px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 2.5rem 2.5rem 3rem;
  color: var(--text); line-height: 1.7;
}
.guia-cover {
  text-align: center; padding: 2rem 1rem 2.5rem;
  border-bottom: 2px solid var(--border); margin-bottom: 2rem;
}
.guia-cover-logo { margin-bottom: 1rem; }
.guia-logo-img { height: 60px; object-fit: contain; border-radius: 8px; }
.guia-cover-title {
  font-size: 2rem; font-weight: 800; margin: 0 0 .35rem;
}
.guia-title-lex { color: var(--navy); }
.guia-title-ia  { color: var(--gold); }
.guia-cover-tagline {
  font-size: .78rem; font-weight: 700; letter-spacing: .18em;
  color: var(--text-muted); text-transform: uppercase; margin: -.2rem 0 1rem;
}
.guia-cover-subtitle {
  font-size: .9rem; color: var(--text-muted); margin: 0 0 .5rem;
}
.guia-cover-date { font-size: .85rem; color: var(--text-muted); margin: 0; }

.guia-section {
  margin-bottom: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.guia-section:first-of-type { border-top: none; padding-top: 0; }
.guia-section-title {
  font-size: 1.15rem; font-weight: 700; color: var(--text);
  margin: 0 0 .85rem; letter-spacing: -.01em;
}
.guia-text { margin: 0 0 .75rem; font-size: .92rem; color: var(--text); }
.guia-feature-block {
  background: var(--bg); border-radius: 10px; padding: 1rem 1.25rem;
  margin-bottom: 1rem; border: 1px solid var(--border);
}
.guia-feature-title {
  font-size: .95rem; font-weight: 700; color: var(--text);
  margin: 0 0 .4rem;
}
.guia-list {
  margin: .5rem 0 0 1rem; padding: 0;
  font-size: .875rem; color: var(--text-muted); line-height: 1.7;
}
.guia-list li { margin-bottom: .2rem; }
.guia-table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
  margin-top: .5rem; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--navy);
}
.guia-table th, .guia-table td {
  padding: .6rem .85rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--navy) 15%, transparent);
}
.guia-table tr:last-child td { border-bottom: none; }
.guia-table th {
  background: var(--navy); font-weight: 700; color: #fff;
  letter-spacing: .02em; font-size: .8rem; text-transform: uppercase;
}
.guia-table tr:nth-child(even) td { background: color-mix(in srgb, var(--navy) 4%, transparent); }
.guia-table td { color: var(--text); }

/* Priority badges inline in table */
.guia-badge {
  display: inline-block; font-size: .72rem; font-weight: 800;
  border-radius: 5px; padding: .1rem .5rem; letter-spacing: .04em; text-transform: uppercase;
}
.guia-badge--p0 { background: #dc2626; color: #fff; }
.guia-badge--p1 { background: #ea580c; color: #fff; }
.guia-badge--p2 { background: #2563eb; color: #fff; }
.guia-badge--p3 { background: #6b7280; color: #fff; }

.guia-footer {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
  text-align: center; font-size: .8rem; color: var(--text-muted);
}
.guia-footer p { margin: .25rem 0; }

@media (max-width: 600px) {
  .guia-doc { padding: 1.25rem 1rem 2rem; }
  .guia-admin-row { grid-template-columns: 1fr; }
}

/* =====================================================================
   v88 — Admin email template editor (etpl-*)
   ===================================================================== */

.etpl-var-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--surface-alt, #f8fafc); border: 1px solid var(--border);
  border-radius: 6px; padding: .25rem .6rem;
}
.etpl-var-code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .78rem; color: var(--accent-primary, #1B2B4A);
  background: none; padding: 0;
}
.etpl-var-desc { font-size: .75rem; color: var(--text-muted); }

/* ── Card ────────────────────────────────────────────────────────── */
.etpl-card { overflow: hidden; }

.etpl-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.etpl-header-left { display: flex; align-items: flex-start; gap: .85rem; }
.etpl-icon-wrap {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--sidebar-bg, #1B2B4A);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.etpl-title   { font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.etpl-subtitle { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }

.etpl-test-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--border); border-radius: 6px;
  padding: .4rem .85rem; font-size: .78rem; font-weight: 600;
  color: var(--text-secondary); background: var(--bg);
  cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s;
}
.etpl-test-btn:hover { border-color: var(--accent-primary,#1B2B4A); color: var(--accent-primary,#1B2B4A); }

/* ── Form ────────────────────────────────────────────────────────── */
.etpl-form { padding: 1.1rem 1.25rem; }

.etpl-field { margin-bottom: 1rem; }
.etpl-label {
  display: flex; align-items: center; flex-wrap: wrap; gap: .4rem;
  font-size: .8rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .02em;
}
.etpl-hint-group { display: flex; flex-wrap: wrap; gap: .25rem; }
.etpl-hint {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .72rem; color: #0ea5e9;
  background: rgba(14,165,233,.08); border: 1px solid rgba(14,165,233,.2);
  border-radius: 4px; padding: .05rem .35rem;
}

.etpl-textarea { min-height: 70px; resize: vertical; }

.etpl-actions {
  display: flex; align-items: center; gap: 1rem; margin-top: 1rem;
  padding-top: .85rem; border-top: 1px solid var(--border);
}
.etpl-save-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .85rem;
}
.etpl-reset-hint { font-size: .75rem; color: var(--text-muted); }

@media (max-width: 600px) {
  .etpl-header { flex-direction: column; }
  .etpl-actions { flex-direction: column; align-items: flex-start; }
}

/* =====================================================================
   v89 — Admin Manual del sistema (manual-*)
   ===================================================================== */

.manual-doc {
  max-width: 860px; margin: 0 auto;
  background: var(--bg); border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ============================================================
   Dark Mode — Global overrides for hardcoded light backgrounds
   ============================================================ */

/* ── Kanban card elements ─────────────────────────────────── */
[data-theme="dark"] .card-ai-request    { background: var(--bg-alt); color: var(--text-muted); }
[data-theme="dark"] .card-action-label  { background: var(--bg-alt); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .card-action-primary { background: var(--bg-alt); color: var(--text); }
[data-theme="dark"] .card-notes-pill    { background: rgba(245,158,11,.1); color: #fbbf24; border-color: rgba(245,158,11,.25); }
[data-theme="dark"] .card-notes-pill:hover { background: rgba(245,158,11,.18); }
[data-theme="dark"] .card-draft         { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .deadline-date-badge { background: rgba(245,158,11,.15); color: #fbbf24; border-color: rgba(245,158,11,.3); }

/* ── Risk & timing badges ─────────────────────────────────── */
[data-theme="dark"] .risk-timing-indeterminado { background: var(--bg-alt); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .risk-timing-proximo  { background: rgba(245,158,11,.1); color: #fbbf24; border-color: rgba(245,158,11,.3); }
[data-theme="dark"] .legal-risk-block     { background: rgba(239,68,68,.08); border-left-color: #f87171; }
[data-theme="dark"] .attachment-analysis  { color: #6ee7b7; }

/* ── Form helpers ─────────────────────────────────────────── */
[data-theme="dark"] .form-hint  { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.25); color: #93c5fd; }
[data-theme="dark"] .cp-edit-wrap { background: var(--bg-alt); }

/* ── Detail page sections ─────────────────────────────────── */
[data-theme="dark"] .draft-section  { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .notes-section  { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.25); }
[data-theme="dark"] .notes-section h2 { color: #fbbf24; }

/* Subtítulo del cabecero (resumen en cursiva) */
[data-theme="dark"] .detail-header-left .subtitle { color: var(--text-muted); border-left-color: #fbbf24; }

/* Bloque "Análisis detallado" — fondo claro → oscuro */
[data-theme="dark"] .ai-summary-long-block {
  background: rgba(124,58,237,.1);
  border-left-color: #a78bfa;
  color: var(--text);
}

/* Texto limpio / síntesis — fondo verde claro → oscuro */
[data-theme="dark"] .raw-text.clean { background: rgba(134,239,172,.06); border-color: rgba(134,239,172,.25); }

/* ── Document analysis ────────────────────────────────────── */
[data-theme="dark"] .doc-analysis-type          { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .doc-block-title            { background: var(--bg-alt); }
[data-theme="dark"] .doc-block-dates .doc-block-title { background: var(--bg-alt); color: #93c5fd; border-color: var(--border); }
[data-theme="dark"] .doc-list-dates li          { color: #93c5fd; }

/* ── Sender & reminder banners ────────────────────────────── */
[data-theme="dark"] .sender-action-bar  { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .reminder-banner    { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #fbbf24; }

/* ── Stats KPI cards ──────────────────────────────────────── */
[data-theme="dark"] .stats-kpi-open  { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .stats-kpi-resolved { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .stats-kpi-rate  { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .stats-kpi-conf  { background: var(--surface); border-color: var(--border); }

/* ── Vincular panel ───────────────────────────────────────── */
[data-theme="dark"] .vincular-panel  { background: var(--surface); }
[data-theme="dark"] .vincular-hint   { color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────── */
[data-theme="dark"] .btn-demo-login  { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.35); color: #93c5fd; }
[data-theme="dark"] .btn-demo-login:hover { background: rgba(59,130,246,.18); }
[data-theme="dark"] .btn-gmail-import { background: rgba(201,168,76,.1); color: var(--gold); border-color: rgba(201,168,76,.35); }
[data-theme="dark"] .btn-outline-navy { color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .btn-outline-navy:hover { background: var(--bg-alt); color: var(--text); border-color: var(--text-muted); }

/* ── Feedback cards ───────────────────────────────────────── */
[data-theme="dark"] .fb-type-card--selected { background: rgba(201,168,76,.12) !important; border-color: var(--gold) !important; }
[data-theme="dark"] .fb-admin-card--unread  { background: var(--surface); }

/* ── Portada ──────────────────────────────────────────────────────── */
.manual-cover {
  background: linear-gradient(160deg, #1B2B4A 0%, #0f1e35 100%);
  color: #fff; padding: 3.5rem 2.5rem 3rem;
  text-align: center; position: relative;
}
.manual-cover::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 4px; background: linear-gradient(90deg, #C9A84C, #f0d080, #C9A84C);
}
.manual-cover-logo-wrap {
  margin-bottom: 1.25rem;
}
.manual-cover-logo {
  height: 72px; border-radius: 10px; object-fit: contain;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.manual-cover-title {
  font-size: 2.5rem; font-weight: 900; letter-spacing: .05em;
  margin: 0 0 .35rem; color: #fff;
}
.manual-cover-subtitle {
  font-size: 1rem; color: rgba(255,255,255,.7);
  margin: 0 0 1.5rem; line-height: 1.6;
}
.manual-cover-divider {
  width: 60px; height: 3px;
  background: linear-gradient(90deg, #C9A84C, #f0d080);
  margin: 1.5rem auto;
}
.manual-cover-doctype {
  font-size: .7rem; letter-spacing: .18em; font-weight: 700;
  color: #C9A84C; text-transform: uppercase; margin: 0 0 .25rem;
}
.manual-cover-date {
  font-size: .82rem; color: rgba(255,255,255,.5); margin: 0 0 2rem;
}

/* Contact card in cover */
.manual-cover-contact { display: flex; justify-content: center; }
.manual-contact-card {
  display: flex; align-items: center; gap: 1rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px; padding: 1rem 1.5rem; max-width: 380px; text-align: left;
}
.manual-contact-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #C9A84C, #f0d080);
  color: #1B2B4A; font-weight: 900; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.manual-contact-name  { font-weight: 700; font-size: .95rem; color: #fff; }
.manual-contact-role  { font-size: .78rem; color: rgba(255,255,255,.55); margin: .1rem 0 .35rem; }
.manual-contact-data  { display: flex; flex-wrap: wrap; gap: .5rem; }
.manual-contact-data span { font-size: .78rem; color: rgba(255,255,255,.75); }

/* ── Sections ────────────────────────────────────────────────────── */
.manual-section {
  padding: 1.75rem 2rem; border-bottom: 1px solid var(--border);
}
.manual-section:last-child { border-bottom: none; }

.manual-section-title {
  display: flex; align-items: center; gap: .75rem;
  font-size: 1.1rem; font-weight: 800; color: var(--text-primary);
  margin: 0 0 1.25rem;
}
.manual-section-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0; color: #fff;
}
.manual-admin-only-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  background: #1B2B4A; color: #C9A84C; border-radius: 20px;
  padding: .2rem .7rem; text-transform: uppercase;
}

.manual-text {
  font-size: .88rem; color: var(--text-secondary);
  line-height: 1.7; margin: 0 0 1rem;
}

/* ── Intro box ────────────────────────────────────────────────────── */
.manual-intro-box {
  background: linear-gradient(135deg, rgba(27,43,74,.04), rgba(201,168,76,.06));
  border: 1px solid rgba(201,168,76,.25); border-left: 4px solid #C9A84C;
  border-radius: 8px; padding: 1.1rem 1.25rem;
}

/* ── ToC ──────────────────────────────────────────────────────────── */
.manual-toc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem;
}
.manual-toc-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .85rem; border: 1px solid var(--border);
  border-radius: 7px; font-size: .82rem; font-weight: 600;
  color: var(--text-secondary); text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.manual-toc-item:hover {
  border-color: #1B2B4A; color: #1B2B4A;
  background: rgba(27,43,74,.04);
}
.manual-toc-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: #1B2B4A; color: #fff;
  font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Priority grid ────────────────────────────────────────────────── */
.manual-priority-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .85rem; margin-top: .5rem;
}
.manual-priority-card {
  border-radius: 10px; padding: 1.1rem; border: 1px solid transparent;
}
.manual-p0 { background: #fee2e2; border-color: #fca5a5; }
.manual-p1 { background: #ffedd5; border-color: #fdba74; }
.manual-p2 { background: #dbeafe; border-color: #93c5fd; }
.manual-p3 { background: #f3f4f6; border-color: #d1d5db; }

.manual-priority-badge {
  display: inline-block; font-size: .7rem; font-weight: 900;
  padding: .2rem .55rem; border-radius: 4px; margin-bottom: .5rem;
  color: #fff;
}
.manual-p0 .manual-priority-badge { background: #dc2626; }
.manual-p1 .manual-priority-badge { background: #ea580c; }
.manual-p2 .manual-priority-badge { background: #2563eb; }
.manual-p3 .manual-priority-badge { background: #6b7280; }

.manual-priority-label { font-weight: 700; font-size: .88rem; margin-bottom: .35rem; }
.manual-priority-desc  { font-size: .78rem; color: var(--text-secondary); line-height: 1.5; margin: 0 0 .6rem; }
.manual-priority-action {
  font-size: .73rem; font-weight: 600; color: var(--text-muted);
  padding-top: .5rem; border-top: 1px solid rgba(0,0,0,.08);
}

/* ── Feature tree ─────────────────────────────────────────────────── */
.manual-feature-tree { display: flex; flex-direction: column; gap: 0; }

.manual-tree-parent {
  display: flex; align-items: flex-start; gap: .85rem;
  padding: .9rem 0 .5rem;
  border-top: 1px solid var(--border);
}
.manual-tree-parent:first-child { border-top: none; padding-top: .25rem; }

.manual-tree-parent-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; margin-top: .15rem;
}
.manual-tree-parent-title {
  font-weight: 700; font-size: .9rem; color: var(--text-primary);
  margin-bottom: .25rem;
}
.manual-tree-parent-desc {
  font-size: .8rem; color: var(--text-secondary); line-height: 1.6;
}

.manual-tree-children {
  display: flex; flex-wrap: wrap; gap: .35rem .75rem;
  padding: .35rem 0 .9rem 3.2rem;
}
.manual-tree-child {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; color: var(--text-secondary);
}
.manual-tree-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}

/* ── Cards grid ───────────────────────────────────────────────────── */
.manual-cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .85rem;
}
.manual-card {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--bg);
}
.manual-card-header {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .9rem 1rem .7rem; border-left: 3px solid;
  background: var(--surface);
}
.manual-card-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.manual-card-title { font-weight: 700; font-size: .88rem; color: var(--text-primary); }
.manual-card-tag {
  display: inline-block; font-size: .68rem; font-weight: 700;
  border-radius: 4px; padding: .1rem .45rem; margin-top: .2rem;
}
.manual-card-desc {
  font-size: .78rem; color: var(--text-secondary); line-height: 1.6;
  padding: .7rem 1rem .35rem; margin: 0;
}
.manual-card-list {
  list-style: none; padding: 0 1rem .85rem; margin: 0;
}
.manual-card-list li {
  font-size: .78rem; color: var(--text-secondary); padding: .2rem 0;
  padding-left: 1rem; position: relative;
}
.manual-card-list li::before {
  content: '›'; position: absolute; left: 0; color: var(--text-muted);
  font-weight: 700;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.manual-footer {
  background: linear-gradient(160deg, #1B2B4A 0%, #0f1e35 100%);
  color: rgba(255,255,255,.7); text-align: center;
  padding: 2rem 1.5rem; position: relative;
}
.manual-footer::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, #C9A84C, #f0d080, #C9A84C);
}
.manual-footer-logo {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin-bottom: .75rem;
}
.manual-footer-brand { font-size: 1.1rem; font-weight: 900; color: #fff; }
.manual-footer-text  { font-size: .78rem; margin: .25rem 0; }
.manual-footer-contact {
  display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem .75rem;
  font-size: .8rem; margin: .85rem 0 .4rem;
  padding: .75rem 1rem; background: rgba(255,255,255,.07);
  border-radius: 8px; border: 1px solid rgba(255,255,255,.1);
}
.manual-footer-contact strong { color: #fff; }
.manual-footer-version { font-size: .7rem; color: rgba(255,255,255,.35); margin: .5rem 0 0; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .manual-cover      { padding: 2.5rem 1.25rem 2rem; }
  .manual-section    { padding: 1.25rem 1rem; }
  .manual-cover-title { font-size: 1.8rem; }
  .manual-contact-card { flex-direction: column; text-align: center; }
  .manual-priority-grid { grid-template-columns: repeat(2, 1fr); }
  .manual-toc-grid  { grid-template-columns: 1fr; }
  .manual-tree-children { padding-left: .5rem; }
  .manual-cards-grid { grid-template-columns: 1fr; }
  .manual-footer-contact { flex-direction: column; align-items: center; }
}

/* ── Font size picker (Configuración → Personalización) ───────────── */
.fs-picker {
  display: flex; gap: .6rem; align-items: stretch; margin-top: .5rem;
}
.fs-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; padding: .6rem 1.1rem; min-width: 72px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg-alt); color: var(--text-muted);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
  font-family: var(--font-sans);
}
.fs-btn:hover { border-color: var(--gold); color: var(--text); }
.fs-btn--active {
  border-color: var(--gold); background: rgba(201,168,76,.12); color: var(--text);
}
.fs-btn-letter { font-weight: 700; line-height: 1; }
.fs-btn-small  .fs-btn-letter { font-size: .75rem; }
.fs-btn-normal .fs-btn-letter { font-size: 1rem; }
.fs-btn-large  .fs-btn-letter { font-size: 1.5rem; }
.fs-btn-label { font-size: .7rem; color: var(--text-muted); }
[data-theme="dark"] .fs-btn--active { background: rgba(251,191,36,.1); }

/* ── Font picker compacto en menú hamburguesa ── */
.nav-font-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  cursor: default;
  pointer-events: none;
}
.nav-font-picker-row .nav-font-picker-label {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}
/* Contenedor segmentado — igual look que .nav-seg-ctrl */
.nav-font-picker-btns {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  pointer-events: all;
  border: 1.5px solid var(--border);
  border-radius: .45rem;
  overflow: hidden;
  gap: 0;
}
.nav-fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .22rem .48rem;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--card-bg);
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-fs-btn:last-child { border-right: none; }
.nav-fs-btn--small  { font-size: .72rem; }
.nav-fs-btn--normal { font-size: .88rem; }
.nav-fs-btn--large  { font-size: 1.05rem; }
.nav-fs-minus, .nav-fs-plus { font-size: .55em; font-weight: 700; }
.nav-fs-btn:hover { background: var(--hover-bg); color: var(--text); }
.nav-fs-btn--active {
  background: var(--gold);
  color: #1a1a1a;
}
[data-theme="dark"] .nav-fs-btn--active { background: #fbbf24; color: #111; }

/* ── Fila inferior combinada: Modo día + S·M·L ── */
.nav-drawer-bottom-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  min-height: 3rem;
}
.nav-drawer-bottom-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  flex: 1;
  padding: .75rem .9rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
}
.nav-drawer-bottom-theme:hover { background: var(--bg-alt); }
.nav-drawer-bottom-vsep {
  width: 1px;
  height: 1.6rem;
  background: var(--border);
  flex-shrink: 0;
}
.nav-drawer-bottom-row .nav-seg-ctrl {
  margin: 0 .9rem;
  flex-shrink: 0;
}
/* Control segmentado S·M·L */
.nav-seg-ctrl {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: .45rem;
  overflow: hidden;
}
.nav-seg-btn {
  padding: .25rem .55rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  border: none;
  background: var(--card-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  border-right: 1px solid var(--border);
  line-height: 1;
}
.nav-seg-btn:last-child { border-right: none; }
.nav-seg-btn:hover { background: var(--hover-bg); color: var(--text); }
.nav-seg-btn--active {
  background: var(--gold);
  color: #1a1a1a;
}
[data-theme="dark"] .nav-seg-btn--active {
  background: #fbbf24;
  color: #111;
}

/* ============================================================
   Remitentes excluidos page
   ============================================================ */
.excl-page { max-width: 800px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.excl-header { margin-bottom: 1.75rem; }
.excl-back-link {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .8rem; color: var(--text-muted); text-decoration: none;
  margin-bottom: .75rem;
}
.excl-back-link:hover { color: var(--text); }
.excl-back-link .btn-icon { width: 14px; height: 14px; }

.excl-title {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.35rem; font-weight: 700; color: var(--text);
  margin: 0 0 .4rem;
}
.excl-title-icon { width: 22px; height: 22px; color: #7c3aed; }

.excl-subtitle { font-size: .85rem; color: var(--text-muted); margin: 0; max-width: 640px; }

.excl-table-wrap {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.excl-table { width: 100%; border-collapse: collapse; }
.excl-table thead th {
  text-align: left; font-size: .72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
  padding: .65rem 1rem; background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.excl-row { border-bottom: 1px solid var(--border); }
.excl-row:last-child { border-bottom: none; }
.excl-row:hover { background: var(--hover-bg); }
.excl-sender { padding: .75rem 1rem; font-size: .84rem; font-weight: 500; color: var(--text); word-break: break-all; }
.excl-date { padding: .75rem 1rem; font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.excl-days { padding: .75rem 1rem; }
.excl-actions { padding: .5rem 1rem; }

.excl-days-pill {
  display: inline-block; font-size: .73rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: 20px;
}
.excl-days-pending { background: #f0fdf4; color: #166534; }
.excl-days-soon { background: #fef3c7; color: #92400e; }
.excl-days-done { background: #fce7f3; color: #9d174d; }

.btn-excl-restore {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .73rem; font-weight: 600; padding: .3rem .7rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card-bg); color: var(--text-muted);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.btn-excl-restore:hover { background: var(--hover-bg); color: var(--text); border-color: var(--text-muted); }
.btn-excl-restore .btn-icon { width: 13px; height: 13px; }

.excl-empty {
  padding: 3rem 1rem; text-align: center;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-muted);
}
.excl-empty-icon { width: 36px; height: 36px; margin-bottom: .75rem; opacity: .4; }
.excl-empty-msg { font-size: .95rem; font-weight: 600; margin: 0 0 .3rem; }
.excl-empty-hint { font-size: .82rem; margin: 0; }

.btn-excl-cfg {
  display: inline-flex; align-items: center;
  font-size: .82rem; font-weight: 600;
  padding: .4rem .9rem; margin-top: .75rem;
  border: 1px solid #c4b5fd; border-radius: 7px;
  background: #f5f3ff; color: #5b21b6;
  text-decoration: none; transition: background .15s;
}
.btn-excl-cfg:hover { background: #ede9fe; }

/* Unified excluded page — sections */
.excl-section { margin-bottom: 2.25rem; }
.excl-section-title {
  display: flex; align-items: center; gap: .5rem;
  font-size: .92rem; font-weight: 700; color: var(--text);
  margin: 0 0 .85rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.excl-section-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  color: #fff;
}
.excl-icon-wa { background: #25d366; }
.excl-icon-email { background: #ea4335; }

.excl-empty-inline {
  padding: 1.25rem 1rem; display: flex; align-items: center; gap: .75rem;
}
.excl-empty-inline .excl-empty-icon { width: 20px; height: 20px; margin-bottom: 0; opacity: .45; }
.excl-empty-inline .excl-empty-msg { font-size: .85rem; font-weight: 600; margin: 0; }
.excl-empty-inline .excl-empty-hint { font-size: .78rem; margin: 0; }

/* ── Actuaciones recomendadas card (standalone) ──────────────────── */
.pasos-ia-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1.5px solid #6ee7b7;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.pasos-ia-header {
  display: flex; align-items: center; gap: .6rem;
  background: #059669; padding: .6rem .85rem;
}
.pasos-ia-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.18); color: #fff; flex-shrink: 0;
}
.pasos-ia-header-text { display: flex; flex-direction: column; gap: .05rem; }
.pasos-ia-title { font-size: .84rem; font-weight: 700; color: #fff; }
.pasos-ia-sub   { font-size: .71rem; color: rgba(255,255,255,.8); }
.pasos-ia-body  { padding: .25rem 0; }

.pasos-list { list-style: none; padding: 0; margin: 0; }
.paso-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem;
  padding: .55rem .75rem;
  border-bottom: 1px solid #d1fae5;
  font-size: .82rem; line-height: 1.45;
}
.paso-item:last-child { border-bottom: none; }

.paso-tag {
  display: inline-block; flex-shrink: 0;
  font-size: .67rem; font-weight: 800; letter-spacing: .04em;
  padding: .12rem .45rem; border-radius: 20px;
  vertical-align: baseline; white-space: nowrap;
}
.paso-tag--urgente  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.paso-tag--semana   { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.paso-tag--proximo  { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* "Subir archivo" button — documents section */
.btn-doc-subir {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 700;
  padding: .38rem .9rem; border-radius: 8px;
  background: #0d9488; color: #fff;
  border: none; cursor: pointer;
  box-shadow: 0 1px 3px rgba(13,148,136,.35);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-doc-subir:hover  { background: #0f766e; box-shadow: 0 2px 6px rgba(13,148,136,.45); }
.btn-doc-subir:active { transform: scale(.97); }

/* "Contacto nuevo" badge on message cards */
.badge-new-contact {
  display: inline-block;
  font-size: .62rem; font-weight: 600;
  vertical-align: middle;
  color: #c2410c;
  white-space: nowrap; margin-left: .3rem; cursor: default;
}

/* ── Estrategia de defensa card ────────────────────────────────── */
.estrategia-ia-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.estrategia-ia-header {
  display: flex; align-items: center; gap: .6rem;
  background: #b45309; padding: .6rem .85rem;
}
.estrategia-ia-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.18); color: #fff; flex-shrink: 0;
}
.estrategia-ia-header-text { display: flex; flex-direction: column; gap: .05rem; }
.estrategia-ia-title { font-size: .84rem; font-weight: 700; color: #fff; }
.estrategia-ia-sub   { font-size: .71rem; color: rgba(255,255,255,.8); }
.estrategia-ia-body  { padding: .5rem .85rem; }
.estrategia-ia-body ul.estrategia-list {
  list-style: none;
  padding: 0; margin: 0;
  counter-reset: estrategia-counter;
}
.estrategia-ia-body ul.estrategia-list li {
  display: flex; align-items: baseline; gap: .5rem;
  font-size: .82rem; line-height: 1.5;
  color: #78350f;
  padding: .35rem 0;
  border-bottom: 1px solid #fde68a;
  counter-increment: estrategia-counter;
}
.estrategia-ia-body ul.estrategia-list li::before {
  content: counter(estrategia-counter);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 50%;
  background: #b45309; color: #fff;
  font-size: .67rem; font-weight: 800; flex-shrink: 0;
}
.estrategia-ia-body ul.estrategia-list li:last-child { border-bottom: none; }
.estrategia-ia-body p {
  font-size: .82rem; line-height: 1.5;
  color: #78350f; margin: .25rem 0;
}

/* ── Orientación jurídica card ─────────────────────────────────── */
.orientacion-ia-card {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1.5px solid #c4b5fd;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.orientacion-ia-header {
  display: flex; align-items: center; gap: .6rem;
  background: #7c3aed; padding: .6rem .85rem;
}
.orientacion-ia-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.18); color: #fff; flex-shrink: 0;
}
.orientacion-ia-header-text { display: flex; flex-direction: column; gap: .05rem; }
.orientacion-ia-title { font-size: .84rem; font-weight: 700; color: #fff; }
.orientacion-ia-sub   { font-size: .71rem; color: rgba(255,255,255,.8); }
.orientacion-ia-body  { padding: .5rem .85rem; }
.orientacion-ia-body ul.orientacion-list {
  list-style: disc;
  padding-left: 1.2rem;
  margin: 0;
}
.orientacion-ia-body ul.orientacion-list li {
  font-size: .82rem; line-height: 1.5;
  color: #3b0764;
  padding: .2rem 0;
  border-bottom: 1px solid #ddd6fe;
}
.orientacion-ia-body ul.orientacion-list li:last-child { border-bottom: none; }
.orientacion-ia-body p {
  font-size: .82rem; line-height: 1.5;
  color: #3b0764; margin: .25rem 0;
}
.orientacion-ia-disclaimer {
  display: flex; align-items: flex-start; gap: .4rem;
  background: #fef3c7; border-top: 1px solid #fde68a;
  padding: .45rem .75rem;
  font-size: .72rem; line-height: 1.4; color: #92400e;
  font-style: italic;
}

/* ══════════════════════════════════════════════════════════════════
   BORRADOR DE ESCRITO — v127
   ══════════════════════════════════════════════════════════════════ */
.borrador-section {
  background: #fff;
  border: 1.5px solid #e9d5ff;
  border-radius: 12px;
  margin: .6rem 0;
  overflow: visible;
}
.borrador-section-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .85rem;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-radius: 10px 10px 0 0;
}
.borrador-section-icon {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.18); color: #fff; flex-shrink: 0;
}
.borrador-section-header-text { display: flex; flex-direction: column; gap: .05rem; }
.borrador-section-title { font-size: .84rem; font-weight: 700; color: #fff; }
.borrador-section-sub   { font-size: .71rem; color: rgba(255,255,255,.8); }
.borrador-selector-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem .85rem .75rem;
  flex-wrap: wrap;
}
.borrador-tipo-select {
  flex: 1; min-width: 200px;
  border: 1.5px solid #d8b4fe;
  border-radius: 8px;
  padding: .42rem .65rem;
  font-size: .83rem;
  color: var(--text-primary);
  background: #faf5ff;
  outline: none;
  appearance: auto;
}
.borrador-tipo-select:focus { border-color: #7c3aed; background: #fff; }
.btn-borrador-generar {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #7c3aed; color: #fff;
  border: none; border-radius: 8px;
  padding: .42rem .9rem;
  font-size: .82rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.btn-borrador-generar:hover { background: #6d28d9; }
.btn-borrador-generar:disabled { opacity: .55; cursor: not-allowed; }
.borrador-manage-link {
  padding: 0 .85rem .5rem;
  margin: 0;
  font-size: .72rem;
}
.link-subtle-sm {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .25rem;
}
.link-subtle-sm:hover { color: #7c3aed; }
.borrador-generating {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .85rem;
  font-size: .82rem; color: var(--text-secondary);
}
/* ── Result card ── */
.borrador-result-card {
  border-top: 1.5px solid #e9d5ff;
  margin: 0;
}
.borrador-result-header {
  display: flex; align-items: center; justify-content: flex-end;
  padding: .55rem .85rem;
  background: #f5f3ff;
  border-bottom: 1px solid #ede9fe;
}
.borrador-result-tipo { display: none; }
.borrador-result-actions {
  display: flex; align-items: center; gap: .4rem;
}
.btn-borrador-save {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #7c3aed; color: #fff;
  border: 1.5px solid #7c3aed; border-radius: 7px;
  padding: .3rem .7rem;
  font-size: .76rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-borrador-save:hover  { background: #6d28d9; border-color: #6d28d9; }
.btn-borrador-save:disabled { opacity: .6; cursor: default; }
.btn-borrador-copy {
  display: inline-flex; align-items: center; gap: .3rem;
  background: transparent; color: #7c3aed;
  border: 1.5px solid #d8b4fe; border-radius: 7px;
  padding: .3rem .7rem;
  font-size: .76rem; font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-borrador-copy:hover { background: #7c3aed; color: #fff; }
.borrador-editable-hint {
  display: flex; align-items: center; gap: .35rem;
  padding: .3rem .85rem;
  font-size: .72rem; color: #7c3aed; font-style: italic;
  background: #f5f3ff; border-bottom: 1px dashed #ddd6fe;
}
.borrador-result-body {
  display: block;
  width: 100%; box-sizing: border-box;
  padding: .75rem .85rem;
  font-size: .8rem; line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  background: #fdfcff;
  margin: 0;
  min-height: 120px;
  resize: vertical;
  border: none; outline: none;
  border-bottom: 1px solid #ede9fe;
  font-family: 'Georgia', 'Times New Roman', serif;
  transition: background .15s;
}
.borrador-result-body:focus {
  background: #fff;
  outline: none;
}
.borrador-result-disclaimer {
  display: flex; align-items: flex-start; gap: .4rem;
  background: #fef3c7; border-top: 1px solid #fde68a;
  padding: .45rem .75rem;
  font-size: .72rem; line-height: 1.4; color: #92400e;
  font-style: italic;
}

/* ── Session inactivity timeout modal ──────────────────────────────────── */
.session-timeout-dialog {
  border: none;
  border-radius: 18px;
  padding: 2rem 1.75rem;
  box-shadow: 0 8px 40px rgba(0,0,0,.22);
  max-width: 340px;
  width: 90%;
}
.session-timeout-dialog::backdrop {
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
}
.session-timeout-icon {
  font-size: 2.2rem;
  margin-bottom: .35rem;
  display: block;
}
.session-countdown-display {
  font-size: 2.8rem;
  font-weight: 800;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  margin: .2rem 0 .6rem;
  line-height: 1;
  transition: color .3s;
}

/* ── Demo trial banner (asistente) ───────────────────────────────────── */
.demo-trial-banner {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .85rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  font-size: .78rem;
  color: #92400e;
  margin-bottom: .25rem;
}
.demo-trial-icon { font-size: 1rem; flex-shrink: 0; }
.demo-trial-text { flex: 1; line-height: 1.4; }
.demo-trial-link {
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
}

/* ── Fuentes jurídicas (asistente) ────────────────────────────────────── */
.chat-sources {
  margin-top: .65rem;
  padding: .6rem .75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .78rem;
}
.chat-sources-title {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .7rem;
  margin-bottom: .45rem;
}
.chat-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.chat-sources-list li {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  line-height: 1.35;
}
.chat-sources-list a {
  color: var(--navy);
  text-decoration: underline;
  word-break: break-word;
}
.chat-sources-list a:hover { opacity: .75; }
.chat-src-badge {
  flex-shrink: 0;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .1rem .35rem;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-muted);
  margin-top: .05rem;
}
.chat-src-badge--boe   { background: #dbeafe; color: #1e40af; }
.chat-src-badge--cendoj { background: #dcfce7; color: #166534; }
.chat-src-badge--dogc  { background: #d1fae5; color: #065f46; border: 1px solid #009B77; }
.chat-src-date { color: var(--text-muted); }

/* ── Videollamada Whereby ─────────────────────────────────────────────── */
.btn-whereby {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1rem;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 600;
  color: #16a34a;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  text-decoration: none;
}
.btn-whereby:hover { background: #dcfce7; border-color: #4ade80; }
.btn-whereby-sub {
  font-size: .7rem;
  font-weight: 400;
  color: #15803d;
  opacity: .75;
}
.whereby-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.62);
  backdrop-filter: blur(4px);
  z-index: 9100;
  align-items: center;
  justify-content: center;
}
.whereby-modal-backdrop.open { display: flex; }
.whereby-modal {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,.28);
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.whereby-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}
.whereby-modal-title {
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.whereby-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: 6px;
  line-height: 0;
}
.whereby-modal-close:hover { background: var(--bg-alt); }
.whereby-room-body {
  padding: .8rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.whereby-room-frame {
  flex: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  min-height: 400px;
}
.whereby-room-frame whereby-embed {
  width: 100%;
  height: 430px;
  display: block;
  border: none;
  border-radius: 12px;
}
.whereby-share-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.whereby-share-url {
  flex: 1;
  min-width: 0;
  font-size: .78rem;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whereby-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: .85rem;
}
.whereby-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: #16a34a;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.caso-whereby-row {
  margin: .75rem 0 .25rem;
}

/* ── Contact Import Modal ──────────────────────────────────────────────── */
.import-modal-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.55);
  align-items: center; justify-content: center;
}
.import-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(500px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,.32);
  overflow: hidden;
}
.import-modal-body {
  display: flex; flex-direction: column;
  overflow-y: auto;
  flex: 1;
}
.import-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem;
  background: var(--navy, #1B2B4A);
  font-weight: 700; font-size: .95rem; color: #fff;
}
.import-header-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(201,168,76,.25);
  border: 1px solid rgba(201,168,76,.4);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.import-modal-close {
  background: rgba(255,255,255,.12); border: none; cursor: pointer;
  color: rgba(255,255,255,.8); padding: .28rem .45rem; border-radius: 6px;
  display: flex; align-items: center;
  transition: background .15s;
}
.import-modal-close:hover { background: rgba(255,255,255,.22); color: #fff; }
/* Intro strip */
.import-intro-strip {
  padding: .85rem 1.25rem .7rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.import-intro-lead {
  margin: 0 0 .55rem; font-size: .87rem; color: var(--text-muted); line-height: 1.4;
}
.import-fmt-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.import-fmt-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .65rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.import-fmt-vcf {
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.import-fmt-csv {
  background: #f0fdf4; color: #166534;
  border: 1px solid #bbf7d0;
}
[data-theme="dark"] .import-fmt-vcf { background: #1e3a5f; color: #93c5fd; border-color: #1d4ed8; }
[data-theme="dark"] .import-fmt-csv { background: #14532d; color: #86efac; border-color: #16a34a; }
/* Drop zone */
.import-file-label {
  display: flex; flex-direction: column; align-items: center;
  gap: .35rem; padding: 1.65rem 1rem 1.25rem;
  border: 2px dashed var(--border);
  border-radius: 12px; cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
}
.import-file-label:hover,
.import-file-label.drag-over {
  border-color: var(--gold);
  background: var(--bg-alt);
}
.import-file-label:hover .import-drop-icon { background: rgba(201,168,76,.15); border-color: rgba(201,168,76,.4); color: #C9A84C; }
.import-drop-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: .3rem;
  transition: background .2s, border-color .2s, color .2s;
}
.import-drop-primary {
  font-size: .95rem; font-weight: 700; color: var(--text);
}
.import-drop-secondary {
  font-size: .8rem; color: var(--text-muted);
}
.import-drop-hint {
  font-size: .72rem; color: var(--text-muted);
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: .15rem .55rem; border-radius: 12px; margin-top: .2rem;
  letter-spacing: .02em;
}
/* Tutorial accordion */
.import-tutorial {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; font-size: .83rem;
}
.import-tutorial-toggle {
  display: flex; align-items: center; gap: .45rem;
  padding: .6rem .85rem; cursor: pointer;
  font-weight: 600; color: var(--text-muted);
  background: var(--bg-alt);
  list-style: none; user-select: none;
  transition: color .15s;
}
.import-tutorial-toggle::-webkit-details-marker { display: none; }
.import-tutorial-toggle:hover { color: var(--text); }
details[open] .import-tutorial-chevron { transform: rotate(180deg); }
.import-tutorial-chevron { transition: transform .2s; }
.import-tutorial-body {
  padding: .65rem .85rem .75rem;
  display: flex; flex-direction: column; gap: .55rem;
  border-top: 1px solid var(--border);
}
.import-platform-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .8rem .6rem;
}
.import-platform-title {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: .8rem; color: var(--text);
  margin-bottom: .4rem;
}
.import-platform-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 5px;
  font-size: .7rem; font-weight: 800; flex-shrink: 0;
}
.import-platform-android { background: #d1fae5; color: #065f46; }
.import-platform-apple   { background: #e0e7ff; color: #3730a3; font-size: .65rem; }
.import-platform-excel   { background: #dcfce7; color: #166534; }
[data-theme="dark"] .import-platform-android { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .import-platform-apple   { background: #312e81; color: #c7d2fe; }
[data-theme="dark"] .import-platform-excel   { background: #14532d; color: #86efac; }
.import-tutorial-steps {
  margin: 0; padding-left: 1.2rem;
  display: flex; flex-direction: column; gap: .22rem;
  color: var(--text-muted); line-height: 1.45;
}
.import-tutorial-steps strong { color: var(--text); }
.import-modal-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
  border-top: 1px solid var(--border);
}
.import-flash {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem; border-radius: 10px;
  font-size: .9rem; margin-bottom: .75rem;
}
.import-flash-ok {
  background: #dcfce7; color: #166534; border: 1px solid #86efac;
}
.import-flash-err {
  background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5;
}
[data-theme="dark"] .import-flash-ok {
  background: #14532d; color: #bbf7d0; border-color: #16a34a;
}
[data-theme="dark"] .import-flash-err {
  background: #450a0a; color: #fecaca; border-color: #dc2626;
}

/* ── Icon-only buttons ─────────────────────────────────────────────── */
.btn-icon-only {
  padding: .45rem .6rem !important;
  min-width: 0 !important;
  line-height: 1;
}

/* ── Client card states ────────────────────────────────────────────── */
.cl-card-corrupt {
  border-color: #f59e0b !important;
  opacity: .7;
}
.cl-card-incomplete-dot {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .72rem;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 5px;
  padding: .05rem .35rem;
  margin-left: .4rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Bulk-select mode ──────────────────────────────────────── */
.cl-card.cl-select-mode-card {
  cursor: default;
  user-select: none;
}
.cl-card.cl-card-selected {
  border-color: #DC2626 !important;
  background: #FEF2F2 !important;
  box-shadow: 0 0 0 2px rgba(220,38,38,.15) !important;
}
[data-theme="dark"] .cl-card.cl-card-selected {
  border-color: #F87171 !important;
  background: #3b0a0a !important;
  box-shadow: 0 0 0 2px rgba(248,113,113,.2) !important;
}
.cl-select-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 250;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  gap: 1rem;
}
.cl-select-info {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.cl-select-confirm {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.cl-select-confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  max-width: 420px;
  width: 92vw;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.cl-select-confirm-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .6rem;
}
.cl-select-confirm-body {
  font-size: .88rem;
  color: var(--text);
  margin: 0;
  line-height: 1.55;
}

/* ── Limpieza de contactos page ────────────────────────────────────── */
.limpiar-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.limpiar-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.limpiar-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 .35rem;
  color: var(--text);
}
.limpiar-desc {
  font-size: .83rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 520px;
}
.limpiar-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .5rem;
  font-size: .83rem;
  color: var(--text-muted);
}
.limpiar-check-all {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
}
.limpiar-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 360px;
  overflow-y: auto;
}
.limpiar-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .65rem;
  border-radius: 8px;
  background: var(--bg-alt);
  font-size: .84rem;
}
.limpiar-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.limpiar-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.limpiar-contact {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.limpiar-msgs {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.limpiar-edit-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  padding: .2rem .4rem;
  border-radius: 6px;
  transition: background .15s;
}
.limpiar-edit-link:hover { background: var(--border); }
.limpiar-empty {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1rem;
  color: var(--text-muted);
  font-size: .88rem;
}
.btn-danger {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}
.btn-danger:hover { background: #b91c1c !important; }

/* ── Import tutorial (collapsible) ─────────────────────────────────── */
.import-tutorial {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.import-tutorial-toggle {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem .85rem;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--bg-alt);
  list-style: none;
  user-select: none;
}
.import-tutorial-toggle::-webkit-details-marker { display: none; }
.import-tutorial-toggle::after {
  content: '▸';
  margin-left: auto;
  font-size: .75rem;
  transition: transform .2s;
}
details[open] .import-tutorial-toggle::after { transform: rotate(90deg); }
.import-tutorial-body {
  padding: .75rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  border-top: 1px solid var(--border);
}
.import-tutorial-os {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.import-tutorial-os-title {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}
.import-tutorial-steps {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.import-tutorial-steps li {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.import-tutorial-steps strong { color: var(--text); }

/* ── Incomplete contacts fold bar ───────────────────────────────────────── */
.cl-incomplete-bar {
  display: flex;
  justify-content: center;
  padding: .6rem 0 .2rem;
  margin-top: .25rem;
}
.cl-incomplete-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: .35rem .9rem;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.cl-incomplete-toggle-btn:hover {
  color: var(--navy);
  border-color: var(--navy);
  background: var(--bg-alt);
}

/* ── Limpieza: nav cards ─────────────────────────────────────────────────── */
.limpiar-nav-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin: 0 0 1.25rem;
}
@media (max-width: 480px) {
  .limpiar-nav-cards { grid-template-columns: 1fr; }
}
.limpiar-nav-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.limpiar-nav-card:hover {
  border-color: var(--navy);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.limpiar-nav-card-ok {
  border-color: #16a34a33;
}
.limpiar-nav-card-ok .limpiar-nav-icon { color: #16a34a; }
.limpiar-nav-card:not(.limpiar-nav-card-ok) .limpiar-nav-icon { color: #f59e0b; }
.limpiar-nav-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--bg-alt);
}
.limpiar-nav-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}
.limpiar-nav-body strong {
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.limpiar-nav-body span {
  font-size: .78rem;
  color: var(--text-muted);
}

/* ── Limpieza: constrain list height ────────────────────────────────────── */
.limpiar-list {
  max-height: 320px;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
}

/* ── Limpieza: info note ─────────────────────────────────────────────────── */
.limpiar-desc-info {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  margin-top: .4rem;
  padding: .45rem .65rem;
  background: color-mix(in srgb, var(--navy) 6%, transparent);
  border-left: 3px solid var(--navy);
  border-radius: 0 6px 6px 0;
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── Client card: urgency dot + left wrapper ─────────────────────────────── */
.cl-card-left {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}
.cl-urg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cl-urg-dot-p0 { background: #dc2626; }
.cl-urg-dot-p1 { background: #f59e0b; }
.cl-urg-dot-p2 { background: #94a3b8; }
.cl-urg-dot-p3, .cl-urg-dot-none { background: transparent; }

/* ── Client card: relative date line ─────────────────────────────────────── */
.cl-card-date {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .05rem;
}

/* ── Date label styling ──────────────────────────────────────────────────── */
.cl-card-date-label {
  font-size: .7rem;
  color: var(--text-muted);
  opacity: .7;
  margin-right: .25rem;
}
.cl-card-date-val {
  font-size: .75rem;
  color: var(--text-muted);
}

/* ── Limpieza: re-importar inline ────────────────────────────────────────── */
.limpiar-reimport {
  margin-top: 1rem;
  padding: .85rem 1rem;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.limpiar-reimport-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0 0 .6rem;
}
.limpiar-reimport-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.limpiar-reimport-filelabel {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: border-color .15s;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.limpiar-reimport-filelabel:hover { border-color: var(--navy); }

/* ── Limpieza: success con ícono festivo ─────────────────────────────────── */
.limpiar-import-ok {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  background: #f0fdf4;
  border: 1.5px solid #16a34a;
  border-radius: 10px;
  font-size: .88rem;
}
[data-theme="dark"] .limpiar-import-ok {
  background: #14532d22;
  border-color: #16a34a88;
}
.limpiar-import-ok strong { color: #15803d; display: block; margin-bottom: .15rem; }

/* ── Expediente: teléfono del cliente en cabecera ────────────────────────── */
.caso-client-phone {
  color: var(--navy);
  text-decoration: none;
  font-size: .85em;
  opacity: .85;
  white-space: nowrap;
}
.caso-client-phone:hover { text-decoration: underline; opacity: 1; }
[data-theme="dark"] .caso-client-phone { color: var(--gold); }

/* ── Herramientas IA — sección colapsable ────────────────────────────────── */
.ia-tools-section {
  margin: .75rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.ia-tools-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1rem;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  gap: .5rem;
  text-align: left;
}
.ia-tools-toggle:hover { background: var(--bg-alt); }
.ia-tools-toggle-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ia-tools-body {
  padding: .5rem .75rem .75rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.ia-tools-body .caso-resumen-ia-row { margin-top: .25rem; }
.ia-tools-body .borrador-section {
  margin-top: .75rem;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}

/* ── Herramientas IA v2 — sin cabecera colapsable ────────────────────────── */
.ia-tools-section { border: none; border-radius: 0; overflow: visible; margin: 0; }
.ia-tools-body    { padding: 0; border-top: none; background: transparent; }
.ia-tools-toggle  { display: none; }

/* ── Resumen IA: espaciado correcto sin envoltorio colapsable ────────────── */
.ia-tools-body .caso-resumen-ia-row { margin-top: 1rem; margin-bottom: 1rem; }

/* ── Borrador: gestionar-link dentro del selector-row ocupa fila completa ── */
.borrador-selector-row .borrador-manage-link {
  width: 100%;
  padding: 0;
  order: 2;
}
.borrador-selector-row .borrador-tipo-select { order: 1; }
.borrador-selector-row .btn-borrador-generar { order: 3; }

/* ── Resumen IA: contador regresivo ──────────────────────────────────────── */
.resumen-loading-countdown { flex-direction: column; gap: .5rem; text-align: center; }
.resumen-countdown-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  display: inline-block;
  min-width: 1.5rem;
}
[data-theme="dark"] .resumen-countdown-num { color: var(--gold); }

/* ── Borrador: editor pantalla completa ──────────────────────────────────── */
.borrador-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.bfs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem 1rem;
  background: #7c3aed;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.bfs-titulo {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bfs-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}
.bfs-close {
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 6px;
  padding: .3rem .4rem;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  line-height: 1;
}
.bfs-close:hover { background: rgba(255,255,255,.3); }
.bfs-hint {
  font-size: .75rem;
  color: var(--text-muted);
  padding: .4rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.bfs-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: .85rem 1rem;
  font-size: .9rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  font-family: inherit;
}
.bfs-disclaimer {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  font-size: .75rem;
  font-style: italic;
  color: #92400e;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  flex-shrink: 0;
}
[data-theme="dark"] .bfs-disclaimer { background: #292110; border-color: #4a3800; color: #d97706; }

/* ── Botones dentro de la barra del editor a pantalla completa ───── */
.bfs-header .btn-borrador-save,
.bfs-header .btn-borrador-copy {
  background: rgba(255,255,255,.18);
  color: #fff;
  border-color: rgba(255,255,255,.5);
}
.bfs-header .btn-borrador-save:hover,
.bfs-header .btn-borrador-copy:hover {
  background: rgba(255,255,255,.32);
  color: #fff;
  border-color: rgba(255,255,255,.75);
}
.bfs-header .btn-borrador-save:disabled,
.bfs-header .btn-borrador-copy:disabled {
  opacity: .55;
  cursor: default;
}

/* ── Borrador: cst-select de tipo de escrito ─────────────────────── */
.borrador-cst-select { flex: 1; min-width: 180px; }
.borrador-cst-select .cst-select-trigger {
  width: 100%; min-width: 0; max-width: none;
}
.borrador-cst-select .cst-select-panel {
  min-width: 100%; max-width: none; left: 0; right: 0;
}
.borrador-cst-select .cst-select-options { max-height: 260px; overflow-y: auto; }
.borrador-selector-row .btn-borrador-generar { flex-shrink: 0; }

@keyframes cst-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.cst-select--shake .cst-select-trigger {
  animation: cst-shake .4s ease;
  border-color: #ef4444 !important;
}

/* ── Borrador: etiqueta y fila "Usar este tipo" ─────────────────── */
.borrador-tipo-label {
  flex-shrink: 0;
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.borrador-usar-row {
  display: flex;
  justify-content: flex-end;
  padding: .2rem .85rem .4rem;
}
.borrador-usar-btn {
  flex-shrink: 0;
  padding: .18rem .55rem;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.borrador-usar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.borrador-usar-btn:disabled {
  opacity: .5;
  cursor: default;
}

/* ── Biometría: solo en móvil y tablet (< 1024 px) ──────────────── */
@media (min-width: 1024px) {
  .passkey-row-wrap { display: none !important; }
}

/* ── Login footer ────────────────────────────────────────────────── */
.login-footer {
  background: #1B2B4A;
  text-align: center;
  padding: .75rem 1.2rem 1rem;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.login-footer-desc {
  color: rgba(255,255,255,.55);
  font-size: .72rem;
  line-height: 1.4;
}
.login-footer-sep {
  color: rgba(255,255,255,.25);
  font-size: .72rem;
}
.login-footer-link {
  color: rgba(255,255,255,.5);
  font-size: .72rem;
  text-decoration: none;
}
.login-footer-link--primary {
  color: #C9A84C;
  font-weight: 600;
  text-decoration: underline;
}
.login-footer-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .3rem .4rem;
}

/* En escritorio: una sola línea + logo pegado a la tarjeta */
@media (min-width: 1024px) {
  .login-footer {
    flex-direction: row;
    justify-content: center;
    gap: .5rem;
  }
  .auth-brand { margin-bottom: .6rem; }
}

/* ============================================================
   DARK MODE — arreglos de contraste
   Todos los elementos que usaban var(--navy) como color de texto
   o fondos hardcoded claros quedan corregidos aquí.
   ============================================================ */

/* --- Lista de clientes --- */
[data-theme="dark"] .cl-card-name           { color: var(--text); }
[data-theme="dark"] .cl-card-count          { color: var(--text-muted); }
[data-theme="dark"] .cl-unlinked-title      { color: var(--text); }
[data-theme="dark"] .cl-unlinked-row        { background: var(--bg-alt); }

/* --- KPI strip (perfil de cliente) --- */
[data-theme="dark"] .cp-kpi-n              { color: var(--text); }
[data-theme="dark"] .cp-kpi:hover          { background: var(--bg-alt); }
[data-theme="dark"] .cp-kpi-active         { background: var(--gold) !important; }
[data-theme="dark"] .cp-kpi-active .cp-kpi-n { color: #111; }
[data-theme="dark"] .cp-kpi-active .cp-kpi-l { color: rgba(0,0,0,.65); }

/* --- Tabs (Historial / Plazos / Documentos) --- */
[data-theme="dark"] .exp-tab               { color: var(--text-muted); }
[data-theme="dark"] .exp-tab:hover         { color: var(--text); }
[data-theme="dark"] .exp-tab-active        { color: var(--gold) !important; border-bottom-color: var(--gold) !important; }
[data-theme="dark"] .exp-tab-badge         { background: var(--gold); color: #111; }
[data-theme="dark"] .exp-tab-active .exp-tab-badge { background: var(--gold); color: #111; }

/* ============================================================
   BÚSQUEDA INTELIGENTE — sugerencias de intención
   ============================================================ */
#nav-smart-box { margin-top: .5rem; }

.nav-smart-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--gold);
  padding: .35rem .1rem .2rem;
  opacity: .85;
}

.nav-smart-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .55rem; border-radius: 7px;
  text-decoration: none; color: var(--text);
  font-size: .82rem; font-weight: 500;
  transition: background .13s;
  cursor: pointer;
}
.nav-smart-item:hover { background: var(--bg-alt); color: var(--text); }
.nav-smart-item span  { flex: 1; }

.nav-smart-icon {
  width: 14px; height: 14px; flex-shrink: 0;
}
.nav-smart-arrow {
  width: 12px; height: 12px; opacity: .4; flex-shrink: 0;
}

[data-theme="dark"] .nav-smart-item:hover { background: var(--surface); }

.nav-smart-empty {
  font-size: .78rem; color: var(--text-muted);
  padding: .4rem .55rem; margin: 0;
  font-style: italic;
}

.nav-live-results {
  border-bottom: 1px solid var(--border);
  margin-bottom: .4rem;
  padding-bottom: .4rem;
}

.nav-smart-all {
  opacity: .7;
  font-size: .78rem;
  margin-top: .15rem;
}
.nav-smart-all:hover { opacity: 1; }

/* ── Buscar como favorito en la barra desktop ───────────────────── */
.nav-fav-btn {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: inherit;
}

/* ── Botón lupa en la barra superior ───────────────────────────── */
.nav-search-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
  padding: .35rem .4rem; border-radius: 7px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.nav-search-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

/* ── Formulario solicitud — checkboxes y radios estilo LexIAs ── */
.form-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-top: .4rem;
}

.form-option {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .85rem;
  border: 1.5px solid rgba(27, 43, 74, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .9rem;
  color: #1B2B4A;
  background: #fff;
  user-select: none;
}

.form-option:hover {
  border-color: rgba(201, 168, 76, 0.5);
  background: rgba(201, 168, 76, 0.04);
}

.form-option input[type="checkbox"],
.form-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(27, 43, 74, 0.3);
  border-radius: 4px;
  flex-shrink: 0;
  transition: border-color .15s, background .15s;
  position: relative;
}

.form-option input[type="radio"] {
  border-radius: 50%;
}

.form-option input[type="checkbox"]:checked,
.form-option input[type="radio"]:checked {
  background: #C9A84C;
  border-color: #C9A84C;
}

.form-option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.form-option input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.form-option:has(input:checked) {
  border-color: #C9A84C;
  background: rgba(201, 168, 76, 0.07);
  font-weight: 500;
}

/* ── Support Chat Flotante ─────────────────────────────────────── */
.support-chat-fab {
  position: fixed;
  bottom: 5rem;
  right: 1.25rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1B2B4A;
  color: #C9A84C;
  border: 2px solid #C9A84C;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: transform .15s, box-shadow .15s;
}
.support-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.support-chat-panel {
  position: fixed;
  bottom: 8.5rem;
  right: 1.25rem;
  width: 320px;
  max-height: 460px;
  background: #1B2B4A;
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  z-index: 10002 !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  overflow: hidden;
}
.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.15);
}
.support-chat-title {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  font-weight: 700;
  font-size: 1rem;
}
.support-title-lex { color: #fff; }
.support-title-ia  { color: #C9A84C; }
.support-chat-subtitle {
  font-size: .72rem;
  color: rgba(255,255,255,0.5);
  font-weight: 400;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.support-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.support-chat-close:hover { color: #fff; }
.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.support-msg {
  padding: .5rem .75rem;
  border-radius: 10px;
  font-size: .85rem;
  line-height: 1.5;
  max-width: 90%;
}
.support-msg--bot {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.support-msg--user {
  background: #C9A84C;
  color: #0a0f1e;
  align-self: flex-end;
  font-weight: 500;
  border-bottom-right-radius: 3px;
}
.support-msg--loading {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  align-self: flex-start;
  font-style: italic;
  font-size: .8rem;
}
.support-chat-input-row {
  display: flex;
  gap: .4rem;
  padding: .6rem .75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.1);
}
.support-chat-input-row input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  padding: .4rem .7rem;
  font-size: .85rem;
}
.support-chat-input-row input::placeholder { color: rgba(255,255,255,0.35); }
.support-send-btn {
  background: #C9A84C;
  border: none;
  border-radius: 8px;
  color: #0a0f1e;
  padding: .4rem .6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.support-send-btn:hover { background: #e6c76a; }

@media (max-width: 600px) {
  .support-chat-panel {
    right: .5rem;
    left: .5rem;
    width: auto;
    bottom: 6rem;
  }
  .support-chat-fab {
    bottom: 5rem;
    right: .75rem;
  }
}

/* ── Info icon tooltip ──────────────────────────────────────────── */
.ud-info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
}
.ud-info-tip svg { display: inline; vertical-align: middle; }
.ud-info-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: .76rem;
  font-weight: 400;
  line-height: 1.45;
  padding: .45rem .65rem;
  border-radius: 7px;
  white-space: normal;
  width: 230px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 99;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.ud-info-tip:hover::after,
.ud-info-tip.active::after { opacity: 1; }

/* M-05 Sprint 4 tanda 4 — fade en hover para botón confirm de modal clear-test (sustituye onmouseenter/onmouseleave inline). */
.btn-hover-fade:hover:not(:disabled) { opacity: .85; }

/* ── M-05 Sprint 4 tanda 6 / F4b ── onboarding wizard ───────────────────
   Estas clases sustituyen los últimos handlers inline del wizard
   (6× onclick obSetTimeout con expresiones Jinja en style=, 4×
   onfocus/onblur, 4× onmouseenter/onmouseleave).  El estado activo de
   los botones de timeout se aplica vía clase `ob-to-btn--active` (Jinja
   al renderizar + classList desde JS al cambiar). */
.ob-to-btn {
  padding: .75rem .25rem;
  border: 2px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: #334155;
  transition: all .15s;
}
.ob-to-btn--active {
  border-color: #C9A84C;
  background: #fffbeb;
}
/* Reemplaza onfocus/onblur en inputs del wizard. El border-color base
   queda definido en el style= inline; sólo se sobrescribe al :focus. */
.ob-input-focus-gold:focus { border-color: #C9A84C; }
.ob-input-focus-blue:focus { border-color: #0078d4; }
/* Reemplaza onmouseenter/onmouseleave en botones outline del wizard. */
.ob-hover-gold:hover { background: rgba(201,168,76,0.1); }
.ob-hover-blue:hover { background: #eff6ff; }
/* Reemplaza onmouseover/onmouseout del CTA gold "Me interesa" del
   email-info.  El background base se define aquí (no en style= inline)
   para que la regla :hover gane en especificidad. */
.btn-cta-gold {
  background: linear-gradient(105deg, #C9A84C 0%, #C9A84C 38%, #f0d882 50%, #C9A84C 62%, #C9A84C 100%);
  background-size: 250% auto;
  animation: demo-cta-shimmer 3.2s linear infinite, demo-cta-glow 2.6s ease-in-out infinite;
  transition: filter .15s, transform .1s;
}
.btn-cta-gold:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
  animation-play-state: paused;
}
/* M-05 G2.A — utilities reutilizables tras retirar handlers inline. */
/* Hover de opacidad para CTAs gold (login.html, reset_password.html). */
.btn-opacity-hover:hover { opacity: .87; }
/* Hover de color azul navy para enlaces grises secundarios (login.html). */
.link-hover-navy:hover { color: #1B2B4A; }
/* Focus border gold para inputs de reset_password.html. */
.rp-input-focus-gold:focus { border-color: #C9A84C; }
/* M-05 G2.B — hover de los enlaces del índice de guia.html. */
.guia-nav-link:hover { border-color: #C9A84C !important; }
/* M-05 G3 — hover Outlook connect btn (configuracion.html). */
.cfg-outlook-connect-btn:hover { background: #005fa3 !important; }

/* ── Task #41 — Chip de último dictamen de conflicto en cabecera de expediente ── */
.caso-conflict-row {
  margin-top: .5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.caso-conflict-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
}
.caso-conflict-chip .caso-conflict-chip-date,
.caso-conflict-chip .caso-conflict-chip-stale {
  font-weight: 500;
  opacity: .85;
}
.caso-conflict-chip--verde {
  background: rgba(22,163,74,.08);
  border-color: rgba(22,163,74,.35);
  color: #15803d;
}
.caso-conflict-chip--amarillo {
  background: rgba(217,119,6,.08);
  border-color: rgba(217,119,6,.35);
  color: #b45309;
}
.caso-conflict-chip--rojo {
  background: rgba(220,38,38,.08);
  border-color: rgba(220,38,38,.35);
  color: #b91c1c;
}
.caso-conflict-chip--empty {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text-muted);
}
.caso-conflict-chip--stale {
  outline: 1px dashed currentColor;
  outline-offset: 1px;
}
.caso-conflict-chip--stale .caso-conflict-chip-stale {
  font-style: italic;
  opacity: 1;
}

/* ── Collapsible "Ver mensaje original" ─────────────────────────── */
details.message-section-collapsible {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
details.message-section-collapsible > summary.message-section-toggle {
  cursor: pointer;
  list-style: none;
  padding: .85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}
details.message-section-collapsible > summary.message-section-toggle::-webkit-details-marker { display: none; }
.msg-toggle-arrow {
  font-size: .65rem;
  transition: transform .2s;
  color: var(--muted);
  display: inline-block;
}
details.message-section-collapsible[open] .msg-toggle-arrow {
  transform: rotate(90deg);
}
details.message-section-collapsible > summary.message-section-toggle:hover {
  color: var(--gold);
}
details.message-section-collapsible > summary.message-section-toggle:hover .msg-toggle-arrow {
  color: var(--gold);
}
.message-section-inner {
  padding: 0 1.1rem 1rem;
}
