/* ==========================================================================
   AccuraTrial Command Center — design system
   2026-08-24 "quiet shell" redesign (design_handoff_command_center_redesign).

   One page, one job, one primary action. A single amber "needs you" thread
   leads from nav → tab → row → button. Amber = needs a person; green =
   healthy/live; gray = not started. Counts live in filter tabs, never in
   stat cards. Raw ids demote to mono text and expanders.

   Contents
     01 tokens              10 studies list (elevated + quiet rows)
     02 reset + base        11 study chrome (header, page tabs) + overview
     03 typography          12 documents
     04 focus + a11y        13 systems page + console
     05 controls            14 audit trail
     06 status + tone       15 states: loading / empty / failed
     07 auth screens        16 overlays: dialog, drawer, toast
     08 shell               17 domain surfaces (semantic, control, identity)
     09 home (three states) 18 responsive + motion
   ========================================================================== */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}
html { font-feature-settings: "liga" 1, "calt" 1; }

/* ── 01 tokens ─────────────────────────────────────────────────────────── */
:root {
  /* ---- ink ---- */
  --text: #0f172a;
  --text-body: #334155;            /* mono values, table copy */
  --text-dim: #5b6472;             /* secondary sentences */
  --text-secondary: #5b6472;
  --nav-muted: #6b7484;            /* inactive nav, ghost labels */
  --ghost-text: #3f4859;           /* ghost button ink */
  --text-faint: #8b94a5;           /* captions, footnotes */
  --text-placeholder: #98a1b3;     /* breadcrumb rest, mono ids */
  --text-disabled: #cbd2de;        /* separators, disabled dots */
  --selection-fg: #2b2e8c;

  /* ---- surfaces ---- */
  --surface-page: #f6f7fa;
  --surface: #ffffff;
  --surface-subtle: #fbfcfe;       /* row hover */
  --surface-muted: #f1f3f7;
  --surface-sunken: #e7eaf1;
  --surface-header: #ffffff;
  --surface-raised: #f8f9fc;       /* payload blocks, filled controls */
  --surface-inverse: #0f172a;      /* console */

  /* ---- borders ---- */
  --border: #e7eaf1;               /* cards, tab baselines */
  --border-solid: #e7eaf1;
  --border-strong: #dfe3ec;        /* ghost buttons; dashed empty states */
  --border-hover: #c2c9d6;
  --border-subtle: #eef0f5;        /* row hairlines */
  --border-inner: #f1f3f7;         /* inner rows */
  --border-payload: #edf0f6;
  --border-teach: #e2e7ee;         /* first-run step connectors */

  /* ---- sidebar (quiet, light) ---- */
  --sidebar: #fbfcfd;
  --sidebar-2: #fbfcfd;
  --sidebar-border: #e9ecf1;
  --sidebar-raised: #eef0f4;       /* active nav item */
  --sidebar-hover: #f1f3f7;
  --sidebar-text: #6b7484;
  --sidebar-text-strong: #0f172a;
  --sidebar-text-active: #0f172a;
  --sidebar-accent: #5155e8;
  --chrome-text: #e2e8f0;          /* on the console's dark ground */
  --chrome-muted: #94a3b8;
  --chrome-line: #1e293b;

  /* ---- indigo ---- */
  --brand: #5155e8;
  --brand-2: #3d41c9;
  --brand-3: #3d41c9;
  --brand-soft: #5155e8;
  --brand-tint: #eef0fb;
  --brand-tint-2: #e9ebfc;
  --brand-border: #d3d6f8;
  --brand-ring: rgba(81, 85, 232, 0.22);
  --field-focus: #5155e8;
  --focus-accent: #5155e8;

  /* ---- tone: green / amber / red / info ---- */
  --ok: #12b76a; --ok-text: #0e9f6e; --ok-tint: #e6f7f0; --ok-border: #bfe6d6;
  --warn: #f59e0b; --warn-text: #b45309; --warn-deep: #8b6a2b;
  --warn-tint: #fff8ec; --warn-border: #f0ddb0; --warn-pill: #fff3e0;
  --down: #dc2626; --down-text: #dc2626; --down-tint: #fdecec; --down-border: #f3c4c4;
  --down-soft: #fda4af;            /* error text on the console's dark ground */
  --info: #0284c7; --info-tint: #f0f7fc; --info-border: #bfdcee; --info-text: #0369a1;
  --unknown: #98a1b3; --unknown-tint: #f1f3f7; --unknown-border: #e7eaf1;

  /* ---- program accents (categorical identity only) ---- */
  --il: #7c3aed; --il-tint: #f5f3ff; --il-bright: #a78bfa;
  --osb: #0f766e; --osb-tint: #f0fdfa; --osb-bright: #2dd4bf;
  --csl: #0e7490; --csl-tint: #ecfeff; --csl-bright: #22d3ee;
  --edc: #b45309; --edc-tint: #fff8ec; --edc-bright: #fbbf24;
  --ref: #64748b; --ref-tint: #f1f3f7; --ref-bright: #94a3b8;

  /* ---- inverse-ground helpers (console, job logs) ---- */
  --on-accent: #ffffff;
  --on-dark: #e2e8f0;
  --on-dark-dim: #94a3b8;
  --on-dark-faint: #94a3b8;
  --on-dark-accent: #a5b4fc;
  --fg: #0f172a;
  --fg-muted: #5b6472;

  /* ---- radii ---- */
  --radius-xs: 7px;                /* nav items */
  --radius-sm: 8px;
  --radius-md: 9px;                /* buttons */
  --radius-lg: 12px;               /* elevated rows, console */
  --radius-xl: 14px;               /* cards */
  --radius: var(--radius-md);
  --radius-pill: 999px;

  /* ---- spacing ---- */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px;
  --space-9: 56px;

  /* ---- type scale (handoff §Design Tokens) ---- */
  --fs-label: 11px;   --lh-label: 14px;     /* caps section labels */
  --fs-caption: 11.5px;                     /* captions, footers */
  --fs-micro: 12px;   --lh-micro: 16px;     /* meta */
  --fs-meta: 12.5px;                        /* reasons, meta sentences */
  --fs-xs: 12px;      --lh-xs: 18px;
  --fs-small: 13px;   --fs-sm: 13.5px; --lh-sm: 21px;   /* UI default */
  --fs-body: 13.5px;
  --fs-base: 15px;    --lh-base: 24px;      /* hero body */
  --fs-lead: 14.5px;                        /* row names */
  --fs-h3: 15.5px;
  --fs-h2: 17px;
  --fs-h1: 24px;                            /* list pages */
  --fs-display: 30px;                       /* home hero */

  --lh-tight: 1.2;
  --lh-snug: 1.45;
  --lh-body: 1.6;

  /* ---- elevation ---- */
  --shadow-panel: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-elevated: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-panel-hover: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-dialog: 0 8px 16px -4px rgba(15, 23, 42, 0.10), 0 24px 56px -12px rgba(15, 23, 42, 0.25);
  --shadow-xs: var(--shadow-panel);
  --shadow-sm: var(--shadow-panel-hover);
  --shadow-md: var(--shadow-pop);
  --shadow-lg: var(--shadow-dialog);

  --focus-ring: 0 0 0 2px var(--surface-page), 0 0 0 4px #5155e8;
  --focus-ring-inverse: 0 0 0 2px var(--sidebar), 0 0 0 4px #5155e8;

  --font: "Inter Variable", Inter, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --sidebar-w: 220px;
  --topbar-h: 54px;
  --content-max: 1000px;
  --ease: ease-out;
  --ease-out: ease-out;
  /* Handoff §Interactions: no transitions longer than 150ms ease-out. */
  --dur-fast: 120ms;
  --dur: 150ms;
  --dur-base: 150ms;
  --dur-slow: 150ms;

  --z-dropdown: 30; --z-sticky: 20; --z-overlay: 60; --z-dialog: 70; --z-toast: 80;

  --bg-0: var(--surface-inverse);
  --bg-1: var(--surface);
  --surface-2: var(--surface-muted);
}

/* ── 02 reset + base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; }

body {
  overflow: hidden;
  background: var(--surface-page);
  color: var(--text-body);
  font: var(--fs-sm)/1.5 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-dialog { overflow: hidden; }

h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg[data-fill] { fill: currentColor; stroke: none; }
code, pre, .mono { font-family: var(--mono); font-size: var(--fs-micro); }
a { color: var(--brand); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
::selection { background: var(--brand-tint-2); color: var(--selection-fg); }
input, textarea, select { caret-color: var(--brand); }
* { scrollbar-width: thin; scrollbar-color: var(--border-hover) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-hover); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); border: 2px solid transparent; background-clip: content-box; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

.hidden { display: none !important; }
[inert] { pointer-events: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── 03 typography ─────────────────────────────────────────────────────── */
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-tight); font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); font-weight: 650; color: var(--text); letter-spacing: -0.008em; }
h4 { font-size: var(--fs-base); line-height: var(--lh-snug); font-weight: 620; color: var(--text); }

.eyebrow, .section-label {
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-placeholder); margin-bottom: 6px;
}
.lead { font-size: var(--fs-base); color: var(--text-dim); line-height: var(--lh-body); max-width: 76ch; }
.muted, .hint, .semantic-muted { color: var(--text-dim); font-size: var(--fs-small); }
.faint { color: var(--text-faint); }
.strong { color: var(--text); font-weight: 600; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 04 focus + a11y ───────────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-accent); outline-offset: 2px; }
.sidebar :focus-visible { outline: 2px solid var(--sidebar-accent); outline-offset: -2px; }
/* Underline tabs sit on a shared baseline; a tight outline collides with it. */
.tabset button:focus-visible, .page-tab:focus-visible { outline-offset: 4px; border-radius: 4px; }
.filter-pill:focus-visible, .link-action:focus-visible { outline-offset: 3px; border-radius: var(--radius-pill); }

button, [role="button"], .nav-tab, .tabset button, a.btn { min-height: 28px; }

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

/* ── 05 controls ───────────────────────────────────────────────────────── */
/* Default .btn IS the ghost button: white, hairline, quiet. At most one
   .btn-primary per page — always the next pipeline action. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 34px; padding: 8px 17px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ghost-text);
  font: 600 var(--fs-small)/1 var(--font); letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { border-color: var(--border-hover); text-decoration: none; color: var(--text); }
.btn:active { background: var(--surface-muted); }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  background: var(--brand); border-color: var(--brand); color: var(--on-accent);
  font-size: var(--fs-sm); padding: 10px 18px;
}
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-accent); }
.btn-primary:active { background: var(--brand-2); }

.btn-danger { background: var(--surface); border-color: var(--down-border); color: var(--down-text); }
.btn-danger:hover { background: var(--down-tint); border-color: var(--down-border); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-faint); font-weight: 600; }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); border-color: transparent; }

.btn-outline { background: var(--surface); border-color: var(--border-strong); }

.btn-sm { min-height: 30px; padding: 8px 15px; font-size: var(--fs-small); }
.btn-lg { min-height: 40px; padding: 11px 20px; font-size: var(--fs-sm); }

.btn[disabled], .btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.btn.is-loading { position: relative; color: transparent; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite; color: var(--text-dim);
}
.btn-primary.is-loading::after { color: var(--on-accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* Indigo text link — the quiet-row action. */
.link-action {
  font-size: var(--fs-small); font-weight: 600; color: var(--brand);
  background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap;
}
.link-action:hover { color: var(--brand-2); text-decoration: none; }

input, select, textarea {
  font: var(--fs-small)/1.45 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 7px 10px; min-height: 34px; width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-placeholder); }
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring);
}
input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--brand);
}
select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235b6472' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}
textarea { min-height: 76px; resize: vertical; line-height: var(--lh-body); }
label { font-size: var(--fs-micro); font-weight: 600; color: var(--text-dim); }
.field { display: grid; gap: 5px; margin-bottom: var(--space-3); }
.field > label { color: var(--text-body); }

/* Underline tab row — every ?tab= surface and the studies filters.
   13.5px, 22px gap, on a 1px baseline; active = ink 600 with a 2px indigo
   underline pulled onto the baseline. */
.tabset {
  display: flex; gap: 22px; padding: 0; margin: 0 0 var(--space-5);
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; width: 100%; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.tabset::-webkit-scrollbar { display: none; }
.tabset button, .tabset a {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 7px 1px 9px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font: 500 var(--fs-sm)/1 var(--font); color: var(--nav-muted); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; border-radius: 0;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tabset button:hover, .tabset a:hover { color: var(--text); background: transparent; text-decoration: none; }
.tabset button.is-active, .tabset a.is-active,
.tabset button[aria-selected="true"], .tabset a[aria-current="page"] {
  background: transparent; color: var(--text); font-weight: 600;
  border-bottom-color: var(--brand); box-shadow: none;
}
.tabset .tab-count {
  min-width: 0; height: auto; padding: 0; border-radius: 0;
  background: transparent; color: var(--text-faint);
  font-size: var(--fs-small); font-weight: 500; display: inline;
}
.tabset button.is-active .tab-count { background: transparent; color: var(--text-dim); font-weight: 600; }
.tabset .tab-count[data-tone="warning"] { background: transparent; color: var(--warn-text); }
.tabset .tab-count[data-tone="danger"] { background: transparent; color: var(--down-text); }
/* The amber dot that rides a tab needing a person. */
.tab-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none;
}

/* Filter pills — the audit trail's filters (radius 999; active = ink bg). */
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  appearance: none; cursor: pointer; white-space: nowrap;
  padding: 6px 13px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border-strong);
  font: 600 var(--fs-meta)/1.2 var(--font); color: var(--text-dim);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.filter-pill:hover { border-color: var(--border-hover); color: var(--text); }
.filter-pill.is-active {
  background: var(--surface-inverse); border-color: var(--surface-inverse); color: var(--on-accent);
}

/* ── 06 status + tone ──────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 2px 9px; border-radius: var(--radius-pill);
  border: 0; background: var(--surface-muted); color: var(--text-dim);
  font-size: var(--fs-caption); font-weight: 600; white-space: nowrap;
}
.chip .chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip svg { width: 13px; height: 13px; }
.chip[data-tone="success"] { background: var(--ok-tint); color: var(--ok-text); }
.chip[data-tone="warning"] { background: var(--warn-pill); color: var(--warn-text); }
.chip[data-tone="danger"] { background: var(--down-tint); color: var(--down-text); }
.chip[data-tone="primary"] { background: var(--brand-tint-2); color: var(--brand); }
.chip[data-tone="neutral"] { background: var(--surface-muted); color: var(--text-dim); }
.chip[data-tone="info"] { background: var(--info-tint); color: var(--info-text); }
.chip-lg { height: 26px; padding: 0 11px; font-size: var(--fs-small); }

.count-pill {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-dim);
  font-size: var(--fs-micro); font-weight: 700;
}
.count-pill[data-tone="warning"] { background: var(--warn-pill); color: var(--warn-text); }
.count-pill[data-tone="danger"] { background: var(--down-tint); color: var(--down-text); }
.count-pill[data-tone="success"] { background: var(--ok-tint); color: var(--ok-text); }

/* Status dots: 6–8px circles. Amber = needs a person; green = healthy/live;
   gray = not started. */
.dot6, .dot8 { border-radius: 50%; flex: none; background: var(--text-disabled); display: inline-block; }
.dot6 { width: 6px; height: 6px; }
.dot8 { width: 8px; height: 8px; }
[data-dot="ok"] { background: var(--ok); }
[data-dot="warn"] { background: var(--warn); }
[data-dot="down"] { background: var(--down); }
[data-dot="off"] { background: var(--text-disabled); }

/* ── 07 auth screens ───────────────────────────────────────────────────── */
.auth-wrap {
  position: fixed; inset: 0; display: grid; place-items: center; padding: var(--space-6);
  background: var(--surface-page);
  overflow: auto; z-index: 60;
}
.auth-card {
  width: min(410px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-pop);
  padding: var(--space-7) var(--space-6) var(--space-6); text-align: left;
  animation: dialog-in var(--dur-base) var(--ease-out);
}
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: var(--space-5); }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius-sm); flex: none;
  display: grid; place-items: center; color: var(--on-accent);
  background: var(--brand);
  font-weight: 800;
}
.brand-mark svg { width: 19px; height: 19px; stroke: var(--on-accent); }
.auth-h { font-size: var(--fs-h2); font-weight: 700; color: var(--text); letter-spacing: -0.013em; }
.auth-sub { font-size: var(--fs-small); color: var(--text-dim); margin: 4px 0 var(--space-5); }
.auth-note, .auth-err {
  display: none; font-size: var(--fs-small); line-height: var(--lh-snug);
  padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: var(--space-4);
}
.auth-note { background: var(--brand-tint); border: 1px solid var(--brand-border); color: var(--brand-2); }
.auth-err { background: var(--down-tint); border: 1px solid var(--down-border); color: var(--down-text); }
.auth-note.show, .auth-err.show { display: block; }
.auth-oidc { width: 100%; min-height: 38px; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; margin: var(--space-5) 0 var(--space-4);
  font-size: var(--fs-label); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
#legacy-login .btn { width: 100%; min-height: 38px; }
.auth-foot {
  margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-micro); color: var(--text-faint); line-height: var(--lh-snug);
}
.auth-guide { display: inline-block; margin-top: 10px; font-size: var(--fs-micro); font-weight: 600; }

.boot-status { display: flex; align-items: center; gap: 9px; color: var(--text-dim); font-size: var(--fs-small); }
.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-strong); border-top-color: var(--brand);
  animation: spin 0.75s linear infinite;
}

/* ── 08 shell ──────────────────────────────────────────────────────────── */
.shell {
  position: fixed; inset: 0; display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* Sidebar — 220px, quiet light ground, hairline right edge. Four items, one dot. */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; min-height: 0; color: var(--sidebar-text);
}
.sidebar-brand {
  text-decoration: none; color: inherit;
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 16px; flex: none;
}
.sidebar-brand .brand-mark {
  width: 26px; height: 26px; border-radius: var(--radius-xs);
  font-size: var(--fs-small); font-weight: 800; margin: 0;
}
.brand-title { font-size: var(--fs-sm); font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand-sub { display: none; }
a.sidebar-brand:hover { text-decoration: none; }
a.sidebar-brand:hover .brand-title { color: var(--brand); }

.nav { padding: 20px 12px; overflow-y: auto; flex: 1; min-height: 0; display: grid; gap: 2px; align-content: start; }
.nav-label {
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-placeholder); padding: var(--space-4) 10px var(--space-2);
}
.nav-label:first-child { padding-top: 0; }

.nav-tab {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-xs);
  background: transparent; color: var(--nav-muted); cursor: pointer; text-align: left;
  font: 500 var(--fs-sm)/1.3 var(--font); text-decoration: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-tab:hover { color: var(--text); background: transparent; text-decoration: none; }
.nav-tab.is-active { background: var(--sidebar-raised); color: var(--text); font-weight: 600; }
.nav-tab .nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-tab .nav-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The amber dot on "Studies" whenever any study needs a person. */
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; margin-left: auto; }

.nav-tab.is-locked { opacity: 0.45; cursor: not-allowed; }
.nav-tab.is-locked:hover { color: var(--nav-muted); background: transparent; }

/* Sidebar footer: the door to Systems, with the live count. */
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border-subtle); flex: none; }
.sidebar-systems {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: var(--radius-xs); text-decoration: none;
  font-size: var(--fs-caption); color: var(--text-faint);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sidebar-systems:hover { color: var(--text); text-decoration: none; }
.sidebar-systems.is-active { background: var(--sidebar-raised); color: var(--text); font-weight: 600; }
.sidebar-systems .dot6 { background: var(--ok); }
.sidebar-systems[data-health="warn"] .dot6 { background: var(--warn); }
.sidebar-systems[data-health="down"] .dot6 { background: var(--down); }
.sidebar-systems[data-health="unknown"] .dot6 { background: var(--text-disabled); }

/* Topbar — 54px, white, hairline bottom. Breadcrumb left, session right. */
.workspace { display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr); min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: 0 30px; background: var(--surface); border-bottom: 1px solid var(--border);
  min-width: 0;
}
.page-context { min-width: 0; display: flex; align-items: center; }
.breadcrumbs { display: flex; align-items: center; gap: 7px; font-size: var(--fs-small); color: var(--text-placeholder); min-width: 0; }
.breadcrumbs a { color: var(--text-placeholder); font-weight: 500; }
.breadcrumbs a:hover { color: var(--text); text-decoration: none; }
.breadcrumbs .crumb-sep { color: var(--text-disabled); font-weight: 400; }
.breadcrumbs .crumb-current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.session { display: flex; align-items: center; gap: var(--space-3); flex: none; position: relative; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-tint-2); color: var(--brand); border: 0;
  font-size: var(--fs-label); font-weight: 700; cursor: pointer; padding: 0;
}
.session-user { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.session-user b { font-size: var(--fs-small); color: var(--text); font-weight: 600; }
.session-user span { display: none; }
.session .btn-ghost { color: var(--text-faint); font-weight: 500; font-size: var(--fs-small); padding: 4px 6px; min-height: 0; }
.session .btn-ghost:hover { color: var(--text); background: transparent; }
.topbar-divider { display: none; }

/* Avatar menu: User guide + Sign out. */
.session-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: var(--z-dropdown);
  min-width: 180px; padding: 6px; display: grid; gap: 1px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
}
.session-menu[hidden] { display: none; }
.session-menu a, .session-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  border: 0; border-radius: var(--radius-xs); background: transparent; cursor: pointer;
  font: 500 var(--fs-small)/1.3 var(--font); color: var(--text-body); text-decoration: none;
}
.session-menu a:hover, .session-menu button:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.session-menu .menu-note {
  padding: 7px 10px 5px; font-size: var(--fs-label); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-placeholder);
}

/* The topbar study context: current study (or "No study") + switch menu. */
.study-picker { position: relative; }
.study-picker-btn {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 260px; min-height: 30px; padding: 5px 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); cursor: pointer;
  font: 600 var(--fs-small)/1.2 var(--font); color: var(--text);
  transition: border-color var(--dur) var(--ease);
}
.study-picker-btn:hover { border-color: var(--border-hover); }
.study-picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-picker.is-empty .study-picker-label { color: var(--text-faint); font-weight: 500; }
.study-picker-caret { color: var(--text-faint); font-size: 10px; }
.study-picker-menu {
  left: auto; right: 0; min-width: 280px; max-width: 360px;
  max-height: min(420px, 70vh); overflow-y: auto;
}
.study-picker-item {
  display: flex !important; align-items: center; gap: 9px; min-width: 0;
}
.study-picker-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-picker-item.is-current { background: var(--sidebar-raised); font-weight: 600; color: var(--text); }
.study-picker-check { color: var(--ok-text); font-weight: 700; flex: none; }
.study-picker-all {
  margin-top: 4px; border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-xs) var(--radius-xs);
  color: var(--brand) !important; font-weight: 600 !important;
}
.menu-empty { padding: 10px; font-size: var(--fs-micro); color: var(--text-faint); }

.job-indicator {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px;
  border: 1px solid var(--brand-border); border-radius: var(--radius-pill);
  background: var(--brand-tint); color: var(--brand-2); cursor: pointer;
  font: 650 var(--fs-micro)/1 var(--font); max-width: 300px;
}
.job-indicator:hover { background: var(--brand-tint-2); }
.job-indicator-spinner {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid var(--brand-ring); border-top-color: var(--brand);
  animation: spin 0.75s linear infinite;
}
.job-indicator-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-indicator-warn { color: var(--warn-text); font-weight: 700; }

/* Content: the page ground; centered column, generous top. */
.main-content {
  overflow-y: auto; overflow-x: hidden;
  padding: 44px 56px var(--space-9);
  min-width: 0; scroll-behavior: smooth;
  background: var(--surface-page);
  display: flex; flex-direction: column;
}
#view-host { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
#view-host > .view { flex: 1 0 auto; }
.view { max-width: var(--content-max); margin: 0 auto; width: 100%; }
.view > * + * { margin-top: var(--space-6); }
/* The hero home centers vertically inside the scroll area. */
.view.is-hero { display: grid; align-content: center; }
.view.is-hero > * + * { margin-top: 0; }

.section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-5); flex-wrap: wrap;
}
.section-head p { color: var(--text-dim); font-size: var(--fs-sm); margin-top: 6px; max-width: 76ch; }
.section-head-actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

.content-section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4);
  flex-wrap: wrap; padding-bottom: var(--space-3); border-bottom: 1px solid var(--border);
}

.app-footer { display: none; }

/* ── cards, kv, metrics, callouts ─────────────────────────────────────── */
.card, .panel, .control-card, .semantic-card, .overview-card, .tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: none;
}
.card { padding: 18px 22px; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.card-head h2, .card-head h3 { margin: 0; font-size: var(--fs-h3); }
.card-sub { font-size: var(--fs-micro); color: var(--text-faint); margin-top: 3px; }
.card-link { font-size: var(--fs-meta); font-weight: 600; color: var(--brand); white-space: nowrap; }
.card-link:hover { color: var(--brand-2); text-decoration: none; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }

.kv, .semantic-kv { display: grid; gap: 0; }
.kv { grid-template-columns: minmax(120px, auto) 1fr; }
.kv dt { font-size: var(--fs-micro); color: var(--text-faint); padding: 7px 0; font-weight: 600; }
.kv dd { font-size: var(--fs-small); color: var(--text-body); padding: 7px 0; margin: 0; }
.kv dt + dd { border-bottom: 1px solid var(--border-subtle); }
.kv dt { border-bottom: 1px solid var(--border-subtle); }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }

.semantic-kv-row, .kv-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4);
  padding: 7px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-small);
}
.semantic-kv-row:last-child, .kv-row:last-child { border-bottom: 0; }
.semantic-kv-row > span:first-child, .kv-row > span:first-child { color: var(--text-dim); }
.semantic-kv-row b, .kv-row b { color: var(--text); font-weight: 620; font-variant-numeric: tabular-nums; }
.semantic-kv-row b[data-absent], .kv-row b[data-absent],
.semantic-stat .n[data-absent], .metric .n[data-absent] {
  color: var(--text-faint); font-weight: 500; font-style: normal;
}
.semantic-kv-row b[data-risk="true"] { color: var(--down-text); }
.semantic-stat .n[data-absent], .metric .n[data-absent] { font-size: var(--fs-base); }

.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.metric {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4); display: grid; gap: 3px;
}
.metric .n { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .l { font-size: var(--fs-micro); color: var(--text-dim); font-weight: 600; }
.metric .n.is-text { font-size: var(--fs-base); letter-spacing: -0.01em; line-height: 1.25; }
.metric[data-tone="danger"] .n  { color: var(--down-text); }
.metric[data-tone="warning"] .n { color: var(--warn-text); }
.metric[data-tone="success"] .n { color: var(--ok-text); }
.metric a, .metric .metric-link {
  font-size: var(--fs-micro); font-weight: 650; color: var(--brand); background: none; border: 0;
  padding: 0; cursor: pointer; text-align: left; justify-self: start;
}

.callout {
  display: flex; gap: 11px; padding: 12px 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--info-border); background: var(--info-tint); color: var(--info-text);
  font-size: var(--fs-small); line-height: var(--lh-snug);
  align-items: center; justify-content: space-between;
}
.callout svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.callout[data-tone="warning"] { border-color: var(--warn-border); background: var(--warn-tint); color: var(--warn-text); }
.callout[data-tone="danger"] { border-color: var(--down-border); background: var(--down-tint); color: var(--down-text); }
.callout[data-tone="success"] { border-color: var(--ok-border); background: var(--ok-tint); color: var(--ok-text); }
.callout[data-tone="neutral"] { border-color: var(--border); background: var(--surface-muted); color: var(--text-body); }
.callout-body { flex: 1; min-width: 0; }
.callout-title { font-weight: 650; display: block; margin-bottom: 2px; }
.callout .btn { align-self: center; }

/* ── 09 home — three states ───────────────────────────────────────────── */
.hero { max-width: 920px; margin: 0 auto; width: 100%; }
.hero.is-first-run { max-width: 560px; text-align: center; }

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 14px;
}
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.hero-eyebrow[data-tone="warning"] { color: var(--warn-text); }
.hero-eyebrow[data-tone="warning"] .dot { background: var(--warn); }
.hero-eyebrow[data-tone="success"] { color: var(--ok-text); }
.hero-eyebrow[data-tone="success"] .dot { background: var(--ok); }

.hero-h1 {
  font-size: var(--fs-display); font-weight: 700; color: var(--text);
  letter-spacing: -0.02em; line-height: 1.2;
}
.hero-body {
  font-size: var(--fs-base); color: var(--text-dim); line-height: var(--lh-body);
  margin-top: 12px; max-width: 620px;
}
.hero.is-first-run .hero-body { margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 10px; margin-top: 24px; align-items: center; }
.hero.is-first-run .hero-actions { justify-content: center; }

/* First-run: the 4-step preview. */
.hero-steps {
  display: flex; align-items: center; justify-content: center; gap: 0;
  margin-top: 52px;
}
.hero-step { display: grid; gap: 8px; justify-items: center; }
.hero-step .n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sidebar-raised); color: var(--text-faint);
  font: 700 10px/1 var(--mono);
}
.hero-step .l { font-size: var(--fs-micro); color: var(--nav-muted); }
.hero-step-line { width: 36px; height: 1px; background: var(--border-teach); margin: 0 8px 22px; }
.hero-steps-caption { margin-top: 20px; font-size: var(--fs-micro); color: var(--text-placeholder); }

/* Working: the digest under the hero. */
.hero-digest {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-top: 52px; padding-top: 20px; border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-sm); color: var(--text-dim);
}
.hero-digest a { font-weight: 600; }

/* Production: live-study rows. */
.hero-live { margin-top: 44px; border-top: 1px solid var(--border-subtle); }
.hero-live-row {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 4px; border-bottom: 1px solid var(--border-subtle);
}
.hero-live-row .dot8 { background: var(--ok); }
.hero-live-name { width: 230px; flex: none; font-size: var(--fs-lead); font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-live-name:hover { color: var(--brand); text-decoration: none; }
.hero-live-nct { width: 130px; flex: none; font-family: var(--mono); font-size: var(--fs-caption); color: var(--text-placeholder); }
.hero-live-meta { flex: 1; min-width: 0; font-size: var(--fs-meta); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-live-open { flex: none; font-size: var(--fs-small); font-weight: 600; }
.hero-quiet-line { margin-top: 18px; font-size: var(--fs-meta); color: var(--text-placeholder); }
.hero-quiet-line a { font-weight: 600; }

/* ── 10 studies list ──────────────────────────────────────────────────── */
.roster { display: grid; gap: 0; }

/* The one elevated row: white card, amber border, the page's only primary. */
.roster-elevated {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--warn-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-elevated);
  padding: 16px 20px; margin-bottom: 14px;
}
.roster-elevated .dot8 { background: var(--warn); }

/* Quiet rows: hairline separated, hover tint, indigo text-link action. */
.roster-row {
  display: flex; align-items: center; gap: 18px;
  padding: 15px 20px; border-bottom: 1px solid var(--border-subtle);
  text-decoration: none; color: inherit;
  transition: background var(--dur) var(--ease);
}
.roster-row:hover { background: var(--surface-subtle); text-decoration: none; }
.roster-row .dot8 { background: var(--text-disabled); }
.roster-row[data-state="live"] .dot8 { background: var(--ok); }
.roster-row[data-state="attention"] .dot8 { background: var(--warn); }

/* The study the topbar picker is holding: indigo rail + "Current" chip. */
.roster-row.is-current { background: var(--surface); box-shadow: inset 3px 0 0 var(--brand); }
.roster-elevated.is-current { box-shadow: var(--shadow-elevated), inset 3px 0 0 var(--brand); }
.roster-name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.roster-name-line .roster-name { flex: 0 1 auto; }
.roster-current {
  flex: none; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--brand-tint-2); color: var(--brand);
  font: 650 var(--fs-micro)/1.4 var(--font);
}

.roster-id { width: 234px; flex: none; min-width: 0; }
.roster-name { display: block; font-size: var(--fs-lead); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
a.roster-name:hover { color: var(--brand); text-decoration: none; }
.roster-nct { display: block; margin-top: 2px; font-family: var(--mono); font-size: var(--fs-caption); color: var(--text-placeholder); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.roster-progress { width: 240px; flex: none; }
.seg-bar { display: flex; gap: 8px; }
.seg { width: 54px; height: 4px; border-radius: 2px; background: var(--surface-sunken); }
.seg[data-state="done"] { background: var(--ok); }
.seg[data-state="current"] { background: var(--warn); }
.seg-caption { margin-top: 7px; font-size: var(--fs-caption); color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.roster-reason { flex: 1; min-width: 0; font-size: var(--fs-meta); color: var(--text-dim); line-height: var(--lh-snug); }
.roster-action { flex: none; }

/* ── 11 study chrome + overview ───────────────────────────────────────── */
.study-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5); }
.study-head-id { min-width: 0; }
.study-head-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.study-head-title h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.01em; }
.study-pill {
  display: inline-flex; align-items: center; height: 22px; padding: 3px 10px;
  border-radius: var(--radius-pill); font-size: var(--fs-caption); font-weight: 600;
  background: var(--surface-muted); color: var(--text-dim); white-space: nowrap;
}
.study-pill[data-tone="success"] { background: var(--ok-tint); color: var(--ok-text); }
.study-pill[data-tone="warning"] { background: var(--warn-pill); color: var(--warn-text); }
.study-pill[data-tone="danger"] { background: var(--down-tint); color: var(--down-text); }
.study-pill[data-tone="primary"] { background: var(--brand-tint-2); color: var(--brand); }
.study-head-sub { margin-top: 7px; font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-placeholder); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-head-utility { flex: none; }

/* Page tab row: same underline style as the studies filters. */
.page-tabs {
  display: flex; gap: 22px; border-bottom: 1px solid var(--border);
  margin-top: 18px; overflow-x: auto; scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 7px 1px 9px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: var(--fs-sm); font-weight: 500; color: var(--nav-muted); text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.page-tab:hover { color: var(--text); text-decoration: none; }
.page-tab.is-active { color: var(--text); font-weight: 600; border-bottom-color: var(--brand); }

/* Pipeline card: one white card, four cells split by hairlines. */
.pipe-card {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden;
}
.pipe-cell { position: relative; flex: 1; min-width: 0; padding: 18px 20px; border-left: 1px solid var(--border-subtle); }
.pipe-cell:first-child { border-left: 0; }
/* Every cell is a door to its step's screen; the ↗ opens the native system. */
.pipe-cell-body { display: block; color: inherit; text-decoration: none; }
.pipe-cell-body:hover { text-decoration: none; }
.pipe-cell-body:hover .pipe-cell-title { color: var(--brand); }
.pipe-cell-open {
  position: absolute; top: 10px; right: 12px; padding: 2px 7px;
  border-radius: var(--radius-xs); text-decoration: none;
  font-size: var(--fs-meta); font-weight: 600; color: var(--text-faint);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pipe-cell-open:hover { color: var(--brand); background: var(--brand-tint); text-decoration: none; }
.pipe-cell-head { display: flex; align-items: center; gap: 9px; }
.pipe-mark {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--surface-muted); color: var(--text-faint);
  font: 700 10px/1 var(--mono);
}
.pipe-mark svg { width: 10px; height: 10px; stroke-width: 2.6; }
.pipe-cell[data-state="done"] .pipe-mark { background: var(--ok-tint); color: var(--ok-text); }
.pipe-cell[data-state="current"] { background: var(--warn-tint); flex: 1.3; }
.pipe-cell[data-state="current"] .pipe-mark {
  background: var(--surface); border: 1.5px solid var(--warn); color: var(--warn-text);
}
.pipe-cell-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.pipe-cell-detail { margin-top: 6px; font-size: var(--fs-micro); color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipe-cell[data-state="current"] .pipe-cell-detail { color: var(--warn-deep); }
.pipe-cell-action { display: inline-block; margin-top: 8px; font-size: var(--fs-meta); font-weight: 600; color: var(--brand); }
.pipe-cell-action:hover { color: var(--brand-2); text-decoration: none; }

/* Identity rows inside the overview card. */
.id-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border-inner);
  font-size: var(--fs-small);
}
.id-row:last-child { border-bottom: 0; }
.id-row .id-sys { flex: 1; color: var(--text-dim); }
.id-row .id-val { font-family: var(--mono); font-size: var(--fs-meta); color: var(--text-body); }
.id-row .id-ok { color: var(--ok-text); font-weight: 700; }
.id-pill {
  display: inline-flex; align-items: center; height: 20px; padding: 2px 9px;
  border-radius: var(--radius-pill); font-size: var(--fs-caption); font-weight: 600;
  background: var(--warn-pill); color: var(--warn-text); white-space: nowrap;
}

/* Governance quiet state. */
.gov-clear { display: flex; gap: 10px; align-items: flex-start; }
.gov-clear .dot6 { background: var(--ok); margin-top: 6px; }
.gov-clear-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.gov-clear-sub { margin-top: 3px; font-size: var(--fs-micro); color: var(--text-faint); }

/* Recent-actions strip: dashed, centered, teaches. */
.runs-empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 22px; text-align: center;
  font-size: var(--fs-meta); color: var(--text-placeholder);
}

/* ── 12 documents ─────────────────────────────────────────────────────── */
.doc-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; border-bottom: 1px solid var(--border-subtle);
}
.doc-name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-state { width: 150px; flex: none; font-size: var(--fs-micro); color: var(--text-dim); }
.doc-state[data-tone="warning"] { color: var(--warn-text); font-weight: 600; }
.doc-state[data-tone="success"] { color: var(--ok-text); }
.doc-meta { flex: 1.4; min-width: 0; font-size: var(--fs-meta); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-open { flex: none; font-size: var(--fs-small); font-weight: 600; }
.doc-foot { margin-top: 14px; font-size: var(--fs-meta); color: var(--text-placeholder); }
.doc-foot a { font-weight: 600; }

/* The platform-wide Documents screen: one quiet group per study. */
.doc-group { margin-top: 26px; }
.doc-group .section-label { margin-bottom: 8px; }
.doc-group-study { color: var(--text); font-weight: 700; }
.doc-group-study:hover { color: var(--brand); text-decoration: none; }

/* One bordered card per protocol, so studies never blur into one list. */
.doc-study-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 18px 22px 10px;
}
.doc-study-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.doc-study-id { min-width: 0; }
.doc-study-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-study-name { font-size: var(--fs-h3); font-weight: 700; color: var(--text); }
.doc-study-name:hover { color: var(--brand); text-decoration: none; }
.doc-study-sub { margin-top: 4px; font-family: var(--mono); font-size: var(--fs-caption); color: var(--text-placeholder); }
.doc-study-aside { display: flex; align-items: center; gap: 14px; flex: none; padding-top: 3px; }
.doc-study-count { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
.doc-study-note { margin-top: 14px; box-shadow: none; }
.doc-study-rows .doc-row { padding-left: 0; padding-right: 0; }
.doc-study-rows .doc-row:last-child { border-bottom: 0; }

.elevated-note {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--warn-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-elevated);
  padding: 16px 20px;
}
.elevated-note .dot8 { background: var(--warn); align-self: flex-start; margin-top: 7px; }
.elevated-note-body { flex: 1; min-width: 0; }
.elevated-note-title { font-size: var(--fs-lead); font-weight: 600; color: var(--text); }
.elevated-note-meta { margin-top: 4px; font-size: var(--fs-meta); color: var(--text-dim); line-height: var(--lh-snug); }
.elevated-note-actions { display: flex; gap: 10px; flex: none; align-items: center; }

/* ── 13 systems page + console ────────────────────────────────────────── */
.sys-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.sys-row { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.sys-row:last-child { border-bottom: 0; }
.sys-row > .dot8 { background: var(--text-disabled); }
.sys-row[data-state="ok"] > .dot8 { background: var(--ok); }
.sys-row[data-state="warn"] > .dot8 { background: var(--warn); }
.sys-row[data-state="down"] > .dot8 { background: var(--down); }
.sys-id { width: 280px; flex: none; min-width: 0; }
.sys-name { display: block; font-size: var(--fs-lead); font-weight: 600; color: var(--text); }
.sys-role { display: block; margin-top: 2px; font-family: var(--mono); font-size: var(--fs-label); color: var(--text-placeholder); letter-spacing: 0.02em; }
.sys-body { flex: 1; min-width: 0; }
.sys-desc { font-size: var(--fs-meta); color: var(--text-dim); }
.sys-pills { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; margin-top: 8px; }
.sys-pill {
  display: inline-flex; align-items: center; height: 20px; padding: 2px 8px;
  border-radius: var(--radius-pill); white-space: nowrap;
  background: var(--ok-tint); color: var(--ok-text);
  font: 600 10.5px/1 var(--mono); letter-spacing: 0.02em;
}
.sys-pill[data-state="down"] { background: var(--down-tint); color: var(--down-text); }
.sys-pill[data-state="unknown"] { background: var(--surface-muted); color: var(--text-faint); }
.sys-pill[data-state="reference"] { background: var(--surface-muted); color: var(--text-dim); }
.sys-links { display: inline-flex; gap: 12px; margin-left: 6px; }
.sys-links a { font-size: var(--fs-caption); font-weight: 600; color: var(--brand); }
.sys-links a:hover { color: var(--brand-2); text-decoration: none; }
.sys-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.sys-controls {
  font-size: var(--fs-meta); font-weight: 600; color: var(--nav-muted);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.sys-controls:hover { color: var(--text); }
.sys-open { padding: 8px 15px; font-size: var(--fs-meta); }
.sys-lifecycle { display: flex; gap: 6px; flex-basis: 100%; padding-left: 24px; }
.sys-lifecycle[hidden] { display: none; }

/* Order strip. */
.order-strip { margin-top: 24px; }
.order-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.order-item { display: inline-flex; align-items: baseline; white-space: nowrap; }
.order-item .n { font: 700 var(--fs-label)/1 var(--mono); color: var(--brand); }
.order-item .t { margin-left: 7px; font-size: var(--fs-small); font-weight: 600; color: var(--text); }
.order-item .c { margin-left: 7px; font-size: var(--fs-micro); color: var(--text-placeholder); }
/* Each strip step is a link now — quiet until hovered. */
a.order-item {
  text-decoration: none; padding: 3px 6px; margin: -3px -6px; border-radius: var(--radius-xs);
  transition: background var(--dur) var(--ease);
}
a.order-item:hover { background: var(--surface-muted); text-decoration: none; }
a.order-item:hover .t { color: var(--brand); }
.order-sep { color: var(--text-disabled); }
.sys-caption { margin-top: 16px; font-size: var(--fs-meta); color: var(--text-placeholder); }

/* Console — ink-dark bar docked into the Systems page flow, expandable body. */
.console-dock {
  background: var(--surface-inverse); color: var(--on-dark);
  border-radius: var(--radius-lg); overflow: hidden;
  display: grid; grid-template-rows: auto 0fr; transition: grid-template-rows var(--dur-slow) var(--ease);
  margin-top: 24px;
}
.console-dock[data-open="true"] { grid-template-rows: auto 300px; }
.console-bar { display: flex; align-items: center; gap: var(--space-3); padding: 6px 18px; min-height: 44px; overflow: hidden; }
.console-toggle {
  display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; cursor: pointer;
  color: var(--chrome-text); font: 600 var(--fs-meta)/1 var(--font); padding: 7px 4px 7px 0; flex: none;
}
.console-toggle svg { width: 14px; height: 14px; }
.console-caret { transition: transform var(--dur) var(--ease); display: inline-block; }
.console-dock[data-open="true"] .console-caret { transform: rotate(180deg); }
.console-tabs { display: flex; gap: 3px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.console-tabs::-webkit-scrollbar { display: none; }
.console-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-xs);
  background: transparent; border: 0; color: var(--on-dark-dim); cursor: pointer;
  font: 600 var(--fs-label)/1 var(--font); white-space: nowrap;
}
.console-tab:hover { background: rgba(255, 255, 255, 0.07); color: var(--chrome-text); }
.console-tab.is-active { background: rgba(255, 255, 255, 0.11); color: var(--on-accent); }
.console-tab .t-dot, .console-tab .t-busy { width: 6px; height: 6px; border-radius: 50%; background: var(--unknown); }
.console-tab[data-state="ok"] .t-dot { background: var(--ok); }
.console-tab[data-state="down"] .t-dot { background: var(--down); }
.console-tab[data-state="warn"] .t-dot { background: var(--warn); }
.console-tab .t-busy { background: var(--on-dark-accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.console-actions { display: flex; align-items: center; gap: 3px; flex: none; }
.console-act {
  color: var(--on-dark-dim); border-color: transparent; background: transparent;
  min-height: 26px; padding: 0 9px; font-size: var(--fs-caption); font-weight: 600;
}
.console-act:hover { background: rgba(255, 255, 255, 0.09); color: var(--chrome-text); border-color: transparent; }
.console-act[data-on="true"] { color: var(--on-dark-accent); }
.console-sep { width: 1px; height: 16px; background: var(--chrome-line); margin: 0 4px; }
.console-body { overflow: hidden; }
.console-out {
  margin: 0; padding: var(--space-3) var(--space-4) var(--space-5); height: 100%; overflow: auto;
  font-family: var(--mono); font-size: var(--fs-micro); line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.console-out .ln-cmd { color: var(--on-dark-accent); font-weight: 600; }
.console-out .ln-meta { color: var(--chrome-muted); }
.console-out .ln-err { color: var(--down-soft); }
.console-out .ln-ok { color: var(--osb-bright); }

/* ── 14 audit trail ───────────────────────────────────────────────────── */
.audit-day {
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-placeholder);
  margin: 26px 0 10px;
}
.audit-day:first-child { margin-top: 0; }
.audit-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
}
.audit-row { display: flex; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); align-items: flex-start; }
.audit-row:last-child { border-bottom: 0; }
.audit-mark {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-muted); color: var(--text-faint); font-size: var(--fs-small);
}
.audit-mark svg { width: 13px; height: 13px; stroke-width: 2.4; }
.audit-row[data-level="success"] .audit-mark { background: var(--ok-tint); color: var(--ok-text); }
.audit-row[data-level="error"] .audit-mark { background: var(--down-tint); color: var(--down-text); }
.audit-row[data-level="warn"] .audit-mark { background: var(--warn-tint); color: var(--warn-text); }
.audit-body { flex: 1; min-width: 0; }
.audit-title { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-meta { margin-top: 3px; font-size: var(--fs-meta); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-meta a { font-weight: 600; }
.audit-aside { flex: none; text-align: right; display: grid; gap: 4px; justify-items: end; }
.audit-time { font-size: var(--fs-micro); color: var(--text-placeholder); font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-toggle {
  font-size: var(--fs-meta); font-weight: 600; color: var(--brand);
  background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap;
}
.audit-toggle:hover { color: var(--brand-2); }

/* Grouped retries: attempts indent behind a 2px left rule, mono timestamps. */
.audit-attempts { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--border-subtle); display: grid; gap: 0; }
.audit-attempt { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.audit-attempt .audit-mark { width: 16px; height: 16px; font-size: 10px; }
.audit-attempt .audit-mark svg { width: 9px; height: 9px; }
.audit-attempt-label { flex: 1; min-width: 0; font-size: var(--fs-small); color: var(--text-body); display: flex; align-items: center; gap: 12px; }
.audit-attempt-time { font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-placeholder); white-space: nowrap; }

/* Payloads: never inline — a key-value block behind a toggle. */
.payload-block {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-raised); border: 1px solid var(--border-payload);
  display: grid; gap: 6px;
}
.payload-row { display: flex; gap: 12px; align-items: baseline; }
.payload-key { width: 70px; flex: none; font-family: var(--mono); font-size: 11px; color: var(--text-placeholder); }
.payload-val { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-body); word-break: break-all; }

/* ── 15 states ────────────────────────────────────────────────────────── */
.state-block {
  display: grid; justify-items: center; text-align: center; gap: 10px;
  padding: var(--space-8) var(--space-5); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); background: transparent;
}
.state-block.is-error { border-style: solid; border-color: var(--down-border); background: var(--down-tint); }
.state-block.is-loading { border: 0; background: transparent; padding: 0; justify-items: stretch; }
.state-icon {
  width: 40px; height: 40px; border-radius: var(--radius-lg); display: grid; place-items: center;
  background: var(--surface); color: var(--text-faint);
  box-shadow: inset 0 0 0 1px var(--border-solid);
}
.state-icon svg { width: 19px; height: 19px; }
.state-icon[data-tone="danger"] { background: var(--down-tint); color: var(--down-text); }
.state-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); }
.state-body { font-size: var(--fs-sm); color: var(--text-dim); max-width: 60ch; line-height: var(--lh-body); }
.state-detail {
  font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 11px; max-width: 74ch; word-break: break-word; text-align: left;
}
.state-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* Empty states teach: chips preview what will appear. */
.teach-label {
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-placeholder);
}
.teach-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 480px; }
.teach-chip {
  display: inline-flex; align-items: center; padding: 5px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: var(--fs-micro); color: var(--text-dim); white-space: nowrap;
}

.skeleton { display: grid; gap: 10px; }
.skeleton-row { display: grid; gap: 7px; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.skeleton-bar {
  height: 11px; border-radius: var(--radius-pill); width: 100%;
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-sunken) 37%, var(--surface-muted) 63%);
  background-size: 200% 100%; animation: shimmer 1.8s linear infinite;
  animation-delay: calc(var(--skeleton-index, 0) * 90ms);
}
.skeleton-bar.is-short { width: 42%; }

.inline-error {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--down-border); background: var(--down-tint); color: var(--down-text);
  font-size: var(--fs-small); line-height: var(--lh-snug);
}
.inline-error-icon svg { width: 15px; height: 15px; }
.inline-error-retry {
  margin-left: auto; background: none; border: 0; color: var(--down-text); font-weight: 700;
  font-size: var(--fs-micro); cursor: pointer; text-decoration: underline; padding: 4px 6px;
}

.feed-empty, .control-empty, .identity-empty {
  padding: var(--space-6); text-align: center; color: var(--text-placeholder); font-size: var(--fs-meta);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: transparent;
}

/* Zero-study hero (studies picker) mirrors the first-run teaching. */
.zero-hero { padding: var(--space-8) var(--space-7); text-align: center; }
.zero-hero h2 { font-size: var(--fs-display); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.zero-hero p { color: var(--text-dim); font-size: var(--fs-base); max-width: 60ch; margin: 0 auto var(--space-6); line-height: var(--lh-body); }
.zero-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* ── 16 overlays ──────────────────────────────────────────────────────── */
#dialog-host { position: relative; z-index: 90; }
.dialog-scrim {
  position: fixed; inset: 0; display: grid; place-items: center; padding: var(--space-5);
  background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); /* dialog-backdrop */
  opacity: 0; transition: opacity var(--dur) var(--ease); overflow: auto;
}
.dialog-scrim[data-enter="true"] { opacity: 1; }
.dialog {
  width: min(520px, 100%); background: var(--surface); border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-dialog); padding: var(--space-6); display: grid; gap: var(--space-4);
  transform: translateY(8px) scale(0.97); transition: transform var(--dur) var(--ease-out);
  animation: dialog-in var(--dur-base) var(--ease-out);
}
.dialog-scrim[data-enter="true"] .dialog { transform: none; }
.dialog-head { display: flex; align-items: flex-start; gap: 12px; }
.dialog-icon { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.dialog-icon svg { width: 18px; height: 18px; }
.dialog-icon[data-tone="warn"] { background: var(--warn-tint); color: var(--warn-text); }
.dialog-icon[data-tone="danger"] { background: var(--down-tint); color: var(--down-text); }
.dialog-title { font-size: var(--fs-h3); font-weight: 700; color: var(--text); padding-top: 6px; }
.dialog-body { display: grid; gap: var(--space-4); font-size: var(--fs-small); color: var(--text-body); line-height: var(--lh-body); }
.dialog-body p { margin: 0; }
.dialog-consequence {
  display: grid; gap: 3px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--warn-tint); border: 1px solid var(--warn-border);
}
.dialog-consequence-label { font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.055em; text-transform: uppercase; color: var(--warn-text); }
.dialog-fields { display: grid; gap: var(--space-3); }
.dialog-field { display: grid; gap: 5px; }
.dialog-field-label { font-size: var(--fs-micro); font-weight: 650; color: var(--text-body); }
.dialog-required { color: var(--down); margin-left: 3px; }
.dialog-input { width: 100%; }
select.dialog-input {
  padding-right: 36px; background-color: var(--surface-raised, var(--surface));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.25 6 8.25l4-4' fill='none' stroke='%23334155' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px; background-position: right 11px center;
}
.dialog-hint { font-size: var(--fs-micro); color: var(--text-faint); }
.dialog-error { font-size: var(--fs-micro); color: var(--down-text); font-weight: 620; }
.dialog-actions { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }

.drawer-scrim {
  position: fixed; inset: 0; z-index: var(--z-overlay); background: rgba(15, 23, 42, 0.45);
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(640px, 100%); height: 100%; background: var(--surface-page);
  display: grid; grid-template-rows: auto 1fr; box-shadow: var(--shadow-lg);
  animation: panel-in 240ms var(--ease-out);
}
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) var(--space-6); background: var(--surface); border-bottom: 1px solid var(--border);
}
.drawer-eyebrow { font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.07em; color: var(--text-faint); }
.drawer-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); margin-top: 3px; }
.drawer-body { overflow-y: auto; padding: var(--space-5) var(--space-6) var(--space-8); display: grid; gap: var(--space-4); }

.toast-host {
  position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 100;
  display: grid; gap: 9px; justify-items: end; max-width: min(430px, calc(100vw - 40px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 11px; pointer-events: auto;
  padding: 11px 13px; border-radius: var(--radius-lg); background: var(--surface); color: var(--text-body);
  box-shadow: var(--shadow-pop), inset 3px 0 0 var(--brand); font-size: var(--fs-small); line-height: var(--lh-snug);
  border: 1px solid var(--border); max-width: 100%;
  animation: toast-in 240ms var(--ease-out);
}
.toast[data-enter="true"] { opacity: 1; transform: none; }
.toast[data-leaving="true"] { opacity: 0; transform: translateY(6px); }
.toast[data-tone="success"] { box-shadow: var(--shadow-pop), inset 3px 0 0 var(--ok); }
.toast[data-tone="warn"] { box-shadow: var(--shadow-pop), inset 3px 0 0 var(--warn); }
.toast[data-tone="danger"] { box-shadow: var(--shadow-pop), inset 3px 0 0 var(--down); }
.toast-msg { flex: 1; min-width: 0; }
.toast-action {
  background: transparent; border: 0; color: var(--brand); cursor: pointer; flex: none;
  padding: 5px 10px; border-radius: var(--radius-xs); font: 500 var(--fs-micro)/1 var(--font);
}
.toast-action:hover { background: var(--brand-tint); }
.toast-close {
  background: none; border: 0; color: var(--text-faint); cursor: pointer; flex: none; padding: 4px;
  border-radius: var(--radius-xs); display: grid; place-items: center; min-height: 24px; min-width: 24px;
}
.toast-close:hover { color: var(--text); background: var(--surface-muted); }
.toast-close svg { width: 13px; height: 13px; stroke-width: 2; }

/* ── 17 domain surfaces ───────────────────────────────────────────────── */
/* Activity feed (compact lists inside cards). */
.feed { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }
.feed-item {
  display: flex; gap: 12px; padding: 10px var(--space-5);
  border-bottom: 1px solid var(--border-subtle); align-items: flex-start;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--surface-subtle); }
.feed-icon { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-muted); color: var(--text-dim); }
.feed-icon svg { width: 14px; height: 14px; }
.feed-item[data-level="success"] .feed-icon { background: var(--ok-tint); color: var(--ok-text); }
.feed-item[data-level="error"] .feed-icon { background: var(--down-tint); color: var(--down-text); }
.feed-item[data-level="error"] .feed-msg { font-weight: 560; }
.feed-item[data-level="warn"] .feed-icon { background: var(--warn-tint); color: var(--warn-text); }
.feed-body { flex: 1; min-width: 0; }
.feed-msg {
  font-size: var(--fs-small); color: var(--text); line-height: var(--lh-snug);
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.feed-meta {
  font-size: var(--fs-micro); color: var(--text-faint); margin-top: 2px; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-meta a { font-weight: 620; }

/* Tables (users, semantic, control) — quiet rows. */
.table-wrap, .user-table-wrap, .semantic-table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
}
table, .user-table, .semantic-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
thead th {
  text-align: left; padding: 9px var(--space-4); background: var(--surface-header);
  border-bottom: 1px solid var(--border); font-size: var(--fs-label); font-weight: 700;
  color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
tbody td { padding: 10px var(--space-4); border-bottom: 1px solid var(--border-subtle); vertical-align: top; color: var(--text-body); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-subtle); }
tbody td b { color: var(--text); font-weight: 620; display: block; }
tbody td small { display: block; font-size: var(--fs-micro); color: var(--text-faint); margin-top: 2px; }
td.risk, .semantic-table .risk { color: var(--down-text); font-weight: 620; }
.semantic-table .warn { color: var(--warn-text); }
.user-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.user-state { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: var(--fs-micro); font-weight: 650; }
.user-state.active { background: var(--ok-tint); color: var(--ok-text); }
.user-state.inactive { background: var(--unknown-tint); color: var(--text-dim); }
.user-role { min-width: 132px; }
.user-create-card {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3);
  align-items: end; padding: var(--space-5); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.user-create-title { grid-column: 1 / -1; font-size: var(--fs-h3); font-weight: 650; color: var(--text); }
.user-head-actions, .identity-head-actions, .control-plane-toolbar, .semantic-study-controls {
  display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap;
}
.audit-source { display: grid; gap: 2px; padding: 9px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-small); }
.audit-source:last-child { border-bottom: 0; }
.audit-source b { color: var(--text); }
.audit-source span { color: var(--text-dim); }
.audit-source small { color: var(--text-faint); font-size: var(--fs-micro); }
.control-note { font-size: var(--fs-small); color: var(--text-dim); line-height: var(--lh-body); }

/* Semantic surfaces (kept working, retokened). */
.semantic-alert {
  padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--warn-border);
  background: var(--warn-tint); color: var(--warn-text); font-size: var(--fs-small); line-height: var(--lh-body);
}
.semantic-alert.error { border-color: var(--down-border); background: var(--down-tint); color: var(--down-text); }
.semantic-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: var(--space-2); }
.semantic-stat, .pipe-stat {
  padding: var(--space-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: grid; gap: 3px;
}
.semantic-stat .n, .pipe-stat .n { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; }
.semantic-stat .l, .pipe-stat .l { font-size: var(--fs-micro); color: var(--text-dim); font-weight: 600; }
.semantic-stat[data-risk="true"] { border-color: var(--down-border); background: var(--down-tint); }
.semantic-stat[data-risk="true"] .n { color: var(--down-text); }
.semantic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-4); }
.semantic-card { padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; }
.semantic-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.semantic-card-head h2 { font-size: var(--fs-h3); }
.semantic-span { grid-column: 1 / -1; }
.semantic-badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: var(--fs-micro); font-weight: 650; background: var(--unknown-tint); color: var(--text-dim);
  border: 1px solid var(--unknown-border);
}
.semantic-badge.ok { background: var(--ok-tint); border-color: var(--ok-border); color: var(--ok-text); }
.semantic-badge.warn { background: var(--warn-tint); border-color: var(--warn-border); color: var(--warn-text); }
.semantic-badge.error { background: var(--down-tint); border-color: var(--down-border); color: var(--down-text); }
.semantic-badge.usdm {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.semantic-badge.sdtm {
  background: color-mix(in srgb, var(--fg) 7%, transparent);
  border-color: color-mix(in srgb, var(--fg) 22%, transparent);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.semantic-badge.visits {
  background: color-mix(in srgb, var(--fg) 5%, transparent);
  border-color: color-mix(in srgb, var(--fg) 18%, transparent);
  color: var(--fg-muted);
}
.semantic-standards th { white-space: nowrap; width: 9.5rem; vertical-align: top; }
.semantic-standards td { line-height: 1.7; }
.semantic-toolbar { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-4); }
.semantic-toolbar input, .semantic-toolbar select { width: auto; min-width: 168px; flex: 1 1 168px; max-width: 340px; }
.semantic-toolbar .btn { flex: none; }
.semantic-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--space-4); align-items: start; }
.semantic-list { display: grid; gap: var(--space-2); max-height: 620px; overflow-y: auto; padding-right: 3px; }
.semantic-list.compact { max-height: 340px; }
.semantic-list-item {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; display: grid; gap: 4px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.semantic-list-item:hover { border-color: var(--brand-border); background: var(--brand-tint); }
.semantic-list-item.is-active { border-color: var(--brand-border); background: var(--brand-tint); }
.semantic-list-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-small); font-weight: 620; color: var(--text); }
.semantic-list-meta { font-size: var(--fs-micro); color: var(--text-dim); line-height: var(--lh-snug); word-break: break-word; }
.semantic-detail {
  padding: var(--space-5); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); max-height: 720px; overflow-y: auto; display: grid; gap: var(--space-3); align-content: start;
}
.semantic-detail h2 { font-size: var(--fs-h3); }
.semantic-detail h3 { font-size: var(--fs-base); margin-top: var(--space-2); }
.semantic-json {
  margin: 0; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-inverse);
  color: var(--on-dark); font-size: var(--fs-micro); line-height: 1.6; overflow-x: auto; max-height: 300px;
}
.semantic-json-input { font-family: var(--mono); font-size: var(--fs-micro); min-height: 116px; }
.semantic-profile-json { min-height: 200px; }
.semantic-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-2); }
.semantic-model { padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.semantic-model .title { font-size: var(--fs-small); font-weight: 630; color: var(--text); }
.semantic-model .meta { font-size: var(--fs-micro); color: var(--text-dim); margin-top: 3px; line-height: var(--lh-snug); }
.semantic-decision { display: grid; gap: var(--space-3); }
.semantic-decision-note {
  font-size: var(--fs-micro); color: var(--text-dim); padding: 9px 11px;
  background: var(--surface-muted); border-radius: var(--radius-sm); line-height: var(--lh-snug);
}
.semantic-decision-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.semantic-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--space-2); }
.semantic-inline-check { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-micro); color: var(--text-dim); white-space: nowrap; }
.semantic-inline-check input { width: 16px; }
.semantic-chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.semantic-chip { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-muted); font-size: var(--fs-micro); color: var(--text-dim); }
.semantic-chip.blocker { background: var(--down-tint); color: var(--down-text); }
.semantic-chip.resolved { background: var(--ok-tint); color: var(--ok-text); }
.semantic-chip.superseded { background: var(--unknown-tint); color: var(--text-faint); }
.semantic-subhead { font-size: var(--fs-label); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-top: var(--space-2); }
.semantic-work-item { display: grid; gap: 5px; }
.mapping-path { font-family: var(--mono); font-size: var(--fs-micro); color: var(--text-dim); word-break: break-all; }
.semantic-profile-counts { display: flex; flex-wrap: wrap; gap: 5px; }
.semantic-object-view { display: grid; gap: var(--space-3); }
.semantic-object-card { grid-column: 1 / -1; }
.canonical-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.mapping-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.semantic-profile-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }

/* ── Semantics workspace dashboard (2026-08-25 semantics redesign) ─────── */
/* The workspace reads like its own screen: wider column, triage first. */
.view.is-wide { max-width: 1240px; }

/* Verdict + ranked attention. One card; the single place that answers
   "what needs a person, in what order, and why". */
.sem-triage {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden;
}
.sem-triage[data-state="risk"] { border-color: var(--warn-border); box-shadow: var(--shadow-elevated); }
.sem-triage-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  flex-wrap: wrap; padding: 15px 20px; border-bottom: 1px solid var(--border-subtle);
}
.sem-triage-verdict { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.sem-triage-verdict b { font-size: var(--fs-h3); font-weight: 700; color: var(--text); }
.sem-triage-sub { font-size: var(--fs-meta); color: var(--text-dim); }
.sem-triage-rows { display: grid; }
.sem-triage-row {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 12px 20px; border: 0; border-bottom: 1px solid var(--border-subtle);
  background: transparent; cursor: pointer; font: inherit; color: inherit;
  transition: background var(--dur) var(--ease);
}
.sem-triage-row:last-child { border-bottom: 0; }
.sem-triage-row:hover { background: var(--surface-subtle); }
.sem-triage-count {
  width: 86px; flex: none; text-align: right;
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--warn-text);
}
.sem-triage-row[data-severity="down"] .sem-triage-count { color: var(--down-text); }
.sem-triage-body { flex: 1; min-width: 0; }
.sem-triage-title { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.sem-triage-why { display: block; margin-top: 2px; font-size: var(--fs-meta); color: var(--text-dim); line-height: var(--lh-snug); }
.sem-triage-go { flex: none; font-size: var(--fs-small); font-weight: 600; color: var(--brand); white-space: nowrap; }
.sem-triage-row:hover .sem-triage-go { color: var(--brand-2); }
.sem-triage-clear { display: flex; align-items: center; gap: 10px; padding: 14px 20px; font-size: var(--fs-sm); color: var(--text-dim); }

/* Stat tiles keep every number; each carries its meaning in place. */
.semantic-stat .d { font-size: var(--fs-caption); color: var(--text-faint); line-height: var(--lh-snug); }

/* The flow: how meaning moves stage to stage, with what is stuck where. */
.sem-flow-scroll { overflow-x: auto; padding-bottom: 4px; }
.sem-flow { display: flex; align-items: stretch; gap: 10px; min-width: 720px; }
.sem-flow-stage {
  flex: 1 1 0; min-width: 118px; display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface-subtle); text-decoration: none; color: inherit; cursor: pointer;
  font: inherit; text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.sem-flow-stage:hover { border-color: var(--brand-border); background: var(--brand-tint); text-decoration: none; }
.sem-flow-stage[data-flow="risk"] { border-color: var(--down-border); }
.sem-flow-stage[data-flow="watch"] { border-color: var(--warn-border); }
.sem-flow-n { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sem-flow-n[data-absent="true"] { color: var(--text-faint); font-weight: 500; font-size: var(--fs-base); }
.sem-flow-l { font-size: var(--fs-small); font-weight: 650; color: var(--text); }
.sem-flow-d { font-size: var(--fs-caption); color: var(--text-dim); line-height: var(--lh-snug); }
.sem-flow-issues { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.sem-flow-issue {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: var(--fs-caption); font-weight: 600;
  background: var(--warn-pill); color: var(--warn-text);
}
.sem-flow-issue[data-tone="down"] { background: var(--down-tint); color: var(--down-text); }
.sem-flow-issue[data-tone="ok"] { background: var(--ok-tint); color: var(--ok-text); }
.sem-flow-arrow { align-self: center; flex: none; color: var(--text-disabled); font-size: var(--fs-base); }

/* Horizontal bars: value next to every bar, nothing dropped. */
.sem-bars { display: grid; gap: 7px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.sem-bar-row { display: flex; align-items: center; gap: 12px; }
.sem-bar-label { width: 210px; flex: none; min-width: 0; font-size: var(--fs-small); color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sem-bar-sub { display: block; font-size: var(--fs-caption); color: var(--text-faint); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sem-bar-track { flex: 1; height: 10px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.sem-bar-fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--brand); min-width: 2px; }
.sem-bar-fill[data-tone="down"] { background: var(--down); }
.sem-bar-fill[data-tone="warn"] { background: var(--warn); }
.sem-bar-fill[data-tone="ok"] { background: var(--ok); }
.sem-bar-fill[data-tone="dim"] { background: var(--border-hover); }
.sem-bar-value { width: 72px; flex: none; text-align: right; font-size: var(--fs-small); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.sem-bar-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: 10px; font-size: var(--fs-caption); color: var(--text-dim); }
.sem-bar-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* 3D relation views. The canvas host owns its children (graph3d.js). */
.graph3d { position: relative; height: 400px; border-radius: var(--radius-lg); background: var(--surface-subtle); border: 1px solid var(--border-subtle); overflow: hidden; }
.graph3d canvas { display: block; width: 100%; height: 100%; }
.graph3d-tip {
  position: absolute; z-index: 2; pointer-events: none; max-width: 260px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-size: var(--fs-micro); color: var(--text-dim); display: grid; gap: 2px;
}
.graph3d-tip b { font-size: var(--fs-small); color: var(--text); font-weight: 650; }
.sem-3d-legend { display: flex; gap: 12px 14px; flex-wrap: wrap; font-size: var(--fs-caption); color: var(--text-dim); align-items: center; }
.sem-3d-legend .dot6 { margin-right: 5px; }
.sem-3d-hint { font-size: var(--fs-caption); color: var(--text-placeholder); }

/* Collapsible table twin + glossary: the data behind every picture. */
.sem-fold summary {
  cursor: pointer; font-size: var(--fs-small); font-weight: 600; color: var(--brand);
  list-style: none; display: inline-flex; align-items: center; gap: 7px; padding: 4px 0;
}
.sem-fold summary::-webkit-details-marker { display: none; }
.sem-fold summary::before { content: "▸"; font-size: var(--fs-caption); transition: transform var(--dur) var(--ease); }
.sem-fold[open] summary::before { transform: rotate(90deg); }
.sem-fold > *:not(summary) { margin-top: var(--space-3); }
.sem-glossary dl { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 0 var(--space-5); }
.sem-glossary dt { font-size: var(--fs-small); font-weight: 650; color: var(--text); padding: 7px 0; border-bottom: 1px solid var(--border-subtle); }
.sem-glossary dd { font-size: var(--fs-small); color: var(--text-dim); padding: 7px 0; margin: 0; border-bottom: 1px solid var(--border-subtle); line-height: var(--lh-snug); }
.sem-glossary dt:last-of-type, .sem-glossary dd:last-of-type { border-bottom: 0; }

/* Control plane (release). */
.control-plane-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.control-plane-summary article {
  padding: var(--space-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: grid; gap: 3px;
}
.control-plane-summary span { font-size: var(--fs-micro); color: var(--text-dim); font-weight: 600; }
.control-plane-summary b { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.018em; }
.control-plane-grid { display: grid; grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.6fr); gap: var(--space-4); align-items: start; }
.control-plane-lower { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); }
.control-card { padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; }
.control-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.control-card-heading h3 { font-size: var(--fs-h3); }
.control-card-heading small { font-size: var(--fs-micro); color: var(--text-dim); display: block; margin-top: 2px; }
.control-workflow-list, .control-compact-list, .control-step-list, .identity-list { display: grid; gap: var(--space-2); max-height: 460px; overflow-y: auto; }
.control-workflow {
  display: grid; gap: 3px; padding: 11px 13px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: inherit;
}
.control-workflow:hover { border-color: var(--brand-border); background: var(--brand-tint); }
.control-workflow.selected { border-color: var(--brand); background: var(--brand-tint); }
.control-workflow-head, .control-compact-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-small); }
.control-workflow small, .control-compact-item small { font-size: var(--fs-micro); color: var(--text-faint); }
.control-compact-item { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.control-compact-item code { font-size: var(--fs-micro); color: var(--text-dim); word-break: break-all; }
.control-state {
  display: inline-flex; padding: 2px 8px; border-radius: var(--radius-pill); font-size: var(--fs-micro);
  font-weight: 650; background: var(--unknown-tint); color: var(--text-dim); text-transform: capitalize; white-space: nowrap;
}
.control-state.succeeded, .control-state.completed, .control-state.verified, .control-state.activated { background: var(--ok-tint); color: var(--ok-text); }
.control-state.failed, .control-state.rejected, .control-state.quarantined { background: var(--down-tint); color: var(--down-text); }
.control-state.waiting_human, .control-state.pending_review, .control-state.open, .control-state.claimed, .control-state.running { background: var(--warn-pill); color: var(--warn-text); }
.control-step { display: grid; gap: 5px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.control-step-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-small); }
.control-step-meta { display: flex; flex-wrap: wrap; gap: 9px; font-size: var(--fs-micro); color: var(--text-dim); align-items: center; }
.control-step-meta code { word-break: break-all; }
.control-action-panel {
  padding: var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--warn-border);
  background: var(--warn-tint); display: grid; gap: var(--space-3);
}
.control-action-panel h4 { font-size: var(--fs-base); color: var(--warn-text); }
.control-action-panel p { font-size: var(--fs-small); color: var(--text-body); }
.control-action-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); }
.control-action-form label { display: grid; gap: 4px; }
.control-action-wide { grid-column: 1 / -1; display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: end; }
.control-action-check { flex-direction: row !important; align-items: center; gap: 8px !important; grid-column: 1 / -1; }
.control-action-check input { width: 16px; }
.control-detail-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.control-inline-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.control-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); }

/* Identity. */
.identity-source-health { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.identity-source {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: var(--fs-micro); font-weight: 600; border: 1px solid var(--unknown-border); background: var(--unknown-tint); color: var(--text-dim);
}
.identity-source b { font-weight: 700; }
.identity-source.ok { background: var(--ok-tint); border-color: var(--ok-border); color: var(--ok-text); }
.identity-source.warn { background: var(--warn-tint); border-color: var(--warn-border); color: var(--warn-text); }
.identity-review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-4); align-items: start; }
.identity-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.identity-item { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.identity-item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-small); }
.identity-item-meta { font-size: var(--fs-micro); color: var(--text-dim); word-break: break-word; }
.identity-evidence { font-size: var(--fs-micro); color: var(--text-faint); display: grid; gap: 2px; }
.identity-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; align-items: center; }
.identity-state {
  display: inline-flex; padding: 2px 8px; border-radius: var(--radius-pill); font-size: var(--fs-micro);
  font-weight: 650; background: var(--unknown-tint); color: var(--text-dim); white-space: nowrap;
}
.identity-state.confirmed_pending_receipt, .identity-state.bound, .identity-state.verified { background: var(--ok-tint); color: var(--ok-text); }
.identity-state.pending, .identity-state.open { background: var(--warn-pill); color: var(--warn-text); }
.identity-state.rejected, .identity-state.conflict { background: var(--down-tint); color: var(--down-text); }
.identity-safety-note { padding: 12px 14px; background: var(--surface-muted); border-radius: var(--radius-sm); }

/* Pipeline systems footnote. */
.pipe-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.pipe-sys { font-size: var(--fs-micro); color: var(--text-dim); padding: 11px 13px; background: var(--surface-muted); border-radius: var(--radius-sm); display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.sys-ok { color: var(--ok-text); }
.sys-down { color: var(--down-text); }

/* Stage panels (build / design / capture) — kept, quiet edges. */
.stage-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 18px 22px;
}
.stage-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-4); flex-wrap: wrap;
}
.stage-panel-title { display: flex; align-items: center; gap: 9px; font-size: var(--fs-h3); font-weight: 650; color: var(--text); }
.stage-panel-title svg { width: 18px; height: 18px; color: var(--accent, var(--text-dim)); }
.stage-panel-sub { font-size: var(--fs-micro); color: var(--text-dim); font-weight: 500; }
.stage-state {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-pill); font-size: var(--fs-caption); font-weight: 600;
  background: var(--unknown-tint); border: 0; color: var(--text-dim);
}
.stage-state.s-done, .stage-state.s-succeeded, .stage-state.s-live { background: var(--ok-tint); color: var(--ok-text); }
.stage-state.s-partial { background: var(--warn-pill); color: var(--warn-text); }
.stage-state.s-failed { background: var(--down-tint); color: var(--down-text); }
.stage-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-subtle); }

.stale-flag {
  display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; margin-bottom: var(--space-4);
  border-radius: var(--radius-sm); border: 1px solid var(--warn-border); background: var(--warn-tint);
  color: var(--warn-text); font-size: var(--fs-small); line-height: var(--lh-snug);
}

.census-bar { display: flex; height: 7px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface-sunken); margin-bottom: 7px; }
.census-bar span { display: block; height: 100%; }
.census-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: var(--fs-micro); color: var(--text-dim); }
.census-legend span { display: inline-flex; align-items: center; gap: 5px; }
.census-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.job-slot:empty { display: none; }
.job-log {
  margin-top: var(--space-4); padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-inverse); color: var(--on-dark); font-family: var(--mono); font-size: var(--fs-micro);
  line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
}
.job-log b { color: var(--on-accent); }
.job-badge {
  display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill);
  font-size: var(--fs-micro); font-weight: 700; margin-left: 7px; text-transform: capitalize;
}
.job-badge.running { background: rgba(81, 85, 232, 0.28); color: var(--on-dark-accent); }
.job-badge.succeeded { background: rgba(18, 183, 106, 0.24); color: var(--osb-bright); }
.job-badge.failed { background: rgba(220, 38, 38, 0.24); color: var(--down-soft); }
.job-badge.cancelled, .job-badge.unknown { background: rgba(255, 255, 255, 0.12); color: var(--chrome-muted); }

kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs); background: var(--surface); color: var(--text-body);
  font: 500 var(--fs-micro)/var(--lh-micro) var(--mono);
}

/* ── 18 responsive + motion ───────────────────────────────────────────── */
@media (max-width: 1280px) {
  .main-content { padding: 36px 40px var(--space-8); }
}
@media (max-width: 1180px) {
  .semantic-split, .canonical-split, .mapping-grid, .semantic-profile-split, .control-plane-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .main-content { padding: var(--space-5) var(--space-5) var(--space-8); }
  .roster-id { width: 190px; }
  .roster-progress { width: 200px; }
  .seg { width: 42px; }
  .sys-id { width: 200px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; gap: var(--space-3); overflow-x: auto; padding: 0 var(--space-3); border-right: 0; border-bottom: 1px solid var(--sidebar-border); }
  .sidebar-brand { padding: 10px 6px; }
  .sidebar-footer, .nav-label { display: none; }
  .nav { display: flex; gap: 3px; padding: var(--space-2) 0; overflow-x: auto; }
  .nav-tab { white-space: nowrap; width: auto; margin: 0; }
  .topbar { padding: 0 var(--space-4); }
  .session-user { display: none; }
  .roster-elevated, .roster-row { flex-wrap: wrap; }
  .roster-reason { flex-basis: 100%; }
  .pipe-card { flex-direction: column; }
  .pipe-cell { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .pipe-cell:first-child { border-top: 0; }
  .sys-row { flex-wrap: wrap; }
  .hero-live-row { flex-wrap: wrap; }
  .sem-triage-count { width: 62px; }
  .sem-triage-go { display: none; }
  .sem-bar-label { width: 130px; }
  .sem-glossary dl { grid-template-columns: 1fr; }
  .sem-glossary dt { border-bottom: 0; padding-bottom: 0; }
  .graph3d { height: 320px; }
}
@media (max-width: 620px) {
  .main-content { padding: var(--space-4) var(--space-4) var(--space-8); }
  .toast-host { left: var(--space-4); right: var(--space-4); max-width: none; justify-items: stretch; }
}

@media print {
  .sidebar, .topbar, .console-dock, .toast-host, .state-actions, .btn { display: none !important; }
  .shell { position: static; display: block; }
  .main-content { overflow: visible; padding: 0; }
}

@keyframes page-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in  { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes toast-in   { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fade-in    { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }
@keyframes panel-in   { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes shimmer    { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.anim-page-enter { animation: page-enter var(--dur-slow) var(--ease-out); }
.view-host > *, #view-host > * { animation: page-enter var(--dur-slow) var(--ease-out); }
