/* Researcher interface in the style of cancer.dk (warm off-white, red accents, pill buttons).
   Colours are tokens; dark values are selected steps, not an inversion. Data colours (series,
   ramps) stay on the validated chart palette. */
:root {
  color-scheme: light;
  --font: "Fighter", Verdana, Arial, sans-serif;
  --font-head: "Fighter Overskrift", "Fighter", Verdana, Arial, sans-serif;
  --page: #faf8f0;
  --surface: #ffffff;
  --surface-2: #f5f4ef;
  --surface-3: #ecebe5;
  --ink: #3c3c3c;
  --ink-2: #555552;
  --ink-3: #6b6b67;
  --muted: #8a8880;
  --grid: #e6e4dc;
  --axis: #cfccc3;
  --border: rgba(60, 60, 60, 0.12);
  --border-strong: rgba(60, 60, 60, 0.22);
  --accent: #e8001d;
  --accent-hover: #bd0018;
  --accent-wash: #fdeff0;
  --link: #c60001;
  --on-accent: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --on-series: #ffffff;
  --iqr: #0d366b;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-text: #a32020;
  --neutral-seg: #c3c2b7;
  --ord-0: #86b6ef; --ord-1: #5598e7; --ord-2: #2a78d6; --ord-3: #1c5cab; --ord-4: #104281; --ord-5: #0d366b;
  --state-hidden: #c3c2b7;
  --state-idle: #e1e0d9;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 8px rgba(11, 11, 11, 0.04);
  --radius: 12px;
  --side-w: 236px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --surface-3: #2c2c2a;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #a3a299;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #ff6f60;
    --accent-hover: #ff8f84;
    --accent-wash: #3a1c1e;
    --link: #ff8f84;
    --on-accent: #0b0b0b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --on-series: #0b0b0b;
    --iqr: #cde2fb;
    --good-text: #0ca30c;
    --critical-text: #e66767;
    --neutral-seg: #52514e;
    --ord-0: #184f95; --ord-1: #256abf; --ord-2: #3987e5; --ord-3: #6da7ec; --ord-4: #9ec5f4; --ord-5: #cde2fb;
    --state-hidden: #52514e;
    --state-idle: #383835;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --surface-3: #2c2c2a;
  --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #a3a299; --muted: #898781; --grid: #2c2c2a; --axis: #383835;
  --border: rgba(255, 255, 255, 0.10); --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #ff6f60; --accent-hover: #ff8f84; --accent-wash: #3a1c1e; --link: #ff8f84; --on-accent: #0b0b0b;
  --series-1: #3987e5; --series-2: #d95926; --on-series: #0b0b0b; --iqr: #cde2fb; --good-text: #0ca30c; --critical-text: #e66767; --neutral-seg: #52514e;
  --ord-0: #184f95; --ord-1: #256abf; --ord-2: #3987e5; --ord-3: #6da7ec; --ord-4: #9ec5f4; --ord-5: #cde2fb;
  --state-hidden: #52514e; --state-idle: #383835; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 13px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; }
code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.rs-skip { position: absolute; left: -9999px; }
.rs-skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.rs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.rs-muted { color: var(--ink-3); }
.rs-small { font-size: 12.5px; }
.rs-err { color: var(--critical-text); }
.rs-yes { color: var(--good-text); font-weight: 600; }

/* ---------- shell ---------- */
.rs-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.rs-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.rs-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 2px 8px 6px; }
.rs-brand strong { display: block; font-size: 15px; }
.rs-brand small { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.3; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-logo-img { height: 22px; width: auto; flex: none; display: block; }
.rs-login-brand .rs-logo-img { height: 34px; }
.rs-logo { width: 30px; height: 30px; flex: none; display: inline-block; border-radius: 50%; background: var(--accent); }
.rs-logo svg { width: 30px; height: 30px; display: block; }
.rs-logo svg rect { fill: var(--accent); }
.rs-logo svg path { fill: var(--on-accent); }
.rs-nav { display: flex; flex-direction: column; gap: 2px; }
.rs-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.rs-nav a:hover { background: var(--surface-2); color: var(--ink); }
.rs-nav a.is-active { background: var(--accent-wash); color: var(--accent-hover); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.rs-icon { width: 18px; height: 18px; fill: currentColor; flex: none; }
.rs-user { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--ink-3); display: flex; flex-direction: column; gap: 4px; }
.rs-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

.rs-main { padding: 24px 32px 64px; max-width: 1280px; width: 100%; }
.rs-main.is-wide { max-width: none; }
.rs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; min-height: 36px; }
.rs-head h1 { font-size: 26px; font-weight: 500; letter-spacing: -0.01em; }
.rs-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .rs-shell { grid-template-columns: 1fr; }
  .rs-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .rs-nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; padding-bottom: 2px; }
  .rs-nav a { white-space: nowrap; padding: 6px 10px; }
  .rs-nav a span { display: none; }
  .rs-nav a.is-active span { display: inline; }
  .rs-user { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; gap: 10px; }
  .rs-main { padding: 16px 16px 48px; }
}

/* ---------- flash, cards, tiles ---------- */
.rs-flash { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.rs-flash.is-ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.rs-flash.is-err { border-color: color-mix(in srgb, var(--critical) 55%, transparent); }
.rs-flash-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.rs-flash.is-ok .rs-flash-icon { fill: var(--good); }
.rs-flash.is-err .rs-flash-icon { fill: var(--critical); }

.rs-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.rs-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.rs-card-head h2 { font-size: 17px; font-weight: 500; }
.rs-card-sub { margin: 3px 0 0; color: var(--ink-3); font-size: 12.5px; max-width: 70ch; }
.rs-card-actions { display: flex; gap: 8px; flex: none; }
.rs-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rs-grid-2 > .rs-card { margin-bottom: 16px; }
@media (max-width: 1100px) { .rs-grid-2 { grid-template-columns: 1fr; gap: 0; } }

.rs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rs-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.rs-tile-label { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.rs-tile-value { font-family: var(--font-head); font-size: 22px; font-weight: 500; margin-top: 4px; letter-spacing: -0.01em; overflow-wrap: anywhere; line-height: 1.25; }
.rs-tile-sub { color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.rs-empty { text-align: center; padding: 28px 16px; color: var(--ink-3); }
.rs-empty p { margin: 0 0 12px; }

/* ---------- buttons & forms ---------- */
.rs-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 16px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.rs-btn:hover { background: var(--ink); color: var(--surface); }
.rs-btn.is-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rs-btn.is-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.rs-btn.is-danger { color: var(--critical-text); border-color: var(--critical-text); }
.rs-btn.is-danger:hover { background: var(--critical-text); color: #fff; }
.rs-btn.is-small { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
.rs-btn.is-block { width: 100%; }
.rs-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rs-inline { display: inline; margin: 0; }
.rs-actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rs-form { display: flex; flex-direction: column; gap: 12px; }
.rs-form.rs-row { flex-direction: row; align-items: flex-end; }
.rs-row { display: flex; gap: 12px; flex-wrap: wrap; }
.rs-form .rs-grid-2 > div { display: flex; flex-direction: column; gap: 12px; }
.rs-row > .rs-field { flex: 1 1 180px; }
.rs-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rs-field > span { font-weight: 550; font-size: 13px; }
.rs-field small { font-weight: 400; color: var(--ink-3); }
.rs-field input, .rs-field select, .rs-field textarea, .rs-filters select, .rs-search, .rs-matrix-controls select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; min-height: 36px; width: 100%;
}
.rs-field textarea { resize: vertical; line-height: 1.5; }
.rs-check { display: flex; gap: 8px; align-items: flex-start; }
.rs-check input { margin-top: 3px; }
.rs-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.rs-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 550; color: var(--ink-2); min-width: 150px; }
.rs-filters select { width: auto; min-width: 150px; }

/* ---------- tables ---------- */
.rs-tablewrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.rs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rs-table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap; }
.rs-table td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.rs-table tbody tr:hover { background: var(--surface-2); }
.rs-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-table.is-compact td { padding: 6px 8px; }
.rs-table th[data-sort] { cursor: pointer; user-select: none; }
.rs-table th[data-sort]::after { content: " ↕"; color: var(--muted); font-size: 10px; }
.rs-table th[aria-sort="ascending"]::after { content: " ↑"; color: var(--ink); }
.rs-table th[aria-sort="descending"]::after { content: " ↓"; color: var(--ink); }
.rs-table .rs-cb { width: 32px; }
.rs-table tr.is-descriptive td { color: var(--ink-3); }
.rs-table tr.is-hidden-field td { opacity: 0.55; }
.rs-qlabel { max-width: 46ch; }
.rs-col-time { width: 190px; white-space: nowrap; }
.rs-col-bar { width: 260px; white-space: nowrap; }
.rs-tableview { margin-top: 10px; }
.rs-tableview summary { cursor: pointer; color: var(--ink-2); font-size: 12.5px; }

.rs-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rs-search { max-width: 280px; }
.rs-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rs-chip { font: inherit; font-size: 12.5px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.rs-chip span { color: var(--ink-3); margin-left: 3px; font-variant-numeric: tabular-nums; }
.rs-chip.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.rs-batch { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--grid); }
.rs-batch .rs-field { max-width: 300px; }
.rs-powered { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.rs-powered a { color: var(--ink-2); font-weight: 700; text-decoration: none; }
.rs-powered a:hover { color: var(--accent); text-decoration: underline; }
.rs-powered.is-bare { text-align: center; margin-top: 18px; }

/* body figure (shared markup from public/shared/bodymap.js) */
.bm-views { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bm-view { margin: 0; text-align: center; }
.bm-view figcaption { font-weight: 700; font-size: 12px; color: var(--ink-2); }
.bm-svg { width: 100%; height: auto; display: block; }
.bm-body { fill: #fff; }
.bm-outline { fill: none; stroke: #3c3c3c; stroke-width: 1.3; pointer-events: none; }
.bm-detail { fill: none; stroke: #8a8880; stroke-width: 0.9; stroke-linecap: round; pointer-events: none; }
.bm-side { font-size: 11px; fill: #6b6b67; }
.bm-shape { fill: transparent; stroke: #e6e3da; stroke-width: 0.8; }
.bm-region { outline: none; }
.bm-region[data-tip]:hover .bm-shape, .bm-region[data-tip]:focus-visible .bm-shape { stroke: #3c3c3c; stroke-width: 1.6; }
.bm-x, .bm-hatch-line, .bm-hatch-bg { display: none; }
.bm-num { font-size: 9px; font-weight: 700; fill: #3c3c3c; paint-order: stroke; stroke: #fff; stroke-width: 2.5px; pointer-events: none; }
.rs-bm-mini { max-width: 230px; margin-bottom: 6px; }
.rs-bm-stats { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 8px; }
.rs-bm-figure .rs-legend { justify-content: center; }
.rs-bm-legend { columns: 2; font-size: 12.5px; margin: 0; padding-left: 28px; }
@media (max-width: 900px) { .rs-bm-stats { grid-template-columns: 1fr; } }
.rs-chip.is-active span { color: inherit; opacity: 0.75; }
.rs-bulkbar { position: sticky; top: 0; z-index: 4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 10px; border-radius: 10px; background: var(--accent-wash); }
.rs-bulkbar[hidden] { display: none; }
.rs-bulkbar span { font-weight: 600; margin-right: 6px; }
.rs-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); vertical-align: middle; }

/* participant status: a dot + text label (never colour alone) */
.rs-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.rs-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--axis); }
.rs-status.is-invited::before { background: var(--ord-1); }
.rs-status.is-opened::before { background: var(--ord-2); }
.rs-status.is-in_progress::before { background: var(--series-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 25%, transparent); }
.rs-status.is-completed::before { background: var(--good); }
.rs-status.is-withdrawn { color: var(--ink-3); }
.rs-status.is-withdrawn::before { background: transparent; border: 1.5px solid var(--muted); width: 6px; height: 6px; }
.rs-mini-progress { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--grid); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.rs-mini-progress span { display: block; height: 100%; background: var(--series-1); border-radius: 0 3px 3px 0; }

/* quality flags: status colour + icon + label */
.rs-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 550; padding: 2px 9px 2px 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); white-space: nowrap; }
.rs-flag-icon { width: 14px; height: 14px; flex: none; fill: var(--muted); }
.rs-flag.is-warning .rs-flag-icon { fill: var(--warning); }
.rs-flag.is-warning { border-color: color-mix(in srgb, var(--warning) 60%, transparent); }
.rs-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.rs-detail-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -8px 0 16px; }
.rs-mailstatus { font-size: 12px; font-weight: 600; }
.rs-mailstatus.is-sent { color: var(--good-text); }
.rs-mailstatus.is-failed { color: var(--critical-text); }
.rs-mailstatus.is-logged, .rs-mailstatus.is-queued { color: var(--ink-3); }

/* ---------- charts ---------- */
.rs-chart { width: 100%; height: auto; display: block; overflow: visible; }
.rs-grid { stroke: var(--grid); stroke-width: 1; }
.rs-baseline { stroke: var(--axis); stroke-width: 1; }
.rs-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.rs-bar { fill: var(--series-1); }
.rs-hit { cursor: default; outline: none; }
.rs-hit:hover .rs-bar, .rs-hit:focus-visible .rs-bar { fill: var(--accent-hover); }
.rs-hit:focus-visible rect { stroke: var(--ink); stroke-width: 1; }

.rs-barlist { display: flex; flex-direction: column; gap: 8px; }
.rs-barrow { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 84px; gap: 12px; align-items: center; outline: none; border-radius: 6px; }
.rs-barrow:hover, .rs-barrow:focus-visible { background: var(--surface-2); }
.rs-barlabel { font-size: 13px; overflow-wrap: anywhere; line-height: 1.3; }
.rs-barlabel small { display: block; color: var(--ink-3); font-size: 11.5px; }
.rs-bartrack { position: relative; height: 18px; }
.rs-barfill { position: absolute; left: 0; top: 2px; height: 14px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.rs-barfill.rs-ord-0 { background: var(--ord-0); } .rs-barfill.rs-ord-1 { background: var(--ord-1); } .rs-barfill.rs-ord-2 { background: var(--ord-2); }
.rs-barfill.rs-ord-3 { background: var(--ord-3); } .rs-barfill.rs-ord-4, .rs-barfill.rs-ord-5 { background: var(--ord-4); }
.rs-whisker { position: absolute; top: 8px; height: 2px; background: var(--iqr); border-radius: 1px; }
.rs-whisker::before, .rs-whisker::after { content: ""; position: absolute; top: -4px; width: 2px; height: 10px; background: var(--iqr); border-radius: 1px; }
.rs-whisker::before { left: 0; } .rs-whisker::after { right: 0; }
.rs-barvalue { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); text-align: right; white-space: nowrap; }

.rs-cellbar { position: relative; display: inline-block; vertical-align: middle; width: 170px; height: 14px; margin-right: 8px; outline: none; }
.rs-cellbar-fill { position: absolute; left: 0; top: 2px; height: 10px; background: var(--series-1); border-radius: 0 3px 3px 0; min-width: 1px; }
.rs-cellbar-iqr { position: absolute; top: 6px; height: 2px; background: var(--iqr); }
.rs-inline-bar { position: relative; display: inline-block; vertical-align: middle; width: 110px; height: 10px; margin-right: 8px; background: var(--grid); border-radius: 3px; outline: none; overflow: hidden; }
.rs-inline-bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 3px 3px 0; }

.rs-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); margin-top: 10px; align-items: center; }
.rs-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rs-legend i { display: inline-block; flex: none; }
.rs-key-seg { width: 28px; height: 10px; border-radius: 2px; background: var(--series-1); }
.rs-key-seg.is-other { background: var(--neutral-seg); }
.rs-key-tick { width: 2px; height: 12px; background: var(--muted); }
.rs-key-tick.is-change { background: var(--series-2); height: 16px; }
.rs-key-state { width: 18px; height: 8px; border-radius: 2px; background: var(--state-hidden); }
.rs-key-state.is-idle { background: var(--state-idle); border: 1px solid var(--axis); }
.rs-key-ramp { width: 140px; height: 10px; border-radius: 2px; }

/* timeline */
.rs-timeline + .rs-timeline { margin-top: 18px; }
.rs-timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.rs-timeline-head .rs-btn { margin-left: auto; }
.rs-timeline-svg { width: 100%; height: 78px; display: block; overflow: visible; }
.rs-tick { stroke: var(--muted); stroke-width: 1.5; }
.rs-tick-change { stroke: var(--series-2); stroke-width: 2; }
.rs-seg-label { fill: var(--ink); font-size: 12px; font-weight: 600; pointer-events: none; }
.rs-seg-label.is-page { fill: var(--on-series); }
.rs-state { outline: none; }
.rs-state.is-hidden, .rs-state.is-away { fill: var(--state-hidden); }
.rs-state.is-idle { fill: var(--state-idle); stroke: var(--axis); stroke-width: 1; }
.rs-timeline-svg a:hover rect, .rs-timeline-svg a:focus-visible rect { opacity: 0.85; stroke: var(--ink); stroke-width: 1; }

/* answer distributions */
.rs-dist-page { border-top: 1px solid var(--grid); padding: 8px 0; }
.rs-dist-page summary { cursor: pointer; padding: 4px 0; }
.rs-dist { padding: 10px 0; display: grid; gap: 4px; }
.rs-dist + .rs-dist { border-top: 1px solid var(--grid); }
.rs-dist-label { font-size: 13px; }
.rs-stack { display: flex; height: 22px; gap: 2px; max-width: 720px; }
.rs-stack-seg { display: flex; align-items: center; justify-content: center; min-width: 2px; outline: none; }
.rs-stack-seg:first-child { border-radius: 4px 0 0 4px; }
.rs-stack-seg:last-child { border-radius: 0 4px 4px 0; }
.rs-stack-seg:only-child { border-radius: 4px; }
.rs-stack-seg:hover, .rs-stack-seg:focus-visible { filter: brightness(1.1); outline: 1px solid var(--ink); }
.rs-stack-seg b { font-size: 11px; font-weight: 600; color: #0b0b0b; }
.rs-stack-seg b.is-light { color: #ffffff; }
.rs-stack-ends { display: flex; justify-content: space-between; max-width: 720px; gap: 16px; }
.rs-stack-ends.is-hist { max-width: 440px; }
.rs-hist { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; max-width: 440px; height: 64px; align-items: end; }
.rs-hist-col { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; padding-bottom: 16px; }
.rs-hist-bar { width: 100%; max-width: 24px; background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 1px; }
.rs-hist-col:hover .rs-hist-bar, .rs-hist-col:focus-visible .rs-hist-bar { background: var(--accent-hover); }
.rs-hist-code { position: absolute; bottom: 0; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* misc lists */
.rs-checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-checklist li { display: flex; gap: 10px; align-items: center; }
.rs-checklist .rs-checkmark { width: 20px; height: 20px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--ink); }
.rs-checklist li.is-done .rs-checkmark { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good-text); }
.rs-checklist li.is-done a { color: var(--ink-2); }
.rs-activity { list-style: none; margin: 0; padding: 0; }
.rs-activity li { display: flex; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--grid); }
.rs-activity time { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }
.rs-downloads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rs-downloads li { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: center; }
.rs-downloads li span { color: var(--ink-2); font-size: 12.5px; }
@media (max-width: 600px) { .rs-downloads li { grid-template-columns: 1fr; gap: 4px; } }
.rs-warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-section-title { font-size: 13.5px; font-weight: 650; margin: 18px 0 8px; }
.rs-section-title:first-child { margin-top: 0; }
.rs-scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rs-score h3 { font-size: 13.5px; margin-bottom: 6px; }
.rs-rule { margin: 8px 0; }
.rs-rule summary { cursor: pointer; font-weight: 550; }
.rs-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.rs-dl dt { color: var(--ink-2); }
.rs-dl dd { margin: 0; overflow-wrap: anywhere; }
.rs-backups { padding-left: 18px; }
.rs-diff { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.rs-mailpreview { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; margin-top: 8px; }
.rs-mailpreview pre { white-space: pre-wrap; font: inherit; margin: 10px 0 0; }

/* tooltip */
.rs-tooltip { position: fixed; z-index: 1000; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; max-width: 340px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); line-height: 1.4; }
.rs-tooltip strong { font-weight: 650; }

/* ---------- matrix heatmap ---------- */
.rs-matrix-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rs-matrix-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 550; color: var(--ink-2); }
.rs-matrix-controls select { width: auto; }
.rs-matrix { position: relative; overflow-x: auto; }
.rs-matrix canvas { display: block; cursor: crosshair; }

/* ---------- heatmap page ---------- */
.rs-heatmap-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.rs-heatmap-stage-wrap { max-width: 1100px; }
.rs-heatmap-summary { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; min-height: 20px; }
.rs-heatmap-stage { position: relative; overflow: hidden; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.rs-heatmap-stage iframe, .rs-replay-stage iframe { border: 0; display: block; transform-origin: 0 0; background: #faf8f0; pointer-events: none; }
.rs-heatmap-table { max-width: 1100px; }
.rs-heatmap-table .rs-qlabel { max-width: 70ch; }
.rs-heatmap-table h2 { font-size: 15px; margin-bottom: 10px; }
.rs-heatmap-stage.is-loading iframe { opacity: 0.55; transition: opacity 0.2s; }

/* ---------- replay ---------- */
.rs-replay { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto auto; gap: 16px; }
.rs-replay-stage-wrap { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; align-items: flex-start; min-height: 420px; }
.rs-replay.is-wide-screen { grid-template-columns: 1fr; }
.rs-replay.is-wide-screen .rs-replay-side { max-height: 340px; }
.rs-replay.is-wide-screen .rs-replay-controls { order: -1; }
.rs-replay-stage { position: relative; overflow: hidden; border-radius: 10px; box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12); background: #f5f4f0; }
.rs-replay-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; max-height: 78vh; overflow: auto; }
.rs-replay-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 12.5px; margin: 12px 0; }
.rs-replay-facts dt { color: var(--ink-2); }
.rs-replay-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.rs-replay-log { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.rs-replay-log li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.rs-replay-log li:hover { background: var(--surface-2); }
.rs-replay-log li.is-current { background: var(--accent-wash); }
.rs-replay-log li.is-future { opacity: 0.45; }
.rs-replay-log time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rs-replay-controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.rs-replay-controls [data-play] { width: 44px; font-size: 16px; }
.rs-replay-time { font-variant-numeric: tabular-nums; min-width: 110px; font-size: 13px; }
.rs-replay-track { position: relative; flex: 1 1 320px; height: 34px; }
.rs-replay-segs { position: absolute; left: 0; right: 0; top: 12px; height: 10px; border-radius: 3px; overflow: hidden; background: var(--grid); }
.rs-replay-segs span { position: absolute; top: 0; bottom: 0; }
.rs-replay-track input[type=range] { position: absolute; inset: 0; width: 100%; height: 34px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.rs-replay-track input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 34px; }
.rs-replay-track input[type=range]::-moz-range-track { background: transparent; height: 34px; }
.rs-replay-track input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 30px; margin-top: 2px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.rs-replay-track input[type=range]::-moz-range-thumb { width: 4px; height: 30px; border: 0; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.rs-replay-controls select { font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); }
@media (max-width: 1100px) { .rs-replay { grid-template-columns: 1fr; } .rs-replay-side { max-height: 360px; } }

/* ---------- login / bare pages ---------- */
.rs-bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.rs-bare-main { width: 100%; max-width: 420px; }
.rs-login { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 30px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 2px 16px rgba(60, 60, 60, 0.06); }
.rs-login h1 { font-size: 24px; }
.rs-bare { background: #f6efc6; }
.rs-login p { margin: 0; }
.rs-login-brand { display: flex; align-items: center; gap: 10px; }
