/* ASD-BrainTwin — light clinical-journal theme, matching the clinic report
   (results/brain_viz/clinic DESIGN.md): paper-white surfaces, steel-blue accent,
   RdBu colorblind-safe diverging maps, persistent amber research banner.
   Neurodiversity-affirming: no puzzle imagery, no "cure" framing.
   Warm red = above / hyper / ASD-direction; cool blue = below / hypo / TD. */
:root {
  /* ===== Stripe-inspired design tokens (apps/web/public/braintwin/DESIGN.md) =====
     financial-grade clarity: cool near-white canvas, deep-navy ink, electric-indigo accent,
     hairline borders, blue-tinted elevation, Inter-thin display + tabular figures.
     Data RdBu (warm=ASD / cool=TD) is preserved — it is clinically load-bearing. */
  /* surfaces — Stripe canvas / canvas-soft / hairline */
  --bg: #F6F9FC;          /* canvas-soft (cool off-white page) */
  --bg-1: #F6F9FC;
  --bg-2: #EDF1F7;
  --panel: #FFFFFF;       /* canvas */
  --panel-2: #F6F9FC;
  --line: #E3E8EE;        /* hairline */
  --line-2: #CFD8E3;
  /* ink — Stripe deep navy (never pure black) */
  --text: #0D253D;        /* ink */
  --muted: #5B6677;       /* ink-mute (darkened for WCAG 4.5:1 on #F6F9FC) */
  --muted-2: #5F6B7C;    /* darkened from #8A93A5 for WCAG 4.5:1 on #F6F9FC */
  --asd-ink: #B91C1C;    /* TEXT-only ASD token (clears 4.5:1 on white/canvas) */
  --ink-2: #273951;       /* ink-secondary */
  /* accent — clinical teal (spectrally clear of the RdBu data range so chrome never reads as a data signal) */
  --accent: #0F766E;
  --accent-hover: #0D6460;
  --accent-press: #0A4F4C;
  --accent-subtle: #F0FDFA;   /* pale teal soft-tag bg */
  --accent-soft: #99F6E4;
  --accent-2: #0F766E;
  --brand-dark: #1C1E54;      /* deep-navy inverted surface */
  /* semantic DATA (warm=ASD/above, cool=TD/below) — UNCHANGED (clinically load-bearing) */
  --asd: #DC2626;  --asd-soft: #FECACA;  --asd-bg: #FEF2F2;
  --td: #1D4ED8;   --td-soft: #BFDBFE;   --td-bg: #EFF6FF;
  --mid: #B45309;  --mid-bg: #FFFBEB;
  --good: #047857; --good-bg: #ECFDF5;
  --warn: #B45309; --warn-bg: #FFFBEB;
  --bad: #DC2626;  --bad-bg: #FEF2F2;
  --info: #0284C7; --info-bg: #F0F9FF;
  /* banner (safety amber — kept cautionary) */
  --banner-bg: #FFFBEB; --banner-border: #FCD34D; --banner-ink: #92400E;
  --radius: 12px;
  /* Stripe shadow-blue (#003770) elevation */
  --shadow: 0 1px 3px rgba(0,55,112,.08);
  --shadow-panel: 0 8px 24px rgba(0,55,112,.08), 0 2px 6px rgba(0,55,112,.04);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --sans: 'Inter', 'SF Pro Display', system-ui, -apple-system, 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--sans);   /* 16px floor for dense clinical reading */
  font-feature-settings: 'ss01';   /* Stripe stylistic set, on globally */
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.018em; line-height: 1.25; color: var(--text); }
.muted { color: var(--muted); }
.xs { font-size: 12px; }
.sm { font-size: 13px; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }   /* tabular figures */
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }

.app { display: flex; flex-direction: column; min-height: 100%; }

/* ---- research banner (amber, persistent) ---- */
.research-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--banner-bg); border-bottom: 2px solid var(--banner-border);
  padding: 9px 22px; color: var(--banner-ink);
}
.research-banner .rb-icon { font-size: 1.05rem; line-height: 1; margin-top: 1px; }
.research-banner .rb-title { font-size: 12.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.research-banner .rb-desc { font-size: 11.5px; opacity: .9; }
.research-banner .rb-back { margin-left: auto; white-space: nowrap; font-size: 12.5px; font-weight: 600; }

/* ---- topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 30;
}
/* calm single-tone brand line — no warm decorative colors that compete with the RdBu data range */
.topbar::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--accent); opacity: .5; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 20px; font-weight: 500; letter-spacing: -0.022em; }
.brand .sub { margin: 0; font-size: 11.5px; color: var(--muted); }
.logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: conic-gradient(from 200deg, var(--td), var(--accent), var(--asd), var(--mid), var(--td));
  box-shadow: inset 0 0 0 2px #ffffffaa;
}
.badges { display: flex; gap: 8px; margin-left: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--bg-1);
  white-space: nowrap;
}
.badge b { color: var(--text); }
.badge--metric {   /* headline performance metric — emphasized, tabular figures */
  color: var(--accent); border-color: var(--accent-soft); background: var(--accent-subtle);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.persona { margin-left: auto; display: flex; gap: 4px; background: var(--bg-1);
  border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.persona-btn {
  border: 0; background: transparent; color: var(--muted); padding: 7px 12px;
  border-radius: 7px; font-size: 13px; font-weight: 550; transition: .12s;
}
.persona-btn:hover { color: var(--text); background: #fff; }
.persona-btn.active { background: var(--accent); color: #fff; }

/* ---- view-switch (1-page Summary / In-depth Analysis) ---- */
.view-switch {
  margin-left: auto; display: flex; gap: 0;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 9px;
  padding: 3px; overflow: hidden;
}
.vs-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  font-weight: 500; padding: 5px 12px; border-radius: 7px; cursor: pointer;
  letter-spacing: .01em; transition: .12s; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center;
}
.vs-btn:hover { color: var(--text); background: #fff; text-decoration: none; }
.vs-btn.active { background: var(--accent); color: #fff; }
/* lang-toggle follows the gap in the flex row — no longer needs its own margin-left */

/* ---- language toggle (KOR / ENG) ---- */
.lang-toggle { display: flex; gap: 3px; background: var(--bg-1);
  border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.lang-toggle button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  font-weight: 500; padding: 5px 12px; border-radius: 999px; cursor: pointer; letter-spacing: .02em;
  transition: .12s;
}
.lang-toggle button:hover { color: var(--text); background: #fff; }
.lang-toggle button.active { background: var(--accent); color: #fff; }
@media (max-width: 980px) { .view-switch { margin-left: 0; } }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; flex: 1; min-height: 0; }
.sidebar { border-right: 1px solid var(--line); padding: 16px; display: flex;
  flex-direction: column; gap: 14px; overflow-y: auto; max-height: calc(100vh - 58px); background: var(--bg); }
.main { padding: 16px 22px 28px; min-width: 0; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 340px; border-right: 0; border-bottom: 1px solid var(--line); }
  .persona { margin-left: 0; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.panel h2, .panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted-2); margin-bottom: 8px; font-weight: 700; }

/* ---- subject list ---- */
.subj-search {
  width: 100%; box-sizing: border-box; margin-top: 8px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg-1);
  color: var(--text); font: inherit; font-size: 12.5px;
}
.subj-search:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
#subjCount { margin: 7px 2px 2px; }
.subject-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px;
  max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.subject-list[aria-busy="true"] { opacity: .55; pointer-events: none; }
/* projected-cohort accents (honest visual flag): relaxed-QC = amber, ADHD-200 contrast = slate */
.subj.subj-relaxed { border-left: 3px solid #B45309; }
.subj.subj-adhd { border-left: 3px solid #475569; }
.subj {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); transition: .12s; text-align: left; color: var(--text);
}
.subj:hover { border-color: var(--accent-border, var(--line-2)); background: var(--bg-1); }
.subj.active { border-color: var(--accent); background: #FFFFFF; box-shadow: 0 0 0 1px var(--accent) inset; }
.subj .id { font-size: 12.5px; font-weight: 600; }
.subj .meta { font-size: 11px; color: var(--muted); }
.subj .idx { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* position band */
.band { height: 12px; border-radius: 7px; position: relative; margin: 13px 0 7px;
  background: linear-gradient(90deg, var(--td), #C8D9EF 50%, var(--asd)); border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); }
.band .ptr { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 3px solid var(--text); transform: translate(-7px, -50%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.22); }
.band-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

/* ---- tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 9px 14px;
  border-radius: 8px 8px 0 0; font-size: 13.5px; font-weight: 550; position: relative;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px; }
.tab.hidden { display: none; }

/* ---- view + cards ---- */
.view { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.card > h2 { font-size: 16px; font-weight: 550; margin-bottom: 5px; letter-spacing: -0.016em; }
.card > .hint { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.kpi { display: flex; gap: 12px; flex-wrap: wrap; }
.kpi .item { flex: 1; min-width: 130px; background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 14px; }
.kpi .v { font-size: 26px; font-weight: 400; font-family: var(--sans); font-feature-settings: 'tnum' 'ss01';
  letter-spacing: -0.03em; line-height: 1.1; }
.kpi .l { font-size: 10.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .045em; font-weight: 600; margin-top: 5px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); background: var(--bg-1); }
.pill.good { color: var(--good); border-color: #6EE7B7; background: var(--good-bg); }
.pill.warn { color: #92400E; border-color: #FCD34D; background: var(--warn-bg); }   /* darker amber — WCAG AA on warn-bg */
.pill.bad { color: var(--asd-ink); border-color: var(--asd-soft); background: var(--bad-bg); }
.pill.asd { color: var(--asd-ink); border-color: var(--asd-soft); background: var(--asd-bg); }
.pill.td { color: var(--td); border-color: var(--td-soft); background: var(--td-bg); }

/* evidence chips */
.ev { font-family: var(--mono); font-weight: 700; font-size: 11px; padding: 1px 6px;
  border-radius: 5px; border: 1px solid var(--line-2); background: var(--bg-1); }
.ev.A { color: var(--good); border-color:#6EE7B7; background: var(--good-bg);}
.ev.B { color: var(--accent); border-color:#93C5FD; background: var(--accent-subtle);}
.ev.C { color: var(--mid); border-color:#FCD34D; background: var(--warn-bg);}
.ev.D { color: #7C3AED; border-color:#DDD6FE; background:#F5F3FF;}
.ev.Unavailable { color: var(--muted-2); border-color: var(--line); }

/* canvases — light chart surfaces */
.brain-wrap { position: relative; }
#brainCanvas, #connCanvas, #surfCanvas { width: 100%; display: block; border-radius: 10px; border: 1px solid var(--line); }
#brainCanvas, #surfCanvas { background:
  radial-gradient(760px 560px at 50% 30%, #FFFFFF 0%, #EEF1F6 68%, #E6EAF1 100%); cursor: grab; }
#brainCanvas { height: 520px; }
#surfCanvas { height: 440px; }
#brainCanvas:active, #surfCanvas:active { cursor: grabbing; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.legend .it { display: flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 8px; border-radius: 3px; display: inline-block; }
.swatch.line { height: 0; border-top: 3px solid; width: 18px; }
.swatch.dash { height: 0; border-top: 3px dashed; width: 18px; }

.tooltip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line-2);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: 240px; z-index: 20; display: none;
  box-shadow: var(--shadow-panel); color: var(--text); }
.tooltip h5 { margin: 0 0 3px; font-size: 12.5px; }

/* controls */
.controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.ctl { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 130px; }
.ctl input[type=range] { width: 100%; accent-color: var(--accent); }
.toggle-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--muted); }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on { color: #fff; }
.btn { border: 1px solid var(--line-2); background: var(--panel); color: var(--muted);
  padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: 13px; transition: .1s; }
.btn:hover { border-color: var(--accent); color: var(--text); background: var(--bg-1); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
select.btn { color: var(--text); }

/* marker dashboard */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.mk {
  border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: var(--panel);
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.mk:hover { border-color: var(--line-2); box-shadow: var(--shadow-panel); transform: translateY(-1px); }
.mk.unavail { opacity: .9; background: repeating-linear-gradient(45deg, #F7F8FA, #F7F8FA 8px, #F0F2F5 8px, #F0F2F5 16px); box-shadow: none; }
.mk.unavail:hover { transform: none; box-shadow: none; }
.mk .top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.mk .nm { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.mk .dm { font-size: 11px; color: var(--muted); }
.mk .row { display: flex; justify-content: space-between; font-size: 12px; }
.mk .bar { height: 6px; border-radius: 4px; position: relative; overflow: hidden; background:#E5E7EB; }
.mk .bar > span { position: absolute; top: 0; bottom: 0; }
.gray-badge { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: var(--bg-1); }

/* contribution bars */
.contrib { display: flex; flex-direction: column; gap: 13px; margin-top: 6px; }
.contrib .row { display: grid; grid-template-columns: 200px 1fr 58px; align-items: center; gap: 18px; font-size: 12.5px; }
.contrib .row > span:first-child { line-height: 1.35; color: var(--text); }
.contrib .row:hover .track { box-shadow: 0 0 0 2px var(--accent-subtle); }
.contrib .track { height: 20px; background: #F1F3F7; border-radius: 7px; position: relative; overflow: hidden;
  border: 1px solid var(--line); transition: box-shadow .12s; }
.contrib .fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px;
  box-shadow: inset 0 -1px 1px rgba(0,0,0,0.07); }

/* tables */
table.tb { width: 100%; border-collapse: collapse; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.tb th, table.tb td { text-align: left; padding: 8px 11px; border-bottom: 1px solid var(--line); }
table.tb thead th { color: var(--muted-2); font-weight: 650; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; background: var(--bg-1); border-bottom: 1.5px solid var(--line-2); }
table.tb tbody tr:last-child td { border-bottom: none; }
table.tb tbody tr:hover { background: var(--accent-subtle); }
.num { font-family: var(--mono); text-align: right; }

/* report */
.report { display: flex; flex-direction: column; gap: 14px; }
.report .rsec h4 { font-size: 13.5px; margin-bottom: 4px; color: var(--accent); }
.report .rsec p, .report .rsec li { font-size: 13.5px; color: var(--text); margin: 2px 0; }
.report .rsec ul { margin: 4px 0 0; padding-left: 18px; }
.callout { border-left: 3px solid var(--mid); background: var(--mid-bg); padding: 11px 14px;
  border-radius: 0 9px 9px 0; font-size: 12.5px; color: var(--mid); line-height: 1.55; }
.callout.danger { border-color: var(--bad); background: var(--bad-bg); color: #991B1B; }
.callout.info { border-color: var(--info); background: var(--info-bg); color: #075985; }
/* plain-language "clinical lens" at the top of each in-depth tab (junior-doctor guide) */
.card.lens { padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--accent-subtle);
  margin-bottom: 14px; box-shadow: none; }
.lens-row { display: flex; gap: 10px; align-items: baseline; margin: 3px 0; line-height: 1.5; }
.lens-row.note { color: var(--ink-2); }
.lens-tag { flex: 0 0 70px; font-weight: 700; font-size: 10.5px; color: var(--accent);
  text-transform: uppercase; letter-spacing: .03em; }
.lens-text { font-size: 13.5px; color: var(--text); }
@media (max-width: 560px) { .lens-row { flex-direction: column; gap: 1px; } .lens-tag { flex: none; } }

/* dynamic states */
.states { display: flex; gap: 8px; flex-wrap: wrap; }
.state { flex: 1; min-width: 90px; border: 1px solid var(--line); border-radius: 9px; padding: 10px;
  background: var(--panel); text-align: center; box-shadow: var(--shadow); }
.state .big { font-size: 20px; font-weight: 700; font-family: var(--mono); }

/* safety footer (amber, matches research banner) */
.safety { border-top: 2px solid var(--banner-border); background: var(--banner-bg); }
.safety-toggle { width: 100%; text-align: left; padding: 10px 22px; background: transparent;
  border: 0; color: var(--banner-ink); font-weight: 700; font-size: 13px; }
.safety-body { padding: 0 22px; max-height: 0; overflow: hidden; transition: max-height .3s, padding .3s; font-size: 12.5px; color: var(--banner-ink); }
.safety-body.open { max-height: 460px; padding: 4px 22px 16px; }
.safety-body p { margin: 0 0 10px; opacity: .92; }

/* loader */
.loader { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; background: var(--bg); z-index: 100; color: var(--muted); }
.loader.hidden { display: none; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2);
  border-radius: 10px; background: var(--bg-1); }

/* ===== decision-support (DSS) features — tokenized to the braintwin design system ===== */
.dss-note { margin-top: 12px; padding: 9px 12px; font-size: 12px; line-height: 1.55;
  color: #075985; background: #F0F9FF; border: 1px solid #BAE6FD; border-radius: 8px; }   /* info tone — distinct from the amber safety banner */
.val-badge { margin-top: 12px; padding: 8px 12px; font-size: 12px; line-height: 1.5; border-radius: 8px; border: 1px solid; }
.val-badge.good { color: var(--good); background: var(--good-bg); border-color: #6EE7B7; }
.val-badge.warn { color: var(--mid); background: var(--warn-bg); border-color: #FCD34D; }

/* ⑤ evidence-tiered section header */
.dss-section { margin: 22px 0 4px; font-weight: 700; font-size: 13px; padding: 8px 13px; border-radius: 8px;
  letter-spacing: .01em; }
.dss-section.good { color: var(--good); background: var(--good-bg); border: 1px solid #6EE7B7; }
.hl-validated { border-left: 3px solid var(--good); }
.hl-box { padding: 2px; }
.hl-title { font-weight: 650; font-size: 13px; margin-bottom: 8px; color: var(--text); }

/* T2 decision band + T6 continuum (matches .band / .band .ptr) */
.dband { margin-top: 4px; }
.dband-bar, .cont-axis { position: relative; height: 15px; border-radius: 8px;
  background: linear-gradient(90deg, var(--td), #C8D9EF 50%, var(--asd)); overflow: visible;
  box-shadow: inset 0 1px 2px rgba(0,55,112,.10); border: 1px solid var(--line); }
.cont-axis { height: 12px; }
/* inconclusive zone — faint band demarcated by dashed boundaries (no murky fill) */
.dband-zone { position: absolute; top: 0; bottom: 0; background: rgba(100,116,141,.10);
  border-left: 1px dashed rgba(100,116,141,.5); border-right: 1px dashed rgba(100,116,141,.5); }
/* 90% interval — a thin ink capsule with a white halo so it reads cleanly over the gradient */
.dband-ci { position: absolute; top: 50%; height: 6px; transform: translateY(-50%);
  background: rgba(13,37,61,.22); border-radius: 4px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
/* estimate marker — white core, dark ring, lifted above the track */
.dband-dot, .cont-dot, .grad-dot { position: absolute; top: 50%; width: 16px; height: 16px; transform: translate(-50%, -50%);
  background: #fff; border: 3px solid var(--text); border-radius: 50%; box-shadow: 0 2px 5px rgba(0,55,112,.28); z-index: 2; }
.cont-dot { width: 12px; height: 12px; border-width: 2px; }
.dband-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 9px; }

/* T1 network heatmap — capped size (no aspect-ratio sprawl), readable fonts, horizontal codes */
.net-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; }
.net-heat-wrap { flex: 1 1 440px; min-width: 300px; max-width: 560px; }
.net-fp { flex: 1 1 340px; min-width: 300px; }
.net-fp > h3 { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
/* match the fingerprint column height to the heatmap: 8 bar-rows at the same 44px cell pitch */
.net-fp .sysbar { margin-top: 0; gap: 3px; }
.net-fp .sysbar-row { height: 44px; }
.net-fp .sysbar-track { height: 15px; }
.net-heat { display: grid; gap: 3px; align-items: center; width: 100%; }
.net-cell { height: 44px; border-radius: 5px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600; font-family: var(--mono); color: var(--text); }
.net-h-col { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; white-space: nowrap; padding-bottom: 2px; }
.net-h-row { font-size: 11.5px; color: var(--muted); text-align: right; padding-right: 8px; white-space: nowrap; }

/* system fingerprint / symptom bars */
.sysbar { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sysbar-row { display: grid; grid-template-columns: 130px 1fr 46px; align-items: center; gap: 8px; }
.sysbar-name { font-size: 12px; color: var(--text); }
.sysbar-track { position: relative; height: 12px; background: var(--bg-1); border-radius: 6px; overflow: hidden; }
.sysbar-track.center::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.sysbar-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px; }
.sysbar-val { font-size: 11.5px; font-family: var(--mono); text-align: right; color: var(--muted); }

/* T7 gradient ruler */
.grad-ruler { position: relative; height: 14px; margin-top: 18px; border-radius: 7px;
  background: linear-gradient(90deg, var(--mid), #C8D9EF 50%, var(--td)); box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }
.grad-td { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.grad-td::after { content: 'TD'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 9.5px; color: var(--text); }

/* T4 context rows */
.ctx-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ctx-row { display: grid; grid-template-columns: 152px 1fr; gap: 10px; align-items: center;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.ctx-row:first-child { border-color: var(--accent); background: var(--accent-subtle); }
.ctx-label { font-size: 12px; font-weight: 650; color: var(--text); }
.ctx-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* T5 model facts */
.mf-box { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; border: 1px solid var(--line);
  border-radius: 11px; overflow: hidden; }
.mf-row { display: grid; grid-template-columns: 152px 1fr; gap: 12px; padding: 11px 14px; background: var(--panel); }
.mf-row:nth-child(even) { background: var(--bg-1); }
.mf-k { font-size: 12px; font-weight: 650; color: var(--muted); }
.mf-v { font-size: 12.5px; line-height: 1.55; color: var(--text); }
.mfacts > h2::before { content: '🪪 '; }
@media (max-width: 720px) { .ctx-row, .mf-row { grid-template-columns: 1fr; gap: 4px; } .sysbar-row { grid-template-columns: 100px 1fr 42px; } }

/* ===== Stripe follow-up: featured dark-navy panel · cream interlude · display polish ===== */
/* Model Facts as the brand's featured deep-navy "spec sheet" surface */
.card.mfacts { background: var(--brand-dark); border-color: #2c2e6a; color: #E7E8F5; box-shadow: var(--shadow-panel); }
.card.mfacts > h2 { color: #fff; }
.card.mfacts > .hint { color: #AAB0DA; }
.card.mfacts .mf-box { border-color: #34376f; }
.card.mfacts .mf-row { background: rgba(255,255,255,.03); }
.card.mfacts .mf-row:nth-child(even) { background: rgba(255,255,255,.06); }
.card.mfacts .mf-k { color: #9CA1D4; }
.card.mfacts .mf-v { color: #E7E8F5; }
.card.mfacts .mf-v b { color: #fff; }
.card.mfacts .dss-note { background: rgba(252,211,77,.10); border-color: rgba(252,211,77,.45); color: #FCD34D; }
/* cream warm-interlude — the behaviour-first anchor (warm human context vs cool imaging data) */
.ctx-anchor { background: #FBF4E4; border: 1px solid #ECDDBC; }
.ctx-anchor .xs { color: var(--ink-2); }
/* display polish */
.dss-section { letter-spacing: -0.01em; }

/* ===== Overview hero — patient + the decision (score · verdict · band) in one scannable block ===== */
.card.hero { padding: 22px 24px; }
.hero-patient { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.hp-id { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; color: var(--text);
  display: inline-flex; align-items: center; }
.hp-id .dot { width: 9px; height: 9px; margin-right: 7px; }
.hp-meta { font-size: 12.5px; color: var(--muted); font-feature-settings: 'tnum'; }
.hero-grid { align-items: center; gap: 36px; }
.hero-decision { display: flex; flex-direction: column; }
.hero-score { font-size: 54px; line-height: 1; font-weight: 400; font-family: var(--sans);
  font-feature-settings: 'tnum' 'ss01'; letter-spacing: -0.045em; }
.hero-score-lbl { font-size: 10.5px; color: var(--muted-2); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600; margin-top: 9px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.hero-chips .pill { font-size: 12px; padding: 3px 11px; }
.hero-band > h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 10px; letter-spacing: -0.005em; }
/* recommended next step + behavior-first anchor */
.hero-next { display: flex; gap: 12px; align-items: baseline; margin-top: 18px;
  padding: 12px 15px; border-radius: 10px; border: 1px solid; }
.hero-next.warn { background: var(--warn-bg); border-color: #FDE68A; }
.hero-next.asd  { background: var(--asd-bg); border-color: var(--asd-soft); }
.hero-next.td   { background: var(--td-bg, #EFF6FF); border-color: var(--td-soft, #BFDBFE); }
.hero-next__label { flex: 0 0 auto; font-weight: 700; font-size: 12.5px; color: var(--text);
  white-space: nowrap; padding-right: 12px; border-right: 1px solid rgba(15,23,42,0.12); }
.hero-next__text { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.hero-anchor { margin-top: 12px; font-size: 12px; color: var(--ink-2, var(--muted));
  padding-left: 12px; border-left: 3px solid var(--accent-soft); }
@media (max-width: 640px) { .hero-next { flex-direction: column; gap: 4px; } .hero-next__label { border-right: 0; padding-right: 0; } }
@media (max-width: 1100px) {
  .hero-grid { gap: 18px; }
  .hero-band { padding-top: 18px; border-top: 1px solid var(--line); }
}

/* ===== readability — cap the measure (line length) on running text, clearer sub-heads, looser card rhythm ===== */
.view { gap: 18px; }
.hint { max-width: 78ch; }
.dss-note { max-width: 84ch; }
.callout { max-width: 92ch; }   /* keep alert text at a readable measure, not full-bleed */
.card h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: -0.006em; margin-bottom: 8px; }

/* ===== WCAG 2.1 AA — P1 focus-visible keyboard rings ===== */
.tab:focus-visible,
.lang-toggle button:focus-visible,
.subj:focus-visible,
.chip:focus-visible,
.btn:focus-visible,
.persona-btn:focus-visible,
.safety-toggle:focus-visible,
.rb-back:focus-visible,
input[type=range]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== WCAG 2.1 AA — P1 prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .spinner { animation: none !important; }
}
@media (prefers-reduced-motion: no-preference) {
  .mk { transition: border-color .12s, box-shadow .12s, transform .12s; }
  .safety-body { transition: max-height .3s, padding .3s; }
  .spinner { animation: spin 1s linear infinite; }
}

/* ===== embedded in the unified report shell (report.html) =====
   The shell carries the brand + research banner + dataset badges, so suppress the
   redundant per-view chrome here; keep the functional language toggle. */
html.embedded .research-banner { display: none; }
html.embedded .topbar { display: none; }   /* shell carries brand + dataset badges + language toggle */
