/* Colour tokens: light by default, dark from the system preference unless the visitor chose
   light, or when they chose dark. Charts read the same tokens (common.js cssVar). */
:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6a6f76;
  --line: #e3e3e0;
  --hover: #f6f6f3;
  --code: #fafaf8;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --soft: #eef2ff;
  --soft-line: #c7d2fe;
  --soft-text: #3346a8;
  --lv: #d1495b;
  --rv: #2e86de;
  --case-a: #2d3142;
  --case-b: #ef8a17;
  --ok: #2f9e44;
  --bad: #d9480f;
  --grid: #eeeeee;
  --zero: #cccccc;
  --tissue: #d8d2c8;
  --epi: #6a6f76;
  --ecg-bg: #fff8f8;
  --ecg-grid: #f2c4c4;
  --ecg-minor: #fbe3e3;
  --ecg-trace: #1f2328;
  --ph-fill: #c3ecd0;
  --ph-isoc: #ffe1b8;
  --ph-ej: #e2d6ff;
  --ph-isor: #c6eef3;
  --st-complete: #2f9e44;
  --st-simulated: #66a80f;
  --st-planned: #74a7d8;
  --st-draft: #ced4da;
  --st-failed: #e8590c;
  --measured: #7048e8;
  --side: #fbfbfa;
  --side-w: 244px;
  --shadow: 0 8px 28px rgba(15, 20, 30, .14);
  --radius: 8px;
  --gap: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111317; --card: #1a1d22; --text: #e6e8eb; --muted: #9aa0a8; --line: #2d3138;
    --hover: #22262c; --code: #15171b; --accent: #6b9bff; --accent-text: #0d1117;
    --soft: #1f2a44; --soft-line: #33476e; --soft-text: #b8c8ff;
    --lv: #ef6f7f; --rv: #5aa6f0; --case-a: #c9d1e0; --case-b: #f5a142; --ok: #51cf66; --bad: #ff7a45;
    --grid: #2a2e35; --zero: #444a53; --tissue: #4b4740; --epi: #9aa0a8;
    --ecg-bg: #1d191a; --ecg-grid: #4a2d31; --ecg-minor: #2e2224; --ecg-trace: #e6e8eb;
    --ph-fill: #1f4a2e; --ph-isoc: #5a4120; --ph-ej: #3d3366; --ph-isor: #1d4a52;
    --st-complete: #51cf66; --st-simulated: #94d82d; --st-planned: #4f7fb0; --st-draft: #495057; --st-failed: #ff7a45;
    --measured: #b197fc; --side: #15181c;
    --shadow: 0 8px 28px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111317; --card: #1a1d22; --text: #e6e8eb; --muted: #9aa0a8; --line: #2d3138;
  --hover: #22262c; --code: #15171b; --accent: #6b9bff; --accent-text: #0d1117;
  --soft: #1f2a44; --soft-line: #33476e; --soft-text: #b8c8ff;
  --lv: #ef6f7f; --rv: #5aa6f0; --case-a: #c9d1e0; --case-b: #f5a142; --ok: #51cf66; --bad: #ff7a45;
  --grid: #2a2e35; --zero: #444a53; --tissue: #4b4740; --epi: #9aa0a8;
  --ecg-bg: #1d191a; --ecg-grid: #4a2d31; --ecg-minor: #2e2224; --ecg-trace: #e6e8eb;
  --ph-fill: #1f4a2e; --ph-isoc: #5a4120; --ph-ej: #3d3366; --ph-isor: #1d4a52;
  --st-complete: #51cf66; --st-simulated: #94d82d; --st-planned: #4f7fb0; --st-draft: #495057; --st-failed: #ff7a45;
  --measured: #b197fc; --side: #15181c;
  --shadow: 0 8px 28px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 4px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Frame: sidebar, top bar, content */
:root[data-sidebar="collapsed"] { --side-w: 60px; }
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.content { min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1520px; margin: 0 auto; padding: 16px 24px 48px; display: flex;
  flex-direction: column; gap: var(--gap); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 48px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar .crumbs { min-width: 0; flex: 1; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.topbar .crumbs > * { overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--line); }
.crumbs > span:last-child { color: var(--text); font-weight: 600; }
section[id], .card[id], .prose h2[id] { scroll-margin-top: 104px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 6px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; }

/* A workspace (a dataset, a cohort, the documentation, the administration): its header and its tabs */
.ws-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ws-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ws-title p { margin: 0; }
.ws-icon { width: 42px; height: 42px; border-radius: 10px; flex: none; display: inline-flex; align-items: center;
  justify-content: center; background: var(--soft); color: var(--soft-text); }
.ws-icon .ico { width: 22px; height: 22px; }
.ws-icon.kind-shape_modes { background: color-mix(in srgb, #0ca678 14%, var(--card)); color: color-mix(in srgb, #0ca678 70%, var(--text)); }
.ws-icon.kind-phenotypes { background: color-mix(in srgb, var(--lv) 13%, var(--card)); color: color-mix(in srgb, var(--lv) 75%, var(--text)); }
.ws-icon.kind-synthetic { background: color-mix(in srgb, #868e96 16%, var(--card)); color: var(--muted); }
.ws-icon.kind-personalised { background: color-mix(in srgb, var(--measured) 14%, var(--card)); color: color-mix(in srgb, var(--measured) 75%, var(--text)); }
.ws-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-top: -6px;
  scrollbar-width: none; }
.ws-tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; font-weight: 500; }
.ws-tabs a:hover { color: var(--text); text-decoration: none; }
.ws-tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* The sections of a long page (case page), under the top bar */
.subnav { position: sticky; top: 48px; z-index: 9; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: -6px -24px 0; padding: 6px 24px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.subnav a { padding: 4px 10px; border-radius: 999px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.subnav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.subnav a.active { background: var(--soft); color: var(--soft-text); font-weight: 600; }
#tab-body, #kind-panel, #admin-body { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
#kind-panel:empty { display: none; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 20;
  background: var(--side); border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; height: 48px;
  padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.brand { font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand svg { width: 20px; height: 20px; fill: var(--lv); flex: none; }
.brand:hover { text-decoration: none; }
.side-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.side-btn:hover { background: var(--hover); color: var(--text); }
.ico { width: 18px; height: 18px; flex: none; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.side-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 14px 10px 4px; }
.side-empty { margin: 2px 10px 4px 38px; font-size: 12px; color: var(--muted); }
.side-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 6px; color: var(--text);
  min-height: 32px; position: relative; }
.side-link:hover { background: var(--hover); text-decoration: none; }
.side-link .ico { color: var(--muted); }
.side-link.active { background: var(--soft); color: var(--soft-text); font-weight: 600; }
.side-link.active .ico { color: var(--soft-text); }
.side-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.side-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.side-label { font-size: 11.5px; color: var(--muted); padding: 6px 10px 2px 38px; }
.side-more { font-size: 12px; color: var(--muted); padding: 2px 10px 4px 38px; }
.side-foot { flex: none; border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.side-foot .status { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.pill { display: flex; align-items: center; gap: 8px; padding: 2px 6px; font-size: 12px; color: var(--muted); cursor: default; }
.pill b { color: var(--text); font-weight: 600; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--st-draft); flex: none; margin: 0 5px; }
.pill.ok i { background: var(--ok); }
.pill.bad i { background: var(--bad); }
.account { position: relative; }
.account-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.account-btn:hover { background: var(--hover); }
.account-btn .who-text { display: flex; flex-direction: column; line-height: 1.25; }
.account-btn .who-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--soft-line); background: var(--soft); flex: none;
  color: var(--soft-text); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); min-width: 228px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: flex;
  flex-direction: column; z-index: 30; }
.menu[hidden] { display: none; }
.menu a, .menu .logout { padding: 7px 8px; border-radius: 6px; color: var(--text); font: inherit; text-align: left;
  background: none; border: 0; cursor: pointer; width: 100%; }
.menu a:hover, .menu .logout:hover { background: var(--hover); text-decoration: none; }
.menu form { margin: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.theme-pick { display: flex; align-items: center; gap: 4px; padding: 6px 8px; }
.theme-pick span { margin-right: auto; }
.theme-pick button { font: inherit; font-size: 12px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); cursor: pointer; }
.theme-pick button.on { background: var(--soft); border-color: var(--soft-line); color: var(--soft-text); }
.side-open, .side-backdrop { display: none; }

/* Collapsed sidebar: icons, the name of an entry on hover */
:root[data-sidebar="collapsed"] .side-text, :root[data-sidebar="collapsed"] .side-count,
:root[data-sidebar="collapsed"] .side-title, :root[data-sidebar="collapsed"] .side-empty { display: none; }
:root[data-sidebar="collapsed"] .side-head { padding: 0 6px; flex-direction: column; justify-content: center; height: auto;
  gap: 4px; padding-block: 8px; }
:root[data-sidebar="collapsed"] .side-link { justify-content: center; padding: 7px; }
:root[data-sidebar="collapsed"] .side-nav { overflow: visible; }
:root[data-sidebar="collapsed"] .side-sep { margin: 8px 6px; }
:root[data-sidebar="collapsed"] .side-title { display: block; height: 1px; padding: 0; margin: 8px 6px; background: var(--line); font-size: 0; }
:root[data-sidebar="collapsed"] .side-label, :root[data-sidebar="collapsed"] .side-more { display: none; }
:root[data-sidebar="collapsed"] .side-link:hover::after, :root[data-sidebar="collapsed"] .side-link:focus-visible::after {
  content: attr(data-label); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--card);
  font-size: 12px; font-weight: 500; z-index: 40; pointer-events: none; box-shadow: var(--shadow); }
:root[data-sidebar="collapsed"] .side-foot .status { align-items: center; }
:root[data-sidebar="collapsed"] .account-btn { justify-content: center; padding: 4px 0; }
:root[data-sidebar="collapsed"] .menu { right: auto; left: calc(100% + 6px); bottom: 0; }

/* Global search */
.global-search { position: relative; width: min(380px, 40vw); flex: none; }
.global-search input { width: 100%; font: inherit; padding: 6px 64px 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--text); }
.global-search input:focus { outline: 2px solid var(--soft-line); outline-offset: 0; }
.global-search .kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.global-search .suggest { left: auto; right: 0; width: max(100%, 420px); }
.kbd { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--card); }
.suggest-group { padding: 8px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); }
a.suggest-item { color: var(--text); }
a.suggest-item:hover { text-decoration: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow); }
  :root.side-open .sidebar { transform: none; }
  :root.side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, .3); }
  .side-open { display: inline-flex; }
  #side-collapse { display: none; }
  :root[data-sidebar="collapsed"] .side-text, :root[data-sidebar="collapsed"] .side-count,
  :root[data-sidebar="collapsed"] .side-label, :root[data-sidebar="collapsed"] .side-more { display: revert; }
  :root[data-sidebar="collapsed"] .side-title { display: block; height: auto; margin: 0; padding: 14px 10px 4px;
    background: none; font-size: 11px; }
  :root[data-sidebar="collapsed"] .side-link { justify-content: flex-start; padding: 6px 10px; }
  :root[data-sidebar="collapsed"] .side-link:hover::after { display: none; }
  .ws-head { gap: 10px; }
  .ws-icon { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .global-search { width: auto; flex: 1; max-width: 260px; }
  .global-search .kbd { display: none; }
  .global-search input { padding-right: 10px; }
  .topbar .crumbs { display: none; }
}

/* Controls */
.btn { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--text); }
input[type="range"] { accent-color: var(--accent); }
label { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.actions, .axis-pickers, .links, .controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pickers { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.picker { display: flex; align-items: center; gap: 8px; }
.picker .dot { width: 10px; height: 10px; border-radius: 50%; }
.picker select { font-size: 15px; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--soft);
  color: var(--soft-text); font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  background: var(--card); font-size: 13px; user-select: none; }
.chip.on { background: var(--soft); border-color: var(--soft-line); }
.filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; border-left: 4px solid var(--line); }
.kpi.ok { border-left-color: var(--ok); }
.kpi.bad { border-left-color: var(--bad); }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 20px; font-weight: 650; margin-top: 2px; }
.kpi .value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.kpi .ref { color: var(--muted); font-size: 11px; margin-top: 2px; }
.kpi .pair { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: baseline;
  margin-top: 4px; }
.kpi .pair b { font-size: 16px; }
.kpi .pair .delta { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.tag-a, .tag-b { font-size: 11px; font-weight: 700; }
.tag-a { color: var(--case-a); }
.tag-b { color: var(--case-b); }
.flag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 4px;
  vertical-align: middle; }
.flag.ok { background: var(--ok); }
.flag.bad { background: var(--bad); }

/* Layout grids */
.grid-3d { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--gap); }
.viewer-card { padding: 0; overflow: hidden; }
#viewer { width: 100%; height: 560px; border: 0; display: block; background: var(--card); }
.grid-stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }
.plot { width: 100%; height: 300px; }
.plot-pv { height: 500px; }
.plot-tall { height: 460px; }
.plot-ecg { height: 520px; }
.ecg-info { display: flex; gap: 8px; flex-wrap: wrap; }
.ecg-info .item { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 13px; }
.ecg-info .item .k { color: var(--muted); font-size: 12px; margin-right: 6px; }
.ecg-info .item .note { color: var(--muted); font-size: 12px; margin-left: 4px; }
.row-plots { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px; }
.row-plots > div { height: 320px; }
@media (max-width: 1000px) { .grid-3d, .grid-stats { grid-template-columns: 1fr; } }
.legend-line { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted);
  font-size: 12px; }
.legend-line i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; margin-right: 5px;
  vertical-align: middle; }
.legend-line i.dash { border-top-style: dashed; }
.legend-line i.swatch { width: 14px; height: 10px; border: 0; border-radius: 2px; }

/* Echo views */
.echo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
@media (max-width: 1000px) { .echo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .echo-grid { grid-template-columns: 1fr; } }
.echo-panel { border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.echo-head { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px 0; font-size: 12px; }
.echo-body { position: relative; padding: 16px 20px; }
.echo-body svg { display: block; width: 100%; height: auto; max-height: 360px; overflow: visible; }
.echo-body .hint { position: absolute; font-size: 10px; color: var(--muted); pointer-events: none; white-space: nowrap; }
.echo-body .hint.top { top: 2px; left: 50%; transform: translateX(-50%); }
.echo-body .hint.bottom { bottom: 2px; left: 50%; transform: translateX(-50%); }
.echo-body .hint.left { left: 10px; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); }
.echo-body .hint.right { right: 10px; top: 50%; transform: translate(50%, -50%) rotate(90deg); }
.echo .tissue { fill: var(--tissue); fill-rule: evenodd; stroke: none; }
.echo path.line { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.echo .lv { stroke: var(--lv); }
.echo .rv { stroke: var(--rv); }
.echo .epi { stroke: var(--epi); }
.echo .ghost path.line { stroke-dasharray: 3 3; opacity: .55; }
.no-ghost .echo .ghost { display: none; }
.echo.compare .c0 .tissue { fill: var(--case-a); opacity: .14; }
.echo.compare .c1 .tissue { fill: var(--case-b); opacity: .14; }
.echo.compare .c0 path.line { stroke: var(--case-a); }
.echo.compare .c1 path.line { stroke: var(--case-b); }
.echo.compare path.line.epi { stroke-width: 1; }
.echo .scale { stroke: var(--muted); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.echo .scale-label { fill: var(--muted); }
.time-label { min-width: 90px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

/* Parameters */
.heart-maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(var(--n, 1) * 180px), 1fr));
  gap: 14px; }
.heart-map { min-width: 0; }
.heart-map .map-title { font-size: 12px; font-weight: 600; text-align: center; }
.heart-map .map-title small { display: block; font-weight: 400; color: var(--muted); }
.heart-map .pair { display: grid; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); gap: 4px; }
.heart-map .tagged > span { display: block; text-align: center; }
.heart-map svg { width: 100%; height: auto; display: block; max-width: 220px; margin: 0 auto; }
.bullseye text { font-size: 0.62px; text-anchor: middle; dominant-baseline: central; pointer-events: none;
  font-variant-numeric: tabular-nums; }
.bullseye .segment { stroke: var(--card); stroke-width: 0.06; }
.bullseye .segment:hover { stroke: var(--text); }
.bullseye .segment.neutral { fill: var(--grid); }
.bullseye .orient { fill: var(--muted); font-size: 0.5px; }
.bullseye .segment.site-seg { fill: var(--soft-line); }
/* Activation sites: thin dark outlines of the segments in the light theme (gaps in the dark one). */
.bullseye.sites .segment { stroke: #1f2328; stroke-width: 0.03; }
:root[data-theme="dark"] .bullseye.sites .segment { stroke: var(--card); stroke-width: 0.06; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bullseye.sites .segment { stroke: var(--card); stroke-width: 0.06; }
}
.bullseye .site { fill: var(--text); stroke: var(--card); stroke-width: 0.08; }
.bullseye .site.late { fill: var(--accent); }
.bullseye .site.blocked { fill: var(--card); stroke: var(--bad); stroke-width: 0.1; }
.bullseye .site-x { stroke: var(--bad); stroke-width: 0.1; }
.bullseye .site-num { fill: var(--card); font-size: 0.6px; font-weight: 700; }
.bullseye .site-num.off { display: none; }
.site-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; display: grid; gap: 2px; }
.site-list li { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; }
.site-list li.off { color: var(--muted); }
.site-list .num { width: 16px; height: 16px; border-radius: 50%; background: var(--text); color: var(--card);
  font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.site-list .num.late { background: var(--accent); }
.site-list .num.blocked { background: var(--card); color: var(--bad); border: 1.5px solid var(--bad); }
.site-list b { font-weight: 600; font-variant-numeric: tabular-nums; }
.params-note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.param-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px;
  margin-top: 14px; }
.param-sections > * { min-width: 0; }
.param-sections table td { white-space: normal; }
.param-sections td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.param-sections h3 { margin-top: 10px; }
.param-sections h2 { margin-bottom: 2px; }
td .changed, td.changed { font-weight: 650; }
td .default { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
tr.differs td.num.b { color: var(--case-b); font-weight: 650; }
.cal { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: 10px;
  line-height: 16px; background: var(--soft); color: var(--soft-text); cursor: help; vertical-align: 1px; }
.has-doc { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; cursor: help; }
.coef-bar { position: relative; display: inline-block; width: 72px; height: 8px; border-radius: 4px;
  background: var(--grid); vertical-align: middle; margin-left: 8px; }
.coef-bar .zero { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.coef-bar .fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.coef-bar .fill.b { top: 4px; background: var(--case-b); }
.coef-bar .fill.a { bottom: 4px; background: var(--case-a); }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th.left, td.left { text-align: left; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--card); }
th.sortable { cursor: pointer; }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
tbody tr:hover { background: var(--hover); }
tr.clickable { cursor: pointer; }
.table-wrap { overflow-x: auto; max-height: 560px; }
.metric-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }
.metric-groups > * { min-width: 0; }
.metric-groups .table-wrap, .param-sections .table-wrap { max-height: none; }
.ref { color: var(--muted); }

details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary h2 { display: inline; }
details summary::before { content: "▸ "; color: var(--muted); }
details[open] summary::before { content: "▾ "; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px;
  margin-top: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.gallery figcaption { font-size: 12px; color: var(--muted); }
.params { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
  margin-top: 8px; }
.params pre { margin: 0; font-size: 12px; background: var(--code); padding: 8px; border-radius: 6px;
  overflow: auto; max-height: 360px; }

/* Login */
.login { min-height: calc(100vh - 80px); display: flex; align-items: center; justify-content: center; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.login-brand svg { width: 36px; height: 36px; fill: var(--lv); flex: none; }
.login-brand p { margin: 0; }
.field { display: flex; flex-direction: column; align-items: stretch; gap: 4px; color: var(--muted); font-size: 13px; }
.field input, .field select, .filter-bar input, .popover input, .case-search input, .search-all input {
  font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.field input:focus, .filter-bar input:focus, .case-search input:focus { outline: 2px solid var(--soft-line); outline-offset: 0; }
.btn.wide { width: 100%; padding: 8px; }
.btn.danger { color: var(--bad); }
.btn.link { border: 0; background: none; color: var(--accent); }
.alert { margin: 0; padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--bad) 12%, var(--card));
  color: var(--bad); font-size: 13px; }

/* Breadcrumbs, badges */
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.crumbs .adjacent { margin-left: auto; display: flex; gap: 6px; align-items: center; }
h1 .badge { vertical-align: 3px; margin-left: 6px; }
.status-chip { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; line-height: 18px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.status-chip.st-complete { color: var(--st-complete); border-color: color-mix(in srgb, var(--st-complete) 45%, var(--card)); }
.status-chip.st-simulated { color: var(--st-simulated); border-color: color-mix(in srgb, var(--st-simulated) 45%, var(--card)); }
.status-chip.st-planned { color: var(--st-planned); border-color: color-mix(in srgb, var(--st-planned) 45%, var(--card)); }
.status-chip.st-failed { color: var(--st-failed); border-color: color-mix(in srgb, var(--st-failed) 45%, var(--card)); }
.status-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--grid); margin: 8px 0; gap: 1px; }
.status-bar span { min-width: 3px; }
.st-complete { background: var(--st-complete); }
.st-simulated { background: var(--st-simulated); }
.st-planned { background: var(--st-planned); }
.st-draft { background: var(--st-draft); }
.st-failed { background: var(--st-failed); }
.status-chip.st-complete, .status-chip.st-simulated, .status-chip.st-planned, .status-chip.st-draft, .status-chip.st-failed { background: none; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
h3.space, .space { margin-top: 14px; }
.notice { border-left: 4px solid var(--accent); }
.notice.bad { border-left-color: var(--bad); }
.notice p { margin: 4px 0; }

/* Home */
.kind-section { display: flex; flex-direction: column; gap: 10px; }
.kind-title { display: flex; gap: 10px; align-items: baseline; margin: 6px 0 0; font-size: 16px; }
.study-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.study-card { display: flex; flex-direction: column; gap: 4px; color: var(--text); transition: border-color .15s; }
.study-card:hover { text-decoration: none; border-color: var(--soft-line); }
.study-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.study-card-head h2 { margin: 0; }
.study-card-foot { display: flex; gap: 14px; flex-wrap: wrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0; min-height: 3.6em; }
.search-all, .case-search { position: relative; }
.search-all { width: min(360px, 100%); margin: 0; }
.search-all input, .case-search input { width: 100%; }
.case-search { min-width: 220px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 25; max-height: 360px; overflow: auto; min-width: 280px; }
.suggest[hidden] { display: none; }
.suggest-item { display: flex; gap: 8px; align-items: center; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.suggest-item span:not(.status-chip) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-item .status-chip { margin-left: auto; }
.suggest-item.active, .suggest-item:hover { background: var(--hover); }

/* Study overview */
.prose { line-height: 1.55; }
.prose p:first-child { margin-top: 0; }
.prose code { background: var(--code); padding: 1px 4px; border-radius: 4px; font-size: 12px; }
.prose pre { background: var(--code); padding: 10px; border-radius: 6px; overflow: auto; font-size: 12px; }
.prose table { width: auto; margin: 8px 0 16px; }
.prose h1 { font-size: 22px; margin-bottom: 12px; }
.prose h2 { font-size: 17px; margin-top: 22px; }
.prose h3 { font-size: 14px; color: var(--text); margin-top: 16px; }
.phenotype-groups { display: flex; flex-direction: column; gap: 14px; }
.phenotype-group { border-left: 3px solid var(--ph); padding-left: 12px; }
.case-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.case-card { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; color: var(--text); background: var(--card); }
.case-card:hover { text-decoration: none; border-color: var(--soft-line); background: var(--hover); }
.case-card.variant { border-style: dashed; }
.case-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.case-card .note { color: var(--muted); font-style: italic; }
.case-card .link { color: var(--accent); margin-top: 2px; }
.mini-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mini-kpis b { color: var(--text); font-weight: 600; }
.mini-kpis .delta { color: var(--muted); font-size: 11px; }
.mode-matrix td, .mode-matrix th { text-align: center; }
.mode-matrix td.left, .mode-matrix th.left { text-align: left; }
.mode-cell a { color: var(--text); font-variant-numeric: tabular-nums; }
.mode-cell small { color: var(--text); opacity: .7; }
.small-multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.plot-small { height: 200px; }

/* Filters, popovers, case table */
.filter-bar { position: relative; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar > input[type="search"] { width: 240px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-chip { display: inline-flex; gap: 6px; align-items: center; }
.filter-chip > span { cursor: pointer; }
.filter-chip .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.filter-chip .x:hover { color: var(--bad); }
.cohorts-pick { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.filter-bar .count { white-space: nowrap; }
.popover { position: absolute; top: calc(100% + 6px); left: 0; z-index: 25; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px;
  min-width: 320px; max-width: min(560px, calc(100vw - 32px)); }
.popover .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.popover .row.end { justify-content: flex-end; }
.popover select { max-width: 100%; }
.value-box { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.value-box input[type="number"] { width: 110px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; max-height: 220px; overflow: auto; }
.checks.wide { max-height: none; }
.checks label { color: var(--text); }
.checks.disabled { opacity: .4; pointer-events: none; }
.table-actions, .table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: relative; }
.table-actions { margin-bottom: 8px; }
.table-actions .btn.primary { margin-left: auto; }
.table-wrap.tall { max-height: calc(100vh - 300px); min-height: 200px; }
.table-wrap.loading { opacity: .5; transition: opacity .2s; }
th.check, td.check { width: 28px; text-align: center; }
td.case-cell a { font-weight: 600; margin-right: 6px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.pager label select { padding: 2px 4px; }
.popover.columns { width: 420px; max-height: 70vh; }
.col-list { overflow: auto; max-height: 50vh; display: flex; flex-direction: column; gap: 8px; }
.col-group { display: flex; flex-direction: column; gap: 2px; }
.col-group label { color: var(--text); font-size: 13px; }
.col-group label.muted { color: var(--muted); }
.plot-pc { height: 420px; }
.pc-picker { position: relative; }
.pc-picker summary { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.pc-picker summary::before { content: none; }
.pc-picker .col-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; width: 340px; }
.pc-picker label { color: var(--text); }

/* Case page */
.picker .case-title { font-size: 15px; }
.picker select { font-size: 13px; font-weight: 400; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; width: 38%; position: static; white-space: normal; }
table.kv td { white-space: normal; }
.param-list { margin-top: 8px; }


/* Documentation: the article over the width of the page, its headings in a column on the right */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: var(--gap); align-items: start; }
.doc-layout.no-toc { grid-template-columns: minmax(0, 1fr); }
.doc { padding: 22px 32px 30px; }
.doc h1 { font-size: 24px; margin-bottom: 6px; }
.doc h2 { font-size: 18px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.doc h1 + p { font-size: 15px; }
.doc table { width: 100%; }
.doc th, .doc td { text-align: left; vertical-align: top; white-space: normal; }
.doc li + li { margin-top: 3px; }
.doc-toc { position: sticky; top: 64px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; padding: 4px 0; }
.doc-toc b { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 12px 6px; }
.doc-toc a { padding: 4px 12px; border-left: 2px solid var(--line); color: var(--muted); }
.doc-toc a:hover { color: var(--text); text-decoration: none; }
.doc-toc a.active { border-left-color: var(--accent); color: var(--text); font-weight: 600; }
.aud-clinicians { --aud: #e8590c; }
.aud-researchers { --aud: #1c7ed6; }
.aud-engineers { --aud: #0ca678; }
.doc-for { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.aud { padding: 1px 9px; border-radius: 999px; font-weight: 600; background: color-mix(in srgb, var(--aud) 13%, var(--card));
  color: color-mix(in srgb, var(--aud) 75%, var(--text)); }
.aud-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 4px; }
.aud-card { border: 1px solid var(--line); border-top: 3px solid var(--aud); border-radius: var(--radius); padding: 14px 16px; }
.aud-card h3 { margin: 0 0 6px; font-size: 15px; color: color-mix(in srgb, var(--aud) 70%, var(--text)); }
.aud-card p { color: var(--muted); margin: 0 0 10px; }
.aud-card ul { margin: 0; padding-left: 18px; }
@media (max-width: 1100px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-toc { display: none; }
  .aud-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) { .doc { padding: 16px; } }

/* Account and administration */
.form { display: flex; flex-direction: column; gap: 10px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form-msg { font-size: 13px; }
.form-msg.ok, .ok-text { color: var(--ok); }
.form-msg.bad, .bad-text { color: var(--bad); }
.inline-form .row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 150px; }
.field.grow { flex: 1; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.secret { font-size: 15px; padding: 2px 8px; margin: 0 8px; background: var(--code); border-radius: 4px; user-select: all; }
.gauge { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; margin: 6px 0 10px; }
.gauge span { display: block; height: 100%; background: var(--accent); }
.access-table td { vertical-align: top; white-space: normal; }
.access-table .checks { max-height: 140px; }
.detail { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
pre.json { margin: 8px 0 0; font-size: 12px; background: var(--code); padding: 8px; border-radius: 6px; overflow: auto; max-height: 480px; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; }
.toast { background: var(--text); color: var(--card); padding: 8px 14px; border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; max-width: 80vw; }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 700px) {
  .filter-bar > input[type="search"] { width: 100%; }
  .cohorts-pick { margin-left: 0; }
  .info-grid { grid-template-columns: 1fr; }
  main { padding: 12px 16px 40px; }
  .metric-groups, .param-sections { grid-template-columns: 1fr; }
}

/* Home: compact study tables */
.study-cell { display: flex; flex-direction: column; gap: 1px; max-width: 440px; white-space: normal; }
.clamp-1 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-cell { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.status-bar.slim { height: 6px; margin: 2px 0; }
.badge.kind-shape_modes { background: color-mix(in srgb, #0ca678 14%, var(--card)); color: color-mix(in srgb, #0ca678 70%, var(--text)); }
.badge.kind-phenotypes { background: color-mix(in srgb, var(--lv) 13%, var(--card)); color: color-mix(in srgb, var(--lv) 75%, var(--text)); }
.badge.kind-synthetic { background: color-mix(in srgb, #868e96 16%, var(--card)); color: var(--muted); }
.badge.kind-personalised { background: color-mix(in srgb, var(--measured) 14%, var(--card)); color: color-mix(in srgb, var(--measured) 75%, var(--text)); }
.space-top { margin-top: var(--gap); }

/* Case table: the case column stays in view */
th.check, td.check { position: sticky; left: 0; z-index: 2; background: var(--card); min-width: 32px; width: 32px; }
th.sticky-col, td.sticky-col { position: sticky; left: 32px; z-index: 2; background: var(--card); box-shadow: 1px 0 0 var(--line); }
th.check, th.sticky-col { z-index: 3; }
tbody tr:hover td.sticky-col, tbody tr:hover td.check { background: var(--hover); }

/* Segmented control */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { font: inherit; font-size: 12px; padding: 3px 10px; border: 0; background: var(--card); color: var(--muted); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--soft); color: var(--soft-text); font-weight: 600; }

/* Reference marks (not by colour only) and the measured values of patient twins */
.flag-mark { font-size: 10px; margin-left: 4px; vertical-align: 1px; }
.flag-mark.bad { color: var(--bad); }
.legend-line i.dot { border-top-style: dotted; border-top-width: 3px; }
.summary { display: flex; flex-direction: column; gap: 6px; }
.summary .legend-line:empty { display: none; }
.measured-key { color: var(--measured); font-weight: 600; }
.kpi .meas { font-size: 12px; margin-top: 3px; }

/* Personalisation section */
.pers-score .score { display: flex; align-items: center; gap: 6px; }
.pers-score .gauge { width: 140px; margin: 0 0 0 6px; }
.pers-data { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 12px; }
.data-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: var(--card); }
.data-chip i { font-style: normal; font-weight: 700; color: var(--muted); }
.data-chip.used { border-color: color-mix(in srgb, var(--ok) 45%, var(--card)); }
.data-chip.used i { color: var(--ok); }
.data-chip.off { color: var(--muted); border-style: dashed; }
.stepper { list-style: none; margin: 0 0 14px; padding: 0; display: flex; gap: 0; flex-wrap: wrap; counter-reset: none; }
.step { flex: 1 1 160px; position: relative; padding-right: 12px; }
.step::after { content: ""; position: absolute; top: 14px; left: 34px; right: 4px; height: 2px; background: var(--line); }
.step:last-child::after { display: none; }
.step a { display: flex; gap: 8px; align-items: flex-start; color: var(--text); position: relative; z-index: 1; }
.step a:hover { text-decoration: none; }
.step a:hover b { text-decoration: underline; }
.step-dot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; background: var(--st-draft); }
.step[data-status="done"] .step-dot { background: var(--st-complete); }
.step[data-status="failed"] .step-dot { background: var(--st-failed); }
.step[data-status="pending"] .step-dot { background: var(--st-planned); }
.step[data-status="skipped"] .step-dot { color: var(--text); }
.step-text { display: flex; flex-direction: column; background: var(--card); padding-right: 8px; }
.pers-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 12px; }
.step-card { border: 1px solid var(--line); border-left: 4px solid var(--st-draft); border-radius: var(--radius); padding: 10px 14px;
  min-width: 0; scroll-margin-top: 60px; }
.step-card h3 { color: var(--text); font-size: 14px; margin: 0; }
.st-complete-edge { border-left-color: var(--st-complete); }
.st-failed-edge { border-left-color: var(--st-failed); }
.st-planned-edge { border-left-color: var(--st-planned); }
.step-meta { margin: 2px 0 8px; }
.notice-inline { margin: 4px 0 8px; padding: 6px 10px; border-radius: 6px; background: var(--hover); }
.notice-inline.bad { background: color-mix(in srgb, var(--bad) 12%, var(--card)); color: var(--bad); }
.step-card table { margin-top: 6px; }
.step-card td.num { font-variant-numeric: tabular-nums; }
.step-card td.left { white-space: normal; }
.step-card th, .step-card td { padding: 4px 6px; }
td.fit-mark { width: 24px; text-align: center; font-weight: 700; }
.bounds-bar { position: relative; display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--grid);
  vertical-align: middle; }
.bounds-bar .val, .bounds-bar .init { position: absolute; top: -3px; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px; }
.bounds-bar .val { background: var(--accent); }
.bounds-bar .init { background: var(--muted); opacity: .6; }
.bounds-bar .sd { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 30%, var(--grid)); border-radius: 4px; }
.plot-conv { height: 150px; }

/* Twins overview */
table.bars td { white-space: normal; vertical-align: middle; }
table.bars td.bar-cell { width: 50%; }
table.bars .counts { margin-top: 3px; }
table.bars .gauge, table.bars .status-bar { margin: 0; }
.plot-identity { height: 240px; }
.global-search input:not(:placeholder-shown) ~ .kbd { display: none; }
/* The filters of a study stay in view while its table or plots scroll */
.filter-card { position: sticky; top: 56px; z-index: 6; box-shadow: 0 4px 12px -8px rgba(0, 0, 0, .25); }
