/* The look and feel from reference/licensed-tracker-prototype.html.
 *
 * The prototype is the design. Where a name here matches a name there
 * (--blue, --gold, --r), it holds the same value on purpose, so a change
 * made in one can be carried across to the other without translating.
 *
 * There is deliberately no dark mode. The prototype is a light blue-and-gold
 * board, and a second palette nobody has looked at is a second palette nobody
 * has checked the contrast of. */

:root {
  --blue: #3f6f8f;
  --blue-d: #2e5571;
  --gold: #e0a040;
  --ink: #1f2a33;
  --muted: #5d6c78;
  --line: #dfe5ea;
  --bg: #f4f6f8;
  /* The quiet pair. Same hues as --red and --gold, dropped to the strength
     of an edge stripe rather than an alarm. */
  --clay: #c98b7e;
  --sand: #e7c88c;
  --red: #b3261e;
  --red-bg: #fbe9e7;
  --amber: #9a5a00;
  --amber-bg: #fdf0d8;
  --ok: #2d6a3e;
  --ok-bg: #e5f2e8;
  --info-bg: #e3edf4;
  --r: 10px;

  /* The rules engine's own urgency words, so a class name can be used
     straight from it: overdue / today / soon / later / waiting. */
  --overdue: var(--red);
  --overdue-bg: var(--red-bg);
  --today: var(--amber);
  --today-bg: var(--amber-bg);
  --soon: var(--blue-d);
  --soon-bg: var(--info-bg);
  --later: var(--muted);
  --later-bg: #eceff2;
  --waiting: var(--muted);
  --waiting-bg: #eceff2;
  --done: var(--ok);
  --done-bg: var(--ok-bg);

  /* Older names, still used by the screens not yet rebuilt. */
  --card: #fff;
  --accent: var(--blue);
  --accent-ink: #fff;
  --radius: var(--r);
  --gap: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }

/* ------------------------------------------------------------------ header */

.top {
  background: var(--blue);
  color: #fff;
  border-bottom: 4px solid var(--gold);
}
.top-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 17px; }
.brand small { display: block; font-weight: 600; opacity: 0.8; font-size: 12px; }

nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button {
  background: transparent;
  border: 0;
  color: #fff;
  opacity: 0.8;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 700;
}
nav button:hover { opacity: 1; }
nav button.on { background: rgba(255, 255, 255, 0.16); opacity: 1; }
nav .count {
  background: var(--gold);
  color: var(--ink);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 12px;
  margin-left: 4px;
}

.whoami {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  opacity: 0.85;
  white-space: nowrap;
}
.whoami button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 13px;
}
.whoami button:hover { background: rgba(255, 255, 255, 0.16); }

.add {
  background: var(--gold);
  color: var(--ink);
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 800;
}
.add:hover { filter: brightness(1.06); }

/* The prototype's demo stripe, kept for a real purpose: it shows only while
   invented test children are in the table, so nobody mistakes the seeded
   dogs for a caseload. */
.demo {
  background: #fff6e5;
  color: var(--amber);
  text-align: center;
  font-size: 13px;
  padding: 6px;
  font-weight: 700;
}

/* -------------------------------------------------------------------- page */

main { max-width: 1180px; margin: 0 auto; padding: 20px 18px 80px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 {
  font-size: 15px;
  margin: 22px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.sub { color: var(--muted); margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
/* Sized to their contents, not to the page: the forms further down set
   width:100% on every control, which is right there and wrong here. */
.filters select, .filters input { width: auto; min-width: 165px; }

select, input, textarea {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
/* A typed date that is not a date keeps what was typed and says so, so it
   can be corrected rather than retyped from scratch. */
input.date.bad {
  border-color: var(--red);
  background: var(--red-bg);
}
/* The box that is stopping you, on a form that refused to save.
   The message that says why is a toast, and a toast is gone in seconds - so
   a button that will not work has to leave a mark on the thing to fix.
   Rachael, 2026-11-10, on the discharge panel: it read as a dead button. */
select.bad, input.bad, textarea.bad {
  border-color: var(--red);
  background: var(--red-bg);
}
select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
  border-color: var(--blue);
}

/* ------------------------------------------------------------------- tiles */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 8px 0 6px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
}
.stat b { font-size: 24px; display: block; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.red b { color: var(--red); }
.stat.amber b { color: var(--amber); }
.stat.off b { color: var(--line); }
.stat.off { background: #fbfcfd; }
.stat em { display: block; font-size: 11.5px; color: var(--muted); font-style: normal; }

/* ------------------------------------------------------------------- tasks */

.task {
  display: grid;
  grid-template-columns: 6px 1fr auto;
  gap: 0 14px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin: 8px 0;
  overflow: hidden;
}
/* The edge stripe is the only colour a row carries now. It used to be a
   fire-engine red beside bold red words saying how many days late something
   was, on a board where most of the lateness came in with the spreadsheet.
   Soft clay says the same thing at a glance without telling anyone off. */
.task .bar { align-self: stretch; background: var(--line); }
.task.overdue .bar { background: var(--clay); }
.task.today .bar { background: var(--sand); }
.task.soon .bar { background: #bcd0dd; }

.task .main { padding: 11px 0; min-width: 0; }
.task .who { font-weight: 800; cursor: pointer; }
.task .who:hover { text-decoration: underline; }
.task .what { font-size: 15px; margin-top: 1px; }
.task .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* Kept for the kid drawer's own dates, which are facts rather than a telling
   off. Nothing on Today or the board uses them any more. */
.late { color: var(--red); font-weight: 800; }
.now { color: var(--amber); font-weight: 800; }
.task .act {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ----------------------------------------------------------------- buttons */

.btn, button.primary, .btn.primary {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 7px;
  padding: 8px 13px;
  font-weight: 700;
  white-space: nowrap;
}
.btn:hover, button.primary:hover { background: var(--blue-d); }
.btn.ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: #fff; border-color: var(--blue); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #255a34; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled, button:disabled { opacity: 0.5; cursor: progress; }

/* ------------------------------------------------------------------- chips */

.chip {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: #eceff2;
  color: var(--muted);
}
.chip.red, .chip.overdue { background: var(--red-bg); color: var(--red); }
.chip.amber, .chip.today { background: var(--amber-bg); color: var(--amber); }
.chip.blue, .chip.soon, .chip.disc { background: var(--info-bg); color: var(--blue-d); }
.chip.green, .chip.done { background: var(--ok-bg); color: var(--ok); }
.chip.grey, .chip.later, .chip.waiting { background: #eceff2; color: var(--muted); }

/* ------------------------------------------------------------------- toast */

/* Both strips live in here, stacked, so neither can cover the other. The
   undo strip is the last child and sits at the bottom; ordinary messages are
   prepended above it. See strips() in web/src/ui.ts. */
#toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9;
  max-width: calc(100% - 32px);
  /* The gap between the strips is not a target. Without this, a click aimed
     just under the undo strip lands on the container instead of the row
     underneath it. */
  pointer-events: none;
}
#toasts > * { pointer-events: auto; }

.toast {
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 700;
  max-width: 100%;
}
.toast.bad { background: var(--red); }

/* The undo strip. It does not time out, so it is marked as the thing it is
   rather than looking like a message that is about to leave: a gold edge,
   and the words of what it would put back. See undoBar in web/src/ui.ts. */
.undobar {
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  gap: 4px;
}
.undobar button.x {
  color: #fff;
  opacity: 0.65;
  font-weight: 700;
  margin-left: 4px;
}
.undobar button.x:hover { opacity: 1; }
.toast button {
  background: none;
  border: 0;
  color: var(--gold);
  font-weight: 800;
  margin-left: 10px;
  padding: 0;
}
.toast.bad button { color: #fff; text-decoration: underline; }

/* --------------------------------------------------------------- sign-in */

.signin { max-width: 420px; margin: 14vh auto; text-align: center; }
.signin p { color: var(--muted); }
.err {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid currentColor;
  border-radius: var(--r);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------------------ *
 * Screens not yet rebuilt — All kids, the kid page and New kid still use
 * these. They go as each screen is done.
 * ------------------------------------------------------------------------ */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card > .hd {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card > .bd { padding: 14px; }
.spacer { flex: 1 1 auto; }

.group { margin-bottom: 22px; }
.group > h2 { display: flex; align-items: center; gap: 8px; }
.count {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eceff2;
  color: var(--muted);
}

button {
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
button:hover { border-color: var(--blue); color: var(--blue); }
button.primary { border-color: var(--blue); }
button.primary:hover { color: #fff; }

label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
input, select, textarea { width: 100%; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.search { max-width: 280px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 800;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7f9fa; }
td a { color: var(--ink); font-weight: 700; text-decoration: none; }
td a:hover { text-decoration: underline; }
.svcline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 3px; }
.svcline:last-child { margin-bottom: 0; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.log li { padding: 6px 0; border-bottom: 1px solid #eef1f4; display: flex; gap: 10px; }
.log li:last-child { border-bottom: 0; }
.log .at { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.when { font-size: 13px; color: var(--muted); }

/* ----------------------------------------------------------------- drawer *
 * A kid opens over the page, not instead of it: you keep your place on the
 * board behind, and closing puts you back exactly where you were.
 * ------------------------------------------------------------------------ */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 40, 0.35);
  display: none;
}
.scrim.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(680px, 100%);
  background: #fff;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.2s;
  overflow-y: auto;
  z-index: 5;
}
.drawer.open { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .drawer { transition: none; }
}

/* > .hd, not .hd: each service block has a .hd of its own, and it must
   not stick to the top and cover the child's name. */
.drawer > .hd {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.drawer > .hd h1 { font-size: 20px; }
.drawer .bd { padding: 16px 20px 40px; }
.drawer h2 { display: flex; align-items: center; gap: 8px; }

.steps { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin: 6px 0 16px; }
.step { text-align: center; font-size: 11.5px; color: var(--muted); }
.step .dot { height: 8px; border-radius: 999px; background: #e3e8ec; margin-bottom: 5px; }
.step.done .dot { background: var(--ok); }
.step.now .dot { background: var(--gold); }
.step.now { color: var(--ink); font-weight: 800; }

/* A step already passed is a way back to it. It has to look pressable
   without turning the stepper into a row of buttons, so it is the word
   itself that lights up. */
.aslink {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
}
.step.back .aslink:hover, .step.back .aslink:focus-visible {
  color: var(--blue-d);
  text-decoration-color: currentColor;
}

.next {
  background: var(--amber-bg);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 6px 0 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.next.overdue { background: var(--red-bg); }
.next.clear { background: var(--ok-bg); }
.next .acts { display: flex; gap: 6px; flex-wrap: wrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.drawer .field {
  display: grid;
  gap: 3px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.drawer .field input,
.drawer .field select,
.drawer .field textarea { font-weight: 400; color: var(--ink); }

.drawer .dates { width: 100%; border-collapse: collapse; font-size: 14px; display: table; }
.drawer .dates td { padding: 6px 4px; border-bottom: 1px solid #eef1f4; }
.drawer .dates tr:last-child td { border-bottom: 0; }
.drawer .dates td:first-child { color: var(--muted); width: 46%; }
.drawer .dates input, .drawer .dates select { padding: 4px 6px; }

/* ---------------------------------------------------- the import screen */

/* Numbered, because these are steps to follow in Excel, in order. */
.steps-list { margin: 10px 0 0; padding-left: 22px; line-height: 1.7; }
.steps-list li { margin-bottom: 2px; }

.warnings { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; background: var(--amber-bg); }
.warnings summary { cursor: pointer; font-weight: 800; color: var(--amber); }
.warnings .log li { border-bottom-color: #efe3cc; }

/* Long enough to scroll, short enough that the button stays in sight. */
.preview { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
/* A plain table. The legacy .dates class is a grid, which crushed it. */
.preview table { display: table; width: 100%; border-collapse: collapse; font-size: 13.5px; }
.preview td { padding: 7px 10px 7px 0; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.preview tr:last-child td { border-bottom: 0; }
.preview tr.small td { position: sticky; top: 0; background: #fff; }

/* The 1st-of-month email, shown exactly as it will be pasted. */
pre.email {
  white-space: pre-wrap;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  font: 14px/1.5 "Nunito Sans", sans-serif;
  margin: 0;
}

/* The insurance table is five columns of its own, not a label and a box. */
.drawer .dates.ins td:first-child { width: auto; color: var(--ink); }
.drawer .dates.ins select { width: auto; min-width: 124px; }
.drawer .dates.ins input { width: 118px; }

.svc { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 10px 0; }
.svc > .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 800; }

/* A finished service, folded shut under the live ones. The whole block is
   still in there - the dates, the steps, the discharge form - because a
   summary gets asked for weeks after the child stopped coming. Greyed and
   quiet so it reads as history rather than as something to do. */
.svcdone { border: 1px solid var(--line); border-radius: var(--r); margin: 10px 0; opacity: 0.72; }
.svcdone > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; cursor: pointer; font-weight: 700;
}
.svcdone > summary::after { content: "discharged"; margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); }
.svcdone[open] { opacity: 1; }
.svcdone[open] > summary::after { content: "discharged — click to fold away"; }
.svcdone > .svc { border: 0; margin: 0; padding-top: 0; }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(5, 1fr); }
}

/* ------------------------------------------------------------------ board *
 * All kids: a column per stage, a card per service. After the legacy block
 * above on purpose — a bare `button` rule lives up there, and these cards are
 * buttons so they can be reached with a keyboard.
 * ------------------------------------------------------------------------ */

.board {
  display: grid;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  align-items: start;
}
.col {
  background: #eef2f5;
  border-radius: var(--r);
  padding: 8px;
  min-height: 120px;
}
.col h3 {
  font-size: 12.5px;
  margin: 2px 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.col .none { font-size: 13px; color: var(--muted); padding: 4px 6px; }

.kidcard {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  margin-bottom: 7px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink);
}
.kidcard:hover { border-color: var(--blue); color: var(--ink); }
.kidcard.overdue { border-left-color: var(--clay); }
.kidcard.today { border-left-color: var(--sand); }
.kidcard b { display: block; font-weight: 800; }
.kidcard .chip { margin-top: 3px; }

@media (max-width: 720px) {
  .task { grid-template-columns: 6px 1fr; }
  .task .act { grid-column: 2; justify-content: flex-start; padding: 0 0 10px; }
  .whoami { margin-left: 0; }
}

/* ---- Release to schedule, in the kid drawer ------------------------- */
.release {
  margin: 12px 0 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfd;
}
.release > .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.release .spacer { flex: 1; }
.rel { display: flex; flex-direction: column; gap: 6px; }
.relbox {
  padding: 7px 10px;
  border-radius: 5px;
  border: 1px solid;
  font-size: 14px;
}
.relbox b { display: block; }
.relbox span { opacity: .85; }
/* The same paper colours the email uses, so the screen and the thing the
   provider opens are recognisably one document. */
.relbox.green { background: #d9ead3; border-color: #5a9d63; color: #1d4620; }
.relbox.red { background: #f4cccc; border-color: #c06060; color: #6b1b1b; }
.relbox.blue { background: #cfe2f3; border-color: #6fa3cd; color: #14385c; }
.release .warn { color: var(--red); margin-top: 8px; }
.relmail { margin-top: 10px; }

/* ---- Providers ------------------------------------------------------ */
table.team { display: table; }
table.team th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.team td { vertical-align: middle; }
table.team td.right { text-align: right; white-space: nowrap; }
table.team input { min-width: 140px; }
.discs { display: flex; gap: 4px; flex-wrap: wrap; }

/* A tickbox with a line of explanation under it. */
.field.check { display: block; }
.field.check .row1 { display: flex; align-items: center; gap: 7px; }
.field.check input { width: auto; margin: 0; }
.field.check .small { display: block; margin-top: 3px; color: var(--muted); }

/* One release box with its tick: which of them goes out in this email. */
.relpick { display: flex; align-items: flex-start; gap: 9px; }
.relpick .relbox { cursor: pointer; }
.relpick input { margin-top: 11px; flex: none; }
.relpick .relbox { flex: 1; }
/* Left out of this email. Still shown, because what it says is why. */
.relbox.off { opacity: .45; }
.release .hd .muted { font-weight: 400; }

/* ------------------------------------------------- the Early Steps SOS forms

   An office's own form, filled from the record and shown over the whole page.
   `.f` is the paper itself: Times, black, 13px, the way the originals are.
   Everything inside it is the office's layout, not ours, so it does not use
   the app's variables - a form that printed in the app's colours would not
   look like the form the office sent us.

   @media print hides the app and the bar, so Print - or "Save as PDF" in the
   print dialogue - puts only the form on the page. */

#sosprint {
  position: fixed; inset: 0; z-index: 60; overflow: auto;
  background: var(--bg);
}
#sosprint .sosbar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
#sosprint .sosbar .sp { flex: 1; }
#sosprint .sossheet {
  background: #fff; max-width: 8.5in; margin: 18px auto; padding: .5in;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .14);
}

.f { font-family: "Times New Roman", Times, serif; color: #000; font-size: 13px; line-height: 1.35; }
/* The app uppercases every h2 and th and greys them out. On the office's
   own form those headings are plain black title case, so undo it here. */
.f h1, .f h2, .f h3 {
  font-family: inherit; margin: 0; text-align: center;
  text-transform: none; letter-spacing: normal; color: #000; font-weight: bold;
}
/* A ruled blank, for what is written in by hand. */
.f .ln { display: inline-block; border-bottom: 1px solid #000; min-width: 120px; padding: 0 4px; }
.f table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.f td, .f th { border: 1px solid #000; padding: 4px 6px; vertical-align: top; text-align: left; }
.f th {
  font-size: inherit; text-transform: none; letter-spacing: normal;
  color: #000; font-weight: bold;
}
.f .box2 { border: 1px solid #000; padding: 8px 10px; }
.f .cb {
  display: inline-block; width: 12px; height: 12px; border: 1px solid #000;
  vertical-align: -1px; margin: 0 4px 0 12px;
  text-align: center; line-height: 11px; font-size: 11px;
}

@media print {
  /* The form, and nothing else. Without this the whole board prints behind
     it. Only while a form is open - :has() keeps Ctrl+P on the board itself
     printing the board, rather than a blank sheet. */
  body:has(#sosprint) > *:not(#sosprint) { display: none !important; }
  #sosprint { position: static; overflow: visible; background: #fff; }
  #sosprint .sosbar { display: none !important; }
  #sosprint .sossheet { margin: 0; padding: 0; max-width: none; box-shadow: none; }
  @page { margin: .5in; }
}

/* UPT's own Discharge Summary, which is Arial rather than Times, and has a
   letterhead at the top and the address at the foot. */
.f.sans { font-family: Arial, Helvetica, sans-serif; }

/* ---------------------------------------- the Discharge Summary, in colour

   Rachael, 2026-11-29: *"i want the color boxes in the background like our
   form!"*, pointing at 4. UPT_Discharge_Form.docx in the blank-forms folder.
   That file is a newer version of the one this form was rebuilt from, and
   the palette below is lifted straight out of its XML rather than guessed:

     #3F6F8F  the band behind a section heading, white text on it
     #2E5570  the title
     #EAF1F5  the pale fill behind a field's label
     #6B7280  the grey of the footer
     Calibri, 10pt body, 15pt title

   THE BACKGROUNDS HAVE TO BE TOLD TO PRINT. A browser drops background
   colour from a printed page by default, which would send every one of these
   bands to the printer as white - the form would look right on screen and
   come out plain, which is the one failure nobody checks for. */
.f.dc {
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
  font-size: 13.3px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.f.dc h1 { color: #2E5570; font-size: 20px; letter-spacing: .01em; }

/* A section heading: white on the blue, full width, hard against the table
   under it. */
.f.dc .band {
  background: #3F6F8F; color: #fff; font-weight: bold;
  padding: 4px 8px; margin: 14px 0 0; font-size: 13px;
}
/* The details grid: label cells on the pale blue, values on white. */
.f.dc table.fields { border-collapse: collapse; width: 100%; }
.f.dc table.fields td { border: 1px solid #C3D4DF; padding: 5px 8px; font-size: 13px; }
.f.dc table.fields td.k {
  background: #EAF1F5; color: #2E5570; font-weight: bold;
  width: 1.55in; white-space: nowrap;
}
/* What sits under a band: the same border, no gap above it. */
.f.dc .panel {
  border: 1px solid #C3D4DF; border-top: 0; padding: 7px 9px; font-size: 13px;
}
.f.dc .panel.recs { min-height: 1.05in; }
/* The reasons keep their ticks down the left and gain nothing else - a grid
   behind them would fight the bands. */
.f.dc table.plain td { padding: 2.5px 0; }
.f.dc .cb { border-color: #5B7F96; }
.f.dc .foot { color: #6B7280; border-top: 1px solid #C3D4DF; }
.f.dc .byline { color: #6B7280; }
.f .head, .f .foot { text-align: center; font-size: 11.5px; line-height: 1.3; }
/* Logo on the left, the phone and fax lines on the right, as the Word
   original has them. */
.f .head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 10px; text-align: left;
}
.f .head img { width: 2.6in; height: auto; }
.f .head .contact { text-align: right; white-space: nowrap; }
.f .foot { margin-top: 26px; padding-top: 8px; border-top: 1px solid #000; }
/* The reasons: ticks down the left, no grid - the original has no borders. */
.f table.plain, .f table.plain td { border: 0; padding: 2px 0; }
.f table.plain td.tick { width: 34px; }
.f .recs { min-height: 72px; }
/* Under the signature line: who produced the document, as against whose
   service it was. Small, because it is a note about the paperwork and not
   part of the record. Rachael, 2026-11-10 - the providers do not sign these,
   so the form has to say where it came from. */
.f .byline { margin-top: 4px; font-size: 11px; font-style: italic; }

/* --------------------------------------------------------- incoming faxes */

.card.fax { display: grid; gap: 12px; }
.card.fax .faxhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* Four boxes across on a laptop, stacking on a narrow window. Fax filing is
   a run of the same four answers over and over, so they stay on one line for
   as long as the window allows. */
.card.fax .faxform {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px 14px;
  align-items: end;
}
/* `.field` carries a bottom margin globally, which inside a grid with its own
   gap reads as an uneven extra space under every box. */
.card.fax .field { display: grid; gap: 4px; margin-bottom: 0; }
.card.fax .field > span { font-size: 12px; color: var(--muted); }
.card.fax .field input,
.card.fax .field select { width: 100%; }

/* Dealt with: still readable, plainly finished, and never in the way of the
   ones still waiting. */
.card.fax.done { background: #fbfcfd; }
.card.fax.done .faxhead b { color: var(--muted); font-weight: 600; }

/* --------------------------------------------- the date boxes, by step *
 * Rachael, 2026-11-17: "I want to only see what step we are workig on and
 * not allow another step to be seen (next steps) until the previous is
 * completed... everything else needs to be hidden into drop downns". So the
 * step being worked on is open and labelled, and every other step is a
 * closed drop-down that still opens on a click.
 * ---------------------------------------------------------------------- */

.steprows { display: grid; gap: 6px; }

.stepgroup {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0 12px;
}

/* The one being worked on: no twisty, and a label that reads as a heading. */
.stepgroup.open { padding: 10px 12px 12px; background: #fbfcfd; }
.steplab {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stepgroup > summary {
  cursor: pointer;
  padding: 9px 2px;
  font-weight: 700;
  font-size: 14px;
}
.stepgroup > summary:hover { color: var(--ink); }
details.stepgroup[open] { padding-bottom: 10px; }

/* "There is already a child with this name" under the add-a-kid box, and the
   delete block at the foot of a kid's page. Both are the app saying stop and
   look, so they share the red; the delete block is boxed because it is the
   one place in the app that destroys something. */
p.sub.warn { color: var(--red); font-weight: 700; }
.danger {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--bg);
}
.danger p.small { color: var(--muted); }
.danger .act { margin-top: 2px; }

/* A line of warning inside a counts box: the therapist names Rethink spells
   differently from the provider records, which is a rename to go and do. */
span.small.warn { color: var(--red); font-weight: 700; }
