/* ════════════════════════════════════════════════════════════════
   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 #02203D (support neutral), dark theme primary.
   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.
   ════════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ──────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-orange: #F15B2B;
  --brand-orange-600: #D64A1E;
  --brand-orange-700: #B93E17;
  --brand-navy: #02203D;
  --brand-navy-700: #0B2B50;
  --brand-navy-600: #14406E;
  --brand-orange-text: #C2410C;   /* 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 */
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F7;
  --panel: var(--surface);
  --panel-2: var(--surface-2);

  /* Text */
  --text: #182233;
  --text-2: #46536A;
  --text-3: #5F6E85;
  --muted: var(--text-3);
  --text-muted-accessible: var(--text-3);

  /* Lines */
  --line: #E3E8F0;
  --line-strong: #C9D4E2;
  --pill: #EEF2F7;

  /* Status */
  --ok-text: #0E7A4D;
  --ok-bg: rgba(16, 185, 129, .12);
  --ok-border: rgba(16, 185, 129, .32);
  --danger-text: #DC2626;
  --danger-bg: rgba(220, 38, 38, .09);
  --danger-border: rgba(220, 38, 38, .32);
  --warn-text: #B45309;
  --warn-bg: rgba(217, 119, 6, .11);
  --warn-border: rgba(217, 119, 6, .30);
  --info-text: #1D4ED8;
  --info-bg: rgba(59, 130, 246, .10);
  --info-border: rgba(59, 130, 246, .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);

  /* Backgrounds */
  --theme-bg: #F3F5F9;
  --auth-bg:
    radial-gradient(880px 420px at 82% -10%, rgba(241, 91, 43, .07), transparent 60%),
    radial-gradient(720px 420px at 8% 110%, rgba(2, 32, 61, .07), transparent 55%),
    #F3F5F9;

  /* 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;

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

  /* Z-scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-backdrop: 1000;
  --z-modal: 1010;
  --z-toast: 1100;
  --z-skip: 1200;
}

: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);

  --theme-bg: #0A0F1A;
  --auth-bg:
    radial-gradient(880px 420px at 82% -10%, rgba(241, 91, 43, .08), transparent 60%),
    radial-gradient(720px 420px at 8% 110%, rgba(20, 64, 110, .18), transparent 55%),
    #0A0F1A;

  --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: "Prompt", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--theme-bg);
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; }

/* ── 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 {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px 48px;
  position: relative;
}
.top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.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); }

/* ── 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 Header (compact sticky bar; markup keeps .hero names) ─ */
.hero { position: relative; color: var(--text); }
.hero::before, .hero::after { display: none; }

.hero.hero-minimal {
  position: sticky;
  top: 10px;
  z-index: var(--z-sticky);
  padding: 10px 16px;
  border-radius: var(--r-lg);
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  box-shadow: var(--elev-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.hero.hero-minimal .hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.hero-left-minimal { min-width: 0; flex: 0 1 auto; }
.hero-brand-row { display: flex; align-items: center; gap: 12px; }
.hero-logo, .auth-logo { display: block; object-fit: contain; background: transparent; }
.hero.hero-minimal .hero-logo { width: auto; height: auto; max-width: 128px; max-height: 26px; margin: 0; filter: none; }

.brand-copy { display: block; min-width: 0; }
.hero-copy-minimal { max-width: none; }
/* Static hero copy is redundant chrome inside the app; the login keeps it. */
.hero-copy-minimal .eyebrow, .hero-copy-minimal p { display: none; }
.hero-copy-minimal h1, .brand-copy h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text);
}
.hero-badges, .hero-badges-minimal { display: none; }

.hero-right, .hero-right-minimal {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}
.hero-right-stack { display: contents; }

/* User chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  min-width: 0;
  color: var(--text);
}
.user-chip-minimal {
  padding: 5px 6px 5px 12px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--line);
  backdrop-filter: none;
  box-shadow: none;
  width: auto;
}
.user-chip-minimal > div:first-child { 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; max-width: 200px; }
.user-chip-meta { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.3; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.user-chip-minimal .btn { min-width: 0; min-height: 30px; padding: 4px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); }

/* Primary nav (segmented) */
.hero-tabs, .hero-tabs-minimal {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  width: auto;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.hero-tabs > .tab-btn, .hero-tabs-minimal > .tab-btn { flex: 0 0 auto; width: auto; }
.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: var(--fs-base);
  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); }
.tab-btn.active {
  background: var(--surface);
  color: var(--accent-text);
  border-color: var(--line);
  font-weight: 600;
  box-shadow: var(--elev-1);
}
.tab-btn .tab-icon { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tab-btn .tab-icon svg { width: 14px; height: 14px; }
.tab-btn .tab-label { display: inline-block; }
.admin-gear-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.gear-icon { font-size: 15px; line-height: 1; display: inline-flex; align-items: center; }

/* Generic badges (outside header they may still appear) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--r-full);
  background: var(--pill);
  border: 1px solid var(--line);
  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-consulta { position: sticky; top: 74px; }
.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; }
.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: 74px; }
.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); }
.password-hint { font-size: var(--fs-sm); color: var(--text-3); }

/* 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; }

.btn.primary { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); }
.btn.primary:hover:not(:disabled) { background: var(--brand-orange-600); border-color: var(--brand-orange-600); }
.btn.primary:active:not(:disabled) { background: var(--brand-orange-700); }
.btn.primary:focus-visible { box-shadow: var(--ring-accent); }

.btn.secondary { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
.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 {
  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: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: 13px;
  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); }

/* ── 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); }
#role-select:disabled { opacity: .6; cursor: not-allowed; }

/* ── 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;
}
.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-size: var(--fs-xl); font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.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-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}
.stat-value.stat-sm, .stat-sm { font-size: var(--fs-base); font-weight: 600; line-height: 1.35; letter-spacing: 0; }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pill);
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  min-height: 24px;
  padding: 2px 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
}
.pill.success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.warning-pill { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.pill.pill-muted, .muted-pill { background: var(--pill); color: var(--text-3); border-color: var(--line); }

/* ── 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;
}
.platform-icon.subtle { background: transparent; border: none; color: var(--text-2); width: auto; height: auto; }
.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; }
.save-case-row #provisioning-status-summary { line-height: 1.35; }

/* 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); }

/* "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 .15s ease, box-shadow .15s ease;
}
.case-card:hover, .completed-row:hover { border-color: var(--line-strong); 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;
}
.case-card-summary-row, .completed-row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.case-card-meta-stack { display: grid; gap: 2px; justify-content: start; }
.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); }

/* 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); }

/* 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; }
.log-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--pill);
  color: var(--text-2);
  white-space: nowrap;
}
.log-item.tone-success { border-color: var(--ok-border); background: var(--ok-bg); }
.log-tag.tone-success { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.log-item.tone-warning { border-color: var(--warn-border); background: var(--warn-bg); }
.log-tag.tone-warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.log-item.tone-info { border-color: var(--line); }
.log-tag.tone-info { background: var(--pill); border-color: var(--line); color: var(--text-2); }
.log-tag.tone-pending { background: var(--pill); border-color: var(--line); color: var(--text-3); }
.log-tag.tone-progress { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }

/* ── 22. Movement Tags ─────────────────────────────────────────── */
.movement-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--pill);
  color: var(--text-2);
}
.movement-tag.movement-alta { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.movement-tag.movement-baja { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.movement-tag.movement-modificacion { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }

/* ── 23. Admin Panel ───────────────────────────────────────────── */
.admin-grid { display: grid; gap: 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, .selected-role-name { line-height: 1.3; }

/* Accordion */
.accordion-list { display: grid; gap: 12px; }
.accordion-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 600;
  transition: background .15s ease;
}
.accordion-trigger:hover { background: var(--soft-hover); }
.accordion-meta { display: flex; align-items: center; gap: 8px; }
.accordion-chevron { font-size: var(--fs-base); color: var(--text-3); }
.accordion-panel { display: none; padding: 0 18px 18px; }
.accordion-panel.is-open { display: block; }
.accordion-stack { padding-top: 8px; gap: 12px; }
.category-title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -.005em; }

/* Users card: always open */
.users-card .accordion-panel { display: block; padding: 0 18px 18px; }
.users-card .accordion-chevron { display: inline-flex; }
.users-card .accordion-trigger { cursor: pointer; pointer-events: auto; }

/* Selected role card */
.selected-role-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
}
.selected-role-name { font-size: var(--fs-lg); font-weight: 600; color: var(--text); margin-top: 2px; letter-spacing: -.01em; }
.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);
}
.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; }

/* 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 {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--auth-bg);
}
.auth-card {
  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);
}
.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: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; 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 {
  max-width: 168px;
  max-height: 44px;
  width: auto;
  height: auto;
  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); }
.auth-version {
  margin-top: 20px;
  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); }
.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 ────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .hero.hero-minimal .hero-row { flex-wrap: wrap; }
  .hero-right, .hero-right-minimal { flex: 1 1 100%; justify-content: space-between; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .card-consulta { position: static; }
  .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 .search-wrap { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .hero.hero-minimal { position: static; }
  .app-shell { padding: 12px 14px 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) {
  .hero.hero-minimal .hero-row { gap: 10px; }
  .hero-right, .hero-right-minimal { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .hero-tabs, .hero-tabs-minimal {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-tabs > .tab-btn, .hero-tabs-minimal > .tab-btn { width: 100%; }
  .tab-btn { padding: 6px 8px; }
  .user-chip-minimal { width: 100%; }
  .user-chip-name, .user-chip-meta { max-width: none; }
  .workflow-toolbar { grid-template-columns: 1fr; }
  .stats, .workflow-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .selected-role-card { align-items: flex-start; flex-direction: column; }
  .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%; }
  .save-case-row #provisioning-status-summary { text-align: left; }
  .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); }
}

.auth-card { animation: rise-in .35s cubic-bezier(.16, 1, .3, 1) both; }
.auth-card.auth-card--error { animation: shake-x .4s ease both; }
.modal-backdrop { animation: fade-in .16s ease-out both; }
.modal-card { animation: scale-in .18s cubic-bezier(.16, 1, .3, 1) both; }
.toast { animation: toast-in .22s cubic-bezier(.16, 1, .3, 1) both; }
.autocomplete-list { animation: fade-in .14s ease-out both; }

/* 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: 11px;
  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: 11px;
  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-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  animation: fade-in .6s ease both;
}

/* 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: 12px;
  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 { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }

/* ── 32. Collaborator Dossier ──────────────────────────────────── */
.collab-section .category-title { display: flex; align-items: center; gap: 8px; }
.collab-net-body { display: grid; gap: 2px; min-width: 0; }
.net-tag-granted { border-color: var(--ok-border); background: var(--ok-bg); }
.net-tag-granted .platform-icon.subtle { color: var(--ok-text); }
.net-tag-revoked { border-color: var(--danger-border); background: var(--danger-bg); }
.net-tag-revoked .platform-icon.subtle { color: var(--danger-text); }
.net-tag-revoked .access-tag-name { text-decoration: line-through; text-decoration-color: var(--danger-border); }
.collab-case-row { padding: 12px 14px; }

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