/* CPIS intake — stylesheet. Apollo Health clinical identity (SEI-74).
   Presentation layer only: a Claude design pass iterates HERE, against the
   running app, without touching the handlers or the gate.

   Ported from the CPIS Clinical Design System (design/cpis-design-system/
   foundations/tokens.css — the canonical source). Identity: warm luxury
   medical-spa — copper / rose-gold on warm cream, echoing apollohealthdoc.com.
   Tablet-first; accessibility bar for patients 40+ (18px base, >=4.5:1 contrast,
   >=56px touch targets, visible focus, error never by color alone). System-font
   stack (no external fetch = offline/HIPAA safe); serif display echoes the
   APOLLO wordmark. */

:root {
  /* Apollo copper on cream */
  --bg: #F4EDE4;              /* warm cream */
  --card: #FCFAF7;            /* warm white surface */
  --fg: #2A211A;             /* warm espresso ink (~12:1 on cream) */
  --muted: #6B5D50;          /* warm taupe — secondary/help (~5:1) */
  --accent: #97552F;         /* deepened bronze — actions/links (white text ~6.5:1) */
  --accent-strong: #7A4326;  /* focus / active / hover */
  --accent-ink: #ffffff;
  --copper: #B16E47;         /* true brand copper — accents, active borders */
  --tint: #F3E6DB;           /* copper wash — selected/hover surfaces */
  --tint-strong: #E7D0BE;
  --ok: #4E7A3E;             /* complete / affirmed */
  --flag: #B23A2E;           /* red-flag / error (warm) */
  --flag-tint: #F7E4DF;
  --border: #E3D8CA;
  --border-strong: #CBB9A6;

  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --radius: 12px;
  --radius-lg: 16px;
  --touch: 46px;             /* C9 (2026-09-25): shrunk from 56px so tablet controls
                                take ~25% less vertical space (less scrolling); still
                                at/above the WCAG 44px tap-target floor */
  --shadow: 0 1px 2px rgba(42,33,26,.06), 0 4px 16px rgba(42,33,26,.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1.125rem;       /* 18px base for 40+ legibility */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2.125rem;
  line-height: 1.1;
  margin: .25rem 0 1.25rem;
  text-wrap: balance;
}
h2 { font-size: 1.375rem; font-weight: 700; margin: 1.5rem 0 .5rem; }

p { color: var(--muted); }

/* Each section is a card. */
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .9rem 1.15rem 1.1rem;   /* C9: was 1.15rem 1.4rem 1.4rem */
  margin: 0 0 1.1rem;              /* C9: was 1.4rem */
  background: var(--card);
  box-shadow: var(--shadow);
}
legend {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.2rem;               /* C9: was 1.4rem */
  padding: 0 .5rem;
  color: var(--fg);
}
fieldset > p em { color: var(--muted); font-style: italic; }

.field {
  margin: .8rem 0;                 /* C9: was 1.1rem */
  display: flex;
  flex-direction: column;
  gap: .42rem;                     /* C9: was .55rem */
}
.field > label { font-weight: 600; font-size: 1.1rem; color: var(--fg); }  /* C9: was 1.25rem */

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
textarea,
select {
  font: inherit;
  font-size: 1.0625rem;            /* C9: was 1.125rem */
  min-height: var(--touch);
  padding: .55rem .9rem;           /* C9: was .8rem 1rem */
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  width: 100%;
  background: var(--card);
  color: var(--fg);
}
input::placeholder, textarea::placeholder { color: #A9998A; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--tint-strong);
}
textarea { min-height: 7rem; resize: vertical; padding-top: .9rem; }

/* C5 (2026-09-25): tablet-typeable date. `<input type=date>` alone was unusable
   on a tablet (calendar-only, can't type). The masked MM/DD/YYYY text box is now
   the PRIMARY, full-width control; the native picker sits beside it as a SMALL
   optional companion (tap the calendar icon) — deliberately not the main path. */
.date-field { display: flex; align-items: stretch; gap: .5rem; }
.date-field .date-mask { flex: 1 1 auto; width: auto; }
.date-field .date-picker {
  flex: 0 0 auto;
  width: 3.25rem;
  padding: 0 .4rem;
}
/* Collapse the picker's own mm/dd/yyyy text so only the calendar icon shows —
   the typed box carries the value; the picker is just a shortcut. */
.date-field .date-picker::-webkit-datetime-edit { display: none; }
.date-field .date-picker::-webkit-calendar-picker-indicator { opacity: 1; margin: 0; }

/* Boolean + multi-select checkbox rows: large, tappable, copper when checked. */
.field label:has(input[type="checkbox"]),
.field label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: .7rem;                      /* C9: was .85rem */
  min-height: var(--touch);
  padding: 0 .95rem;               /* C9: was 0 1.1rem */
  margin-top: .35rem;              /* C9: was .5rem */
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-weight: 400;
  cursor: pointer;
}
.field label:has(input:checked) {
  border-color: var(--copper);
  background: var(--tint);
}
/* Yes/No booleans sit side-by-side, sized to content (not full-width rows). */
.field .yn-pair { display: flex; gap: 1rem; flex-wrap: wrap; }
.field .yn-pair label { flex: 0 0 auto; min-width: 6rem; justify-content: center; }
input[type="checkbox"], input[type="radio"] {
  width: 1.2rem;                   /* C9: was 1.5rem */
  height: 1.2rem;                  /* C9: was 1.5rem */
  accent-color: var(--accent);
  flex: 0 0 auto;
}

/* SEI-215 — drawn/touchscreen signature pad. Patient TYPES their name (identity /
   name-match) AND draws their signature; both required. */
.sign-block { margin-top: .3rem; }
.sign-pad { margin-top: 1rem; }
.sign-label { font-weight: 600; font-size: 1.1rem; margin: 0 0 .5rem; color: var(--fg); }
.sign-error { color: var(--danger, #B3261E); font-size: 1rem; margin: .5rem 0 0; }
.sign-canvas-wrap {
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius, 10px);
  background: #fff;
  touch-action: none;              /* let the canvas own touch drags (no scroll) */
}
.sign-canvas { display: block; width: 100%; height: 180px; border-radius: inherit; background: #fff; cursor: crosshair; }
.sign-actions { display: flex; gap: 1rem; align-items: center; margin-top: .6rem; flex-wrap: wrap; }
.sign-clear {
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  min-height: var(--touch);
  padding: .5rem 1.2rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius, 10px);
  background: var(--card, #fff);
  /* Readable dark text at rest — the global `button` rule sets a light accent ink
     meant for the dark accent background, which was invisible on this light button
     until hover darkened it (physician 2026-10-02). */
  color: var(--fg);
  cursor: pointer;
}
.sign-clear:hover { background: var(--tint); border-color: var(--copper); color: var(--fg); }
.sign-hint { color: var(--muted); font-size: .95rem; margin: .5rem 0 0; }

progress {
  width: 100%;
  height: .6rem;
  margin-bottom: 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  accent-color: var(--copper);
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--copper); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--copper); border-radius: 999px; }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

button {
  font: inherit;
  font-size: 1.1875rem;
  font-weight: 700;
  padding: 0 1.75rem;
  min-height: var(--touch);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
button:hover { background: var(--accent-strong); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tint-strong), 0 0 0 5px var(--accent-strong); }

/* Back is an <a> in .actions — render it as a quiet ghost button. */
.actions a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 1.5rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
}
.actions a:hover { background: var(--tint); border-color: var(--copper); }

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

/* Confirmation summary table (Consent Validity Engine). */
table { border-collapse: collapse; width: 100%; margin-top: .75rem; font-size: 1rem; }
th, td { text-align: left; padding: .6rem .75rem; border: 1px solid var(--border); }
th { background: var(--tint); color: var(--accent-strong); font-weight: 700; }
code { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .9em;
  background: var(--tint); color: var(--accent-strong); padding: 1px 6px; border-radius: 5px; }

/* A consent already on file for the current version (engine-driven). */
.on-file .onfile-note {
  color: #33632A;
  background: #EAF1E5;
  border: 1px solid #CADEBE;
  border-left: 5px solid var(--ok);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin: 0;
  font-weight: 600;
}

/* SEI-150 — attestation name-match gate. Never by color alone: the mismatch
   state also carries the ✗ text in .field-error, and disables Next/Finish. */
input.attest-input.mismatch {
  border-color: var(--flag);
  background: var(--flag-tint);
}
.field-error {
  color: var(--flag);
  font-weight: 600;
  font-size: .95rem;
  margin: -.3rem 0 0;
}
button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Wizard stepper (numbered circles + connecting bars). Scrolls in its own
   container if a form has many sections, so the page never scrolls sideways. */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: .5rem;
  overflow-x: auto;
}
.step {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--card);
  border: 2px solid var(--border-strong);
  color: var(--muted);
}
.step.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.now  { background: var(--accent); border-color: var(--accent); color: #fff; }
.bar { flex: 1 0 12px; height: 3px; background: var(--border); border-radius: 2px; }
.bar.done { background: var(--ok); }
.stepcap { color: var(--muted); font-size: 1rem; margin: 0 0 .6rem; }
/* Selena 2026-09-30: the patient's on-file name banner atop each wizard step. */
.patient-name-banner {
  margin: 0 0 1.4rem;
  padding: .55rem .8rem;
  background: var(--tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: .95rem;
}
.patient-name-banner strong { font-weight: 700; }

/* Start / welcome card */
.start {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  max-width: 560px;
}
.start-lede { color: var(--fg); font-size: 1.2rem; margin: 0 0 1rem; }
.start-reassure { color: var(--muted); margin: 0 0 1.5rem; }
.btn-block { width: 100%; }

/* Confirmation hero */
.done-hero { text-align: center; padding: 1rem 0 1.5rem; }
.done-hero .tick {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #EAF1E5;
  border: 2px solid #CADEBE;
  color: var(--ok);
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: .75rem;
}
.done-h { font-family: var(--font-serif); font-size: 1.9rem; margin: 0 0 .25rem; }
.done-hero p { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 480px) {
  .container { padding: 1.25rem .9rem 3rem; }
  h1 { font-size: 1.85rem; }
}

/* Provider Case-Card lens (SEI-144). A separate, centered read-only card —
   not the patient wizard's .container — ported from design/cpis-design-
   system/components/lens-card.html onto the copper tokens above (no
   duplicate --c-* variables). */
body.lens-body { padding: 1.75rem 1rem 4rem; }

.lens {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(42,33,26,.06), 0 6px 22px rgba(42,33,26,.07);
  overflow: hidden;
}
/* Everything below is scoped as a descendant of .lens, so these short class
   names (.hdr, .name, .reason, .qa, ...) can never collide with a future
   patient-wizard page on this shared stylesheet. */
.lens .ro {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--tint);
  color: var(--accent-strong);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
}
.lens .hdr { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.lens .hdr-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem 1.5rem; flex-wrap: wrap;
}
.lens .name { font-family: var(--font-serif); font-size: 1.875rem; font-weight: 700; margin: 0; }
.lens .idrow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  color: var(--muted);
  font-size: 1rem;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.lens .idrow b { color: var(--fg); font-weight: 600; }
.lens .packet-dl {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  min-height: 44px; padding: 8px 18px; box-sizing: border-box;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font-weight: 600; border-radius: var(--radius);
}
.lens .hdr-top .packet-dl { margin-top: 0; flex: 0 0 auto; }
.lens .hdr-top { gap: 10px 12px; }
.lens .consents-dl { background: var(--card); color: var(--accent-strong); border: 1.5px solid var(--accent); }
.lens .consents-dl:hover { background: var(--tint); }
.lens .packet-dl:hover { background: var(--accent-strong); }
.lens .packet-dl:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.lens .body { padding: 20px 24px 26px; display: flex; flex-direction: column; gap: 20px; }
.lens .reason {
  background: var(--tint);
  border: 1px solid var(--tint-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.lens .reason .k {
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 4px;
}
.lens .reason .v { font-size: 1.25rem; font-weight: 600; }
.lens .flags {
  border: 1.5px solid var(--flag);
  background: var(--flag-tint);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.lens .flags .k { display: flex; align-items: center; gap: 8px; color: var(--flag); font-weight: 700; font-size: 1.0625rem; margin-bottom: 8px; }
.lens .flags .ic {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--flag);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .9rem;
  font-weight: 700;
}
.lens .flags ul { margin: 0; padding-left: 2px; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.lens .flags li { font-weight: 600; }
.lens .flags li::before { content: "•"; color: var(--flag); font-weight: 700; margin-right: 8px; }
.lens .grp .gh {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin: 0 0 8px;
}
.lens .qa { display: grid; grid-template-columns: 1fr; gap: 0; }
.lens .qa .pair { display: flex; justify-content: space-between; gap: 20px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.lens .qa .pair:last-child { border-bottom: 0; }
.lens .qa .q { color: var(--muted); }
.lens .qa .an { font-weight: 600; text-align: right; }

/* Provider worklist (SEI-152) — the `GET /` index of recent locked sessions.
   A titled card of rows, not the plain <ul> v0 shipped with; same copper-on-
   cream identity as .lens, scoped as a descendant of .worklist so these short
   class names (.wl-row, .wl-name, ...) can't collide with the patient
   wizard's .field/.actions on this shared stylesheet. Rows are full-width
   tap targets (each row IS the <a> to the lens), sized well above --touch. */
.worklist {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.worklist .wl-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  min-height: var(--touch);
  border-bottom: 1px solid var(--border);
}
.worklist .wl-row:last-child { border-bottom: 0; }
/* SEI-189 — the download list carries two extra cells (Download link +
   transfer action) beyond the worklist's 3, so give it its own column track. */
/* The compliance archive carries two extra cells (grouped download links +
   transfer action) beyond the worklist's three, so it needs a wider frame than
   the 760px worklist or the last column clips (physician 2026-09-30). */
.worklist.dl-list { max-width: 900px; }
.worklist.dl-list .wl-row { grid-template-columns: minmax(220px, 1fr) auto auto auto; gap: 1.25rem; }
/* Download links (Merged / Forms / Consents) AND the mark action share ONE grid
   cell, laid out as a right-aligned column, so the row keeps four tracks and
   nothing clips off the edge (physician 2026-09-30). */
.dl-list .dl-actions { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
.dl-list .dl-actions a { white-space: nowrap; }
.dl-list .dl-actions .wl-inline-form { margin: .15rem 0 0; }
.dl-list .wl-patient { overflow-wrap: break-word; }
.dl-list .wl-inline-form { margin: 0; display: inline; }
/* A quiet, link-styled action so a per-row button doesn't read as a big CTA. */
.dl-list .btn-linkish {
  background: none;
  color: var(--accent-strong);
  border: 1px solid var(--border);
  padding: .35rem .7rem;
  font-size: .85rem;
  min-height: 0;
  width: auto;
}
.dl-list .btn-linkish:hover { background: var(--tint); border-color: var(--copper); }
/* The EOD bulk action sits above the list. */
.wl-bulk { max-width: 960px; margin: 0 auto .75rem; display: flex; align-items: center; gap: .5rem; }
.wl-bulk .btn-transfer { width: auto; }
.wl-bulk-hint { color: var(--muted); font-size: .85rem; }
.worklist .wl-head {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--tint);
}
.worklist a.wl-link {
  color: inherit;
  text-decoration: none;
}
.worklist a.wl-link:hover { background: var(--tint); }
.worklist a.wl-link:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: -2px;
}
.worklist .wl-name { font-weight: 600; font-size: 1.125rem; color: var(--fg); }
.worklist .wl-chart { color: var(--muted); font-variant-numeric: tabular-nums; }
.worklist .wl-visit { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.worklist .wl-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.worklist .status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 999px;
  background: #EAF1E5;
  border: 1px solid #CADEBE;
  color: var(--ok);
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}

/* Empty state — a clean panel, never an empty table. */
.worklist-empty {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.worklist-empty p { margin: 0; }

@media (max-width: 480px) {
  .worklist .wl-row { grid-template-columns: 1fr; row-gap: .4rem; }
  .worklist .wl-time, .worklist .status-pill { justify-self: start; }
}

/* Demo forms landing (routes::forms_index) + provider worklist nav */
.lede { color: var(--muted); margin: 0 0 1.25rem; }
/* Group heading on the patient "Start a form" landing (New Patient /
   Follow-Up & Maintenance / Consents). */
.form-group-h {
  font-family: var(--font-serif);
  font-size: 1.25rem; font-weight: 700;
  color: var(--fg);
  margin: 1.75rem 0 .85rem;
  padding-bottom: .35rem;
  border-bottom: 1.5px solid var(--border);
}
.form-group-h:first-of-type { margin-top: .5rem; }
.form-list { display: grid; gap: .85rem; }
.form-tile {
  display: flex; align-items: center;
  min-height: var(--touch);
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 1.1875rem; font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.form-tile:hover { border-color: var(--copper); background: var(--tint); color: var(--accent-strong); }
.form-tile:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tint-strong), 0 0 0 5px var(--accent-strong); }
.worklist-nav { display: flex; gap: .6rem; align-items: center; margin: 0 0 1.25rem; font-weight: 600; }

/* Symptom severity grid (SEI-170) — MRS/AMS instrument sections render as a
   table: one row per symptom, one column per legend level, a radio per cell.
   Wrapped in a horizontal-scroll container so the 5-level grid never forces the
   page body to scroll sideways on a phone. */
.severity-wrap { overflow-x: auto; margin: .25rem 0 1rem; -webkit-overflow-scrolling: touch; }
.severity {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 1rem;
}
.severity th, .severity td {
  border: 1px solid var(--border);
  padding: .5rem .4rem;
  text-align: center;
  vertical-align: middle;
}
.severity thead th {
  background: var(--tint);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.15;
}
.severity th.sev-item {
  text-align: left;
  font-weight: 600;
  color: var(--fg);
  background: var(--card);
  min-width: 11rem;
  position: sticky;
  left: 0;
  z-index: 1;
}
.severity thead th.sev-item { background: var(--tint); z-index: 2; }
/* Each cell is a big tap target: the whole cell selects its radio. */
.sev-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  min-width: 2.75rem;
  margin: 0;
  cursor: pointer;
}
.sev-cell input[type="radio"] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.severity tbody tr:hover { background: var(--tint); }

/* Item 8 — health-screening results grid: one row per screening, columns for
   status (Yes/No/N/A), date and abnormal-results note. Scrolls horizontally on a
   phone like the severity grid. */
.scr-wrap { overflow-x: auto; margin: .25rem 0 1rem; -webkit-overflow-scrolling: touch; }
.scr-title { font-size: .95rem; color: var(--fg); margin: 0 0 .4rem; }
.scr-grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1.5px solid var(--border-strong); border-radius: var(--radius); font-size: .95rem; }
.scr-grid th, .scr-grid td { border: 1px solid var(--border); padding: .5rem .5rem; text-align: left; vertical-align: middle; }
.scr-grid thead th { background: var(--tint); color: var(--accent-strong); font-weight: 700; font-size: .85rem; }
.scr-grid th.scr-name { min-width: 9rem; font-weight: 600; color: var(--fg); background: var(--card); }
.scr-grid thead th.scr-name { background: var(--tint); }
.scr-status { white-space: nowrap; }
.scr-opt { display: inline-flex; align-items: center; margin-right: .6rem; cursor: pointer; }
.scr-opt input[type="radio"] { width: 20px; height: 20px; margin: 0 .2rem 0 0; accent-color: var(--accent); }
.scr-date input, .scr-abn input { min-height: var(--touch); font: inherit; padding: .3rem .4rem; border: 1px solid var(--border-strong); border-radius: 8px; width: 100%; }
.scr-abn { min-width: 12rem; }
.scr-grid tbody tr:hover { background: var(--tint); }

/* Visually hidden, still read by assistive tech (per-cell legend label — the
   column header carries it visually). */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Multi-form staff picker (SEI-171) — tick every form a patient is here for. */
.form-picklist {
  max-width: 760px;
  margin: 0 auto 1.25rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--card);
}
.form-picklist legend { font-weight: 700; padding: 0 .4rem; color: var(--accent-strong); }
.form-pick-hint { margin: 0 0 .75rem; font-size: .9rem; color: var(--muted); }
.form-pick-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: var(--touch);
  padding: .35rem .25rem;
  font-size: 1.0625rem;
  cursor: pointer;
}
.form-pick-row + .form-pick-row { border-top: 1px solid var(--border); }
.form-pick { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* Collapsible drawer holding the full individual-form list, so the groupings
   above stay the focus (physician 2026-09-27). Collapsed by default; the summary
   is a tappable control. Checkboxes inside still submit and are still toggled by
   the grouping chips even while collapsed (the DOM state persists). */
.form-drawer { margin-top: .75rem; border-top: 1px solid var(--border); }
.form-drawer-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--touch);
  padding: .5rem .25rem;
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--accent-strong);
}
.form-drawer-summary::-webkit-details-marker { display: none; }
.form-drawer-summary::after {
  content: "▾";
  margin-left: auto;
  transition: transform .15s ease;
}
.form-drawer[open] .form-drawer-summary::after { transform: rotate(180deg); }
.form-drawer-summary:hover { color: var(--accent); }

/* Provider worklist New/Reviewed tabs + per-row review toggle (SEI-167). */
.wl-tabs { display: flex; gap: .5rem; margin: 0 auto 1rem; max-width: 760px; }
.wl-tab {
  padding: .5rem 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
}
.wl-tab:hover { border-color: var(--copper); color: var(--accent-strong); }
.wl-tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wl-item {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  max-width: 760px;
  margin: 0 auto .5rem;
}
.wl-item .wl-link {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .5rem 1rem;
  padding: .85rem 1rem;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
}
.wl-item .wl-link:hover { border-color: var(--copper); background: var(--tint); }
/* Per-row chart-bundle download buttons (forms + consents), so staff grab the
   EMR upload from the worklist without opening each Case-Card. */
.wl-dls { display: flex; flex-direction: column; gap: .35rem; justify-content: center; }
.wl-dl {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .4rem .7rem; min-height: 2rem; white-space: nowrap;
  background: var(--card); border: 1.5px solid var(--accent); border-radius: var(--radius);
  color: var(--accent-strong); font-size: .9rem; font-weight: 600; text-decoration: none;
}
.wl-dl:hover { background: var(--tint); }
.wl-review {
  flex: none;
  min-width: 8.5rem;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0 1rem;
}
.wl-review:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.wl-review.is-reviewed {
  background: var(--card);
  color: var(--ok);
  border-color: var(--ok);
}
@media (max-width: 560px) {
  .wl-item { flex-direction: column; }
  .wl-review { min-height: var(--touch); }
}

/* SEI-169 — verbatim consent document shown before the name attestation. */
.consent-doc-wrap {
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  margin: 0 0 .75rem;
}
.consent-doc-wrap > summary {
  cursor: pointer;
  padding: .75rem 1rem;
  min-height: var(--touch);
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--fg);
}
.consent-doc {
  white-space: pre-wrap;
  font-family: var(--font-serif);
  line-height: 1.5;
  color: var(--fg);
  max-height: 45vh;
  overflow-y: auto;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}
.consent-read {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--touch);
  margin: 0 0 .5rem;
  color: var(--fg);
  font-weight: 600;
}
.consent-read .consent-read-box { width: 1.25rem; height: 1.25rem; }
/* Highlight an "I have read" box that blocked Finish, so the patient sees which
   consent still needs acknowledging (physician 2026-09-27, feedback-not-dead-button). */
.consent-read.unread {
  outline: 2px solid var(--danger, #B3261E);
  outline-offset: 2px;
  border-radius: var(--radius);
}
/* The summary shown when Finish is tapped but a gate is unmet — spells out exactly
   what is still needed instead of a silently-disabled button. */
.gate-summary {
  color: var(--danger, #B3261E);
  font-weight: 600;
  font-size: 1.05rem;
  margin: .9rem 0 0;
}

/* Optional-consent skip ("does not apply to me", e.g. prostate waiver). */
.consent-skip-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--touch);
  margin: 0 0 .75rem;
  font-weight: 600;
}
.consent-skip-wrap .consent-skip { width: 1.25rem; height: 1.25rem; }
/* When skipped, dim the now-optional consent document + inputs. */
.field.is-skipped .consent-doc-wrap,
.field.is-skipped .consent-read,
.field.is-skipped .attest-input,
.field.is-skipped .field-error { opacity: .4; }

/* ── Chart PDFs portal (redesign) — clean aligned filing rows ─────────────── */
.charts-list {
  max-width: 820px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.chart-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center; gap: 1.25rem;
  padding: 0.9rem 1.25rem; min-height: var(--touch);
  border-bottom: 1px solid var(--border);
}
.chart-row:last-child { border-bottom: 0; }
.chart-id { min-width: 0; display: grid; gap: 0.2rem; }
.chart-name-line { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.chart-name-line .wl-name { font-weight: 600; font-size: 1.075rem; color: var(--fg); }
.chart-name-line .wl-chart { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.chart-meta { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.875rem; }
.chart-meta .wl-visit { font-weight: 500; }
.chart-dot { opacity: 0.6; }
/* download chips — compact bordered pills, side by side */
.chart-dls { display: flex; gap: 0.5rem; }
.chart-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: 999px;
  color: var(--fg); text-decoration: none; font-size: 0.9rem; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.chart-chip:hover { background: var(--tint); border-color: var(--accent); }
/* mark-filed — a modest outline action, NOT a big filled CTA */
.chart-file-form { margin: 0; }
.chart-file-btn {
  min-height: 2.5rem; padding: 0.4rem 0.9rem; font-size: 0.9rem; font-weight: 600;
  color: var(--accent); background: transparent; border: 1px solid var(--accent);
  border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.chart-file-btn:hover { background: var(--accent); color: var(--card); }
.chart-file-btn.undo { color: var(--muted); border-color: var(--border); }
.chart-file-btn.undo:hover { background: var(--tint); color: var(--fg); }
@media (max-width: 620px) {
  .chart-row { grid-template-columns: 1fr; gap: 0.6rem; }
  .chart-dls { flex-wrap: wrap; }
}
/* ── Staff patient picker (search → select patient → pick forms → Start) ───── */
.start-visit { max-width: 760px; margin: 1.5rem auto; display: grid; gap: 1.5rem; }
.patient-picklist, .form-picklist {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem 1.25rem;
  margin: 0;
}
.patient-picklist > legend, .form-picklist > legend {
  font-weight: 700; font-size: 1.125rem; color: var(--fg); padding: 0 0.5rem;
}
.form-pick-hint { color: var(--muted); font-size: 0.95rem; margin: 0.25rem 0 0.75rem; }
/* selectable rows: whole row is the click target; highlight the chosen one */
.patient-pick-row, .form-pick-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.85rem 0.9rem; min-height: var(--touch);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-top: 0.6rem; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.patient-pick-row:hover, .form-pick-row:hover { background: var(--tint); }
.patient-pick-row:has(input:checked), .form-pick-row:has(input:checked) {
  border-color: var(--accent); background: var(--tint);
}
.patient-pick-row input, .form-pick-row input { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
.pp-name { font-weight: 600; font-size: 1.075rem; color: var(--fg); }
.pp-chart { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.start-intake {
  justify-self: start; min-height: var(--touch); padding: 0.75rem 1.75rem;
  font-size: 1.075rem; font-weight: 600;
}
/* Create-new-patient link on the picker + back link on the create page */
.new-patient-link { max-width: 760px; margin: 0.75rem auto 0; color: var(--muted); }
.new-patient-link a { color: var(--accent); font-weight: 600; }
.back-link { max-width: 760px; margin: 0 auto 1rem; }
.back-link a { color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--fg); }

/* Staff form-grouping preset chips (physician grouping doc, 2026-09-26) —
   tap a chip to check its member forms in one go; stacks additively with
   other chips and with manually-ticked boxes. Sits above the form checklist
   inside the same .form-picklist fieldset. */
.grouping-selector { margin: 0 0 1rem; display: grid; gap: 0.75rem; }
.grouping-cat-group { display: grid; gap: 0.4rem; }
.grouping-cat {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.grouping-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.grouping-chip {
  min-height: var(--touch); padding: 0.5rem 1rem;
  border: 1.5px solid var(--border-strong); border-radius: 999px;
  background: var(--card); color: var(--fg);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.grouping-chip:hover { border-color: var(--copper); background: var(--tint); }
.grouping-chip.active {
  border-color: var(--copper); background: var(--copper); color: var(--card);
}
.grouping-chip:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

/* SEI-216 — live readout of what the current selection will send, above the
   Start/Send buttons, so staff catch a stacked/stale pick before sending. */
.invite-summary {
  margin: 1rem 0 0.75rem; padding: 0.6rem 0.85rem;
  border: 1px dashed var(--border-strong); border-radius: 8px;
  background: var(--card); color: var(--muted);
  font-size: 0.95rem; line-height: 1.4;
}
.invite-summary.has-forms {
  border-style: solid; border-color: var(--copper);
  background: var(--tint); color: var(--fg);
}
.invite-summary strong { color: var(--fg); }

/* SEI-216 — the forms an invite actually carries, listed on the staff
   confirmation page so a wrong bundle is caught before the patient opens it. */
.invite-forms {
  margin: 0.75rem 0; padding: 0.75rem 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--tint);
}
.invite-forms-head { margin: 0 0 0.4rem; color: var(--fg); }
.invite-forms-list { margin: 0; padding-left: 1.4rem; color: var(--fg); }
.invite-forms-list li { margin: 0.15rem 0; }

/* SEI-216 — an inline "(required to send a remote link)" qualifier on a field
   label, lighter than the label itself. */
.field-opt { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
