/* ==========================================================================
   Cris Barros app
   tokens -> base -> components -> areas -> responsive -> print

   One identity, Turquesa (planning/brand-turquesa.md), in two arrangements.
   The public booking pages lead with deep teal, matching crisbarros.com.au,
   with turquoise shapes and lilac accents. Cris's own area leads with lilac,
   with turquoise accents, so she always knows which side of the app she is on.

   Components only ever refer to the --brand and --accent roles, so an area is
   re-skinned by the data-area attribute on <html> and nothing else.

   Every colour pair here is listed in src/ui/tokens.ts and checked by
   `npm run contrast`, which runs as part of the test suite.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Turquesa */
  --deep-teal:       #2E6F7C;  /* buttons, links, headings: 5.7:1 on white */
  --deep-teal-hover: #24575F;
  --teal-wash:       #E4F2F4;
  --turquoise:       #6FCCD7;  /* shapes only: 1.9:1 on white. Text on it is ink */
  --turquoise-pale:  #D7F2F6;
  --lilac:           #8C7BB9;  /* panels and shapes; text only at 24px and up */
  --lilac-deep:      #5B4B8A;  /* lilac as small text */
  --lilac-hover:     #4F3F7E;
  --lilac-wash:      #EFEDF6;
  --lilac-pale:      #E9E4F4;

  /* Shared */
  --ink:      #231F20;
  --ink-soft: #4B5360;
  --mist:     #F3F5F5;
  --stone:    #E7E6E5;
  --white:    #FFFFFF;

  /* Status. Always with words, never colour alone. */
  --warn:      #8A5300;  /* running over, something to check */
  --warn-wash: #FCF3E3;
  --danger:    #B3261E;
  --rec:       #E5484D;  /* the recording dot: a shape, never text */
  --ok:        #1E7F5C;

  /* Roles the components use. Swapped per area, below. */
  --brand:       var(--deep-teal);
  --brand-deep:  var(--deep-teal);
  --brand-hover: var(--deep-teal-hover);
  --brand-wash:  var(--teal-wash);
  --accent:      var(--turquoise);
  --accent-deep: var(--lilac-deep);
  --accent-pale: var(--lilac-pale);

  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;

  /* Type. 19px body, because most of the people reading this are over 70. */
  --text-small: 1rem;         /* 16 */
  --text-body:  1.1875rem;    /* 19 */
  --text-lead:  1.3125rem;    /* 21 */
  --text-h3:    1.375rem;     /* 22 */
  --text-state: 1.5rem;       /* 24  the statement line */
  --text-h2:    2.375rem;     /* 38 */
  --text-h1:    3.5rem;       /* 56 */
  --text-clock: 4rem;         /* 64  the countdown */

  --gutter: clamp(20px, 5vw, 40px);
  --container: 1120px;
  --narrow: 620px;
  --section: 72px;

  --radius-s: 8px;
  --radius-m: 16px;
  --radius-l: 28px;

  --tap: 52px;       /* every button, everywhere */
  --tap-big: 64px;   /* the two actions on the running visit card */

  --shadow-card: 0 20px 50px rgba(46, 111, 124, .14);
}

/* Cris's area: the same components, lilac first. */
[data-area='nurse'] {
  --brand:       var(--lilac);
  --brand-deep:  var(--lilac-deep);
  --brand-hover: var(--lilac-hover);
  --brand-wash:  var(--lilac-wash);
  --accent:      var(--turquoise);
  --accent-deep: var(--deep-teal);
  --accent-pale: var(--turquoise-pale);
  --shadow-card: 0 20px 50px rgba(91, 75, 138, .16);
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }

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

h1, h2, h3 { font-weight: 600; text-wrap: balance; }
h1 { font-size: var(--text-h1); line-height: 1.1; letter-spacing: -.015em; max-width: 16ch; }
h2 { font-size: var(--text-h2); line-height: 1.15; letter-spacing: -.01em; max-width: 22ch; }
h3 { font-size: var(--text-h3); line-height: 1.3; }

p { max-width: 62ch; }
.lead { font-size: var(--text-lead); line-height: 1.5; max-width: 56ch; }
.small { font-size: var(--text-small); color: var(--ink-soft); }

a {
  color: var(--brand-deep);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2.5px; }

/* There is no focus style by default in any browser worth relying on. */
:focus-visible {
  outline: 3px solid var(--brand-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

.shell { width: min(var(--container), 100% - 2 * var(--gutter)); margin-inline: auto; }
.shell-narrow { width: min(var(--narrow), 100% - 2 * var(--gutter)); margin-inline: auto; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  padding: 12px 18px; border-radius: var(--radius-s);
  background: var(--brand-deep); color: var(--white);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* Visible to a screen reader, not on the screen. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* The brand's own device: a pink italic sentence, from the flyer. */
.statement {
  font-size: var(--text-state);
  font-style: italic;
  font-weight: 500;
  line-height: 1.35;
  color: var(--accent-deep);
  max-width: 34ch;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 26px;
  border-radius: 999px; border: 2px solid transparent;
  font: 600 1.0625rem/1 var(--font);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
/* No lift, no shadow, no arrow in the label: the printed identity is flat. */
.btn-primary   { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--white); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-secondary { background: var(--white); border-color: var(--brand-deep); color: var(--brand-deep); }
.btn-secondary:hover { background: var(--brand-wash); }
.btn-on-brand  { background: var(--white); border-color: var(--white); color: var(--brand-deep); }
.btn-on-brand:hover { background: var(--brand-wash); border-color: var(--brand-wash); }
.btn-danger    { background: var(--danger); border-color: var(--danger); color: var(--white); }
.btn-block     { width: 100%; }
.btn-big       { min-height: var(--tap-big); font-size: 1.25rem; }
.btn:disabled  { opacity: .55; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }

/* A link that should read as plain text until it is wanted. */
.link-quiet { color: var(--ink-soft); font-size: var(--text-small); }

/* ---------- Panels and cards ---------- */
.panel {
  background: var(--mist);
  border-radius: var(--radius-m);
  padding: 32px;
}
[data-area='nurse'] .panel { background: var(--brand-wash); }

.card {
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  padding: 28px;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--mist);
  border-radius: var(--radius-m);
  padding: 28px;
  transition: background-color .15s;
}
.card-link:hover, .card-link:focus-visible { background: var(--brand-wash); }
.card-link h3 { color: var(--brand-deep); margin-bottom: 8px; }
.card-link p { margin-bottom: 12px; }

.card-meta {
  font-size: var(--text-small);
  color: var(--ink-soft);
  font-weight: 500;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  grid-auto-rows: 1fr;
}

/* ---------- Fields ---------- */
.field { display: grid; gap: 8px; margin-bottom: 24px; }
.field > label { font-weight: 500; font-size: 1.0625rem; }
.field-hint { font-size: var(--text-small); color: var(--ink-soft); }

.input {
  min-height: var(--tap);
  width: 100%;
  padding: 12px 16px;
  font: 400 var(--text-body)/1.4 var(--font);
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius-s);
}
.input:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: 1px; border-color: var(--brand-deep); }
.input[aria-invalid='true'] { border-color: var(--danger); border-width: 2px; }

.field-error {
  color: var(--danger);
  font-size: var(--text-small);
  font-weight: 500;
}

/* A one-time code: wide, spaced, numeric keypad on a phone. */
.input-code {
  font-size: 1.75rem;
  letter-spacing: .3em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Chips (a single choice that works without JavaScript) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; }
.chip input {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.chip span {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  border: 2px solid var(--stone); border-radius: 999px;
  font-weight: 500; background: var(--white);
  transition: background-color .15s, border-color .15s;
}
.chip input:checked + span {
  background: var(--brand-wash);
  border-color: var(--brand-deep);
  color: var(--brand-deep);
  font-weight: 600;
}
.chip input:focus-visible + span { outline: 3px solid var(--brand-deep); outline-offset: 3px; }

/* ---------- Status bands ---------- */
.band {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-s);
  font-weight: 500;
  margin-bottom: 20px;
}
.band-info   { background: var(--brand-wash); color: var(--ink); }
.band-ok     { background: var(--white); border: 2px solid var(--ok); color: var(--ink); }
.band-warn   { background: var(--warn); color: var(--white); }
.band-danger { background: var(--danger); color: var(--white); }
.band a { color: inherit; }
.band-icon { flex: none; font-weight: 700; }

/* ---------- The road ---------- */
/* One path, a wide round stroke, with numbered stops on it. The last stop is
   the accent colour, as the road on the printed flyer ends in pink. */
.road { display: grid; gap: 0; margin: 32px 0; }

.road-stop {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  align-items: start;
  padding-bottom: 28px;
  position: relative;
}
.road-stop:last-child { padding-bottom: 0; }

/* The ribbon between the stops. */
.road-stop:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 21px; top: 44px; bottom: 0;
  width: 2px;
  background: var(--brand-wash);
}

.road-marker {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--white);
  border: 2px solid var(--brand);
  color: var(--brand-deep);
  font-weight: 700;
  font-size: 1.0625rem;
}
.road-stop:last-child .road-marker {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.road-body h3 { font-size: 1.125rem; margin-bottom: 4px; }
.road-body p { font-size: 1.0625rem; color: var(--ink-soft); max-width: 46ch; }

/* ---------- The ghost wordmark ---------- */
/* The brochure's back-panel device: the wordmark, very large and very faint,
   clipped by the edge of the band it sits on. */
.ghost-wordmark {
  position: absolute;
  right: -40px; bottom: -30px;
  width: 420px;
  aspect-ratio: 164.8 / 54.62;
  background-color: var(--white);
  -webkit-mask: url('/logo.svg') no-repeat center / contain;
  mask: url('/logo.svg') no-repeat center / contain;
  opacity: .08;
  pointer-events: none;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--stone);
}
.header-bar {
  min-height: 76px;
  display: flex; align-items: center; gap: 24px;
  padding-block: 12px;
}
.brand-mark { flex: none; display: block; }

/* The wordmark is 20 KB of paths. Painting it as a mask keeps it one cached
   file while still letting it take the colour of whatever it sits on, which
   an <img> could not do and an inline copy would pay for on every page. */
.logo {
  display: block;
  width: 168px;
  aspect-ratio: 164.8 / 54.62;
  background-color: currentColor;
  -webkit-mask: url('/logo.svg') no-repeat center / contain;
  mask: url('/logo.svg') no-repeat center / contain;
}
.logo-sm { width: 140px; }
.logo-lg { width: 260px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }

.area-label {
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--ink-soft);
  padding-left: 16px;
  border-left: 1px solid var(--stone);
}

.phone-link {
  display: inline-flex; align-items: center; gap: 8px;
  /* A header link is aimed at with a thumb, so it gets a thumb-sized box. */
  min-height: 44px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.phone-link:hover span { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Layout ---------- */
main { padding-block: var(--section); }
.stack > * + * { margin-top: 24px; }
.stack-tight > * + * { margin-top: 12px; }
.section-intro { display: grid; gap: 20px; margin-bottom: 40px; }

.site-footer {
  background: var(--stone);
  padding-block: 40px;
  font-size: var(--text-small);
  color: var(--ink-soft);
}
.site-footer a { color: var(--brand-deep); }
.site-footer p { max-width: 70ch; }
.site-footer > * + * { margin-top: 12px; }

/* ---------- Facts list ---------- */
.facts { display: grid; gap: 0; }
.fact {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--stone);
}
.fact:last-child { border-bottom: 1px solid var(--stone); }
.fact dt { font-weight: 500; color: var(--ink-soft); font-size: 1.0625rem; }
.fact dd { margin: 0; }

/* ---------- The Halaxy booking frame ---------- */
/* A white panel with a real border, so the widget's own white background does
   not read as a hole in the page. */
.booking-frame {
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  padding: 8px;
  margin-block: 32px;
  min-height: 760px;
  position: relative;
}
.booking-frame iframe { width: 100%; min-height: 744px; border: 0; border-radius: var(--radius-s); display: block; }

.booking-skeleton {
  position: absolute; inset: 8px;
  display: grid; place-items: center;
  background: var(--mist);
  border-radius: var(--radius-s);
  color: var(--ink-soft);
  font-weight: 500;
}

.booking-fallback {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px;
  margin-top: 8px;
}

/* ---------- Cris's area: the running visit ---------- */
.visit-clock {
  font-size: var(--text-clock);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--ink);
}
.visit-clock-over { color: var(--warn); }
.visit-due { font-size: var(--text-lead); color: var(--ink-soft); margin-top: 8px; }

.visit-actions { display: grid; gap: 12px; margin-top: 28px; }

.outcome {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: var(--text-small);
  font-weight: 600;
}
.outcome-checked_out { background: var(--brand-wash); color: var(--brand-deep); }
.outcome-resolved    { background: var(--white); border: 2px solid var(--ok); color: var(--ok); }
.outcome-cancelled   { background: var(--mist); color: var(--ink-soft); }
.outcome-active,
.outcome-overdue,
.outcome-alerting    { background: var(--danger); color: var(--white); }

.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid var(--stone);
  text-decoration: none;
  color: inherit;
}
.history-row:last-child { border-bottom: 1px solid var(--stone); }
.history-row:hover { background: var(--brand-wash); }
.history-when { font-weight: 600; }
.history-detail { font-size: var(--text-small); color: var(--ink-soft); }

.message-log { display: grid; gap: 0; margin-top: 12px; }
.message-log li {
  padding: 14px 0;
  border-top: 1px solid var(--stone);
  font-size: 1.0625rem;
}
.message-log li:last-child { border-bottom: 1px solid var(--stone); }
.message-to { font-weight: 600; }
.message-body { color: var(--ink-soft); margin-top: 4px; }
.message-failed { color: var(--danger); font-weight: 600; }

/* ---------- The login screen ---------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: var(--brand-deep);
  position: relative;
  overflow: hidden;
}
/* The purple fills the window edge to edge: no white strip from <main>. */
main:has(> .auth-page) { padding-block: 0; }
.auth-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  background: var(--white);
  border-radius: var(--radius-l);
  padding: 40px;
}
.auth-card h1 { font-size: 1.75rem; max-width: none; margin-bottom: 8px; }
.auth-card .lead { font-size: 1.0625rem; margin-bottom: 28px; }
.auth-brand { margin-bottom: 28px; color: var(--brand-deep); }

.qr { display: grid; place-items: center; padding: 20px; background: var(--white); border: 1px solid var(--stone); border-radius: var(--radius-m); }
.secret-manual {
  font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 1.125rem;
  letter-spacing: .08em;
  word-break: break-all;
  background: var(--mist);
  padding: 12px 16px;
  border-radius: var(--radius-s);
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 20px;
  font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 1.125rem;
  background: var(--mist);
  padding: 20px;
  border-radius: var(--radius-m);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root {
    --text-h1: 2.375rem;   /* 38 */
    --text-h2: 1.875rem;   /* 30 */
    --text-h3: 1.25rem;    /* 20 */
    --text-body: 1.125rem; /* 18 */
    --text-lead: 1.1875rem;/* 19 */
    --text-state: 1.25rem; /* 20 */
    --section: 56px;
  }
  .header-bar { min-height: 64px; gap: 16px; }
  .brand-mark svg { width: 140px; }
  .panel { padding: 22px; }
  .card, .card-link { padding: 22px; }
  .fact { grid-template-columns: 1fr; gap: 4px; }
  .auth-card { padding: 28px 22px; }
  .recovery-codes { grid-template-columns: 1fr; }
  .area-label { padding-left: 0; border-left: 0; }
}

/* Cris's header on a phone.
   Two rows rather than a menu button: there are only three places to go, and
   a panel that has to be opened is one more tap between her and the timer. */
@media (max-width: 700px) {
  [data-area='nurse'] .header-bar {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-block: 10px;
  }
  /* The lilac colourway and the nav already say where she is. */
  [data-area='nurse'] .area-label { display: none; }
  /* Logo and Sign out on the first line; the sections below, as even tabs. */
  [data-area='nurse'] .header-bar .header-signout { order: 2; margin-left: auto; }
  [data-area='nurse'] nav.header-right {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 4px;
  }
  [data-area='nurse'] nav.header-right .nav-link { flex: 1 1 0; justify-content: center; min-height: 44px; }
}

/* The public header at phone width: a full email address will not sit beside
   the wordmark, so let it take its own line rather than shrink to unreadable
   or slide off the side. */
@media (max-width: 560px) {
  .header-bar { flex-wrap: wrap; row-gap: 6px; padding-block: 10px; }
  .header-right { width: 100%; margin-left: 0; }
  .phone-link { font-size: var(--text-small); }
}

@media (max-width: 560px) {
  .header-right { gap: 12px; }
  .actions .btn { width: 100%; }
  .booking-frame { min-height: 620px; padding: 4px; }
  .booking-frame iframe { min-height: 612px; }
  .ghost-wordmark { width: 300px; right: -60px; }
}

/* ---------- Cris's area: a working scale ---------- */
/* The large type above is for the public pages, whose readers are mostly over
   seventy. Cris is a professional using a work tool all day, on a laptop as
   much as a phone, so her area uses an ordinary app scale: 16px body, smaller
   headings and controls. Still nothing under 15px and 44px tap targets.
   :root[data-area] outranks the plain :root in the media query above.
   The running visit keeps its own big clock and 64px buttons (--tap-big,
   --text-clock), because those are used one-handed at a front door. */
:root[data-area='nurse'] {
  --text-small: .9375rem;   /* 15 */
  --text-body:  1rem;       /* 16 */
  --text-lead:  1.125rem;   /* 18 */
  --text-h3:    1.1875rem;  /* 19 */
  --text-state: 1.125rem;
  --text-h2:    1.75rem;    /* 28 */
  --text-h1:    2.125rem;   /* 34 */
  --tap:        44px;
  --section:    32px;
}
[data-area='nurse'] body { line-height: 1.55; }
[data-area='nurse'] h1 { max-width: none; }
[data-area='nurse'] .btn { font-size: 1rem; padding: 0 20px; }
[data-area='nurse'] .card,
[data-area='nurse'] .card-link,
[data-area='nurse'] .panel { padding: 20px 22px; }
[data-area='nurse'] .field { margin-bottom: 16px; gap: 6px; }
[data-area='nurse'] .field > label { font-size: 1rem; }
[data-area='nurse'] .input { padding: 9px 12px; }
[data-area='nurse'] .chip span { min-height: 40px; padding: 0 16px; }
[data-area='nurse'] .band { padding: 12px 16px; margin-bottom: 12px; }
[data-area='nurse'] .header-bar { min-height: 60px; padding-block: 8px; }
[data-area='nurse'] .logo-sm { width: 120px; }
[data-area='nurse'] .road { margin: 16px 0 0; }
[data-area='nurse'] .road-stop { padding-bottom: 14px; grid-template-columns: 36px 1fr; gap: 12px; }
[data-area='nurse'] .road-marker { width: 36px; height: 36px; font-size: .9375rem; }
[data-area='nurse'] .road-stop:not(:last-child)::before { left: 17px; top: 36px; }
[data-area='nurse'] .road-body h3 { font-size: 1rem; }
[data-area='nurse'] .road-body p { font-size: .9375rem; }
[data-area='nurse'] .site-footer { padding-block: 20px; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Print ---------- */
/* Families print pages for a parent. Keep the words, drop the furniture. */
@media print {
  .site-header, .site-footer, .btn, .visit-actions, .skip-link, .booking-frame { display: none !important; }
  body { font-size: 12pt; color: #000; background: #fff; }
  a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 10pt; }
  .panel, .card { border: 1px solid #999; background: #fff; }
}

/* ==========================================================================
   Utilities
   --------------------------------------------------------------------------
   These exist because the app sends `style-src 'self'` with no
   'unsafe-inline'. Under that policy a browser silently discards every inline
   style attribute, so a layout built with them looks subtly wrong in
   production and perfectly fine in a page opened from disk. Keeping the
   policy strict and the styling in here is the trade this app makes.
   ========================================================================== */

/* A heading inside a card or panel: the size of an h3, whatever the tag. */
.h-sub {
  font-size: var(--text-h3);
  line-height: 1.3;
  max-width: none;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 28px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }

.strong { font-weight: 600; }

/* A fieldset carrying no visual box of its own. */
.fieldset-plain { border: 0; padding: 0; margin: 0; margin-inline: 0; }
.legend-plain {
  font-weight: 500;
  font-size: 1.0625rem;
  padding: 0;
  margin-bottom: 8px;
}

/* A <details> used as a collapsible section inside a card. */
.disclosure { border-top: 1px solid var(--stone); padding: 14px 0; }
.disclosure > summary { cursor: pointer; font-weight: 600; }
.disclosure > summary::marker { color: var(--brand-deep); }

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
  min-height: 44px;
}
.checkbox-row input { width: 22px; height: 22px; }

/* A button that should read as a link (cancel, and nothing else). */
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  font: 500 var(--text-small)/1.5 var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.btn-link:hover { color: var(--ink); }

.nav-link { color: var(--ink); font-weight: 500; }

/* The three extend options stay on one line: they are a set of small
   choices, not three separate calls to action, and stacking them pushes the
   honest note about how the alert works below the fold on a phone. */
.extend-options { display: flex; flex-wrap: wrap; gap: 10px; }
.extend-options .btn { flex: 1 1 0; min-width: 96px; padding-inline: 12px; }
.inline-form { display: inline; }
.btn-compact { min-height: 44px; padding-inline: 18px; }

/* Cris's header links: quiet pills rather than underlined words, with the
   page she is on filled in. */
[data-area='nurse'] .nav-link {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
}
[data-area='nurse'] .nav-link:hover { background: var(--brand-wash); }
[data-area='nurse'] .nav-link[aria-current='page'] { background: var(--brand-wash); color: var(--brand-deep); font-weight: 600; }
[data-area='nurse'] .header-right { gap: 6px; }
[data-area='nurse'] .header-signout { margin-left: 10px; }
[data-area='nurse'] .header-signout .btn { white-space: nowrap; }
@media (max-width: 700px) {
  [data-area='nurse'] .nav-link { padding: 0 8px; }
}
/* The smallest phones, with four sections (the check-in adds History):
   a little tighter, and wrapping rather than pushing the page sideways. */
@media (max-width: 400px) {
  [data-area='nurse'] nav.header-right { flex-wrap: wrap; row-gap: 4px; gap: 2px; }
  [data-area='nurse'] nav.header-right .nav-link { flex: 1 1 auto; padding: 0 4px; font-size: .9375rem; }
}

/* ==========================================================================
   The assessment and report demo (/nurse/demo)
   --------------------------------------------------------------------------
   Prototype screens for the scribe flow, planning/system-setup.md §7, 3b.
   ========================================================================== */

[data-area='nurse'] { --text-label: var(--text-small); }

.client-line { font-size: var(--text-small); color: var(--ink-soft); }
.client-line .strong { color: var(--ink); }
.client-line-sep { margin-inline: 8px; }

/* A small label above a heading or a block: the date, "Read this out". */
.eyebrow { font-size: var(--text-small); font-weight: 600; color: var(--brand-deep); }
.section-label {
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
  max-width: none;
}

.pill {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-label);
  font-weight: 700;
  line-height: 1.5;
}

/* --- A screen's title row: heading left, its actions right --- */
.screen-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.screen-head-text { flex: 1 1 320px; min-width: 0; display: grid; gap: 2px; }
.screen-title { font-size: var(--text-h2); max-width: none; }
@media (min-width: 760px) { .screen-head > .actions { flex: none; } }

.head-stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--brand-wash);
  color: var(--ink);
  font-size: var(--text-small);
}
.head-stat-num { font-weight: 700; font-size: var(--text-body); color: var(--brand-deep); }

/* --- Today --- */
.visit-list { display: grid; gap: 12px; }
.visit-card {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 8px 20px;
  align-items: center;
}
.visit-card-time {
  display: grid; justify-items: start; gap: 6px;
  font-weight: 700; font-size: var(--text-h3); color: var(--brand-deep); white-space: nowrap;
}
.visit-card-body { display: grid; gap: 4px; }
.visit-card-reason { font-size: var(--text-small); color: var(--ink-soft); max-width: 52ch; }

/* --- Consent --- */
.consent-card {
  margin: 0;
  padding: 20px 24px;
  border-radius: var(--radius-m);
  background: var(--brand-wash);
}
.consent-script {
  padding-left: 16px;
  border-left: 3px solid var(--brand);
  font-size: var(--text-lead);
  font-style: italic;
  line-height: 1.55;
}
.consent-note { margin-top: 14px; font-size: var(--text-small); color: var(--ink-soft); }
.agree-list { display: grid; gap: 8px; }
.agree-row {
  margin-bottom: 0;
  padding: 0 14px;
  min-height: 48px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-s);
  cursor: pointer;
  font-weight: 500;
  transition: background-color .15s, border-color .15s;
}
.agree-row:hover { border-color: var(--brand); }
.agree-row:has(input:checked) { border-color: var(--brand-deep); background: var(--brand-wash); }
.agree-row input { accent-color: var(--brand-deep); }
legend.h-sub { font-weight: 600; }

/* --- The recording bar --- */
.rec-bar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--brand-deep);
  color: var(--white);
}
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.5ch; }
.rec-client { flex: none; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .5); white-space: nowrap; }
.rec-dot {
  flex: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 0 4px rgba(229, 72, 77, .25);
  animation: rec-pulse 1.6s ease-in-out infinite;
}
.btn .rec-dot { animation: none; box-shadow: none; }
@keyframes rec-pulse { 50% { opacity: .35; } }

/* The level meter. It takes all the room between the time and the client;
   bars that don't fit are clipped at the right. With the microphone live
   (.is-live) scribe-demo.js sets each bar's height from the sound; until then,
   or without the script, it pretends, with heights and timings from co-prime
   nth-child cycles (5, 7, 3) so the pattern doesn't visibly repeat. */
.rec-wave {
  flex: 1 1 80px;
  min-width: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 3px; height: 22px;
  overflow: hidden;
}
.rec-wave i {
  --peak: 1;
  flex: none;
  width: 3px; height: 100%;
  border-radius: 2px;
  background: rgba(255, 255, 255, .8);
  transform: scaleY(.2);
  transform-origin: center;
  animation: rec-wave 1.2s ease-in-out infinite;
}
.rec-wave i:nth-child(5n+1) { animation-delay: -.9s; }
.rec-wave i:nth-child(5n+2) { animation-delay: -.3s; }
.rec-wave i:nth-child(5n+3) { animation-delay: -.6s; }
.rec-wave i:nth-child(5n+4) { animation-delay: -.15s; }
.rec-wave i:nth-child(7n+1) { --peak: .45; }
.rec-wave i:nth-child(7n+3) { --peak: .7; }
.rec-wave i:nth-child(7n+4) { --peak: .35; }
.rec-wave i:nth-child(7n+6) { --peak: .85; }
.rec-wave i:nth-child(3n) { animation-duration: 1.5s; }
.rec-wave i:nth-child(3n+1) { animation-duration: .95s; }
@keyframes rec-wave { 0%, 100% { transform: scaleY(.2); } 50% { transform: scaleY(var(--peak)); } }
.rec-bar.is-live .rec-wave i { animation: none; transform: scaleY(.12); transition: transform 70ms linear; }
/* No microphone: say so, and stop looking busy. */
.rec-bar.is-mic-off .rec-wave i { animation: none; transform: scaleY(.12); opacity: .5; }
.rec-bar.is-mic-off .rec-dot { animation: none; background: var(--white); box-shadow: none; opacity: .6; }

/* --- The assessment --- */
.area-top { display: grid; gap: 10px; }
.area-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.area-title { font-size: var(--text-h2); }

/* Every area is one tap away: the steps across the top are links. */
.area-steps ol { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.area-steps a {
  display: grid; align-content: start; gap: 6px;
  min-height: 44px;
  color: var(--ink-soft);
  text-decoration: none;
}
.area-step-bar { height: 6px; border-radius: 999px; background: var(--stone); transition: background-color .15s; }
.area-step-label {
  font-size: var(--text-label);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.area-steps a:hover .area-step-bar { background: var(--brand); }
.area-steps a:hover .area-step-label { color: var(--brand-deep); }
.area-steps .is-done .area-step-bar { background: var(--brand); }
.area-steps .is-done .area-step-label { color: var(--ink); }
.area-steps .is-current .area-step-bar { background: var(--brand-deep); }
.area-steps .is-current .area-step-label { color: var(--brand-deep); font-weight: 700; }

/* Grows with its text where the browser can (field-sizing), so the last line
   of a draft is never hidden behind a scrollbar. */
.input-area { min-height: 8rem; resize: vertical; line-height: 1.5; field-sizing: content; }

/* After .fieldset-plain, whose margin: 0 would otherwise win. */
/* Two lilac panels side by side, the same family as "How a visit works"
   and the consent card: what she sees and rates on the left, her notes on
   the right. On a computer they stretch to the same height. */
.area-panel {
  background: var(--brand-wash);
  border-radius: var(--radius-m);
  padding: 20px 22px;
}
.area-form { display: flex; flex-direction: column; gap: 18px; }
.area-form .section-label, .area-notes .section-label { color: var(--brand-deep); }
/* The rating sits at the foot of its panel, level with the foot of the notes. */
.area-rating { margin-top: auto; }

/* What she sees: tapped on and off. Chosen ones fill in, with a tick. */
.pick-chips { gap: 8px; }
.pick span {
  gap: 6px;
  border: 1px solid rgba(91, 75, 138, .22);
  background: var(--white);
  color: var(--ink);
  font-weight: 500;
}
.pick:hover span { border-color: var(--brand); }
.pick input:checked + span {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: var(--white);
  font-weight: 600;
}
.pick input:checked + span::before { content: '✓'; font-weight: 700; }
/* Her own findings: "+ Add" opens a field in the row, "+N more" opens the
   whole list once the row is full. Both are made by scribe-demo.js. */
.chip-btn {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 14px;
  border-radius: 999px;
  font: 600 var(--text-small)/1 var(--font);
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.chip-add { border: 1px dashed rgba(91, 75, 138, .55); background: transparent; color: var(--brand-deep); }
.chip-add:hover { border-style: solid; background: var(--white); }
.chip-more { border: 1px solid transparent; background: rgba(91, 75, 138, .14); color: var(--brand-deep); }
.chip-more:hover { background: rgba(91, 75, 138, .22); }
.chip-input {
  min-height: 40px; width: 15rem; max-width: 100%;
  padding: 0 16px;
  border: 1px solid var(--brand-deep);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font: 500 var(--text-body)/1 var(--font);
}
.chip-input:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: 2px; }

.picks-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 22px 24px;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(35, 31, 32, .25);
}
.picks-dialog[open] { display: flex; flex-direction: column; gap: 16px; }
.picks-dialog::backdrop { background: rgba(35, 31, 32, .45); }
.picks-dialog .section-label { color: var(--brand-deep); margin-bottom: 2px; }
.picks-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.picks-close {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--mist);
  color: var(--ink);
  font-size: 1.375rem; line-height: 1;
  cursor: pointer;
}
.picks-close:hover { background: var(--stone); }
.picks-all {
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  border-radius: var(--radius-m);
  background: var(--brand-wash);
}
.pick-wrap { display: inline-flex; align-items: center; gap: 2px; }
.pick-remove {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.125rem; line-height: 1;
  cursor: pointer;
}
.pick-remove:hover { background: var(--white); color: var(--danger); }
.picks-add { display: flex; gap: 10px; }
.picks-add .input { flex: 1; min-height: 44px; border-radius: 999px; padding-inline: 18px; }
.picks-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }


/* Her rating: one control in three parts, each with its colour dot. The
   colour never works alone: the words say it too. */
.seg-fine  { --seg: var(--ok);     --seg-tint: #E6F4EE; }
.seg-watch { --seg: #C98A12;       --seg-tint: #FCF1DC; }
.seg-act   { --seg: var(--danger); --seg-tint: #FBE6E4; }
/* As wide as its three words, never the width of the panel. */
.rating-seg {
  display: inline-flex;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  background: var(--white);
  border: 1px solid rgba(91, 75, 138, .18);
  border-radius: 999px;
}
.seg span {
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-small);
  font-weight: 500;
  white-space: nowrap;
}
.seg:hover span { background: var(--mist); }
.seg input:checked + span {
  background: var(--seg-tint);
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--seg);
}
.rating-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--seg); }

.area-notes { display: flex; flex-direction: column; }
.area-notes .section-label { margin-bottom: 4px; }
.area-notes .field-hint { margin-bottom: 10px; }
.area-notes .area-note { border-color: rgba(91, 75, 138, .22); }

.area-nav {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--stone);
}

/* --- Processing and filed: one block in the middle of the screen --- */
.center-screen { display: grid; place-items: center; }
.center-card {
  width: min(540px, 100%);
  padding: 28px 32px;
  box-shadow: 0 1px 2px rgba(35, 31, 32, .04), 0 16px 40px rgba(91, 75, 138, .10);
}

.progress-steps { display: grid; gap: 12px; }
.progress-steps li { display: flex; align-items: center; gap: 14px; color: var(--ink-soft); }
.progress-mark {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--stone);
  display: grid; place-items: center;
}
.progress-steps .is-active { color: var(--ink); font-weight: 600; }
.progress-steps .is-active .progress-mark {
  border-color: var(--brand-deep);
  border-right-color: transparent;
  animation: spin .9s linear infinite;
}
.progress-steps .is-done { color: var(--ink); }
.progress-steps .is-done .progress-mark { border-color: var(--ok); background: var(--ok); }
.progress-steps .is-done .progress-mark::after { content: '✓'; color: var(--white); font-size: .875rem; font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- The family report: always the public arrangement, deep teal first --- */
.report-viewer { background: var(--mist); border-radius: var(--radius-m); padding: 20px; }

.report-paper {
  --brand: var(--deep-teal);
  --brand-deep: var(--deep-teal);
  --brand-wash: var(--teal-wash);
  --accent: var(--turquoise);
  --accent-deep: var(--lilac-deep);
  max-width: 820px;
  margin-inline: auto;
  padding: clamp(24px, 6vw, 56px);
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(46, 111, 124, .14);
}
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; }
.report-mark { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; color: var(--deep-teal); }
.report-mark .logo { width: 220px; }
.report-creds { font-size: .9375rem; color: var(--ink-soft); padding-bottom: 6px; }
.report-contact { display: grid; gap: 4px; font-size: .9375rem; align-content: start; overflow-wrap: anywhere; }
.report-contact li { display: flex; align-items: center; gap: 10px; }
.report-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--turquoise); }

.report-title {
  display: flex; align-items: center; gap: 20px;
  margin: 36px 0 24px;
  max-width: none;
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: center;
}
.report-title::before, .report-title::after { content: ''; flex: 1; height: 1px; background: var(--ink-soft); }

.report-facts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.report-facts > div { border: 1px solid var(--stone); border-radius: 4px; padding: 10px 14px; }
.report-facts dt {
  color: var(--deep-teal);
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.report-facts dd { margin: 2px 0 0; font-size: 1rem; }

.report-body { display: grid; gap: 24px; margin-top: 36px; }
.report-body h3 { color: var(--deep-teal); font-size: 1.1875rem; margin-bottom: 6px; }
.report-body p { font-size: 1rem; }
.report-body .road { margin: 12px 0 0; }
.report-foot {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--stone);
  display: grid; gap: 6px;
  font-size: .9375rem;
  color: var(--ink-soft);
}

/* --- Filed --- */
.filed { width: min(920px, 100%); display: grid; gap: 22px; }
.filed-head { display: flex; align-items: center; gap: 18px; }
.filed-mark {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ok); color: var(--white);
  font-size: 1.5rem; font-weight: 700;
  box-shadow: 0 0 0 8px #E2F1EB;
}
.filed-grid { display: grid; gap: 20px; align-items: start; }
.filed-actions { justify-content: flex-start; }
.done-list { display: grid; gap: 12px; }
.done-list li { display: flex; gap: 12px; align-items: flex-start; }
.done-mark {
  flex: none;
  width: 24px; height: 24px; margin-top: 1px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ok); color: var(--white);
  font-size: .9375rem; font-weight: 700;
}
.done-mark-sm { width: 22px; height: 22px; margin-top: 0; font-size: .9375rem; }

/* --- Home: each visit, and the two ways to capture it --- */
.visit-card { background: var(--white); border: 1px solid var(--stone); }
.visit-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.visit-card-name { color: var(--ink); font-weight: 600; }
.visit-card-actions { display: flex; flex-direction: column; gap: 8px; }
.visit-go { white-space: nowrap; }

/* A small microphone, drawn: a capsule on a stand. */
.mic-icon {
  position: relative;
  flex: none;
  width: 10px; height: 14px;
  margin: 0 4px 4px 2px;
  border: 2px solid currentColor;
  border-radius: 6px;
}
.mic-icon::after {
  content: '';
  position: absolute;
  left: 50%; top: 100%;
  width: 14px; height: 6px;
  transform: translateX(-50%);
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

/* --- Who the visit is for, and its type, which she can change --- */
.visit-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }

/* The type is a pill that opens: its name, and a chevron that says so. */
.type-switch { position: relative; }
.type-switch-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 12px 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand-wash);
  color: var(--brand-deep);
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background-color .15s, border-color .15s;
}
.type-switch-trigger::-webkit-details-marker { display: none; }
.type-switch-trigger:hover { border-color: color-mix(in srgb, var(--brand-deep) 35%, transparent); }
.type-switch[open] > .type-switch-trigger { background: var(--white); border-color: var(--brand-deep); }
.type-switch-chevron {
  flex: none;
  width: 8px; height: 8px;
  margin: -4px 2px 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s;
}
.type-switch[open] .type-switch-chevron { margin-top: 4px; transform: rotate(-135deg); }

.type-switch-menu {
  position: absolute; z-index: 30;
  top: calc(100% + 8px); left: 0;
  width: max-content;
  min-width: 300px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  background: var(--white);
  box-shadow: 0 18px 44px rgba(35, 31, 32, .16);
  animation: card-in .12s ease-out;
}
.type-switch-head {
  margin: 4px 10px 6px;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.type-switch-who {
  margin-left: 6px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}
.type-switch-who::before { content: '· '; }
.type-switch-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.type-option {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.type-switch-menu form { margin: 0; }
.type-option:hover { background: var(--mist); }
.type-option[aria-current] { background: var(--brand-wash); }
/* A radio, drawn: the chosen one filled. */
.type-option-mark {
  flex: none;
  width: 20px; height: 20px; margin-top: 2px;
  border: 2px solid var(--stone);
  border-radius: 50%;
  background: var(--white);
}
.type-option:hover .type-option-mark { border-color: var(--brand-deep); }
.type-option[aria-current] .type-option-mark {
  border-color: var(--brand-deep);
  box-shadow: inset 0 0 0 4px var(--white);
  background: var(--brand-deep);
}
.type-option-text { display: grid; gap: 2px; min-width: 0; }
.type-option-name { font-weight: 600; line-height: 1.3; }
.type-option[aria-current] .type-option-name { color: var(--brand-deep); }
.type-option-meta { font-size: .875rem; line-height: 1.35; color: var(--ink-soft); }
.type-switch-foot {
  display: block;
  margin-top: 6px; padding: 10px 12px 6px;
  border-top: 1px solid var(--stone);
  font-size: .9375rem; font-weight: 600;
  color: var(--brand-deep);
}

/* On a phone the menu is a sheet from the bottom. The dimmed backdrop is
   part of the summary, so tapping it closes the menu without JavaScript. */
@media (max-width: 560px) {
  .type-switch[open] > .type-switch-trigger::before {
    content: '';
    position: fixed; inset: 0; z-index: 40;
    background: rgba(35, 31, 32, .45);
    cursor: default;
  }
  .type-switch-menu {
    position: fixed; z-index: 41;
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; min-width: 0; max-width: none;
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(35, 31, 32, .2);
    animation: sheet-up .2s ease-out;
  }
  /* Phones: every tap target 44px, no text under 15px. */
  .type-switch-trigger { min-height: 44px; }
  .type-switch-head { font-size: .9375rem; }
  .type-option { padding: 12px; }
  .type-option-meta { font-size: .9375rem; }
  .type-switch-foot { display: flex; align-items: center; min-height: 48px; padding-block: 6px 0; }
}

/* The card she just switched: a short glow, so she sees what changed. */
.visit-card.is-switched { animation: switched 1.6s ease-out; }
@keyframes switched {
  0%, 30% { border-color: var(--brand-deep); box-shadow: 0 0 0 4px var(--brand-wash); }
}

/* --- Talk about it --- */
.talk-panel {
  display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px;
  padding: 28px 24px;
  border-radius: var(--radius-l);
  background: var(--brand-wash);
  text-align: center;
}
.talk-lead { max-width: 40ch; font-size: var(--text-lead); line-height: 1.5; }

/* Talk or type: one control, two equal choices. The chosen one fills in. */
.mode-switch {
  display: inline-flex; gap: 4px;
  padding: 4px;
  border: 1px solid rgba(91, 75, 138, .22);
  border-radius: 999px;
  background: var(--white);
}
.mode-switch[hidden] { display: none; }
.mode-option {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; min-width: 116px; padding: 0 22px;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--brand-deep);
  font: 600 1rem/1 var(--font);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.mode-option:hover { background: var(--brand-wash); }
.mode-option[aria-pressed='true'] { background: var(--brand-deep); color: var(--white); }
.mode-option .mic-icon { margin-bottom: 4px; }

/* A small keyboard, drawn: keys on a board, the space bar below. */
.keys-icon {
  position: relative;
  flex: none;
  width: 18px; height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background:
    radial-gradient(circle, currentColor 1px, transparent 1.4px) 1px 1px / 4px 4px repeat-x;
}
.keys-icon::after {
  content: '';
  position: absolute;
  left: 3px; right: 3px; bottom: 2px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.mode-pane { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px; }
.mode-pane[hidden] { display: none; }
.type-pane { justify-items: stretch; gap: 10px; max-width: 520px; text-align: left; }
.type-label { font-weight: 600; }
.type-box { min-height: 9rem; background: var(--white); border-color: rgba(91, 75, 138, .3); line-height: 1.55; }
.type-pane .btn { justify-self: start; }
.type-pane .btn[hidden] { display: none; }
.type-status { color: var(--ink); min-height: 1.5em; }
.rec-button {
  width: 132px; height: 132px;
  display: grid; place-items: center; align-content: center; gap: 10px;
  border: 0; border-radius: 50%;
  background: var(--brand-deep);
  color: var(--white);
  font: 700 1.125rem/1 var(--font);
  cursor: pointer;
  box-shadow: 0 0 0 8px rgba(91, 75, 138, .14), 0 12px 30px rgba(91, 75, 138, .3);
  transition: background-color .15s, box-shadow .2s;
}
.rec-button:hover { background: var(--brand-hover); }
.rec-button:disabled { opacity: .6; cursor: progress; }
.rec-button-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--rec); transition: border-radius .2s; }
.is-recording .rec-button { background: var(--danger); animation: rec-ring 1.6s ease-in-out infinite; }
.is-recording .rec-button-dot { border-radius: 4px; background: var(--white); }
@keyframes rec-ring { 50% { box-shadow: 0 0 0 16px rgba(168, 58, 116, .18), 0 12px 30px rgba(168, 58, 116, .3); } }
.is-mic-off .rec-button { opacity: .6; }

.talk-meter {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 440px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--brand-deep);
  color: var(--white);
}
.talk-time { color: var(--white); }
/* Flat until she records: this meter never pretends. */
.talk-wave i { animation: none; transform: scaleY(.12); transition: transform 70ms linear; }
.talk-status { max-width: 44ch; min-height: 3em; color: var(--ink); }

.talk-notes { display: grid; gap: 14px; align-content: start; }
.note-list { display: grid; gap: 10px; }
.note-list:empty { display: none; }
.note-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
  padding: 12px 14px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  background: var(--white);
}
.note-kind { font-weight: 600; }
.note-text { grid-column: 1 / -1; font-size: var(--text-small); color: var(--ink-soft); }
.note-item audio { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 44px; }
.note-remove { grid-column: 2; grid-row: 1; }
.talk-actions { display: flex; flex-wrap: wrap; gap: 12px; }
a.btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; }
.talk-private { max-width: 52ch; }

/* --- The report: read, edit, check, file --- */
body.doc main { padding-block: 20px 0; }
.report-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.report-top-actions { gap: 8px; }
.report-intro { display: grid; gap: 4px; }
.report-intro .small { max-width: 70ch; }

.locked-icon {
  flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--warn); color: var(--white);
  font-weight: 700; font-size: .9375rem;
}
.to-check {
  display: grid; gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-m);
  background: var(--warn-wash);
  box-shadow: inset 4px 0 0 var(--warn);
  scroll-margin-top: 16px;
}
.to-check.is-clear { background: #E2F1EB; box-shadow: inset 4px 0 0 var(--ok); }
.to-check.is-clear .locked-icon { background: var(--ok); }
.to-check-title { display: flex; align-items: center; gap: 10px; font-size: var(--text-h3); max-width: none; }
.check-list { display: grid; gap: 10px; }
.check-card { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius-s); background: var(--white); }
.check-message { max-width: none; }
.check-options { display: flex; flex-wrap: wrap; gap: 8px; }
.check-done {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-s);
  background: #E2F1EB;
  color: var(--ok); font-weight: 600; font-size: var(--text-small);
}

.report-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.report-tools[hidden] { display: none; }

/* --- The marks: who wrote what, and what is waiting ---
   Four stages, each its own line under the words, never colour alone:
   none (the app), solid lilac (hers), solid green (hers, improved), wavy
   (a suggestion, coloured by kind). Clean view takes them all away. */
.report-paper {
  --mark-mine: #8C7BB9;
  --mark-improved: #2E9E6B;
  --mark-improved-tint: #E3F4EB;
}
.sg-correctness { --sg: #C0392B; --sg-tint: #FBE9E7; --sg-deep: var(--danger); }
.sg-clarity     { --sg: #7A68B0; --sg-tint: var(--lilac-wash); --sg-deep: var(--lilac-deep); }
.sg-australian  { --sg: #2E8C99; --sg-tint: #DDF3F5; --sg-deep: var(--deep-teal); }

.report-paper .w-m {
  text-decoration: underline 2px var(--mark-mine);
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;
}
.report-paper .w-i {
  text-decoration: underline 2px var(--mark-improved);
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color .15s;
}
.report-paper .w-i:hover { background: var(--mark-improved-tint); }
.report-paper .w-i:focus-visible { outline: 3px solid var(--mark-improved); outline-offset: 2px; }

.sg {
  text-decoration: underline wavy var(--sg);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
  text-decoration-skip-ink: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color .15s, opacity .2s;
}
/* The words inside a suggestion show only the wavy line. */
.sg .w { text-decoration: none; }
.sg:hover, .sg.is-open { background: var(--sg-tint); }
.sg:focus-visible { outline: 3px solid var(--sg); outline-offset: 2px; }
.sg.is-new { animation: sg-draw .6s ease-out both; }
.sg.is-leaving { opacity: .25; text-decoration: line-through var(--sg); }
.w-i.is-fresh { animation: sg-fresh 1.4s ease-out; }
@keyframes sg-draw {
  from { text-decoration-color: transparent; text-underline-offset: 12px; }
  to   { text-decoration-color: var(--sg); text-underline-offset: 5px; }
}
@keyframes sg-fresh {
  0%   { background: #BFE6D1; text-underline-offset: 10px; }
  35%  { background: #BFE6D1; text-underline-offset: 4px; }
  100% { background: transparent; text-underline-offset: 4px; }
}

.report-paper.clean .w-m, .report-paper.clean .w-i, .report-paper.clean .sg {
  text-decoration: none;
  background: none;
  cursor: auto;
}

/* The scan, when a section is checked: a soft light passing over it. */
.r-body { position: relative; }
.is-checking .r-body::after {
  content: '';
  position: absolute; inset: -4px -8px;
  border-radius: var(--radius-s);
  background: linear-gradient(100deg, transparent 20%, rgba(140, 123, 185, .22) 50%, transparent 80%);
  background-size: 250% 100%;
  animation: scan .65s ease-in-out;
  pointer-events: none;
}
@keyframes scan { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* The legend above the report. */
.mark-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; max-width: none; font-size: var(--text-small); color: var(--ink-soft); }
.key { margin-right: 4px; font-weight: 700; color: var(--ink); text-underline-offset: 4px; text-decoration-skip-ink: none; }
.key-mine { text-decoration: underline 2px #8C7BB9; }
.key-improved { text-decoration: underline 2px #2E9E6B; }
.key-sg { text-decoration: underline wavy 1.5px #C0392B; }

.r-sec { display: grid; gap: 6px; scroll-margin-top: 16px; }
.r-sec[hidden] { display: none; }
.r-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.report-body .r-sec-head h3 { margin: 0 auto 0 0; }

/* --- Editing a section in place --- */
.r-sec.is-editing .r-body {
  margin: -10px -12px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  background: #FBFAFE;
  box-shadow: 0 0 0 2px var(--lilac-deep);
  caret-color: var(--lilac-deep);
}
.r-sec.is-editing [contenteditable] { outline: none; }
.r-sec.is-editing .road-body [contenteditable] {
  min-height: 1.6em;
  padding: 2px 6px;
  margin-inline: -6px;
  border-radius: 6px;
}
.r-sec.is-editing .road-body [contenteditable]:focus { background: var(--lilac-wash); }
.r-sec.is-editing [contenteditable]:empty::before,
.r-sec.is-editing .r-body p:only-child:empty::before { content: 'Type here'; color: var(--ink-soft); }
.r-sec.is-editing .road-body p[contenteditable]:empty::before { content: 'A line of detail (optional)'; }
.add-step { justify-self: start; margin-top: 4px; border-color: var(--lilac-deep); color: var(--lilac-deep); }

.r-edit {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid rgba(91, 75, 138, .3);
  border-radius: 999px;
  background: var(--white);
  color: var(--lilac-deep);
  font: 600 var(--text-small)/1 var(--font);
  cursor: pointer;
}
.r-edit::before { content: '✎' / ''; font-size: 1rem; }
.r-edit:hover { background: var(--lilac-wash); border-color: var(--lilac-deep); }
.r-edit[hidden] { display: none; }
.r-edit.is-done { background: var(--lilac-deep); border-color: var(--lilac-deep); color: var(--white); }
.r-edit.is-done::before { content: '✓' / ''; }

/* --- The card for one suggestion: under the word, or up from the bottom on a phone --- */
.sg-card {
  position: absolute; z-index: 40;
  width: min(360px, calc(100vw - 32px));
  display: grid; gap: 12px;
  padding: 14px 16px 16px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(35, 31, 32, .18);
  animation: card-in .16s ease-out;
}
.sg-card[hidden] { display: none; }
.sg-card.is-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto;
  width: 100%;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(35, 31, 32, .2);
  animation: sheet-up .2s ease-out;
}
@keyframes card-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sg-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sg-card-kind { display: flex; align-items: center; gap: 8px; font-size: var(--text-small); font-weight: 700; color: var(--ink-soft); }
.sg-card-title { margin: 2px 0 0; font-size: 1.0625rem; font-weight: 700; }
.sg-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.dot-correctness { background: #C0392B; }
.dot-clarity { background: #7A68B0; }
.dot-australian { background: #2E8C99; }
.dot-improved { background: #2E9E6B; }
.sg-close {
  flex: none;
  width: 44px; height: 44px; margin: -8px -8px 0 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.5rem; line-height: 1;
  cursor: pointer;
}
.sg-close:hover { background: var(--mist); color: var(--ink); }
.sg-change { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; max-width: none; font-size: 1.0625rem; }
.sg-change del { color: var(--ink-soft); text-decoration-thickness: 2px; }
.sg-arrow { color: var(--ink-soft); }
.sg-now {
  min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 999px;
  font: 700 1.0625rem/1 var(--font);
  cursor: pointer;
  transition: filter .15s;
}
.sg-now:hover { filter: brightness(.95); }
.now-correctness { background: #FBE9E7; color: var(--danger); }
.now-clarity { background: var(--lilac-wash); color: var(--lilac-deep); }
.now-australian { background: #DDF3F5; color: var(--deep-teal); }
.sg-why { font-size: var(--text-small); color: var(--ink-soft); max-width: none; }
.sg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sg-all { margin-left: auto; }

/* --- The count at the foot of the screen --- */
.writing-button { gap: 10px; }
.writing-button[hidden] { display: none; }
.writing-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--stone); }
.writing-button.is-open .writing-dot { background: #C0392B; box-shadow: 0 0 0 4px #FBE9E7; }
.writing-button.is-clear .writing-dot { background: #2E9E6B; }
.writing-button.is-editing { background: var(--lilac-deep); border-color: var(--lilac-deep); color: var(--white); }
.writing-button.is-editing .writing-dot { background: var(--white); }
.r-flag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--warn);
  color: var(--white);
  font-size: .9375rem; font-weight: 700;
  text-decoration: none;
}
.r-flag[hidden] { display: none; }
.r-body { display: grid; gap: 10px; }
.r-body:empty { display: none; }
.report-body .r-body .road { margin: 4px 0 0; }
.road-body h4 { font-size: 1.125rem; margin-bottom: 4px; }
.report-body .road-body h4 { font-size: 1rem; }
.r-sec.is-missing h3 { color: var(--ink-soft); }
.r-missing {
  display: grid; gap: 10px;
  padding: 12px 14px;
  border: 1px dashed #B9B5B3;
  border-radius: var(--radius-s);
  color: var(--ink-soft);
  font-size: var(--text-small);
}
.r-missing[hidden], .r-missing-actions[hidden] { display: none; }
.r-missing-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.r-missing .btn-secondary { border-color: var(--lilac-deep); color: var(--lilac-deep); }

/* Where a section came from: closed until she wonders. Never in the PDF. */
.r-src > summary {
  display: inline-flex; align-items: center;
  min-height: 44px;
  color: var(--lilac-deep);
  font-size: var(--text-small); font-weight: 600;
  cursor: pointer;
}
.src-list { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius-s); background: var(--mist); }
.src-label { display: block; font-size: var(--text-small); font-weight: 600; color: var(--ink-soft); }
.src-text { font-size: var(--text-small); }
.src-text mark { background: var(--lilac-wash); color: var(--ink); box-shadow: inset 0 -2px 0 var(--lilac); padding: 0 2px; }

.left-out { font-size: var(--text-small); color: var(--ink-soft); }
.left-out[hidden] { display: none; }
.link-button {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0;
  border: 0; background: none;
  color: var(--lilac-deep);
  font: 600 var(--text-small) var(--font);
  text-decoration: underline;
  cursor: pointer;
}

.report-note .report-title { margin-top: 0; }

.ideas { display: grid; gap: 10px; padding: 18px 20px; border-radius: var(--radius-m); background: var(--mist); }
.ideas[hidden] { display: none; }
.idea-list { display: grid; gap: 10px; }
.idea { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--stone); border-radius: var(--radius-s); background: var(--white); }
.idea-title { font-weight: 700; max-width: none; }
.idea-why { font-size: var(--text-small); color: var(--deep-teal); font-weight: 600; }
.idea-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.idea-actions[hidden] { display: none; }

/* The two things she does last, always in reach at the foot of the screen. */
.report-bar {
  position: sticky; bottom: 0; z-index: 6;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stone);
  background: rgba(255, 255, 255, .96);
}
.report-bar-why { margin-right: auto; color: var(--warn); font-weight: 600; }
.report-bar-why:empty { display: none; }
.report-bar [hidden] { display: none; }
/* Waiting, not broken: flat and quiet, and the words beside it say why. */
.btn.is-locked { background: var(--mist); border-color: var(--stone); color: var(--ink-soft); }

/* Sheets: editing a section, the writing check, what she had written. */
.check-sheet, .was-sheet {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 20px 22px;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(35, 31, 32, .25);
}
.check-sheet[open], .was-sheet[open] { display: flex; flex-direction: column; gap: 14px; }
.check-sheet { overflow-y: auto; }
.check-sheet::backdrop, .was-sheet::backdrop { background: rgba(35, 31, 32, .45); }
.edit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.edit-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.suggest-list { display: grid; gap: 12px; }
.suggest-card { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--stone); border-radius: var(--radius-m); }
.suggest-card.is-decided { background: var(--mist); }
.suggest-card .section-label { margin-bottom: 0; }
.suggest-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.diff { line-height: 1.7; max-width: none; }
.diff del { background: #FBE6E4; color: var(--danger); text-decoration-thickness: 2px; }
.diff ins { background: #DDF0E6; color: #16603F; text-decoration: underline; text-decoration-thickness: 2px; }
.held { color: var(--warn); font-weight: 600; }
.was-sheet .btn { align-self: flex-end; }

/* --- The assessment, filled in from what she said --- */
.fill-list { display: grid; gap: 12px; }
.fill-card {
  display: grid; align-content: start; gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  background: var(--white);
}
.fill-card.is-empty { background: var(--mist); border-style: dashed; }
.fill-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.rating-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--seg-tint);
  box-shadow: inset 0 0 0 1.5px var(--seg);
  font-size: var(--text-small); font-weight: 700;
}
.fill-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.fill-picks li {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--brand-wash);
  color: var(--brand-deep);
  font-size: var(--text-small); font-weight: 600;
}
.fill-note { font-size: var(--text-small); max-width: none; }
.fill-edit { justify-self: start; }
@media (min-width: 760px) { .fill-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }

/* --- Settings: visit types --- */
.back-link { font-size: var(--text-small); }
.back-link a::before { content: '‹ '; }
.lead-small { color: var(--ink-soft); max-width: 60ch; }
.settings-link { display: grid; gap: 4px; }
.settings-link .h-sub { color: var(--brand-deep); }

/* Settings -> Connections */
.conn-list { display: grid; gap: 12px; }
.conn-row { display: grid; gap: 10px; }
.conn-row .band { margin: 0; }
.conn-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.conn-state {
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--brand-wash);
  color: var(--brand-deep);
  font-size: .9375rem;
  font-weight: 600;
}
/* Settings -> Your writing style */
.style-progress { display: grid; gap: 10px; }
.style-trend { display: grid; gap: 10px; margin: 0; }
.style-trend > div {
  display: grid; gap: 2px;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  background: var(--mist);
}
.style-trend dt { font-size: var(--text-small); color: var(--ink-soft); }
.style-trend dd { margin: 0; }
.style-trend-figure { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.style-trend-figure.is-better { color: var(--brand-deep); }
@media (min-width: 560px) { .style-trend { grid-template-columns: 1fr 1fr; } }
.style-learning {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stone);
}
.rule-list { display: grid; gap: 10px; }
.rule-card { display: grid; gap: 6px; }
.rule-card.rule-noticed { background: var(--brand-wash); }
.rule-card.rule-off .rule-text { color: var(--ink-soft); }
.rule-text { font-weight: 600; max-width: none; }
.rule-meta { font-size: var(--text-small); color: var(--ink-soft); }
.rule-scope { color: var(--brand-deep); font-weight: 600; }
.rule-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rule-actions .btn { min-height: 44px; padding-inline: 16px; }
.rule-change > summary {
  display: inline-flex; align-items: center;
  min-height: 44px;
  color: var(--brand-deep);
  font-weight: 600;
  cursor: pointer;
}
.rule-change[open] > summary { margin-bottom: 8px; }
.rule-form { display: grid; gap: 4px; }
.rule-form .btn { justify-self: start; }
.rule-input { min-height: 4.5rem; }
.rule-example { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--text-small); }
.rule-example del { padding: 1px 8px; border-radius: 999px; background: var(--mist); color: var(--ink-soft); }
.rule-example ins { padding: 1px 8px; border-radius: 999px; background: #E6F4EE; color: var(--ink); font-weight: 600; text-decoration: none; }

/* A small four-point spark: "this is the app adapting to you", wherever it shows. */
.style-spark {
  display: inline-block; flex: none;
  width: .9em; height: .9em; margin-right: .35em;
  background: var(--lilac-deep);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  vertical-align: -.08em;
}

/* How it learns: three steps across the top of the page. */
.style-steps { display: grid; gap: 8px; counter-reset: none; }
.style-steps li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: var(--lilac-wash);
  font-size: var(--text-small);
}
.style-step-num {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--lilac-deep); color: var(--white);
  font-weight: 700;
}
@media (min-width: 700px) { .style-steps { grid-template-columns: repeat(3, 1fr); } }

/* Lately: what the last reports taught it. */
.lesson-log { display: grid; gap: 0; border-top: 1px solid var(--stone); }
.lesson-log li {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--stone);
  font-size: var(--text-small);
}
.lesson-when { color: var(--ink-soft); }
.lesson-kind { font-weight: 700; color: var(--lilac-deep); }
.lesson-kind::after { content: ':'; }
.lesson-in_use { color: var(--ok); }
.lesson-dropped { color: var(--ink-soft); }

/* On the report: which of her rules this draft followed. */
.style-note { font-size: var(--text-small); }
.style-note > summary {
  display: inline-flex; align-items: center;
  min-height: 44px;
  color: var(--lilac-deep); font-weight: 600;
  cursor: pointer;
}
.style-note-list { display: grid; gap: 4px; margin: 2px 0 8px; padding-left: 1.4em; list-style: disc; }
.style-note a { font-weight: 600; }

/* On the Filed screen: what this report taught. */
.learned {
  display: grid; gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-m);
  background: var(--lilac-wash);
}
.learned-list { display: grid; gap: 8px; }
.learned-item {
  display: grid; gap: 2px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--white);
}
.learned-text { font-weight: 600; }
.learned-kind { font-size: var(--text-small); color: var(--ink-soft); }
.learned-in_use .learned-kind { color: var(--ok); font-weight: 600; }
.learned-wait { display: flex; align-items: center; gap: 10px; }
.learned-dots {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--lilac-deep);
  animation: learned-pulse 1.2s ease-in-out infinite;
}
@keyframes learned-pulse { 50% { opacity: .25; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .learned-dots { animation: none; } }

/* On Today: the way in to her lessons. */
.head-stat-style { min-height: 44px; align-items: center; text-decoration: none; color: var(--ink); background: var(--lilac-wash); }
.head-stat-style:hover { text-decoration: underline; }
.head-stat-style.is-new { background: var(--lilac-deep); color: var(--white); }
.head-stat-style.is-new .head-stat-num { color: var(--white); }
.head-stat-style.is-new .style-spark { background: var(--white); }

.type-list { display: grid; gap: 12px; }
.type-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.type-card-meta { margin-top: 6px; font-size: var(--text-small); color: var(--ink-soft); }
.type-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.type-card-actions .btn, .row-buttons .btn { padding-inline: 16px; }
.archived-list { display: grid; gap: 8px; }
.archived-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.type-form { display: grid; gap: 16px; }
.row-list { display: grid; gap: 12px; margin-bottom: 14px; }
.row-card { padding: 0 16px; border-radius: var(--radius-m); background: var(--mist); }
.row-fold[open] { display: grid; gap: 8px; padding-bottom: 14px; }
.row-summary {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px;
  font-weight: 600;
  cursor: pointer;
}
.row-summary::marker { color: var(--brand-deep); }
.row-name { flex: 1; }
.row-count { font-size: var(--text-small); font-weight: 500; color: var(--ink-soft); }
.row-card .field { margin-bottom: 10px; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.type-save {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stone);
  background: rgba(255, 255, 255, .96);
}
.type-save .btn-big { min-height: 48px; font-size: 1.0625rem; }

/* Two columns on a computer, one on a phone. */
.demo-split { display: grid; gap: 24px; align-items: start; }
/* A column never grows past the screen because of what is in it (the meter bars). */
.demo-split > * { min-width: 0; }
.demo.stack > * + * { margin-top: 18px; }
.demo .lead { max-width: 70ch; }
.demo .checkbox-row { margin-bottom: 0; }
.demo .btn-big { min-height: 48px; font-size: 1rem; }
.demo .road-stop { padding-bottom: 10px; }
@media (min-width: 561px) { .demo .visit-card { grid-template-columns: 5rem 1fr auto; } }

/* Side by side from a small laptop or a tablet held sideways. */
@media (min-width: 760px) {
  .demo-split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; }
  .filed-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- On a computer, every demo screen fits the window ----------
   The body is exactly the window's height and never scrolls. What is long
   (a list of notes) scrolls inside its own pane instead, and
   `.fill` is the part of a screen that takes whatever height is left. If the
   window is shorter than even that, <main> scrolls rather than cutting
   anything off. Phones keep ordinary page scrolling.

   The demo also drops a step in scale here, the way a desktop app sits a
   little denser than a phone app: 15px body, 14px small print. */
@media (min-width: 760px) {
  body.fit {
    --text-small: .875rem;    /* 14 */
    --text-label: .75rem;     /* 12, uppercase labels only */
    --text-body:  .9375rem;   /* 15 */
    --text-lead:  1rem;       /* 16 */
    --text-h3:    1.0625rem;  /* 17 */
    --text-h2:    1.625rem;   /* 26 */
    --text-h1:    1.625rem;
    --tap:        40px;

    height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  }
  body.fit > .site-header { flex: none; }
  body.fit > main { flex: 1; min-height: 0; overflow: auto; padding-block: 18px; }
  body.fit .demo { height: 100%; display: flex; flex-direction: column; }
  body.fit .demo.stack > * + * { margin-top: 16px; }
  body.fit .demo > .fill { flex: 1; min-height: 0; }

  body.fit .header-bar { min-height: 56px; padding-block: 6px; }
  body.fit .nav-link { min-height: 36px; }
  body.fit .btn { font-size: .9375rem; padding: 0 18px; }
  body.fit .btn-compact { min-height: 38px; }
  body.fit .chip span { min-height: 36px; padding: 0 14px; font-size: var(--text-body); }
  body.fit .chip-btn, body.fit .chip-input { min-height: 36px; }
  body.fit .chips { gap: 8px; }
  body.fit .seg span { font-size: var(--text-small); padding: 0 16px; }
  body.fit .card, body.fit .card-link, body.fit .panel { padding: 18px 20px; }
  body.fit .field > label { font-size: var(--text-body); font-weight: 600; }
  body.fit .legend-plain { font-size: var(--text-body); font-weight: 600; }
  body.fit .road-marker { width: 30px; height: 30px; font-size: .875rem; }
  body.fit .road-stop { grid-template-columns: 30px 1fr; gap: 12px; }
  body.fit .road-stop:not(:last-child)::before { left: 14px; top: 30px; }
  body.fit .road-body h3 { font-size: var(--text-body); }
  body.fit .road-body p { font-size: var(--text-small); line-height: 1.45; }
  body.fit .area-steps a { min-height: 0; }
  body.fit .agree-row { min-height: 44px; }
  body.fit .rec-bar { padding: 7px 16px; }
  body.fit .center-card { padding: 28px 32px; }

  /* The notes box is as tall as the window allows, within reason, so a
     short window still fits and a tall one does not get a wall of white. */
  /* The assessment uses the height it is given: the gaps grow with the
     window, and the two panels take what is left, up to a point, so a tall
     screen does not get a wall of lilac. */
  body.fit .demo.stack > .area-top,
  body.fit .demo.stack > .area-split,
  body.fit .demo.stack > .area-nav { margin-top: clamp(16px, 4dvh, 36px); }
  body.fit .area-split { flex: 1 1 auto; max-height: 390px; align-items: stretch; }
  .area-notes .area-note { flex: 1; min-height: 6rem; field-sizing: fixed; resize: none; }

}

/* A short window: a laptop with Windows display scaling at 150-200% leaves
   the browser 450-550px of height. Everything tightens a step so the screens
   before and during the assessment still fit without scrolling. */
@media (min-width: 760px) and (max-height: 640px) {
  body.fit > main { padding-block: 12px; }
  body.fit .demo.stack > * + * { margin-top: 12px; }
  body.fit .header-bar { min-height: 48px; padding-block: 4px; }
  body.fit .logo-sm { width: 104px; }
  body.fit { --text-h2: 1.375rem; }
  body.fit .demo .card, .demo .card-link, .demo .panel, .demo .consent-card { padding: 14px 18px; }
  body.fit .demo.stack > .area-top,
  body.fit .demo.stack > .area-split,
  body.fit .demo.stack > .area-nav { margin-top: 10px; }
  body.fit .area-split { flex: none; }
  body.fit .demo .area-panel { padding: 12px 16px; }
  body.fit .demo .area-form { gap: 10px; }
  body.fit .demo .section-label { margin-bottom: 6px; }
  body.fit .demo .pick span { min-height: 32px; padding: 0 12px; }
  body.fit .demo .chip-btn, body.fit .demo .chip-input { min-height: 32px; }
  body.fit .demo .seg span { min-height: 32px; }
  body.fit .demo .chips { gap: 6px; }
  body.fit .demo .field-hint { display: none; }
  body.fit .demo .area-top { gap: 8px; }
  body.fit .demo .area-nav { padding-top: 10px; }
  body.fit .demo .agree-row { min-height: 38px; }
  body.fit .demo .btn-big { min-height: 42px; }
  /* Consent: the legend says it all; the hint under it goes, and the gaps close. */
  body.fit .consent-form legend + .small { display: none; }
  body.fit .consent-form .mt-3 { margin-top: 10px; }
  body.fit .consent-form .mt-2 { margin-top: 6px; }
  body.fit .consent-others-label { margin-top: 2px; }
  /* Step by step on one page: the same tight spacing the area screens had. */
  body.fit .guided, body.fit .guided-area { gap: 10px; }
  body.fit .guided .area-split { margin-top: 0; }
  body.fit .demo .rec-bar { padding: 5px 14px; }
  body.fit .demo .road { margin-top: 10px; }
  body.fit .demo .road-stop { padding-bottom: 6px; }
  body.fit .demo .road-body p { line-height: 1.35; }
  body.fit .demo .done-list { gap: 8px; }
  body.fit .demo .visit-card-reason { display: none; }
  body.fit .demo .visit-list { gap: 8px; }
  body.fit .demo .visit-card { padding: 10px 16px; }
  body.fit .demo .visit-card-actions { flex-direction: row; }
  body.fit .demo .visit-card-actions .btn { min-height: 36px; }
  /* The visits take the whole width; how a visit works is on the phone and on taller screens. */
  body.fit .type-switch-trigger { min-height: 32px; }
  body.fit .demo .talk-panel { gap: 8px; padding: 14px 18px; }
  body.fit .demo .mode-pane { gap: 8px; }
  body.fit .demo .talk-lead { display: none; }
  body.fit .demo .type-box { min-height: 6rem; }
  body.fit .demo .rec-button { width: 88px; height: 88px; font-size: 1rem; gap: 6px; }
  body.fit .demo .rec-button-dot { width: 16px; height: 16px; }
  body.fit .demo .talk-meter { padding: 6px 14px; }
  body.fit .demo .talk-status { min-height: 0; }
  body.fit .demo .talk-notes { gap: 10px; }
  body.fit .home-split { grid-template-columns: minmax(0, 1fr); }
  body.fit .home-split > .panel { display: none; }
  body.fit .demo .visit-card-body { grid-template-columns: auto 1fr; align-items: baseline; column-gap: 12px; }
  body.fit .demo .center-card { padding: 20px 24px; }
  body.fit .demo .filed { gap: 14px; }
  body.fit .demo .filed-mark { width: 40px; height: 40px; font-size: 1.125rem; box-shadow: 0 0 0 6px #E2F1EB; }
  body.fit .demo .consent-script { line-height: 1.45; }
  body.fit .demo .consent-note { margin-top: 8px; }
  body.fit .demo .screen-head-text > p.small { display: none; }
}

@media (max-width: 560px) {
  .visit-card { grid-template-columns: 1fr; }
  .visit-card-time { display: flex; align-items: center; gap: 10px; }
  .visit-card-actions .btn { width: 100%; }
  .report-viewer { padding: 0; background: none; }
  .report-bar .btn { flex: 1 1 auto; }
  .check-sheet { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; padding: 16px; border-radius: 0; }
  .rec-button { width: 116px; height: 116px; }
  .area-nav .btn { width: 100%; }
  /* Too narrow for one bar: three separate pills that wrap, each only as
     wide as its words. */
  .rating-seg { flex-wrap: wrap; gap: 8px; padding: 0; border: 0; background: none; }
  .seg span { min-height: 44px; background: var(--white); border: 1px solid rgba(91, 75, 138, .22); }
  .seg input:checked + span { border-color: transparent; }
  .chip-btn, .chip-input { min-height: 44px; }
  .report-facts { grid-template-columns: 1fr; }
  .report-mark .logo { width: 170px; }
  .rec-bar { border-radius: var(--radius-m); }
  .rec-client { flex: 1 1 100%; padding-left: 0; border-left: 0; white-space: normal; }
  /* Eight names will not fit across a phone: the bars stay, the names are
     still read out. */
  .area-step-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .area-steps a { position: relative; align-content: center; }
}

@media print {
  .screen-head, .report-bar { display: none !important; }
  .report-paper { box-shadow: none; border: 0; padding: 0; }
}

/* ==========================================================================
   Calendar: the month at a glance, and the chosen day beside it
   ========================================================================== */

/* Each visit type has a colour, in her order; other Halaxy appointments are grey. */
.hue-lilac { --hue: #8C7BB9; --hue-tint: #EFEDF6; }
.hue-teal  { --hue: #3FB3C1; --hue-tint: #DDF3F5; }
.hue-amber { --hue: #D9A441; --hue-tint: #FCF1DC; }
.hue-rose  { --hue: #C95A94; --hue-tint: #FBE6F0; }
.hue-none  { --hue: #B4B1AE; --hue-tint: var(--mist); }

/* The month switcher is one control in three parts: back, today, forward. */
.cal-nav {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  border: 1px solid var(--stone);
  border-radius: 999px;
  background: var(--white);
}
.cal-nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 16px;
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--text-small); font-weight: 600; line-height: 1;
  text-decoration: none;
  transition: background-color .15s, color .15s;
}
.cal-nav-btn:hover { background: var(--mist); }
.cal-nav-btn[aria-current] { background: var(--brand-wash); color: var(--brand-deep); }
.cal-arrow { width: 36px; padding: 0; }
.chev {
  flex: none;
  display: inline-block;
  width: 8px; height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.chev-left { transform: translateX(2px) rotate(45deg); }
.chev-right { transform: translateX(-2px) rotate(-135deg); }

.cal-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .cal-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 20px; } }

/* The month: one sheet, ruled into days by hairlines. */
.cal-month {
  display: flex; flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  background: var(--white);
}
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays { border-bottom: 1px solid var(--stone); }
.cal-weekdays span {
  padding: 10px 10px 8px;
  font-size: .75rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft);
}
/* The 1px gaps show the sheet behind: those are the rules between the days. */
.cal-days {
  grid-auto-rows: minmax(96px, auto);
  gap: 1px;
  margin: 0; padding: 0;
  background: var(--stone);
  list-style: none;
}
.cal-days > li { min-width: 0; min-height: 0; background: var(--white); }
.cal-day {
  display: flex; flex-direction: column; gap: 3px;
  height: 100%; min-height: 0;
  padding: 6px;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  transition: background-color .12s;
}
.cal-day.is-weekend, .cal-day.is-out { background: #FAFAF9; }
.cal-day:hover { background: var(--mist); }
.cal-day.is-selected { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-num {
  flex: none;
  align-self: flex-start;
  display: grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 5px;
  border-radius: 999px;
  font-size: .875rem; font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cal-day.is-out .cal-num { color: var(--ink-soft); font-weight: 500; }
.cal-day.is-today .cal-num { background: var(--brand-deep); color: var(--white); }

/* Coming visits sit on their colour; what has happened is a quiet line with a dot. */
.cal-chips { display: grid; gap: 2px; min-width: 0; }
.cal-chip, .cal-more {
  display: block;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: .8125rem;
  line-height: 18px;
}
.cal-chip {
  position: relative;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--hue-tint);
  color: var(--ink);
  font-weight: 500;
}
.cal-chip-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day.is-past .cal-chip { padding-left: 14px; background: none; color: var(--ink-soft); }
.cal-day.is-past .cal-chip::before {
  content: '';
  position: absolute; left: 4px; top: 50%;
  width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%;
  background: var(--hue);
}
.cal-more { padding: 1px 7px; font-weight: 600; color: var(--ink-soft); }
.cal-chip.drop-3, .cal-more.more-2 { display: none; }

.cal-dots { display: none; gap: 3px; }
.cal-dots i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--hue); }

/* Each day fits what it shows to its own size: three lines of names need
   105px, two need 83px, and below that the day shows dots. A line is 20px,
   the date and padding above and below are 41px. */
@media (min-width: 761px) {
  .cal-days > li { container-type: size; }
  @container (max-height: 104.9px) {
    .cal-chip:nth-child(n+3), .cal-chip.drop-2, .cal-more.more-3 { display: none; }
    .cal-more.more-2 { display: block; }
  }
  @container (max-height: 82.9px) or (max-width: 64px) {
    .cal-chips { display: none; }
    .cal-dots { display: flex; flex-wrap: wrap; padding-left: 5px; }
  }
  @container (max-height: 52px) {
    .cal-day { flex-direction: row; align-items: center; gap: 6px; padding-block: 4px; }
    .cal-num { align-self: center; }
    .cal-dots { flex-wrap: nowrap; padding-left: 0; }
  }
}

.cal-key {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  margin: 0; padding: 10px 14px;
  border-top: 1px solid var(--stone);
  list-style: none;
  font-size: .8125rem; color: var(--ink-soft);
}
.cal-key li { display: inline-flex; align-items: center; gap: 7px; }
.cal-key i { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--hue); }

/* The chosen day: a header that stays put, and the day's visits as a timeline. */
.cal-panel {
  display: flex; flex-direction: column;
  min-width: 0;
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  background: var(--white);
}
.cal-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--stone);
}
.cal-panel-title { display: grid; gap: 2px; min-width: 0; }
.cal-panel-sum { margin: 0; font-size: var(--text-small); color: var(--ink-soft); }
.pill-today { flex: none; margin-top: 2px; background: var(--brand-deep); color: var(--white); }
.cal-panel-body {
  padding: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--stone) transparent;
}

.cal-list { display: grid; margin: 0; padding: 0; list-style: none; }
.cal-entry {
  position: relative;
  display: grid; gap: 4px; justify-items: start;
  padding: 0 0 22px 26px;
}
.cal-entry:last-child { padding-bottom: 2px; }
.cal-entry > * { margin: 0; max-width: none; }
/* A dot in the visit type's colour, and a line down to the next visit. */
.cal-entry::before {
  content: '';
  position: absolute; left: 0; top: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--hue);
  box-shadow: 0 0 0 3px var(--hue-tint);
}
.cal-entry::after {
  content: '';
  position: absolute; left: 5px; top: 23px; bottom: 3px;
  width: 2px;
  border-radius: 1px;
  background: var(--stone);
}
.cal-entry:last-child::after { display: none; }
.cal-entry-when {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px;
  font-size: var(--text-small); line-height: 1.5;
  color: var(--ink-soft);
}
.cal-entry-time { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-entry.is-past .cal-entry-time { color: var(--ink-soft); }
.cal-entry-title { position: relative; justify-self: stretch; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.cal-entry-name { font-size: var(--text-h3); font-weight: 600; line-height: 1.3; }
.cal-type {
  display: inline-flex; align-items: center;
  min-height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: var(--hue-tint);
  font-size: .875rem; font-weight: 600;
  color: var(--ink);
}
.cal-entry-reason { font-size: var(--text-small); line-height: 1.5; color: var(--ink-soft); }
.cal-entry .visit-card-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
@media (min-width: 761px) { .cal-entry .visit-card-actions .btn { padding-inline: 14px; gap: 8px; } }
/* The type menu opens across the panel, under the name, so the panel never clips it. */
@media (min-width: 561px) {
  .cal-entry .type-switch { position: static; }
  .cal-entry .type-switch-menu { left: -10px; right: -10px; width: auto; min-width: 0; max-width: none; }
}

/* An empty day, with the next visit one tap away. */
.cal-empty { display: grid; gap: 14px; }
.cal-empty-text { color: var(--ink-soft); }
.cal-next {
  display: grid; gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--stone);
  border-radius: var(--radius-s);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, background-color .15s;
}
.cal-next:hover { border-color: var(--brand); background: var(--mist); }
.cal-next-label { font-size: var(--text-small); font-weight: 700; color: var(--brand-deep); }
.cal-next-when { font-weight: 600; }
.cal-next-who { font-size: var(--text-small); color: var(--ink-soft); }

/* On a computer the calendar is one window: the month fills what is left,
   and a long day scrolls under its own header. */
@media (min-width: 900px) {
  body.fit .cal-layout { align-items: stretch; min-height: 0; }
  body.fit .cal-month { min-height: 0; }
  body.fit .cal-days { flex: 1; min-height: 0; grid-auto-rows: minmax(0, 1fr); }
  body.fit .cal-panel { min-height: 0; overflow: hidden; }
  body.fit .cal-panel-body { flex: 1; min-height: 0; overflow: auto; }
}
/* Short windows: a little tighter all round. */
@media (min-width: 760px) and (max-height: 700px) {
  body.fit .cal-weekdays span { padding-block: 6px 5px; }
  body.fit .cal-key { padding-block: 7px; }
  body.fit .cal-panel-head { padding: 12px 16px 10px; }
  body.fit .cal-panel-body { padding: 14px 16px; }
  body.fit .cal-entry { padding-bottom: 16px; }
  /* Today with a check-in line on the next home visit: the reason keeps to two lines. */
  body.fit .visit-card-reason { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  body.fit .visit-list { gap: 8px; }
  body.fit .visit-card { padding-block: 12px; }
}

/* Phones: the month is a compact grid of dates with dots, the day's list below it. */
@media (max-width: 760px) {
  .cal-weekdays { padding: 8px 4px 0; border-bottom: 0; }
  .cal-weekdays span {
    padding: 4px 0;
    text-align: center;
    font-size: .9375rem; font-weight: 600;
    letter-spacing: 0; text-transform: none;
  }
  .cal-days { grid-auto-rows: 54px; gap: 0; padding: 0 4px 6px; background: none; }
  .cal-days > li { background: none; }
  .cal-day, .cal-day.is-weekend, .cal-day.is-out, .cal-day:hover { background: none; }
  .cal-day { align-items: center; gap: 4px; padding: 4px 0; }
  .cal-day.is-selected { box-shadow: none; }
  .cal-num { align-self: center; width: 36px; height: 36px; font-size: 1rem; }
  .cal-day.is-selected .cal-num { box-shadow: inset 0 0 0 2px var(--brand-deep); }
  .cal-day.is-selected:not(.is-today) .cal-num { background: var(--brand-wash); color: var(--brand-deep); }
  .cal-chips { display: none; }
  .cal-chip, .cal-more { font-size: .9375rem; }
  .cal-dots { display: flex; justify-content: center; }
  .cal-key { gap: 6px 16px; padding: 12px 14px; font-size: .9375rem; }
  .cal-nav-btn { min-height: 44px; font-size: 1rem; }
  .cal-arrow { width: 44px; }
  .cal-panel-head { padding: 16px 16px 14px; }
  .cal-panel-body { padding: 18px 16px; }
  .cal-entry { padding-left: 24px; }
  .cal-entry-when, .cal-entry-reason, .cal-type { font-size: .9375rem; }
  .cal-type { min-height: 32px; }
  .cal-entry .visit-card-actions { justify-self: stretch; }
  .cal-entry .visit-card-actions .btn { flex: 1 1 auto; }
}


/* ==========================================================================
   The visit flow, made real (planning/ready-to-connect-plan.md)
   ========================================================================== */

/* Notices on Today: a draft deleted after 7 days, a recording not sent. */
.notice-list { display: grid; gap: 8px; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.notice-text { flex: 1 1 24ch; }
.notice-form { margin: 0; }

/* A visit's state on its card. */
.visit-filed {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  color: var(--ok);
  font-weight: 600;
  text-decoration: none;
}
.visit-card-date { font-size: .9375rem; font-weight: 500; color: var(--ink-soft); }

/* Adding a visit by hand (HALAXY_MODE=off). */
.add-visit { margin-top: 12px; }
.add-visit-summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--brand-deep); }
.add-visit-form { display: grid; gap: 12px; margin-top: 12px; }

/* Talk: a note's delete button sits in its own small form. */
.note-remove-form { margin: 0; }
.type-pane .btn[data-typed-add] { justify-self: start; }

/* Consent: the others, named. */
.consent-others-label { margin-top: 8px; }

/* Step by step, all on one page: one area shows at a time with the script. */
.guided { display: grid; gap: 18px; }
.guided-area { display: grid; gap: 18px; scroll-margin-top: 16px; }
.guided .area-steps { margin-top: 0; }

/* The report changed on another device. */
.save-conflict { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.report-bar { margin: 0; }
.report-bar .btn.is-locked { opacity: .75; }

/* A recording a closed page could not finish sending. */
.pending-band { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px auto 0; }
.pending-band .btn { background: var(--white); }

/* Filing to Halaxy: each document, and what she can do about it (plan §9.3). */
.filing-list { display: grid; gap: 12px; }
.filing { display: grid; gap: 10px; justify-items: start; }
.filing .band { margin: 0; justify-self: stretch; }
.filing .actions { margin: 0; }
.filing-state { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; margin: 0; }

/* ==========================================================================
   Check-in, attendance and mileage (planning/ready-to-connect-plan.md §8)
   ========================================================================== */

/* The strip at the top of Today: where she is in her day, and the one thing
   to tap next (src/routes/nurse/day-strip.tsx). The main button is always in
   the same place, big enough to hit without looking twice. */
.day-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 24px;
  background: var(--brand-wash);
  border: 0;
  border-left: 6px solid var(--turquoise);
}
.strip-text { display: grid; gap: 2px; min-width: 0; }
.strip-eyebrow { margin: 0; }
.strip-title { margin: 0; font-size: 1.375rem; }
.strip-meta { margin: 0; color: var(--ink-soft); }
.strip-actions { display: grid; gap: 8px; align-content: start; }
.strip-form { margin: 0; }
.strip-main { width: 100%; min-height: var(--tap-big); font-size: 1.1875rem; }
.strip-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px; }
.strip-more .btn { min-height: 44px; }
.strip-quiet { min-height: 44px; padding: 0 4px; }
.strip-note { margin: 0; font-size: .9375rem; color: var(--ink-soft); grid-column: 1 / -1; }
/* Going somewhere else first: the other visits, each with its own button. */
.strip-others { width: 100%; }
.strip-others summary { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; color: var(--brand-deep); font-weight: 600; list-style: none; }
.strip-others summary::-webkit-details-marker { display: none; }
.strip-others summary::after {
  content: ''; width: 8px; height: 8px; margin-top: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.strip-others[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.strip-others ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.strip-others li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.strip-others li .btn { min-height: 44px; }
/* At a visit: the running state, a stronger frame. */
.day-strip-at { border-left-color: var(--brand-deep); }
/* The day is done: one quiet line. */
.strip-done { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-soft); }
.strip-done-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--turquoise); color: var(--ink); font-weight: 700;
}
/* On a computer the strip heads the right-hand column, above "After a visit",
   and the day's visits keep the left: Today still fits one window. */
@media (min-width: 760px) {
  .home-split { grid-template-areas: 'visits strip' 'visits side'; grid-template-rows: auto 1fr; }
  .home-split:not(:has(> .day-strip, > .strip-done)) { grid-template-areas: 'visits side'; grid-template-rows: auto; }
  .home-split > .day-strip, .home-split > .strip-done { grid-area: strip; }
  .home-split > .home-visits { grid-area: visits; }
  .home-split > .panel { grid-area: side; }
  .strip-more { justify-content: flex-start; }
  .strip-others summary { justify-content: flex-start; }
}
@media (min-width: 760px) and (max-height: 700px) {
  body.fit .day-strip { padding-block: 12px; gap: 8px; }
  body.fit .strip-title { font-size: 1.25rem; }
  body.fit .strip-main { min-height: 48px; font-size: 1.0625rem; }
  body.fit .strip-note { display: none; }
  /* "After a visit" keeps its steps' names, not their explanations. */
  body.fit .home-split .road-body p { display: none; }
  body.fit .home-split .road-stop { padding-bottom: 6px; }
}
/* A small window: one column, the strip on one line above the visits. */
@media (min-width: 760px) and (max-height: 640px) {
  body.fit .home-split { grid-template-areas: none; grid-template-rows: none; }
  body.fit .home-split > * { grid-area: auto; }
  body.fit .home-split { gap: 10px; }
  body.fit .day-strip { grid-template-columns: 1fr minmax(200px, 260px); align-items: center; padding-block: 6px; }
  body.fit .strip-main { min-height: 40px; }
  body.fit .strip-eyebrow, body.fit .strip-more { display: none; }
  body.fit .strip-text { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; }
}

/* Mileage settings: her home, for the drive home. */
.home-point { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--stone); display: grid; gap: 8px; }
.home-point .field-label { margin: 0; font-size: 1rem; font-weight: 600; }
.home-point .actions { margin: 0; align-items: center; }
.home-point form { margin: 0; }

/* Settings, then Reminders. */
.push-card p { margin: 0 0 12px; }
.push-steps { margin: 0 0 8px; padding-left: 1.4em; display: grid; gap: 6px; }
.push-said:empty { display: none; }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.device-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.device-list form { margin: 0; }

/* Mileage */
.mileage-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 0; }
.mileage-totals > div { background: var(--brand-wash); border-radius: var(--radius-s); padding: 10px 14px; }
.mileage-totals dt { font-size: .9375rem; color: var(--ink-soft); }
.mileage-totals dd { margin: 2px 0 0; font-size: 1.375rem; font-weight: 600; color: var(--brand-deep); }
.trip-days { display: grid; gap: 12px; }
.trip-day { display: grid; gap: 8px; }
.trip-list { display: grid; gap: 4px; }
.trip {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  padding: 8px 10px; min-height: 44px;
  border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none;
}
a.trip:hover { background: var(--mist); }
.trip-where { font-weight: 600; }
.trip-km { text-align: right; font-variant-numeric: tabular-nums; }
.trip-est { color: var(--ink-soft); font-size: .9375rem; font-weight: 400; }
.trip-purpose { grid-column: 1 / -1; }

/* ==========================================================================
   Moving between pages (public/js/nav.js)
   ========================================================================== */

/* Where the browser can (Chrome, Edge, Safari 18.2+), a page change is a
   quick cross-fade and the header stays put, instead of a blink to white. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 140ms; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* The skeleton of the page on its way: pale shapes where its parts will be,
   with a slow sweep of light so it reads as "coming", not "broken". */
.sk-frame { padding-block: 24px; }
.sk-page { display: grid; gap: 18px; }
.sk {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--stone) 0%, #F3F2F1 40%, var(--stone) 80%);
  background-size: 300% 100%;
  animation: sk-sweep 1.4s ease-in-out infinite;
}
@keyframes sk-sweep {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}
.sk-line { height: 14px; }
.sk-tall { height: 20px; }
.sk-title { height: 32px; margin-top: 6px; }
.sk-label { height: 12px; margin-bottom: 4px; }
.sk-w20 { width: 20%; } .sk-w30 { width: 30%; } .sk-w40 { width: 40%; } .sk-w50 { width: 50%; }
.sk-w60 { width: 60%; } .sk-w70 { width: 70%; } .sk-w80 { width: 80%; } .sk-w90 { width: 90%; }
.sk-pill { height: 44px; }
.sk-head { display: grid; gap: 8px; }
.sk-card {
  display: grid; gap: 12px;
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: var(--radius-m);
  padding: 20px 22px;
}
.sk-stack { display: grid; gap: 10px; min-width: 0; }
.sk-list { display: grid; gap: 12px; align-content: start; }
.sk-split { display: grid; gap: 18px; }
/* Today: the strip first on a phone, as the page will be. */
.sk-strip {
  display: grid; gap: 10px;
  background: var(--brand-wash);
  border-left: 6px solid var(--turquoise);
  border-radius: var(--radius-m);
  padding: 20px 22px;
}
.sk-strip .sk { background-image: linear-gradient(90deg, #DCD8EA 0%, #F3F2F8 40%, #DCD8EA 80%); }
.sk-main { height: var(--tap-big); margin-top: 6px; }
.sk-visit { grid-template-columns: 1fr; }
.sk-time { width: 70px; height: 18px; }
.sk-button { height: 44px; }
/* The calendar: a month of days. */
.sk-month { grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 14px; }
.sk-day { height: 54px; border-radius: var(--radius-s); }
/* Mileage: the three totals, then the list. */
.sk-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.sk-total { height: 72px; border-radius: var(--radius-s); }
@media (min-width: 760px) {
  /* Today on a computer: the visits on the left, the strip on the right. */
  .sk-split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; }
  .sk-split > .sk-strip { order: 2; align-self: start; }
  .sk-visit { grid-template-columns: 5rem 1fr 150px; align-items: center; column-gap: 20px; }
  .sk-month { gap: 8px; }
  .sk-day { height: 76px; }
}

/* ---------- Proposals and payments (planning/payments-plan.md) ---------- */
.included-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.consent-row { align-items: flex-start; margin-bottom: 8px; }
.consent-row input { flex: none; margin-top: 3px; }
.pay-details { display: grid; gap: 0; margin: 0; }
.pay-row {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: 4px 16px;
  padding: 10px 0;
  border-top: 1px solid var(--stone);
  align-items: center;
}
.pay-row:last-child { border-bottom: 1px solid var(--stone); }
.pay-row dt { color: var(--ink-soft); font-weight: 500; }
.pay-row dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pay-value { font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .pay-row { grid-template-columns: 1fr; }
}
.scam-line { margin-top: 28px; }

/* Cris's Clients list */
.client-groups { display: grid; gap: 28px; }
.client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.client-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.client-group-count {
  min-width: 22px; padding: 0 7px;
  border-radius: 999px;
  background: var(--brand-wash); color: var(--brand-deep);
  font-size: var(--text-small); letter-spacing: 0; text-align: center;
}
/* A row is one tap target: the name's link covers the whole card. */
.client-row {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 14px;
  padding-block: 10px;
  border-left: 4px solid var(--stone);
  transition: border-color .15s, box-shadow .15s;
}
.client-row:hover, .client-row:focus-within { box-shadow: 0 2px 10px rgba(40, 30, 80, .08); }
.client-row-you { border-left-color: var(--warn); }
.client-row-client { border-left-color: var(--lilac); }
.client-row-upcoming { border-left-color: var(--ok); }
.client-initial {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-wash); color: var(--brand-deep);
  font-weight: 700;
}
.client-row-main { display: grid; gap: 2px; }
.client-row-name { font-weight: 700; text-decoration: none; color: var(--ink); }
.client-row-name::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.client-row-name:focus-visible { outline: none; }
.client-row-name:focus-visible::after { outline: 3px solid var(--brand-deep); outline-offset: 2px; }
.client-row-status { font-weight: 600; color: var(--ink); }
.client-row-you .client-row-status { color: var(--warn); }
.client-row-done .client-row-status { font-weight: 400; color: var(--ink-soft); }
.client-row-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.client-row-go {
  width: 9px; height: 9px;
  border-right: 2px solid var(--brand-deep); border-top: 2px solid var(--brand-deep);
  transform: rotate(45deg);
}
@media (max-width: 480px) {
  .client-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .client-row-go { display: none; }
}

/* The three figures: quiet at nothing, amber when owed to her, green when in. */
.money-card { border: 1px solid var(--stone); border-radius: var(--radius-m); background: var(--white); overflow: hidden; }
.money-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.money-total { display: grid; gap: 4px; padding: 18px 20px; border-left: 1px solid var(--stone); }
.money-total:first-child { border-left: 0; }
.money-total dt { font-size: var(--text-small); color: var(--ink-soft); }
.money-total dd { margin: 0; }
.money-total-num { font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.money-total.is-zero .money-total-num { color: var(--ink-soft); font-weight: 600; }
.money-total.is-owed .money-total-num { color: var(--warn); }
.money-total.is-in .money-total-num { color: var(--ok); }
.money-note { padding: 10px 20px; background: var(--mist); font-size: var(--text-small); color: var(--ink-soft); max-width: none; }
@media (max-width: 520px) {
  .money-totals { grid-template-columns: 1fr; }
  .money-total { grid-template-columns: 1fr auto; align-items: baseline; padding: 12px 16px; border-left: 0; border-top: 1px solid var(--stone); }
  .money-total:first-child { border-top: 0; }
  .money-total-num { font-size: 1.25rem; }
}

/* What the AI cost: one sentence, then client by client. */
.ai-cost { display: grid; gap: 10px; }
.ai-cost-total { max-width: none; }
.ai-cost-num { font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--lilac-deep); }
.ai-cost-list { display: grid; border-top: 1px solid var(--stone); }
.ai-cost-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 14px; align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--stone);
}
.ai-cost-name { font-weight: 600; }
.ai-cost-detail { grid-column: 1; font-size: var(--text-small); color: var(--ink-soft); }
.ai-cost-amount { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.ai-cost-note { font-size: var(--text-small); color: var(--ink-soft); max-width: none; }
.ai-cost-line { font-size: var(--text-small); max-width: none; }

/* Not Cris's own details yet: said once, calmly, not shouted. */
.setup-note {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-s);
  border-left: 4px solid var(--warn);
  background: var(--warn-wash);
  font-size: var(--text-small); max-width: none;
}
.setup-note-mark {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--warn); color: var(--white);
  font-weight: 700; font-size: .9375rem;
}

/* Nothing yet: say what this page will do for her. */
.clients-empty {
  display: grid; gap: 12px; justify-items: start;
  padding: 22px;
  border-radius: var(--radius-m);
  background: var(--brand-wash);
}
.money-steps { display: grid; gap: 10px; width: 100%; }
.money-steps li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--white);
}
.money-step-num {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--brand-deep); color: var(--brand-deep);
  font-weight: 700;
}
.money-step-detail { display: block; font-size: var(--text-small); color: var(--ink-soft); }
@media (min-width: 620px) { .money-steps { grid-template-columns: 1fr 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.timeline li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 12px; }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }
.link-box { overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; font-size: var(--text-small); background: var(--white); padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--stone); }

/* With Clients in the menu there are six sections: on a laptop-width window
   the label gives way, as it does on a phone, rather than wrapping the header
   onto two lines. The lilac and the menu already say where she is. */
.area-label { white-space: nowrap; }
@media (min-width: 701px) and (max-width: 1100px) {
  [data-area='nurse'] .area-label { display: none; }
}
.head-stats { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-stat-link { text-decoration: none; color: var(--ink); background: var(--warn-wash); }
.head-stat-link:hover { text-decoration: underline; }
/* A quiet button is still a 44px target: "No thanks", "Waive it". */
.proposal-page .btn-link, .clients .btn-link { min-height: 44px; margin-bottom: 0; }
.proposal-page .disclosure > summary, .clients .disclosure > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.proposal-page .disclosure > summary::before, .clients .disclosure > summary::before { content: '▸'; color: var(--brand-deep); }
.proposal-page .disclosure[open] > summary::before, .clients .disclosure[open] > summary::before { content: '▾'; }
.proposal-page .disclosure > summary::-webkit-details-marker, .clients .disclosure > summary::-webkit-details-marker { display: none; }
.proposal-page .disclosure > summary, .clients .disclosure > summary { list-style: none; }
.client-row-name { min-height: 44px; display: flex; align-items: center; }

/* ---------- The Integrated Assessment form (src/routes/nurse/assessment-form.tsx) ---------- */

/* Her visit page: the header, a slim bar, and the form filling the rest. The
   form scrolls inside its own frame, so this page never does. */
body.form-host { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
body.form-host main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.form-host main > .shell { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; max-width: none; padding-top: 8px; padding-bottom: 0; }
.form-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.form-bar-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; min-width: 0; }
.form-bar-who .client-line { margin: 0; }
.form-bar-status { margin: 0; color: var(--ink-soft); }
.form-bar-actions { display: flex; gap: 8px; }
.form-bar-actions [aria-busy='true'] { opacity: 0.7; cursor: progress; }
.form-frame { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--stone); border-radius: var(--radius-m) var(--radius-m) 0 0; background: var(--white); }
body.form-host .band { margin: 0; }

/* Finish */
.card-urgent { border-color: var(--danger); background: #FDF1F0; }
.card-urgent .h-sub { color: var(--danger); }
.urgent-list, .flag-list { margin: 0; padding-left: 1.2em; list-style: disc; }
.urgent-list li, .flag-list li { margin: 4px 0; }
.report-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.report-pick-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--stone); }
.report-pick-row:first-child { border-top: 0; }
.report-pick-row .checkbox-row { margin: 0; align-items: flex-start; }
.report-pick-use, .report-pick-warn { display: block; color: var(--ink-soft); }
.report-pick-warn { color: var(--warn); }
.score-table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.score-table th, .score-table td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-top: 1px solid var(--stone); }
.score-table thead th { border-top: 0; color: var(--ink-soft); font-weight: 600; }
.score-table tbody th { font-weight: 600; }
.score-value { white-space: nowrap; font-weight: 700; color: var(--brand-deep); }
@media (max-width: 560px) {
  .score-table thead { display: none; }
  .score-table tr { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--stone); padding: 8px 0; }
  .score-table th, .score-table td { border-top: 0; padding: 2px 0; }
  .score-table td:last-child { grid-column: 1 / -1; color: var(--ink-soft); }
  .form-bar-actions { width: 100%; }
  .form-bar-actions .btn { flex: 1; }
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; }
/* On a phone the form needs the height: while she is in it, the section tabs
   and sign out step aside (Today in the bar is the way out), and the bar is
   one short row. */
@media (max-width: 700px) {
  body.form-host .header-right, body.form-host .header-signout { display: none; }
  body.form-host .header-bar { padding-top: 6px; padding-bottom: 6px; }
  body.form-host main > .shell { padding-top: 4px; gap: 6px; }
  .form-bar { flex-wrap: nowrap; gap: 8px; }
  .form-bar-who { flex-direction: column; gap: 0; }
  .form-bar-who .client-line { font-size: var(--text-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
  .form-bar-status { font-size: 0.875rem; }
  .form-bar-actions { width: auto; flex-shrink: 0; }
  .form-bar-actions .btn { flex: none; padding: 6px 12px; min-height: 40px; }
  .form-frame { border-left: 0; border-right: 0; border-radius: 0; margin: 0 calc(-1 * var(--gutter, 16px)); width: calc(100% + 2 * var(--gutter, 16px)); }
}

/* ---------- Money (src/routes/nurse/money.tsx) ---------- */
.money-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-row .field { margin: 0; }
.money-zip-note { color: var(--ink-soft); }
.money-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.money-item {
  display: grid; grid-template-columns: 4.5em 1fr auto; grid-template-areas: 'when what amount' 'when actions actions';
  gap: 4px 12px; align-items: baseline; padding: 10px 12px; background: var(--white); border: 1px solid var(--stone); border-radius: var(--radius-s);
}
.money-when { grid-area: when; color: var(--ink-soft); font-size: var(--text-small); }
.money-what { grid-area: what; display: grid; min-width: 0; }
.money-what .small { color: var(--ink-soft); overflow-wrap: anywhere; }
.money-amount { grid-area: amount; font-weight: 700; color: var(--brand-deep); white-space: nowrap; }
.money-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.money-actions form { margin: 0; }
.money-missing { color: var(--warn); }
@media (max-width: 560px) {
  .money-row { grid-template-columns: 1fr; }
  .money-item { grid-template-columns: 1fr auto; grid-template-areas: 'what amount' 'when when' 'actions actions'; }
}

/* The cancellation fee notice Cris copies to the client (policy S09). */
.fee-notice { white-space: pre-wrap; font: inherit; font-size: 0.95rem; background: var(--stone-soft, #F4F4F4); padding: 12px 14px; border-radius: 10px; margin: 0; user-select: all; }
