/* Prisma. Colours are custom properties generated from one primary by
   neurotest/palette.py (/palette.css); type: Literata for reading and
   headings, Public Sans for the interface. */
@import url("/static/fonts/fonts.css");

:root {
  --font-read: "Literata", "Iowan Old Style", Georgia, serif;
  --font-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* modular scale, ratio 1.2 on a 16px base */
  --fs-xs: .78rem; --fs-s: .875rem; --fs-m: 1rem; --fs-l: 1.2rem; --fs-xl: 1.44rem; --fs-2xl: 1.73rem; --fs-3xl: 2.3rem;
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem;
  --radius: 6px; --radius-l: 10px;
  --sidebar: 15rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 400 var(--fs-m)/1.55 var(--font-ui);
  font-feature-settings: "kern", "liga";
}
h1, h2, h3, h4 { font-family: var(--font-read); color: var(--ink); line-height: 1.2; font-weight: 600; }
h1 { font-size: var(--fs-2xl); margin: 0 0 var(--sp-3); letter-spacing: -.005em; }
h2 { font-size: var(--fs-xl); margin: var(--sp-7) 0 var(--sp-4); }
h3 { font-size: var(--fs-l); margin: var(--sp-6) 0 var(--sp-3); }
h4 { font-size: var(--fs-m); margin: var(--sp-5) 0 var(--sp-2); }
p { margin: 0 0 var(--sp-4); }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--deep); }
small, .muted, .meta { color: var(--muted); }
.meta { font-size: var(--fs-s); }
table, td, th { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent-vivid); outline-offset: 2px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shells ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--canvas) 90%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.appbar-in { max-width: 76rem; margin: 0 auto; padding: .7rem clamp(16px, 4vw, 2.5rem); display: flex; align-items: center; gap: var(--sp-5); }
.logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.logo .mark { flex: none; display: block; }
.logo .wordmark { font: 600 1.3rem/1 var(--font-read); letter-spacing: -.005em; }
.logo:hover .wordmark { color: var(--deep); }
.mainnav { display: flex; gap: var(--sp-1); flex: 1; }
.mainnav a { padding: .45rem .8rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 500; }
.mainnav a:hover { color: var(--ink); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--deep); background: var(--primary-t6); }
.appbar-tools { display: flex; align-items: center; gap: var(--sp-3); }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--primary);
  color: var(--on-primary); font: 600 .95rem/1 var(--font-read); }
.menu-pop { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 15rem; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-l); padding: var(--sp-2);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 14%, transparent); z-index: 30; }
.menu-pop .who { display: flex; flex-direction: column; padding: var(--sp-2) var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-1); }
.menu-pop a, .menu-pop .menu-item { display: block; width: 100%; text-align: left; padding: .5rem .75rem; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; font-size: .95rem; min-height: 0; font-weight: 400; }
.menu-pop a:hover, .menu-pop .menu-item:hover { background: var(--surface-2); color: var(--ink); }
.menu-pop .danger-item { color: var(--accent); }
.content { max-width: 76rem; margin: 0 auto; padding: var(--sp-6) clamp(16px, 4vw, 2.5rem) var(--sp-7); }
.content.narrow, .narrowbox { max-width: 48rem; margin-left: auto; margin-right: auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  max-width: 76rem; margin: 0 auto; padding: var(--sp-3) clamp(16px, 4vw, 2.5rem);
}
.page { max-width: 46rem; margin: 0 auto; padding: var(--sp-5) 16px var(--sp-7); }
.page.wide { max-width: 72rem; }

.toggles { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 999px; }
.toggles a, .toggles button {
  font: 600 var(--fs-xs)/1 var(--font-ui); color: var(--muted); text-decoration: none; background: none; border: 0;
  padding: .38rem .6rem; border-radius: 999px; cursor: pointer; min-height: 0;
}
.toggles a[aria-current="true"] { background: var(--primary); color: var(--on-primary); }
.toggles button:hover, .toggles a:hover { color: var(--ink); background: var(--surface-2); }
.toggles a[aria-current="true"]:hover { background: var(--deep); color: var(--on-primary); }
@media (max-width: 720px) {
  .appbar-in { flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
  .mainnav { order: 3; width: 100%; flex: none; overflow-x: auto; }
  .appbar-tools { margin-left: auto; }
}

/* ---------- controls ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
  font: 600 .92rem/1.2 var(--font-ui); text-decoration: none; min-height: 2.5rem;
  padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--primary);
  background: var(--primary); color: var(--on-primary);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
button:hover, .btn:hover { background: var(--deep); border-color: var(--deep); color: var(--on-primary); }
.btn.ghost, button.ghost { background: transparent; color: var(--primary); border-color: var(--line-strong); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); border-color: var(--primary); color: var(--deep); }
.btn.danger, button.danger { background: transparent; color: var(--accent); border-color: var(--accent-vivid); }
.btn.danger:hover, button.danger:hover { background: var(--accent-vivid-t6); }
.btn.small, button.small { min-height: 2rem; padding: .3rem .7rem; font-size: var(--fs-s); }
.linkbtn { background: none; border: 0; padding: 0; min-height: 0; color: var(--muted); font: inherit; font-size: var(--fs-s); cursor: pointer; }
.linkbtn:hover { background: none; color: var(--primary); text-decoration: underline; }
label { display: block; font-size: var(--fs-s); color: var(--muted); margin: var(--sp-4) 0 var(--sp-1); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: .55rem .7rem; border-radius: var(--radius); font: inherit; font-size: .95rem;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--primary-t3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-t6); }
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; text-overflow: ellipsis; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 55%, calc(100% - .7rem) 55%; background-size: .35rem .35rem; background-repeat: no-repeat; }
select, option, optgroup, datalist { background-color: var(--surface); color: var(--ink); }
input[type=date]::-webkit-calendar-picker-indicator { filter: none; opacity: .7; cursor: pointer; }
:root[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); } }
select.auto { width: auto; max-width: 100%; }
.field { margin: 0; }
.field.wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--sp-2) var(--sp-5) var(--sp-5); margin: 0 0 var(--sp-5); background: var(--surface); }
legend { font: 600 var(--fs-l) var(--font-read); padding: 0 var(--sp-2); color: var(--ink); }
fieldset .hint { font-size: var(--fs-s); color: var(--muted); margin: var(--sp-1) 0 0; }
textarea.report { min-height: 75vh; font: .86rem/1.6 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; background: var(--surface); }
.grid { display: grid; gap: 0 var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; }
.actions { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.checks label { display: flex; gap: .55rem; align-items: baseline; color: var(--ink); margin: .3rem 0; font-weight: 400; font-size: .93rem; }
.checks input { accent-color: var(--primary); }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--sp-5); }
.panel + .panel { margin-top: var(--sp-4); }
.panel > h3:first-of-type { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--sp-4) var(--sp-5); margin: var(--sp-3) 0; }
.panel-placeholder { border-style: dashed; background: transparent; }
.split { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }

.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  border: 1px solid var(--accent-vivid-t3); border-left: 4px solid var(--accent-vivid); border-radius: var(--radius);
  padding: .7rem .9rem; margin: var(--sp-3) 0; background: var(--accent-vivid-t6); font-size: .95rem;
}
.notice { border-left: 3px solid var(--primary-t3); padding: .55rem .9rem; background: var(--surface-2); margin: var(--sp-3) 0;
  border-radius: 0 var(--radius) var(--radius) 0; font-size: .95rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; font: 500 var(--fs-xs)/1 var(--font-ui);
  padding: .32rem .6rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink); background: var(--surface);
  white-space: nowrap;
}
.chip.primary { border-color: var(--primary-t3); color: var(--deep); background: var(--primary-t6); }
.chip.accent { border-color: var(--accent-vivid-t2); color: var(--accent); background: var(--accent-vivid-t6); }
.chip.quiet { color: var(--muted); }
.chip .dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge { display: inline-block; font-size: var(--fs-xs); padding: .1rem .45rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.badge.accent { border-color: var(--accent-vivid); color: var(--accent); }
.badge.muted { color: var(--muted); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--muted); font-weight: 600; font-size: var(--fs-s); border-bottom: 1px solid var(--line-strong); }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.ident { width: auto; margin: var(--sp-3) 0 var(--sp-5); }
table.ident th { padding-right: var(--sp-6); color: var(--muted); font-weight: 500; border-bottom-color: var(--line); }
td.flag, .flag { color: var(--accent); font-weight: 600; }
td.num, th.num { text-align: right; }
table.scores input, table.scores select { min-width: 4.8rem; padding: .35rem .45rem; font-size: .88rem; }
table.scores td:first-child { min-width: 13rem; }
table.scores tbody tr:hover td { background: none; }

/* ---------- clinician pages ---------- */
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.pagehead h1 { margin: 0; }
.pagehead .lead { color: var(--muted); margin: var(--sp-1) 0 0; }
.patient-head { padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-4); }
.patient-head .title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-4); }
.patient-head h1 { font-size: var(--fs-3xl); margin: 0; letter-spacing: -.01em; }
.patient-head .name { font: 400 var(--fs-xl)/1.2 var(--font-read); color: var(--muted); }
.patient-head .chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.subnav {
  position: sticky; top: 0; z-index: 5; display: flex; gap: var(--sp-1); overflow-x: auto; margin: 0 0 var(--sp-5);
  padding: var(--sp-2) 0; background: color-mix(in srgb, var(--canvas) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.subnav a { padding: .4rem .7rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: var(--fs-s); white-space: nowrap; }
.subnav a:hover { color: var(--ink); background: var(--surface-2); }
section.block { scroll-margin-top: 4rem; }
section.block > h2:first-child { margin-top: var(--sp-6); }

.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 1060px) { .hero { grid-template-columns: 1fr; } }
.hero .facts { display: grid; gap: var(--sp-3); }
.fact { padding: var(--sp-3) var(--sp-4); border-left: 3px solid var(--primary-t4); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.fact.accent { border-left-color: var(--accent-vivid); }
.fact .k { font-size: var(--fs-s); color: var(--muted); }
.fact .v { font: 600 var(--fs-l)/1.3 var(--font-read); }
.fact .v small { font: 400 var(--fs-s) var(--font-ui); color: var(--muted); }

.domain { margin: 0 0 var(--sp-5); }
.domain > h3 { margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-l); display: flex; gap: var(--sp-3); align-items: baseline; }
.domain > h3 small { font: 400 var(--fs-s) var(--font-ui); }
.measures { border-top: 1px solid var(--line-strong); }
.measure { display: grid; grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.measure .who a { font-weight: 600; text-decoration: none; }
.measure .who a:hover { text-decoration: underline; }
.measure .who .meta { display: block; margin-top: 2px; }
.measure .who .chip { margin-top: var(--sp-2); }
.mrows { display: grid; gap: 4px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem minmax(7rem, 12rem); gap: var(--sp-3); align-items: center; font-size: .92rem; }
.mrow .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.mrow .v.flag { color: var(--accent); }
.mrow .v small { font-weight: 400; color: var(--muted); }
.mrow .note { font-size: var(--fs-xs); color: var(--muted); }
.mrow.main { font-weight: 500; }
.acc { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-2); line-height: 1.45; }
@media (max-width: 640px) {
  .measure { grid-template-columns: 1fr; gap: var(--sp-2); }
  .mrow { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .mrow .bar { grid-column: 1 / -1; }
}

.figgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); gap: var(--sp-5); }
figure { margin: 0; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
figure.bare { padding: 0; background: none; border: 0; }
figcaption { font-size: var(--fs-s); color: var(--muted); margin-top: var(--sp-2); line-height: 1.4; }

.patients td { vertical-align: middle; }
.patients .code { font: 600 1.05rem var(--font-read); text-decoration: none; }
.patients .code:hover { text-decoration: underline; }
.search { max-width: 22rem; }
.empty { padding: var(--sp-6); text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-l); }

/* ---------- charts ---------- */
svg.chart { width: 100%; height: auto; display: block; max-width: 48rem; overflow: visible; }
svg.chart text { font-family: var(--font-ui); }
svg.meter { display: block; width: 100%; max-width: 12rem; height: 12px; }

/* ---------- respondent screens ---------- */
.respondent .topbar { border-bottom: 0; }
.respondent h1 { font-size: var(--fs-2xl); }
.intro-lead { font: 400 var(--fs-l)/1.5 var(--font-read); color: var(--ink); }
.steps { list-style: none; padding: 0; margin: var(--sp-5) 0; border-top: 1px solid var(--line); }
.steps li { display: flex; align-items: center; gap: var(--sp-3); padding: .9rem 0; border-bottom: 1px solid var(--line); }
.steps .mark { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid var(--line-strong); flex: none;
  display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--muted); }
.steps li.done .mark { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.steps li.next .mark { border-color: var(--accent-vivid); color: var(--accent); }
.steps .what { flex: 1; }
.steps .what small { display: block; color: var(--muted); font-size: var(--fs-s); }
.bigbtn { min-height: 3.2rem; padding: .8rem 1.6rem; font-size: 1.05rem; border-radius: var(--radius-l); }

.progress-wrap { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--canvas) 94%, transparent);
  backdrop-filter: blur(6px); padding: var(--sp-3) 0 var(--sp-2); margin-bottom: var(--sp-3); }
.progress { height: 6px; background: var(--primary-t6); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); width: 0; transition: width .35s var(--ease); border-radius: 3px; }
.progress-label { font-size: var(--fs-s); color: var(--muted); margin-top: var(--sp-1); }

.q-item { padding: var(--sp-5) 0; border-bottom: 1px solid var(--line); }
.q-item:last-of-type { border-bottom: 0; }
.q-section { margin: var(--sp-6) 0 0; padding-bottom: var(--sp-2); border-bottom: 2px solid var(--primary-t4); font-size: var(--fs-l); }
.q-text { font: 400 1.12rem/1.5 var(--font-read); margin-bottom: var(--sp-3); }
.q-num { color: var(--muted); font: 600 var(--fs-s) var(--font-ui); margin-right: .4rem; }
.q-opts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.q-opts label {
  margin: 0; display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; min-height: 2.9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-l); padding: .55rem .9rem; color: var(--ink);
  font-size: .97rem; font-weight: 400; background: var(--surface);
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.q-opts label:hover { border-color: var(--primary-t3); }
.q-opts input { accent-color: var(--primary); width: 1.1rem; height: 1.1rem; margin: 0; }
.q-opts label:has(input:checked) { border-color: var(--primary); background: var(--primary-t6); box-shadow: inset 0 0 0 1px var(--primary); }
.q-item:has(input:checked) .q-num { color: var(--primary); }
@media (max-width: 640px) {
  .q-opts { flex-direction: column; }
  .q-opts label { width: 100%; }
}

/* tasks: the scene is standardised. Its palette is the fixed --task-* set
   of /palette.css (palette.scene_css), its fonts the --task-font* below, its
   sizes in px on a 16px root (data-scene="task" on the page): no aura, theme
   or comfort setting reaches the stimuli. */
:root { --task-font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --task-font-read: "Literata", Georgia, serif; }
:root[data-scene="task"] { font-size: 16px; }
.task-stage, .q-scene { --font-ui: var(--task-font); --font-read: var(--task-font-read); }
.task-stage { letter-spacing: normal; word-spacing: normal; line-height: 1.55; color: var(--ink); font-family: var(--font-ui); }
/* the questionnaire items sit on a fixed sheet, like the paper form; text
   size and spacing follow the reader (WCAG 1.4.4, 1.4.12), nothing else */
.q-scene { background: var(--canvas); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 0 clamp(1rem, 4vw, 2rem); margin: var(--sp-3) 0 0; }
.q-scene > .intro-lead { padding-top: var(--sp-5); margin-bottom: 0; }
.task-stage {
  position: relative; min-height: 62vh; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius-l); user-select: none; -webkit-user-select: none;
  touch-action: manipulation; overflow: hidden; background: var(--surface);
}
.task-stage.full { position: fixed; inset: 0; min-height: 100vh; border: 0; border-radius: 0; z-index: 50; background: var(--canvas); }
.stim { font: 700 min(18vw, 112px)/1 var(--font-ui); color: var(--ink); }
.dot { width: 80px; height: 80px; border-radius: 50%; background: var(--primary); }
.square { width: 80px; height: 80px; border-radius: var(--radius); background: var(--primary); position: absolute; top: calc(50% - 40px); }
.fix { font: 300 48px/1 var(--font-ui); color: var(--muted); }
.task-msg { max-width: 36rem; text-align: center; padding: var(--sp-5); font-size: 1.05rem; }
.task-msg h3 { margin-top: var(--sp-3); }
.task-msg .actions { justify-content: center; }
.task-msg .actions button { min-height: 3rem; padding: .7rem 1.5rem; font-size: 1rem; }
.check-list { list-style: none; padding: 0; margin: var(--sp-3) auto; text-align: left; max-width: 22rem; font-size: .95rem; }
.check-list li { display: flex; justify-content: space-between; gap: var(--sp-4); padding: .35rem 0; border-bottom: 1px solid var(--line); }
.keypad { display: grid; grid-template-columns: repeat(3, 4.2rem); gap: .6rem; justify-content: center; margin: var(--sp-4) 0; }
.keypad button { font-size: 1.35rem; height: 3.6rem; }
.colour-buttons { position: absolute; bottom: 1.2rem; left: 0; right: 0; display: flex; justify-content: center; gap: .7rem; flex-wrap: wrap; }
.colour-buttons button { min-width: 4.8rem; min-height: 3.2rem; border: 0; color: #fff; text-shadow: 0 1px 2px #0008; }
#corsi-canvas { width: 100%; height: 62vh; display: block; }

/* ---------- aura: "Qual è la tua aura oggi?" (static/js/aura.js) ----------
   the button (two-tone dot and the question) opens a ring of 24 hues with the sample in its centre,
   an intensity slider down to Quiete and the ready-made auras as chips */
.aura-summary { display: inline-flex; align-items: center; gap: .5rem; height: 2rem; padding: 0 .8rem 0 .55rem; border-radius: 1rem;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: var(--fs-s); white-space: nowrap; cursor: pointer; }
.aura-summary:hover { background: var(--surface-2); }
.aura-summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.aura-dot { flex: none; }
.aura-text-short { display: none; }
@media (max-width: 640px) { .aura-text-full { display: none; } .aura-text-short { display: inline; } }
@media (max-width: 1000px) { .appbar .aura-text-full { display: none; } .appbar .aura-text-short { display: inline; } }
.aura-dot { width: .95rem; height: .95rem; border-radius: 50%;
  background: conic-gradient(var(--primary) 0 50%, var(--accent-vivid) 50% 100%); box-shadow: 0 0 0 3px var(--primary-t5), 0 0 10px var(--primary-t3); }
.aura-pop { width: min(21rem, calc(100vw - 32px)); max-height: min(88vh, 48rem); overflow-y: auto; padding: var(--sp-3) var(--sp-4); }
.aura-wheel { position: relative; width: 13rem; aspect-ratio: 1; margin: var(--sp-4) auto var(--sp-2); touch-action: none; cursor: pointer; }
.aura-ring { position: absolute; inset: 0; border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 56%, #000 57%); mask: radial-gradient(circle, transparent 56%, #000 57%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent); }
.aura-thumb { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; outline: none; }
.aura-thumb > span { position: absolute; left: 50%; top: 0; width: 1.6rem; height: 1.6rem; margin-left: -.8rem; margin-top: .6rem;
  border-radius: 50%; background: var(--thumb, var(--primary)); border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--ink-t2), 0 2px 8px color-mix(in srgb, var(--ink) 30%, transparent); }
.aura-thumb:focus-visible > span { box-shadow: 0 0 0 3px var(--accent-vivid), 0 2px 8px color-mix(in srgb, var(--ink) 30%, transparent); }
.aura-center { position: absolute; inset: 24%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; text-align: center; cursor: default; }
.aura-sample { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line); }
.aura-hue-name { font: italic 500 1.15rem/1.1 var(--font-quote); color: var(--ink); }
.aura-range-label { margin-top: var(--sp-3); color: var(--ink); font-weight: 600; }
#aura-chroma { width: 100%; accent-color: var(--primary); margin: var(--sp-1) 0 0; }
.range-ends { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }
.aura-presets-title { font: 600 var(--fs-s)/1.3 var(--font-ui); margin: var(--sp-4) 0 var(--sp-2); }
.aura-presets { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.aura-chipbtn { min-height: 2rem; padding: .3rem .65rem .3rem .35rem; gap: .4rem; border-radius: 999px; font: 500 var(--fs-xs)/1 var(--font-ui);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.aura-chipbtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--primary-t3); }
.aura-chipbtn[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-t4); }
.aura-chip { width: 1.15rem; height: 1.15rem; border-radius: 50%; flex: none; }
.aura-pop .hint { font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-2) 0 0; text-align: center; }
.aura-pop .aura-presets + .hint { text-align: left; }
/* on phones the panels open below the bar, across the width */
@media (max-width: 640px) {
  .aura-pop, .comfort-pop { position: fixed; left: 16px; right: 16px; top: 3.6rem; width: auto; max-height: calc(100vh - 4.6rem); }
  .aura-wheel { width: min(13rem, 62vw); }
}

/* ---------- comfort panel (neurotest/prefs.py) ----------
   Text size, spacing, typeface and density apply to the frame only: the
   task page has data-scene="task", and the questionnaire items keep their
   typeface and spacing scale (.q-scene). */
.tool-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); }
.tool-btn:hover { color: var(--ink); background: var(--surface-2); }
.comfort-pop { width: min(22rem, calc(100vw - 32px)); max-height: min(80vh, 40rem); overflow-y: auto; padding: var(--sp-3) var(--sp-4); }
.pop-title { font: italic 500 1.4rem/1.1 var(--font-quote, var(--font-read)); color: var(--deep); margin: 0 0 var(--sp-1); }
.pref-row { border: 0; padding: 0; margin: var(--sp-3) 0 0; background: none; }
.pref-row legend { font: 600 var(--fs-s)/1.3 var(--font-ui); color: var(--ink); padding: 0; margin-bottom: var(--sp-1); }
.pref-row legend label { margin: 0; color: inherit; font: inherit; }
.pref-row select { font-size: var(--fs-s); }
.pref-row .hint, .comfort-pop > .hint { font-size: var(--fs-xs); color: var(--muted); margin: var(--sp-1) 0 0; }
.seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.seg label { flex: 1 1 0; min-width: max-content; margin: 0; position: relative; cursor: pointer; font-weight: 500; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: .38rem .5rem; min-height: 24px; border-radius: calc(var(--radius) - 2px);
  font-size: var(--fs-xs); color: var(--muted); }
.seg label:hover span { color: var(--ink); background: var(--surface-2); }
.seg input:checked + span { background: var(--primary); color: var(--on-primary); }
.seg input:focus-visible + span { outline: 2px solid var(--accent-vivid); outline-offset: 1px; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3);
  padding-top: var(--sp-2); border-top: 1px solid var(--line); }
#pref-font option.font-atkinson { font-family: "Atkinson Hyperlegible"; }
#pref-font option.font-lexend { font-family: "Lexend"; }
#pref-font option.font-opendyslexic { font-family: "OpenDyslexic"; }

/* text size: rem everywhere, so the root size scales the frame */
:root[data-text="s"]:not([data-scene]) { font-size: 93.75%; }
:root[data-text="l"]:not([data-scene]) { font-size: 112.5%; }
:root[data-text="xl"]:not([data-scene]) { font-size: 125%; }
/* spacing: the values of WCAG 1.4.12 */
:root[data-spacing="wide"]:not([data-scene]) body { line-height: 1.75; letter-spacing: .12em; word-spacing: .16em; }
:root[data-spacing="wide"]:not([data-scene]) p { margin-bottom: 2em; }
:root[data-spacing="wide"]:not([data-scene]) h1, :root[data-spacing="wide"]:not([data-scene]) h2,
:root[data-spacing="wide"]:not([data-scene]) h3 { line-height: 1.4; letter-spacing: .04em; }
/* typeface */
:root[data-font="atkinson"]:not([data-scene]) { --font-ui: "Atkinson Hyperlegible", "Public Sans", system-ui, sans-serif; --font-read: var(--font-ui); }
:root[data-font="lexend"]:not([data-scene]) { --font-ui: "Lexend", "Public Sans", system-ui, sans-serif; --font-read: var(--font-ui); }
:root[data-font="opendyslexic"]:not([data-scene]) { --font-ui: "OpenDyslexic", "Public Sans", system-ui, sans-serif; --font-read: var(--font-ui); }
/* density: the spacing scale */
:root[data-density="compact"]:not([data-scene]) { --sp-4: .8rem; --sp-5: 1.1rem; --sp-6: 1.5rem; --sp-7: 2.2rem; }
:root[data-density="airy"]:not([data-scene]) { --sp-4: 1.25rem; --sp-5: 2rem; --sp-6: 2.75rem; --sp-7: 4rem; }
.q-scene { --sp-4: 1rem; --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; letter-spacing: normal; word-spacing: normal; }
/* transparency: the frosted bars become solid */
:root[data-glass="off"] :is(.appbar, .subnav, .progress-wrap, .savebar, .printbar) { background: var(--canvas); backdrop-filter: none; }
@media (prefers-reduced-transparency: reduce), (prefers-reduced-motion: reduce) {
  :root:not([data-glass]) :is(.appbar, .subnav, .progress-wrap, .savebar, .printbar) { background: var(--canvas); backdrop-filter: none; }
}

/* first access: "Come preferisci Prisma?" */
.firstrun { width: min(46rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line-strong);
  border-radius: 18px; background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 80px color-mix(in srgb, var(--ink) 25%, transparent); }
.firstrun::backdrop { background: color-mix(in srgb, var(--canvas) 55%, transparent); }
:root:not([data-glass="off"]) .firstrun::backdrop { backdrop-filter: blur(3px); }
.firstrun-in { padding: var(--sp-6) clamp(1rem, 4vw, 2.2rem) var(--sp-5); }
.firstrun h2 { font: italic 500 clamp(1.7rem, 4vw, 2.2rem)/1.15 var(--font-quote); color: var(--deep); margin: 0 0 var(--sp-3); }
.profiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin: var(--sp-4) 0; }
@media (max-width: 640px) { .profiles { grid-template-columns: 1fr; } }
.profile { position: relative; display: flex; flex-direction: column; gap: var(--sp-1); margin: 0; cursor: pointer;
  padding: var(--sp-3) var(--sp-4) var(--sp-4); border: 1px solid var(--line-strong); border-radius: var(--radius-l);
  background: var(--canvas); color: var(--ink); font-weight: 400; }
.profile input { position: absolute; opacity: 0; }
.profile strong { font: 600 var(--fs-l)/1.2 var(--font-read); }
.profile:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary), 0 0 0 4px var(--primary-t6); }
.profile:has(input:focus-visible) { outline: 2px solid var(--accent-vivid); outline-offset: 2px; }
.profile-demo { display: grid; gap: .4rem; height: 3rem; align-content: center; margin-bottom: var(--sp-2); }
.pd-bar { height: 6px; border-radius: 3px; background: var(--primary-t6); overflow: hidden; }
.pd-bar span { display: block; height: 100%; width: 62%; background: var(--primary); border-radius: 3px; }
.pd-ray { display: flex; gap: 4px; }
.pd-ray i { height: 4px; flex: 1; border-radius: 2px; background: var(--primary-t3); }
.pd-ray i:nth-child(2) { background: var(--primary); }
.pd-ray i:nth-child(3) { background: var(--accent-vivid); }
.profile-quiet .pd-bar span, .profile-quiet .pd-ray i { filter: saturate(.35); }
.profile-vivid .pd-ray i { animation: none; }
.firstrun[data-profile="vivid"] .profile-vivid .pd-ray i { animation: shimmer 2.4s ease-in-out infinite; }
.firstrun[data-profile="vivid"] .profile-vivid .pd-ray i:nth-child(2) { animation-delay: .4s; }
.firstrun[data-profile="vivid"] .profile-vivid .pd-ray i:nth-child(3) { animation-delay: .8s; }
.firstrun-preview { border: 1px dashed var(--line-strong); border-radius: var(--radius-l); padding: var(--sp-3) var(--sp-4); }
.firstrun-preview p { margin: var(--sp-1) 0 var(--sp-3); }
.firstrun-preview .progress { margin-bottom: var(--sp-3); }
.firstrun-preview .pv-bar { width: 35%; }
.firstrun.pv-pressed .firstrun-preview .pv-bar { width: 80%; }
.firstrun .actions { justify-content: flex-end; }
.firstrun .hint { font-size: var(--fs-s); color: var(--muted); margin: var(--sp-3) 0 0; }
@media (max-width: 640px) { .profile-demo { height: 1.6rem; margin-bottom: 0; } .profile { padding: var(--sp-2) var(--sp-3) var(--sp-3); } }

/* ---------- patient journey: steps, pauses, acknowledgements ---------- */
.stepline { font-size: var(--fs-s); color: var(--muted); margin: 0 0 var(--sp-2); }
.ack { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-5); margin: 0 0 var(--sp-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.ack .facets { flex: none; color: var(--ink); }
.ack-title { font: 600 var(--fs-l)/1.35 var(--font-read); margin: 0 0 var(--sp-1); }
.ack .meta { margin: 0; }
.scene-note { margin-top: var(--sp-3); }
.done-mark { margin: var(--sp-5) 0 var(--sp-3); color: var(--ink); }
.help-pop { width: min(22rem, calc(100vw - 32px)); padding: var(--sp-3) var(--sp-4); font-size: var(--fs-s); }
.help-pop p { margin: 0 0 var(--sp-2); }
.tool-btn > span { font: 600 .95rem/1 var(--font-read); }
@media (max-width: 640px) { .help-pop { position: fixed; left: 16px; right: 16px; top: 3.6rem; width: auto; }
  .ack { padding: var(--sp-3); flex-direction: column; align-items: flex-start; gap: var(--sp-2); } .ack-title { font-size: var(--fs-m); } }
/* the bar keeps its controls on one line on phones */
.topbar .row { flex-wrap: nowrap; gap: 6px; }
@media (max-width: 440px) { .topbar .wordmark { display: none; } .topbar { gap: var(--sp-2); } }
/* decorative refraction (item 10): the bands open one after the other at
   the balanced and lively levels, never in a questionnaire or a task */
.refract polygon:not(:last-of-type) { animation: band .7s var(--ease) both; }
.refract polygon:nth-of-type(2) { animation-delay: .12s; } .refract polygon:nth-of-type(3) { animation-delay: .24s; }
.refract polygon:nth-of-type(4) { animation-delay: .36s; } .refract polygon:nth-of-type(n+5) { animation-delay: .48s; }
@keyframes band { from { opacity: 0; transform: scaleX(.4); transform-origin: 50% 50%; } to { opacity: 1; transform: none; } }
/* lively only: a slow light behind the homepage and a glow of the aura
   around the focus, outside the scenes */
:root[data-motion="vivid"] body.is-login { background:
  radial-gradient(60rem 40rem at 15% -10%, var(--primary-t6), transparent 70%),
  radial-gradient(50rem 35rem at 110% 30%, var(--accent-vivid-t6), transparent 70%), var(--canvas);
  background-size: 140% 140%; animation: drift 60s ease-in-out infinite alternate; }
@keyframes drift { from { background-position: 0% 0%; } to { background-position: 100% 60%; } }
:root[data-motion="vivid"] :focus-visible:not(.task-stage *):not(.q-scene *) { box-shadow: 0 0 0 4px var(--primary-t5), 0 0 18px var(--primary-t3); }

/* ---------- login ---------- */
:root { --font-quote: "Cormorant Garamond", "Literata", Georgia, serif; }
.login { display: flex; flex-direction: column; align-items: center; gap: var(--sp-6);
  padding: clamp(1.5rem, 5vh, 3.5rem) 0 var(--sp-5); }
.login-card { width: min(100%, 26rem); background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: var(--sp-6) clamp(1.2rem, 5vw, 2.4rem) var(--sp-5);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent), 0 18px 50px color-mix(in srgb, var(--primary) 14%, transparent); }
.login-hero { text-align: center; margin-bottom: var(--sp-5); }
.login-hero .mark { display: block; margin: 0 auto var(--sp-3); width: 112px; height: 112px; }
.login-name { font: 600 2.6rem/1 var(--font-read); letter-spacing: .01em; color: var(--ink); margin: 0 0 var(--sp-2); }
.login-sub { font: 400 var(--fs-m)/1.4 var(--font-read); color: var(--muted); margin: 0; }
.login-card form label { margin-top: var(--sp-3); }
.login-card form .actions button { width: 100%; }
.login-links { text-align: center; margin: var(--sp-4) 0 var(--sp-2); }
.login-intro-note { text-align: center; margin: 0; }
.login-motto { font: italic 500 clamp(1.35rem, 3.2vw, 1.7rem)/1.3 var(--font-quote); color: var(--deep); text-align: center;
  margin: 0; max-width: 34rem; }
.login-motto span { display: block; }
.login-motto .motto-2 { padding-left: 2.2em; }
.login-why { width: 100%; max-width: 40rem; text-align: center; }
.home-sec.login-why { max-width: 40rem; }
.is-login .topbar .logo { visibility: hidden; }
.why-ray { width: min(100%, 20rem); height: auto; display: block; margin: 0 auto var(--sp-4); }
.login-why h2 { font: 500 var(--fs-s)/1 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 var(--sp-4); }
.why-quote { margin: 0; padding: 0; border: 0; }
.why-quote p { font: italic 400 clamp(1.3rem, 2.6vw, 1.6rem)/1.55 var(--font-quote); color: var(--ink); margin: 0 0 var(--sp-4); }
.why-quote p:first-child::first-letter { font-size: 1.5em; color: var(--primary); }
.why-quote p:last-child { color: var(--deep); font-weight: 500; }
.login-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-s); color: var(--muted); }
.login-foot .credits { margin-left: auto; text-align: right; }
@media (max-width: 760px) { .login-foot .credits { margin-left: 0; text-align: left; } }

/* ---------- homepage (docs/ricerca/homepage.md): the login card on top,
   then what Prisma is, the journey, for whom, principles, why, questions */
.homenav { display: flex; gap: var(--sp-1); margin-right: auto; }
.homenav a { padding: .4rem .7rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: var(--fs-s); font-weight: 500; }
.homenav a:hover { color: var(--ink); background: var(--surface-2); }
.is-login .topbar .logo { display: none; }
@media (max-width: 760px) { .homenav { display: none; } }
.login-line { font: 400 var(--fs-s)/1.55 var(--font-ui); color: var(--muted); margin: var(--sp-3) auto 0; max-width: 21rem; }
.login-patient { margin: var(--sp-3) 0 0; padding-top: var(--sp-3); border-top: 1px solid var(--line); text-align: center;
  font-size: var(--fs-s); color: var(--ink); }
.home-more { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); text-decoration: none; font-size: var(--fs-s);
  font-weight: 500; padding: .4rem .8rem; border-radius: 999px; margin-top: calc(-1 * var(--sp-3)); }
.home-more:hover { color: var(--deep); background: var(--surface-2); }
.login { scroll-margin-top: 1rem; }
.home-sec { max-width: 46rem; margin: clamp(4.5rem, 12vw, 8rem) auto 0; scroll-margin-top: 2rem; }
.home-h, .login-why h2 { font: 500 var(--fs-s)/1 var(--font-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 var(--sp-5); }
.home-lead { font: 400 var(--fs-l)/1.65 var(--font-read); color: var(--ink); margin: 0 0 var(--sp-4); }
.home-status { margin: var(--sp-5) 0 0; padding: .1rem 0 .1rem var(--sp-4); border-left: 2px solid var(--primary-t3);
  color: var(--muted); font-size: var(--fs-s); }
.home-intro { color: var(--muted); max-width: 36rem; margin: 0 0 var(--sp-6); }
.home-sec.home-journey { max-width: 60rem; }
.home-journey > .home-h, .home-journey > .home-intro { max-width: 46rem; margin-left: auto; margin-right: auto; }
.home-journey > .home-intro { margin-bottom: var(--sp-6); }

/* the journey: two columns on one timeline of 9 rows, a connector where they meet */
.journey { display: grid; grid-template-columns: minmax(0, 1fr) clamp(2.5rem, 7vw, 5rem) minmax(0, 1fr);
  grid-template-rows: auto repeat(9, auto); position: relative; }
.jcol { display: contents; }
.jhead { font: 600 var(--fs-m)/1.3 var(--font-read); margin: 0 0 var(--sp-4); padding-left: 2.6rem; color: var(--deep); }
.jhead-clin { grid-column: 1; grid-row: 1; }
.jhead-pat { grid-column: 3; grid-row: 1; }
.jcol-clin > li { grid-column: 1; }
.jcol-pat > li { grid-column: 3; }
.jstep { position: relative; list-style: none; padding: 0 0 var(--sp-5) 2.6rem; z-index: 1; }
.jstep strong { display: block; font: 600 var(--fs-m)/1.35 var(--font-ui); color: var(--ink); margin-top: .1rem; }
.jstep p { margin: .25rem 0 0; font-size: var(--fs-s); line-height: 1.55; color: var(--muted); }
.jnum { position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--canvas); border: 1.5px solid var(--primary-t2); color: var(--deep); font: 600 .78rem/1 var(--font-ui); }
.jline { position: relative; width: 1px; justify-self: start; margin-left: .85rem; background: var(--line-strong); margin-bottom: var(--sp-5); }
.jl-clin { grid-column: 1; grid-row: 2 / 11; }
.jl-pat { grid-column: 3; grid-row: 4 / 11; }
.jmeet { grid-column: 2; align-self: start; margin-top: .85rem; height: 1px; background: var(--primary); position: relative; }
.jmeet::before, .jmeet::after { content: ""; position: absolute; top: -3.5px; width: 0; height: 0; border: 4px solid transparent; }
.jmeet.to-r::after, .jmeet.to-b::after { right: -1px; border-left: 6px solid var(--primary); border-right: 0; }
.jmeet.to-l::before, .jmeet.to-b::before { left: -1px; border-right: 6px solid var(--primary); border-left: 0; }
.r1 { grid-row: 2; } .r2 { grid-row: 3; } .r3 { grid-row: 4; } .r4 { grid-row: 5; } .r5 { grid-row: 6; }
.r6 { grid-row: 7; } .r7 { grid-row: 8; } .r8 { grid-row: 9; } .r9 { grid-row: 10; }
.jtabs { display: none; }
@media (max-width: 760px) {
  .journey { display: block; }
  .jcol { display: block; padding: 0; margin: 0 0 var(--sp-5); position: relative; }
  .jcol::before { content: ""; position: absolute; left: .85rem; top: .5rem; bottom: var(--sp-5); width: 1px; background: var(--line-strong); }
  .jline, .jmeet { display: none; }
  .has-jtabs .jhead { display: none; }
  .has-jtabs .jcol.jhide { display: none; }
  .jtabs { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 999px; width: max-content; max-width: 100%;
    margin: 0 0 var(--sp-5); }
  .jtabs[hidden] { display: none; }
  .jtabs button { min-height: 2.2rem; padding: .35rem 1rem; border-radius: 999px; border: 0; background: none; color: var(--muted); font-size: var(--fs-s); }
  .jtabs button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); }
}
.home-cam { max-width: 46rem; margin: var(--sp-5) auto 0; padding: var(--sp-4) var(--sp-5); border: 1px dashed var(--line-strong);
  border-radius: var(--radius-l); }
.home-cam h3 { font: 600 var(--fs-m)/1.3 var(--font-read); margin: 0 0 var(--sp-2); }
.home-cam p { margin: 0; font-size: var(--fs-s); color: var(--muted); }
.home-who { max-width: 60rem; }
.home-who > .home-h, .home-principles > .home-h { max-width: 46rem; margin-left: auto; margin-right: auto; }
.who-cards { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.who-card { padding-top: var(--sp-4); border-top: 2px solid var(--primary-t3); }
.who-card h3, .principle h3 { font: 600 var(--fs-m)/1.3 var(--font-read); margin: 0 0 var(--sp-2); color: var(--ink); }
.who-card p, .principle p { margin: 0; font-size: var(--fs-s); line-height: 1.6; color: var(--muted); }
.home-principles { max-width: 60rem; }
.principles { display: grid; gap: var(--sp-6) var(--sp-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.principle { padding-left: var(--sp-4); border-left: 2px solid var(--primary-t4); }
.home-faq .faq { border-bottom: 1px solid var(--line); }
.home-faq .faq:first-of-type { border-top: 1px solid var(--line); }
.faq > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: var(--sp-4); align-items: baseline;
  padding: var(--sp-4) 0; font-weight: 500; color: var(--ink); }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after { content: "+"; color: var(--primary); font: 400 1.3rem/1 var(--font-ui); flex: none; }
.faq[open] > summary::after { content: "\2212"; }
.faq > summary:hover { color: var(--deep); }
.faq p { margin: 0 0 var(--sp-4); color: var(--muted); max-width: 40rem; }
.home-crisis { max-width: 46rem; margin: clamp(3.5rem, 9vw, 5.5rem) auto 0; text-align: center; font-size: var(--fs-s); color: var(--ink); }
/* the shimmer of the logo is continuous: only at the vivid level */
:root[data-motion="vivid"] .login-hero .mark polygon:not(:last-of-type) { animation: shimmer 5s ease-in-out infinite; }
:root[data-motion="vivid"] .login-hero .mark polygon:nth-of-type(2) { animation-delay: .6s; }
:root[data-motion="vivid"] .login-hero .mark polygon:nth-of-type(3) { animation-delay: 1.2s; }
:root[data-motion="vivid"] .login-hero .mark polygon:nth-of-type(4) { animation-delay: 1.8s; }
@keyframes shimmer { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- report ---------- */
.sheet {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent), 0 8px 30px color-mix(in srgb, var(--primary) 8%, transparent);
  padding: clamp(1.2rem, 5vw, 3.5rem) clamp(1rem, 6vw, 4rem); max-width: 52rem; margin: 0 auto;
}
.report-view { font: 400 1rem/1.65 var(--font-read); }
.report-view h1 { font-size: var(--fs-2xl); margin: var(--sp-5) 0 var(--sp-4); }
.report-view h2 { font-size: var(--fs-l); margin: var(--sp-6) 0 var(--sp-3); color: var(--primary); }
.report-view h3 { font-size: var(--fs-m); margin: var(--sp-5) 0 var(--sp-2); }
.report-view table { font-family: var(--font-ui); font-size: .84rem; }
.report-view ul { padding-left: 1.2rem; }
.report-view li { margin: .25rem 0; }
.letterhead { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  border-bottom: 2px solid var(--primary); padding-bottom: var(--sp-3); margin-bottom: var(--sp-4); font: .9rem/1.45 var(--font-ui); }
.letterhead strong { font: 600 1.05rem var(--font-read); }
.letterhead .place { color: var(--muted); align-self: flex-end; }
.signature { display: flex; justify-content: space-between; margin-top: var(--sp-7); flex-wrap: wrap; gap: var(--sp-4); }
.signature .sign { text-align: right; min-width: 14rem; border-top: 1px solid var(--muted); padding-top: var(--sp-2); }
.rep-chart, .rep-table { margin: var(--sp-3) 0 var(--sp-5); break-inside: avoid; }
h4.tgroup { margin-top: var(--sp-5); color: var(--primary); font-size: .95rem; }
.editor { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: var(--sp-5); align-items: start; }
.editor .sheet { position: sticky; top: var(--sp-4); max-height: calc(100vh - 2rem); overflow: auto; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .editor .sheet { position: static; max-height: none; } }

/* ---------- motion: three levels (comfort panel, data-motion) ----------
   balanced (default): short movements in answer to an action, nothing
   continuous; quiet: none (also the default when the system asks for
   reduced motion); vivid: also the slow decorative effects. */
.reveal { animation: reveal .5s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ribbon circle { animation: dotin .6s var(--ease) both; }
@keyframes dotin { from { opacity: 0; } to { opacity: 1; } }
:root[data-motion="quiet"] *, :root[data-motion="quiet"] *::before, :root[data-motion="quiet"] *::after {
  transition: none !important; animation: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) *, :root:not([data-motion]) *::before, :root:not([data-motion]) *::after {
    transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */
@media print {
  .sidebar, .topbar, .subnav, .noprint, .actions { display: none !important; }
  .shell { display: block; }
  body { background: #fff; font-size: 10.5pt; }
  .content, .page { max-width: none; padding: 0; }
  .sheet { box-shadow: none; border: 0; padding: 0; max-width: none; background: #fff; }
  a { color: inherit; text-decoration: none; }
  h2, h3 { break-after: avoid; }
  figure { border: 0; padding: 0; }
  @page { size: A4; margin: 18mm 16mm; }
}

/* ---------- patient page: strip, tabs, info ---------- */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(7.4rem, 1fr); gap: var(--sp-3); margin: var(--sp-5) 0;
  overflow-x: auto; padding-bottom: var(--sp-1); scroll-snap-type: x proximity; scrollbar-width: thin; }
.tile { scroll-snap-align: start; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-l);
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--primary-t3); text-decoration: none; color: var(--ink);
  transition: border-color .15s var(--ease), transform .15s var(--ease); }
.tile:hover { border-color: var(--primary-t3); color: var(--ink); }
.tile .tv { font: 600 2.1rem/1.05 var(--font-read); font-variant-numeric: lining-nums tabular-nums; margin: 2px 0; }
.tile { position: relative; }
.tile .tl { font-weight: 600; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .ts { white-space: nowrap; }
.tile .tag { font-size: .7rem; font-weight: 700; color: var(--accent); background: var(--accent-vivid-t5); border-radius: 999px; padding: .08rem .4rem; }
.tile .ts { font-size: var(--fs-xs); color: var(--muted); }
.tile.high { border-top-color: var(--accent-vivid); background: color-mix(in srgb, var(--accent-vivid-t6) 55%, var(--surface)); }
.tile.high .tv { color: var(--accent); }
.tile.low { border-top-color: var(--primary-t4); }
.tile.score { border-top-color: var(--primary); }
.tile.score .tv { color: var(--deep); }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line-strong); margin: var(--sp-4) 0 var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .7rem 1.1rem; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--deep); border-bottom-color: var(--primary); }
.info { display: inline-block; position: relative; vertical-align: middle; font: 400 var(--fs-s)/1.45 var(--font-ui); }
.info > summary { list-style: none; cursor: pointer; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1.5px solid var(--primary-t3);
  color: var(--primary); font: 700 .72rem/1.05rem var(--font-read); text-align: center; font-style: italic; }
.info > summary::-webkit-details-marker { display: none; }
.info[open] > summary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.info-pop { position: absolute; z-index: 25; left: 50%; transform: translateX(-50%); top: calc(100% + .45rem); width: min(22rem, 80vw);
  padding: var(--sp-3) var(--sp-4); background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: var(--radius-l); box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 14%, transparent); font-weight: 400; }
h2 .info, h3 .info { margin-left: .3rem; }
.info-block { margin-top: var(--sp-6); font-size: .95rem; }
.info-block > summary { cursor: pointer; color: var(--muted); }
.info-block[open] > summary { margin-bottom: var(--sp-2); }
.gen { margin-top: var(--sp-6); font: 400 var(--fs-xs) var(--font-ui); color: var(--muted); text-align: right; }
.printbar { position: sticky; top: 0; z-index: 10; display: flex; gap: var(--sp-3); align-items: center; justify-content: center;
  padding: var(--sp-3); background: color-mix(in srgb, var(--canvas) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }

.scrollfig { overflow-x: auto; }
.scrollfig svg.chart { min-width: 34rem; }
.flag-item { border-left: 3px solid var(--accent-vivid); background: var(--accent-vivid-t6); border-radius: 0 var(--radius) var(--radius) 0;
  padding: .6rem .9rem; margin: var(--sp-2) 0; }
.flag-item.info { border-left-color: var(--primary-t3); background: var(--surface-2); }
.flag-item > summary { cursor: pointer; font-weight: 600; }
.flag-item p { margin: var(--sp-2) 0 0; font-size: .92rem; }

/* patient cards */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--sp-4); }
.pcard { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-4) var(--sp-5); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-l); text-decoration: none; color: var(--ink); min-height: 11rem;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.pcard:hover { border-color: var(--primary-t3); color: var(--ink); box-shadow: 0 6px 22px color-mix(in srgb, var(--primary) 10%, transparent); }
.pc-code { font: 600 1.35rem/1.15 var(--font-read); color: var(--deep); }
.pc-name { color: var(--ink); }
.pc-meta { font-size: var(--fs-s); color: var(--muted); }
.pc-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-2); }
.pc-foot { margin-top: auto; display: flex; justify-content: space-between; font-size: var(--fs-s); color: var(--muted);
  padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.pc-foot strong { color: var(--ink); }
.pcard-new { align-items: center; justify-content: center; border-style: dashed; color: var(--primary); font-weight: 600; background: transparent; }
.pcard-new .plus { font: 300 2.2rem/1 var(--font-read); }

.newbattery { margin-top: var(--sp-5); }
.newbattery > summary { list-style: none; width: max-content; }
.newbattery > summary::-webkit-details-marker { display: none; }
.newbattery[open] > summary { margin-bottom: var(--sp-4); background: transparent; color: var(--primary); border-color: var(--line-strong); }
.newbattery .split { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.checkcols { columns: 2 18rem; column-gap: var(--sp-5); }
.checkcols label { break-inside: avoid; }
@media (max-width: 960px) { .newbattery .split { grid-template-columns: 1fr; } }
.editor > * { min-width: 0; }
.editor .sheet { overflow-x: auto; }
.report-view th, .report-view td { padding: .4rem .5rem; }
table.scores select[name$=".norms"], table.scores input[name$=".norms"] { min-width: 16rem; }
table.scores select[name$=".interp"], table.scores select[name$=".present"], table.scores select[name$=".validity"] { min-width: 10rem; }
table.scores input[name$=".name"] { min-width: 12rem; }

input[type=date] { max-width: 16rem; }

/* stacked tables on phones: each row becomes a card, each cell shows its column label */
table.scores th.rowhead { font-weight: 500; color: var(--ink); font-size: .92rem; text-align: left; position: sticky; left: 0; background: var(--canvas); z-index: 1; min-width: 13rem; }
@media (max-width: 640px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td, table.stack th.rowhead { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); padding: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-3); }
  table.stack tbody tr:hover td { background: none; }
  table.stack td { overflow-wrap: anywhere; border: 0; padding: .3rem 0; display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--sp-3); align-items: center; text-align: left; }
  table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-s); }
  table.stack td:not([data-label]) { display: block; }
  table.stack td.num { text-align: left; }
  table.stack th.rowhead { position: static; border: 0; padding: .3rem 0 .5rem; font-weight: 600; font-family: var(--font-read); font-size: 1rem; min-width: 0; }
  table.scores input, table.scores select { min-width: 0 !important; width: 100%; }
  .tablewrap:has(table.stack) { overflow: visible; }
}

/* in-clinic administration */
.administer fieldset.items { padding-top: 0; }
.administer .intro-lead { font-size: var(--fs-m); margin-top: var(--sp-3); }
.savebar { position: sticky; bottom: 0; z-index: 6; display: flex; justify-content: flex-end; gap: var(--sp-3);
  margin: var(--sp-5) calc(-1 * clamp(16px, 4vw, 2.5rem)) 0; padding: var(--sp-3) clamp(16px, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--canvas) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }
.administer.compact .q-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-4); align-items: center; padding: var(--sp-2) 0; }
.administer.compact .q-text { font: 400 .98rem/1.4 var(--font-ui); margin: 0; }
.administer.compact .q-opts label { min-height: 2.3rem; padding: .3rem .8rem; }
.administer.compact .q-section { font-size: var(--fs-m); margin-top: var(--sp-5); }
@media (max-width: 640px) { .administer.compact .q-item { grid-template-columns: 1fr; } .administer.compact .q-opts { flex-direction: row; } .administer.compact .q-opts label { width: auto; } }

/* instrument catalogue */
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.fchip { min-height: 0; padding: .4rem .8rem; border-radius: 999px; font-size: var(--fs-s); font-weight: 500;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.fchip:hover { background: var(--surface-2); color: var(--ink); border-color: var(--primary-t3); }
.fchip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.icards { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--sp-4); }
.icard { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-l); text-decoration: none; color: var(--ink); transition: border-color .15s var(--ease); }
.icard:hover { border-color: var(--primary-t3); color: var(--ink); }
.icard[hidden] { display: none; }
.ic-top { display: flex; justify-content: space-between; align-items: center; }
.ic-short { font: 600 1.1rem var(--font-read); color: var(--deep); }
.ic-name { font-size: .92rem; line-height: 1.35; }
.ic-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: auto; }
.ic-domain { font-size: var(--fs-xs); color: var(--muted); }
.facts-list { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); gap: var(--sp-3) var(--sp-5); margin: 0; }
.facts-list dt { color: var(--muted); font-size: var(--fs-s); }
.facts-list dd { margin: 0; overflow-wrap: anywhere; }
.en-note > summary { cursor: pointer; color: var(--primary); font-size: var(--fs-s); }
.wide-ish { max-width: 58rem; }
@media (max-width: 640px) { .facts-list { grid-template-columns: 1fr; gap: var(--sp-1); } .facts-list dd { margin-bottom: var(--sp-3); } }

/* visual report editor */
.ed-toolbar { position: sticky; top: 3.6rem; z-index: 8; display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; justify-content: center;
  max-width: 52rem; margin: 0 auto var(--sp-3); padding: var(--sp-2); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-l); box-shadow: 0 4px 16px color-mix(in srgb, var(--ink) 8%, transparent); }
.ed-toolbar select { width: auto; min-height: 2rem; padding-top: .3rem; padding-bottom: .3rem; font-size: var(--fs-s); }
.ed-sep { width: 1px; height: 1.4rem; background: var(--line-strong); margin: 0 var(--sp-1); }
.editable { outline: none; counter-reset: sec; }
.editable:focus-visible { box-shadow: 0 0 0 3px var(--primary-t6); }
.editable h2 { counter-increment: sec; counter-reset: sub; }
.editable h2::before { content: counter(sec) ". "; }
.editable h3 { counter-increment: sub; }
.editable h3::before { content: counter(sec) "." counter(sub) " "; }
.editable p:empty::before { content: "\200b"; }
.rep-block { position: relative; margin: var(--sp-3) calc(-1 * var(--sp-3)); padding: var(--sp-2) var(--sp-3); border: 1px dashed transparent;
  border-radius: var(--radius); user-select: none; }
.rep-block:hover, .rep-block:focus-within { border-color: var(--primary-t3); background: color-mix(in srgb, var(--primary-t6) 35%, transparent); }
.blk-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); font: 500 var(--fs-xs) var(--font-ui);
  color: var(--muted); opacity: 0; transition: opacity .15s var(--ease); margin-bottom: var(--sp-1); }
.rep-block:hover .blk-bar, .rep-block:focus-within .blk-bar { opacity: 1; }
.blk-tools { display: inline-flex; gap: 4px; }
.blk-tools button { min-height: 0; width: 1.8rem; height: 1.8rem; padding: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); font-size: .85rem; }
.blk-tools button:hover { background: var(--primary); color: var(--on-primary); }
@media (hover: none) { .blk-bar { opacity: 1; } }
#ed-source textarea { max-width: 52rem; margin: 0 auto; display: block; }

.replist { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.repitem { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.repname { font: 600 1.05rem var(--font-read); text-decoration: none; }
.repacts { margin-left: auto; display: flex; gap: var(--sp-2); }

input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-cancel-button { filter: grayscale(1); }
.morebtn { display: none; }
@media (max-width: 640px) {
  .tabs { flex-wrap: wrap; gap: 0; }
  .tabs a { flex: 1 1 auto; text-align: center; padding: .6rem .5rem; font-size: .92rem; }
  table.stack td.more { display: none; }
  table.stack tr.open td.more { display: grid; }
  .morebtn { display: block; margin-top: var(--sp-1); font: 500 var(--fs-s) var(--font-ui); color: var(--primary); }
}

/* battery picker: one block per battery with its plan */
.battery { border-top: 1px solid var(--line); padding: var(--sp-2) 0; }
.battery:first-of-type { border-top: 0; }
.battery details.plan > summary { cursor: pointer; margin: .2rem 0 0 1.9rem; }
.battery ol.planlist { margin: .4rem 0 .4rem 1.9rem; padding-left: 1.2rem; font-size: .92rem; }
.battery ol.planlist li { display: list-item; margin: .15rem 0; padding: 0; border: 0; line-height: 1.4; }
.battery ol.planlist li .chip { padding: .12rem .4rem; margin-right: .2rem; }
.battery ol.planlist li .meta { display: inline; }
.battery ol.planlist li.optional { opacity: .78; }
.battery > .linkbtn { margin-left: 1.9rem; }
.addinstr { margin-top: var(--sp-3); gap: .5rem; }
.addinstr select:first-of-type { min-width: 0; flex: 1 1 16rem; }
.mailform h2 { margin-top: 0; }
.docform { margin-top: var(--sp-3); }

/* ---------- criteria and differential (PESAD, decision support) ---------- */
.criteria .crit-disclaimer { border-left: 3px solid var(--accent-vivid); background: var(--accent-vivid-t6); padding: .55rem .9rem;
  border-radius: 0 var(--radius) var(--radius) 0; font-size: var(--fs-s); }
.crit-form { gap: var(--sp-3); align-items: center; }
.crit-form .crit-check { display: inline-flex; gap: .4rem; align-items: center; font-size: var(--fs-s); color: var(--muted); }
.crit-stamp { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-4); }
.crit-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items: start; margin-top: var(--sp-4); }
.crit-card { background: var(--canvas); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  border-radius: 0 var(--radius-l) var(--radius-l) 0; padding: var(--sp-4); min-width: 0; }
.crit-card.st-present { border-left-color: var(--primary); }
.crit-card.st-undetermined { border-left-color: var(--accent-vivid); }
.crit-card.st-absent { border-left-color: var(--ink-t3); }
.crit-head { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: flex-start; }
.crit-head h4 { margin: 0; font-size: var(--fs-m); }
.crit-head .codes { margin-top: .15rem; font-variant-numeric: tabular-nums; }
.chip.st { flex: none; white-space: nowrap; }
.chip.st-present { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip.st-undetermined { border-color: var(--accent-vivid-t2); color: var(--accent); background: var(--accent-vivid-t6); }
.chip.st-absent { color: var(--muted); }
.cbar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); margin: var(--sp-3) 0 .3rem; overflow: hidden; }
.cbar .hi, .cbar .lo { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.cbar .hi { background: repeating-linear-gradient(-45deg, var(--primary-t2) 0 4px, var(--primary-t4) 4px 8px); }
.cbar .lo { background: var(--primary); }
.cbar .thr { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .55; }
.cbar-legend { margin: 0 0 var(--sp-3); }
.checklist { list-style: none; margin: 0; padding: 0; font-size: var(--fs-s); }
.checklist li { display: grid; grid-template-columns: 1.2rem minmax(0, 1fr) auto; gap: .4rem; padding: .3rem 0; border-top: 1px solid var(--line); align-items: baseline; }
.checklist li.lvl4 { padding-left: 1rem; }
.checklist li.lvl5 { padding-left: 2rem; }
.checklist .mark { font-weight: 700; text-align: center; }
.checklist .cs-label { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.checklist .cs-met .mark, .checklist .cs-met .cs-label { color: var(--primary); }
.checklist .cs-not_met .mark { color: var(--accent2); }
.checklist .cs-unknown .mark, .checklist .cs-unknown .cs-label { color: var(--accent); }
.checklist .cs-not_assessed { color: var(--muted); }
.crit-card h5 { font: 600 var(--fs-s)/1.3 var(--font-ui); margin: var(--sp-4) 0 var(--sp-2); color: var(--ink); }
.crit-missing ul { margin: 0; padding-left: 1.1rem; font-size: var(--fs-s); }
.crit-missing li { margin-bottom: .35rem; }
.crit-missing .srcs { display: inline-flex; flex-wrap: wrap; gap: .25rem; margin-left: .2rem; }
.crit-missing .srcs .chip, .crit-diff .chip { font-size: var(--fs-xs); padding: .1rem .45rem; text-decoration: none; }
.crit-diff .chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.crit-more { margin-top: var(--sp-3); font-size: var(--fs-s); }
.crit-more > summary { cursor: pointer; color: var(--primary); }
.variants { list-style: none; padding: 0; margin: var(--sp-2) 0 0; }
.variants li { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: space-between; padding: .25rem 0; border-top: 1px solid var(--line); }
.variants li > span:first-child { flex: 1 1 12rem; min-width: 0; }
.ptree, .ptree ul { list-style: none; margin: 0; padding-left: .9rem; border-left: 1px solid var(--line); }
.ptree { padding-left: .5rem; margin-top: var(--sp-2); }
.ptree li { padding: .15rem 0; overflow-wrap: anywhere; }
.crit-section { margin-top: var(--sp-5); }
.crit-section > summary { cursor: pointer; list-style: none; }
.crit-section > summary::-webkit-details-marker { display: none; }
.crit-section > summary h4 { display: inline; margin: 0; }
.crit-section > summary::before { content: "▸ "; color: var(--primary); }
.crit-section[open] > summary::before { content: "▾ "; }
.crit-engine { margin-top: var(--sp-4); }
.criteria code { font-size: var(--fs-xs); overflow-wrap: anywhere; }
@media (max-width: 640px) { .crit-head { flex-direction: column; gap: var(--sp-2); } .crit-form select { width: 100%; } }
.crit-sub { margin: var(--sp-6) 0 var(--sp-3); }
.crit-rows { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.crit-row { padding: var(--sp-3) var(--sp-4); }
.crit-row > summary { cursor: pointer; list-style: none; }
.crit-row > summary::-webkit-details-marker { display: none; }
.crit-row .crit-name { font: 600 var(--fs-s)/1.3 var(--font-read); }
.crit-row .cbar { height: 6px; margin: var(--sp-2) 0 .2rem; }
.crit-row .cbar-legend { margin: 0; font-size: var(--fs-xs); }
.crit-row[open] { grid-column: 1 / -1; }
.crit-row[open] > summary { margin-bottom: var(--sp-3); }
.crit-row > summary .crit-name::after { content: " ▸"; color: var(--primary); }
.crit-row[open] > summary .crit-name::after { content: " ▾"; }
.crit-grid > :only-child { grid-column: 1 / -1; }
.crit-diff .chip, .crit-missing .srcs .chip { white-space: normal; max-width: 100%; }
@media (max-width: 640px) {
  .checklist li { grid-template-columns: 1.2rem minmax(0, 1fr); row-gap: 0; }
  .checklist .cs-label { grid-column: 2; }
}
.crit-diff .chip { border-radius: var(--radius); line-height: 1.25; }

/* optional webcam module and consents ------------------------------------- */
.consent-text h3 { font-size: 1rem; margin: var(--sp-4) 0 var(--sp-1); }
.consent-text h3:first-child { margin-top: 0; }
.consent-text p { margin: 0; }
.consent-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-3); }
.consent-actions button { min-height: 3rem; }
.optional-card { margin-top: var(--sp-5); }
.optional-card h3 { margin: 0 0 var(--sp-2); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.motion-hidden { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; z-index: -1; }
/* framing check: only the landmarks, on a dark canvas (motion_mesh.js) */
.motion-check { max-width: 40rem; }
.motion-mesh { width: min(30rem, 88vw); aspect-ratio: 4 / 3; margin: var(--sp-3) auto var(--sp-2); border-radius: var(--radius-l);
  overflow: hidden; background: #07060c; border: 1px solid var(--primary-t3); box-shadow: 0 0 2.5rem -1rem var(--primary); }
.motion-mesh canvas { width: 100%; height: 100%; display: block; }
.motion-private { font-size: .85rem; color: var(--muted); margin: 0 0 var(--sp-2); }
.motion-tip { font-weight: 600; color: var(--accent); margin: var(--sp-2) 0; min-height: 1.5em; }
.motion-tip.ok { color: var(--deep); }
.motion-list li.warn strong { color: var(--accent); }
.motion-list li.ok strong { color: var(--deep); }
.motion-hint { position: absolute; bottom: 12%; left: 0; right: 0; text-align: center; color: var(--muted); }
.motion-pill { position: fixed; top: .6rem; right: .6rem; z-index: 60; display: flex; align-items: center; gap: .5rem;
  padding: .3rem .7rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .8rem; color: var(--muted); }
.motion-pill .rec { width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent-vivid); }
.motion-pill.off { color: var(--ink); }
.motion-pill .linkbtn { font-size: .8rem; }
.motion-switch { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin: var(--sp-4) 0 0; padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--line); border-radius: var(--radius-l); }
.motion-panel + .motion-panel { margin-top: var(--sp-4); }
.mv-replay { margin: var(--sp-5) 0; }
.mv-replay h3 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.mv-replay-stage { border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; background: var(--surface); }
.mv-replay-stage canvas { display: block; width: 100%; }
.mv-replay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin: var(--sp-2) 0; }
.mv-replay-bar input[type=range] { flex: 1 1 12rem; accent-color: var(--primary); }
.mv-replay-bar select { width: auto; }
.mv-quality { margin: var(--sp-3) 0; }
.consent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.consent-item { display: flex; flex-direction: column; gap: var(--sp-2); }
@media (max-width: 720px) { .consent-grid { grid-template-columns: 1fr; } }

/* personal area of the patient (/me) and the sharing panel */
.me .me-rec { border-top: 1px solid var(--line); padding-top: var(--sp-5); margin-top: var(--sp-6); }
.me .me-rec:first-of-type { border-top: 0; }
.me .me-org { margin-bottom: var(--sp-2); }
.me .me-battery + .me-battery { margin-top: var(--sp-5); }
.me .lock { vertical-align: -2px; }
.me-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); }
.me-list li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: baseline; }
.me-answers { padding-left: 1.4rem; }
.me-answers li { margin: 0 0 var(--sp-2); }
.me-answers strong { display: block; font-weight: 600; }
.me-note, .me-dx { margin: var(--sp-4) 0; }
label.check { display: flex; gap: var(--sp-2); align-items: flex-start; color: var(--ink); font-weight: 400; font-size: var(--fs-m, 1rem); }
label.check input { width: auto; margin-top: .25rem; }
.release { margin-top: var(--sp-6); }
code.wrap { word-break: break-all; }
.me-note > h2, .me-dx > h2 { margin-top: 0; }
.me .me-data { border-top: 0; }
.home-journey .paths { max-width: 60rem; margin: 0 auto var(--sp-4); }
.home-journey .paths .chip { font: 500 var(--fs-xs, .75rem) var(--font-ui, inherit); vertical-align: 2px; margin-left: var(--sp-1); }
.home-journey .paths .soon { border-top-style: dashed; }
.home-journey > .paths-note { font-size: var(--fs-s); margin-bottom: var(--sp-6); }
/* prototype notice for clinicians: fixed at the bottom, small, never over the content */
.proto-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; padding: .3rem 16px;
  font-size: var(--fs-xs); text-align: center; color: var(--muted); background: var(--surface-2);
  border-top: 1px solid var(--line); }
body:has(.proto-banner) { padding-bottom: 2rem; }
@media print { .proto-banner { display: none; } }
