/* ═══════════════════════════════════════════════════════════════════════════
   GenAI Mindset — ADMIN PANEL DESIGN SYSTEM

   Self-contained. This file deliberately does NOT reuse styles.css:
   that sheet sets `html, body { overflow: hidden }` for the full-viewport
   brain canvas, which would make a scrolling roster table unusable, and it
   carries ~4,100 lines of learner-experience styling the panels never need.
   The tokens below mirror styles.css :root so the two stay recognisably
   the same brand — keep them in sync by hand if the brand moves.

   The chart palette is COMPUTED, not chosen by eye. See docs/ADMIN.md
   § Chart palette for the derivation and the validator output. Do not
   substitute raw brand hexes here: #AE99FF, #19F4D4, #36DBFF, #BDEF00 and
   #FF7E1D all sit at OKLCH L 0.73–0.89, outside the dark-surface band, and
   fail the lightness gate as chart marks. They are UI accents, not data ink.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  /* Brand surfaces and ink — mirrors styles.css */
  --dark: #1a1a1d;
  --light: #F9F9F9;
  --purple: #AE99FF;
  --purple-bright: #CDBEFF;
  --purple-dim: rgba(174, 153, 255, 0.15);
  --purple-border: rgba(174, 153, 255, 0.35);
  --purple-glow: rgba(174, 153, 255, 0.2);
  --ease-brand: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 140ms;
  --dur-med: 240ms;
  --dur-slow: 480ms;

  /* Panel-specific elevation surfaces. The learner experience has one
     surface (the brain sits on the canvas); a data panel needs three. */
  --surface-0: #1a1a1d;
  --surface-1: #212125;
  --surface-2: #27272c;
  --surface-3: #2e2e34;
  --hairline: rgba(249, 249, 249, 0.09);
  --hairline-strong: rgba(249, 249, 249, 0.16);

  /* Ink. Text NEVER wears a series colour, and marks never wear text ink. */
  --ink-primary: #F9F9F9;
  --ink-secondary: rgba(249, 249, 249, 0.78);
  --ink-muted: rgba(249, 249, 249, 0.52);
  --ink-faint: rgba(249, 249, 249, 0.34);

  /* ── Chart: categorical. FIXED ORDER, never cycled. ──
     5 slots pass the adjacent gates (bar/line/stacked): worst adjacent
     CVD ΔE 14.7 (deutan), normal-vision 20.7.
     Scatter/bubble/choropleth cap at THREE slots — all five all-pairs fails
     (lime↔orange ΔE 1.5 deutan). Past three: fold to "Other", or facet. */
  --series-1: #836dcf; /* purple */
  --series-2: #00aa93; /* teal   */
  --series-3: #e36b00; /* orange */
  --series-4: #00a3c1; /* cyan   */
  --series-5: #7fa100; /* lime   */

  /* Chart: ordinal ramp — funnel stages, tiers. One hue, ΔL 0.08. */
  --ord-1: #ded8ff;
  --ord-2: #c5b9ff;
  --ord-3: #ad98fe;
  --ord-4: #957fe3;
  --ord-5: #7d67c8;
  --ord-6: #674fae;

  /* Chart: sequential — continuous magnitude, heatmap cells. */
  --seq-1: #ded8ff;
  --seq-2: #c5b9ff;
  --seq-3: #ad98fe;
  --seq-4: #957fe3;
  --seq-5: #7d67c8;
  --seq-6: #674fae;
  --seq-7: #513794;

  /* Chart: diverging — cool ↔ warm with a NEUTRAL GREY midpoint.
     Never a hue at the midpoint: the middle must read as "nothing". */
  --div-cool-2: #00b1d0;
  --div-cool-1: #0096b1;
  --div-mid: #3a3a3f;
  --div-warm-1: #d16200;
  --div-warm-2: #f47404;

  /* Status — RESERVED. Never reused as a series colour, and never colour
     alone: every status ships with an icon and a text label. */
  --status-good: #008e7b;
  --status-warning: #ad9000;
  --status-critical: #d61b2a;
  --status-good-bg: rgba(0, 142, 123, 0.16);
  --status-warning-bg: rgba(173, 144, 0, 0.16);
  --status-critical-bg: rgba(214, 27, 42, 0.16);

  /* Chart furniture — recessive by design. */
  --grid: rgba(249, 249, 249, 0.10);
  --axis: rgba(249, 249, 249, 0.22);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
}

/* ─── RESET & BASE ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  /* The panels SCROLL. This is the deliberate difference from styles.css. */
  background: var(--surface-0);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--surface-0);
  color: var(--ink-primary);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── ACCESSIBILITY ──────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sr-only-focusable:focus {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  width: auto; height: auto; padding: 10px 20px; margin: 0;
  overflow: visible; clip: auto; z-index: 9999;
  background: var(--purple); color: var(--dark);
  font-family: 'DM Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.14em; border-radius: 100px;
}

/* ─── TYPE SCALE ─────────────────────────────────────────────────────────── */
.a-display {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-weight: 800;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.a-h2 {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-weight: 800; font-size: clamp(20px, 1.8vw, 26px); line-height: 1.15;
}
.a-h3 { font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: 17px; }

/* The programme's signature label: DM Mono, 11px, uppercase, wide tracking. */
.a-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--purple);
}
.a-label--muted { color: var(--ink-muted); }

.a-body { color: var(--ink-secondary); }
.a-mono { font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; }
.a-muted { color: var(--ink-muted); }
.a-num { font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; }

/* ─── APP SHELL ──────────────────────────────────────────────────────────── */
.a-shell { display: flex; flex-direction: column; min-height: 100vh; }

.a-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 0 clamp(16px, 3vw, 40px);
  height: 64px;
  background: rgba(26, 26, 29, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.a-topbar-logo { width: 34px; height: auto; flex-shrink: 0; }
.a-topbar-title {
  font-family: 'DM Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-secondary);
}
.a-topbar-title strong { color: var(--ink-primary); font-weight: 500; }
.a-topbar-spacer { margin-left: auto; }

/* A standing marker that this is not the learner experience. */
.a-scope-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--purple-dim); border: 1px solid var(--purple-border);
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--purple);
}
.a-scope-chip--super {
  background: rgba(227, 107, 0, 0.14);
  border-color: rgba(227, 107, 0, 0.4);
  color: #e36b00;
}

.a-main {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 44px) clamp(16px, 3vw, 40px) 96px;
}

.a-page-head { margin-bottom: 32px; }
.a-page-head .a-label { margin-bottom: 14px; display: block; }
.a-page-head .a-body { margin-top: 12px; max-width: 68ch; }

/* ─── TABS ───────────────────────────────────────────────────────────────── */
.a-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 28px;
}
.a-tab {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 12px 16px; position: relative;
  font-family: 'DM Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-muted);
  transition: color var(--dur-fast) var(--ease-brand);
}
.a-tab:hover { color: var(--ink-secondary); }
.a-tab[aria-selected="true"] { color: var(--purple); }
.a-tab[aria-selected="true"]::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; background: var(--purple); border-radius: 2px 2px 0 0;
}
.a-tabpanel[hidden] { display: none !important; }

/* ─── CARDS ──────────────────────────────────────────────────────────────── */
.a-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2vw, 26px);
}
.a-card--flush { padding: 0; overflow: hidden; }
.a-card-head {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.a-card-head .a-label { margin: 0; }
.a-card-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.a-card-note { color: var(--ink-muted); font-size: 13px; margin-top: 12px; }

.a-grid { display: grid; gap: clamp(14px, 1.6vw, 20px); }
.a-grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.a-grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.a-grid--4 { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.a-section { margin-bottom: clamp(28px, 3.5vw, 44px); }

/* ─── STAT TILE ──────────────────────────────────────────────────────────────
   A single number is not a chart. Magnitude with no comparison gets a tile.
   No sparkline unless there is a real series behind it. */
.a-stat {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.a-stat-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted);
}
.a-stat-value {
  font-family: 'Bricolage Grotesque', Georgia, serif;
  font-weight: 800; font-size: clamp(28px, 3vw, 38px); line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-primary);
}
.a-stat-sub { font-size: 13px; color: var(--ink-muted); }
.a-stat-delta {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'DM Mono', monospace; font-size: 11px;
}
.a-stat-delta--up { color: var(--status-good); }
.a-stat-delta--down { color: var(--status-critical); }
.a-stat-delta--flat { color: var(--ink-muted); }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--purple); color: var(--dark);
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  transition: opacity var(--dur-med) ease, box-shadow var(--dur-med) ease,
              background var(--dur-med) ease;
  white-space: nowrap;
  /* The class is worn by an <a> as well as a <button> (a gate that names
     another panel gives you a way to reach it), and an anchor arrives
     underlined. */
  text-decoration: none;
}
.a-btn:hover { box-shadow: 0 0 24px rgba(174, 153, 255, 0.45); opacity: 0.92; }
.a-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.a-btn--ghost {
  background: transparent; color: var(--purple);
  border: 1px solid var(--purple-border);
}
.a-btn--ghost:hover { background: var(--purple-dim); box-shadow: none; }
.a-btn--quiet {
  background: transparent; color: var(--ink-secondary);
  border: 1px solid var(--hairline-strong);
}
.a-btn--quiet:hover { background: var(--surface-2); color: var(--ink-primary); box-shadow: none; }
.a-btn--danger {
  background: transparent; color: var(--status-critical);
  border: 1px solid rgba(214, 27, 42, 0.45);
}
.a-btn--danger:hover { background: var(--status-critical-bg); box-shadow: none; }
.a-btn--sm { padding: 7px 14px; font-size: 10px; letter-spacing: 0.12em; }
.a-btn--block { width: 100%; }

.a-btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ─── FORMS ──────────────────────────────────────────────────────────────── */
.a-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.a-field-label {
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-muted);
}
.a-field-label .a-req { color: var(--purple); margin-left: 3px; }
.a-input, .a-select, .a-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  font-size: 15px;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.a-input::placeholder, .a-textarea::placeholder { color: var(--ink-faint); }
.a-input:focus, .a-select:focus, .a-textarea:focus {
  outline: none;
  border-color: var(--purple-border);
  box-shadow: 0 0 0 3px rgba(174, 153, 255, 0.14);
}
.a-input[aria-invalid="true"], .a-select[aria-invalid="true"] {
  border-color: rgba(214, 27, 42, 0.6);
}
.a-textarea { min-height: 96px; resize: vertical; font-family: inherit; }
.a-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23AE99FF' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.a-field-error {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--status-critical);
}
.a-field-hint { font-size: 12px; color: var(--ink-muted); }
.a-form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.a-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.a-check input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--purple); flex-shrink: 0; }

/* Copy-a-link row — the issued magic link is the panel's main artefact. */
.a-copyrow { display: flex; gap: 8px; align-items: stretch; }
.a-copyrow .a-input {
  font-family: 'DM Mono', monospace; font-size: 12px;
  text-overflow: ellipsis;
}

/* CSV drop zone */
.a-drop {
  border: 1.5px dashed var(--purple-border);
  border-radius: var(--radius);
  background: var(--purple-dim);
  padding: 34px 24px;
  text-align: center;
  cursor: pointer;
  transition: background var(--dur-med) ease, border-color var(--dur-med) ease;
}
.a-drop:hover, .a-drop.is-over {
  background: rgba(174, 153, 255, 0.22);
  border-color: var(--purple);
}
.a-drop-title { font-size: 16px; margin-bottom: 6px; }
.a-drop input[type="file"] { display: none; }

/* ─── BADGES ─────────────────────────────────────────────────────────────────
   Status is never colour alone: the dot is decorative, the word carries it. */
.a-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  white-space: nowrap;
  background: var(--surface-3); color: var(--ink-secondary);
  border: 1px solid var(--hairline);
}
.a-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.a-badge--good { background: var(--status-good-bg); color: var(--status-good); border-color: rgba(0, 142, 123, 0.4); }
.a-badge--warning { background: var(--status-warning-bg); color: var(--status-warning); border-color: rgba(173, 144, 0, 0.4); }
.a-badge--critical { background: var(--status-critical-bg); color: var(--status-critical); border-color: rgba(214, 27, 42, 0.4); }
.a-badge--neutral { color: var(--ink-muted); }
.a-badge--accent { background: var(--purple-dim); color: var(--purple); border-color: var(--purple-border); }

/* ─── TABLES ─────────────────────────────────────────────────────────────────
   The roster. Also the table VIEW that every chart must be able to fall back
   to — identity is never carried by colour alone. */
.a-table-wrap { overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.a-table caption { text-align: left; padding: 0 0 12px; color: var(--ink-muted); font-size: 13px; }
.a-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  text-align: left; padding: 11px 14px; white-space: nowrap;
  font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-muted);
  border-bottom: 1px solid var(--hairline-strong);
}
.a-table th[aria-sort] { cursor: pointer; user-select: none; }
.a-table th[aria-sort]:hover { color: var(--ink-secondary); }
.a-table th[aria-sort="ascending"]::after { content: ' ↑'; color: var(--purple); }
.a-table th[aria-sort="descending"]::after { content: ' ↓'; color: var(--purple); }
.a-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-secondary);
  vertical-align: middle;
}
.a-table tbody tr { transition: background var(--dur-fast) ease; }
.a-table tbody tr:hover { background: var(--surface-2); }
.a-table td.a-td-name { color: var(--ink-primary); }
.a-table td.a-td-num { text-align: right; font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; }
.a-table td.a-td-actions { text-align: right; white-space: nowrap; }
.a-table--compact td, .a-table--compact th { padding: 8px 12px; }

/* Inline progress bar inside a roster row. 4px rounded data-end,
   anchored to the track's start — a mark, not a decoration. */
.a-prog { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.a-prog-track {
  flex: 1; height: 6px; border-radius: 3px;
  background: rgba(249, 249, 249, 0.10); overflow: hidden;
}
.a-prog-fill {
  height: 100%; border-radius: 3px; background: var(--series-1);
  transition: width var(--dur-slow) var(--ease-brand);
}
.a-prog-text {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums; min-width: 34px; text-align: right;
}

/* ─── TOOLBAR (filters — one row, above the charts) ──────────────────────── */
.a-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px;
}
.a-toolbar .a-input, .a-toolbar .a-select { width: auto; min-width: 160px; }
.a-toolbar-spacer { margin-left: auto; }
.a-search { position: relative; flex: 1 1 220px; max-width: 340px; }
.a-search .a-input { padding-left: 36px; }
.a-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
}

/* Segmented time-range control */
.a-seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: 999px; padding: 2px; }
.a-seg button {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 6px 14px; border-radius: 999px;
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-muted);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.a-seg button[aria-pressed="true"] { background: var(--purple-dim); color: var(--purple); }
.a-seg button:hover { color: var(--ink-primary); }

/* ─── CHARTS ─────────────────────────────────────────────────────────────────
   Charts are inline SVG built in admin-charts.js. These classes are the
   furniture: recessive grid and axes, ink-coloured labels, a 2px surface gap
   between adjacent fills, and a hover layer on every plotted form. */
.a-chart { position: relative; width: 100%; }
.a-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.a-chart-grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.a-chart-axis line, .a-chart-axis path { stroke: var(--axis); stroke-width: 1; fill: none; }
.a-chart-axis text, .a-chart-tick {
  font-family: 'DM Mono', monospace; font-size: 10px;
  fill: var(--ink-muted); letter-spacing: 0.06em;
}
.a-chart-label { font-family: 'DM Mono', monospace; font-size: 11px; fill: var(--ink-secondary); }
.a-chart-value { font-family: 'DM Mono', monospace; font-size: 11px; fill: var(--ink-primary); font-variant-numeric: tabular-nums; }
/* 2px surface gap between neighbouring fills — stacked segments and bars alike */
.a-chart-bar { stroke: var(--surface-1); stroke-width: 2; }
.a-chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* A 2px surface ring keeps overlapping marks readable */
.a-chart-dot { stroke: var(--surface-1); stroke-width: 2; }
.a-chart-hit { fill: transparent; cursor: pointer; }
.a-chart-crosshair { stroke: var(--hairline-strong); stroke-width: 1; stroke-dasharray: 3 3; }

.a-legend {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.a-legend-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-secondary);
}
.a-legend-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.a-tooltip {
  position: absolute; z-index: 30; pointer-events: none;
  min-width: 132px; padding: 9px 12px;
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  font-size: 12px; color: var(--ink-secondary);
  opacity: 0; transition: opacity var(--dur-fast) ease;
}
.a-tooltip.is-visible { opacity: 1; }
.a-tooltip-title {
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-muted); margin-bottom: 6px;
}
.a-tooltip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.a-tooltip-row b { color: var(--ink-primary); font-family: 'DM Mono', monospace; font-weight: 500; }

/* Toggle between a chart and its table view */
.a-viewtoggle { display: inline-flex; gap: 2px; }
.a-viewtoggle button {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 4px 9px; border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint);
}
.a-viewtoggle button[aria-pressed="true"] { color: var(--purple); background: var(--purple-dim); }

/* Funnel — an ordinal ramp, one bar per stage, labelled directly */
.a-funnel { display: flex; flex-direction: column; gap: 8px; }
.a-funnel-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: 14px; align-items: center; }
.a-funnel-name { font-size: 13px; color: var(--ink-secondary); }
.a-funnel-track { height: 26px; background: rgba(249, 249, 249, 0.06); border-radius: 4px; overflow: hidden; }
.a-funnel-fill { height: 100%; border-radius: 0 4px 4px 0; transition: width var(--dur-slow) var(--ease-brand); }
.a-funnel-val { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--ink-primary); font-variant-numeric: tabular-nums; }
.a-funnel-drop { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--status-critical); }

/* ─── TOASTS ─────────────────────────────────────────────────────────────── */
.a-toasts {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 10px;
  max-width: min(400px, calc(100vw - 48px));
}
.a-toast {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px;
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  font-size: 14px; color: var(--ink-secondary);
  animation: a-toast-in var(--dur-med) var(--ease-brand);
}
.a-toast--good { border-left-color: var(--status-good); }
.a-toast--critical { border-left-color: var(--status-critical); }
.a-toast-close {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--ink-faint); margin-left: auto; padding: 0 2px; line-height: 1;
}
.a-toast-close:hover { color: var(--ink-primary); }
@keyframes a-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.a-modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: a-fade-in var(--dur-med) ease;
}
.a-modal {
  width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 32px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.a-modal--wide { max-width: 900px; }
.a-modal-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.a-modal-close {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--ink-muted); margin-left: auto; font-size: 20px; line-height: 1;
}
.a-modal-close:hover { color: var(--ink-primary); }
.a-modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 26px; flex-wrap: wrap; }
@keyframes a-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ─── EMPTY / LOADING / ERROR STATES ────────────────────────────────────── */
.a-empty { text-align: center; padding: 52px 24px; color: var(--ink-muted); }
.a-empty-title { font-size: 17px; color: var(--ink-secondary); margin-bottom: 8px; }
.a-empty .a-btn { margin-top: 20px; }

.a-skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: a-shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}
.a-skeleton--line { height: 12px; margin-bottom: 9px; }
.a-skeleton--stat { height: 96px; }
.a-skeleton--chart { height: 240px; }
@keyframes a-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.a-error {
  padding: 16px 18px;
  background: var(--status-critical-bg);
  border: 1px solid rgba(214, 27, 42, 0.4);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary); font-size: 14px;
}
.a-error strong { color: var(--status-critical); }

/* A standing note for a figure whose data is partial or lagging — never
   let a number look authoritative when it is not. */
.a-caveat {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12px; color: var(--ink-muted); margin-top: 12px;
}

/* ─── GATE (the sign-in / bad-link screen) ──────────────────────────────── */
.a-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.a-gate-inner { max-width: 460px; }
.a-gate-inner .a-display { margin-bottom: 14px; }
.a-gate-inner .a-body { margin-bottom: 26px; }
.a-gate-logo { width: 60px; margin-bottom: 30px; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .a-topbar { height: 56px; gap: 12px; }
  .a-topbar-title { display: none; }
  .a-main { padding-bottom: 64px; }
  .a-grid--4, .a-grid--3, .a-grid--2 { grid-template-columns: 1fr; }
  .a-funnel-row { grid-template-columns: 1fr; gap: 5px; }
  .a-funnel-val { text-align: left; }
  .a-toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .a-table th, .a-table td { padding: 10px 11px; }
  .a-search { max-width: none; }
}

/* ─── PRINT (an admin exporting a cohort report) ────────────────────────── */
@media print {
  .a-topbar, .a-toolbar, .a-btn, .a-tabs, .a-toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .a-card, .a-stat { border-color: #ccc; background: #fff; }
  .a-stat-value, .a-table td.a-td-name { color: #000; }
}
