/* Home-care intelligence: a calm, familiar care app.
   A light-grey canvas with white cards, near-black text, blue links and green primary buttons.
   Word tags carry meaning, never colour alone; yellow highlighter marks only the words the
   model quoted. Phone first: wider windows add room, and from 840 px (Material 3's expanded
   class) the lead's register sits beside the note. Dark mode keeps every role. */

:root {
  color-scheme: light dark;
  --canvas: #f2f4f5;
  --surface: #ffffff;
  --sunken: #e6eaed;
  --selected: #e3edf8;
  --ink: #1b2127;
  --ink-2: #4a5560;
  --line: #d6dce1;
  --line-strong: #6b7680; /* field and tile borders: at least 3:1 on a card */
  --link: #1757a6;
  --focus: #1757a6;
  --primary: #1d7a48;
  --primary-press: #155f37;
  --on-primary: #ffffff;
  --highlight: #ffe27a;
  --on-highlight: #1b2127;
  --today-bg: #fbe3e4;
  --today: #a3141f;
  --visit-bg: #fff0d4;
  --visit: #874600;
  --check-bg: #e3edf8;
  --check: #1d4f86;
  --tamper-bg: #f0e7f8;
  --tamper: #5c2c8f;
  --unread-bg: #e8ecef;
  --unread: #3c4650;
  --done-bg: #e2f2e8;
  --done: #17683b;
  --streets: #c3cbd2;
  --shadow: 0 1px 2px rgb(16 24 32 / 0.06), 0 3px 10px rgb(16 24 32 / 0.05);
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --radius-control: 8px;
  --gutter: 16px;
  --narrow: 42rem;
  --wide: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #101417;
    --surface: #1a2025;
    --sunken: #232a30;
    --selected: #1c2f45;
    --ink: #e8edf0;
    --ink-2: #aab5be;
    --line: #2e373f;
    --line-strong: #7d8993;
    --link: #8ebbf5;
    --focus: #9cc3ff;
    --primary: #4cb87e;
    --primary-press: #6cc994;
    --on-primary: #06170d;
    --highlight: #6e5a0e;
    --on-highlight: #fff6d1;
    --today-bg: #3d1519;
    --today: #ffb4b9;
    --visit-bg: #3a2a0c;
    --visit: #ffcf87;
    --check-bg: #16293d;
    --check: #a9cdf5;
    --tamper-bg: #2b1b3e;
    --tamper: #d7baf6;
    --unread-bg: #272e34;
    --unread: #c9d2da;
    --done-bg: #12301f;
    --done: #93ddb3;
    --streets: #3a444c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 3px 10px rgb(0 0 0 / 0.25);
  }
}

@media (min-width: 600px) {
  :root { --gutter: 24px; }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-bottom: 7rem; /* a focused field never sits under the sticky action bar */
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font: 1rem/1.5 var(--body);
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--link); color: var(--surface); }

/* The parts the browser draws carry the palette too: scrollbars and the text cursor. */
html { scrollbar-color: var(--line-strong) var(--canvas); }
input, textarea { caret-color: var(--link); }

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

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0; }

.figure { font-variant-numeric: tabular-nums; }
.window { white-space: nowrap; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--surface);
}
.skip:focus { top: 0.5rem; }

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The app bar: the name, the SYNTHETIC tag and who is signed in. It holds still while pages
   change (view transitions), as an app's bar does. */
.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  view-transition-name: appbar;
}
.appbar-inner {
  display: flex;
  flex-wrap: wrap; /* a long account name moves to its own line, never past the screen's edge */
  align-items: center;
  gap: 0 0.5rem;
  max-width: var(--wide);
  min-height: 3.5rem;
  margin: 0 auto;
  padding: 0.25rem max(var(--gutter), env(safe-area-inset-right)) 0.25rem
    max(var(--gutter), env(safe-area-inset-left));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover .brand-name { text-decoration: underline; }
.mark { width: 2rem; height: 2rem; flex: none; }
/* On a phone the bar is narrow: the name is shortened to "Home-care" (screen readers still hear
   it whole), and who is signed in shows from 360 px. */
@media (max-width: 599px) {
  .brand-rest {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (max-width: 359px) {
  .account .who { display: none; }
}
.account { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.account .who { font-size: 0.875rem; color: var(--ink-2); white-space: nowrap; }
.account form { margin: 0; }
.account .button { white-space: nowrap; }

/* The page column: narrow for reading and forms, wide for the office's split views. */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--narrow);
  margin: 0 auto;
  padding: 1rem max(var(--gutter), env(safe-area-inset-right)) 2rem
    max(var(--gutter), env(safe-area-inset-left));
}
.page.wide { max-width: var(--wide); }

.page-head { margin-bottom: 1rem; }
.page-head .sub { max-width: 75ch; margin-top: 0.25rem; color: var(--ink-2); }
.page-head .days { margin-top: 1rem; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 3rem;
  margin: -0.5rem 0 0 -0.25rem;
  padding: 0 0.25rem;
  font-weight: 600;
  text-decoration: none;
}
.back:hover { text-decoration: underline; }

.footer {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.5rem max(var(--gutter), env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  color: var(--ink-2);
  font-size: 0.875rem;
}
.footer p { max-width: 75ch; }
.footer p + p { margin-top: 0.25rem; }

/* Cards: one per question a screen answers. */
.card {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card > h1 { margin-bottom: 0.5rem; }
.card > h2,
.card > .card-head { margin-bottom: 0.75rem; }
.card > p + p { margin-top: 0.5rem; }
.card > p + .details,
.card > .details + p { margin-top: 0.75rem; }
.card p { max-width: 75ch; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.section-title { margin: 1.75rem 0 0.25rem; }
.lead-in { max-width: 68ch; color: var(--ink-2); }
.meta { color: var(--ink-2); font-size: 0.875rem; }
.empty { color: var(--ink-2); }

/* Buttons: a link or a button that does one action, at least 48 px for a thumb or a glove. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.625rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--primary); color: var(--on-primary); }
.button.primary:hover { background: var(--primary-press); }
.button.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--link); }
.button.secondary:hover { border-color: var(--link); }
.button.quiet {
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: var(--link);
}
.button.quiet:hover { text-decoration: underline; }
.button:disabled {
  background: var(--sunken);
  border-color: var(--sunken);
  color: var(--ink-2);
  cursor: not-allowed;
}
.button.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.actions .button { flex: 1 1 12rem; }

/* Word tags: the word carries the meaning, the colour only repeats it. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 6px;
  background: var(--unread-bg);
  color: var(--unread);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.tag .icon { width: 1rem; height: 1rem; stroke-width: 2.5; }
.tag.today { background: var(--today-bg); color: var(--today); }
.tag.visit { background: var(--visit-bg); color: var(--visit); }
.tag.check { background: var(--check-bg); color: var(--check); }
.tag.tamper { background: var(--tamper-bg); color: var(--tamper); }
.tag.done { background: var(--done-bg); color: var(--done); }
.tag.synthetic { background: var(--sunken); color: var(--ink); letter-spacing: 0.04em; }

/* Messages: what happened, calmly. A missing signal is a status, never an error. */
.status-line:not([hidden]) + .page-head { margin-top: 1.25rem; }
.status-line {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: var(--sunken);
  color: var(--ink);
  font-weight: 600;
}
.sent {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: var(--done-bg);
  color: var(--done);
  font-weight: 700;
}
.alert {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--today);
  border-radius: var(--radius-control);
  background: var(--today-bg);
  color: var(--today);
  font-weight: 600;
}
.notice {
  max-width: 75ch;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: var(--check-bg);
  color: var(--check);
}
.notice.tampering { background: var(--tamper-bg); color: var(--tamper); }
.notice.caution { background: var(--visit-bg); color: var(--visit); }

/* The week as seven day chips; the chosen day is raised and underlined, not only coloured. */
.days {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  max-width: 30rem;
  margin: 0;
  padding: 0.25rem;
  border-radius: var(--radius);
  background: var(--sunken);
}
.days a {
  display: grid;
  place-items: center;
  min-height: 3.25rem;
  padding: 0.25rem 0;
  border-radius: var(--radius-control);
  color: var(--ink);
  line-height: 1.2;
  text-decoration: none;
}
.days a:hover { background: var(--surface); }
.days .weekday { font-size: 0.875rem; color: var(--ink-2); }
.days .date { font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.days [aria-current="date"] {
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 -3px 0 var(--link);
}

/* A role's two pages, as a switch in the same tray as the day chips. */
.switch {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border-radius: var(--radius);
  background: var(--sunken);
}
.switch a {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1rem;
  border-radius: var(--radius-control);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.switch a:hover { background: var(--surface); }
.switch [aria-current="page"] {
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 -3px 0 var(--link);
}

/* Lists of rows inside one card: the register, the team, the import rows. */
.list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list > li + li { border-top: 1px solid var(--line); }

/* A register row is one link: the whole row opens the note. */
.row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.125rem 0.75rem;
  align-items: start;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  color: var(--ink);
  text-decoration: none;
}
.row:hover { background: var(--canvas); }
.row:hover .row-title { text-decoration: underline; }
.row[aria-current="page"] { background: var(--selected); }
.row.plain { grid-template-columns: minmax(0, 1fr) auto; } /* a list with no order to number */
.row .num { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.row-main { display: grid; gap: 0.25rem; min-width: 0; }
.row-title { color: var(--link); font-weight: 700; }
.row-meta { color: var(--ink-2); font-size: 0.875rem; }
.row-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.row .chevron { color: var(--ink-2); align-self: center; }

.band-head { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; }
.band-head .count { color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.band-head + .lead-in { margin-top: 0.25rem; font-size: 0.875rem; }

.tally { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.tally strong { font-size: 1.75rem; font-variant-numeric: tabular-nums; }

/* The office's split view: the register beside the note from 840 px. */
.split { display: grid; gap: 1.5rem; }
.split > .pane-list { display: none; }
.split.queue > .pane-list { display: block; }
@media (min-width: 840px) {
  .split { grid-template-columns: minmax(20rem, 25rem) minmax(0, 1fr); align-items: start; }
  .split > .pane-list {
    display: block;
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 1rem;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .pane-tally { color: var(--ink-2); font-size: 0.875rem; }
  .pane-tally + .band-head { margin-top: 0.75rem; }
  .split > .pane-detail { grid-column: 2; grid-row: 1; }
  .split .narrow-only { display: none; }
}
.pane-list > .list:first-child,
.pane-list > .band-head:first-child { margin-top: 0; }

/* The note: the visit, the carer's words, the findings, then what the model missed. */
.details {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) 1fr;
  gap: 0.375rem 1rem;
  margin: 0;
}
.details dt { color: var(--ink-2); }
.details dd { margin: 0; }
@media (max-width: 380px) {
  .details { grid-template-columns: 1fr; gap: 0; }
  .details dd { margin-bottom: 0.5rem; }
}

.entry {
  max-width: 68ch;
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}
mark {
  padding: 0 0.1em; /* inline, so padding would part the quoted words */
  border-radius: 3px;
  background: var(--highlight);
  color: var(--on-highlight);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.ref { margin-left: 0.1em; font-size: 0.75em; font-weight: 700; }

.provenance { margin-top: 1rem; color: var(--ink-2); font-size: 0.875rem; }
.provenance summary {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  color: var(--link);
  cursor: pointer;
}
.provenance code { font-size: 0.8125rem; overflow-wrap: anywhere; }

/* A finding is a card with its own decision; a fieldset keeps the radios grouped for
   screen readers, and its legend floats so it lays out like any heading. */
.finding { margin-top: 1rem; border: 1px solid var(--line); min-inline-size: 0; }
.finding legend {
  float: left;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
}
.finding legend + * { clear: both; }
.finding-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.finding-title .label { font-size: 1.125rem; font-weight: 700; }
.finding .quote { margin-top: 0.25rem; font-size: 1.125rem; line-height: 1.6; }
.finding .why { margin-top: 0.5rem; }
.finding .read { margin-top: 0.5rem; color: var(--ink-2); font-size: 0.875rem; }
.flag { color: var(--visit); font-weight: 700; }

.choices { display: grid; gap: 0.5rem; margin-top: 1rem; }
@media (min-width: 600px) {
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.choice:hover { border-color: var(--link); }
.choice:has(input:checked) {
  border-color: var(--link);
  background: var(--selected);
  box-shadow: inset 0 0 0 1px var(--link);
}
input[type="radio"] {
  appearance: none;
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}
input[type="radio"]:checked {
  border-color: var(--link);
  background: var(--link);
  box-shadow: inset 0 0 0 0.25rem var(--surface);
}
/* Windows High Contrast repaints colours: the radios go back to the system there. */
@media (forced-colors: active) {
  input[type="radio"] { appearance: auto; }
  /* Backgrounds and shadows are dropped too: the current day, page and row get an outline. */
  .days [aria-current="date"],
  .switch [aria-current="page"],
  .row[aria-current] { outline: 2px solid CanvasText; outline-offset: -2px; }
}

.field { display: grid; gap: 0.375rem; margin-top: 1rem; }
.field > label { font-weight: 700; }
select,
input:not([type="radio"]):not([type="hidden"]),
textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: max(1rem, 16px); /* under 16 px, iOS zooms into the field */
}
select:hover, input:hover, textarea:hover { border-color: var(--link); }
textarea { display: block; resize: vertical; line-height: 1.6; }
.compose textarea { min-height: 14rem; font-size: 1.0625rem; }
.hint { color: var(--ink-2); }
.draft-state { min-height: 1.5rem; margin-top: 0.5rem; color: var(--ink-2); font-size: 0.875rem; }
.last { margin-top: 0.75rem; color: var(--done); font-weight: 600; }
.last .icon { vertical-align: -0.2em; margin-right: 0.25rem; }

/* The right-category list shows once "wrong category" is chosen; without :has it always shows. */
@supports selector(:has(*)) {
  .finding .right-category { display: none; }
  .finding:has(input[value="wrong category"]:checked) .right-category { display: grid; }
}

/* The sticky action bar: the screen's one action, under the thumb and clear of the home bar. */
.actionbar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1.5rem calc(-1 * var(--gutter)) 0;
  padding: 0.75rem var(--gutter) max(0.75rem, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgb(16 24 32 / 0.06);
}
.actionbar .meta { flex: 1 1 14rem; }
.actionbar .button { flex: 1 1 100%; }
@media (min-width: 600px) {
  .actionbar {
    margin-inline: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .actionbar .button { flex: 0 0 auto; margin-left: auto; }
}

/* The carer's day: what to do now (write up, where next, the week), the route, then every
   visit. On wide screens the route sits beside the rest. */
.day-layout { display: grid; grid-template-areas: "lead" "side" "all"; gap: 0 1.5rem; }
.day-layout .lead { grid-area: lead; }
.day-layout .side { grid-area: side; }
.day-layout .all { grid-area: all; }
.week { margin-top: 1rem; }
@media (min-width: 840px) {
  .day-layout {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
    grid-template-areas: "lead side" "all side";
    align-items: start;
  }
  .day-layout .side { position: sticky; top: 1rem; }
}
.next-card .client { font-size: 1.25rem; font-weight: 700; }
.leave {
  margin-top: 0.75rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.next-card .trip { margin-top: 0.25rem; }
.next-card .needs { margin-top: 0.75rem; }
.next-card .from { margin-top: 0.75rem; color: var(--ink-2); font-size: 0.875rem; }
.write-up ul { list-style: none; margin: 0; padding: 0; }
.write-up li { display: grid; gap: 0.75rem; padding: 0.75rem 0; }
.write-up li:first-child { padding-top: 0; }
.write-up li:last-child { padding-bottom: 0; }
.write-up li + li { border-top: 1px solid var(--line); }
@media (min-width: 600px) {
  .write-up li { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
}
.waiting p { font-weight: 600; }
.waiting .button { width: 100%; margin-top: 0.75rem; }
.waiting-mark { margin-top: 0.25rem; color: var(--visit); font-weight: 700; }

.visits > li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  padding: 0.875rem 1rem 0.5rem;
}
.sec {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.visits .is-next .sec { border-color: var(--link); background: var(--link); color: var(--surface); }
.visits .what { padding-top: 0.25rem; }
.visits .when, .visits .needs { margin-top: 0.25rem; color: var(--ink-2); font-size: 0.875rem; }
.note-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1rem; margin-top: 0.25rem; }
.note-state a { display: inline-flex; align-items: center; min-height: 3rem; font-weight: 600; }

.route { margin: 1rem 0 0; } /* clear of the day chips above it on a phone */
.route > svg { /* the sketch only: Leaflet draws its own SVG inside the live map */
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-control);
  background: var(--surface);
}
.route .streets { fill: none; stroke: var(--streets); stroke-width: 1; vector-effect: non-scaling-stroke; }
.route .path {
  fill: none;
  stroke: var(--link);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.route .home { fill: var(--surface); stroke: var(--ink); }
.route .stop { fill: var(--link); }
.route .stop.is-next { fill: var(--surface); stroke: var(--link); }
.route .stop-label {
  fill: var(--surface);
  font-family: var(--body);
  font-weight: 700;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.route .stop-label.is-next { fill: var(--link); }
.route figcaption { margin-top: 0.75rem; color: var(--ink-2); font-size: 0.875rem; }

/* With signal, OpenStreetMap's map takes the sketch's place. Its credit sits on the
   map, bottom right, always visible, as OSM's tile policy asks; the controls are ours. */
.route.is-live > svg { display: none; }
.live-map-frame { position: relative; }
.live-map-canvas {
  height: 18rem;
  border-radius: var(--radius-control);
  background: var(--sunken);
  font: inherit;
}
@media (min-width: 840px) {
  .live-map-canvas { height: 22rem; }
}
.map-credit {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1000; /* above Leaflet's panes */
  padding: 0 0.5rem;
  border-top-left-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.8125rem;
}
.map-credit a { display: inline-block; min-height: 1.5rem; line-height: 1.5rem; }
.map-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.map-tools .button { flex: 1 1 6rem; padding-inline: 0.75rem; }
/* Markers drawn as the sketch draws them: numbered boxes, the next one outlined, home a hollow
   square. Leaflet places each at its point; the box centres itself there. */
.map-pin { background: none; border: 0; }
.map-stop,
.map-home { position: absolute; transform: translate(-50%, -50%); }
.map-stop {
  padding: 0.0625rem 0.5rem;
  border: 2px solid var(--link);
  border-radius: 6px;
  background: var(--link);
  color: var(--surface);
  font: 700 0.875rem/1.4 var(--body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgb(16 24 32 / 0.3);
}
.map-stop.is-next { background: var(--surface); color: var(--link); }
.map-home {
  width: 1rem;
  height: 1rem;
  border: 3px solid var(--ink);
  background: var(--surface);
}

/* Sign in: a role chooser, carers first. */
.roles { display: grid; gap: 0; }
@media (min-width: 840px) {
  .page.signin { max-width: 60rem; }
  .roles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
}
.roles form { display: flex; flex-direction: column; }
.roles form .actions { margin-top: auto; padding-top: 1rem; }
.roles form .actions .button { flex: 1 1 100%; }
.roles p { margin-top: 0.25rem; }

/* The manager's team: a list on a phone, aligned columns on a laptop. */
.person { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; padding: 0.75rem 1rem; }
.person .num { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.person .name { font-weight: 700; }
.person .chance { text-align: right; }
.person .chance strong { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.person .more { grid-column: 2 / -1; }
.person summary,
.row-cells summary {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
}
.person ul { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.person .plain { grid-column: 2 / -1; color: var(--ink-2); font-size: 0.875rem; }

/* The import report: each held row with its reasons, then its cells exactly as the file had them. */
.held > li { padding: 0.875rem 1rem; }
.held .reasons { margin-top: 0.25rem; }
/* One reason stated once, above the visits it covers. */
.group-reason { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 1rem; }
.group-reason:first-of-type { margin-top: 0; }
.group-reason .count { color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.group-reason + .list { margin-top: 0.5rem; }
.cells {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
  margin: 0.5rem 0 0;
}
@media (min-width: 840px) {
  .cells { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.cells div { min-width: 0; }
.cells dt { color: var(--ink-2); font-size: 0.875rem; }
.cells dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Motion: pages change like an app's screens. The bar holds; the content cross-fades. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 160ms; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  .sent { animation: arrive 320ms cubic-bezier(0.16, 1, 0.3, 1); }
  @keyframes arrive {
    from { transform: translateY(-0.5rem); }
    to { transform: none; }
  }
  .choice, .row, .button { transition: background-color 120ms ease-out, border-color 120ms ease-out; }
}
