/* welldata.app - one stylesheet, no external fonts, no CDN.
   Color roles come from a validated palette: categorical hues for series,
   a fixed status set for state, and neutral surfaces underneath. Dark mode is
   selected, not flipped. */

:root {
  color-scheme: light;

  --page:            #f4f2ee;
  --surface-1:       #fcfcfb;
  --surface-2:       #f7f6f3;
  --surface-sunken:  #efedE8;

  --text-primary:    #14140f;
  --text-secondary:  #52514e;
  --text-muted:      #6b6963;
  --text-invert:     #ffffff;

  --rule:            #e3e0d9;
  --rule-strong:     #cfcbc1;
  --track:           #e9e6df;
  --band:            #d6e2f4;

  --brand:           #1c5cab;
  --brand-fill:      #1c5cab;
  --brand-hover:     #184f95;
  --brand-soft:      #e7f0fc;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  --status-good:     #0ca30c;
  --status-warning:  #b47c00;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;
  --status-unknown:  #6b6963;
  --status-info:     #2a78d6;

  --good-soft:     #e8f6e8;
  --warning-soft:  #fdf3dd;
  --serious-soft:  #fceee7;
  --critical-soft: #fbe9e9;

  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 8px 24px -14px rgba(20, 20, 15, .22);
  --radius: 14px;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:           #121211;
    --surface-1:      #1a1a19;
    --surface-2:      #202020;
    --surface-sunken: #262625;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #96958c;
    --rule:           #333230;
    --rule-strong:    #46443f;
    --track:          #2c2b29;
    --band:           #2b3a4d;
    --brand-fill:     #1c5cab;
    --status-good:     #35c135;
    --status-warning:  #fab219;
    --status-serious:  #ec835a;
    --status-critical: #f06a6a;
    --status-unknown:  #96958c;
    --status-info:     #3987e5;
    --brand:          #3987e5;
    --brand-hover:    #5598e7;
    --brand-soft:     #17263a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --good-soft:     #142b14;
    --warning-soft:  #2f2712;
    --serious-soft:  #2f2119;
    --critical-soft: #301818;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #121211;
  --surface-1:      #1a1a19;
  --surface-2:      #202020;
  --surface-sunken: #262625;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #96958c;
  --rule:           #333230;
  --rule-strong:    #46443f;
  --track:          #2c2b29;
  --band:           #2b3a4d;
  --brand-fill:   #1c5cab;
  --status-good:   #35c135;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #f06a6a;
  --status-unknown:  #96958c;
  --status-info:   #3987e5;
  --brand:          #3987e5;
  --brand-hover:    #5598e7;
  --brand-soft:     #17263a;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --good-soft:     #142b14;
  --warning-soft:  #2f2712;
  --serious-soft:  #2f2119;
  --critical-soft: #301818;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2;
  letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.65rem, 1.2rem + 1.7vw, 2.35rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.06rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
small { font-size: .82rem; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- layout ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--surface-1);
  border-right: 1px solid var(--rule); padding: 20px 14px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display);
  font-size: 1.16rem; font-weight: 600; color: var(--text-primary); text-decoration: none;
  padding: 4px 8px 16px; letter-spacing: -.015em; }
.brand-mark { width: 22px; height: 22px; flex: 0 0 22px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-secondary); text-decoration: none; font-size: .93rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text-primary); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.nav-group { margin-top: 18px; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-muted); padding: 0 10px 6px; font-weight: 600; }

.main { flex: 1 1 auto; min-width: 0; }
.topbar {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: var(--surface-1); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 30;
}
.container { max-width: 1120px; margin: 0 auto; padding: 30px 26px 72px; }
.container.narrow { max-width: 760px; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .container { padding: 20px 16px 60px; }
  .mobile-nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px;
    background: var(--surface-1); border-bottom: 1px solid var(--rule);
    position: sticky; top: 55px; z-index: 25; }
  .mobile-nav a { white-space: nowrap; font-size: .86rem; padding: 6px 11px;
    border-radius: 999px; color: var(--text-secondary); text-decoration: none; }
  .mobile-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
}
@media (min-width: 900.02px) { .mobile-nav { display: none; } }

/* ---------- page header ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin-bottom: 22px; }
.page-head p.lede { color: var(--text-secondary); max-width: 62ch; margin: 0; }
.eyebrow { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }

/* ---------- cards ---------- */

.card {
  background: var(--surface-1); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--text-muted); font-size: .85rem; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.grid.multiples { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

/* ---------- small multiples ---------- */

.multiple {
  display: block; text-decoration: none; color: inherit; padding: 11px 12px 9px;
  border: 1px solid var(--rule); border-radius: 11px; background: var(--surface-2);
  transition: border-color .12s ease;
}
.multiple:hover { border-color: var(--rule-strong); color: inherit; }
.multiple-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; }
.multiple-label { font-size: .8rem; color: var(--text-secondary); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multiple-label .dot { margin-right: 6px; vertical-align: baseline; }
.multiple-value { font-size: 1.02rem; font-weight: 700; white-space: nowrap; }
.multiple-foot { display: flex; justify-content: space-between; gap: 8px;
  font-size: .72rem; color: var(--text-muted); margin-top: 7px; }
.multiple-foot span:last-child { text-align: right; }
svg.mini { display: block; border-radius: 5px; overflow: hidden; }

/* ---------- stat tiles ---------- */

.tile {
  background: var(--surface-1); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 15px 16px 13px; text-decoration: none; color: inherit; display: block;
  transition: border-color .12s ease, transform .12s ease;
}
.tile:hover { border-color: var(--rule-strong); transform: translateY(-1px); color: inherit; }
.tile-label { font-size: .8rem; color: var(--text-secondary); display: flex;
  align-items: center; gap: 6px; margin-bottom: 7px; }
.tile-value { font-size: 1.72rem; font-family: var(--font-display); line-height: 1.05;
  display: flex; align-items: baseline; gap: 5px; }
.tile-unit { font-size: .8rem; color: var(--text-muted); font-family: var(--font-body); }
.tile-foot { display: flex; align-items: center; justify-content: space-between;
  margin-top: 9px; gap: 8px; }
.tile-when { font-size: .74rem; color: var(--text-muted); }

.hero-number { font-family: var(--font-display); font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1; letter-spacing: -.02em; }

/* ---------- status ---------- */

.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; display: inline-block; }
.dot.good { background: var(--status-good); }
.dot.warning { background: var(--status-warning); }
.dot.serious { background: var(--status-serious); }
.dot.critical { background: var(--status-critical); }
.dot.unknown { background: var(--status-unknown); }
.dot.info { background: var(--status-info); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--rule-strong);
  color: var(--text-secondary); background: var(--surface-2); white-space: nowrap;
}
.badge.good { background: var(--good-soft); border-color: transparent; color: var(--status-good); }
.badge.warning { background: var(--warning-soft); border-color: transparent; color: #8a6206; }
.badge.serious { background: var(--serious-soft); border-color: transparent; color: #a2451c; }
.badge.critical { background: var(--critical-soft); border-color: transparent; color: var(--status-critical); }
:root[data-theme="dark"] .badge.warning,
:root[data-theme="dark"] .badge.serious { color: var(--text-primary); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.warning,
  :root:not([data-theme="light"]) .badge.serious { color: var(--text-primary); }
}

/* ---------- buttons and forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: .92rem; font-weight: 600; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--rule-strong); background: var(--surface-1); color: var(--text-primary);
  cursor: pointer; text-decoration: none; transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); color: var(--text-primary); }
.btn.primary { background: var(--brand-fill); border-color: var(--brand-fill); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn.danger { color: var(--status-critical); border-color: var(--status-critical); background: transparent; }
.btn.danger:hover { background: var(--critical-soft); }
.btn.small { font-size: .82rem; padding: 6px 11px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%; font: inherit; font-size: .95rem; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--rule-strong); background: var(--surface-1); color: var(--text-primary);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
input[type="file"] { font-size: .9rem; }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.notice { padding: 11px 14px; border-radius: 10px; background: var(--brand-soft);
  color: var(--text-primary); border: 1px solid transparent; margin-bottom: 18px; font-size: .92rem; }
.notice.error { background: var(--critical-soft); }
.flash { position: sticky; top: 0; z-index: 20; }
.notice.error { border-left: 4px solid var(--status-critical); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); font-weight: 600; white-space: nowrap; }
table.data td.n, table.data th.n { text-align: right; padding-right: 0;
  font-variant-numeric: tabular-nums; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data a { text-decoration: none; font-weight: 600; }
table.data a:hover { text-decoration: underline; }

details.table-view { margin-top: 14px; }
details.table-view summary { cursor: pointer; font-size: .84rem; color: var(--text-secondary);
  font-weight: 600; }
details.table-view[open] summary { margin-bottom: 10px; }

/* ---------- charts ---------- */

.chart-frame { position: relative; margin: 4px 0 2px; }
@media (max-width: 720px) {
  .chart-frame { overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; }
  .chart-frame > svg.chart { min-width: 560px; }
}
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--rule); stroke-width: 1; }
.ch-axis-line { stroke: var(--rule-strong); stroke-width: 1; }
.ch-axis { fill: var(--text-muted); font-size: 11px; font-family: var(--font-body);
  font-variant-numeric: tabular-nums; }
.ch-band-label { fill: var(--text-muted); font-size: 10.5px; font-family: var(--font-body); }
.ch-value-label { fill: var(--text-primary); font-size: 12.5px; font-weight: 700;
  font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.ch-event { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .7; }
.ch-event-flag { fill: var(--text-muted); opacity: .85; cursor: help; }
.ch-crosshair { stroke: var(--rule-strong); stroke-width: 1; }
.ch-capture { cursor: crosshair; }
svg.spark { display: block; overflow: visible; }
svg.meter { display: block; }
svg.dbar, svg.segbar { display: block; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 20; min-width: 108px;
  background: var(--surface-1); border: 1px solid var(--rule-strong); border-radius: 9px;
  padding: 8px 11px; box-shadow: var(--shadow); font-size: .82rem; opacity: 0;
  transform: translate(-50%, -118%); transition: opacity .09s ease;
}
.tooltip .tt-date { color: var(--text-muted); font-size: .74rem; }
.tooltip .tt-value { font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }
.tooltip .tt-note { color: var(--text-secondary); margin-top: 3px; max-width: 210px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem;
  color: var(--text-secondary); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.band { height: 10px; width: 14px; background: var(--band); border-radius: 3px; }
.legend i.evt { height: 12px; width: 0; border-left: 2px dashed var(--text-muted); }

/* ---------- flags and insights ---------- */

.flag { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.flag:last-child { border-bottom: none; }
.flag-bar { width: 3px; border-radius: 3px; flex: 0 0 3px; background: var(--status-unknown); }
.flag.good .flag-bar { background: var(--status-good); }
.flag.warning .flag-bar { background: var(--status-warning); }
.flag.serious .flag-bar { background: var(--status-serious); }
.flag.critical .flag-bar { background: var(--status-critical); }
.flag h3 { margin: 0 0 3px; font-family: var(--font-body); font-size: .97rem; font-weight: 700; }
.flag p { margin: 0 0 3px; font-size: .89rem; color: var(--text-secondary); }
.flag .basis { font-size: .76rem; color: var(--text-muted); }
.flag .action { font-size: .86rem; color: var(--text-primary); font-weight: 600; }

.verdict {
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px;
  border: 1px solid var(--rule); background: var(--surface-1);
  border-left: 5px solid var(--status-unknown);
}
.verdict.urgent { border-left-color: var(--status-critical); background: var(--critical-soft); }
.verdict.soon { border-left-color: var(--status-serious); background: var(--serious-soft); }
.verdict.routine { border-left-color: var(--status-warning); background: var(--warning-soft); }
.verdict.clear { border-left-color: var(--status-good); background: var(--good-soft); }
.verdict h2 { margin: 0 0 6px; }
.verdict p { margin: 0 0 8px; color: var(--text-secondary); }
.verdict ul { margin: 6px 0 0; padding-left: 18px; font-size: .89rem; color: var(--text-secondary); }

.screen-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0;
  border-bottom: 1px solid var(--rule); }
.screen-row:last-child { border-bottom: none; }
.screen-main { flex: 1 1 auto; min-width: 0; }
.screen-main h3 { margin: 0 0 2px; font-family: var(--font-body); font-size: .97rem; font-weight: 700; }
.screen-main p { margin: 0; font-size: .85rem; color: var(--text-secondary); }
.screen-main .why { font-size: .77rem; color: var(--text-muted); margin-top: 3px; }
.screen-side { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px; }

/* ---------- timeline ---------- */

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: var(--rule); }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 6px; width: 11px;
  height: 11px; border-radius: 50%; background: var(--series-1);
  border: 2px solid var(--surface-1); }
.tl-item.medication::before { background: var(--series-1); }
.tl-item.lifestyle::before { background: var(--series-3); }
.tl-item.diet::before { background: var(--series-4); }
.tl-item.procedure::before { background: var(--series-7); }
.tl-item.illness::before { background: var(--series-8); }
.tl-item.stress::before { background: var(--series-5); }
.tl-item.other::before { background: var(--text-muted); }
.tl-date { font-size: .76rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tl-item h3 { margin: 1px 0 3px; font-family: var(--font-body); font-size: .97rem; font-weight: 700; }
.tl-item h3 a { color: inherit; text-decoration: none; }
.tl-item h3 a:hover { color: var(--brand); }
.tl-item p { margin: 0; font-size: .87rem; color: var(--text-secondary); }

/* ---------- misc ---------- */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--surface-1);
  color: var(--text-primary); padding: 10px 16px; border: 1px solid var(--rule-strong);
  border-radius: 0 0 10px 0; font-weight: 600; }
.skip-link:focus { left: 0; }

.empty { color: var(--text-muted); font-size: .92rem; padding: 18px 0; }
.prose { max-width: 68ch; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: .4em; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.tag { display: inline-block; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 18px;
  font-size: .92rem; }
.kv dt { color: var(--text-muted); font-size: .82rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.prose p, table.data td, .flag p, .tl-item p { overflow-wrap: anywhere; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--rule); margin-bottom: 20px;
  overflow-x: auto; }
.tabs a { padding: 9px 14px; font-size: .9rem; font-weight: 600; color: var(--text-secondary);
  text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

.pillbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.pillbar a { font-size: .82rem; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--rule-strong); color: var(--text-secondary); text-decoration: none; }
.pillbar a.active { background: var(--brand-fill); border-color: var(--brand-fill); color: #fff; }

.print-only { display: none; }
.footer { border-top: 1px solid var(--rule); margin-top: 40px; padding: 22px 0 0;
  color: var(--text-muted); font-size: .84rem; display: flex; flex-wrap: wrap;
  gap: 8px 18px; justify-content: space-between; }
.footer a { color: var(--text-secondary); }

.theme-toggle { background: none; border: 1px solid var(--rule-strong); border-radius: 8px;
  padding: 5px 9px; cursor: pointer; color: var(--text-secondary); font: inherit;
  font-size: .8rem; }
.theme-toggle:hover { background: var(--surface-2); }

/* ---------- landing ---------- */

.marketing { max-width: 1080px; margin: 0 auto; padding: 0 24px 80px; }
.mast { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 0 40px; }
.hero { padding: 30px 0 46px; max-width: 40ch; }
.hero h1 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.5rem); letter-spacing: -.025em;
  margin-bottom: .35em; }
.hero p { font-size: 1.1rem; color: var(--text-secondary); max-width: 52ch; }
.hero-wrap { display: grid; gap: 30px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center; }
@media (max-width: 860px) { .hero-wrap { grid-template-columns: 1fr; } .hero { max-width: none; } }
.feature { padding: 22px; }
.feature h3 { margin-bottom: .3em; }
.feature p { color: var(--text-secondary); font-size: .93rem; margin: 0; }
.feature-icon { display: block; width: 26px; height: 26px; margin-bottom: 12px;
  color: var(--brand); }
.section-title { margin: 54px 0 20px; }

/* ---------- print (physician summary) ---------- */

@media print {
  /* Beat both dark scopes: the OS-preference block and the explicit toggle.
     Each of those is (0,2,0), so the print list has to match that weight. */
  :root,
  :root:not([data-theme="light"]),
  :root[data-theme="dark"],
  :root[data-theme="light"] {
          color-scheme: light;
          --page: #fff; --surface-1: #fff; --surface-2: #fff; --surface-sunken: #fff;
          --shadow: none; --text-primary: #000; --text-secondary: #333; --text-muted: #555;
          --rule: #ccc; --rule-strong: #999; --band: #e8e8e8; --track: #eee;
          --good-soft: #fff; --warning-soft: #fff; --serious-soft: #fff;
          --critical-soft: #fff; --brand-soft: #fff;
          --status-good: #1a7a1a; --status-warning: #8a6206; --status-serious: #a2451c;
          --status-critical: #a01c1c; --status-unknown: #555; }
  .sidebar, .topbar, .mobile-nav, .no-print, .footer, .theme-toggle { display: none !important; }
  .container { max-width: none; padding: 0; }
  .print-only { display: block; }
  .card { border: none; padding: 0 0 12px; box-shadow: none; page-break-inside: auto; }
  .table-wrap { overflow: visible; }
  table.data tr, .screen-row, .flag { page-break-inside: avoid; }
  table.data th { color: #000; }
  .badge { border: 1px solid #999; background: #fff; color: #000; }
  .verdict { border: 1px solid #999; background: #fff; }
  .card + .card { margin-top: 14px; }
  table.data { font-size: 10.5pt; }
  body { font-size: 11pt; background: #fff; }
  a { color: #000; text-decoration: none; }
  .page-break { page-break-before: always; }
}
