/* FlyLab bench styles.
   Colour tokens follow the validated data-viz palette: categorical slots for
   transmitters, a blue/orange pair for insect vs vertebrate, a blue<->red
   diverging pair (neutral grey midpoint) for "change vs vehicle", and a single
   blue ramp for magnitude. Every value is declared once here and consumed by
   both the CSS and the Plotly/cytoscape layer (via getComputedStyle), so light
   and dark stay in step. */

:root {
  color-scheme: light;

  --page: #f4f2ee;
  --surface: #fcfcfb;
  --surface-2: #f0eee9;
  --text-1: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.12);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06);

  /* insect vs vertebrate (2 slots, all-pairs validated) */
  --insect: #2a78d6;
  --vertebrate: #eb6834;

  /* transmitters (7 hue slots in documented order + neutral "unclear") */
  --nt-acetylcholine: #2a78d6;
  --nt-gaba: #eb6834;
  --nt-glutamate: #1baf7a;
  --nt-octopamine: #eda100;
  --nt-dopamine: #e87ba4;
  --nt-serotonin: #008300;
  --nt-histamine: #4a3aa7;
  --nt-unclear: #898781;

  /* diverging: suppressed <-> vehicle <-> enhanced */
  --div-low: #2a78d6;
  --div-mid: #f0efec;
  --div-high: #d03b3b;

  /* sequential blue ramp (magnitude) */
  --seq-100: #cde2fb;
  --seq-250: #86b6ef;
  --seq-400: #3987e5;
  --seq-550: #1c5cab;
  --seq-700: #0d366b;

  /* status */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --accent: #1c5cab;
  --accent-ink: #ffffff;

  --radius: 8px;
  --gap: 14px;
  --sidebar-w: 268px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* placeholder so the media query below can override cleanly */
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --text-1: #ffffff;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.14);
    --shadow: none;
    --insect: #3987e5;
    --vertebrate: #d95926;
    --nt-acetylcholine: #3987e5;
    --nt-gaba: #d95926;
    --nt-glutamate: #199e70;
    --nt-octopamine: #c98500;
    --nt-dopamine: #d55181;
    --nt-serotonin: #008300;
    --nt-histamine: #9085e9;
    --nt-unclear: #898781;
    --div-low: #3987e5;
    --div-mid: #383835;
    --div-high: #e66767;
    --seq-100: #0d366b;
    --seq-250: #184f95;
    --seq-400: #2a78d6;
    --seq-550: #6da7ec;
    --seq-700: #cde2fb;
    --accent: #3987e5;
    --accent-ink: #0d0d0d;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --text-1: #ffffff;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: none;
  --insect: #3987e5;
  --vertebrate: #d95926;
  --nt-acetylcholine: #3987e5;
  --nt-gaba: #d95926;
  --nt-glutamate: #199e70;
  --nt-octopamine: #c98500;
  --nt-dopamine: #d55181;
  --nt-serotonin: #008300;
  --nt-histamine: #9085e9;
  --nt-unclear: #898781;
  --div-low: #3987e5;
  --div-mid: #383835;
  --div-high: #e66767;
  --seq-100: #0d366b;
  --seq-250: #184f95;
  --seq-400: #2a78d6;
  --seq-550: #6da7ec;
  --seq-700: #cde2fb;
  --accent: #3987e5;
  --accent-ink: #0d0d0d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}

a { color: var(--accent); }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 100;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin: 0;
}
.brand span { color: var(--accent); }
.tagline {
  color: var(--muted);
  font-size: 12px;
  flex: 1 1 220px;
  min-width: 0;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  padding: var(--gap);
  padding-bottom: 56px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 62px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.sidebar h2, .panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}

.field { margin-bottom: 12px; }
.field > label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
  font-weight: 500;
}
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }

select, input[type="text"], input[type="number"], input[type="search"], textarea {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  color: var(--text-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
textarea { font-family: var(--mono); font-size: 12px; min-height: 96px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
select:focus-visible, input:focus-visible, button:focus-visible, textarea:focus-visible,
[role="tab"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  font: inherit;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: progress; }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  width: 100%;
  padding: 9px 12px;
}
button.small { padding: 4px 9px; font-size: 12px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface-2);
  white-space: nowrap;
}
.badge.tier-literature_order { border-color: var(--good); color: var(--good); }
.badge.tier-class_placeholder { border-color: var(--warning); color: var(--text-2); }
.badge.tier-measured_fit { border-color: var(--accent); color: var(--accent); }

.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  background: var(--surface-2);
}

/* ---------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
}
[role="tab"] {
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
[role="tab"][aria-selected="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.panel { display: none; }
.panel.active { display: block; }
.panel-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-head h1 { font-size: 17px; margin: 0; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; flex: 1 1 200px; }
.panel-head .row, .panel-head > button { align-self: center; }
.panel-head select[multiple] { max-height: 52px; }

.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.span-all { grid-column: 1 / -1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  min-width: 0;
}
.card h3 {
  font-size: 13px;
  margin: 0 0 2px;
  font-weight: 600;
}
.card .sub { font-size: 11.5px; color: var(--muted); margin: 0 0 10px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }

.plot { width: 100%; min-height: 60px; }
.plot .svg-container { position: relative !important; }

/* stat tiles */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-2);
}
.tile .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tile .v { font-size: 22px; font-weight: 600; line-height: 1.2; }
.tile .u { font-size: 11px; color: var(--text-2); }

/* gain meters: diverging around vehicle = 1.0 */
.meters { display: grid; gap: 8px; }
.meter { display: grid; grid-template-columns: 78px 1fr 62px; gap: 8px; align-items: center; }
.meter .name { font-size: 12px; color: var(--text-2); font-family: var(--mono); }
.meter .track {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: var(--div-mid);
  border: 1px solid var(--border);
  overflow: hidden;
}
.meter .track::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--baseline);
}
.meter .fill { position: absolute; top: 0; bottom: 0; }
.meter .val { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

/* tables */
.table-wrap { overflow-x: auto; max-height: 360px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td {
  text-align: left;
  padding: 5px 7px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
td .mono, table .mono { font-family: var(--mono); font-size: 11.5px; }
thead th {
  white-space: normal;
  line-height: 1.25;
  position: sticky;
  top: 0;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 1;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* long free-text columns wrap instead of forcing a horizontal scroll */
#tbl-mechanism td:last-child,
#tbl-paths td:nth-child(2) { white-space: normal; min-width: 180px; }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
tr.selected { background: var(--surface-2); outline: 1px solid var(--accent); }

.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: baseline;
}

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); margin-top: 8px; }
.legend span.item { display: inline-flex; align-items: center; gap: 5px; }
.legend .dash { width: 16px; height: 0; border-top: 2px dashed currentColor; }
.legend .solid { width: 16px; height: 0; border-top: 2px solid currentColor; }

/* notices */
.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--surface-2);
  margin-bottom: 10px;
}
.notice.info { border-left-color: var(--accent); }
.notice.serious { border-left-color: var(--serious); }
.notice b { color: var(--text-1); }
.notice::before { content: "! "; font-weight: 700; color: var(--warning); }
.notice.info::before { content: "i "; color: var(--accent); }

.empty { color: var(--muted); font-size: 12.5px; padding: 18px 0; text-align: center; }

pre.json {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 0;
}

/* cytoscape */
#cy {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}

/* ---------------------------------------------------------------- drawer */
.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  transform: translateX(101%);
  transition: transform 0.18s ease;
  z-index: 40;
}
.drawer[data-open="true"] { transform: none; }
.drawer h2 { margin-top: 0; }
.drawer ul { margin: 0; padding-left: 18px; }
.drawer li { font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.drawer-close { position: absolute; right: 12px; top: 12px; }

/* ---------------------------------------------------------------- status */
.statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 5px 14px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 25;
}
.statusbar .mono { font-family: var(--mono); }
.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.statusbar .dot[data-state="busy"] { background: var(--warning); }
.statusbar .dot[data-state="ok"] { background: var(--good); }
.statusbar .dot[data-state="error"] { background: var(--critical); }
.statusbar .spacer { flex: 1 1 auto; }

/* ---------------------------------------------------------------- toasts */
.toasts {
  position: fixed;
  right: 14px;
  bottom: 42px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  max-width: min(400px, 92vw);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--critical);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.toast.info { border-left-color: var(--accent); }
.toast.ok { border-left-color: var(--good); }
.toast b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
}
@media (max-width: 640px) {
  :root { --gap: 10px; }
  body { font-size: 13.5px; }
  .shell { padding: 10px; padding-bottom: 70px; }
  .grid, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  [role="tab"] { white-space: nowrap; }
  #cy { height: 380px; }
  .topbar { padding: 8px 10px; }
  .tagline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ================================================================== */
/* Dashboard: the interpretation layer                                */
/* ================================================================== */

/* --- secondary (bench) tab row ------------------------------------ */
.tabs.bench {
  margin-top: -6px;
  background: transparent;
  border-style: dashed;
  padding: 5px 6px;
  align-items: center;
}
.tabs.bench .tabs-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 6px 0 2px;
  font-weight: 600;
}
.tabs.bench [role="tab"] { font-size: 12px; padding: 4px 9px; }

/* --- dose rail: the slider every card listens to ------------------- */
.dose-rail {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: var(--gap);
}
.dose-rail > label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.dose-rail input[type="range"] { flex: 1 1 220px; min-width: 160px; }
.dose-rail output {
  font-size: 15px;
  font-weight: 600;
  min-width: 96px;
  color: var(--text-1);
}
.dose-rail .ladder { display: flex; gap: 4px; flex-wrap: wrap; }
.dose-rail .ladder button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.dose-rail .hint { flex: 1 1 100%; margin: 0; }

/* --- compound overview: the one hero figure on the page ------------ */
.overview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: var(--gap);
}
.overview .hero {
  font-size: clamp(26px, 4.2vw, 40px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  /* proportional figures: tabular-nums makes a display number look loose */
  font-variant-numeric: normal;
}
.overview .hero .dose { color: var(--accent); }
.overview .facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.overview .facts b { color: var(--text-1); font-weight: 600; }
.overview .coverage {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* --- classification chips: the defining visual feature ------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  font-family: var(--font);
  line-height: 1.7;
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  flex: none;
}
.chip:hover, .chip:focus-visible { border-color: currentColor; }
.chip[data-k="LITERATURE"] { color: var(--good); }
.chip[data-k="MODEL-DERIVED"] { color: var(--accent); }
.chip[data-k="MODEL-ASSUMPTION"] { color: var(--serious); }
.chip[data-k="PREDICTION"] { color: var(--nt-histamine); }
.chip[data-k="NOT MODELLED"] { color: var(--muted); }
.chip[data-k="NOT MODELLED"]::before {
  background: repeating-linear-gradient(
    45deg, currentColor 0 2px, transparent 2px 4px
  );
}
.chip.static { cursor: help; }

/* --- KPI tiles ----------------------------------------------------- */
.tiles.kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: var(--gap); }
.tiles.kpi .tile { background: var(--surface); }
.tile .v.big { font-size: 28px; font-variant-numeric: normal; }
.tile .chiprow { margin-top: 6px; }
.tile .note { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* --- generated explanation ---------------------------------------- */
.card.why {
  margin-bottom: var(--gap);
  border-left: 3px solid var(--accent);
}
.card.why p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-1); }
.card.why .src { margin-top: 8px; font-size: 11px; color: var(--muted); }

/* --- verdict line (dependence) ------------------------------------- */
.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 0 10px;
}
.verdict .mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--muted);
  flex: none;
}
.verdict[data-class="topology-dependent"] .mark { background: var(--accent); }
.verdict[data-class="composition-dominated"] .mark { background: var(--serious); }
.verdict[data-class="network-insensitive"] .mark { background: var(--muted); }
.verdict .why { font-weight: 400; font-size: 12px; color: var(--muted); flex: 1 1 260px; }

/* --- fact / inference / unknown ------------------------------------ */
.fiu { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.fiu section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-2);
  min-width: 0;
}
.fiu h4 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.fiu ul { margin: 0; padding-left: 16px; }
.fiu li { font-size: 12px; color: var(--text-2); margin-bottom: 7px; overflow-wrap: anywhere; }

/* --- claim chain --------------------------------------------------- */
.chain { display: grid; gap: 8px; }
.chain .link {
  display: grid;
  grid-template-columns: 22px minmax(120px, 190px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-left: 2px solid var(--grid);
  padding: 6px 0 6px 10px;
}
.chain .link .n { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.chain .link .step { font-size: 12.5px; font-weight: 600; }
.chain .link .what { font-size: 12px; color: var(--text-2); }

/* --- deeper analyses ------------------------------------------------ */
.analysis-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.analysis {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-2);
}
.analysis h4 { margin: 0 0 3px; font-size: 12.5px; }
.analysis p { margin: 0 0 8px; font-size: 11.5px; color: var(--muted); }
.analysis .est { font-size: 11.5px; color: var(--text-2); margin-bottom: 8px; font-variant-numeric: tabular-nums; }

/* --- provenance drawer --------------------------------------------- */
#provenance dl { margin: 0; }
#provenance dt {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 12px;
  font-weight: 600;
}
#provenance dd {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-1);
  overflow-wrap: anywhere;
}
#provenance dd.source { color: var(--text-2); font-size: 12px; line-height: 1.5; }
#provenance .prov-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
#provenance .prov-head .name { font-family: var(--mono); font-size: 13px; }

/* table cells that hold a chip stop being nowrap */
td .chip { vertical-align: middle; }
#tbl-dash-trust td:nth-child(3),
#tbl-evidence td:nth-child(7),
#tbl-dash-vert td:last-child { white-space: normal; min-width: 180px; }

@media (max-width: 640px) {
  .dose-rail { padding: 10px; }
  .chain .link { grid-template-columns: 18px minmax(0, 1fr); }
  .chain .link .what { grid-column: 2; }
}

/* the trust panel and the claim chain are read in full, never scrolled inside
   their card: cutting either one hides exactly the caveat it exists to show */
#card-trust .table-wrap { max-height: none; overflow-y: visible; }
#card-trust td:nth-child(2) { white-space: normal; min-width: 150px; }
.chain .link .step { overflow-wrap: anywhere; }
.tile .v { overflow-wrap: anywhere; }
.facts-list p { margin: 0 0 8px; font-size: 12.5px; }
.facts-list p:last-of-type { margin-bottom: 0; }

/* the close button floats over the drawer heading; keep the title clear of it */
.drawer h2 { padding-right: 76px; }

/* ---------------------------------------------------------------- tour
   The guided tour is a ring around a real panel plus a card that explains it.
   Two rules shape the CSS: the ring never receives pointer events, so the
   bench stays fully usable while the tour is open, and there is no backdrop,
   so nothing is ever hidden behind a modal.  Both themes inherit the tokens
   above; nothing here introduces a colour of its own. */
.tour-ring {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  z-index: 55;
  transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}
.tour-card {
  position: absolute;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  padding: 13px 14px 12px;
  z-index: 56;
}
.tour-card .tour-step {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 3px;
}
.tour-card h3 { margin: 0 0 6px; font-size: 14px; color: var(--text-1); }
.tour-card p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.tour-card p.tour-caveat {
  border-left: 2px solid var(--serious);
  padding-left: 9px;
  color: var(--text-1);
}
.tour-card .tour-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tour-card .tour-actions .spacer { flex: 1 1 auto; }
.tour-card .tour-dots { display: flex; gap: 4px; }
.tour-card .tour-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--baseline);
  display: block;
}
.tour-card .tour-dots i[data-now="true"] { background: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .tour-ring { transition: none; }
}
@media (max-width: 640px) {
  .tour-card { width: calc(100vw - 24px); left: 12px !important; }
}

/* "How to read this" sits with the dashboard heading, not in a toolbar: the
   question it answers is asked while looking at the numbers. */
.howto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 2px 10px;
}
.howto:hover, .howto:focus-visible { border-style: solid; border-color: var(--accent); }
.panel-head .head-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
