/* Open Spine Alliance — design system.
   Tokens and shared components extracted from osa_patient_view.html (repo root).
   Rules: one accent colour (teal); amber is reserved for clinical flags and the
   surgery marker; hairline borders only, no shadows; metric summaries are rows;
   numeric columns right-aligned with tabular figures; sentence-case labels. */

:root {
  --page: #f6f6f4;
  --surface: #ffffff;
  --line: #e6e6e1;
  --line-strong: #cfcfc8;
  --ink: #1c1c1a;
  --ink-2: #6b6b66;
  --ink-3: #9a9a94;
  --accent: #0f766e;
  --accent-soft: #d9efeb;
  --flag: #b45309;
  --flag-soft: #fbe9d3;
  --pre: #9a9a94;
  --radius: 6px;
  --side-w: 232px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ---------- reset + type ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
/* A long unbroken token — a compound surname, an email address, a reference id
   pasted into a note — has to wrap. Without this it sets the block's
   min-content width and drags the whole page wider than a phone screen.
   `anywhere` rather than `break-word`: only `anywhere` shrinks the intrinsic
   size that the flex and grid tracks above are measured against.
   Filenames are deliberately left out: they belong on one line, and the
   sessions table scrolls inside .table-wrap to make room for them. */
.crumb, .head h1, .head p, .lead, .row .name, .hero-note, .foot, .empty,
.notice, .status, .kv dd, .side-foot .who b { overflow-wrap: anywhere; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 22px; letter-spacing: -.02em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }
code, kbd, pre { font: 13px/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent-soft); }

/* Focus rings on every interactive element. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- app frame ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 18px;
  font-weight: 600; letter-spacing: -.01em; color: var(--ink);
}
.brand .mark { flex: none; }
/* `svg text` below sets family, size and fill for the chart labels, and CSS
   beats an SVG presentation attribute — without this the mark's O renders as
   grey Inter 12px. .brand's own font-weight: 600 inherits in too, so the
   regular weight has to be stated. */
.brand .mark text {
  font-family: 'Times New Roman', Times, serif;
  font-size: 14px; font-weight: 400; fill: #fff;
}
.side h5 { margin: 14px 8px 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.side a, .side button.navlink {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius);
  color: var(--ink-2); background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.side a > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.side a:hover, .side button.navlink:hover { background: var(--page); color: var(--ink); }
.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.side a small { color: var(--ink-3); font-size: 12px; flex: none; }
.side a.on small { color: var(--accent); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.side-foot .who { padding: 4px 8px 8px; font-size: 12px; color: var(--ink-3); }
.side-foot .who b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; }
.lang { display: flex; gap: 2px; padding: 4px 8px 0; }
.lang a { width: auto; padding: 2px 6px; font-size: 12px; color: var(--ink-3); }
.lang a.on { background: var(--page); color: var(--ink); }

/* Mobile top bar; the sidebar slides in under 860px. */
.topbar { display: none; }

/* The content column is capped and centred inside the space the sidebar
   leaves, so a wide monitor does not strand it against the navigation. */
.main { padding: 28px 40px 60px; max-width: 1120px; min-width: 0; width: 100%; margin-inline: auto; }
.main.wide { max-width: none; }
.crumb { color: var(--ink-3); font-size: 13px; margin-bottom: 14px; }
.crumb b { color: var(--ink-2); font-weight: 500; }
.crumb a:hover { color: var(--ink); }

.head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.head > div:first-child { flex: 1 1 auto; min-width: 0; }
.head .meta, .head .actions { flex: none; }
.head h1 { margin: 0 0 4px; }
.head p { margin: 0; color: var(--ink-2); }
.head .lead { max-width: 64ch; }
.meta { display: flex; gap: 20px; color: var(--ink-2); font-size: 13px; flex-wrap: wrap; }
.meta span b { display: block; color: var(--ink); font-weight: 500; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer; line-height: 1.3;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--page); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"], .btn.is-disabled {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}
.btn svg { width: 16px; height: 16px; }

/* ---------- collapsible panels ---------- */
/* A [data-panel] section pairs a chevron heading with a .panel-body. Panels
   start collapsed; the "Remember" checkbox pins the panel's current state as
   the reader's default (osa.js, localStorage). */
.panel-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  background: none; border: 0; padding: 0; margin: 0;
  color: inherit; text-align: left; cursor: pointer;
}
.panel-toggle svg { flex: none; color: var(--ink-3); transition: transform .15s; }
.panel-toggle:hover svg { color: var(--ink-2); }
.panel-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.panel-remember {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-3); white-space: nowrap; cursor: pointer;
}
.panel-remember:hover { color: var(--ink-2); }
.panel-remember input { width: 13px; height: 13px; }
.panel-body { margin-top: 8px; }

/* Drag handle. Dim until the panel is hovered or the grip itself is focused,
   so four grips do not compete with the headings for attention. */
.panel-grip {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: -4px; padding: 0;
  background: none; border: 0; border-radius: 4px;
  color: var(--line-strong); cursor: grab; opacity: 0; transition: opacity .15s;
}
.panel-grip svg { fill: currentColor; }
[data-panel]:hover .panel-grip, .panel-grip:focus-visible { opacity: 1; }
.panel-grip:hover { color: var(--ink-3); background: var(--page); }
.panel-grip:active { cursor: grabbing; }
[data-panel].is-dragging { opacity: .5; }
/* A touch device has no hover, so the grips are simply always visible. */
@media (hover: none) { .panel-grip { opacity: 1; } }
/* Wide enough for a gutter: park the grip in the left margin so the headings
   stay flush with the rest of the page instead of being indented by a control
   that is invisible most of the time. Below this the grip stays in normal
   flow — .main's padding is only 16-20px there, and a negative offset would
   hang off the side of the screen. */
@media (min-width: 861px) {
  .hero-top, .section-top { position: relative; }
  .panel-grip { position: absolute; left: -30px; top: 50%; transform: translateY(-50%); margin-left: 0; }
}
/* The legend describes the chart, so it goes away with it. */
.panel-toggle[aria-expanded="false"] ~ .legend { display: none; }

/* ---------- hero chart ---------- */
.hero { margin-top: 28px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 12px 16px; flex-wrap: wrap; }
.hero-top h2 { margin: 0; }
.legend { display: flex; gap: 18px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 18px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--accent); }
.legend i.energy, .legend i.secondary { background: var(--ink); height: 0; border-top: 2px dashed var(--ink); }
.legend i.surg { background: none; height: 0; border-top: 1px dashed var(--flag); }
/* The chart scrolls inside its own card rather than widening the page. */
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 8px; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .empty { padding: 48px 0; }
svg text { font-family: inherit; fill: var(--ink-2); font-size: 12px; }
svg .axis { stroke: var(--line); stroke-width: 1; }
svg .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
svg .surg { stroke: var(--flag); stroke-width: 1; stroke-dasharray: 3 3; }
svg .surg-label { fill: var(--flag); }
svg .cone, svg .primary { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .energy, svg .secondary { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; stroke-linejoin: round; }
svg .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
svg .dot.energy, svg .dot.secondary { stroke: var(--ink); stroke-width: 1.5; }
svg .end-label { fill: var(--accent); font-weight: 600; }
svg .end-label.secondary { fill: var(--ink); font-weight: 400; }
.hero-note { color: var(--ink-2); font-size: 13px; margin: 10px 2px 0; max-width: 72ch; }

/* ---------- metrics: rows, not cards ---------- */
.metrics { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.metrics h2 { margin: 0; }
/* minmax(0, …) lets every track shrink below its content on a narrow screen;
   plain fr tracks floor at min-content and push the page sideways. */
.row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center;
}
.row.h { color: var(--ink-3); font-size: 12px; font-weight: 500; padding: 6px 0; }
.row .name { font-weight: 500; }
.row .name small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12px; }
.row .num { font-size: 15px; }
.row .pre { color: var(--ink-2); }
.row .na { color: var(--ink-3); }
.delta { display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.delta.up { background: var(--accent-soft); color: var(--accent); }
.delta.flat { background: var(--page); color: var(--ink-2); border: 1px solid var(--line); }
.delta.flag { background: var(--flag-soft); color: var(--flag); }
.spark { height: 26px; width: 100%; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.spark path.g { stroke: var(--ink-3); }

/* ---------- sections + tables ---------- */
.section { margin-top: 36px; }
.section > h2, .sessions h2 { margin: 0 0 6px; }
.section-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.section-top h2 { margin: 0; }
.section-top .hint { color: var(--ink-3); font-size: 12px; }
.sessions { margin-top: 36px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap table { border: 0; border-radius: 0; }
table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
th {
  text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--page);
  white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfbf9; }
td.r, th.r { text-align: right; }
td.c, th.c { text-align: center; }
td.dim, .dim { color: var(--ink-3); }
td.muted, .muted { color: var(--ink-2); }
td.nowrap, .nowrap { white-space: nowrap; }
td.file { font-size: 13px; letter-spacing: -.005em; }
tr.day-row td, tr.group td { background: var(--page); color: var(--ink-2); font-size: 12px; padding: 6px 14px; }
tr.day-row:hover td, tr.group:hover td { background: var(--page); }
tr[data-href] { cursor: pointer; }
tr.empty td { padding: 32px 14px; text-align: center; color: var(--ink-3); }
tr.selected td { background: #f4f9f8; }

.tag {
  display: inline-block; font-size: 12px; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px;
  background: var(--surface); white-space: nowrap; line-height: 1.4;
}
.tag.pre { color: var(--flag); border-color: #e9c9a4; background: var(--flag-soft); }
.tag.on { color: var(--accent); border-color: #b9dfd9; background: var(--accent-soft); }
.tag svg { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }
.bar { display: inline-block; height: 6px; background: var(--accent); border-radius: 3px; vertical-align: middle; margin-right: 8px; }
.foot { margin-top: 26px; color: var(--ink-3); font-size: 12px; max-width: 80ch; }

/* ---------- notices, empty states ---------- */
.notice {
  padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: var(--radius); background: var(--surface); color: var(--ink-2); margin: 0 0 16px;
}
.notice.success { border-left-color: var(--accent); color: var(--ink); }
.notice.error, .notice.danger { border-left-color: var(--ink); color: var(--ink); }
.notice.warning { border-left-color: var(--flag); color: var(--ink); }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 4px; }
.status { font-size: 13px; color: var(--ink-2); min-height: 1.5em; }
.status.ok { color: var(--accent); }
.status.err { color: var(--ink); }
.status.warn { color: var(--flag); }

/* ---------- panels + forms ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .span { grid-column: 1 / -1; }
.field label, label.lbl { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.field small, .help { display: block; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.field { min-width: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="url"], select, textarea, .input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; line-height: 1.4;
}
input:disabled, select:disabled, textarea:disabled { background: var(--page); color: var(--ink-2); }
input::placeholder, textarea::placeholder { color: var(--ink-3); text-transform: none; letter-spacing: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b66' stroke-width='2'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
textarea { resize: vertical; min-height: 80px; }
textarea.inline { min-height: 0; padding: 4px 8px; font-size: 13px; resize: none; }
input.inline { padding: 4px 8px; font-size: 13px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; vertical-align: -2px; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 13px;
}
.chip[aria-pressed="true"], .chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.pre { color: var(--flag); border-color: #e9c9a4; background: var(--flag-soft); cursor: default; }
.dropzone {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 24px;
  text-align: center; color: var(--ink-2); cursor: pointer; background: var(--surface);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #f8fcfb; }
.dropzone b { display: block; color: var(--ink); font-weight: 500; }
.dropzone small { color: var(--ink-3); }

/* ---------- tabs, key/value, dots ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 8px 10px; margin-bottom: -1px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--ink-3); margin: 0; }
.kv dd { margin: 0; color: var(--ink); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); vertical-align: middle; margin-right: 6px; }
.dot.on { background: var(--accent); }
.dot.off { background: var(--ink-3); }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 16px 0; }
.stats div { padding: 12px 16px 12px 0; }
.stats div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.stats small { display: block; color: var(--ink-3); font-size: 12px; }
.stats b { display: block; font-size: 20px; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.toolbar .count { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.disclosure { background: none; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); cursor: pointer; }
.disclosure svg { transition: transform .15s; }
.disclosure[aria-expanded="true"] svg { transform: rotate(90deg); }

/* ---------- auth / narrow pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .panel { width: 100%; max-width: 380px; padding: 28px; }
.auth .brand { padding: 0 0 18px; }
.auth .lang { justify-content: flex-end; padding: 0 0 8px; }
.narrow { max-width: 640px; }

/* ---------- utilities the page scripts rely on ---------- */
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rotate-90 { transform: rotate(90deg); }
.opacity-50 { opacity: .5; }
.cursor-not-allowed { cursor: not-allowed; }
.cluster { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.small { font-size: 12px; } .id { letter-spacing: .04em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: min(var(--side-w), 86vw); z-index: 20;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .side.open { transform: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
  }
  .topbar .brand { padding: 0; }
  .main { padding: 20px; }
  .head { flex-direction: column; align-items: flex-start; }
  .row { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
  .row .sparkcell { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stats div + div { padding-left: 0; border-left: 0; }
}

/* Phones. The biomarker row stops being a table and becomes a labelled block,
   so nothing has to scroll sideways to be read; the trajectory keeps a legible
   minimum width and scrolls inside its own card instead. */
@media (max-width: 640px) {
  .main { padding: 16px; }
  .metrics .row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 14px 0; }
  .metrics .row.h { display: none; }
  .metrics .row .name { grid-column: 1 / -1; }
  .metrics .row [data-label]::before {
    content: attr(data-label); display: block;
    font-size: 11px; font-weight: 400; color: var(--ink-3);
  }
  .chart { padding: 14px 14px 6px; }
  .chart svg { min-width: 560px; }
  /* The viewBox scales text down with the drawing; grow it back to legible. */
  .chart svg text { font-size: 18px; }
  .head .meta { gap: 12px 18px; }
  .actions { width: 100%; }
  .toolbar .count { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  svg .cone, svg .primary { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 1.1s ease-out forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .side, .topbar, .actions, .toolbar, .panel-remember { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; max-width: none; }
  /* A collapsed panel still belongs in the printout. */
  .panel-body[hidden] { display: block !important; }
  .panel-toggle svg { display: none; }
}
