/* VascaTest by VasCalyx. The brand red (#C8102E) and the logo artwork come from the VasCalyx launch pack (4 Dec 2026,
   static/brand, built by mhs/dev/brand/build_brand.py); the working colours and typefaces follow glycocalyx.com (its
   --ink, --paper, --red, --deep, --gold tokens; Archivo for headings, Figtree for text). Fonts are served from here: the site calls no third party. */
@font-face { font-family: "Archivo"; src: url("/static/fonts/Archivo.woff2") format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/static/fonts/Figtree.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #171211; --ink-soft: #3A3130; --muted: #6E6462; --line: #E4DCDA; --panel: #F3EFEE; --paper: #FBF9F8;
  --white: #fff; --red: #C8102E; --red-hi: #E03A3A; --red-wash: #FBEBED; --crimson: #96110E; --deep: #0E4E5A;
  --deep-wash: #E8F1F2; --gold: #C9A227; --brand: #C8102E;
  --f-d: "Archivo", "Helvetica Neue", system-ui, sans-serif; --f-b: "Figtree", "Helvetica Neue", system-ui, sans-serif;
  --radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--f-b); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--f-d); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 30px; font-weight: 800; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 700; line-height: 1.25; }
.h1-small { font-size: 24px; }
p { margin: 0; }
a { color: var(--deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--crimson); }
:focus-visible { outline: 2px solid var(--deep); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.soft { color: var(--muted); font-weight: 400; }
.nowrap { white-space: nowrap; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 9px 24px; background: var(--white); border-bottom: 3px solid var(--brand); }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; flex: none; }
.brand-logo { display: block; width: 87px; height: 50px; }
.brand-rule { width: 1px; height: 30px; background: var(--line); }
.brand-product { display: block; width: 130px; height: 22px; }
.brand:hover .brand-product { opacity: 0.86; }
.search { flex: 1; display: flex; max-width: 520px; margin: 0 auto; }
.search input { flex: 1; min-width: 0; font: inherit; line-height: 22px;   /* a whole-pixel header height keeps the mark beside it on whole pixels, so it stays sharp */ padding: 8px 14px; border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; background: var(--paper); color: var(--ink); }
.search input:focus { outline: none; border-color: var(--deep); background: var(--white); }
.search button { font: 600 14px var(--f-b); padding: 8px 16px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); border-radius: 0 999px 999px 0; cursor: pointer; }
.search button:hover { background: var(--ink-soft); }
.who { display: flex; align-items: center; gap: 14px; flex: none; font-size: 14px; }
.who-name { color: var(--ink-soft); font-weight: 600; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--deep); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
button.link:hover { color: var(--crimson); }

.wrap { max-width: 1480px; margin: 0 auto; padding: 22px 24px 60px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.head { margin: 4px 0 18px; }
.sub { color: var(--muted); margin-top: 6px; max-width: 80ch; }
.eyebrow { font: 600 11.5px/1.2 var(--f-b); letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: block; }
.meta { color: var(--muted); font-size: 13.5px; }
.pad { padding: 4px 0 2px; }
.tag { display: inline-block; font: 600 11px/1 var(--f-b); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--panel); border-radius: 999px; padding: 4px 8px; vertical-align: middle; }

/* cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card.empty { color: var(--muted); text-align: center; padding: 44px 22px; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; margin-bottom: 14px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font: 700 17px/1.2 var(--f-d); font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; }
.two .card { margin-bottom: 18px; }

/* buttons */
.button, .primary { display: inline-block; font: 600 14px/1 var(--f-b); padding: 11px 18px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { background: var(--ink-soft); color: var(--white); }
.button.ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.button.ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--white); }
.button.is-busy, .button.is-busy:hover { opacity: .55; cursor: progress; }
.primary { background: var(--red); border-color: var(--red); font-size: 15px; padding: 13px 22px; }
.primary:hover { background: var(--crimson); border-color: var(--crimson); color: var(--white); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.actions--left { margin-top: 16px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font: 600 12px/1.3 var(--f-b); color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: bottom; }
td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--panel); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.list tbody tr:hover { background: var(--paper); }
.row-link { font-weight: 600; color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--crimson); text-decoration: underline; }
.muted-row td { color: var(--muted); }
.muted-row .row-link { color: var(--ink-soft); }
.filter input { font: inherit; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); width: 240px; max-width: 100%; }
.filter input:focus { outline: none; border-color: var(--deep); background: var(--white); }
details.more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.card > details.more:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); padding: 4px 0; }
details.more[open] summary { margin-bottom: 8px; }

/* the visit grid */
.grid-table { font-size: 13px; }
.grid-table th, .grid-table td { padding: 8px 7px; }
.grid-table thead tr:last-child th { white-space: normal; line-height: 1.2; }
.grid-table td:first-child, .grid-table th:first-child { padding-left: 10px; white-space: nowrap; }
.grid-table td.num { white-space: nowrap; }
.grid-table .groups th { text-align: center; color: var(--ink); font: 700 12px/1.2 var(--f-d); border-bottom: 0; padding-bottom: 2px; border-left: 1px solid var(--line); }
.grid-table .groups th:first-child { border-left: 0; text-align: left; }
.grid-table .sep { border-left: 1px solid var(--line); }
.grid-table tbody tr:hover { background: var(--paper); }
.grid-table tr.on { background: var(--red-wash); }
.grid-table tr.on:hover { background: var(--red-wash); }
.grid-table tr.on td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.strong { font-weight: 700; }

/* patient header */
.patient { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 28px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 34px; margin: 14px 0 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 1px 0 0; font-weight: 600; }
.facts--stack { flex-direction: column; gap: 9px; }
.facts--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 24px; }
.same { margin-top: 12px; }
.remarks { margin-top: 16px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.remarks p { overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.pill { font-size: 13px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-soft); }
.pill:hover { border-color: var(--ink); color: var(--ink); }
.pill--on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pill--on:hover { color: var(--white); }

/* the selected visit's measures: a card each, a straight scale with a marker in it */
.gauges { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.gauge-card { margin: 0; padding: 12px 8px 12px; border: 1px solid var(--line); border-radius: 12px; text-align: center; background: var(--white); }
.gauge-card--key { border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
.gauge-card figcaption { font: 600 12.5px/1.25 var(--f-b); color: var(--ink-soft); margin-top: 2px; min-height: 2.5em; text-wrap: balance; }
.rail { display: block; width: 100%; max-width: 230px; margin: 0 auto; }
.rail-value { font: 800 27px var(--f-d); fill: var(--ink); font-variant-numeric: tabular-nums; }
.rail-num { font: 500 9px var(--f-b); fill: var(--muted); }
.rail-tick { stroke: #b9afac; stroke-width: 1; }
.rail-marker { fill: var(--ink); stroke: #fff; stroke-width: 2.5; }
.rail-off { fill: #e9e3e1; }
.rail--off .rail-value, .rail--off .rail-num { fill: #b9afac; }

/* charts */
.chart-wrap { overflow-x: auto; }
.bars { display: block; width: 100%; min-width: 640px; max-width: 1080px; height: auto; margin: 0 auto; }
.grid { stroke: var(--line); stroke-width: 1; }
.grid--base { stroke: var(--ink-soft); }
.axis-num { font: 500 11px var(--f-b); fill: var(--muted); font-variant-numeric: tabular-nums; }
.axis-cat { font: 500 11px var(--f-b); fill: var(--ink-soft); }
.axis-title { font: 500 11.5px var(--f-b); fill: var(--muted); }
.bar-num { font: 600 10.5px var(--f-b); fill: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bar-num--zero { fill: #b9afac; font-weight: 500; }
.bars--density .bar { fill: var(--deep); }
.bars--pbr .bar { fill: var(--gold); }
.bar:hover { opacity: 0.82; }

.trends { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.trend-card { margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 6px; }
.trend-card figcaption { font: 700 13.5px/1.2 var(--f-d); margin-bottom: 6px; }
.trend { display: block; width: 100%; height: auto; }
.trend-band { opacity: 1; }
.trend-grid { stroke: var(--line); stroke-width: 1; opacity: 1; }
.trend-line { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; opacity: 0.55; }
.trend-dot { fill: #8c8280; stroke: #fff; stroke-width: 1.5; }
.trend-dot--on { fill: var(--ink); stroke: #fff; stroke-width: 2.5; }
a:hover .trend-dot { fill: var(--crimson); }
.trend-val { font: 600 11px var(--f-b); fill: var(--ink); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 3px; }
.trend-val--on { font-weight: 800; font-size: 12.5px; }
.trend-empty { font: 500 12px var(--f-b); fill: var(--ink-soft); }

/* sign-in and messages */
body.plain { background: var(--panel); }
.letterhead { display: flex; justify-content: center; padding: 7vh 24px 0; }
.letterhead img { display: block; width: 160px; height: 92px; }
.door { max-width: 440px; margin: 9vh auto 0; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 34px 34px 30px; position: relative; overflow: hidden; }
.door::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand); }
.letterhead + .wrap .door { margin-top: 26px; }
.door-product { display: block; width: 166px; height: 28px; margin-bottom: 20px; }
.door h1 { font-size: 26px; }
.lede { margin-top: 10px; color: var(--ink-soft); font-size: 16px; }
.door-form { display: grid; gap: 8px; margin-top: 22px; }
.door-form label { font-weight: 600; font-size: 13.5px; }
.door-form input[type=email] { font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.door-form input[type=email]:focus { outline: none; border-color: var(--deep); background: var(--white); }
.door-form .primary { margin-top: 8px; justify-self: start; }
.door p + p, .door .fine { margin-top: 18px; }
.fine { color: var(--muted); font-size: 13.5px; }

@media (max-width: 1180px) { .gauges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px 14px; }
  .brand { gap: 11px; }
  .brand-logo { width: 70px; height: 40px; }
  .brand-rule { height: 24px; }
  .brand-product { width: 107px; height: 18px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .who { margin-left: auto; }
  .wrap { padding: 16px 16px 48px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .two { grid-template-columns: 1fr; gap: 0; }
  h1 { font-size: 25px; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .door { margin-top: 5vh; padding: 26px 22px 24px; }
  .letterhead { padding-top: 4vh; }
  .letterhead img { width: 128px; height: 74px; }
}
@media print {
  .top, .actions, .crumbs, .pills { display: none; }
  body { background: #fff; }
  .card { break-inside: avoid; border-color: #ccc; }
}

/* connect Claude */
.who-link { color: var(--deep); white-space: nowrap; }
/* Acquisition is where most people are going: the one red button in the header. 38px tall, inside the 40px of the search box, so the header keeps its whole-pixel height. */
.acq-go { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px 0 13px; margin-right: 4px; border-radius: 999px; background: var(--red); color: var(--white); font: 700 14.5px/1 var(--f-b); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap; box-shadow: 0 1px 2px rgba(150, 17, 14, 0.28); transition: background 0.12s; }
.acq-go svg { width: 18px; height: 18px; flex: none; }
.acq-go:hover { background: var(--crimson); color: var(--white); }
.acq-go:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0 4px; white-space: pre-wrap; word-break: break-all; user-select: all; }
.token-new { border-color: var(--red); }
.steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 10px; }
.connect.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.inline-form input[type=text] { flex: 1; min-width: 180px; font: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.inline-form input[type=text]:focus { outline: none; border-color: var(--deep); background: var(--white); }
@media (max-width: 760px) { .connect.two { grid-template-columns: minmax(0, 1fr); } }

/* Stations */
.light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #b9afac; vertical-align: baseline; margin-right: 4px; }
.light--ok { background: #1f9d6b; }
.light--wait { background: #d99a1c; }
.light--bad { background: var(--red); }
.light--done { background: var(--deep); }
.station-now { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 17px; }
.bar-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; }
progress.bar { flex: 1; height: 12px; border: 0; border-radius: 999px; background: var(--panel); overflow: hidden; appearance: none; -webkit-appearance: none; }
progress.bar::-webkit-progress-bar { background: var(--panel); border-radius: 999px; }
progress.bar::-webkit-progress-value { background: var(--deep); border-radius: 999px; }
progress.bar::-moz-progress-bar { background: var(--deep); border-radius: 999px; }
progress.bar--small { width: 90px; flex: none; height: 8px; vertical-align: middle; }
.bar-text { font: 700 15px var(--f-d); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.phases { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 6px 0 4px; counter-reset: ph; }
.phases li { font-size: 13px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.phases li.on { background: var(--ink); border-color: var(--ink); color: var(--white); font-weight: 600; }
.warn-card { border-color: #d99a1c; background: #fff9ec; }
.warn-line { color: var(--crimson); font-weight: 600; margin: 10px 0; }
.cell-problem { display: inline-block; max-width: 24em; white-space: normal; color: var(--crimson); font-size: .86em; line-height: 1.35; }
.ok-line { color: #17694a; font-weight: 600; margin: 10px 0; }
.stack-form { display: grid; gap: 6px; max-width: 520px; }
.stack-form label { font-size: 13px; font-weight: 600; margin-top: 8px; }
.stack-form input, .stack-form select, .door-form input, .inline-form input { font: inherit; padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.door-form { display: grid; gap: 10px; max-width: 340px; margin-top: 18px; }
.door-form label { font-size: 13px; font-weight: 600; }
.door-form input { font: 700 20px var(--f-d); letter-spacing: 0.08em; text-transform: uppercase; }
.door--wide { max-width: 720px; }
.steps--big li { margin: 0 0 16px; }
.steps--big .primary { margin-top: 8px; }
.station-two { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.log { max-height: 640px; overflow-y: auto; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.log-line { display: grid; grid-template-columns: 118px 110px minmax(0, 1fr); gap: 10px; padding: 4px 10px; border-bottom: 1px solid var(--panel); }
.log-line--warn { background: #fff6e0; }
.log-line--error { background: var(--red-wash); }
.log-time, .log-who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-msg { overflow-wrap: anywhere; white-space: pre-wrap; }
.gap { margin-top: 22px; margin-bottom: 8px; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
@media (max-width: 900px) { .station-two { grid-template-columns: minmax(0, 1fr); } .log-line { grid-template-columns: 1fr; gap: 0; } }

/* acquisition and recalculation */
.acq-open { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; }
.acq-open .acq-note { grid-column: 1 / -1; }
.acq-open code, .sub code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel); border-radius: 6px; padding: 1px 5px; }
.cell-form { display: inline; margin: 0; }
button[disabled] { opacity: 0.45; cursor: default; }
.cmp td, .cmp th { padding-right: 16px; }
.cmp .sep { border-left: 1px solid var(--line); padding-left: 16px; }
.cmp th .soft { font-weight: 400; }
.delta { color: var(--crimson); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-foot td { color: var(--ink-soft); font-size: 13px; border-top: 1px solid var(--line); }
.set-form { max-width: none; }
.set-form > label, .set-form > input { max-width: 520px; }
.set-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; margin: 14px 0 0; }
.set-group legend { font: 700 14px var(--f-d); padding: 0 6px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 20px; }
.set-field { display: grid; gap: 4px; align-content: start; }
.set-field label { margin-top: 0; }
@media (max-width: 700px) { .acq-open { grid-template-columns: 1fr; } }

/* users, comments and reviews */
.count { display: inline-block; min-width: 18px; padding: 2px 6px; border-radius: 999px; background: var(--red); color: var(--white); font: 700 11.5px/1.2 var(--f-b); text-align: center; vertical-align: 1px; }
.tag--red { background: var(--red-wash); color: var(--crimson); }
.tag--deep { background: var(--deep-wash); color: var(--deep); }
.tag--gold { background: #f8f0d2; color: #6f5708; }
.stack-form textarea { font: inherit; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); resize: vertical; min-height: 76px; }
.stack-form textarea:focus, .stack-form input:focus, .stack-form select:focus { outline: none; border-color: var(--deep); background: var(--white); }
.note-form { max-width: 760px; margin-top: 14px; }
.check { display: flex; gap: 8px; align-items: baseline; font-size: 14px; font-weight: 400; margin-top: 6px; }
.stack-form .check { font-weight: 400; font-size: 14px; }
.stack-form .check input { padding: 0; flex: none; }
.checks { border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px 14px; margin: 12px 0 2px; }
.checks legend { font: 700 13px var(--f-b); padding: 0 6px; }
.thread { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; max-width: 900px; }
.note { border: 1px solid var(--line); border-radius: 12px; padding: 11px 15px 12px; background: var(--paper); }
.note--review { border-color: var(--deep); background: var(--deep-wash); }
.note--private { border-style: dashed; border-color: var(--gold); background: #fffbee; }
.note-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 4px; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-box { border: 1px solid var(--red); background: var(--red-wash); border-radius: 12px; padding: 14px 16px 16px; margin: 0 0 16px; max-width: 900px; display: grid; gap: 8px; justify-items: start; }
.review-box .note-form { margin-top: 0; width: 100%; }
.review-box--answer { margin: 14px 0 0; }
/* the header has more links for an admin: let it fold onto a second line instead of running off the screen */
.top { flex-wrap: wrap; row-gap: 8px; }
.search { flex: 1 1 240px; }
.who { flex: 0 1 auto; flex-wrap: wrap; row-gap: 4px; margin-left: auto; }
a.flag { color: var(--crimson); font-weight: 600; }

/* recordings: the player on a scan's page */
.watch { display: grid; grid-template-columns: minmax(0, auto) minmax(300px, 1fr); gap: 20px 26px; align-items: start; }
.player { min-width: 0; max-width: 760px; }
.player-screen { position: relative; background: #0d0b0b; border-radius: 12px; overflow: hidden; line-height: 0; }
.player-canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; }      /* never enlarged: one picture dot per screen dot where it fits */
.player-canvas:focus-visible { outline-offset: -3px; border-radius: 12px; }
.player-wait { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; padding: 20px; text-align: center; color: #e9e3e1; font-size: 15px; line-height: 1.4; background: rgba(13, 11, 11, 0.72); }
.player-wait[hidden] { display: none; }
.player-wait progress { width: min(260px, 70%); height: 8px; accent-color: var(--red); }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.player-bar .button { padding: 9px 14px; font-size: 13.5px; }
.player-bar .button[data-play] { min-width: 76px; text-align: center; }
.player-scrub { flex: 1 1 160px; min-width: 120px; accent-color: var(--red); }
.player-count { font: 600 13px/1 var(--f-b); font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; min-width: 9.5em; }
.player-bar select { font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink); }
.player-what { margin-top: 12px; display: grid; gap: 2px; }
.player-title { font: 700 16px/1.3 var(--f-d); }
.player-what .button { justify-self: start; margin-top: 8px; padding: 9px 14px; font-size: 13.5px; }
/* the lines the calculation found, drawn over the picture: the switch, and the key to the colours (video.js reads the colours from here) */
.player-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); cursor: pointer; white-space: nowrap; }
.player-switch input { accent-color: var(--red); margin: 0; }
.player-switch:has(input:disabled) { color: var(--ink-soft); cursor: default; }
.player-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 8px 0 0; padding: 8px 12px; background: #0d0b0b; color: #e9e3e1; border-radius: 10px; font-size: 13px; line-height: 1.3; justify-self: start; }
.player-legend li { display: inline-flex; align-items: center; gap: 7px; margin-right: 6px; }
.player-legend--off { opacity: 0.55; }
.key { display: inline-block; width: 22px; height: 0; border-top: 3px solid currentColor; }
.key--vessel { color: #ffd23f; }
.key--ok { color: #3ee07a; }
.key--no { color: #ff6b81; border-top-style: dashed; }
.key--plain { color: #6ecbff; }
.rec-side { min-width: 0; }
.rec-list { max-height: 590px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; background: var(--paper); }
.rec-head { font: 700 13px/1.2 var(--f-d); margin: 10px 0 2px; }
.rec-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 4px 10px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rec-row:last-child { border-bottom: 0; }
.rec-period { font-size: 13px; font-weight: 600; color: var(--ink-soft); padding-top: 5px; }
.rec-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.rec { font: 600 12.5px/1 var(--f-b); font-variant-numeric: tabular-nums; min-width: 32px; padding: 7px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); cursor: pointer; }
.rec:hover:not([disabled]) { border-color: var(--ink); }
.rec--seen { background: var(--panel); color: var(--ink-soft); }
.rec--on, .rec--on:hover { background: var(--ink); border-color: var(--ink); color: var(--white); }
.rec-note { margin-top: 10px; }
@media (max-width: 1180px) { .watch { grid-template-columns: minmax(0, 1fr); } .rec-list { max-height: 360px; } }
.player [hidden] { display: none !important; }

/* the front screen: tests on the left, the two panels (updates, supplements) in a rail on the right.
   The rail takes its column only while a panel is open; with both closed they are two small bars above the list. */
.home { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 22px; align-items: start; }
.home-main { min-width: 0; }
/* The Updates and ReVasca column ("home-side"; not "rail", which is the straight scale's class since 28 November and
   capped this column at 230 pixels). Laptop and wider: a column beside the tests that grows with the screen. Narrower:
   the panels sit above the tests, side by side, and share the width. Phone: still above the tests, a closed panel
   takes half a row and an open one the whole row. Open or closed is remembered on each device (home.js). */
.home-side { order: -1; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 0 12px; min-width: 0; }
.home-side .panel { flex: 0 1 auto; }
.home-side .panel[open] { flex: 1 1 320px; }
@media (min-width: 1180px) {
  .home:has(.home-side .panel[open]) { grid-template-columns: minmax(0, 1fr) clamp(340px, 27vw, 440px); }
  .home:has(.home-side .panel[open]) .home-side { order: 0; flex-direction: column; flex-wrap: nowrap; align-items: stretch; margin-top: 4px; }
  .home:has(.home-side .panel[open]) .home-side .panel { flex: none; }
  /* both closed: the two bars sit on the heading's own line, at its right end, and take no height of their own */
  .home:not(:has(.home-side .panel[open])) .home-side { height: 0; position: relative; z-index: 1; }
  .home:not(:has(.home-side .panel[open])) .home-side .panel { margin-top: 6px; }
  .home:not(:has(.home-side .panel[open])) .home-head { padding-right: 500px; min-height: 60px; }
}
.home-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 32px; }
.home-stats dd { white-space: nowrap; }
.home-stats .soft { font: 500 13px var(--f-b); }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; min-width: 0; }
.panel > summary { display: flex; align-items: center; gap: 9px; padding: 11px 14px 11px 16px; cursor: pointer; list-style: none; border-radius: var(--radius); user-select: none; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary:hover .panel-title { color: var(--crimson); }
.panel-title { font: 700 16px/1.2 var(--f-d); letter-spacing: -0.01em; }
.panel-sub { font-size: 12.5px; color: var(--muted); }
.panel-new { font: 700 11.5px/1 var(--f-b); padding: 4px 8px; border-radius: 999px; background: var(--deep-wash); color: var(--deep); white-space: nowrap; }   /* not the red count: that one means somebody is waiting */
.panel-fold { margin-left: auto; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--panel); position: relative; }
.panel-fold::before { content: ""; position: absolute; left: 9px; top: 7px; width: 7px; height: 7px; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); }
.panel[open] > summary .panel-fold::before { top: 11px; transform: rotate(-135deg); }
.panel[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.panel-body { padding: 12px 16px 16px; }
.panel h3 { font: 700 14.5px/1.3 var(--f-d); margin: 0; letter-spacing: -0.005em; text-wrap: balance; }
.panel-more { margin-top: 12px; font-size: 13.5px; font-weight: 600; }

.feed { list-style: none; margin: 8px 0 0; padding: 0; }
.feed-item { padding: 11px 0 12px; border-top: 1px solid var(--panel); }
.feed-item:first-child { border-top: 0; padding-top: 4px; }
.feed-item p { font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); }
.feed-item h3, .feed-item h2 { margin: 3px 0 3px; }
.feed-item .feed-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.feed-item--new .feed-meta::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.panel .feed { max-height: 292px; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.kind { display: inline-block; font: 700 10.5px/1 var(--f-b); letter-spacing: 0.05em; text-transform: uppercase; border-radius: 999px; padding: 4px 7px; background: var(--panel); color: var(--muted); }
.kind--new { background: var(--deep-wash); color: var(--deep); }
.kind--improved { background: #f8f0d2; color: #6f5708; }
.kind--fixed { background: var(--red-wash); color: var(--crimson); }
.feed--page { max-width: 820px; margin-top: 0; }
.feed--page .feed-item { padding: 16px 0 17px; }
.feed--page .feed-item p { font-size: 15px; }
.feed--page .feed-item .feed-meta { font-size: 12.5px; }

.shop-hero { display: block; border-radius: 12px; padding: 14px 16px 0; text-align: center; background: radial-gradient(circle at 50% 38%, #fff 0, #fff 22%, var(--panel) 100%); border: 1px solid var(--line); }
.shop-hero img { display: block; width: 100%; max-width: 236px; height: auto; margin: 0 auto; transition: transform 0.25s ease; }
.shop-hero:hover img { transform: translateY(-2px) scale(1.015); }
.shop-title { margin: 13px 0 5px !important; font-size: 17px !important; font-weight: 800 !important; }
.panel--shop .panel-body > p { font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.shop-actions { margin-top: 12px; gap: 8px; }
.shop-actions .button { padding: 10px 15px; font-size: 13.5px; }
.shop-eyebrow { margin: 18px 0 2px; }
.formulas { list-style: none; margin: 0; padding: 0; }
.formulas a { display: flex; align-items: center; gap: 11px; padding: 7px 0; color: var(--ink-soft); text-decoration: none; font-size: 13px; line-height: 1.3; border-top: 1px solid var(--panel); }
.formulas li:first-child a { border-top: 0; }
.formulas img { flex: none; width: 44px; height: 44px; border-radius: 9px; border: 1px solid var(--line); }
.formulas strong { display: block; font: 700 14px/1.25 var(--f-d); color: var(--ink); }
.formulas a:hover strong { color: var(--crimson); }
.panel--shop .shop-fine { margin-top: 12px; font-size: 11px; line-height: 1.4; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .shop-hero img { transition: none; } }

.filters { padding: 16px 20px 16px; }
.filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.field { display: grid; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > label, .field > legend { font: 600 12px/1.3 var(--f-b); color: var(--muted); padding: 0; }
.field > legend { margin-bottom: 4px; }
.field--wide { flex: 1 1 200px; max-width: 320px; }
.field--go { margin-left: auto; }
.filter-form input, .filter-form select { font: inherit; font-size: 14px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); min-width: 0; }
.filter-form select { max-width: 230px; padding-right: 8px; }
.filter-form input:focus, .filter-form select:focus { outline: none; border-color: var(--deep); background: var(--white); }
.filter-form input[type=number] { width: 72px; }
.filter-form input[type=date] { width: 138px; padding: 0 8px; }
.filter-form .button { height: 38px; padding: 0 20px; }
.range-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.seg-row { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; height: 38px; }
.seg-row label { display: flex; position: relative; cursor: pointer; }
.seg-row input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-row span { display: flex; align-items: center; padding: 0 13px; font-size: 14px; color: var(--ink-soft); border-left: 1px solid var(--line); }
.seg-row label:first-child span { border-left: 0; }
.seg-row input:checked + span { background: var(--ink); color: var(--white); font-weight: 600; }
.seg-row input:focus-visible + span { outline: 2px solid var(--deep); outline-offset: -2px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--panel); }
.chip { font: inherit; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px 7px 12px; border: 1px solid transparent; border-radius: 999px; background: var(--deep-wash); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--deep); }
.chip-label { color: var(--deep); font-weight: 700; }
.chip-x { font-size: 16px; line-height: 0.8; color: var(--deep); }
.chip-clear { font-size: 13px; margin-left: 4px; }

.tests { padding-top: 10px; }
.tests-table td { vertical-align: middle; padding-top: 10px; padding-bottom: 10px; }
.tests-table th { padding-top: 10px; }
.tests-table abbr { text-decoration: none; cursor: help; }
.tests-table .pcode { font-size: 12px; margin-left: 4px; white-space: nowrap; }
.score-head { padding-left: 4px; }
.score { white-space: nowrap; padding-left: 4px; }
.score-num { display: inline-block; min-width: 3.2em; font: 700 15px/1 var(--f-d); font-variant-numeric: tabular-nums; }
.score-bar { display: inline-block; width: 56px; height: 6px; vertical-align: middle; margin-left: 4px; }
.score-track { fill: var(--panel); }
a.quiet { color: var(--ink-soft); text-decoration: none; }
a.quiet:hover { color: var(--crimson); text-decoration: underline; }
.empty-line { color: var(--muted); text-align: center; padding: 40px 12px 34px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--panel); }
.pager-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pager-nav a, .pager-on, .pager-gap { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; text-decoration: none; color: var(--ink-soft); }
.pager-nav a:hover { background: var(--panel); color: var(--ink); }
.pager-on { background: var(--ink); color: var(--white); font-weight: 700; }
.pager-step { border: 1px solid var(--line); font-weight: 600; }
@media (max-width: 860px) {
  .field--go { margin-left: 0; }
  .field--wide { max-width: none; flex-basis: 100%; }
  .filter-form select { max-width: 100%; }
}
.tests .table-wrap { position: relative; }      /* keeps the table's screen-reader-only labels inside its own scrolling box */
/* narrower than a laptop: the panels sit side by side above the list and are kept short */
@media (max-width: 1179px) {
  .home-side { margin-bottom: 4px; }
  .home-side .panel[open] .panel-body { max-height: 244px; overflow-y: auto; }
  .home-side .panel[open] .feed { max-height: none; overflow: visible; margin-right: 0; padding-right: 0; }
  .home-side .panel--shop[open] .shop-hero img { max-width: 200px; }
}
/* phone: still above the list; two closed panels share one row, an open one takes the row and stays short */
@media (max-width: 720px) {
  .home-side { justify-content: stretch; gap: 0 10px; }
  .home-side .panel { flex: 1 1 0; margin-bottom: 10px; }
  .home-side .panel[open] { flex: 1 1 100%; }
  .home-side .panel > summary { padding-left: 13px; padding-right: 10px; }
  .home-side .panel:not([open]) .panel-sub { display: none; }
  .home-side .panel[open] .panel-body { max-height: 210px; }
}
@media print { .home-side, .filters, .pager-nav { display: none; } }

/* recordings, one click from a test: a small play mark before the link */
a.watch { color: var(--deep); font-weight: 600; text-decoration: none; white-space: nowrap; }
a.watch::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: 6px; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor; vertical-align: -1px; }
a.watch:hover { color: var(--crimson); text-decoration: underline; }
.scan-links a { display: block; }
.scan-links a + a { margin-top: 3px; font-size: 13px; }
.row-form { display: inline; margin-left: 14px; }

/* "View as": the bar at the foot of every page while an admin looks at the site as a standard user */
.viewing { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 22px; padding: 10px 24px; background: var(--deep); color: var(--white); box-shadow: 0 -6px 24px rgba(23, 18, 17, 0.18); }
.viewing p { font-size: 14px; line-height: 1.4; }
.viewing-tag { display: inline-block; font: 700 11px/1 var(--f-b); letter-spacing: 0.06em; text-transform: uppercase; background: var(--white); color: var(--deep); border-radius: 999px; padding: 5px 9px; margin-right: 6px; vertical-align: 1px; }
.viewing-who { opacity: 0.8; margin-left: 4px; }
.viewing-note { opacity: 0.8; margin-left: 14px; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
.viewing .button { background: var(--white); color: var(--deep); border-color: var(--white); }
.viewing .button:hover { background: var(--deep-wash); }
body.is-viewing { padding-bottom: 74px; }
@media (max-width: 1100px) { body.is-viewing { padding-bottom: 116px; } }   /* the bar wraps onto two lines */
@media (max-width: 720px) {
  .viewing { padding: 10px 16px; justify-content: flex-start; }
  .viewing-note { display: block; margin: 2px 0 0; padding: 0; border: 0; }
  body.is-viewing { padding-bottom: 130px; }
}
@media print { .viewing { display: none; } body.is-viewing { padding-bottom: 0; } }

/* a link to a card (#recordings, #comments, #results) stops below the header that stays at the top, not under it */
html { scroll-padding-top: 76px; }
@media (max-width: 1300px) { html { scroll-padding-top: 112px; } }   /* the header wraps onto two lines */
@media (max-width: 720px) { html { scroll-padding-top: 160px; } }

/* the help pages (/help): what Calyx learns from, readable by people too */
.help-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; align-items: start; }
.help-group { margin-bottom: 0; }
.help-group h2 { font: 700 12px/1 var(--f-d); letter-spacing: 0.12em; text-transform: uppercase; color: var(--crimson); margin: 2px 0 12px; }
.help-list { list-style: none; margin: 0; padding: 0; }
.help-list li { padding: 9px 0; border-top: 1px solid var(--line); }
.help-list li:first-child { border-top: 0; padding-top: 0; }
.help-list a { font-weight: 600; }
.help-article { max-width: 78ch; padding: 28px 32px; }
.help-article h1 { margin-bottom: 14px; }
.help-article h2 { font: 700 17px/1.3 var(--f-d); margin: 22px 0 8px; letter-spacing: -0.005em; }
.help-article p { margin: 0 0 12px; line-height: 1.62; color: var(--ink-soft); }
.help-article .help-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

/* AI analysis on the front screen: a question box that stands out from the page, and under it the answers, each
   with its tables. The box is the one dark surface on the site, so it reads as the place to start. */
.ask { margin: 0 0 18px; }
.ask [hidden] { display: none; }
.ask-box { position: relative; overflow: hidden; border-radius: 18px; padding: 22px 24px 18px; color: var(--white);
  background: radial-gradient(120% 140% at 100% 0%, rgba(229, 52, 43, 0.34) 0%, rgba(229, 52, 43, 0) 46%), linear-gradient(135deg, #0E4E5A 0%, #0B3A44 52%, #171211 128%);
  box-shadow: 0 10px 30px -18px rgba(14, 78, 90, 0.7); }
.ask-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; }
.ask-eyebrow { display: flex; align-items: center; gap: 7px; margin: 0 0 5px; font: 700 11.5px/1.2 var(--f-b); letter-spacing: 0.11em; text-transform: uppercase; color: #9FD6DE; }
.ask-spark { width: 15px; height: 15px; fill: #FFC9C5; flex: none; }
.ask-title { font: 800 25px/1.15 var(--f-d); letter-spacing: -0.015em; color: var(--white); text-wrap: balance; }
.ask-new { flex: none; font: 600 13px/1 var(--f-b); padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.34); background: rgba(255, 255, 255, 0.08); color: var(--white); cursor: pointer; white-space: nowrap; }
.ask-new:hover { background: rgba(255, 255, 255, 0.18); }
.ask-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 15px; padding: 7px 7px 7px 18px; border-radius: 16px; background: var(--white); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 8px 22px -12px rgba(0, 0, 0, 0.55); }
.ask-form:focus-within { box-shadow: 0 0 0 3px rgba(159, 214, 222, 0.75), 0 8px 22px -12px rgba(0, 0, 0, 0.55); }
.ask-form textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; color: var(--ink); font: 400 17px/1.45 var(--f-b); padding: 9px 0 8px; height: 42px; max-height: 160px; }
.ask-form textarea::placeholder { color: #8A7F7D; }
.ask-go { flex: none; font: 700 15px/1 var(--f-b); height: 42px; padding: 0 24px; border-radius: 11px; border: 0; background: var(--red); color: var(--white); cursor: pointer; }
.ask-go:hover { background: var(--red-hi); }
.ask-go:disabled { background: #B9AFAC; cursor: default; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.ask-chip { font: 500 13px/1.25 var(--f-b); text-align: left; padding: 8px 13px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.26); background: rgba(255, 255, 255, 0.09); color: var(--white); cursor: pointer; }
.ask-chip:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); }
.ask-foot { margin-top: 13px; font-size: 12.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.74); max-width: 108ch; }
.ask-foot a { color: var(--white); font-weight: 700; white-space: nowrap; }
.ask-mcp { color: rgba(255, 255, 255, 0.92); }
.ask-new:focus-visible, .ask-chip:focus-visible, .ask-go:focus-visible, .ask-foot a:focus-visible { outline: 2px solid #9FD6DE; outline-offset: 2px; }

.ask-thread:empty { display: none; }
.ask-turn { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px 20px; margin-top: 12px; }
.ask-question { margin: 0 0 10px; font: 700 17px/1.3 var(--f-d); letter-spacing: -0.005em; padding-left: 12px; border-left: 3px solid var(--deep); }
.ask-text { max-width: 92ch; }
.ask-text p, .ask-text ul { margin: 0 0 9px; font-size: 15.5px; line-height: 1.55; }
.ask-text ul { padding-left: 20px; }
.ask-text strong { font-weight: 700; }
.ask-text code { font: 13.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel); border-radius: 5px; padding: 1px 5px; }
.ask-answer > :last-child, .ask-text > :last-child { margin-bottom: 0; }
.ask-status { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; color: var(--deep); font-weight: 600; font-size: 14px; }
.ask-dots { width: 26px; height: 8px; flex: none; background: radial-gradient(circle at 4px 4px, var(--deep) 3.2px, transparent 3.6px) 0 0 / 9px 8px repeat-x; animation: ask-dots 1.1s steps(4, end) infinite; }
@keyframes ask-dots { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -12% 0 0); } }
.ask-error { margin: 6px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--red-wash); color: var(--crimson); font-size: 14.5px; }
.ask-table { margin: 12px 0 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ask-table-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.ask-table-head h4 { margin: 0; font: 700 15.5px/1.3 var(--f-d); }
.ask-table-head .meta { margin: 2px 0 0; font-size: 12.5px; }
.ask-export { display: flex; gap: 8px; flex: none; }
.ask-export .button { padding: 9px 14px; font-size: 13px; }
.ask-table-wrap { overflow: auto; max-height: 440px; }
.ask-table table { font-size: 13.5px; }
.ask-table th { position: sticky; top: 0; z-index: 1; background: var(--white); padding: 0; box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
.ask-table td { padding: 8px 14px; white-space: nowrap; }
.ask-table td.ask-long { white-space: normal; min-width: 260px; max-width: 520px; overflow-wrap: anywhere; }
.ask-table td:first-child { padding-left: 16px; }
.ask-sort { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 9px 14px; font: 600 12px/1.3 var(--f-b); color: var(--muted); cursor: pointer; white-space: nowrap; }
.ask-table th:first-child .ask-sort { padding-left: 16px; }
.ask-table th.num .ask-sort { text-align: right; }
.ask-sort:hover, .ask-sort[data-dir] { color: var(--ink); }
.ask-sort[data-dir="up"]::after { content: " \2191"; }
.ask-sort[data-dir="down"]::after { content: " \2193"; }
.ask-sort:focus-visible { outline: 2px solid var(--deep); outline-offset: -2px; }
.ask-score { white-space: nowrap; text-align: right; }
.ask-score .score-num { min-width: 2.6em; font-size: 13.5px; text-align: right; }
.ask-bar { display: inline-block; width: 48px; height: 6px; margin-left: 8px; border-radius: 3px; background: var(--panel); vertical-align: middle; overflow: hidden; }
.ask-bar-fill { display: block; height: 100%; border-radius: 3px; }
.ask-bar--low { background: var(--red); }
.ask-bar--mid { background: var(--gold); }
.ask-bar--high { background: #1F9D6B; }
.ask-more { padding: 9px 16px; border-top: 1px solid var(--line); background: var(--paper); }
@media (max-width: 720px) {
  .ask-box { padding: 18px 16px 15px; border-radius: 16px; }
  .ask-title { font-size: 21px; }
  .ask-form { padding-left: 14px; }
  .ask-form textarea { font-size: 16px; }
  .ask-go { padding: 0 18px; }
  .ask-turn { padding: 15px 16px 16px; }
  .ask-chips { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .ask-chip { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .ask-dots { animation: none; } }
@media print { .ask-box { display: none; } }
/* the Connect page: the address card above the ways to connect */
.connect-address .code { font-size: 15px; }

/* ---------------------------------------------------------------------------------------------------------------
   Tags: a coloured dot says the kind (location, study, event, other); "Test scan" is the system's own.
   --------------------------------------------------------------------------------------------------------------- */
.tagdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: #8A7F7C; }
.tagdot--location { background: var(--deep); }
.tagdot--study { background: #5B4B8A; }
.tagdot--event { background: var(--gold); }
.tagdot--tag { background: #8A7F7C; }
.tagdot--system { background: var(--red); }
.tagdot--big { width: 11px; height: 11px; margin-right: 9px; vertical-align: 1px; }
.tagchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 2px 6px 2px 0; padding: 4px 10px 4px 8px; border-radius: 999px; font: 500 12.5px/1.25 var(--f-b); color: var(--ink); background: var(--panel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tagchip--location { background: var(--deep-wash); }
.tagchip--study { background: #EFECF6; }
.tagchip--event { background: #F8F0D2; }
.tagchip--system { background: var(--red-wash); color: var(--crimson); }
.tagchip-x { font: inherit; font-size: 16px; line-height: 0.8; margin: 0 -3px 0 1px; padding: 2px 3px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.tagchip-x:hover { color: var(--crimson); background: rgba(23, 18, 17, 0.07); }
/* The Tags column of the Tests list. A new tag's name is 48 characters at most (tags.py MAX_NAME), which is one line
   of this column at its widest. A chip never runs over the next column: where the column is narrower than the
   name (a small window, or a longer name from before the limit) the name goes on to a second line inside its chip. */
.t-tags { max-width: 322px; }
.t-tags .tags-link { max-width: 100%; }
.t-tags .tagchip { margin-right: 4px; font-size: 12px; padding: 3px 9px 3px 7px; align-items: flex-start; border-radius: 12px; white-space: normal; overflow-wrap: break-word; text-overflow: clip; }
.t-tags .tagdot { margin-top: 3.5px; }
/* the tags of a row are a way in: one click to the test's own tags, where they are changed */
.tags-link { display: inline-block; color: inherit; text-decoration: none; border-radius: 10px; }
.tags-link:hover .tagchip, .tags-link:focus-visible .tagchip { box-shadow: 0 0 0 1px var(--deep); }
.tags-link:focus-visible { outline: none; }
.tags-link--none { font-size: 12px; line-height: 1.25; color: var(--muted); padding: 3px 9px; border: 1px dashed #CFC5C2; border-radius: 999px; white-space: nowrap; }
.tags-link--none:hover, .tags-link--none:focus-visible { color: var(--deep); border-style: solid; border-color: var(--deep); }
.card > .scan-tags, #results > .scan-tags { margin: 0 0 18px; padding: 0 0 16px; border-top: 0; border-bottom: 1px solid var(--panel); }

/* the tags of one scan, on its page */
.scan-tags { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--panel); }
.scan-tags + .pills { margin-top: 16px; }
.tagline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; }
.tagline .tagchip { font-size: 13.5px; padding: 6px 11px 6px 10px; }
.tagline-none { margin-right: 10px; font-size: 14px; }

/* the picker: a button that opens a panel with a box to type in and the tags under it */
.tagpick { position: relative; }
.tagpick > summary { list-style: none; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; min-width: 128px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; position: relative; }
.tagpick > summary::-webkit-details-marker { display: none; }
.tagpick > summary::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border-right: 1.6px solid var(--ink-soft); border-bottom: 1.6px solid var(--ink-soft); transform: rotate(45deg); }
.tagpick[open] > summary { border-color: var(--deep); background: var(--white); }
.tagpick > summary:focus-visible { outline: 2px solid var(--deep); outline-offset: 1px; }
.tagpick--add > summary { height: 32px; min-width: 0; padding: 0 14px 0 11px; border-radius: 999px; border-style: dashed; border-color: #BFB4B1; background: var(--white); font: 600 13.5px/1 var(--f-b); color: var(--deep); }
.tagpick--add > summary::after { display: none; }
.tagpick--add > summary:hover, .tagpick--add[open] > summary { border-style: solid; border-color: var(--deep); }
.tag-pop { position: absolute; z-index: 6; top: calc(100% + 6px); left: 0; width: 320px; max-width: calc(100vw - 48px); padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 14px 34px rgba(23, 18, 17, 0.16); display: grid; gap: 10px; }
.tag-pop .tag-find { width: 100%; height: 38px; padding: 0 12px; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.tag-pop .tag-find:focus { outline: none; border-color: var(--deep); background: var(--white); }
.tag-list { max-height: 264px; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.tag-group { border: 0; margin: 0; padding: 0; }
.tag-group + .tag-group { margin-top: 8px; }
.tag-group > legend, .tag-group-name { font: 600 11px/1.2 var(--f-b); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 4px 6px; margin: 0; }
.tag-check, .tag-pick { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 6px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; }
.tag-check:hover, .tag-pick:hover, .tag-pick:focus-visible { background: var(--paper); outline: none; }
/* typing in the box hides the tags that do not match; these rows are laid out as flex, which would otherwise show them anyway */
.tag-check[hidden], .tag-pick[hidden], .tag-group[hidden] { display: none; }
.tag-pop-foot a { white-space: nowrap; }
/* the tags that exist come first: making a new one is the rare case, so its row sits under the list (it is above it in the page, so that Enter with no script makes the tag that was typed) */
.tag-pop > .tag-find { order: 0; }
.tag-pop > .tag-list { order: 1; }
.tag-pop > .tag-create { order: 2; }
.tag-pop > .tag-pop-foot { order: 3; }
.tag-pop > .tag-pop-note { order: 4; }
.tag-check input { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--deep); }
.filter-form .tag-check input { height: 16px; padding: 0; }
.tag-check-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-check-where { flex: none; font-size: 12px; color: var(--muted); }
.tag-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tag-js .tag-create:not(.is-on) { display: none; }      /* with the script running it shows once a new name has been typed */
.tag-create select { height: 38px; padding: 0 8px; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); min-width: 0; }
.tag-create .button { height: 38px; padding: 0 14px; }
.tag-pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--panel); font-size: 13px; }
.tag-pop-foot .button { height: 34px; padding: 0 16px; }
.tag-pop-note { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.field-label { font: 600 12px/1.3 var(--f-b); color: var(--muted); }

/* the Tags page */
.tag-new { padding: 16px 20px; }
.tag-new-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.tag-new-form input[type=text], .tag-new-form select, .tag-edit-form input[type=text], .tag-edit-form select, .tag-merge select { font: inherit; font-size: 14px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); min-width: 0; max-width: 100%; }
.tag-new-form input:focus, .tag-new-form select:focus, .tag-edit-form input:focus, .tag-edit-form select:focus, .tag-merge select:focus { outline: none; border-color: var(--deep); background: var(--white); }
.tag-new-form .field--wide { max-width: 360px; }
.tag-new-form .button, .tag-edit-form .button, .tag-merge .button { height: 38px; padding: 0 20px; }
.tag-new-form .seg-row span { gap: 7px; }
.seg-row span.tagdot { display: inline-block; padding: 0; border: 0; }
.tag-new-form .seg-row input:checked + span .tagdot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
.tag-rows { list-style: none; margin: 0; padding: 0; }
.tag-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px 96px 84px; align-items: center; gap: 6px 16px; padding: 9px 0; border-top: 1px solid var(--panel); }
.tag-row:first-child { border-top: 0; }
.tag-row:target { background: var(--paper); box-shadow: -22px 0 0 var(--paper), 22px 0 0 var(--paper); }
.tag-row-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.tag-row-main .tagchip { font-size: 14px; padding: 6px 12px 6px 10px; }
.tag-row-where, .tag-row-count { font-size: 13.5px; color: var(--muted); }
.tag-row-count { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag-edit { justify-self: end; min-width: 0; }
.tag-edit[open] { grid-column: 1 / -1; justify-self: stretch; margin-top: -34px; }      /* the open panel takes the whole row under the tag; its Change stays where it was */
.tag-edit > summary { list-style: none; width: max-content; margin-left: auto; height: 28px; line-height: 28px; font-size: 14px; color: var(--deep); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tag-edit > summary::-webkit-details-marker { display: none; }
.tag-edit[open] > summary { color: var(--ink); font-weight: 600; text-decoration: none; }
.tag-edit-body { margin: 10px 0 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); display: grid; gap: 14px; }
.tag-edit-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; }
.tag-edit-form input[type=text], .tag-edit-form select, .tag-merge select { background: var(--white); }
.tag-edit-hide { flex: 1 0 100%; margin: 0; }
.tag-edit-more { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.tag-merge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 13px; color: var(--muted); }
.tag-merge label { font-weight: 600; }
.tag-merge select { max-width: 280px; }
.tag-delete > summary { font-size: 14px; color: var(--crimson); cursor: pointer; padding: 9px 0; }
.tag-delete form { display: grid; gap: 8px; justify-items: start; max-width: 380px; }
.button.danger { background: var(--crimson); border-color: var(--crimson); color: var(--white); }
.button.danger:hover { background: #7C0D0B; border-color: #7C0D0B; }
.tag-edit-none { justify-self: end; text-align: right; }
.tag-kind .card-head h2 .soft { font: 500 14px var(--f-b); margin-left: 4px; }
@media (max-width: 760px) {
  .tag-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tag-row-where { grid-column: 1; }
  .tag-row-count { grid-column: 2; grid-row: 1; }
  .tag-edit, .tag-edit-none { grid-column: 2; grid-row: 2; }
  .tag-edit[open] { grid-column: 1 / -1; grid-row: auto; margin-top: 0; }
  .tag-pop { width: min(320px, calc(100vw - 32px)); }
  .field--tags { flex: 1 1 100%; }
  .tagpick > summary { max-width: none; }
}

/* Publishing a test's results to the patient (publish.py) */
.publish { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.publish .meta { margin: 6px 0 2px; }
.publish .actions--left { margin-top: 10px; }
.publish-card { max-width: 760px; }
.publish-address { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.publish-check { margin: 14px 0 4px; padding: 12px 16px; background: var(--red-wash); border-radius: 12px; }
.publish-eyebrow { margin-top: 18px; }
.publish-steps { margin: 6px 0 12px; padding-left: 22px; display: grid; gap: 6px; }
.publish-form { max-width: 640px; margin-top: 6px; }
.scan-links .sent { color: #17694a; font-weight: 600; text-decoration: none; }
.scan-links .sent:hover { text-decoration: underline; }
.scan-links .sent--back { color: var(--crimson); }

/* the patient page: the address results go to, and the name */
.email-edit, .name-edit { max-width: 560px; }
#email .ok-line, #email .warn-line, #name .ok-line, #name .warn-line { margin: 14px 0 0; }
#name .name-edit { margin-bottom: 4px; }

/* ---------------------------------------------------------------------------------------------------------------
   Proving Ground: every score engine on the same scans (admins). The engines' own colours are in engines.py and say
   which engine, never how good a score is; text is always ink.
   --------------------------------------------------------------------------------------------------------------- */
.pg-mark { width: 32px; height: 20px; vertical-align: -4px; }
.pg-mark--big { width: 96px; height: 60px; flex: none; }
.who-link--pg { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.who-link--pg .pg-mark { width: 26px; height: 16px; vertical-align: 0; }
.pg-hero { background: var(--ink); color: var(--white); border-radius: var(--radius); padding: 30px 32px 26px; margin-bottom: 18px; }
.pg-hero-title { display: flex; align-items: center; gap: 22px; }
.pg-hero h1 { font-size: 40px; letter-spacing: -0.02em; color: var(--white); }
.pg-kicker { font: 600 11.5px/1.2 var(--f-b); letter-spacing: 0.12em; text-transform: uppercase; color: #C9BFBC; margin-bottom: 6px; }
.pg-tagline { font: 500 17px/1.3 var(--f-d); color: #EDE7E5; margin-top: 4px; }
.pg-lead { max-width: 820px; margin-top: 18px; color: #D8CFCC; font-size: 15px; }
.pg-figures { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid #3A3130; }
.pg-figures div { min-width: 120px; }
.pg-figures dt { font: 600 11.5px/1.3 var(--f-b); letter-spacing: 0.06em; text-transform: uppercase; color: #B5AAA7; }
.pg-figures dd { margin: 4px 0 0; font: 800 30px/1 var(--f-d); font-variant-numeric: tabular-nums; }
.pg-engines { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 18px; }
.pg-engine { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; }
.pg-engine--building { background: var(--paper); border-style: dashed; }
.pg-engine-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pg-engine-head h2 { font-size: 21px; }
.pg-swatch { width: 12px; height: 12px; flex: none; }
.pg-engine-tag { font: 600 14.5px/1.3 var(--f-d); margin: 8px 0 6px; }
.pg-engine-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--panel); }
.pg-engine-figures dt { font-size: 12px; color: var(--muted); }
.pg-engine-figures dd { margin: 2px 0 0; font: 700 18px/1.2 var(--f-d); font-variant-numeric: tabular-nums; }
.pg-engine-foot { margin-top: auto; padding-top: 12px; }
.pg-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.pg-two--scan { grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr); }
.pg-plot { max-width: 420px; margin: 0 auto; }
.pg-chart { display: block; width: 100%; height: auto; }
.pg-axis { font: 400 11px var(--f-b); fill: var(--muted); }
.pg-axis-title { font: 600 12px var(--f-b); fill: var(--ink-soft); }
.pg-label { font: 600 13px var(--f-b); fill: var(--ink); }
.pg-value { font: 700 14px var(--f-d); fill: var(--ink); }
.pg-dot { cursor: pointer; }
.pg-chart a:hover .pg-dot, .pg-chart a:focus .pg-dot { stroke: var(--ink); }
.pg-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 12px 0 0; padding: 0; font-size: 13.5px; }
.pg-legend li { display: inline-flex; align-items: center; gap: 7px; }
.pg-facts { margin-top: 14px; }
.pg-note, .pg-empty { margin-top: 12px; }
.pg-choose fieldset { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.pg-choose legend { padding: 0; margin-bottom: 8px; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; background: var(--white); cursor: pointer; }
.pg-chip input { margin: 0; accent-color: var(--deep); }
.pg-chip:has(input:checked) { border-color: var(--deep); background: var(--deep-wash); }
.pg-chip:focus-within { outline: 2px solid var(--deep); outline-offset: 2px; }
.pg-chip--done { cursor: default; opacity: 0.7; }
.pg-chip .pg-swatch { width: 10px; height: 10px; }
.pg-tabs { margin: 0 0 18px; }
.pg-said { margin: 0 0 18px; }
.pg-sub { font: 700 15px var(--f-d); margin: 22px 0 8px; }
.pg-sub .soft { font: 400 13px var(--f-b); margin-left: 8px; }
.pg-verdict + .pg-verdict { margin-top: 10px; }
.pg-sorts { margin-top: 0; }
.pg-table td { vertical-align: middle; }
.pg-score { font-weight: 600; white-space: nowrap; }
.pg-pixel td:first-child { white-space: nowrap; font-weight: 600; }
.pg-pixel .pg-swatch { display: inline-block; vertical-align: -1px; margin-right: 6px; }
.pg-pixel td.meta { min-width: 260px; }
.pg-check { display: inline-block; margin-left: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--deep-wash); color: var(--deep); font: 700 11px/16px var(--f-b); text-align: center; text-decoration: none; cursor: help; }
.pg-check--off { background: var(--red-wash); color: var(--crimson); }
.pg-rail-cell { min-width: 200px; }
.pg-rail { display: block; width: 220px; height: 20px; }
.pg-scale { display: block; width: 100%; max-width: 620px; height: auto; margin: 4px auto 0; }
.pg-scale-name { font: 600 14px var(--f-b); fill: var(--ink); }
.pg-scale-value { font: 800 16px var(--f-d); fill: var(--ink); font-variant-numeric: tabular-nums; }
.pg-verdict { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--deep-wash); color: var(--ink); font-size: 14px; }
.pg-verdict--off { background: var(--red-wash); }
.pg-maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.pg-maps--pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }      /* four engines: two rows of two, not three and one */
.pg-big { font: 800 30px/1 var(--f-d); font-variant-numeric: tabular-nums; }
.pg-big .soft { font: 400 13.5px var(--f-b); }
.pg-map-row { display: flex; flex-wrap: wrap; gap: 20px 28px; align-items: flex-start; }
.pg-map-box { flex: 1 1 250px; max-width: 320px; }
.pg-map-box .meta { margin-top: 8px; }
.pg-map { display: block; width: 100%; height: auto; }
.pg-map-facts { flex: 1 1 180px; }
.pg-cell { font: 800 15px var(--f-d); fill: var(--ink); }
.pg-cell-sub { font: 500 9.5px var(--f-b); fill: var(--ink-soft); }
.pg-strip-box { overflow-x: auto; }
.pg-strip { display: block; height: 132px; max-width: 100%; }
.pg-swatch--sq { width: 13px; height: 13px; }
/* An engine's own page: the model in words and formulas, and what has been observed */
.pg-hero--engine h1 { font-size: 36px; }
.pg-hero--engine .pg-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pg-hero--engine .pg-engine-head { gap: 12px; }
.pg-swatch--big { width: 18px; height: 18px; }
.pg-version { font: 500 13px/1 var(--f-b); color: #C9BFBC; }
.pg-toc { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid #3A3130; font-size: 14px; }
.pg-toc a { color: #EDE7E5; }
.pg-paper .card > p, .pg-paper .pg-steps, .pg-paper .pg-findings { max-width: 86ch; }
.pg-paper .card > p { margin: 0 0 12px; }
.pg-paper var { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-style: italic; font-size: 1.04em; }
.pg-formula { font: 400 16.5px/1.9 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; color: var(--ink); background: var(--paper); border-left: 3px solid var(--line); border-radius: 0 8px 8px 0; padding: 10px 18px; margin: 4px 0 14px !important; overflow-x: auto; white-space: nowrap; max-width: none !important; }
.pg-formula sub, .pg-formula sup, .pg-paper p sub, .pg-paper li sub, .pg-paper p sup, .pg-paper li sup { font-size: 0.72em; line-height: 0; }
.pg-remark { background: var(--deep-wash); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.pg-steps { margin: 0 0 14px; padding-left: 20px; }
.pg-steps li { margin-bottom: 9px; }
.pg-h3 { font: 700 16px/1.3 var(--f-d); margin: 22px 0 8px; letter-spacing: -0.005em; }
.pg-facts-table { margin: 4px 0 14px; }
.pg-facts-table td { padding: 8px 18px 8px 0; border-bottom: 1px solid var(--panel); vertical-align: top; }
.pg-facts-table td:first-child { font-weight: 600; white-space: nowrap; }
.pg-observed { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px 28px; margin: 0 0 6px; }
.pg-observed dt { font-size: 12.5px; color: var(--muted); }
.pg-observed dd { margin: 2px 0 0; font: 700 17px/1.25 var(--f-d); font-variant-numeric: tabular-nums; }
.pg-findings { list-style: none; margin: 0 0 6px; padding: 0; }
.pg-findings li { padding: 11px 0; border-top: 1px solid var(--panel); }
.pg-basis { display: block; font: 600 11.5px/1.3 var(--f-b); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.pg-engine-more { margin: 12px 0 0; }
@media (max-width: 720px) {
  .pg-hero { padding: 22px 18px; }
  .pg-hero h1 { font-size: 30px; }
  .pg-mark--big { width: 64px; height: 40px; }
  .pg-two--scan, .pg-maps { grid-template-columns: 1fr; }
}

/* Focus (admins only): how sharp a scan's recordings are; _focus.html, proving_ground_focus.html, Proving Ground's table */
.focus-top { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; margin-bottom: 14px; }
.focus-rail { flex: 0 1 240px; }
.focus-rail-note { text-align: center; margin-top: 2px; }
.focus-facts { flex: 1 1 260px; }
.focus-row { margin-bottom: 14px; }
.focus-groups { flex: 1 1 280px; }
.focus-map--row { max-width: 100%; }
.focus-strip { display: block; width: 100%; max-width: 1100px; height: auto; min-width: 560px; }
.focus-chip { display: inline-block; min-width: 2.6em; padding: 1px 7px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-chip--sharp { background: #DCEDEE; color: #0B4C55; }
.focus-chip--soft { background: #F8E1DC; color: #8A2219; }

/* ---------------------------------------------------------------------------------------------------------------
   Phones and tablets. Every rule below sits inside a question about the screen's width or about touch, or belongs
   to something that only shows there, so a desktop screen draws exactly as it did. small-screens.js adds the
   classes named here: .is-open (the menu, the filters), .stack (a list shown as blocks), .filters--fold and
   .is-handheld (a phone or a tablet, however wide).
   --------------------------------------------------------------------------------------------------------------- */
.menu-button, .field--more, .acq-touch { display: none; }

/* Acquisition needs the camera, which a phone or a tablet cannot be plugged into yet: say so instead of offering the scan screen */
@media (hover: none) and (pointer: coarse) { .acq-touch { display: block; } .acq-desk { display: none; } }
.is-handheld .acq-touch { display: block; }
.is-handheld .acq-desk { display: none; }

/* the header: one line with a Menu button; the links (and on a phone, search) open under it */
@media (max-width: 900px) {
  .top { padding: 8px 16px; gap: 8px 12px; }
  .search { order: 0; flex: 1 1 200px; max-width: 520px; margin: 0 auto; }
  .menu-button { display: inline-flex; align-items: center; gap: 9px; flex: none; height: 40px; margin-left: auto; padding: 0 15px 0 13px; font: 600 14px/1 var(--f-b); color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; touch-action: manipulation; }
  .menu-button[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
  .menu-bars { width: 15px; height: 2px; border-radius: 1px; background: currentColor; box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor; }
  .who { display: none; order: 4; flex: 1 0 100%; margin: 0; gap: 2px 4px; padding: 6px 0 2px; border-top: 1px solid var(--line); }
  .top.is-open .who { display: flex; }
  .top.is-open { max-height: 100vh; max-height: 100dvh; overflow-y: auto; }
  .who-name { padding: 10px 12px 10px 0; }
  .who-link, .who button.link { display: inline-block; padding: 10px 11px; border-radius: 10px; text-decoration: none; font-weight: 600; }
  .who-link:hover, .who button.link:hover { background: var(--panel); }
  .who form { margin-left: auto; }
  html { scroll-padding-top: 70px; }
  .wrap { padding: 16px 16px 48px; }
  .stack-form { grid-template-columns: minmax(0, 1fr); }
  select { max-width: 100%; }
}
@media (max-width: 860px) {
  .gauge-card--key { grid-column: 1 / -1; }
  /* a patient's visits: the visit's name stays in view while the numbers scroll sideways. The table runs to the
     card's edges here, so nothing shows beside the name as it scrolls. */
  .table-wrap:has(> .grid-table) { padding: 0; }
  .grid-table th:first-child, .grid-table td:first-child { padding-left: 16px; }
  .grid-table th:last-child, .grid-table td:last-child { padding-right: 16px; }
  .grid-table tr:not(.groups) th:first-child, .grid-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--white); box-shadow: 1px 0 0 var(--line); }
  .grid-table tbody tr:hover td:first-child { background: var(--paper); }
  .grid-table tr.on td:first-child, .grid-table tr.on:hover td:first-child { background: var(--red-wash); box-shadow: inset 3px 0 0 var(--red), 1px 0 0 var(--line); }
}
/* the two charts on a scan's page fit the card, where they used to sit in half of a box that scrolled sideways */
@media (max-width: 720px) { .bars { min-width: 0; } }
@media (max-width: 600px) {
  .search { display: none; }
  .top.is-open .search { display: flex; order: 3; flex: 1 0 100%; max-width: none; margin: 2px 0 4px; }
  .top.is-open .who { flex-direction: column; align-items: stretch; gap: 0; padding: 0; border-top: 0; }
  .who-name { padding: 8px 2px; font-size: 13px; font-weight: 500; color: var(--muted); }
  .who-link, .who form { border-top: 1px solid var(--panel); }
  .who-link, .who button.link { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 0 2px; border-radius: 0; font-size: 16px; color: var(--ink); text-align: left; }
  .who form { margin: 0; }
  .who button.link { color: var(--crimson); }
  .acq-go { justify-content: center; height: 46px; margin: 8px 0 6px; font-size: 16px; }
}
/* with scripts switched off the Menu button cannot open anything, so the links and search simply show */
@media (scripting: none) and (max-width: 900px) {
  .menu-button { display: none; }
  .who, .search { display: flex; }
}

/* a phone held upright */
@media (max-width: 640px) {
  .card { padding: 16px; }
  .help-article { padding: 20px 18px; }
  .button, .primary { white-space: normal; text-align: center; line-height: 1.2; }
  .crumbs { font-size: 13px; }

  /* the front screen's filters: the patient box, and the rest behind "More filters" */
  .filters { padding: 14px 16px; }
  .filter-form { gap: 10px 12px; }
  .filter-form > .field { flex: 1 1 100%; grid-template-columns: minmax(0, 1fr); }
  .filter-form select { width: 100%; max-width: none; }
  .filter-form > .range { flex: 1 1 40%; }
  .filter-form > .range--date { flex-basis: 100%; }
  .range-row input[type=number], .range-row input[type=date] { flex: 1 1 0; width: auto; }
  .seg-row { display: flex; }
  .seg-row label, .seg-row span { flex: 1 1 auto; justify-content: center; }
  .filter-form > .field--more, .filter-form > .field--go { order: 9; flex: 1 1 40%; margin-left: 0; }
  .field--more .button, .field--go .button { width: 100%; }
  .filters--fold .field--more { display: block; }
  .filters--fold:not(.is-open) .filter-form > .field:not(.field--wide):not(.field--more):not(.field--go) { display: none; }

  /* the tests: each one a small block, the name and the score first */
  .tests { padding-top: 2px; padding-bottom: 12px; }
  .tests .table-wrap { overflow: visible; margin: 0; padding: 0; }
  .tests-table, .tests-table tbody { display: block; }
  .tests-table thead, table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tests-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; padding: 13px 0 12px; border-bottom: 1px solid var(--panel); }
  .tests-table tbody tr:last-child { border-bottom: 0; }
  .tests-table tr::before, .tests-table tr::after { content: ""; flex: 0 0 100%; height: 0; margin-top: -3px; }
  .tests-table td { display: block; padding: 0; border: 0; font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); text-align: left; }
  .tests-table td:empty { display: none; }
  .tests-table .t-who { order: 1; flex: 1 1 58%; min-width: 0; font-size: 16px; color: var(--ink); }
  .tests-table .t-score { order: 2; flex: none; margin-left: auto; padding: 0; }
  .tests-table .t-score .score-num { min-width: 0; font-size: 17px; }
  .tests-table .t-when { order: 3; }
  .tests-table .t-age { order: 4; }
  .tests-table .t-gender { order: 5; }
  .tests-table tr::before { order: 6; }
  .tests-table .t-tags { order: 7; min-width: 0; max-width: 100%; }
  .tests-table .t-station { order: 8; }
  .tests-table tr::after { order: 9; }
  .tests-table .t-pbr { order: 10; }
  .tests-table .t-cbv { order: 11; }
  .tests-table .t-links { order: 12; margin-left: auto; white-space: normal; text-align: right; }
  .tests-table .t-age::before { content: "Age "; }
  .tests-table .t-pbr::before { content: "PBR "; color: var(--muted); }
  .tests-table .t-cbv::before { content: "CBV "; color: var(--muted); }
  .tests-table .scan-links a { display: inline-block; padding: 4px 0; }
  .tests-table .scan-links a + a { margin: 0 0 0 14px; }
  .list.tests-table tbody tr:hover { background: none; }

  /* every other list: each row a block, every value beside its column's name */
  .table-wrap:has(> table.stack) { overflow: visible; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: block; padding: 12px 0 11px; border-bottom: 1px solid var(--line); }
  table.stack tr[hidden] { display: none; }
  table.stack tbody tr:last-child { border-bottom: 0; padding-bottom: 2px; }
  table.stack td { display: block; position: relative; min-height: 26px; padding: 3px 0 3px 39%; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 36%; font: 600 12px/1.5 var(--f-b); color: var(--muted); }
  table.stack td:not([data-label]) { padding-left: 0; }
  table.stack td:not([data-label])::before { content: none; }
  table.stack td:first-child { font-size: 15.5px; padding-bottom: 5px; }
  table.stack td.is-blank { display: none; }
  .list.stack tbody tr:hover { background: none; }

  /* the player: the frame slider on its own line, the frame count under it, then the buttons */
  .player-bar { gap: 8px; }
  .player-scrub { order: -2; flex: 1 0 100%; }
  .player-count { order: -1; flex: 1 0 100%; min-width: 0; }
  .player-bar .button[data-play] { flex: 1 1 auto; }
  .rec-row { grid-template-columns: minmax(0, 1fr); }
  .rec-period { padding-top: 0; }
}

/* a phone on its side: the whole picture stays on the screen */
@media (max-height: 560px) and (orientation: landscape) {
  .player-canvas { max-height: calc(100vh - 84px); max-height: calc(100dvh - 84px); }
}

/* touch (small-screens.js marks a phone or a tablet with .is-handheld): room for a finger, and no zooming in by
   accident when a button is pressed twice quickly */
.is-handheld .button, .is-handheld .primary, .is-handheld button, .is-handheld summary, .is-handheld .player-bar,
.is-handheld .player-canvas, .is-handheld .pill, .is-handheld a.watch { touch-action: manipulation; }
.is-handheld .crumbs { gap: 0 8px; margin-bottom: 8px; }
.is-handheld .crumbs a, .is-handheld .crumbs span { padding: 7px 0; }
.is-handheld .pill { padding: 10px 14px; }
.is-handheld .chip { padding: 10px 12px 10px 14px; }
.is-handheld .ask-chip { padding: 11px 14px; }
.is-handheld .pager-nav a, .is-handheld .pager-on, .is-handheld .pager-gap { min-width: 42px; height: 42px; }
.is-handheld details.more summary { padding: 10px 0; }
.is-handheld .panel > summary { padding-top: 13px; padding-bottom: 13px; }
.is-handheld .tests-table td { padding-top: 13px; padding-bottom: 13px; }
.is-handheld td button.link, .is-handheld td a:not(.row-link):not(.quiet) { display: inline-block; padding: 6px 0; }
.is-handheld .check { align-items: center; padding: 6px 0; }
.is-handheld .check input { width: 20px; height: 20px; }
.is-handheld .rec-buttons { gap: 8px; }
.is-handheld .rec { min-width: 46px; padding: 14px 8px; font-size: 14px; }
.is-handheld .player-bar { gap: 10px; }
.is-handheld .player-bar .button { padding: 14px 16px; font-size: 14px; }
.is-handheld .player-bar select { height: 44px; padding: 0 12px; font-size: 16px; }
.is-handheld .stack-form select { height: 44px; padding-top: 0; padding-bottom: 0; }
.is-handheld .player-switch { padding: 11px 15px; font-size: 14px; }
.is-handheld .player-switch input { width: 18px; height: 18px; }
.is-handheld .player-scrub { height: 36px; }
@media (min-width: 901px) {
  .is-handheld .who { gap: 2px 4px; }
  .is-handheld .who-link, .is-handheld .who button.link { display: inline-block; padding: 10px 7px; }
}
/* a phone's browser zooms the page when a box with small type is tapped: 16px type stops it */
@media (max-width: 940px) {
  .is-handheld .search input, .is-handheld .filter input, .is-handheld .filter-form input, .is-handheld .filter-form select,
  .is-handheld .stack-form input, .is-handheld .stack-form select, .is-handheld .stack-form textarea, .is-handheld .inline-form input[type=text] { font-size: 16px; }
}
@media (max-width: 640px) { .is-handheld .tests-table td { padding-top: 0; padding-bottom: 0; } }

