
/* ------------------------------------------------------------------ tokens */
/* Ported from report/tokens/colors.css, typography.css, spacing.css. */

:root {
  color-scheme: light;

  --rw-paper: #FBF8F4;
  --rw-white: #FFFFFF;
  --rw-sand-50: #F6EFE7;
  --rw-sand-100: #EFE4D8;
  --rw-sand-200: #E4D3C2;
  --rw-sand-300: #DBC8B6;
  --rw-clay-300: #C79E86;
  --rw-clay-400: #BC8E73;
  --rw-clay-500: #AE7F66;
  --rw-clay-600: #96684F;
  --rw-taupe-400: #877669;
  --rw-taupe-500: #6E5E52;
  --rw-taupe-600: #574A41;
  --rw-taupe-700: #40362F;
  --rw-ink: #2E2620;

  --surface-app: var(--rw-paper);
  --surface-card: var(--rw-white);
  --surface-sunken: var(--rw-sand-50);
  --surface-accent: var(--rw-sand-100);

  --text-strong: var(--rw-ink);
  --text-body: var(--rw-taupe-700);
  --text-muted: var(--rw-taupe-400);
  --text-on-clay: #FFFFFF;

  --border-soft: #EAE0D5;
  --border-default: #E0D3C4;
  --border-strong: #CBB8A5;

  --status-attention: #B4553D;
  --status-attention-surface: #F6E2DA;
  --status-attention-border: #E6C4B7;
  --status-optimal: #6F8A63;
  --status-optimal-surface: #E9EFE3;
  --status-optimal-border: #CBD9BF;
  --status-watch-strong: #8F6A2B;
  --status-watch-surface: #F5EBD6;
  --status-watch-border: #E4D2AC;

  --focus-ring: #96684F;

  /* The brand face is Helvetica Neue. It ships on Apple platforms, so leading
     with it costs no download and the demo laptop gets the real thing; every
     other platform lands on its own UI face. No webfont binaries -- the
     bundled Inter belongs to the PDFs. */
  --font-sans: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --fw-thin: 200;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-bold: 700;

  --fs-h1: 2.25rem;
  --fs-h2: 1.625rem;
  --fs-h3: 1.25rem;
  --fs-title: 1.0625rem;
  --fs-body: 1rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;
  --fs-2xs: 0.6875rem;

  --lh-tight: 1.08;
  --lh-snug: 1.25;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;
  --ls-eyebrow: 0.14em;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(70, 54, 47, 0.06);
  --shadow-sm: 0 2px 8px rgba(70, 54, 47, 0.07);
  --shadow-md: 0 6px 20px rgba(70, 54, 47, 0.09);
  --shadow-focus: 0 0 0 3px rgba(150, 104, 79, 0.28);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-med: 240ms;

  --wrap: 960px;
  --mark: 34px;   /* timeline node diameter -- the rail geometry depends on it */
}

/* ------------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-body);
  background: var(--surface-app);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--rw-clay-600); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--rw-taupe-700); }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Screen-reader-only. Timeline state and "opens in a new tab" are conveyed
   visually; this carries the same facts to a screen reader. */
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.eyebrow {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--rw-clay-500);
  margin: 0 0 var(--sp-2);
}

.muted { color: var(--text-muted); }
.measure { max-width: 58ch; }

/* --------------------------------------------------------- header / footer */

.site-head {
  border-bottom: 1px solid var(--border-soft);
  background: rgba(251, 248, 244, 0.92);
  backdrop-filter: saturate(140%) blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-head .wrap {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  min-height: 64px;
  padding-top: var(--sp-4);
  padding-bottom: var(--sp-4);
}

/* There is no logo asset in this repo, so the wordmark is set as type:
   letter-spaced caps, which is how the brand guide sets it anyway. */
.wordmark {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--rw-ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--rw-clay-600); }

.head-tag {
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: var(--sp-4);
  border-left: 1px solid var(--border-default);
}

.head-spacer { margin-left: auto; }

.site-main { flex: 1 0 auto; padding: var(--sp-12) 0 var(--sp-16); }

.site-foot {
  border-top: 1px solid var(--border-soft);
  padding: var(--sp-8) 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.site-foot p { margin: 0 0 var(--sp-1); }

/* ------------------------------------------------------------- typography */

.page-title {
  font-size: var(--fs-h1);
  font-weight: var(--fw-thin);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 0 0 var(--sp-3);
}

.lede {
  font-size: var(--fs-title);
  line-height: var(--lh-relaxed);
  color: var(--rw-taupe-600);
}

.section-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  color: var(--text-strong);
  margin: 0 0 var(--sp-2);
}

.rule { height: 2px; width: 48px; background: var(--rw-clay-400); margin: var(--sp-6) 0; }

/* ------------------------------------------------------------- containers */

.panel {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-8);
}

.section { margin-top: var(--sp-12); }

/* ------------------------------------------------------------------ notes */

.note {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-sunken);
  color: var(--rw-taupe-600);
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}
.note-sent { background: var(--status-optimal-surface); border-color: var(--status-optimal-border); }
.note-error { background: var(--status-attention-surface); border-color: var(--status-attention-border); color: #7C3A2B; }
.note svg { flex: none; margin-top: 2px; }
.note-stack { margin-bottom: var(--sp-6); }

/* The demo banner is deliberately quiet -- it must be readable by anyone
   looking for it and invisible to anyone who is not. */
.demo-banner {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  color: var(--status-watch-strong);
  background: var(--status-watch-surface);
  border: 1px solid var(--status-watch-border);
  border-radius: var(--radius-pill);
  padding: var(--sp-1) var(--sp-3);
  margin-bottom: var(--sp-6);
}
.demo-banner::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.7;
}

/* ------------------------------------------------------------------ forms */

.field { display: block; margin-bottom: var(--sp-5); }
.field-label {
  display: block;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--rw-clay-500);
  margin-bottom: var(--sp-2);
}

input[type="email"] {
  width: 100%;
  font: inherit;
  color: var(--text-strong);
  background: var(--rw-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
input[type="email"]:focus {
  outline: none;
  border-color: var(--rw-clay-500);
  box-shadow: var(--shadow-focus);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font: inherit;
  font-weight: var(--fw-medium);
  color: var(--text-on-clay);
  background: var(--rw-clay-500);
  border: 1px solid var(--rw-clay-500);
  border-radius: var(--radius-pill);
  padding: var(--sp-3) var(--sp-6);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.button:hover { background: var(--rw-clay-600); border-color: var(--rw-clay-600); }
.button:active { transform: translateY(1px); }
.button-wide { width: 100%; }

/* The logout control is a POST, so it must be a button. It is dressed as a
   quiet link because it is not the thing anyone came here to do. */
.button-quiet {
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: var(--sp-1) var(--sp-2);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.button-quiet:hover { color: var(--rw-taupe-700); }

.form-hint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  margin-top: var(--sp-4);
}

/* ------------------------------------------------------------------ login */

/* Nudged off the top rail so the card sits nearer optical centre on a laptop,
   without ever pushing itself off a short phone screen. */
.login-card { max-width: 460px; margin: clamp(0px, 5vh, 56px) auto 0; }
.login-card .page-title { font-size: var(--fs-h2); }

/* --------------------------------------------------------------- timeline */
/* Horizontal "train track" on desktop, vertical list under 760px. The rail is
   drawn per step with ::before and reaches to the NEXT node's centre, so a
   done step paints its own outgoing segment and the fill stops exactly where
   the patient has got to. No wrapper element, no JS. */

.track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin: var(--sp-8) 0 0;
}

.step {
  position: relative;
  padding: 0 var(--sp-3);
  text-align: center;
}

.step::before {
  content: "";
  position: absolute;
  top: calc(var(--mark) / 2 - 1px);
  left: calc(50% + (var(--mark) / 2) + 6px);
  right: calc(-50% + (var(--mark) / 2) + 6px);
  height: 2px;
  border-radius: 2px;
  background: var(--border-default);
}
.step:last-child::before { content: none; }
.step.is-done::before { background: var(--rw-clay-400); }

.step-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--mark);
  height: var(--mark);
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  background: var(--surface-app);
  border: 2px solid var(--border-strong);
  color: var(--text-on-clay);
}

.step.is-done .step-mark {
  background: var(--rw-clay-500);
  border-color: var(--rw-clay-500);
}

.step.is-current .step-mark {
  background: var(--rw-white);
  border-color: var(--rw-clay-500);
  box-shadow: 0 0 0 5px rgba(174, 127, 102, 0.16);
}
.step.is-current .step-mark::after {
  content: "";
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--rw-clay-500);
}

.step.is-upcoming .step-mark { background: var(--surface-app); border-style: dashed; }
.step.is-upcoming .step-mark::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.step-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--text-strong);
}
.step.is-upcoming .step-label { color: var(--text-muted); font-weight: var(--fw-regular); }

.step-detail {
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  color: var(--text-muted);
  margin-top: var(--sp-2);
}

.step-now {
  display: inline-block;
  margin-top: var(--sp-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--rw-clay-600);
  background: var(--surface-accent);
  border-radius: var(--radius-pill);
  padding: 3px var(--sp-3);
}

@media (max-width: 760px) {
  .track { grid-auto-flow: row; margin-top: var(--sp-6); }
  .step {
    display: grid;
    grid-template-columns: var(--mark) minmax(0, 1fr);
    gap: 0 var(--sp-4);
    text-align: left;
    padding: 0 0 var(--sp-6);
  }
  .step:last-child { padding-bottom: 0; }
  .step::before {
    top: var(--mark);
    bottom: 0;
    left: calc(var(--mark) / 2 - 1px);
    right: auto;
    width: 2px;
    height: auto;
  }
  .step-mark { margin: 0; }
  .step-body { padding-top: 5px; }
  .step-now { margin-top: var(--sp-2); }
}

/* ---------------------------------------------------------------- documents */

.docs-layout { display: grid; gap: var(--sp-6); align-items: start; }

@media (min-width: 900px) {
  .docs-layout.has-key { grid-template-columns: minmax(0, 1fr) 260px; }
}

.doc-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.doc {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
  padding: var(--sp-5);
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out);
}
.doc:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}
.doc-icon { color: var(--rw-clay-500); }
.doc-kind {
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}
.doc-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--text-strong);
  margin: var(--sp-1) 0 var(--sp-3);
}
.doc-open {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--rw-clay-600);
}
.doc:hover .doc-open { text-decoration: underline; text-underline-offset: 2px; }

/* A placeholder must not be mistakable for a patient's own file, so it is
   marked twice: a dashed edge you notice across the room and a badge you can
   read up close. */
.doc.is-placeholder {
  border-style: dashed;
  border-color: var(--border-strong);
  background: var(--surface-sunken);
  box-shadow: none;
}
.doc-badge {
  display: inline-block;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--status-watch-strong);
  background: var(--status-watch-surface);
  border: 1px solid var(--status-watch-border);
  border-radius: var(--radius-pill);
  padding: 2px var(--sp-2);
  margin-bottom: var(--sp-2);
}

/* Centred, not left-aligned. Left-aligned short copy in a wide dashed box
   reads as a container that failed to fill; centred, it reads as a message. */
.doc-empty {
  display: grid;
  gap: var(--sp-3);
  justify-items: center;
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}
.doc-empty h3 {
  font-size: var(--fs-title);
  font-weight: var(--fw-medium);
  color: var(--text-strong);
}
.doc-empty p { font-size: var(--fs-sm); line-height: var(--lh-relaxed); max-width: 46ch; }
.doc-empty svg { color: var(--rw-clay-300); }

/* ----------------------------------------------------------- the password */

.key {
  background: var(--surface-accent);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
}
.key-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--rw-clay-600);
  margin-bottom: var(--sp-3);
}
.key-field {
  position: relative;
}
.key-value {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-title);
  letter-spacing: 0.06em;
  color: var(--text-strong);
  background: var(--rw-white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  /* Right padding reserves the button's lane. Without it a long password wraps
     underneath the icon and the two collide. */
  padding: var(--sp-3) calc(var(--sp-4) + 34px) var(--sp-3) var(--sp-4);
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
/* The copy control: an icon inside the field's right edge, the way every
   password and API-key field a patient has ever used already behaves. It is a
   32px hit target, which is small for a finger, so it sits inside a field that
   is itself tappable-adjacent and the password stays selectable as the fallback. */
.key-copy {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--rw-taupe-400);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}
.key-copy:hover {
  color: var(--rw-clay-600);
  background: var(--rw-sand-50);
}
.key-copy:focus-visible {
  outline: 2px solid var(--rw-clay-500);
  outline-offset: 2px;
}
.key-copy.is-copied {
  color: var(--rw-clay-600);
}

/* The two glyphs occupy the same cell so the swap does not move anything. */
.key-copy-icon,
.key-copy-tick {
  grid-area: 1 / 1;
  display: flex;
  transition: opacity 140ms ease, transform 140ms ease;
}
.key-copy {
  display: grid;
  place-items: center;
}
.key-copy-tick {
  opacity: 0;
  transform: scale(0.7);
}
.key-copy.is-copied .key-copy-icon {
  opacity: 0;
  transform: scale(0.7);
}
.key-copy.is-copied .key-copy-tick {
  opacity: 1;
  transform: scale(1);
}

/* "Copied", above the button. Dark pill, small rise as it appears -- the
   standard shape, so it needs no explaining. Uses visibility rather than
   display so the fade still plays on the way out. */
.key-copy-flash {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--rw-white);
  background: var(--rw-taupe-700);
  border-radius: 5px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms;
}
.key-copy.is-copied .key-copy-flash {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* Announced, never shown. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.key-hint {
  font-size: var(--fs-xs);
  line-height: var(--lh-relaxed);
  color: var(--rw-taupe-600);
  margin-top: var(--sp-3);
}

/* ------------------------------------ programme + additional documents */
/* Shared material: the same for every patient and not encrypted. "Your
   programme" is the protocol -- clinical, something to follow daily -- so each
   one gets a card of its own with the brand accent down its edge; further
   phases stack beneath. "Additional documents" is the reading, which reuses
   the document card at a quieter register with a line of summary added. */

.protocol {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-6);
  margin-top: var(--sp-5);
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--rw-clay-500);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out);
}
.protocol:hover {
  border-color: var(--border-strong);
  border-left-color: var(--rw-clay-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}
.protocol .doc-icon { align-self: start; }
.protocol-body { display: block; min-width: 0; }
.protocol-flag {
  display: block;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--rw-clay-600);
}
.protocol-title {
  display: block;
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--text-strong);
  margin: var(--sp-1) 0 var(--sp-2);
}
.protocol-summary {
  display: block;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-body);
  max-width: 62ch;
}
.protocol-meta {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--sp-3);
}
/* Dressed as the primary button so the card reads as the thing to do next.
   The whole card is the link; this is only where the eye lands. */
.protocol-open {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  color: var(--text-on-clay);
  background: var(--rw-clay-500);
  border-radius: var(--radius-pill);
  padding: var(--sp-2) var(--sp-5);
  transition: background var(--dur-fast) var(--ease-out);
}
.protocol:hover .protocol-open { background: var(--rw-clay-600); }

@media (max-width: 600px) {
  .protocol { grid-template-columns: 34px minmax(0, 1fr); align-items: start; }
  .protocol-open { grid-column: 2; justify-self: start; }
}

/* Wider minimum than the documents grid. Each card carries a line of summary,
   which needs the width; and four of them at the documents' 230px make a row
   of three with the fourth stranded alone, while at 200px everything wraps.
   Two across gives a 2x2 at the page's full width and one column on a phone. */
.additional-grid {
  margin-top: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* The summary sits between the title and "Open", so the title gives up most
   of its bottom margin to it. */
.doc.has-summary .doc-label { margin-bottom: var(--sp-1); }
.doc-summary {
  display: block;
  font-size: var(--fs-xs);
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

/* --------------------------------------------------------- doctors portal */
/* The patient picker: one select, one button, in a row that wraps on a phone.
   Styled like the email field so the two forms read as one family. */

/* The picker is a control, not a section: one row, tight panel, the count
   beside the heading rather than a paragraph under it. */
.section-tight { margin-top: var(--sp-6); }
.pick-panel { padding: var(--sp-5) var(--sp-6); }
.pick-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.pick-head .section-title { font-size: var(--fs-title); margin: 0; }
.pick { display: flex; gap: var(--sp-3); align-items: flex-end; flex-wrap: wrap; }
.pick .field-label { margin-bottom: var(--sp-1); }
.pick select { padding: var(--sp-2) var(--sp-3); }
.pick .button { padding: var(--sp-2) var(--sp-5); }
.pick .field { flex: 1 1 260px; margin-bottom: 0; }
select {
  width: 100%;
  font: inherit;
  color: var(--text-strong);
  background: var(--rw-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
}
select:focus { outline: none; border-color: var(--rw-clay-500); box-shadow: var(--shadow-focus); }
.patient-meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.patient-meta span {
  font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase;
  padding: 3px var(--sp-3); border-radius: var(--radius-pill);
  background: var(--surface-accent); color: var(--rw-clay-600);
}

/* ----------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .doc:hover, .protocol:hover { transform: none; }
}
