/* ════════════════════════════════════════════════════════════════
   Connect Access Hub — Design System v2
   Single-layer stylesheet. No override generations.

   Register: product (enterprise internal tool).
   Identity: Connect orange #F15B2B (accent, ≤10% surface),
             navy #001D3D (support neutral, official manual value),
             dark theme primary. Display font: official Connect (brand
             moments only); UI font: Prompt (body/labels/data).
   Contracts preserved for app.js:
     - all class names, element ids, data-* attributes
     - .progress-bar span width driven by var(--progress) set via JS
     - .provisioning-item grid areas (icon / name / meta)
   CSP-safe: no inline styles required.
   ════════════════════════════════════════════════════════════════ */

/* ── 0. Brand font ─────────────────────────────────────────────────
   Official Connect corporate variable font, self-hosted (CSP 'self').
   Weight axis 'wght' (named "Peso") spans 0–1000; default 0 = Fina.
   Reserved for brand moments and display headings only — never labels,
   buttons, inputs or data (product register bans display fonts there).
   Body/UI runs on Prompt: the manual's own sanctioned web font and far
   more legible at 12–14px. */
@font-face {
  font-family: "Connect";
  src: url("./fonts/ConnectVF.woff2") format("woff2-variations");
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
}

/* ── 1. Design Tokens ──────────────────────────────────────────── */
:root {
  /* Type families */
  --font-ui: "Prompt", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Connect", "Prompt", system-ui, sans-serif;

  /* ── Brand tonal ramps ───────────────────────────────────────────
     Exact values shared with the Connect Notifications app (its @theme),
     so both products draw from one palette. Semantic tokens below map
     onto these; components keep using the semantic tokens, never the raw
     ramp, so a future ramp tweak propagates everywhere. */
  --ink-50: #F2F5F8;  --ink-100: #D9E1EA; --ink-200: #B0C0D1; --ink-300: #7E94AE;
  --ink-400: #4E6885; --ink-500: #2D4A6B; --ink-600: #1A3455; --ink-700: #0E2846;
  --ink-800: #072340; --ink-900: #001D3D; --ink-950: #011530;

  --accent-50: #FFF3EE;  --accent-100: #FFE0D3; --accent-200: #FFC1A7; --accent-300: #FF9B74;
  --accent-400: #F87A49; --accent-500: #F15B2B; --accent-600: #D4451A; --accent-700: #AE3613;
  --accent-800: #852A10; --accent-900: #62200E;

  --surface-c-0: #FFFFFF;  --surface-c-50: #F8FAFC; --surface-c-100: #F1F4F8; --surface-c-200: #E5EAF1;
  --surface-c-300: #D1D9E4; --surface-c-400: #9AA7B8; --surface-c-500: #6B7888; --surface-c-600: #4A5665;
  --surface-c-700: #343E4C; --surface-c-800: #1F2833; --surface-c-900: #0F1620;

  --blue-50: #EEF4FB;  --blue-100: #D6E4F6; --blue-400: #5E8BD0; --blue-500: #3E6FC0; --blue-600: #2F59A3; --blue-700: #264983;
  --success-50: #ECFDF5; --success-100: #D1FAE5; --success-200: #A7F3D0; --success-300: #6EE7B7; --success-500: #10B981; --success-600: #059669; --success-700: #047857;
  --warning-50: #FFFBEB; --warning-100: #FEF3C7; --warning-200: #FDE68A; --warning-300: #FCD34D; --warning-500: #F59E0B; --warning-600: #D97706; --warning-700: #B45309;
  --danger-50: #FEF2F2;  --danger-100: #FEE2E2; --danger-200: #FECACA; --danger-300: #FCA5A5; --danger-500: #EF4444; --danger-600: #DC2626; --danger-700: #B91C1C;

  /* Brand — mapped onto the shared ramps (naranja = accent-500 #F15B2B,
     azul = ink-900 #001D3D). */
  --brand-orange: var(--accent-500);
  --brand-orange-600: var(--accent-600);
  --brand-orange-700: var(--accent-700);
  --brand-navy: var(--ink-900);
  --brand-navy-700: var(--ink-700);
  --brand-navy-600: var(--ink-600);
  --brand-orange-text: var(--accent-700);   /* #AE3613 — AA on white */

  /* Accent roles (theme-aware) */
  --accent: var(--brand-orange);
  --accent-text: var(--brand-orange-text);
  --accent-soft: rgba(241, 91, 43, .09);
  --accent-soft-strong: rgba(241, 91, 43, .16);
  --accent-border: rgba(241, 91, 43, .34);

  /* Surfaces — mapped onto the shared Surface ramp */
  --bg: var(--surface-c-50);
  --surface: var(--surface-c-0);
  --surface-2: var(--surface-c-50);
  --surface-3: var(--surface-c-100);
  --panel: var(--surface);
  --panel-2: var(--surface-2);

  /* Text — Surface ramp dark end (surface-500 is the AA floor for small text) */
  --text: var(--surface-c-900);
  --text-2: var(--surface-c-600);
  --text-3: var(--surface-c-500);
  --muted: var(--text-3);
  --text-muted-accessible: var(--text-3);

  /* Lines */
  --line: var(--surface-c-200);
  --line-strong: var(--surface-c-300);
  --pill: var(--surface-c-100);

  /* Status — text from AA-safe ramp steps; tints keyed to each ramp's 500 */
  --ok-text: var(--success-700);
  --ok-bg: rgba(16, 185, 129, .12);
  --ok-border: rgba(16, 185, 129, .32);
  --danger-text: var(--danger-600);
  --danger-bg: rgba(239, 68, 68, .10);
  --danger-border: rgba(239, 68, 68, .32);
  --warn-text: var(--warning-700);
  --warn-bg: rgba(245, 158, 11, .12);
  --warn-border: rgba(245, 158, 11, .30);
  --info-text: var(--blue-700);
  --info-bg: rgba(62, 111, 192, .11);
  --info-border: rgba(62, 111, 192, .30);
  --success-bg: var(--ok-bg);
  --success-text: var(--ok-text);

  /* Elevation */
  --elev-1: 0 1px 2px rgba(2, 32, 61, .06);
  --elev-2: 0 2px 8px rgba(2, 32, 61, .07), 0 1px 2px rgba(2, 32, 61, .05);
  --elev-3: 0 16px 40px rgba(2, 32, 61, .13), 0 4px 10px rgba(2, 32, 61, .06);

  /* Focus */
  --ring-accent: 0 0 0 3px rgba(241, 91, 43, .32);
  --ring-input: 0 0 0 3px rgba(2, 32, 61, .16);
  --input-focus-border: var(--brand-navy);
  --focus-ring: var(--ring-accent);

  /* Header */
  --header-bg: rgba(255, 255, 255, .86);
  --header-border: rgba(2, 32, 61, .10);

  /* Sidebar active nav item — filled navy (Ink 900). */
  --nav-active-bg: #001D3D;

  /* Backgrounds */
  --theme-bg: #F3F5F9;
  --auth-bg:
    radial-gradient(circle, rgba(2, 32, 61, .05) 1px, transparent 1.4px) 0 0/24px 24px,
    radial-gradient(880px 420px at 82% -10%, rgba(241, 91, 43, .10), transparent 60%),
    radial-gradient(720px 420px at 8% 110%, rgba(2, 32, 61, .09), transparent 55%),
    #F3F5F9;
  --auth-orb-1: rgba(241, 91, 43, .20);
  --auth-orb-2: rgba(2, 32, 61, .14);

  /* Toast */
  --toast-bg: #FFFFFF;
  --toast-close-bg: rgba(15, 23, 42, .05);
  --toast-close-color: var(--text);

  /* Legacy aliases still referenced */
  --glass-bg: rgba(255, 255, 255, .7);
  --glass-bg-strong: rgba(255, 255, 255, .88);
  --glass-border: var(--line);
  --glass-border-strong: var(--line-strong);
  --soft-hover: rgba(2, 32, 61, .045);
  --soft-accent: var(--accent-soft);
  --soft-accent-strong: var(--accent-soft-strong);
  --hero-logo-filter: none;
  --shadow: var(--elev-1);
  --panel-glow: var(--elev-2);

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-full: 999px;
  /* Connect signature chamfer — echoes the wordmark's diagonal letter cuts.
     Used on tags/chips and key accents as the app's ownable geometric detail. */
  --notch: 5px;

  /* Type scale (fixed rem, product register) */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-2xl: 22px;

  /* Z-scale */
  --z-noise: 90;         /* grain overlay: above content, below all interactives */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-sync: 210;
  --z-backdrop: 1000;
  --z-modal: 1010;
  --z-toast: 1100;
  --z-skip: 1200;

  /* Ambient canvas — faint radial washes (accent + ink) over the base, for
     depth without breaking the light tone. Mirrors the Connect Notifications
     app's cn-app-bg so the two products read as one family. */
  --app-bg-image:
    radial-gradient(70% 65% at 100% 0%, rgba(241, 91, 43, .22), transparent 65%),
    radial-gradient(65% 56% at 0% 100%, rgba(0, 29, 61, .18), transparent 62%);
}

:root.dark {
  --accent-text: #FF7A47;         /* AA on dark surfaces */
  --accent-soft: rgba(241, 91, 43, .12);
  --accent-soft-strong: rgba(241, 91, 43, .20);
  --accent-border: rgba(241, 91, 43, .42);

  --bg: #0A0F1A;
  --surface: #111927;
  --surface-2: #17202F;
  --surface-3: #1D2839;

  --text: #E9EEF5;
  --text-2: #B9C4D4;
  --text-3: #97A5B9;

  --line: rgba(148, 163, 184, .16);
  --line-strong: rgba(148, 163, 184, .30);
  --pill: #1B2536;

  --ok-text: #4ADE99;
  --ok-bg: rgba(16, 185, 129, .13);
  --ok-border: rgba(16, 185, 129, .36);
  --danger-text: #F98080;
  --danger-bg: rgba(239, 68, 68, .12);
  --danger-border: rgba(239, 68, 68, .38);
  --warn-text: #FBBF24;
  --warn-bg: rgba(217, 119, 6, .14);
  --warn-border: rgba(217, 119, 6, .36);
  --info-text: #7AB8FF;
  --info-bg: rgba(59, 130, 246, .13);
  --info-border: rgba(59, 130, 246, .36);

  --elev-1: 0 1px 2px rgba(0, 0, 0, .35);
  --elev-2: 0 4px 14px rgba(0, 0, 0, .38), 0 1px 3px rgba(0, 0, 0, .28);
  --elev-3: 0 20px 50px rgba(0, 0, 0, .5), 0 6px 14px rgba(0, 0, 0, .3);

  --ring-accent: 0 0 0 3px rgba(241, 91, 43, .42);
  --ring-input: 0 0 0 3px rgba(111, 160, 212, .28);
  --input-focus-border: #6FA0D4;

  --header-bg: rgba(13, 20, 33, .82);
  --header-border: rgba(148, 163, 184, .16);

  /* Lighter navy so the active pill reads as selected on the dark sidebar. */
  --nav-active-bg: #24405F;

  --theme-bg: #0A0F1A;
  --auth-bg:
    radial-gradient(circle, rgba(255, 255, 255, .045) 1px, transparent 1.4px) 0 0/24px 24px,
    radial-gradient(880px 420px at 82% -10%, rgba(241, 91, 43, .11), transparent 60%),
    radial-gradient(720px 420px at 8% 110%, rgba(20, 64, 110, .24), transparent 55%),
    #0A0F1A;
  --auth-orb-1: rgba(241, 91, 43, .22);
  --auth-orb-2: rgba(20, 64, 110, .30);
  --app-bg-image:
    radial-gradient(70% 65% at 100% 0%, rgba(241, 91, 43, .24), transparent 65%),
    radial-gradient(65% 56% at 0% 100%, rgba(20, 64, 110, .38), transparent 62%);

  --toast-bg: #141D2C;
  --toast-close-bg: rgba(255, 255, 255, .05);
  --toast-close-color: #FFFFFF;

  --glass-bg: rgba(255, 255, 255, .03);
  --glass-bg-strong: rgba(255, 255, 255, .05);
  --soft-hover: rgba(255, 255, 255, .05);
  --brand-orange-text: #FF7A47;
  --shadow: var(--elev-1);
}

/* ── 2. Reset & Base ───────────────────────────────────────────── */
* { box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background-color: var(--theme-bg);
  background-image: var(--app-bg-image);
  background-attachment: fixed;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* Grain overlay — a fixed, ~2.5% fractal-noise wash that breaks the digital
   flatness of large flat fills. pointer-events:none (never blocks clicks); sits
   above content but below every interactive layer so dropdowns/modals/toasts
   stay crisp. Adopted from the Connect Notifications app for family coherence. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-noise);
  pointer-events: none;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ── 3. Accessibility ──────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-3);
  transform: translateY(-180%);
  background: var(--brand-navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-md);
  z-index: var(--z-skip);
  text-decoration: none;
  font-weight: 600;
  transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring-accent);
}

/* ── 4. Layout Shells ──────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
}
.app-main { min-width: 0; padding: 22px clamp(20px, 3vw, 40px) 56px; }
/* Cap the working width so cards don't sprawl on ultra-wide screens; left-aligned
   so the content anchors to the sidebar. The sidebar itself stays flush to the
   viewport's left edge. */
.app-content { max-width: 1440px; }

/* Panel greeting header (date eyebrow + welcome + description), aligned with the
   Connect Notifications dashboard header. */
.page-greeting { margin-bottom: 18px; }
.greeting-eyebrow { display: inline-flex; align-items: center; gap: 7px; font: 600 11px/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.greeting-eyebrow .ui-icon { width: 14px; height: 14px; }
.greeting-eyebrow .ui-icon svg { width: 14px; height: 14px; }
.greeting-title { margin: 10px 0 5px; font: 800 26px/1.05 var(--font-display); letter-spacing: -.01em; color: var(--text); text-wrap: balance; }
.greeting-desc { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); max-width: 68ch; }
.layout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}
.single-column-layout,
.completed-layout {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 20px;
}
.single-column-layout > .card,
.completed-layout > .card,
.card.card-result { width: 100%; max-width: none; min-width: 0; }

/* ── 5. Icon Button (theme toggle) ─────────────────────────────── */
.icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }

/* Small variant: inline next to a label/title instead of the top-bar. */
.icon-btn-sm { width: 28px; height: 28px; min-height: 28px; }
.icon-btn-sm .ui-icon svg { width: 15px; height: 15px; }
.icon-btn.is-danger { color: var(--danger-text); border-color: var(--danger-border); }
.icon-btn.is-danger:hover { background: var(--danger-bg); color: var(--danger-text); }

/* ── 6. UI Icons ───────────────────────────────────────────────── */
.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}
.ui-icon svg { width: 16px; height: 16px; }

/* ── 7. App shell: left sidebar navigation ───────────────────────── */
.sidenav {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--accent-border);
  z-index: var(--z-sticky);
}
.sidenav-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 15px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
/* Wordmark PNGs are trimmed to the same glyph bbox — size by HEIGHT so light
   and dark render at the identical visual size. */
.sidenav-logo { height: 18px; width: auto; max-width: 150px; object-fit: contain; flex: 0 0 auto; }
.sidenav-prod { font-family: var(--font-display); font-size: 15px; font-weight: 800; letter-spacing: .002em; line-height: 1; color: var(--text); white-space: nowrap; }

/* Grouped nav (Operación / Administración), mirroring the Notifications app. */
.nav-group + .nav-group { margin-top: 22px; }
.nav-group-label { margin: 0 0 8px; padding: 0 11px; font: 600 10px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }

.sidenav-nav { display: flex; flex-direction: column; margin-top: 16px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }

.sidenav-foot { margin-top: 0; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.sidenav-foot-actions { display: flex; align-items: center; gap: 7px; }
/* Orden: sidebar · tema · logout (pegado a la derecha). Tema al mismo tamaño (sm). */
.sidenav-foot-actions #theme-toggle { width: 28px; height: 28px; min-height: 28px; }
.sidenav-foot-actions #theme-toggle .ui-icon svg { width: 15px; height: 15px; }
.sidenav-foot-actions #logout-btn { margin-left: auto; }

/* ── Sidebar contraído (solo íconos) ──────────────────────────────
   Toggle en la cabecera del sidenav; el estado persiste entre recargas.
   En modo contraído se ocultan textos y se centran los íconos; los tooltips
   nativos (title=) muestran la etiqueta al pasar el mouse. */
/* Toggle contraer/expandir: mismo botón que tema/salir en el pie. Anima el
   ancho al abrir/cerrar; el tamaño de los íconos del nav NO cambia. */
.app-shell { transition: grid-template-columns .2s var(--ease-out-quart, ease); }
.app-shell.sidebar-collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.app-shell.sidebar-collapsed .sidenav { padding-inline: 10px; }
.app-shell.sidebar-collapsed .sidenav-brand { display: none; }
/* Sin el brand, los íconos suben; se bajan un poco para alinearlos con la
   cabecera del contenido. */
.app-shell.sidebar-collapsed .sidenav-nav { margin-top: 26px; }
.app-shell.sidebar-collapsed .nav-group-label { display: none; }
.app-shell.sidebar-collapsed .nav-group + .nav-group { margin-top: 14px; }
.app-shell.sidebar-collapsed .tab-btn { position: relative; justify-content: center; padding: 9px; gap: 0; }
.app-shell.sidebar-collapsed .tab-label { display: none; }
.app-shell.sidebar-collapsed .tab-badge { position: absolute; top: 2px; right: 6px; }
.app-shell.sidebar-collapsed .sidenav-game { display: none; }
/* Sin el juego (que empujaba hacia abajo), el pie sube: lo mando al fondo. */
.app-shell.sidebar-collapsed .sidenav-foot { margin-top: auto; }
.app-shell.sidebar-collapsed .user-chip--side { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .user-chip-text { display: none; }
.app-shell.sidebar-collapsed .sidenav-foot { align-items: center; }
.app-shell.sidebar-collapsed .sidenav-foot-actions { flex-direction: column; gap: 8px; }
/* Contraído: el sidebar va AL FONDO de la columna — igual que en horizontal está
   al final de la fila inferior — así el botón queda en el mismo punto (abajo) y
   no cambia de lugar al abrir/cerrar. */
.app-shell.sidebar-collapsed .sidenav-foot-actions #theme-toggle { order: 1; }
.app-shell.sidebar-collapsed .sidenav-foot-actions #logout-btn { order: 2; margin-left: 0; }
.app-shell.sidebar-collapsed .sidenav-foot-actions #toggle-sidebar { order: 3; }

/* Login shares these (auth screen keeps the wordmark + brand copy). */
.auth-logo { display: block; object-fit: contain; background: transparent; }
.brand-copy { display: block; min-width: 0; }
.brand-copy h1 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 800; letter-spacing: .002em; line-height: 1.1; color: var(--text); }

/* User chip (sidebar footer) */
.user-chip { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); }
.user-chip--side { gap: 10px; padding: 0 4px; }
.user-avatar {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-navy); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  display: grid; place-items: center; line-height: 1;
}
.user-chip-text { min-width: 0; }
.user-chip-name { font-size: var(--fs-base); font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-meta { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.3; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Primary nav — vertical items in the sidebar. Active = subtle accent tint +
   accent text + hairline accent border (segmented treatment, never a
   side-stripe). */
.tab-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: var(--fs-md);
  background: transparent;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab-btn:hover { background: var(--soft-hover); color: var(--text); }
/* Active = filled navy (Ink) pill with white label + orange icon — matches the
   Connect Notifications sidebar. */
.tab-btn.active {
  background: var(--nav-active-bg);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: var(--elev-1);
}
.tab-btn .tab-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-3); transition: color .15s ease; }
.tab-btn:hover .tab-icon { color: var(--text-2); }
.tab-btn.active .tab-icon { color: var(--accent-400, #F87A49); }
.tab-btn .tab-icon svg { width: 18px; height: 18px; }
.tab-btn .tab-label { display: inline-block; }
.tab-btn .tab-badge { margin-left: auto; }

/* Count / label badges — chamfered chip (Connect signature), tabular figures. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 0;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, 0 100%);
  background: var(--pill);
  color: var(--text-2);
}

/* ── 8. Cards ──────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--elev-1);
}
.card::before { display: none; }
.card h2, .card h3, .card h4 { margin: 0; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.card-subtitle { margin-top: 4px; font-size: var(--fs-base); color: var(--text-3); line-height: 1.5; max-width: 64ch; }

/* ── 9. Form Elements ──────────────────────────────────────────── */
.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: none;
  color: var(--text-2);
  margin-bottom: 6px;
}
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Inline per-field validity check (replaces the "Antes de crear el caso" card) */
.label-with-check, .title-with-hint { display: inline-flex; align-items: center; gap: 6px; }
.field-check {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: var(--r-full);
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}
.field-check[hidden] { display: none; }
/* Inline field hint — replaces the description line that used to sit under
   every input and card title. Click the ⓘ to reveal the text in a bubble; it
   stays until dismissed (works on touch, unlike a hover tooltip). */
.field-hint-wrap { position: relative; display: inline-flex; }
.field-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-3);
  transition: color .15s ease, background .15s ease;
}
.field-hint svg { width: 14px; height: 14px; }
.field-hint:hover { color: var(--text); background: var(--soft-hover); }
.field-hint[aria-expanded="true"] { color: var(--accent-text); background: var(--accent-soft); }
.field-hint:focus-visible { outline: none; box-shadow: var(--ring-accent); }
.field-hint-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  /* --hint-shift is set by the click handler to clamp the bubble inside the
     viewport when the icon sits near an edge (common on mobile). */
  transform: translateX(calc(-50% + var(--hint-shift, 0px)));
  z-index: var(--z-dropdown);
  width: max-content;
  max-width: min(280px, calc(100vw - 24px));
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--elev-3);
  color: var(--text-2);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.45;
  white-space: normal;
  text-align: left;
  animation: fade-in .12s ease both;
}
.field-hint-bubble[hidden] { display: none; }
.input, .select, .textarea, textarea.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
:root.dark .input, :root.dark .select, :root.dark .textarea, :root.dark textarea.input { background: var(--surface-2); }
.input::placeholder, .textarea::placeholder, textarea.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover, textarea.input:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus, textarea.input:focus {
  border-color: var(--input-focus-border);
  box-shadow: var(--ring-input);
}
textarea.input { resize: vertical; min-height: 76px; line-height: 1.5; }
.input-group { display: grid; gap: 14px; }
.field-group { display: grid; gap: 6px; min-width: 0; align-content: start; }

/* Password field */
.password-field-wrap { position: relative; display: flex; align-items: center; }
.password-input { padding-right: 44px; }
/* Ícono guía dentro del campo (login): usuario / llave. Absoluto a la izquierda;
   el input deja espacio con padding-left. */
.auth-input-wrap { position: relative; }
.auth-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auth-input-icon svg { width: 18px; height: 18px; }
.auth-input-wrap .input,
.password-field-wrap.has-leading-icon .input { padding-left: 42px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 48px;
  height: 28px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.password-toggle:hover { border-color: var(--accent-border); color: var(--accent-text); }
/* Toggle como ícono de ojo (sin caja): abre/cierra la visibilidad. */
.password-toggle.icon-toggle {
  min-width: 0;
  width: 34px;
  height: 34px;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  padding: 0;
}
.password-toggle.icon-toggle:hover { color: var(--accent-text); border-color: transparent; background: transparent; }
.password-toggle.icon-toggle .ui-icon svg { width: 19px; height: 19px; }
.password-hint { font-size: var(--fs-sm); color: var(--text-3); }

/* Sin label: solo el placeholder + el ícono guía, que se tiñe de acento cuando
   el campo está enfocado (feedback sutil sin texto extra). */
.auth-input-icon { transition: color .16s ease; }
.auth-input-wrap:focus-within .auth-input-icon,
.password-field-wrap:focus-within .auth-input-icon { color: var(--accent-text); }

/* Email input */
.input-email {
  letter-spacing: 0;
  font-variant-ligatures: none;
  font-feature-settings: 'liga' 0, 'calt' 0;
  text-transform: none;
  word-spacing: normal;
  font-kerning: none;
}

/* Invalid state */
.is-invalid,
#modal-input[aria-invalid="true"],
.input.is-invalid {
  border-color: var(--danger-text);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .14);
}

/* Date field */
.date-field-wrap { position: relative; width: 100%; }
.date-input { padding-right: 48px; appearance: none; -webkit-appearance: none; }
.date-input::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; right: 10px; width: 28px; height: 28px; cursor: pointer; }
.date-input::-webkit-inner-spin-button, .date-input::-webkit-clear-button { display: none; }
.date-trigger {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 28px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.date-trigger:hover { border-color: var(--accent-border); color: var(--accent-text); }

/* File input */
.file-input { display: none; }

/* Switches / checkboxes */
.switch { accent-color: var(--brand-orange); width: 15px; height: 15px; }
.inline.inline-checkbox { display: inline-flex; align-items: center; gap: 8px; }

/* ── 10. Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--fs-base);
  letter-spacing: .01em;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:disabled, button[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* Solid brand buttons carry a barely-there vertical gradient + a hairline top
   highlight + a colour-tinted shadow. Reads as a crafted, lit surface rather
   than a flat fill — premium without gloss. */
.btn.primary {
  background: linear-gradient(180deg, #F4703F, var(--brand-orange) 62%);
  color: #fff;
  border-color: var(--brand-orange-600);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 6px rgba(241, 91, 43, .26);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, var(--brand-orange), var(--brand-orange-600) 70%); border-color: var(--brand-orange-700); }
.btn.primary:active:not(:disabled) { background: var(--brand-orange-700); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .22); }
.btn.primary:focus-visible { box-shadow: var(--ring-accent); }

.btn.secondary {
  background: linear-gradient(180deg, #123457, var(--brand-navy) 68%);
  color: #fff;
  border-color: #001526;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 2px 6px rgba(0, 29, 61, .28);
}
.btn.secondary:hover:not(:disabled) { background: var(--brand-navy-700); border-color: var(--brand-navy-700); }
:root.dark .btn.secondary { background: var(--brand-navy-700); border-color: var(--brand-navy-700); }
:root.dark .btn.secondary:hover:not(:disabled) { background: var(--brand-navy-600); border-color: var(--brand-navy-600); }

.btn.ghost { background: transparent; color: var(--text-2); border-color: var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--soft-hover); color: var(--text); border-color: var(--line-strong); }

.btn.danger { background: transparent; color: var(--danger-text); border-color: var(--danger-border); }
.btn.danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn.danger-solid { background: #DC2626; color: #fff; border-color: #DC2626; }
.btn.danger-solid:hover:not(:disabled) { background: #B91C1C; border-color: #B91C1C; }

.btn-sm { min-height: 30px; padding: 5px 12px; font-size: var(--fs-sm); border-radius: var(--r-xs); }
.full { width: 100%; }

.linkish {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  padding: 5px 12px;
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: var(--r-xs);
  min-height: 30px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.linkish .ui-icon svg { width: 14px; height: 14px; }
.linkish:hover { border-color: var(--line-strong); background: var(--soft-hover); color: var(--text); }
.linkish.linkish-danger { color: var(--danger-text); border-color: var(--danger-border); }
.linkish.linkish-danger:hover { background: var(--danger-bg); color: var(--danger-text); }

/* ── 11. Country / Select ──────────────────────────────────────── */
.country-dropdown-wrap { margin-bottom: 14px; }
.select-icon-wrap { position: relative; display: flex; align-items: center; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.country-select { font-weight: 500; }
.select-chevron { position: absolute; right: 12px; pointer-events: none; color: var(--text-3); font-size: var(--fs-sm); }

/* Country chips (admin) */
.country-strip { display: flex; gap: 8px; flex-wrap: wrap; overflow: visible; margin: 4px 0 2px; }
.country-chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--r-full);
  padding: 6px 14px;
  min-height: 32px;
  font-size: var(--fs-base);
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.country-chip:hover { border-color: var(--line-strong); background: var(--soft-hover); color: var(--text); }
.country-chip.active { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
:root.dark .country-chip.active { background: var(--brand-navy-700); border-color: var(--brand-navy-700); }

/* ── 12. Search Input ──────────────────────────────────────────── */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-base);
  pointer-events: none;
  color: var(--text-3);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}
.search-input, .input.search-input, input.search-input { padding-left: 36px; }
.search-wrap-stack { margin-bottom: 0; }
.compact-search-row { margin-top: 2px; }

/* ── 13. Autocomplete ──────────────────────────────────────────── */
.autocomplete-list {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  padding: 5px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--elev-2);
  position: relative;
  z-index: var(--z-dropdown);
}
.autocomplete-item {
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--r-xs);
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 400;
  font-size: var(--fs-base);
  min-height: 34px;
  transition: background .12s ease;
}
.autocomplete-item:hover { background: var(--accent-soft); color: var(--accent-text); }

/* Role combobox (unified search + dropdown) */
.role-combo { position: relative; }
.combo-input { padding-right: 34px; }
.combo-chevron {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-3);
  font-size: var(--fs-sm);
  transition: transform .18s var(--ease-out-quart, ease);
}
.role-combo.is-open .combo-chevron { transform: translateY(-50%) rotate(180deg); }
/* Overlay the dropdown (absolute) so opening it never reflows the controls
   row or drags the mode toggle down. */
.combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin-top: 0;
  max-height: 320px;
  overflow-y: auto;
}
.combo-list .autocomplete-item.is-selected-role {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.combo-list .autocomplete-item.is-selected-role::after { content: ' ✓'; }
.autocomplete-empty { padding: 10px 12px; }

/* ── 14. Role Buttons ──────────────────────────────────────────── */
.role-list { display: grid; gap: 6px; max-height: 480px; overflow: auto; padding-right: 4px; }
.role-btn {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: var(--fs-base);
  line-height: 1.3;
  min-height: 38px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.role-btn:hover:not(.active) { background: var(--soft-hover); border-color: var(--line-strong); color: var(--text); }
.role-btn.active { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; font-weight: 600; }
:root.dark .role-btn.active { background: var(--brand-navy-700); border-color: var(--brand-navy-700); }

/* ── 15. Mode Toggle (Consulta / Ejecución) ────────────────────── */
.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
/* Gestión controls row: mode toggle + cargo selector side by side, above the
   full-width result card. */
.consulta-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 16px 24px;
  margin-bottom: 16px;
}
.consulta-greeting { justify-self: start; min-width: 0; align-self: end; padding-left: 32px; }
.consulta-greeting-title { margin: 6px 0 0; font-size: 20px; line-height: 1.1; }
.mode-toggle--top { justify-self: center; }
.consulta-cargo { justify-self: end; width: min(100%, 460px); min-width: 240px; position: relative; }
@media (max-width: 900px) {
  .consulta-controls { grid-template-columns: 1fr; justify-items: start; }
  .mode-toggle--top { justify-self: start; }
  .consulta-cargo { justify-self: stretch; width: 100%; }
}
/* Toggle en modo íconos (Consulta = ojo, Ejecución = llave); el nombre sale en el
   tooltip al pasar el mouse. */
.mode-toggle--icons .mode-btn { min-width: 58px; padding: 7px 14px; display: inline-flex; align-items: center; justify-content: center; }
.mode-toggle--icons .mode-btn .ui-icon svg { width: 18px; height: 18px; }

/* Estado "esperando cargo": SOLO el texto "Selecciona un cargo / Elige…" queda
   encendido; el resto del card (contador "Aplicaciones" y el contenido de
   accesos) se apaga en gris. Saludo, toggle y Cargo (con glow) quedan a color. */
.awaiting-role .card-result > *:not(.result-header),
.awaiting-role .card-result .stats { filter: grayscale(1); opacity: .55; transition: filter .2s ease, opacity .2s ease; }
.combo-invite .combo-input {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 14px 0 rgba(241, 91, 43, .28);
  animation: combo-invite-pulse 2.2s ease-in-out infinite;
}
.combo-invite .search-icon,
.combo-invite .combo-chevron { color: var(--accent-text); }
@keyframes combo-invite-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 10px 0 rgba(241, 91, 43, .22); }
  50% { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 18px 0 rgba(241, 91, 43, .42); }
}
@media (prefers-reduced-motion: reduce) { .combo-invite .combo-input { animation: none; } }
/* Mini-juego "runner" en el pie del sidenav, justo sobre la línea del chip de
   usuario. Sin caja: canvas transparente que corre sobre su propia línea de
   piso, como el dino de Chrome. Se adapta al ancho del sidenav. */
.sidenav-game { margin-top: auto; padding: 8px 6px 10px; }
.dino-canvas {
  display: block;
  width: 100%;
  height: 64px;
  color: var(--text-3);
  background: transparent;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
.dino-canvas:focus-visible { outline: 2px solid var(--focus-ring, var(--brand-orange)); outline-offset: 2px; border-radius: var(--r-xs); }
@media (max-width: 860px) {
  /* En el sidenav horizontal de mobile no hay hueco vertical: se oculta. */
  .sidenav-game { display: none; }
}
/* Compact, self-width segmented control (not a full-width block). */
.mode-toggle--top {
  display: inline-flex;
  width: auto;
  margin-bottom: 0;
}
.mode-toggle--top .mode-btn { min-width: 132px; }
.mode-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-weight: 500;
  font-size: var(--fs-base);
  min-height: 34px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.mode-btn:hover { background: var(--soft-hover); color: var(--text); }
.mode-btn.active {
  background: var(--surface);
  color: var(--accent-text);
  border-color: var(--line);
  font-weight: 600;
  box-shadow: var(--elev-1);
}

/* ── 16. Result Header ─────────────────────────────────────────── */
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.result-title { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 600; line-height: 1.15; letter-spacing: 0; }
.result-meta { font-size: var(--fs-base); color: var(--text-3); margin-top: 3px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* Stats — compact inline strip */
.stats, .workflow-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 14px;
}
.stat-label { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.stat-value.stat-sm, .stat-sm { font-family: var(--font-ui); font-size: var(--fs-base); font-weight: 600; line-height: 1.35; letter-spacing: 0; }

/* Stats compactos dentro del encabezado (Pendientes): a la derecha del título,
   en lugar de una fila aparte debajo. */
.card-head--stats { flex-wrap: wrap; align-items: center; }
.workflow-stats--head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  justify-content: flex-end;
}
.workflow-stats--head .stat { padding: 6px 14px; min-width: 92px; gap: 1px; }
.workflow-stats--head .stat-value { font-size: 18px; line-height: 1.15; }
@media (max-width: 720px) {
  .workflow-stats--head { justify-content: flex-start; width: 100%; }
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pill);
  color: var(--text-2);
  border: 0;
  border-radius: 0;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, 0 100%);
  min-height: 22px;
  padding: 2px 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill.success { color: var(--ok-text); }
.warning-pill { color: var(--warn-text); }
.pill.pill-muted, .muted-pill { color: var(--text-3); }

/* ── 17. Access Tags (Consulta results) ────────────────────────── */
.access-list-card, .compact-tags-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  background: var(--surface);
  box-shadow: none;
}
.access-list-head, .compact-tags-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.compact-subtitle { margin-top: 3px; }

.access-tags-grid, .unified-tags-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.access-tag, .unified-tag {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition: border-color .15s ease, background .15s ease;
}
.access-tag-name {
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.3;
  word-break: break-word;
  text-align: left;
}
.unified-tag .access-tag-name { text-align: left; font-size: var(--fs-base); }

/* App links */
.has-app-link { position: relative; padding-right: 40px; }
.app-link, .app-url-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  text-decoration: none;
  font-size: var(--fs-sm);
  line-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-3);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.app-link:hover, .app-url-open:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.app-link:focus-visible { outline: none; box-shadow: var(--ring-accent); }
.app-link-inline { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); }
.app-link-corner { position: absolute; top: 8px; right: 8px; z-index: 3; }
.access-tag.has-app-link .access-tag-name { padding-right: 8px; }

/* Platform icon */
.platform-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
}
/* Access-row marker — the Connect angular square (same mark as the status
   chips), replacing a generic bullet. Colour inherits per context. */
.platform-icon.subtle {
  background: transparent;
  border: none;
  color: var(--text-3);
  width: auto;
  height: auto;
  font-size: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.platform-icon.subtle::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 100% 65%, 65% 100%, 0 100%);
  opacity: .85;
}
.platform-meta { font-size: var(--fs-sm); color: var(--text-3); -webkit-text-fill-color: var(--text-3); line-height: 1.45; }

/* ── 18. Provisioning / Execution ──────────────────────────────── */
.execution-shell { display: grid; gap: 16px; }
.provisioning-box {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.progress-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-base); font-weight: 600; }
.progress-bar {
  margin-top: 10px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
}
:root.dark .progress-bar { background: rgba(255, 255, 255, .06); }
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--brand-orange);
  width: var(--progress, 0%);
  transition: width .25s ease;
}
.progress-bar.compact { height: 5px; margin-top: 8px; }

.provisioning-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.provisioning-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  min-height: 72px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-areas: "icon name" "icon meta";
  column-gap: 10px;
  row-gap: 3px;
  align-items: start;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.provisioning-item:hover { border-color: var(--line-strong); box-shadow: var(--elev-1); }
.provisioning-item.is-pending:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.provisioning-item .platform-icon { grid-area: icon; align-self: start; margin-top: 1px; }
.provisioning-item .access-tag-name {
  grid-area: name;
  text-align: left;
  font-size: var(--fs-md);
  font-weight: 600;
  padding-right: 34px;
  min-width: 0;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}
.provisioning-item .platform-meta {
  grid-area: meta;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
  word-break: normal;
  overflow-wrap: anywhere;
  white-space: normal;
}
.provisioning-item > .platform-icon,
.provisioning-item > .access-tag-name,
.provisioning-item > .platform-meta,
.provisioning-item > .provisioning-done-meta { position: relative; z-index: 2; pointer-events: none; }
.provisioning-item:disabled { opacity: 1; cursor: not-allowed; color: var(--text); -webkit-text-fill-color: var(--text); }
.provisioning-item:disabled .access-tag-name { color: var(--text); -webkit-text-fill-color: var(--text); }
.provisioning-item:disabled .platform-meta { color: var(--text-3); -webkit-text-fill-color: var(--text-3); }

/* Done states: full tinted border + icon change (color + shape, not color-only) */
.provisioning-item.is-done-self,
.provisioning-item.is-done-other {
  grid-template-areas: "icon name" "icon meta";
  row-gap: 3px;
  min-height: 0;
  padding: 10px 14px;
  border-color: var(--ok-border);
  background: var(--ok-bg);
  box-shadow: none;
}
.provisioning-item.is-done-self:hover,
.provisioning-item.is-done-other:hover { border-color: var(--ok-border); }
.provisioning-item.is-done-self .platform-icon,
.provisioning-item.is-done-other .platform-icon { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.provisioning-item.is-done-self .access-tag-name,
.provisioning-item.is-done-other .access-tag-name { font-size: var(--fs-base); font-weight: 600; line-height: 1.3; }
.provisioning-item.is-done-self { outline: 1px solid var(--ok-border); outline-offset: -1px; }
.provisioning-item.is-done-other::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  z-index: 3;
}

/* Movement-aware done tints */
.provisioning-item.movement-baja.is-done-self,
.provisioning-item.movement-baja.is-done-other { border-color: var(--danger-border); background: var(--danger-bg); }
.provisioning-item.movement-baja.is-done-self { outline-color: var(--danger-border); }
.provisioning-item.movement-baja.is-done-self .platform-icon,
.provisioning-item.movement-baja.is-done-other .platform-icon { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.provisioning-item.movement-modificacion.is-done-self,
.provisioning-item.movement-modificacion.is-done-other { border-color: var(--info-border); background: var(--info-bg); }
.provisioning-item.movement-modificacion.is-done-self { outline-color: var(--info-border); }
.provisioning-item.movement-modificacion.is-done-self .platform-icon,
.provisioning-item.movement-modificacion.is-done-other .platform-icon { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }

.provisioning-done-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}
.provisioning-done-meta .movement-tag { flex: 0 0 auto; }
.provisioning-done-meta .platform-meta {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.platform-toggle-hit { position: absolute; inset: 0; border: 0; background: transparent; border-radius: var(--r-md); cursor: pointer; z-index: 1; }

.provisioning-complete-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.provisioning-complete-bar .inline { flex-wrap: wrap; gap: 8px; align-items: center; }
.completion-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-align: right;
  max-width: 44ch;
  line-height: 1.35;
  margin-left: auto;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-2);
}
.completion-note::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--brand-orange);
  flex: 0 0 auto;
}
.completion-note.is-ready { color: var(--ok-text); }
.completion-note.is-ready::before { background: var(--ok-text); }
#complete-case-btn { min-width: 200px; }
.save-case-row { align-items: center; row-gap: 8px; column-gap: 14px; }

/* Validation checklist */
.validation-card {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.validation-head { font-size: var(--fs-base); font-weight: 600; margin-bottom: 10px; color: var(--text); }
.validation-list { display: grid; gap: 6px; }
.validation-item { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-base); line-height: 1.4; color: var(--text-2); }
.validation-item.is-ok { color: var(--ok-text); }
.validation-item.is-missing { color: var(--text-2); }
.warning-text { color: var(--warn-text); }

/* ── 19. Workflow toolbars & filters ───────────────────────────── */
.workflow-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr) minmax(170px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.workflow-toolbar.collab-toolbar { grid-template-columns: minmax(0, 1fr); }
/* Completados: search flexible + movimiento + Mis casos + fecha inline a la derecha */
.workflow-toolbar.completed-toolbar { grid-template-columns: minmax(0, 1fr) minmax(150px, auto) auto auto; }
.completed-date-inline { display: inline-flex; align-items: center; gap: 6px; justify-self: end; }
.completed-date-inline .date-field-wrap { width: 150px; }
.completed-date-inline .date-input { min-height: 38px; }

/* "Mis casos" quick filter */
.mine-toggle { white-space: nowrap; justify-self: start; }
.mine-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}
.workflow-toolbar .input, .workflow-toolbar .select { min-width: 0; }
.compact-select-wrap { min-width: 0; }

.log-date-block, .compact-log-toolbar-pro, .compact-log-toolbar {
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 0;
}
.compact-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.compact-label-row .label { margin-bottom: 0; }
.log-filter-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.compact-clear-btn { min-height: 38px; min-width: 96px; padding-inline: 16px; white-space: nowrap; }
.small-empty { padding: 16px; }

/* ── 20. Case Cards ────────────────────────────────────────────── */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: stretch; }
.case-card, .completed-row {
  position: relative;
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  transition: border-color .18s var(--ease-out-quart, ease), box-shadow .18s var(--ease-out-quart, ease), transform .18s var(--ease-out-quart, ease), --spot .22s ease;
}
/* Interactive cards earn a subtle lift on hover (cn-hover-lift). Only these
   clickable rows move; static panels stay put. */
.case-card:hover, .completed-row:hover { border-color: var(--line-strong); box-shadow: var(--elev-3); transform: translateY(-2px); }
.case-card:active, .completed-row:active { transform: translateY(0); box-shadow: var(--elev-2); }
.case-card:focus-visible, .completed-row:focus-visible { box-shadow: var(--ring-accent); }
.case-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.case-card-title, .completed-row-title { font-weight: 600; font-size: var(--fs-md); line-height: 1.3; letter-spacing: -.01em; }
.case-card-meta { font-size: var(--fs-sm); color: var(--text-3); margin-top: 1px; }
.case-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 2px;
}
.completed-row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.case-card-tags, .completed-row-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.strong-link { color: var(--accent-text); font-weight: 600; font-size: var(--fs-sm); }

/* Progress bar paired inline with its fraction — one scan instead of two. */
.case-card-progress-row { display: flex; align-items: center; gap: 8px; }
.case-card-progress-row .progress-bar { flex: 1; margin-top: 0; }
.case-progress-pill { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* Consolidated owner + relative-time line — replaces two stacked muted rows. */
.case-card-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.case-card-meta-icon { width: 13px; height: 13px; flex: 0 0 auto; opacity: .75; }

/* Ownership: communicated by meta text; subtle surface shift for others' cases */
.case-card.is-owned-other, .completed-row.is-owned-other { background: var(--surface-2); }
.completed-row.active { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-border); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; }
.pager .pager-label { min-width: 96px; text-align: center; }

/* Completed layout */
.completed-shell { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.completed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 480px;
  max-height: min(720px, calc(100vh - 240px));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 6px 16px 2px;
  scroll-padding-bottom: 16px;
}
.completed-list > .completed-row { flex: 0 0 auto; }
.completed-detail {
  min-width: 0;
  min-height: 480px;
  max-height: min(720px, calc(100vh - 240px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  background: var(--surface-2);
}
.completed-detail > .empty,
.completed-list > .empty,
.single-column-layout .case-grid > .empty {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
}
.single-column-layout .case-grid > .empty { grid-column: 1 / -1; }
.completed-detail > .empty.empty-action,
.completed-list > .empty.empty-action,
.single-column-layout .case-grid > .empty.empty-action {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
}
.case-log-list { max-height: 620px; overflow: auto; }

/* Case comment */
.case-comment-card {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.case-comment-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.5;
  margin-top: 4px;
}

/* ── 21. Log Items ─────────────────────────────────────────────── */
.log-list { display: grid; gap: 8px; max-height: 620px; overflow: auto; padding-right: 4px; }
.log-item {
  position: relative;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  gap: 3px;
}
.log-item::before { display: none; }
.log-item-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.log-main { font-size: var(--fs-base); font-weight: 600; letter-spacing: -.005em; }
/* Status / movement tags — bespoke "Connect chip".
   Signature: a single angular corner cut (--notch) echoing the diagonal
   letter cuts of the Connect wordmark, plus a leading solid status square.
   No generic rounded-pill, no soft border — the chamfer + tint carry it. */
.log-tag,
.movement-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, 0 100%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--pill);
  color: var(--text-2);
}
/* Leading status mark — a small solid square in the tone color (currentColor),
   itself chamfered to match the chip. A deliberate indicator, not a dot. */
.log-tag::before,
.movement-tag::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 100% 65%, 65% 100%, 0 100%);
  opacity: .9;
}
/* El tono lo comunican el tag y su marca — la tarjeta del log NO se rellena de
   color; queda en superficie neutra con apenas un borde tenue del tono, para
   que el historial no se sienta recargado. */
.log-item.tone-success { border-color: var(--ok-border); }
.log-tag.tone-success { color: var(--ok-text); }
.log-item.tone-warning { border-color: var(--warn-border); }
.log-tag.tone-warning { color: var(--warn-text); }
.log-item.tone-info { border-color: var(--line); }
.log-tag.tone-info { color: var(--text-2); }
.log-tag.tone-pending { color: var(--text-3); }
.log-tag.tone-progress { color: var(--info-text); }

/* Completado: a check mark replaces the generic leading square. */
.log-tag.has-icon::before { content: none; }
.log-tag .ui-icon svg { width: 10px; height: 10px; }
.log-tag.icon-only { padding: 4px; gap: 0; }

/* ── 22. Movement Tags ─────────────────────────────────────────── */
/* Alta stays neutral (inherits --text-2 from .movement-tag) — green was
   reading as a duplicate "success" signal next to done/completed states.
   Baja and Modificación keep their tone; still a chip, not a status. */
.movement-tag.movement-baja { color: var(--danger-text); }
.movement-tag.movement-modificacion { color: var(--info-text); }

/* ── 23. Admin Panel ───────────────────────────────────────────── */
.admin-grid { display: grid; gap: 20px; margin-top: 20px; }
.simplified-admin-grid { grid-template-columns: minmax(0, 1fr); }
.card-admin .card-title { font-size: var(--fs-lg); }
.admin-sections { display: grid; gap: 12px; }
.admin-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-input-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: center; }
.admin-action-row { flex-wrap: wrap; }
.admin-context { margin-bottom: 2px; }
.admin-context-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.context-box {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: grid;
  gap: 4px;
}
.context-box strong { line-height: 1.3; }

.category-title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -.005em; }

/* ── Admin sub-tabs ────────────────────────────────────────────────
   Secondary navigation, deliberately subordinate to the main nav: text +
   count only (no icons — those belong to the primary tabs), an underline
   indicator instead of a filled pill, and a rule that ties the bar to the
   panel below. Replaces the former accordion, so exactly one section is
   mounted at a time and the app has one obvious "where am I". */
.admin-tabbar {
  display: flex;
  gap: 2px;
  margin-top: 14px;
  padding-bottom: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabbar::-webkit-scrollbar { display: none; }
/* Narrow viewports scroll the bar horizontally; fade the trailing edge so the
   off-screen tabs are discoverable instead of silently clipped. */
@media (max-width: 760px) {
  .admin-tabbar {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
}
.admin-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.admin-tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background .18s var(--ease-out-quart, ease);
}
.admin-tab:hover { color: var(--text); background: var(--soft-hover); }
.admin-tab.active { color: var(--accent-text); }
.admin-tab.active::after { background: var(--brand-orange); }
.admin-tab:focus-visible { box-shadow: var(--ring-accent); border-radius: var(--r-xs); }
.admin-tabpanel { padding-top: 18px; }
.admin-tabpanel:focus { outline: none; }
.admin-tabpanel:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 4px; border-radius: var(--r-sm); }
.admin-stack { gap: 14px; }

/* Grouped block inside a tab (Sistema holds Respaldo + Bitácora). */
.admin-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.admin-block + .admin-block { margin-top: 4px; }
.admin-block-head { display: grid; gap: 2px; }

/* País manager rows (Admin › Sistema) — name on the left, actions on the right. */
.country-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.country-admin-name { font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Matriz steps ──────────────────────────────────────────────────
   País → Cargo → Accesos as one ordered flow. A step whose prerequisite
   is unmet renders its head only (no dead controls) and dims, so the next
   action is always unambiguous. */
.admin-steps { display: grid; gap: 12px; }
.admin-step {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  transition: opacity .18s ease, border-color .18s ease;
}
.admin-step.is-locked { opacity: .6; gap: 0; }
.admin-step-head { display: flex; align-items: flex-start; gap: 12px; }
.admin-step-titles { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.admin-step-count {
  flex: 0 0 auto;
  padding: 2px 9px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, 0 100%);
  background: var(--pill);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.admin-step-body { display: grid; gap: 12px; }
.admin-step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
/* Keep "campo + botón" on one line with a bounded field, instead of letting the
   grid stretch the input until the button wraps to its own row. */
.admin-step-actions .admin-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.admin-step-actions .admin-input-row .input { flex: 0 1 240px; min-width: 0; }
.admin-step-actions .admin-input-row .btn { flex: 0 0 auto; }
@media (max-width: 720px) {
  .admin-step-actions { align-items: stretch; }
  .admin-step-actions .admin-input-row { width: 100%; }
  .admin-step-actions .admin-input-row .input { flex: 1 1 auto; }
}

.admin-role-select { cursor: pointer; }

/* Assignment grid */
.assignment-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
/* Barra de guardado de la matriz: aparece cuando hay cambios sin persistir. */
.assignment-savebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--accent-border, var(--line));
  border-radius: var(--r-md);
  background: var(--accent-soft, var(--surface-2));
  color: var(--accent-text, var(--text));
}
.assignment-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.assignment-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 46px;
  transition: border-color .15s ease, background .15s ease;
}
.assignment-check:hover { border-color: var(--line-strong); background: var(--soft-hover); }
.assignment-check input { width: 16px; height: 16px; flex: 0 0 16px; accent-color: var(--brand-orange); }
.assignment-check.is-selected { background: var(--accent-soft); border-color: var(--accent-border); }
.assignment-check-name { font-size: var(--fs-base); font-weight: 500; line-height: 1.35; word-break: break-word; }

/* User form */
#create-user-form {
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
#create-user-form .btn { justify-self: start; min-width: 160px; }

/* User list */
.list-panel { max-height: 260px; overflow: auto; display: grid; gap: 6px; padding-right: 4px; }
.compact-list-panel { max-height: 360px; }
.user-list-panel { max-height: 360px; }
.item-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.item-name { font-size: var(--fs-md); font-weight: 600; }
.user-line.is-inactive { opacity: .6; }
.completed-row.is-archived-collab { opacity: .6; }

/* URL editor */
.url-editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.url-editor-summary { display: grid; gap: 2px; min-width: 0; }
.url-editor-shell { gap: 10px; }
.apps-url-list, .compact-urls-list { display: grid; gap: 6px; }
.app-url-row {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--surface);
  display: grid;
  gap: 8px;
}
.app-url-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.app-url-titleblock { min-width: 0; display: grid; gap: 2px; flex: 1 1 180px; }
.app-row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.app-crud-panel { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.app-crud-row { align-items: center; gap: 8px; flex-wrap: wrap; }
.app-crud-row .select-icon-wrap { flex: 0 0 170px; min-width: 0; }
.app-crud-row .select { width: 100%; }
.app-crud-row .input { flex: 1 1 200px; min-width: 0; }
.app-crud-row .btn { flex: 0 0 auto; }
.app-url-inline-edit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.audara-compact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.audara-url-minirow { display: grid; gap: 6px; }
.compact-url-input { min-height: 34px; padding-block: 6px; font-size: var(--fs-base); }
.url-input { min-height: 38px; }
.compact-actions-row { justify-content: flex-end; }
.app-url-save-row { grid-column: 1 / -1; }

/* Backup */
.backup-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.backup-actions-row .btn { min-width: 170px; }
.import-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── 24. Auth Screens ──────────────────────────────────────────── */
.auth-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--auth-bg);
}
/* Soft blurred glow orbs, brand-colored, bleeding off the viewport edges —
   adds depth behind the card without competing with it (kept below via
   z-index, .auth-card sits above at z-index:1). */
.auth-shell::before,
.auth-shell::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(90px);
}
.auth-shell::before {
  width: 480px;
  height: 480px;
  top: -180px;
  right: -140px;
  background: var(--auth-orb-1);
}
.auth-shell::after {
  width: 420px;
  height: 420px;
  bottom: -160px;
  left: -140px;
  background: var(--auth-orb-2);
}
/* Aurora animada de fondo (login): blobs de marca (naranja/azul/ink) que
   derivan lento tras la tarjeta. Todo self-contained (sin dependencias ni CSP
   relajada); respeta prefers-reduced-motion. Queda bajo la tarjeta (z-index 1). */
.auth-aurora { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .5;
  will-change: transform;
  animation: aurora-drift 26s ease-in-out infinite alternate;
}
.aurora-blob-1 {
  width: 48vw; height: 48vw; max-width: 640px; max-height: 640px;
  top: -14vh; left: -8vw;
  background: radial-gradient(circle at 32% 30%, var(--brand-orange, #F15B2B), transparent 68%);
}
.aurora-blob-2 {
  width: 42vw; height: 42vw; max-width: 580px; max-height: 580px;
  bottom: -16vh; right: -10vw;
  background: radial-gradient(circle at 60% 42%, var(--blue-500, #3E6FC0), transparent 70%);
  animation-duration: 34s; animation-delay: -7s;
}
.aurora-blob-3 {
  width: 34vw; height: 34vw; max-width: 500px; max-height: 500px;
  top: 26vh; right: 18vw;
  opacity: .34;
  background: radial-gradient(circle at 50% 50%, var(--ink-900, #001D3D), transparent 72%);
  animation-duration: 40s; animation-delay: -14s;
}
@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(6vw, 4vh) scale(1.12); }
  100% { transform: translate(-4vw, -3vh) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) { .aurora-blob { animation: none; } }
/* Con la aurora en juego, atenúo los orbes estáticos para que no compitan. */
.auth-shell::before, .auth-shell::after { opacity: .5; }

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px 28px 24px;
  box-shadow: var(--elev-3);
  overflow: hidden;
}
/* Thin brand-gradient accent along the top edge — a small, minimal touch
   that reads as intentional rather than a bare card on a bare page. */
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-orange, #F15B2B), var(--brand-navy, #001D3D));
}
.auth-topbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.auth-copy { margin-bottom: 22px; }
.auth-copy .eyebrow {
  margin: 14px 0 4px;
  font-size: var(--fs-xs);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-3);
}
.auth-copy h1 { margin: 16px 0 0; font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: .002em; line-height: 1.08; color: var(--text); }
.auth-copy p { margin: 8px 0 0; font-size: var(--fs-base); line-height: 1.55; color: var(--text-2); max-width: 46ch; }
.auth-logo {
  width: auto;
  height: 30px;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: transparent;
  filter: none;
  margin-bottom: 2px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin: 14px 0 12px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* Versión: pie fijo al borde inferior de la página, centrado y sutil. */
.auth-version {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 1;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-3);
  letter-spacing: .03em;
}

/* Generic eyebrow (rarely used outside auth) */
.eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-3);
}

/* ── 25. Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: rgba(4, 10, 20, .55);
  display: grid;
  place-items: center;
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-card {
  width: min(100%, 520px);
  max-height: min(84vh, 700px);
  overflow: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--elev-3);
  padding: 22px;
  z-index: var(--z-modal);
}
.modal-card.is-danger { border-color: var(--danger-border); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-title { font-size: var(--fs-lg); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.modal-message { margin-top: 6px; color: var(--text-2); line-height: 1.55; font-size: var(--fs-base); white-space: pre-line; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
  transition: border-color .15s ease, color .15s ease;
}
.modal-close:hover { border-color: var(--accent-border); color: var(--accent-text); }
.modal-body { margin-top: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
#modal-input { width: 100%; }

/* ── 26. Toasts ────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: var(--z-toast);
  display: grid;
  gap: 10px;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--toast-bg);
  box-shadow: var(--elev-3);
  line-height: 1.45;
  font-size: var(--fs-base);
}
.toast-info { border-color: var(--info-border); }
.toast-success { border-color: var(--ok-border); }
.toast-warning { border-color: var(--warn-border); }
.toast-error { border-color: var(--danger-border); }
.toast-close {
  width: 26px;
  height: 26px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--toast-close-bg);
  color: var(--toast-close-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-size: 18px;
  padding: 0;
  flex: 0 0 auto;
}
.toast-close:hover { border-color: var(--accent-border); color: var(--accent-text); }

/* ── 27. Utilities ─────────────────────────────────────────────── */
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.stack { display: grid; gap: 12px; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-tight { gap: 8px; align-items: center; }
.inline-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.top-gap { margin-top: 16px; }
.top-gap-8 { margin-top: 8px; }
.top-gap-sm { margin-top: 6px; display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.footer-note { margin-top: 16px; color: var(--text-3); font-size: var(--fs-sm); }
.empty {
  border: 1px solid var(--line);
  padding: 32px 24px;
  border-radius: var(--r-md);
  color: var(--text-3);
  text-align: center;
  background: var(--surface-2);
  font-size: var(--fs-base);
  line-height: 1.5;
}
.logo-lockup { display: flex; align-items: center; gap: 12px; }
.logo-lockup-with-image { flex-direction: row; }

/* Legacy category cards */
.category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.category-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease; }
.category-card:hover { border-color: var(--line-strong); box-shadow: var(--elev-1); }
.category-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── 28. Responsive ────────────────────────────────────────────── */
/* Wrap the header before it squeezes: logo + wordmark + 7 nav tabs + user chip
   need ~1280px on one line. Below that the nav drops to its own row rather than
   truncating "Access Hub" and the user's name to ellipses. */
@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 216px minmax(0, 1fr); }
  .app-main { padding: 18px 20px 48px; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .category-grid, .admin-row { grid-template-columns: 1fr; }
  .assignment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .completed-shell { grid-template-columns: 1fr; }
  .completed-list, .case-log-list { max-height: none; }
  .completed-detail { min-height: 320px; }
  .workflow-toolbar { grid-template-columns: 1fr 1fr; }
  .workflow-toolbar.completed-toolbar { grid-template-columns: 1fr 1fr; }
  .workflow-toolbar .search-wrap { grid-column: 1 / -1; }
  .completed-date-inline { justify-self: stretch; }
  .completed-date-inline .date-field-wrap { width: 100%; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; min-height: 0; }
  .sidenav { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .sidenav-nav { margin-top: 10px; }
  .nav-group { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav-group + .nav-group { margin-top: 10px; }
  .nav-group-label { width: 100%; margin-bottom: 4px; }
  .sidenav-nav .tab-btn { width: auto; }
  .sidenav-foot { margin-top: 12px; padding-top: 12px; flex-direction: row; align-items: center; justify-content: space-between; }
  .app-main { padding: 16px 16px 40px; }
  .card, .auth-card { padding: 20px; }
  .admin-context-grid, .inline-2, .provisioning-grid,
  .unified-tags-grid, .access-tags-grid { grid-template-columns: 1fr; }
  .log-filter-inline { grid-template-columns: 1fr; }
  .compact-clear-btn { width: 100%; }
  .url-editor-toolbar { align-items: flex-start; flex-direction: column; }
  .url-editor-toolbar .btn { width: 100%; }
  .app-url-inline-edit, .audara-compact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .sidenav-nav { gap: 4px; }
  .tab-btn { padding: 7px 10px; }
  .user-chip-name, .user-chip-meta { max-width: none; }
  .workflow-toolbar { grid-template-columns: 1fr; }
  .workflow-toolbar.completed-toolbar { grid-template-columns: 1fr; }
  .stats, .workflow-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast-stack { left: 12px; right: 12px; max-width: none; }
  .assignment-grid { grid-template-columns: 1fr; }
  .mode-toggle { grid-template-columns: 1fr 1fr; }
  .modal-backdrop { padding: 12px; align-items: end; }
  .modal-card { width: 100%; border-radius: var(--r-lg); padding: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .provisioning-complete-bar { flex-direction: column; align-items: stretch; }
  .provisioning-complete-bar .inline { width: 100%; }
  .provisioning-complete-bar .btn { flex: 1 1 100%; }
  .completion-note { max-width: none; width: 100%; text-align: left; margin-left: 0; }
  .password-input { padding-right: 70px; }
  .inline.inline-2 { grid-template-columns: 1fr; }
  .inline-tight { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .save-case-row { flex-direction: column; align-items: stretch; }
  .save-case-row #save-case-btn { width: 100%; }
  .backup-summary-grid { grid-template-columns: 1fr; }
  .assignment-toolbar { align-items: stretch; }
  .assignment-toolbar .inline-tight { width: 100%; }
  .assignment-toolbar .btn { flex: 1 1 100%; }
  .backup-actions-row .btn { width: 100%; min-width: 0; }
  .compact-label-row { flex-direction: column; align-items: flex-start; }
  .result-header { flex-direction: column; align-items: stretch; }
}

/* ── 29. Motion System ─────────────────────────────────────────── */
/* State-driven only: entrances for elements that APPEAR on a state
   change (modal, toast, dropdown, auth card). Never on content that
   re-renders during normal interaction (cards, lists, sections). */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes shake-x {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
/* Data-viz reveal: grow from a zero axis (GPU-friendly scale, not width/height). */
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
/* One-shot feedback pop (used via Web Animations API too). */
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.045); } 100% { transform: scale(1); } }

:root {
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-card { animation: rise-in .35s var(--ease-out-expo) both; }
.auth-card.auth-card--error { animation: shake-x .4s ease both; }

/* Boot screen: shown only while the initial GET /me is in flight, so a
   returning session doesn't flash the login form before swapping to the
   app. Delayed, held-back start (fill-mode: backwards holds the 0% frame
   during the delay) so a fast/cached response never shows more than a
   dim, static logo — no pulse, no pop-in. */
@keyframes boot-breathe {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
.boot-logo {
  height: 34px;
  animation: boot-breathe 1.4s ease-in-out .2s infinite backwards;
}
@media (prefers-reduced-motion: reduce) {
  .boot-logo { animation: none; opacity: .8; }
}
.modal-backdrop { animation: fade-in .16s ease-out both; }
.modal-card { animation: scale-in .18s var(--ease-out-expo) both; }
.toast { animation: toast-in .22s var(--ease-out-expo) both; }
.autocomplete-list { animation: fade-in .14s ease-out both; }

/* ── View-enter choreography (plays only on tab change; .view-enter is
   added to the active section once per tab switch, never on re-render) ── */

/* List rhythm: staggered rise-in for the main lists. Capped at 10 items
   (≤360ms total); nth-child avoids CSP-blocked inline style delays. */
.view-enter .case-grid > .case-card,
.view-enter .completed-list > .completed-row,
.view-enter .recert-subject,
.view-enter .provisioning-grid > .provisioning-item,
.view-enter .unified-tags-grid > .access-tag,
.view-enter .log-list > .log-item,
.view-enter .assignment-grid > .assignment-check {
  animation: rise-in .32s var(--ease-out-quart) both;
}
.view-enter .case-grid > .case-card:nth-child(n+2),
.view-enter .completed-list > .completed-row:nth-child(n+2),
.view-enter .recert-subject:nth-child(n+2),
.view-enter .provisioning-grid > .provisioning-item:nth-child(n+2),
.view-enter .unified-tags-grid > .access-tag:nth-child(n+2) { animation-delay: 40ms; }
.view-enter .case-grid > .case-card:nth-child(n+3),
.view-enter .completed-list > .completed-row:nth-child(n+3),
.view-enter .recert-subject:nth-child(n+3),
.view-enter .provisioning-grid > .provisioning-item:nth-child(n+3),
.view-enter .unified-tags-grid > .access-tag:nth-child(n+3) { animation-delay: 80ms; }
.view-enter .case-grid > .case-card:nth-child(n+4),
.view-enter .provisioning-grid > .provisioning-item:nth-child(n+4),
.view-enter .unified-tags-grid > .access-tag:nth-child(n+4) { animation-delay: 120ms; }
.view-enter .case-grid > .case-card:nth-child(n+5),
.view-enter .provisioning-grid > .provisioning-item:nth-child(n+5),
.view-enter .unified-tags-grid > .access-tag:nth-child(n+5) { animation-delay: 160ms; }
.view-enter .case-grid > .case-card:nth-child(n+6),
.view-enter .provisioning-grid > .provisioning-item:nth-child(n+6) { animation-delay: 200ms; }
.view-enter .provisioning-grid > .provisioning-item:nth-child(n+7) { animation-delay: 240ms; }

/* Micro-feedback: quick press-in on primary controls (100ms, no bounce). */
.btn:active:not(:disabled) { transform: scale(.975); }
.tab-btn:active, .mode-btn:active, .icon-btn:active,
.country-chip:active, .role-btn:active { transform: scale(.97); }
.btn, .tab-btn, .mode-btn, .icon-btn, .country-chip, .role-btn { transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s var(--ease-out-quart); }
/* Case/subject cards lift a touch more decisively on hover. */
.case-card, .completed-row, .provisioning-item, .recert-subject, .assignment-check {
  transition: transform .16s var(--ease-out-quart), border-color .15s ease, box-shadow .16s ease, background .15s ease;
}
.case-card:hover, .completed-row:hover { transform: translateY(-2px); }

/* Access-mark pop (also triggered via Web Animations API on toggle). */
.provisioning-item.just-marked { animation: pop .26s var(--ease-out-expo); }

/* Dashboard hero: KPI cards rise, metric bars grow from the left, sparkline
   columns grow from the bottom. */
.view-enter .dash-kpis > .stat { animation: rise-in .38s var(--ease-out-expo) both; }
.view-enter .dash-kpis > .stat:nth-child(2) { animation-delay: 60ms; }
.view-enter .dash-kpis > .stat:nth-child(3) { animation-delay: 120ms; }
.view-enter .dash-kpis > .stat:nth-child(4) { animation-delay: 180ms; }
.view-enter .dash-panel { animation: rise-in .4s var(--ease-out-expo) both; animation-delay: 120ms; }
.view-enter .metric-bar-fill { animation: grow-x .5s var(--ease-out-expo) both; transform-origin: left center; animation-delay: 220ms; }
.view-enter .dash-spark-bar { animation: grow-y .5s var(--ease-out-expo) both; transform-origin: bottom center; animation-delay: 220ms; }

/* Button spinner (loading state) */
.btn-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-radius: var(--r-full);
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.ghost .btn-spinner, .linkish .btn-spinner {
  border-color: var(--line-strong);
  border-top-color: var(--text-2);
}

/* ── 30. Auth UX Components ────────────────────────────────────── */
.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: var(--fs-base);
  line-height: 1.45;
}
.capslock-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--warn-text);
}
.capslock-hint[hidden] { display: none; }

/* Live password requirements checklist */
.pw-checklist {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: grid;
  gap: 5px;
}
.pw-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  transition: color .15s ease;
}
.pw-checklist li::before {
  content: '○';
  display: inline-grid;
  place-items: center;
  width: 14px;
  flex: 0 0 14px;
  font-size: var(--fs-xs);
  line-height: 1;
  transition: color .15s ease;
}
.pw-checklist li.is-met { color: var(--ok-text); }
.pw-checklist li.is-met::before { content: '✓'; font-weight: 700; }

.pw-match-hint {
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.4;
}
.pw-match-hint[hidden] { display: none; }
.pw-match-hint.is-ok { color: var(--ok-text); }
.pw-match-hint.is-bad { color: var(--danger-text); }

/* ── 31. Navigation & Flow Components ──────────────────────────── */
/* Open-cases badge on the Pendientes tab */
.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--brand-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.tab-btn.active .tab-badge { background: var(--brand-orange); color: #fff; }

/* View transition: applied only when the active tab changes */
.view-enter { animation: rise-in .24s cubic-bezier(.16, 1, .3, 1) both; }

/* Autocomplete keyboard highlight */
.autocomplete-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Copy-button success morph */
.btn.is-flash-success, .linkish.is-flash-success {
  color: var(--ok-text);
  border-color: var(--ok-border);
  background: var(--ok-bg);
}

/* Actionable empty states */
.empty-action { display: grid; justify-items: center; gap: 8px; }
.empty-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-2); }
.empty-action p { margin: 0; max-width: 46ch; }
.empty-action .btn { margin-top: 6px; }

/* Keyboard hint chips */
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
}

/* Boot loader (index.html): replaced by the first render */
.boot-loader {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
}
.boot-spinner {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  border: 3px solid var(--line-strong);
  border-top-color: var(--brand-orange);
  animation: spin .8s linear infinite;
}
.boot-label {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--text-2);
  animation: fade-in .6s ease both;
}

/* Sync bar — thin indeterminate strip while hydrateAppFromRemote() is in
   flight, so a returning session never sits silently on stale cached/seed
   data with no cue that a fresher copy is on its way. */
.sync-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--line);
  overflow: hidden;
  z-index: var(--z-sync);
}
.sync-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  background: var(--brand-orange);
  animation: sync-sweep 1.1s ease-in-out infinite;
}
@keyframes sync-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  .sync-bar::after { animation: none; width: 100%; opacity: .6; }
}

/* Per-access note (Ejecución) */
.item-note-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1;
  opacity: 0;
  transition: opacity .15s ease, border-color .15s ease, color .15s ease;
}
.provisioning-item:hover .item-note-btn,
.item-note-btn:focus-visible,
.item-note-btn.has-note { opacity: 1; }
.item-note-btn:hover { border-color: var(--accent-border); color: var(--accent-text); }
.item-note-btn.has-note { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.item-note-text {
  flex: 1 1 100%;
  min-width: 0;
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--warn-text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Stalled-case age pill */
.pill.danger-pill { color: var(--danger-text); }

/* Assignment / inbox */
.pill.assigned-me-pill {
  color: var(--accent-text);
  font-weight: 600;
}
.tab-badge.inbox-badge { margin-left: 2px; }
.mine-toggle .tab-badge { background: var(--brand-orange); color: #fff; }

/* SLA pills */
.pill.sla-pill { font-weight: 600; }
.pill.sla-breached { color: var(--danger-text); }
.pill.sla-risk { color: var(--warn-text); }

/* SLA config grid (Admin) */
.sla-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* Recertification */
.recert-campaign-row.active { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-border); }
.recert-review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.recert-subject {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.recert-subject.is-certified { border-color: var(--ok-border); background: var(--ok-bg); }
.recert-subject.is-flagged { border-color: var(--warn-border); background: var(--warn-bg); }
.recert-subject-main { min-width: 0; flex: 1 1 260px; }
.recert-subject-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.recert-apps { display: flex; flex-wrap: wrap; gap: 4px; }
.recert-subject-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.ok-text { color: var(--ok-text); }

/* Modal checkbox list */
.modal-checkbox-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.modal-checkbox-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-xs); cursor: pointer; font-size: var(--fs-base); }
.modal-checkbox-row:hover { background: var(--soft-hover); }

/* Draft restore banner (Consulta) */
.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  animation: rise-in .24s cubic-bezier(.16, 1, .3, 1) both;
}
.draft-banner-copy { display: grid; gap: 2px; min-width: 0; }
.draft-banner-copy strong { color: var(--text); font-size: var(--fs-md); }

/* Matrix import/export bar (Admin) */
.matrix-io-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

/* ── Dashboard / Panel ─────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.dash-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 16px;
}
.metric-bars { display: grid; gap: 8px; }
.metric-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 96px) 1fr auto;
  align-items: center;
  gap: 10px;
}
.metric-bar-label {
  font-size: var(--fs-sm);
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-bar-track {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.metric-bar-fill {
  display: block;
  height: 100%;
  width: var(--bar, 0%);
  border-radius: var(--r-full);
  background: var(--blue-500);
  transition: width .3s ease;
}
.metric-bar-fill.tone-ok { background: var(--ok-text); }
.metric-bar-fill.tone-warn { background: var(--warn-text); }
.metric-bar-fill.tone-danger { background: var(--danger-text); }
.metric-bar-value { font-size: var(--fs-sm); font-weight: 600; color: var(--text); min-width: 20px; text-align: right; }

/* Weekly sparkline (columns) */
.dash-spark {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 6px;
  height: 96px;
}
.dash-spark-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.dash-spark-bar {
  width: 100%;
  max-width: 28px;
  height: var(--bar, 0%);
  min-height: 3px;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  background: var(--blue-500);
  transition: height .3s ease;
}
.dash-spark-bar.is-current { background: var(--brand-orange); }
.dash-spark-label { font-size: var(--fs-xs); color: var(--text-3); }

/* Featured chart — casos creados vs. cerrados por semana (grouped columns). */
.dash-bigpanel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
.dash-bigpanel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-legend { display: flex; gap: 16px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-2); }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend-created { background: var(--blue-500); }
.legend-closed { background: var(--ok-text); }
.dash-bigchart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 14px; height: 220px; }
.bigchart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; min-width: 0; }
.bigchart-bars { display: flex; align-items: flex-end; justify-content: center; gap: 5px; width: 100%; height: 100%; }
.bigchart-bar { width: 100%; max-width: 24px; height: var(--bar, 0%); min-height: 3px; border-radius: var(--r-xs) var(--r-xs) 0 0; transition: height .3s ease; }
.bar-created { background: var(--blue-500); }
.bar-closed { background: var(--ok-text); }
.bigchart-label { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.view-enter .bigchart-bar { animation: grow-y .55s var(--ease-out-expo) both; transform-origin: bottom center; animation-delay: 260ms; }

/* ── 32. Collaborator Dossier ──────────────────────────────────── */
.collab-section .category-title { display: flex; align-items: center; gap: 8px; }
.collab-net-body { display: grid; gap: 3px; min-width: 0; }
/* Tarjetas de accesos del colaborador: layout en columna limpio y consistente —
   nombre → meta → acción, cada uno en su renglón. Superficie neutra; el tono lo
   lleva solo el borde tenue (sin marca cuadrada ni relleno de color). */
.net-tag-granted, .net-tag-revoked, .net-tag-pending-revoke {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.net-tag-granted .net-revoke-btn,
.net-tag-revoked .net-revoke-btn,
.net-tag-pending-revoke .net-revoke-btn { align-self: flex-start; }
.net-tag-granted { border-color: var(--ok-border); }
.net-tag-revoked { border-color: var(--danger-border); }
.net-tag-revoked .access-tag-name { text-decoration: line-through; text-decoration-color: var(--danger-border); }
.net-tag-pending-revoke { border-color: var(--warn-border); }
.net-tag-pending-revoke .platform-meta { color: var(--warn-text); font-weight: 600; }
.collab-case-row { padding: 12px 14px; }
.net-revoke-btn { min-height: 30px; padding: 5px 12px; }

/* ── 32b. Cursor spotlight ─────────────────────────────────────────
   A faint accent glow that follows the pointer across premium card
   surfaces (KPIs, dashboard panels, interactive case rows). Adopted from
   the Connect Notifications app. Implemented without pseudo-elements or a
   child node: an extra radial-gradient background layer whose colour lives
   in the animatable custom property --spot (transparent until :hover) and
   whose centre tracks --mx/--my (set by one delegated pointermove listener
   in app.js). Placed after the card rules so the layer wins over their
   `background` shorthands; background-color is untouched. */
@property --spot {
  syntax: "<color>";
  inherits: false;
  initial-value: rgba(241, 91, 43, 0);
}
.stat,
.dash-panel,
.case-card,
.completed-row {
  background-image: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 62%);
}
.stat, .dash-panel { transition: --spot .22s ease; }
@media (hover: hover) {
  .stat:hover,
  .dash-panel:hover,
  .case-card:hover,
  .completed-row:hover { --spot: rgba(241, 91, 43, .10); }
}

/* ── 33. Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
