/* Self-hosted IBM Plex (SIL OFL) — same TTFs as the iOS bundle, so the app
   is offline-complete and matches across platforms. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap;
  src: url("./public/fonts/IBMPlexSans-Regular.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap;
  src: url("./public/fonts/IBMPlexSans-Medium.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap;
  src: url("./public/fonts/IBMPlexSans-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap;
  src: url("./public/fonts/IBMPlexSans-Bold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap;
  src: url("./public/fonts/IBMPlexMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap;
  src: url("./public/fonts/IBMPlexMono-Medium.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap;
  src: url("./public/fonts/IBMPlexMono-SemiBold.ttf") format("truetype"); }

/* Kairos Tier 5 palette — "Ink & Ember on Parchment" (decided 2026-09-03).
   Light-first, warm-neutral ground, ember accent used sparingly. Distinct from
   AnesCalc (navy + gold) and CRISIS (near-black + teal + serif). Tokens only.
   Font stack prefers IBM Plex Sans/Mono; self-hosted woff2 is a follow-up, so
   the stack falls back to the system sans until those files land. */
:root {
  --bg: #f2f1ed;
  --surface: #fbfaf8;
  --surface-2: #f0eee7;
  --text: #1c1a24;
  --muted: #6b6862;
  --line: #e3e1db;
  --accent: #c6521c;
  --accent-deep: #8e2810;
  --sev-low: #3f7a4e;
  --sev-moderate: #c6521c;
  --sev-high: #b4322a;
  --sev-critical: #8a2020;
  /* section tints — muted, low-chroma; distinguishable without a color wheel */
  --sec-procedures: #5b6b7a;
  --sec-calculators: #4a4754;
  --sec-drug-dosing: #b5602e;
  --sec-reference-library: #6e6a4e;
  --sec-peds-module: #8a5a6b;
  --radius: 12px;
  --radius-lg: 16px;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-family: var(--font-sans);
  color-scheme: light;

  /* diagram tokens — semantic palette for declarative vector figures
     (common.schema.json#/$defs/diagramColor). Mirrored in DiagramView.swift. */
  --dg-outline: #3a3742;
  --dg-surface: #fbfaf8;
  --dg-tissue: #f0ddd2;
  --dg-bone: #eae6dc;
  --dg-lumen: #dfe6ea;
  --dg-muscle: #cf9384;
  --dg-vessel: #8c5a86;
  --dg-accent: var(--accent);
  --dg-danger: var(--sev-high);
  --dg-warning: var(--sev-moderate);
  --dg-good: var(--sev-low);
  --dg-muted: var(--muted);
  --dg-text: var(--text);
}
/* one place to recolour a section: --tint is set per-section on .tile / .content */
[data-section="procedures"] { --tint: var(--sec-procedures); }
[data-section="calculators"] { --tint: var(--sec-calculators); }
[data-section="drug-dosing"] { --tint: var(--sec-drug-dosing); }
[data-section="reference-library"] { --tint: var(--sec-reference-library); }
[data-section="peds-module"] { --tint: var(--sec-peds-module); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1e;
    --surface: #242329;
    --surface-2: #201f25;
    --text: #e9e7e1;
    --muted: #9b978f;
    --line: #34323b;
    --accent: #e5843f;
    --accent-deep: #c6521c;
    --sev-low: #4e9a63;
    --sev-moderate: #e5843f;
    --sev-high: #d9564a;
    --sev-critical: #c24438;
    --sec-procedures: #7e8e9d;
    --sec-calculators: #6c6879;
    --sec-drug-dosing: #d0824f;
    --sec-reference-library: #9a9578;
    --sec-peds-module: #b27e90;
    color-scheme: dark;
    /* diagram tokens — dark variants (fills desaturated so strokes stay readable) */
    --dg-outline: #c9c5d0;
    --dg-surface: #242329;
    --dg-tissue: #4a3b36;
    --dg-bone: #4a473f;
    --dg-lumen: #33404a;
    --dg-muscle: #8a5145;
    --dg-vessel: #9d6b96;
    --dg-accent: var(--accent);
    --dg-danger: var(--sev-high);
    --dg-warning: var(--sev-moderate);
    --dg-good: var(--sev-low);
    --dg-muted: var(--muted);
    --dg-text: var(--text);
  }
}
/* explicit override wins in both directions, regardless of OS scheme */
:root[data-theme="dark"] {
  --bg: #1a1a1e;
  --surface: #242329;
  --surface-2: #201f25;
  --text: #e9e7e1;
  --muted: #9b978f;
  --line: #34323b;
  --accent: #e5843f;
  --accent-deep: #c6521c;
  --sev-low: #4e9a63;
  --sev-moderate: #e5843f;
  --sev-high: #d9564a;
  --sev-critical: #c24438;
  --sec-procedures: #7e8e9d;
  --sec-calculators: #6c6879;
  --sec-drug-dosing: #d0824f;
  --sec-reference-library: #9a9578;
  --sec-peds-module: #b27e90;
  color-scheme: dark;

  /* diagram tokens — dark variants (fills desaturated so strokes stay readable) */
  --dg-outline: #c9c5d0;
  --dg-surface: #242329;
  --dg-tissue: #4a3b36;
  --dg-bone: #4a473f;
  --dg-lumen: #33404a;
  --dg-muscle: #8a5145;
  --dg-vessel: #9d6b96;
  --dg-accent: var(--accent);
  --dg-danger: var(--sev-high);
  --dg-warning: var(--sev-moderate);
  --dg-good: var(--sev-low);
  --dg-muted: var(--muted);
  --dg-text: var(--text);
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* form controls don't inherit type by default — keep them in IBM Plex, not Arial */
input, button, select, textarea { font: inherit; color: inherit; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.shell { display: flex; justify-content: center; gap: 34px; }
.app { max-width: 720px; width: 100%; margin: 0; padding: 20px calc(16px + env(safe-area-inset-right)) 72px calc(16px + env(safe-area-inset-left)); }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.4rem; margin: 0 0 8px; letter-spacing: -0.01em; text-wrap: balance; }

/* ---------- desktop nav rail (>= 960px) ---------- */
.nav-rail { display: none; }
@media (min-width: 960px) {
  .nav-rail {
    display: flex; flex-direction: column; flex: none;
    width: 228px; align-self: flex-start;
    position: sticky; top: 0; height: 100vh;
    padding: 26px 8px 24px 20px;
    border-right: 1px solid var(--line);
  }
  .app { padding-top: 28px; }
}
.rail-brand {
  display: flex; align-items: center; gap: 7px;
  padding: 2px 10px 18px; color: var(--text);
  font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em;
}
.rail-brand i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }
.rail-nav { display: flex; flex-direction: column; gap: 1px; }
.rail-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--muted); font-size: .9rem;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.rail-link:hover { background: var(--surface-2); color: var(--text); }
.rail-link.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.rail-link.active .rail-label { font-weight: 600; }
.rail-mark { width: 13px; height: 13px; border-radius: 4px; flex: none; background: var(--tint, var(--muted)); }
.rail-label { flex: 1; }
.rail-count { font-family: var(--font-mono); font-size: .72rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.rail-foot { margin-top: auto; padding: 14px 10px 0; font-family: var(--font-mono); font-size: .74rem; color: var(--muted); }
.rail-foot a { color: var(--muted); }
.rail-foot a:hover { color: var(--accent); }
/* with the rail present, the home view's brand + section list would be duplicates */
.home-hint { display: none; }
@media (min-width: 960px) {
  .nav-rail ~ .app .home .brand,
  .nav-rail ~ .app .home .section-tiles,
  .nav-rail ~ .app .home .section-tiles-label:not(.pinned-label) { display: none; }
  .nav-rail ~ .app .home .searchbar { margin-top: 6px; }
  .nav-rail ~ .app .home .home-hint {
    display: block; margin: 12px 0 18px; color: var(--muted);
    font-family: var(--font-mono); font-size: .82rem;
  }
}

/* ---------- mobile bottom tab bar (< 960px) — the rail's counterpart ---------- */
.tab-bar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px calc(4px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
}
@media (min-width: 960px) { .tab-bar { display: none; } }
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 9px; color: var(--muted);
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .02em;
}
.tab-icon { font-size: 1.15rem; line-height: 1; }
.tab-item.active { color: var(--accent); }
.tab-item.active .tab-icon { color: var(--accent); }
@media (max-width: 959px) {
  .app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

h3 { margin: 18px 0 6px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.loading { padding: 40px 0; text-align: center; }
.back { display: inline-block; font-size: .82rem; font-family: var(--font-mono); color: var(--muted); }
.back:hover { color: var(--accent); }
.detail-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pin-btn {
  font-family: var(--font-mono); font-size: .74rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  background: var(--surface); color: var(--muted);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.pin-btn:hover { border-color: var(--muted); color: var(--text); }
.pin-btn.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* numbers read as instrument output, not prose */
.score strong, .formula-result strong, .dose-amt strong,
.adc-label, .setting-label, .result-section, .sources-block h2,
.why-matters h4, .takeaway h4, .settings, .last-verified, .flag {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- home ---------- */
.home { display: flex; flex-direction: column; }

.brand {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.brand h1 {
  font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0;
  line-height: 1;
}
.brand h1::after {
  /* the "one struck point" — a single ember tick, echoing the app icon */
  content: ""; display: inline-block; width: 9px; height: 9px;
  margin-left: 8px; border-radius: 2px; background: var(--accent);
  transform: translateY(-2px);
}
.brand p {
  margin: 0; color: var(--muted);
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em;
}

.searchbar { position: relative; margin: 0 0 16px; }
.searchbar::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 15px; height: 15px;
  transform: translateY(-50%);
  background: var(--muted);
  -webkit-mask: no-repeat center / contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>');
  mask: no-repeat center / contain url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>');
  pointer-events: none;
}
.search-input {
  width: 100%; padding: 13px 14px 13px 38px; font: inherit; font-size: 1rem;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* filter chips only appear while searching */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: .78rem; cursor: pointer;
  font-family: var(--font-mono);
}
.chip:hover { border-color: var(--muted); }
.chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

.setting-chips { align-items: center; margin: 0 0 20px; }
.setting-chips .setting-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-right: 4px; }
.lens-sep { width: 1px; align-self: stretch; min-height: 16px; background: var(--line); margin: 0 3px; }
.section-lens { margin: 10px 0 4px; }
/* Peds lens — a toggle, not a one-of-many chip: keep an outline even when off */
.peds-toggle { border-color: var(--muted); }
.peds-toggle::before { content: "◐ "; opacity: .7; }
.peds-toggle.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* a cross-listed row (peds tool showing in an adult clinical section) */
.xlist-badge {
  margin-left: 8px; font-family: var(--font-mono); font-size: .64rem;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--sec-peds-module);
  border: 1px solid color-mix(in srgb, var(--sec-peds-module) 45%, var(--line));
  border-radius: 5px; padding: 1px 5px; vertical-align: 1px;
}

/* curated home-screen shortcuts */
.pinned { margin: 2px 0 20px; }
.pin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.pin-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 15px; border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-left: 3px solid var(--accent);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.pin-card:hover { transform: translateY(-1px); box-shadow: 0 2px 12px -5px color-mix(in srgb, var(--accent) 60%, transparent); }
.pin-label { font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.pin-blurb { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }

.results { display: grid; gap: 18px; }
.result-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 6px; }
.result-group ul { list-style: none; margin: 0; padding: 0; }
.result-item { display: flex; flex-direction: column; gap: 1px; padding: 11px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; }
.result-item:hover { border-color: var(--accent); }
.ri-title { font-weight: 500; }
.ri-cat { font-size: .76rem; color: var(--muted); }

/* section list — the one list of sections, with the core-question descriptions */
.section-tiles { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.section-tiles-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 4px 0 2px; }
.tile {
  position: relative; display: grid;
  grid-template-columns: auto 1fr; align-items: center; gap: 3px 14px;
  padding: 15px 16px 15px 17px;
  background: color-mix(in srgb, var(--tint, var(--line)) 9%, var(--surface));
  border: 1px solid var(--line);
  border-left: 3px solid var(--tint, var(--line));
  border-radius: var(--radius-lg);
  transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.tile:hover { border-color: var(--tint, var(--muted)); transform: translateY(-1px); box-shadow: 0 2px 12px -5px color-mix(in srgb, var(--tint, var(--muted)) 70%, transparent); }
.tile:active { transform: translateY(0); box-shadow: none; }
.tile-mark {
  grid-column: 1; grid-row: 1 / span 2; align-self: center;
  width: 20px; height: 20px; border-radius: 5px; flex: none;
  background: var(--tint, var(--muted));
}
.tile-title { grid-column: 2; grid-row: 1; font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; color: var(--text); }
.tile-q { grid-column: 2; grid-row: 2; font-size: .82rem; color: var(--muted); line-height: 1.4; }

/* content */
.content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 20px 22px; }
.content[style*="--tint"] {
  border-top: 3px solid var(--tint);
  background: linear-gradient(color-mix(in srgb, var(--tint) 6%, transparent), transparent 150px), var(--surface);
}
.content h1, .content h2, .prose h2, .prose h3 { letter-spacing: -0.01em; text-wrap: balance; }
.content > h1:first-of-type, .content .back + h1 {
  font-size: 1.55rem; font-weight: 700; margin: 0 0 12px; padding-bottom: 12px;
  border-bottom: 2px solid color-mix(in srgb, var(--tint, var(--line)) 45%, var(--line));
}
.purpose { color: var(--muted); margin: 4px 0 14px; font-size: .95rem; }
.settings { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.field-grid { display: grid; gap: 10px; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }
.field-label .unit { color: var(--muted); }
.field-input { position: relative; display: flex; align-items: center; }
.field-input input, .field-input select { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 1rem; }
.field-input input { padding: 10px 34px 10px 12px; }
.field-input select { padding: 10px 12px; }
.field-input input:focus, .field-input select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.clear-field { position: absolute; right: 6px; width: 22px; height: 22px; border-radius: 999px; border: none; background: var(--line); color: var(--text); cursor: pointer; font-size: .7rem; line-height: 1; }
.toolbar { margin: 14px 0; display: flex; justify-content: flex-end; }
.clear-all { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }

.item { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 8px 10px; }
.item legend { font-weight: 600; padding: 0 4px; }
.opts { display: grid; gap: 6px; }
.opt { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; }
.opt.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.opt .pts { color: var(--muted); font-variant-numeric: tabular-nums; }

.result-box { margin-top: 16px; display: grid; gap: 10px; }
.progress { display: grid; gap: 6px; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .2s ease; }
.progress-label { margin: 0; font-family: var(--font-mono); font-size: .78rem; }
.score { font-size: 1rem; color: var(--muted); }
.score strong { font-size: 1.6rem; color: var(--text); margin-left: 4px; }
.band { padding: 11px 13px; border-radius: 10px; border-left: 4px solid var(--muted); background: var(--surface-2); }
.band strong { letter-spacing: -0.01em; }
.band.sev-low { border-color: var(--sev-low); }
.band.sev-moderate { border-color: var(--sev-moderate); }
.band.sev-high { border-color: var(--sev-high); }
.band.sev-critical { border-color: var(--sev-critical); background: color-mix(in srgb, var(--sev-critical) 8%, var(--surface-2)); }
.band p { margin: 4px 0 0; }
.dispo { color: var(--muted); }
.formula-result { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.formula-result .flabel { flex: 1; min-width: 60%; color: var(--muted); font-size: .9rem; }
.formula-result strong { font-size: 1.15rem; }

.plot-box { margin-top: 14px; }
.nomogram { margin: 0; }
.nomogram svg { width: 100%; height: auto; display: block; border-radius: var(--radius); }
.nomogram .nom-tick { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; font-variant-numeric: tabular-nums; }
.nomogram .nom-axis { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; }
.nomogram .nom-curve { fill: var(--sev-high); font-family: var(--font-mono); font-size: 10px; }
.nomogram figcaption { margin-top: 6px; font-size: .82rem; color: var(--muted); font-family: var(--font-mono); }

.flags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.flag { font-size: .72rem; background: color-mix(in srgb, var(--sev-moderate) 25%, transparent); color: var(--text); border-radius: 6px; padding: 2px 6px; }
.build-note { margin-top: 14px; font-size: .88rem; color: var(--muted); }
.last-verified { margin-top: 14px; font-size: .8rem; color: var(--muted); }

/* Reference Library standard template framing */
.why-matters, .takeaway { margin: 4px 0 14px; padding: 10px 12px; border-radius: 10px; }
.why-matters h4, .takeaway h4 { margin: 0 0 4px; font-family: var(--font-mono); font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.why-matters p, .takeaway p { margin: 0; }
/* context / background — quiet: hairline rule, no ember */
.why-matters { background: color-mix(in srgb, var(--muted) 6%, var(--surface)); border-left: 2px solid var(--line); }
.why-matters h4 { color: var(--muted); }
/* the punchline — the one struck point on the page */
.takeaway { margin: 16px 0 4px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-left: 3px solid var(--accent); }
.takeaway h4 { color: var(--accent); }
.takeaway p { font-weight: 500; }

/* per-page Sources block (always visible, numbered) */
.sources-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.sources-block h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.sources-block ol { margin: 0; padding-left: 20px; font-size: .85rem; color: var(--text); }
.sources-block li { margin: 3px 0; overflow-wrap: anywhere; } /* long URLs and DOIs wrap on phones */
.sources-all { margin: 6px 0 0; font-size: .8rem; }

/* global Sources page (Settings -> Sources) */
.sources-page h2 { font-size: .95rem; margin: 20px 0 8px; }
.sources-ol { margin: 0; padding-left: 20px; }
.sources-ol li { margin: 0 0 10px; overflow-wrap: anywhere; }
.src-text { font-size: .92rem; }
.src-usedby { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.src-usedby a { color: var(--accent); }
.notes { font-size: .9rem; color: var(--muted); }

/* reference prose */
.prose h2 {
  display: flex; align-items: baseline; gap: 9px;
  font-size: 1.16rem; font-weight: 600;
  margin: 30px 0 8px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.prose h2::before {
  content: ""; flex: none; width: 3px; height: .8em; border-radius: 2px;
  background: var(--tint, var(--accent)); transform: translateY(1px);
}
.prose h3 { font-size: 1.02rem; font-weight: 600; margin: 18px 0 4px; }
.prose > *:first-child { margin-top: 0; }
.prose > h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.prose ul, .prose ol { padding-left: 18px; }
.prose li { margin: 3px 0; }
/* Nested lists (common.schema.json#/$defs/listItem). A sub-list is a
   continuation of its parent item, so it sits tighter than a sibling gap
   would suggest, and each level changes marker so depth reads at a glance
   without extra indentation — screen width is the scarce resource here. */
.prose li > ul, .prose li > ol,
.node-body li > ul, .node-body li > ol,
.tree-walker li > ul, .tree-walker li > ol { margin: 4px 0 6px; padding-left: 17px; }
/* Markers are set explicitly at every level, not inherited from the UA
   sheet: a step's substeps list lives inside `ol.nodes`, and the UA rule
   `ol ul` would silently start it at `circle` — so level 1 and level 2 would
   look identical. */
.prose > ul, .node-body > ul, .tree-walker > ul { list-style-type: disc; }
.prose li > ul, .node-body li > ul, .tree-walker li > ul { list-style-type: circle; }
.prose li > ul ul, .node-body li > ul ul, .tree-walker li > ul ul { list-style-type: square; }
.prose ol.numbered, .node-body ol.numbered, .tree-walker ol.numbered { list-style-type: decimal; }
.prose li > ol.numbered, .node-body li > ol.numbered,
.tree-walker li > ol.numbered { list-style-type: lower-alpha; }
/* A procedure step's sub-steps hang off its prose rather than starting a
   fresh visual block. */
.node-body > ul, .node-body > ol,
.tree-walker > ul, .tree-walker > ol { margin: 6px 0 0; padding-left: 18px; }
.node-body li, .tree-walker li { margin: 3px 0; }
.callout { padding: 11px 13px; border-radius: 10px; margin: 12px 0; border-left: 4px solid var(--sev-moderate); background: var(--surface-2); }
.callout.danger { border-color: var(--sev-high); background: color-mix(in srgb, var(--sev-high) 7%, var(--surface-2)); }
.callout.warning { border-color: var(--sev-moderate); }
.table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.prose thead th, .prose tr:first-child th {
  font-family: var(--font-mono); font-weight: 500;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--surface-2);
}
.prose tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--muted) 4%, transparent); }
/* One <colgroup> sizes every row, so header and cells always line up. */
.prose table { table-layout: fixed; }
.prose td { overflow-wrap: break-word; }
.prose td > p, .prose td > .rich > p { margin: 0; }
/* Three or more columns never fit a phone: each row becomes a card, the first
   cell its title and every other cell labeled with its column header. */
@media (max-width: 600px) {
  .table-wrap.stack { overflow: visible; }
  .table-wrap.stack table, .table-wrap.stack tbody,
  .table-wrap.stack tr, .table-wrap.stack td { display: block; width: auto; }
  .table-wrap.stack colgroup, .table-wrap.stack thead { display: none; }
  .table-wrap.stack tr {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 9px 12px; margin: 0 0 8px; background: var(--surface-2);
  }
  .prose .table-wrap.stack td,
  .prose .table-wrap.stack tbody tr:nth-child(even) td { border: none; padding: 3px 0; background: none; }
  .table-wrap.stack td:first-child { font-weight: 600; padding-bottom: 5px; }
  /* label beside value: short values stay on one line, long ones wrap in
     their own column */
  .table-wrap.stack td + td {
    display: grid; grid-template-columns: minmax(78px, 34%) 1fr;
    column-gap: 10px; align-items: baseline;
  }
  .table-wrap.stack td + td::before {
    content: attr(data-label);
    font-family: var(--font-mono); font-size: .68rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  .table-wrap.stack td + td[data-label=""],
  .table-wrap.stack.pair td + td { display: block; }
  .table-wrap.stack td + td[data-label=""]::before,
  .table-wrap.stack.pair td + td::before { display: none; }
}

/* Kairos text format (lib/richText.js): paragraphs, line breaks and lists
   inside a single prose field. */
.rich > p { margin: 0; }
.rich.rich > * + * { margin-top: 8px; } /* doubled class beats `.node-body p { margin: 0 }` */
.rich > ul, .rich > ol { margin-bottom: 0; padding-left: 18px; }
.rich > ul { list-style-type: disc; }
.rich > ol.numbered { list-style-type: decimal; }
.rich li { margin: 3px 0; }
.callout > p { margin: 0; }
li > p:only-child { margin: 0; }

/* drug card / zones */
.zone-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; font-size: .85rem; }
.zone-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.zone-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.zone-equip { color: var(--muted); }
.dose-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dose-amt strong { font-size: 1.15rem; }
.disclaimer { font-size: .8rem; color: var(--muted); margin-top: 10px; }

.home-footer { text-align: center; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: .76rem; }
.home-footer a { color: var(--muted); }
.home-footer a:hover { color: var(--accent); }
.about h2 { font-size: 1.05rem; margin-top: 18px; }

/* ---------- settings ---------- */
.settings-row { margin: 22px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.settings-row:first-of-type { margin-top: 14px; padding-top: 0; border-top: none; }
.settings-row h2 { font-size: .95rem; margin: 0 0 8px; }
.settings-links { display: flex; flex-direction: column; gap: 1px; }
.settings-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; color: var(--text); font-size: .92rem;
  border-bottom: 1px solid var(--line);
}
.settings-link:last-child { border-bottom: none; }
.settings-link span { color: var(--muted); }
.settings-row .opt {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: .85rem;
}
.settings-row .opt:disabled { color: var(--muted); opacity: .6; }
.settings-row .opt:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }

.adc-sub { color: var(--muted); margin: -4px 0 10px; }
.tall-man { letter-spacing: .02em; }
.adc-grid { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 10px 0; }
.adc-field { font-size: .9rem; }
.adc-label { color: var(--muted); margin-right: 6px; text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; }
.anesthesia-drug-card h3 { margin: 16px 0 4px; }

.nodes { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
.nodes .node {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line);
}
.nodes .node.warning {
  background: color-mix(in srgb, var(--sev-high) 8%, var(--surface-2));
  border-color: color-mix(in srgb, var(--sev-high) 40%, var(--line));
}
.node-badge {
  flex: none; width: 26px; height: 26px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .8rem; font-weight: 600;
  background: var(--accent); color: #fff;
}
.node.warning .node-badge { background: var(--sev-high); }
.node-body { flex: 1; min-width: 0; }
/* the step title only — bold lead-ins inside the body stay inline */
.node-body > strong { display: block; margin-bottom: 4px; }
.node-body p { margin: 0; }
.tree-walker { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; background: var(--surface-2); }
.tree-crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.tree-crumbs a { color: var(--accent); }
.tree-walker .node.recommendation { border-left: 3px solid var(--sev-low); padding-left: 10px; }
.tree-walker .node.warning { border-left: 3px solid var(--sev-high); padding-left: 10px; }
.checklist { list-style: none; padding: 0; }
.note-template { white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 8px; font-size: .82rem; }

/* ---------- motion & focus ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.chip, .opt, .clear-all, .clear-field, .rail-link, .result-item, .back {
  transition: border-color .12s ease, background .12s ease, color .12s ease, box-shadow .12s ease, transform .12s ease;
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes kairos-rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
  .home, .content, #app > .detail { animation: kairos-rise .19s ease-out both; }
  .result-group { animation: kairos-rise .16s ease-out both; }
}

/* --- diagrams (declarative vector figures) ------------------------------- */
figure.diagram { margin: 16px 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
figure.diagram .diagram-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
figure.diagram .diagram-svg { display: block; width: 100%; height: auto; max-height: 60vh; overflow: visible; }
figure.diagram .diagram-caption { margin: 10px 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { figure.diagram .diagram-svg { transition: opacity 0.2s ease; } }

/* A diagram drawn over a raster plate (common.schema.json#/$defs/diagram,
   `image`). Two deliberate departures from the vector-only figure:
   - The plate is black ink on white, so the figure stays in the LIGHT palette
     in every theme. Inverting an engraving for dark mode makes it unreadable,
     and dark-theme overlay colors on white paper lose their contrast. The
     tokens are pinned to literal light values — `var(--accent)` etc. would
     re-resolve to the dark palette and defeat the point.
   - The viewBox is a crop window onto the plate, so overflow is clipped. The
     vector-only figure leaves overflow visible for labels that brush the
     edge; here that would spill the rest of the plate out of the frame. */
figure.diagram--plate {
  --dg-outline: #3a3742;
  --dg-surface: #fbfaf8;
  --dg-accent: #c6521c;
  --dg-danger: #b4322a;
  --dg-warning: #c6521c;
  --dg-good: #2f6b3f;
  --dg-muted: #55524c;
  --dg-text: #1c1a24;
  background: #f7f5f0;
  border-color: #d9d5cc;
}
figure.diagram--plate .diagram-title,
figure.diagram--plate .diagram-caption { color: #55524c; }
figure.diagram--plate .diagram-svg--plate { overflow: hidden; border-radius: 6px; }
figure.diagram .diagram-credit { margin: 6px 0 0; font-size: 0.74rem; line-height: 1.4; color: var(--muted); font-style: italic; }
figure.diagram--plate .diagram-credit { color: #6b6862; }

/* ---- EKG axis interpreter (views/axisTool.js) ------------------------------ */
.band.sev-info { border-color: var(--line); }
.axis-modes { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin: 6px 0 4px; scrollbar-width: none; }
.axis-modes::-webkit-scrollbar { display: none; }
.axis-mode, .axis-seg-btn, .axis-chip, .axis-sign, .axis-jump {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.axis-mode { flex: none; padding: 7px 12px; font-size: .88rem; white-space: nowrap; }
.axis-mode.selected, .axis-seg-btn.selected, .axis-chip.selected {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.axis-mode:focus-visible, .axis-seg-btn:focus-visible, .axis-chip:focus-visible, .axis-sign:focus-visible, .axis-jump:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.axis-panel .help { margin: 4px 0 10px; color: var(--muted); font-size: .9rem; }
.axis-paste { width: 100%; box-sizing: border-box; font: inherit; font-family: var(--font-mono); font-size: .95rem;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); margin-bottom: 10px; }
.axis-prt-fields, .axis-amps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.axis-amps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* 320px phones: three signed fields side by side can't show "-135". */
@media (max-width: 359px) { .axis-prt-fields { grid-template-columns: minmax(0, 1fr); } }
.axis-field { display: flex; flex-direction: column; gap: 4px; }
.axis-field-row { display: flex; align-items: center; gap: 3px; min-width: 0; }
.axis-field-row input { flex: 1; min-width: 0; width: 100%; font: inherit; font-family: var(--font-mono); font-size: 1rem;
  padding: 9px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
/* 16px stays: iOS Safari zooms the page into any input set smaller. */
.axis-field .unit { color: var(--muted); font-size: .85rem; }
.axis-sign { flex: none; width: 30px; height: 38px; border-radius: 8px; font-size: 1.05rem; padding: 0; }
.axis-leads { display: grid; gap: 8px; }
.axis-lead { display: flex; align-items: center; gap: 10px; }
.axis-lead-name { width: 36px; font-family: var(--font-mono); font-weight: 600; }
.axis-seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.axis-seg-btn { padding: 7px 12px; font-size: .88rem; min-width: 44px; }
.axis-shared { display: grid; gap: 10px; margin: 14px 0 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.axis-age { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.axis-age-input { display: inline-flex; gap: 6px; align-items: center; }
.axis-age-input input { width: 64px; font: inherit; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.axis-age-input select { font: inherit; padding: 7px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.axis-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.axis-chip { padding: 5px 11px; font-size: .82rem; }
.axis-out { display: grid; gap: 8px; }
.axis-headline { display: grid; gap: 2px; }
.axis-kicker { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.axis-value { font-size: 1.9rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.axis-cat { font-weight: 600; }
.axis-sub { font-size: .85rem; }
.axis-line { display: grid; grid-template-columns: auto auto 1fr; column-gap: 10px; row-gap: 2px; align-items: baseline; }
.axis-line-label { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.axis-line strong { font-variant-numeric: tabular-nums; }
.axis-line-detail { grid-column: 1 / -1; font-size: .86rem; }
.axis-msg { margin: 0; }
.axis-flag summary, .axis-diff summary, .axis-why summary { cursor: pointer; }
.axis-flag ul, .axis-diff ul { margin: 6px 0 4px; padding-left: 18px; }
.axis-cl-title { margin: 8px 0 0; font-weight: 600; font-size: .9rem; }
.axis-diff, .axis-why { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.axis-why { margin-top: 12px; }
.axis-why .rich, .axis-why > p { margin-top: 6px; }
.axis-jump { padding: 4px 10px; margin-left: 4px; font-size: .85rem; }
.axis-wheel { margin: 2px auto; max-width: 300px; width: 100%; }
.axis-wheel svg { width: 100%; height: auto; display: block; }
.axis-wheel figcaption { text-align: center; font-size: .78rem; color: var(--muted); display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.ax-sec { stroke: none; }
.ax-sec-low { fill: color-mix(in srgb, var(--sev-low) 22%, transparent); }
.ax-sec-moderate { fill: color-mix(in srgb, var(--sev-moderate) 22%, transparent); }
.ax-sec-high { fill: color-mix(in srgb, var(--sev-high) 16%, transparent); }
.ax-sec-critical { fill: color-mix(in srgb, var(--sev-critical) 26%, transparent); }
.ax-sec-bg { fill: color-mix(in srgb, var(--muted) 8%, transparent); }
.ax-range { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 3 3; }
.ax-rim { fill: none; stroke: var(--line); stroke-width: 1.5; }
.ax-spoke { stroke: var(--muted); stroke-width: 1; opacity: .7; }
.ax-spoke-neg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .45; }
.ax-lead { font-family: var(--font-mono); font-size: 11px; font-weight: 600; fill: var(--text); }
.ax-tick { font-family: var(--font-mono); font-size: 9px; fill: var(--muted); }
.ax-needle-qrs { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.ax-needle-est { stroke-dasharray: 6 4; }
.ax-needle-head { fill: var(--text); }
.ax-needle-p { stroke: var(--sev-low); stroke-width: 1.6; stroke-linecap: round; }
.ax-needle-t { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; stroke-linecap: round; }
.ax-hub { fill: var(--text); }
.ax-key { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 4px; border-top: 3px solid var(--text); }
.ax-key-p { border-top: 2px solid var(--sev-low); }
.ax-key-t { border-top: 2px dashed var(--accent); }
.ax-key-range { height: 8px; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* Acid-base analyzer — reuses the axis tool's field/band/flag styles. */
.abg-tool .abg-lytes { margin-top: 10px; }
.abg-help { font-size: .78rem; line-height: 1.3; }
.abg-chron { display: grid; gap: 6px; margin-top: 12px; }
.abg-tool .abg-primary { font-size: 1.15rem; }
/* Acid-base lines carry sentences, not short values: stack label → value → text. */
.abg-tool .axis-line { grid-template-columns: minmax(0, 1fr); }
.abg-tool .abg-sample { margin: 0 0 12px; }

/* ---- Extubation decision tool (views/extubationTool.js) --------------------
   Skin only: layout and words come from the kit's extubation-logic.json. */
.ext-body { display: grid; gap: 12px; }
.ext-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.ext-topbar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ext-track { font-weight: 600; }
.ext-step { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em; color: var(--muted); }
.ext-title { margin: 4px 0 0; font-size: 1.25rem; letter-spacing: -0.01em; text-wrap: balance; }
.ext-prompt { margin: 0; color: var(--text); }
.ext-info p { margin: 0; }
.ext-info-src, .ext-note { font-size: .82rem; }
.ext-choices { display: grid; gap: 8px; }
.ext-choice { font: inherit; text-align: left; padding: 14px 16px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); min-height: 52px; }
.ext-choice.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.ext-checklist { display: grid; gap: 6px; }
.ext-check, .ext-ack { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.ext-ack { margin-top: 8px; background: transparent; border-color: currentColor; }
.ext-check input, .ext-ack input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.ext-fields { display: grid; gap: 12px; }
.ext-field { display: grid; gap: 6px; }
.ext-field input { font: inherit; font-size: 1rem; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--text); }
.ext-alert p { margin: 0; }
.ext-disclaimer { font-size: .82rem; margin: 4px 0 0; }
.ext-bottombar { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--line); }
.ext-result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ext-btn { font: inherit; padding: 10px 16px; border-radius: 999px; cursor: pointer; min-height: 44px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.ext-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ext-btn-quiet { padding: 6px 12px; min-height: 36px; font-size: .88rem; }
.ext-btn:disabled { opacity: .45; cursor: not-allowed; }
.ext-chip { justify-self: start; font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; }
.ext-chip.sev-low { color: var(--sev-low); }
.ext-chip.sev-moderate { color: var(--sev-moderate); }
.ext-chip.sev-high { color: var(--sev-high); }
.ext-rec { margin: 0; font-weight: 500; }
.ext-why { margin: 0; padding-left: 20px; }
.ext-rescue { display: grid; gap: 2px 0; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.ext-rescue dt { font-size: .82rem; color: var(--muted); }
.ext-rescue dd { margin: 0 0 8px; }
.ext-evidence summary { cursor: pointer; font-weight: 600; }
.ext-evidence ol { margin: 8px 0 0; padding-left: 20px; font-size: .86rem; }
.ext-dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  max-width: min(420px, calc(100vw - 32px)); padding: 18px; }
.ext-dialog::backdrop { background: rgb(0 0 0 / .35); }
.ext-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ext-print-root { display: none; }
@media print {
  body.ext-printing > *:not(.ext-print-root) { display: none !important; }
  body.ext-printing .ext-print-root { display: block; color: #000; background: #fff; }
  .ext-card { font: 11pt/1.4 var(--font-sans); }
  .ext-card-head { display: flex; flex-wrap: wrap; gap: 4px 14px; border-bottom: 1px solid #000; padding-bottom: 6px; }
  .ext-card-label { border: 1.5px solid #000; height: 1.2in; margin: 10px 0; padding: 6px; font-size: 9pt; }
  .ext-card-chip { font-family: var(--font-mono); font-weight: 600; margin: 6px 0 0; }
  .ext-card-alert { border-left: 3px solid #000; padding-left: 8px; }
  .ext-card-refs { font-weight: 600; margin-bottom: 2px; }
  .ext-card-cites { font-size: 9pt; }
  .ext-card-disclaimer { font-size: 9pt; border-top: 1px solid #000; padding-top: 6px; }
}
.ext-note-src { font-family: var(--font-mono); font-size: .74rem; }
