/* css/dashboard.css — page-unique styles for index.html (dashboard SPA).
   Linked AFTER css/styles.css so it can override the shared design tokens
   defined there. All shared component styles (stat-card, role-badge,
   toolbar, sub-chip, modal-backdrop, navbar, role-info-bar, next-action,
   empty-state) live in css/styles.css — do NOT duplicate them here,
   since these rules override the external sheet and cause visual drift. */

/* SPA section visibility (toggled by hash router) */
.nav-section { display: none; }
.nav-section.active { display: block; }
.navbar .user-profile { margin-left: auto; }

/* Position sub-line under personnel name in tables */
.position-sub { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

/* Schedule page — stage tabs (unique to this page) */
.schedule-tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 2px solid var(--color-border); overflow-x: auto; }
.sch-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; color: var(--color-text-muted); font-size: 13px; font-weight: 500; white-space: nowrap; transition: all .12s; }
.sch-tab:hover { color: var(--color-primary); background: var(--color-info-bg); }
.sch-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }
.sch-tab-icon { font-size: 14px; }
.sch-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 11px; font-weight: 700; }
.sch-tab.active .sch-tab-count { background: var(--color-primary); color: #fff; }
.sch-tab[data-tab="hold"].active .sch-tab-count       { background: #f59e0b; }
.sch-tab[data-tab="hold"].active                       { color: #92400e; border-bottom-color: #f59e0b; }
.sch-tab[data-tab="failed"].active .sch-tab-count     { background: #dc2626; }
.sch-tab[data-tab="failed"].active                     { color: #991b1b; border-bottom-color: #dc2626; }
.sch-tab[data-tab="completed"].active .sch-tab-count  { background: #16a34a; }
.sch-tab[data-tab="completed"].active                  { color: #166534; border-bottom-color: #16a34a; }

/* SBTC general checklist (inside assessment modal) */
.sbtc-checklist { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--color-border); border-radius: 6px; padding: 8px 10px; background: #fafbfc; max-height: 320px; overflow-y: auto; }
.sbtc-checklist .sc-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid #eef0f3; }
.sbtc-checklist .sc-row:last-child { border-bottom: 0; }
.sbtc-checklist .sc-label { font-size: 12.5px; line-height: 1.35; color: #1f2937; }
.sbtc-checklist .sc-levels { display: flex; gap: 4px; }
.sbtc-checklist .sc-levels label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 3px 8px; border: 1px solid var(--color-border); border-radius: 4px; cursor: pointer; background: #fff; user-select: none; white-space: nowrap; }
.sbtc-checklist .sc-levels label.sel-competent { border-color: #16a34a; background: #ecfdf5; color: #166534; font-weight: 600; }
.sbtc-checklist .sc-levels label.sel-partial   { border-color: #f59e0b; background: #fffbeb; color: #92400e; font-weight: 600; }
.sbtc-checklist .sc-levels label.sel-not       { border-color: #dc2626; background: #fef2f2; color: #991b1b; font-weight: 600; }
.sbtc-checklist .sc-levels input { display: none; }
.sbtc-checklist-summary { font-size: 11.5px; color: var(--color-text-muted); padding: 6px 4px 0; display: flex; gap: 12px; }
.sbtc-checklist-summary .pill { padding: 2px 7px; border-radius: 99px; font-weight: 600; }
.sbtc-checklist-summary .pill.c { background: #ecfdf5; color: #166534; }
.sbtc-checklist-summary .pill.p { background: #fffbeb; color: #92400e; }
.sbtc-checklist-summary .pill.n { background: #fef2f2; color: #991b1b; }
.sbtc-checklist-summary .pill.x { background: #f1f5f9; color: #475569; }

/* ── Dashboard enrichment (sparkline cards, urgent banner, chart grid) ──
   All page-unique; safe to scope here because we don't reuse on other
   pages. Use CSS vars for colors so theme tokens stay the single SoT. */
.urgent-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(90deg, #fff7ed 0%, #fffbeb 100%);
  border: 1px solid #fcd34d; border-left: 4px solid #f59e0b;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 16px;
  font-size: 13px; color: #92400e;
}
.urgent-banner .ub-icon { font-size: 18px; line-height: 1; }
.urgent-banner .ub-text { flex: 1 1 auto; min-width: 240px; line-height: 1.4; }
.urgent-banner .ub-text strong { color: #78350f; font-weight: 700; }
.urgent-banner .ub-text .ub-num { font-weight: 700; color: #b45309; font-size: 14px; }
.urgent-banner .ub-text .ub-num.crit { color: #b91c1c; }
.urgent-banner .ub-action { font-size: 12.5px; color: #92400e; text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 4px 6px; font-weight: 600; }
.urgent-banner .ub-action:hover { color: #78350f; }

/* Stat-card additions: delta chip + sparkline strip.
   These live INSIDE existing .stat-card without changing its layout —
   they just append below .stat-value / .stat-sub. */
.stat-delta {
  display: inline-flex; align-items: center; gap: 3px; margin-top: 6px;
  font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px;
  background: #f1f5f9; color: #475569; line-height: 1.5; width: fit-content;
}
.stat-delta.up   { background: #ecfdf5; color: #065f46; }
.stat-delta.down { background: #fef2f2; color: #991b1b; }
.stat-delta.flat { background: #f1f5f9; color: #475569; }
.stat-delta .stat-delta-vs { color: inherit; opacity: .7; font-weight: 500; margin-left: 2px; }
.stat-spark { height: 36px; margin-top: 8px; margin-left: -6px; margin-right: -6px; }
/* No sparkline data → _renderSparkline clears innerHTML; collapse the reserved
   36px+margin so the card hugs its content instead of leaving a void.
   NOT `display: none`: the strip is ALSO empty in the moment before ApexCharts
   mounts into it, and _renderChartWhenVisible (index.html) defers render() until
   clientWidth > 0 — which a display:none element never reaches, so the sparkline
   never rendered at all. Collapsing the height keeps the box measurable.
   Second selector matches `#adminStatGrid .stat-spark` (src/styles.css density
   pass), which otherwise wins the height on specificity. */
.stat-spark:empty,
#adminStatGrid .stat-spark:empty { height: 0; margin-top: 0; }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { box-shadow: 0 6px 18px -6px rgba(15,23,42,.18); transform: translateY(-2px); }
.stat-card.clickable:focus-visible { outline: 2px solid #06c; outline-offset: 2px; }
.stat-card .stat-cta { font-size: 11px; color: #0052a3; margin-top: 4px; font-weight: 600; opacity: 0; transition: opacity .15s; }
.stat-card.clickable:hover .stat-cta,
.stat-card.clickable:focus-visible .stat-cta { opacity: 1; }

/* 3-tier expiry bar inside the Critical Certificates card */
.expiry-tiers { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.expiry-tiers .et-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.expiry-tiers .et-label { width: 46px; color: #475569; font-weight: 600; }
.expiry-tiers .et-bar { flex: 1 1 auto; height: 6px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.expiry-tiers .et-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.expiry-tiers .et-fill.t30 { background: #dc2626; }
.expiry-tiers .et-fill.t60 { background: #f59e0b; }
.expiry-tiers .et-fill.t90 { background: #fbbf24; }
.expiry-tiers .et-count { width: 28px; text-align: right; font-weight: 700; color: #1e293b; font-variant-numeric: tabular-nums; }

/* Chart row grid — compact by default; each chart has a maximize toggle
   (.chart-zoom-btn) so the dense layout never costs readability. */
.dash-chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
/* Asymmetric variant: wide horizontal-bar chart left (60%), donut right (40%).
   Bars want width for labels; donuts are square-ish and waste a half row. */
.dash-chart-row.split-60-40 { grid-template-columns: 3fr 2fr; }
@media (max-width: 900px) { .dash-chart-row, .dash-chart-row.split-60-40 { grid-template-columns: 1fr; } }
.chart-card { padding: 12px 14px; margin-bottom: 0; }
.chart-card .chart-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.chart-card h3 { margin: 0; font-size: 14px; font-weight: 600; color: #0f172a; }
.chart-card .chart-card-sub { font-size: 11.5px; color: #5b6675; }
/* Right-aligned cluster: sub-label + maximize button. */
.chart-card-actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chart-zoom-btn {
  background: transparent; border: 1px solid var(--color-border, #e2e8f0); border-radius: 7px;
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: #64748b; padding: 0; transition: all .12s; flex-shrink: 0;
}
.chart-zoom-btn:hover { color: #0066cc; border-color: #0066cc; background: rgba(0,102,204,.08); }
.chart-zoom-btn .lucide { width: 14px; height: 14px; }
.chart-card .chart-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 168px; color: #94a3b8; font-size: 13px; text-align: center;
}
.chart-card .chart-empty .ce-icon { font-size: 32px; opacity: .5; margin-bottom: 8px; }
.chart-skeleton { min-height: 168px; background: linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 50%,#f1f5f9 75%); background-size: 200% 100%; animation: chart-shimmer 1.4s linear infinite; border-radius: 8px; }
@keyframes chart-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── SBTC processing-time summary (registration → certificate) ──────
   Compact single-row band: lead metric on the left, supporting stats on
   the right. Wraps gracefully on narrow screens. */
.cycle-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(0,102,204,.06), rgba(16,185,129,.05));
  border: 1px solid #dee2e6; border-radius: 12px;
  padding: 12px 18px; margin-bottom: 12px;
}
.cyc-lead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cyc-icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #0066cc; color: #fff;
}
.cyc-icon .lucide { width: 22px; height: 22px; }
.cyc-value { display: flex; align-items: baseline; gap: 6px; font-size: 30px; font-weight: 800; line-height: 1; color: #212529; font-variant-numeric: tabular-nums; }
.cyc-unit { font-size: 13px; font-weight: 600; color: #6c757d; }
.cyc-label { font-size: 12px; color: #6c757d; margin-top: 4px; }
.cyc-metrics { display: flex; gap: 22px; flex-wrap: wrap; }
.cyc-metric { display: flex; flex-direction: column; align-items: flex-end; }
.cyc-m-val { font-size: 17px; font-weight: 700; color: #212529; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cyc-m-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; margin-top: 2px; }
@media (max-width: 640px) {
  .cyc-metrics { gap: 14px; width: 100%; }
  .cyc-metric { align-items: flex-start; }
}
html.dark .cycle-summary { background: linear-gradient(90deg, rgba(96,165,250,.10), rgba(16,185,129,.07)); border-color: #1f2c4a; }
html.dark .cyc-value,
html.dark .cyc-m-val { color: #f1f5f9; }
html.dark .cyc-unit,
html.dark .cyc-label,
html.dark .cyc-m-lbl { color: #94a3b8; }

/* ── Modern visual refresh — Pass 1 (additive, scoped to dashboard) ──
   Goal: lift the dashboard from "corporate 2022" to "SaaS 2026" without
   touching unrelated pages. Everything here is additive — existing
   classes keep working; new helpers compose on top. */

/* Tabular numerals — keeps stat values and table numbers visually
   aligned. Without this, "1,234" and "5,678" sit on different widths
   because proportional digits vary. Applied via class so we can opt-in
   on numeric cells without forcing it everywhere. */
.tabular-nums,
.stat-value,
.et-count,
.data-table td.num,
.data-table td.date-cell { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* Lucide icon sizing baseline. Lucide replaces <i data-lucide="x"></i>
   with an <svg>, but the original element keeps its inline-style
   attributes, so we set width/height/stroke-width here for consistency.
   `vertical-align: -2px` aligns icons with adjacent text baseline. */
[data-lucide], .lucide {
  width: 16px; height: 16px; stroke-width: 2;
  display: inline-block; vertical-align: -3px;
  color: currentColor; flex-shrink: 0;
}
.lucide-lg { width: 20px; height: 20px; vertical-align: -4px; }
.lucide-xl { width: 24px; height: 24px; vertical-align: -5px; }
.lucide-sm { width: 14px; height: 14px; vertical-align: -2px; stroke-width: 2.25; }

/* Tab item with icon — give icon + label proper gap & alignment. */
.tab-item { display: inline-flex; align-items: center; gap: 6px; }
.tab-item .lucide { stroke-width: 2; }
.tab-item.active .lucide { stroke-width: 2.25; }

/* Stat-value skeleton: a subtle 32×80px shimmer block that holds the
   same vertical footprint as the final number, so the card doesn't
   reflow when data arrives. Hidden by default; .is-loading on the
   card flips it on and dims the actual value. */
.stat-value-skel {
  display: none; height: 32px; width: 88px; margin-top: 4px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: chart-shimmer 1.4s linear infinite;
}
.stat-card.is-loading .stat-value { display: none; }
.stat-card.is-loading .stat-value-skel { display: block; }

/* Refine stat-card hover — a softer lift + accent border on hover for
   clickable cards. Original transform stays for non-clickable cards. */
.stat-card { transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, border-color .2s ease; }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -10px rgba(15,23,42,.15), 0 4px 8px -4px rgba(15,23,42,.08);
  border-color: #bfdbfe;
}
/* The CTA row at the bottom of clickable cards: hidden until hover,
   fades in with a small icon to telegraph "click me". */
.stat-cta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: #0052a3; margin-top: 6px; font-weight: 600;
  opacity: 0; transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.stat-card.clickable:hover .stat-cta,
.stat-card.clickable:focus-visible .stat-cta {
  opacity: 1; transform: translateX(0);
}

/* Section header — bigger, tighter heading for dashboard hero. */
.section-header h1 { font-size: 24px; letter-spacing: -0.01em; }
.section-header p  { font-size: 13.5px; color: #64748b; }

/* Chart-card header — tighter icon + label alignment, optional subtitle pill. */
.chart-card-header h3 { display: inline-flex; align-items: center; gap: 8px; }
.chart-card-header h3 .lucide { color: #06c; }
.chart-card-sub {
  background: #f1f5f9; color: #475569;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
}

/* Urgent banner — flatter, more refined; replace gradient with subtle
   amber tint, larger icon, action button as filled chip. */
.urgent-banner {
  background: #fffbeb; border: 1px solid #fde68a; border-left-width: 3px; border-left-color: #f59e0b;
  border-radius: 12px; padding: 12px 16px;
}
.urgent-banner .ub-icon { color: #d97706; display: inline-flex; align-items: center; }
.urgent-banner .ub-icon .lucide { width: 20px; height: 20px; stroke-width: 2; }
.urgent-banner .ub-action {
  background: #fff; border: 1px solid #fcd34d; color: #92400e;
  padding: 6px 12px; border-radius: 8px;
  text-decoration: none; font-weight: 600; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .15s ease, transform .15s ease;
}
.urgent-banner .ub-action:hover { background: #fef3c7; transform: translateX(2px); }
.urgent-banner .ub-action .lucide { width: 14px; height: 14px; }

/* Toolbar buttons — consistent icon + label gap. */
.btn .lucide { width: 14px; height: 14px; vertical-align: middle; stroke-width: 2.25; }
.btn-sm .lucide { width: 13px; height: 13px; }

/* Chart empty state — tighter typography, muted icon. */
.chart-empty .ce-icon { display: inline-flex; align-items: center; justify-content: center; }
.chart-empty .ce-icon .lucide { width: 28px; height: 28px; stroke-width: 1.5; color: #cbd5e1; }
.chart-empty .ce-title { font-weight: 600; color: #475569; font-size: 13.5px; margin-bottom: 2px; }
.chart-empty .ce-sub   { font-size: 12px; color: #5b6675; }

/* Fade-in animation for content arriving after async load. Applied
   once via class; respects prefers-reduced-motion. */
@keyframes dash-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dash-fade-in { animation: dash-fade-in .35s cubic-bezier(.4,0,.2,1) both; }
@media (prefers-reduced-motion: reduce) {
  .dash-fade-in, .stat-card, .stat-cta { animation: none !important; transition: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   DARK MODE — Sprint 2
   ════════════════════════════════════════════════════════════════
   Strategy:
   - Override CSS custom properties under `html.dark` (single source of
     truth for color tokens defined in css/styles.css :root).
   - Tailwind's compiled CSS uses hardcoded rgb() in places where it
     didn't reference the vars, so we explicitly override those rules
     too (body, navbar, card backgrounds, table rows, modals, inputs).
   - All overrides use the same color values as light mode counterparts
     just darkened — no new palette to maintain.
   - WCAG AA contrast preserved: body text on body bg ≥ 7:1, muted
     text ≥ 4.5:1, borders are deliberately low-contrast for hierarchy.

   ── 1. CSS custom-property overrides ──────────────────────────── */
html.dark {
  --color-bg:           #0b1220;          /* near-black with blue tint */
  --color-surface:      #111827;          /* card surface — slate-900-ish */
  --color-surface-alt:  #0f172a;
  --color-text:         #e5e7eb;          /* primary text */
  --color-text-muted:   #94a3b8;          /* secondary text */
  --color-text-light:   #64748b;
  --color-border:       #1f2937;          /* hairline borders */
  --color-border-input: #334155;          /* input borders (a touch brighter) */
  --color-primary:      #3b82f6;          /* shift primary slightly lighter for contrast */
  --color-primary-dark: #2563eb;
  --color-success-bg:   #052e1c;
  --color-success-bdr:  #14532d;
  --color-success-text: #6ee7b7;
  --color-error-bg:     #2a0d0d;
  --color-error-bdr:    #7f1d1d;
  --color-error-text:   #fca5a5;
  --color-warning-bg:   #2a1d05;
  --color-warning-bdr:  #78350f;
  --color-warning-text: #fde68a;
  --color-info-bg:      #0c1f3a;
  --color-info-bdr:     #1e40af;
  --color-info-text:    #93c5fd;
  --shadow-sm: 0 1px 3px 0 rgba(0,0,0,.4),  0 1px 2px -1px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,.5), 0 4px 8px -4px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 28px -8px rgba(0,0,0,.6);
}

/* ── 2. Body, root, scrollbar ─────────────────────────────────── */
html.dark body { background-color: #0b1220; color: #e5e7eb; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── 3. Navbar (already dark in light mode — darken further) ──── */
html.dark .navbar { background-color: #0f172a; box-shadow: 0 4px 16px -8px rgba(0,0,0,.6), inset 0 1px 0 0 hsla(0,0%,100%,.04); }
html.dark .role-info-bar { background-color: #111827; border-color: #1f2937; color: #94a3b8; }

/* ── 4. Container backgrounds & section header ───────────────── */
html.dark .section-header {
  background: linear-gradient(180deg, #111827, #0f172a);
  border-color: #1f2937; color: #e5e7eb;
}
html.dark .section-header h1 { color: #f1f5f9; }
html.dark .section-header p  { color: #94a3b8; }
html.dark .section-header h1:before { background-color: #3b82f6; }

/* ── 5. Cards (the big visual surface) ───────────────────────── */
html.dark .card,
html.dark .stat-card,
html.dark .chart-card {
  background-color: #111827;
  border-color: #1f2937;
  color: #e5e7eb;
}
html.dark .card-header { border-color: #1f2937; }
html.dark .stat-label { color: #94a3b8; }
html.dark .stat-value { color: #f1f5f9; }
html.dark .stat-sub   { color: #94a3b8; }
html.dark .stat-card.clickable:hover {
  border-color: #1d4ed8;
  box-shadow: 0 12px 24px -10px rgba(59,130,246,.25), 0 4px 8px -4px rgba(0,0,0,.4);
}
html.dark .stat-cta { color: #60a5fa; }
html.dark .stat-delta.flat { background: #1f2937; color: #94a3b8; }
html.dark .stat-delta.up   { background: #052e1c; color: #6ee7b7; }
html.dark .stat-delta.down { background: #2a0d0d; color: #fca5a5; }

/* ── 6. Tabs (dashboard sub-tabs + page tabs) ───────────────── */
html.dark .tab-bar { border-color: #1f2937; }
html.dark .tab-item { color: #94a3b8; }
html.dark .tab-item:hover { color: #93c5fd; }
html.dark .tab-item.active { color: #60a5fa; border-color: #3b82f6; }

/* ── 7. Tables ──────────────────────────────────────────────── */
html.dark .table-wrap,
html.dark .table-responsive { background-color: #111827; border-color: #1f2937; }
html.dark .data-table thead th {
  background-color: #0f172a; border-color: #1f2937; color: #94a3b8;
}
html.dark .data-table tbody td { border-color: #1f2937; color: #cbd5e1; }
html.dark .data-table tbody tr:hover td { background-color: #0f172a; }
html.dark .data-table tbody tr.row-mine td { background: linear-gradient(90deg, #1e3a8a, #1e3a8a 4px, #111827 0); }
html.dark .data-table tbody tr.row-mine:hover td { background: linear-gradient(90deg, #1d4ed8, #1d4ed8 4px, #0f172a 0); }

/* ── 8. Inputs / selects / textareas ──────────────────────────── */
html.dark .form-group input,
html.dark .form-group select,
html.dark .form-group textarea,
html.dark .toolbar input[type="search"],
html.dark .toolbar input[type="text"],
html.dark .toolbar select,
html.dark input[type="search"],
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="number"],
html.dark input[type="date"],
html.dark select,
html.dark textarea {
  background-color: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}
html.dark .form-group input::placeholder,
html.dark .toolbar input::placeholder,
html.dark input::placeholder,
html.dark textarea::placeholder { color: #64748b; }
html.dark .form-group input:focus,
html.dark .form-group select:focus,
html.dark .form-group textarea:focus,
html.dark .form-input:focus,
html.dark .toolbar input:focus,
html.dark .toolbar select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}
html.dark .form-group input[disabled],
html.dark .form-group input[readonly] { background-color: #1e293b; color: #64748b; }
html.dark .form-group label { color: #cbd5e1; }
html.dark .help-text { color: #64748b; }

/* ── 9. Buttons ──────────────────────────────────────────────── */
html.dark .btn-secondary { background-color: #1f2937; border-color: #334155; color: #e5e7eb; }
html.dark .btn-secondary:hover:not(:disabled) { background-color: #334155; }
html.dark .btn-outline { color: #60a5fa; border-color: #1e40af; }
html.dark .btn-outline:hover:not(:disabled) { background-color: #0c1f3a; border-color: #3b82f6; }
html.dark .btn-link { color: #60a5fa; }
html.dark .btn-link:hover:not(:disabled) { background-color: #0c1f3a; }
html.dark .btn-icon { background-color: #1f2937; border-color: #334155; color: #cbd5e1; }
html.dark .btn-icon:hover { background-color: #334155; color: #f1f5f9; }

/* First-click reliability on icon buttons (Workforce Renew / Edit / Exit / Delete
   and the same .btn-icon pattern on Applications). Lucide replaces <i> with an
   <svg><path> — a click on the path is what the user actually lands on. If
   anything about that SVG node is weird (detached mid-replace, no .closest in
   an old WebView, or a 1px hit-test miss) the first click dies. Icons never
   need to be the event target; the <button> is. */
.btn-icon svg,
.btn-icon i,
.btn svg,
.btn i[data-lucide],
button .lucide,
button [data-lucide] {
  pointer-events: none;
}

/* Closed sheet is only translated off-screen — it stays display:flex and can
   still intercept hits on the right edge, exactly where the roster action
   column lives. Kill hit-testing until it is actually open. */
.sheet-panel:not(.open),
.sheet-backdrop:not(.open) {
  pointer-events: none !important;
  visibility: hidden;
}
.sheet-panel.open,
.sheet-backdrop.open {
  visibility: visible;
}

/* ── 10. Modals (dialog + backdrop) ────────────────────────── */
html.dark .modal-backdrop.open { background-color: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
html.dark .modal-card,
html.dark .modal-content { background-color: #111827; color: #e5e7eb; border: 1px solid #1f2937; }
html.dark .modal-header { background-color: #111827; border-color: #1f2937; }
html.dark .modal-header h3 { color: #f1f5f9; }
html.dark .close-modal { color: #94a3b8; }
html.dark .close-modal:hover { background-color: #1f2937; color: #f1f5f9; }

/* ── 11. Badges & pills ──────────────────────────────────────── */
html.dark .badge-success, html.dark .pill.success { background: #052e1c; border-color: #14532d; color: #6ee7b7; }
html.dark .badge-warning, html.dark .pill.warning { background: #2a1d05; border-color: #78350f; color: #fde68a; }
html.dark .badge-danger,  html.dark .pill.danger  { background: #2a0d0d; border-color: #7f1d1d; color: #fca5a5; }
html.dark .badge-info,    html.dark .pill.info    { background: #0c1f3a; border-color: #1e40af; color: #93c5fd; }
html.dark .badge-primary { background: #0c1f3a; border-color: #1e40af; color: #93c5fd; }
html.dark .badge-secondary, html.dark .pill.secondary { background: #1f2937; border-color: #334155; color: #cbd5e1; }

/* ── 12. Alerts ──────────────────────────────────────────────── */
html.dark .alert-success { background-color: #052e1c; color: #6ee7b7; border-color: #14532d; }
html.dark .alert-warning { background-color: #2a1d05; color: #fde68a; border-color: #78350f; }
html.dark .alert-danger, html.dark .alert-error { background-color: #2a0d0d; color: #fca5a5; border-color: #7f1d1d; }
html.dark .alert-info { background-color: #0c1f3a; color: #93c5fd; border-color: #1e40af; }

/* ── 13. Sub-chips (filter row in /applications) ─────────────── */
html.dark .sub-chip { background-color: #111827; border-color: #1f2937; color: #cbd5e1; }
html.dark .sub-chip:hover { background-color: #1f2937; border-color: #334155; }
html.dark .sub-chip.active { background-color: #1e40af; border-color: #2563eb; color: #f1f5f9; }
html.dark .sub-chip-count { background-color: #1f2937; color: #cbd5e1; }

/* ── 14. Dashboard-specific overrides ───────────────────────── */
html.dark .urgent-banner { background: #2a1d05; border-color: #78350f; }
html.dark .urgent-banner .ub-text { color: #fde68a; }
html.dark .urgent-banner .ub-text strong { color: #fef3c7; }
html.dark .urgent-banner .ub-action { background: #1c1410; border-color: #78350f; color: #fde68a; }
html.dark .urgent-banner .ub-action:hover { background: #2a1d05; }
html.dark .urgent-banner .ub-icon { color: #fbbf24; }

html.dark .expiry-tiers .et-label { color: #94a3b8; }
html.dark .expiry-tiers .et-bar { background: #1f2937; }
html.dark .expiry-tiers .et-count { color: #f1f5f9; }

html.dark .chart-card-header h3 { color: #f1f5f9; }
html.dark .chart-card-header h3 .lucide { color: #60a5fa; }
html.dark .chart-card-sub { background: #1f2937; color: #94a3b8; }
html.dark .chart-zoom-btn { border-color: #334155; color: #94a3b8; }
html.dark .chart-zoom-btn:hover { color: #60a5fa; border-color: #60a5fa; background: rgba(96,165,250,.12); }
html.dark .chart-empty .ce-icon .lucide { color: #475569; }
html.dark .chart-empty .ce-title { color: #cbd5e1; }
html.dark .chart-empty .ce-sub   { color: #64748b; }
html.dark .chart-skeleton {
  background: linear-gradient(90deg, #1f2937 25%, #334155 50%, #1f2937 75%);
  background-size: 200% 100%;
}
html.dark .stat-value-skel {
  background: linear-gradient(90deg, #1f2937 25%, #334155 50%, #1f2937 75%);
  background-size: 200% 100%;
}

/* ── 15. Pagination + sub-controls ──────────────────────────── */
html.dark .pagination-btn:not(.active) { background-color: #111827; border-color: #1f2937; color: #cbd5e1; }
html.dark .pagination-btn:hover { background-color: #1f2937; border-color: #334155; }

/* ── 16. Profile, info-box, doc-link-row ────────────────────── */
html.dark .info-box { background: #0c1f3a; border-color: #3b82f6; }
html.dark .info-box h3 { color: #93c5fd; }
html.dark .doc-link-row { background-color: #0f172a; border-color: #1f2937; }
html.dark .doc-link-row:hover { background-color: #1f2937; }
html.dark .dl-type { background-color: #0c1f3a; color: #93c5fd; }
html.dark .dl-url { color: #93c5fd; }
html.dark .empty-state { color: #64748b; }

/* ── 17. SBTC checklist (in-modal) ──────────────────────────── */
html.dark .sbtc-checklist { background: #0f172a; border-color: #1f2937; }
html.dark .sbtc-checklist .sc-label { color: #cbd5e1; }
html.dark .sbtc-checklist .sc-row { border-bottom-color: #1f2937; }
html.dark .sbtc-checklist .sc-levels label { background: #111827; border-color: #334155; color: #cbd5e1; }
html.dark .sbtc-checklist-summary { color: #94a3b8; }

/* Schedule-tab count pills — light hardcoded greys go invisible on dark. */
html.dark .sch-tab-count { background: #334155; color: #cbd5e1; }

/* ── 18. Theme toggle button itself ─────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px;
  background: transparent; border: 1px solid hsla(0,0%,100%,.15);
  color: rgba(255,255,255,.85); cursor: pointer;
  transition: all .15s ease;
  padding: 0;
}
.theme-toggle:hover { background: hsla(0,0%,100%,.1); border-color: hsla(0,0%,100%,.3); color: #fff; }
.theme-toggle .lucide { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: inline-flex; }
.theme-toggle .icon-sun  { display: none; }
html.dark .theme-toggle .icon-moon { display: none; }
html.dark .theme-toggle .icon-sun  { display: inline-flex; }

/* ════════════════════════════════════════════════════════════════
   COMMAND PALETTE (⌘K / Ctrl+K) — Sprint 2
   ════════════════════════════════════════════════════════════════ */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15,23,42,.6); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 80px 20px 20px;
  animation: cmdk-fade .15s ease both;
}
.cmdk-backdrop.open { display: flex; }
@keyframes cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk-dialog {
  width: 100%; max-width: 600px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,.25), 0 0 0 1px rgba(15,23,42,.08);
  overflow: hidden;
  animation: cmdk-pop .18s cubic-bezier(.34,1.56,.64,1) both;
}
html.dark .cmdk-dialog { background: #111827; box-shadow: 0 24px 48px -12px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06); }
@keyframes cmdk-pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cmdk-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid #e2e8f0;
}
html.dark .cmdk-input-wrap { border-bottom-color: #1f2937; }
.cmdk-input-wrap .lucide { color: #94a3b8; width: 18px; height: 18px; }
.cmdk-input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 15px; color: #0f172a; font-family: inherit;
}
html.dark .cmdk-input { color: #f1f5f9; }
.cmdk-input::placeholder { color: #94a3b8; }
.cmdk-hint-kbd {
  font-size: 11px; color: #64748b; background: #f1f5f9;
  border: 1px solid #e2e8f0; border-radius: 4px;
  padding: 2px 6px; font-family: ui-monospace, monospace;
}
html.dark .cmdk-hint-kbd { background: #1f2937; border-color: #334155; color: #94a3b8; }
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.cmdk-group-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: #94a3b8; padding: 10px 12px 4px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  cursor: pointer; color: #334155; font-size: 13.5px;
  user-select: none;
}
html.dark .cmdk-item { color: #cbd5e1; }
.cmdk-item .lucide { color: #64748b; flex-shrink: 0; }
.cmdk-item.active { background: #eff6ff; color: #1e40af; }
.cmdk-item.active .lucide { color: #2563eb; }
html.dark .cmdk-item.active { background: #1e3a8a; color: #93c5fd; }
html.dark .cmdk-item.active .lucide { color: #60a5fa; }
.cmdk-item-label { flex: 1 1 auto; }
.cmdk-item-kbd {
  font-size: 11px; color: #94a3b8; font-family: ui-monospace, monospace;
}
.cmdk-item-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 99px;
  background: #f1f5f9; color: #475569; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
html.dark .cmdk-item-badge { background: #1f2937; color: #94a3b8; }
.cmdk-empty {
  padding: 24px 12px; text-align: center;
  color: #94a3b8; font-size: 13px;
}
.cmdk-footer {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; border-top: 1px solid #e2e8f0;
  background: #f8fafc; font-size: 11.5px; color: #64748b;
}
html.dark .cmdk-footer { border-top-color: #1f2937; background: #0f172a; color: #94a3b8; }
.cmdk-footer-item { display: inline-flex; align-items: center; gap: 4px; }

/* ════════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS OVERLAY (press ?)
   ════════════════════════════════════════════════════════════════ */
.kbd-help-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15,23,42,.55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.kbd-help-backdrop.open { display: flex; animation: cmdk-fade .15s ease both; }
.kbd-help-dialog {
  width: 100%; max-width: 480px;
  background: #fff; border-radius: 14px; padding: 24px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,.25);
}
html.dark .kbd-help-dialog { background: #111827; color: #e5e7eb; box-shadow: 0 24px 48px -12px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06); }
.kbd-help-dialog h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.kbd-help-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px dashed #e2e8f0; }
html.dark .kbd-help-row { border-bottom-color: #1f2937; }
.kbd-help-row:last-child { border-bottom: 0; }
.kbd-keys { display: inline-flex; gap: 4px; }
.kbd-keys kbd {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-bottom-width: 2px;
  border-radius: 4px; padding: 2px 7px;
  font-size: 11.5px; font-family: ui-monospace, monospace; color: #334155;
}
html.dark .kbd-keys kbd { background: #1f2937; border-color: #334155; color: #cbd5e1; }

/* ════════════════════════════════════════════════════════════════
   SPRINT 3 — Polish & power-user UX
   ════════════════════════════════════════════════════════════════
   All additive. Class-based toggles persisted in localStorage so the
   user's preference survives reloads. */

/* ── Density toggle ────────────────────────────────────────────
   Default density = comfortable (existing padding). Compact mode is
   opt-in via html.density-compact on the root; affects every
   .data-table on the page without per-table wiring. */
html.density-compact .data-table thead th { padding: .5rem .75rem; font-size: 11px; }
html.density-compact .data-table tbody td { padding: .45rem .75rem; font-size: 12.5px; }
html.density-compact .data-table tbody td .position-sub { font-size: 11px; }
/* The density button itself */
.density-btn { display: inline-flex; align-items: center; gap: 4px; }
.density-btn .lucide { width: 13px; height: 13px; }

/* ── Section transitions ──────────────────────────────────────
   Existing rule: `.nav-section { display: none; } .nav-section.active
   { display: block; }`. We keep that but add a fade-in animation on
   activation so route changes feel like a deliberate transition, not
   a flash. Respects reduced-motion. */
.nav-section.active { animation: section-fade-in .28s cubic-bezier(.4,0,.2,1) both; }
@keyframes section-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .nav-section.active { animation: none; }
}

/* ── Refined modal animations ────────────────────────────────
   Existing .modal-backdrop.open uses `display: flex`. We layer in a
   short fade for the backdrop and spring pop for the dialog card.
   Targets the standard modal scaffold used across the dashboard. */
.modal-backdrop.open { animation: backdrop-fade .18s ease both; }
.modal-backdrop.open .modal-card,
.modal-backdrop.open .modal-content { animation: modal-pop .24s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes backdrop-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop     { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop.open,
  .modal-backdrop.open .modal-card,
  .modal-backdrop.open .modal-content { animation: none; }
}

/* ── Status badge pulse for in-progress states ────────────────
   A whisper-soft glow on .badge-warning, intended to draw the eye to
   items that need action (Awaiting Review etc). Loops slowly so it's
   ambient, not annoying. Opted-in via `.pulse` class. */
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .35); }
  50%      { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}
.badge.pulse { animation: badge-pulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .badge.pulse { animation: none; }
}
html.dark .badge.pulse { animation: badge-pulse-dark 2.4s ease-in-out infinite; }
@keyframes badge-pulse-dark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .35); }
  50%      { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0); }
}

/* ── Refined focus rings (a11y) ───────────────────────────────
   Modern 3px ring with theme-aware color. Visible on keyboard nav
   only (focus-visible), invisible on mouse click. Stacks via outline
   instead of box-shadow to avoid clipping inside scroll containers. */
:focus-visible {
  outline: 3px solid rgba(59,130,246,.4);
  outline-offset: 2px;
  border-radius: 4px;
}
html.dark :focus-visible {
  outline-color: rgba(96,165,250,.55);
}
button:focus-visible,
.btn:focus-visible,
.stat-card.clickable:focus-visible {
  outline-offset: 3px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible { outline: 0; /* form-control's own focus glow takes over */ }

/* ── "Last updated" indicator ─────────────────────────────────
   Compact chip rendered next to the Refresh button. Live-updates via
   JS every 30s; the pulse dot signals freshness. */
.last-updated {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f1f5f9; color: #475569;
  padding: 5px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500;
  border: 1px solid #e2e8f0;
}
html.dark .last-updated { background: #1f2937; color: #94a3b8; border-color: #334155; }
.last-updated .lu-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16,185,129,.55);
  animation: lu-pulse 2s ease-in-out infinite;
}
@keyframes lu-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  50%      { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}
.last-updated.stale .lu-dot { background: #f59e0b; animation: none; }
@media (prefers-reduced-motion: reduce) {
  .last-updated .lu-dot { animation: none; }
}

/* ── Underline tab indicator animation ────────────────────────
   The compiled CSS already shows an underline on .tab-item.active. We
   enhance it with a subtle slide via transform when switching tabs. */
.tab-bar { position: relative; }
.tab-item { transition: color .15s ease, border-color .25s cubic-bezier(.4,0,.2,1); }

/* ── Refined toolbar layout ───────────────────────────────────
   Allow the toolbar to flex its items so density button + last-updated
   chip + refresh button align nicely on the right. */
.toolbar .toolbar-actions {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ════════════════════════════════════════════════════════════════
   SPRINT 4 — Sheet panel, Activity feed, Quick filters
   ════════════════════════════════════════════════════════════════ */

/* ── Sheet (slide-in panel from the right edge) ──────────────
   A reusable container for "side context" content — activity feeds,
   detail views, multi-step forms — that doesn't disrupt the main
   layout. Lives outside any section, mounted once at body root.
   Open via JS: showSheet({ title, body, footer }) returns a handle. */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(15,23,42,.45); backdrop-filter: blur(3px);
  display: none; opacity: 0;
  transition: opacity .22s ease;
}
.sheet-backdrop.open { display: block; opacity: 1; }
html.dark .sheet-backdrop { background: rgba(0,0,0,.6); }

.sheet-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 95vw;
  background: #fff; z-index: 1501;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 40px -20px rgba(15,23,42,.25);
}
.sheet-panel.open { transform: translateX(0); }
html.dark .sheet-panel { background: #111827; color: #e5e7eb; }

.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
html.dark .sheet-header { border-bottom-color: #1f2937; }
.sheet-header h3 {
  margin: 0; font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.sheet-header h3 .lucide { color: #06c; }
html.dark .sheet-header h3 .lucide { color: #60a5fa; }
.sheet-close {
  background: transparent; border: 0; cursor: pointer;
  padding: 6px; border-radius: 6px; color: #64748b;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s ease;
}
.sheet-close:hover { background: #f1f5f9; color: #0f172a; }
html.dark .sheet-close { color: #94a3b8; }
html.dark .sheet-close:hover { background: #1f2937; color: #f1f5f9; }

.sheet-body  { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; }
.sheet-footer{ flex-shrink: 0; padding: 12px 18px; border-top: 1px solid #e2e8f0; background: #f8fafc; }
html.dark .sheet-footer { border-top-color: #1f2937; background: #0f172a; }
@media (prefers-reduced-motion: reduce) {
  .sheet-panel, .sheet-backdrop { transition: none; }
}

/* ── Activity feed items (rendered inside a Sheet) ─────────── */
.af-empty {
  text-align: center; padding: 40px 16px; color: #94a3b8;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.af-empty .lucide { width: 32px; height: 32px; stroke-width: 1.5; color: #cbd5e1; }
html.dark .af-empty .lucide { color: #475569; }
.af-item {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.af-item:last-child { border-bottom: 0; }
html.dark .af-item { border-bottom-color: #1f2937; }
.af-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eff6ff; color: #1d4ed8;
}
html.dark .af-icon { background: #0c1f3a; color: #93c5fd; }
.af-icon.create  { background: #ecfdf5; color: #065f46; }
.af-icon.update  { background: #fff7ed; color: #9a3412; }
.af-icon.delete  { background: #fef2f2; color: #991b1b; }
.af-icon.approve { background: #ecfdf5; color: #065f46; }
.af-icon.reject  { background: #fef2f2; color: #991b1b; }
html.dark .af-icon.create  { background: #052e1c; color: #6ee7b7; }
html.dark .af-icon.update  { background: #2a1d05; color: #fde68a; }
html.dark .af-icon.delete  { background: #2a0d0d; color: #fca5a5; }
html.dark .af-icon.approve { background: #052e1c; color: #6ee7b7; }
html.dark .af-icon.reject  { background: #2a0d0d; color: #fca5a5; }
.af-icon .lucide { width: 16px; height: 16px; }
.af-body { flex: 1 1 auto; min-width: 0; }
.af-actor { font-size: 12.5px; font-weight: 600; color: #0f172a; }
html.dark .af-actor { color: #f1f5f9; }
.af-action { font-size: 12.5px; color: #475569; line-height: 1.45; }
html.dark .af-action { color: #94a3b8; }
.af-action strong { color: #0f172a; }
html.dark .af-action strong { color: #cbd5e1; }
.af-time { font-size: 11px; color: #94a3b8; margin-top: 2px; }
html.dark .af-time { color: #64748b; }
.af-toolbar {
  display: flex; gap: 8px; padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0; margin-bottom: 10px;
  align-items: center;
}
html.dark .af-toolbar { border-bottom-color: #1f2937; }
.af-refresh-pill {
  margin-left: auto;
  font-size: 11px; color: #64748b;
  display: inline-flex; align-items: center; gap: 4px;
}
html.dark .af-refresh-pill { color: #94a3b8; }

/* Navbar button to open the activity feed */
.navbar-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px;
  background: transparent; border: 1px solid hsla(0,0%,100%,.15);
  color: rgba(255,255,255,.85); cursor: pointer;
  transition: all .15s ease; padding: 0; position: relative;
}
.navbar-action-btn:hover { background: hsla(0,0%,100%,.1); border-color: hsla(0,0%,100%,.3); color: #fff; }
.navbar-action-btn .lucide { width: 16px; height: 16px; }
.navbar-action-btn .nav-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px #152a52;
  display: none;
}
html.dark .navbar-action-btn .nav-dot { box-shadow: 0 0 0 2px #0f172a; }
.navbar-action-btn.has-new .nav-dot { display: block; }

/* ── Quick filter chips (Personnel table) ─────────────────── */
.quick-filter-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 16px 6px;
  border-bottom: 1px solid #f1f5f9;
}
html.dark .quick-filter-row { border-bottom-color: #1f2937; }
.qf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  color: #475569; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .14s ease;
  user-select: none;
}
.qf-chip:hover {
  background: #f1f5f9; border-color: #cbd5e1; color: #0f172a;
}
.qf-chip.active {
  background: #06c; border-color: #06c; color: #fff;
}
html.dark .qf-chip { background: #0f172a; border-color: #1f2937; color: #94a3b8; }
html.dark .qf-chip:hover { background: #1f2937; border-color: #334155; color: #cbd5e1; }
html.dark .qf-chip.active { background: #2563eb; border-color: #3b82f6; color: #f1f5f9; }
.qf-chip-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px; border-radius: 99px;
  background: #e2e8f0; color: #475569;
  font-size: 10.5px; font-weight: 700; line-height: 1;
}
.qf-chip.active .qf-chip-count { background: hsla(0,0%,100%,.25); color: #fff; }
html.dark .qf-chip-count { background: #1f2937; color: #94a3b8; }
html.dark .qf-chip.active .qf-chip-count { background: hsla(0,0%,100%,.2); color: #f1f5f9; }
.qf-chip .lucide { width: 12px; height: 12px; }

/* Special chip color hints */
.qf-chip[data-filter="expired"]:not(.active)  { color: #b91c1c; }
.qf-chip[data-filter="expiring"]:not(.active) { color: #b45309; }
.qf-chip[data-filter="active"]:not(.active)   { color: #047857; }
html.dark .qf-chip[data-filter="expired"]:not(.active)  { color: #fca5a5; }
html.dark .qf-chip[data-filter="expiring"]:not(.active) { color: #fde68a; }
html.dark .qf-chip[data-filter="active"]:not(.active)   { color: #6ee7b7; }

/* ════════════════════════════════════════════════════════════════
   SPRINT 5 — Saved views, toasts polish, tooltips, G+key hint
   ════════════════════════════════════════════════════════════════ */

/* ── Saved views dropdown ───────────────────────────────────── */
.saved-views {
  position: relative; display: inline-block;
}
.saved-views-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  color: #475569; font-size: 12.5px; font-weight: 500;
  padding: 5px 10px; border-radius: 8px;
  cursor: pointer; transition: all .14s ease;
}
.saved-views-btn:hover { background: #f1f5f9; border-color: #cbd5e1; color: #0f172a; }
.saved-views-btn .lucide { width: 13px; height: 13px; }
html.dark .saved-views-btn { background: #1f2937; border-color: #334155; color: #cbd5e1; }
html.dark .saved-views-btn:hover { background: #334155; color: #f1f5f9; }
.saved-views-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 240px; max-width: 320px;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; box-shadow: 0 12px 28px -8px rgba(15,23,42,.18);
  padding: 6px; z-index: 100;
  display: none;
  animation: cmdk-pop .18s cubic-bezier(.34,1.56,.64,1) both;
}
.saved-views.open .saved-views-menu { display: block; }
html.dark .saved-views-menu { background: #111827; border-color: #1f2937; }
.sv-group { font-size: 10.5px; font-weight: 600; text-transform: uppercase;
            letter-spacing: .06em; color: #94a3b8; padding: 6px 10px 4px; }
.sv-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  font-size: 13px; color: #334155; cursor: pointer;
  transition: background .12s ease;
}
.sv-item:hover { background: #f1f5f9; color: #0f172a; }
html.dark .sv-item { color: #cbd5e1; }
html.dark .sv-item:hover { background: #1f2937; color: #f1f5f9; }
.sv-item .lucide { width: 13px; height: 13px; color: #64748b; flex-shrink: 0; }
.sv-item-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-item-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.sv-item:hover .sv-item-actions { opacity: 1; }
.sv-item-actions button {
  background: transparent; border: 0; padding: 2px;
  color: #94a3b8; cursor: pointer; border-radius: 4px;
  display: inline-flex; align-items: center;
}
.sv-item-actions button:hover { background: #fef2f2; color: #b91c1c; }
html.dark .sv-item-actions button:hover { background: #2a0d0d; color: #fca5a5; }
.sv-item-actions .lucide { width: 12px; height: 12px; }
.sv-empty {
  padding: 10px; text-align: center; color: #94a3b8; font-size: 12px;
}
.sv-divider { height: 1px; background: #e2e8f0; margin: 4px 0; }
html.dark .sv-divider { background: #1f2937; }
.sv-save-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: 6px;
  background: #eff6ff; color: #1d4ed8; border: 0;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .14s ease;
}
.sv-save-btn:hover { background: #dbeafe; }
html.dark .sv-save-btn { background: #0c1f3a; color: #93c5fd; }
html.dark .sv-save-btn:hover { background: #1e3a8a; }
.sv-save-btn .lucide { width: 13px; height: 13px; }

/* ── Toast system visual polish ─────────────────────────────
   The api.js toast injects inline styles. We override the container
   and child element styles via attribute + structural selectors.
   `!important` is necessary because the inline styles win otherwise. */
#sbtc-toast-stack {
  top: 70px !important;                   /* below the navbar */
  right: 20px !important;
  width: 380px !important;
  gap: 10px !important;
}
#sbtc-toast-stack > div {
  background: #fff !important;
  color: #0f172a !important;
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  border-left-width: 4px !important;
  box-shadow: 0 12px 32px -8px rgba(15,23,42,.18), 0 0 0 1px rgba(15,23,42,.04) !important;
  padding: 12px 14px !important;
  font-size: 13.5px !important;
  line-height: 1.5 !important;
  align-items: center !important;
}
html.dark #sbtc-toast-stack > div {
  background: #111827 !important;
  color: #e5e7eb !important;
  border-color: #1f2937 !important;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04) !important;
}
/* Tone-aware left accent (the api.js bg is a different color per type;
   we read it through the inline style attribute via :is() selectors). */
#sbtc-toast-stack > div[style*="#28a745"] { border-left-color: #10b981 !important; }
#sbtc-toast-stack > div[style*="#dc3545"] { border-left-color: #ef4444 !important; }
#sbtc-toast-stack > div[style*="#fb8c00"] { border-left-color: #f59e0b !important; }
#sbtc-toast-stack > div[style*="#0066cc"] { border-left-color: #06c    !important; }
/* The icon span inside each toast — re-color it from the matching tone */
#sbtc-toast-stack > div[style*="#28a745"] > span:first-child { color: #10b981 !important; }
#sbtc-toast-stack > div[style*="#dc3545"] > span:first-child { color: #ef4444 !important; }
#sbtc-toast-stack > div[style*="#fb8c00"] > span:first-child { color: #f59e0b !important; }
#sbtc-toast-stack > div[style*="#0066cc"] > span:first-child { color: #06c    !important; }
/* Close (×) and action buttons readable on the new white background */
#sbtc-toast-stack > div > button {
  color: #94a3b8 !important;
  background: transparent !important;
  border: 0 !important;
}
#sbtc-toast-stack > div > button:hover { color: #0f172a !important; }
html.dark #sbtc-toast-stack > div > button:hover { color: #f1f5f9 !important; }
/* Optional action button (if api.js renders one) — make it readable */
#sbtc-toast-stack > div > button[style*="rgba(255,255,255,.2)"] {
  background: #f1f5f9 !important;
  color: #1d4ed8 !important;
  border: 1px solid #e2e8f0 !important;
  font-weight: 600 !important;
}
html.dark #sbtc-toast-stack > div > button[style*="rgba(255,255,255,.2)"] {
  background: #1f2937 !important; color: #93c5fd !important; border-color: #334155 !important;
}

/* ── Tooltip system (data-tip attribute, CSS-only) ──────────
   Add `data-tip="hint text"` to any element to get a hover tooltip.
   Position can be controlled with `data-tip-pos="top|bottom|left|right"`,
   defaults to top. Uses a pseudo-element so we don't need extra DOM. */
[data-tip] { position: relative; }
[data-tip]:before, [data-tip]:after {
  pointer-events: none;
  opacity: 0; transition: opacity .14s ease, transform .14s ease;
  transform: translateY(2px);
  position: absolute; z-index: 999;
}
[data-tip]:before {
  content: attr(data-tip);
  background: #0f172a; color: #f1f5f9;
  padding: 5px 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; line-height: 1.35;
  white-space: nowrap; max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(2px);
}
[data-tip]:after {
  content: ''; width: 0; height: 0;
  border: 5px solid transparent;
  border-top-color: #0f172a;
  bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%) translateY(2px);
}
[data-tip]:hover:before, [data-tip]:hover:after,
[data-tip]:focus-visible:before, [data-tip]:focus-visible:after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
html.dark [data-tip]:before { background: #e5e7eb; color: #0f172a; }
html.dark [data-tip]:after  { border-top-color: #e5e7eb; }
/* Position variants */
[data-tip][data-tip-pos="bottom"]:before { top: calc(100% + 6px); bottom: auto; }
[data-tip][data-tip-pos="bottom"]:after  { top: calc(100% - 4px); bottom: auto;
                                            border-top-color: transparent;
                                            border-bottom-color: #0f172a; }
html.dark [data-tip][data-tip-pos="bottom"]:after { border-bottom-color: #e5e7eb; }
@media (prefers-reduced-motion: reduce) {
  [data-tip]:before, [data-tip]:after { transition: none; }
}

/* ── G+key hint chip ─────────────────────────────────────── */
.gkey-hint {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,.92); color: #f1f5f9;
  padding: 10px 16px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.4);
  z-index: 2500; display: none;
  align-items: center; gap: 10px;
  animation: gkey-fade-in .14s ease both;
}
.gkey-hint.open { display: inline-flex; }
.gkey-hint kbd {
  background: hsla(0,0%,100%,.12);
  border: 1px solid hsla(0,0%,100%,.18);
  border-radius: 4px; padding: 1px 6px;
  font-family: ui-monospace, monospace; font-size: 11px;
}
@keyframes gkey-fade-in { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
