/* Staff Genius Shifts: shared styles for every page (test build, fake demo data).
   Tokens first, then chrome, then the guaranteed classes from the shared contract (section D).
   Rules that keep phones happy: form text is 16px (no zoom on tap), main content is capped, chrome is not. */
:root {
  --vp-narrow: 375px; --vp-medium: 768px; --vp-wide: 1280px;
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --line: #e2e5ea; --line-strong: #cfd4dc;
  --text: #16191f; --muted: #5b6472; --accent: #1f5fd1; --accent-ink: #ffffff; --accent-soft: #e8effc;
  --ok: #17803d; --ok-soft: #e5f4ea; --warn: #a55b00; --warn-soft: #fdf1df; --bad: #b42318; --bad-soft: #fde8e6; --bad-ink: #ffffff;
  --info: #5b3cc4; --info-soft: #efeafd;
  --radius: 10px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --line: #2a2f38; --line-strong: #3a414d;
    --text: #e8eaee; --muted: #9aa3b2; --accent: #6b9cff; --accent-ink: #0b1220; --accent-soft: #1a2640;
    --ok: #4cc27a; --ok-soft: #13291c; --warn: #f0a548; --warn-soft: #2e2212; --bad: #ff7b6e; --bad-soft: #341715; --bad-ink: #2a0a07;
    --info: #a996ff; --info-soft: #221c3d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --line: #2a2f38; --line-strong: #3a414d;
  --text: #e8eaee; --muted: #9aa3b2; --accent: #6b9cff; --accent-ink: #0b1220; --accent-soft: #1a2640;
  --ok: #4cc27a; --ok-soft: #13291c; --warn: #f0a548; --warn-soft: #2e2212; --bad: #ff7b6e; --bad-soft: #341715; --bad-ink: #2a0a07;
  --info: #a996ff; --info-soft: #221c3d; color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; width: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; min-height: 100dvh; overflow-wrap: break-word; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 650; }
h2 { font-size: 17px; line-height: 1.3; margin: 0; font-weight: 650; }
h3 { font-size: 15px; line-height: 1.3; margin: 0; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
img, svg, video, canvas { max-width: 100%; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 0; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s2); top: -60px; z-index: 60; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line-strong); }
.skip:focus { top: var(--s2); }

/* ---------- Test banner ---------- */
.testbar { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; text-align: center; padding: 6px var(--s4); border-bottom: 1px solid var(--line); }

/* ---------- App chrome (full width, never capped) ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s3); padding: 0 var(--s4); min-height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; gap: 5px; }
.brand span { color: var(--muted); font-weight: 500; }
.menu-btn { margin-left: auto; }
.nav { display: none; }
.nav a { text-decoration: none; color: var(--muted); padding: 0 12px; border-radius: 8px; min-height: 44px; display: flex; align-items: center; }
.nav a:hover { color: var(--text); }
.nav a[aria-current] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.me-box { display: none; align-items: center; gap: var(--s1) var(--s2); flex-wrap: wrap; }
.me-name { display: inline-flex; flex-direction: column; line-height: 1.25; min-width: 0; max-width: 240px; margin-right: var(--s1); }
.me-name strong, .me-name .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name strong { font-weight: 600; }
.me-box.always { display: flex; margin-left: auto; }

/* Narrow: the menu button opens the same destinations, section by section */
@media (max-width: 767.98px) {
  .topbar.open .nav { display: block; flex: 1 1 100%; max-height: calc(100vh - 150px); overflow-y: auto; border-top: 1px solid var(--line); padding: var(--s2) 0; }
  .topbar.open .me-box { display: flex; flex: 1 1 100%; border-top: 1px solid var(--line); padding: var(--s3) 0; }
  .nav-group { padding: var(--s1) 0 var(--s2); }
  .nav .nav-sec { pointer-events: none; min-height: 32px; padding: 0 var(--s1); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: none; }
  .nav-pages { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s2); }
  .nav-pages a { padding: 0 var(--s2); }
  .me-box.always .me-name { max-width: 30vw; }
  .me-box.always .me-name .small, .me-box.always.has-out .me-name { display: none; }
}
/* Medium and wide: sections sit in the bar, pages sit in the sub-menu below it */
@media (min-width: 768px) {
  .topbar .menu-btn { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: var(--s1); order: 3; flex: 1 1 100%; padding-bottom: var(--s2); }
  .nav-pages { display: none; }
  .me-box { display: flex; order: 2; margin-left: auto; }
  .topbar { position: static; }
}
@media (min-width: 1280px) {
  .topbar { position: sticky; }
  .nav { order: 2; flex: 0 1 auto; padding-bottom: 0; margin-left: var(--s3); }
  .me-box { order: 3; }
}

/* Sub-menu: the pages of the open section (also the two facility pages) */
.subnav { display: flex; gap: var(--s1); padding: 0 var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: 0 0 auto; padding: 0 12px; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* Nurse bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--accent); }
body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
body.has-tabbar .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }

/* ---------- Page (capped and centered) ---------- */
main, .page { width: 100%; max-width: var(--vp-wide); margin-inline: auto; }
.page { padding: var(--s5) var(--s4) var(--s6); min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); margin-bottom: var(--s4); }
.page-head .grow { flex: 1 1 260px; min-width: 0; }
.page-head p { color: var(--muted); margin-top: var(--s1); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s3); min-width: 0; }
.toolbar > * { max-width: 100%; }
.section { margin-top: var(--s6); }
.section-head { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.section-head p { color: var(--muted); flex: 1 1 100%; }

/* ---------- Controls ---------- */
button, input, select, textarea { font: inherit; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 10px 14px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  cursor: pointer; text-decoration: none; white-space: nowrap; max-width: 100%; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.primary.danger { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
@media (pointer: coarse) { .btn.small { min-height: 44px; } }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { opacity: .75; cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) { .btn[aria-busy="true"]::after { animation: spin .7s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } }
.icon-btn { min-width: 44px; min-height: 44px; padding: 10px; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]), select, textarea {
  font-size: 16px; line-height: 1.3; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 10px 12px; min-height: 44px; width: 100%; max-width: 100%; min-width: 0; }
textarea { min-height: 88px; resize: vertical; line-height: 1.4; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.toolbar select, .toolbar input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]) { width: auto; flex: 0 1 auto; }
.toolbar .grow, .toolbar input.grow:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]) { flex: 1 1 200px; }
::placeholder { color: var(--muted); opacity: 1; }

.field { display: block; min-width: 0; }
.field > label, .field > .label, .field > legend { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.field > label.check, .field > label.switch { display: flex; font-weight: 400; font-size: inherit; margin-bottom: 0; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 13px; color: var(--bad); margin-top: 4px; font-weight: 600; }
.field [aria-invalid="true"] { border-color: var(--bad); }
fieldset.field { border: 0; margin: 0; padding: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; cursor: pointer; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }

/* Switch: <label class="switch"><input type="checkbox"> Text</label> (saves itself; no Save button) */
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.switch input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); border: 0; position: relative; cursor: pointer; flex: 0 0 auto; }
.switch input[type="checkbox"]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input[type="checkbox"]:checked { background: var(--accent); }
.switch input[type="checkbox"]:checked::before { left: 21px; }
.switch input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
@media (prefers-reduced-motion: no-preference) { .switch input[type="checkbox"], .switch input[type="checkbox"]::before { transition: left .12s ease-out, background-color .12s ease-out; } }

/* Week stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); max-width: 100%; }
.stepper .btn { border: 0; border-radius: 7px; background: transparent; }
.stepper .btn:hover { background: var(--surface-2); }
.stepper .label { padding: 0 var(--s2); font-weight: 600; white-space: nowrap; font-size: 14px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-pad { padding: var(--s4); }
.notice { border-radius: var(--radius); padding: var(--s3) var(--s4); background: var(--warn-soft); color: var(--text); border: 1px solid var(--line); margin-bottom: var(--s4); }
.notice strong { color: var(--warn); }
.notice p + p { margin-top: var(--s2); }
.notice.info { background: var(--accent-soft); } .notice.info strong { color: var(--accent); }
.notice.bad { background: var(--bad-soft); } .notice.bad strong { color: var(--bad); }
.notice.ok { background: var(--ok-soft); } .notice.ok strong { color: var(--ok); }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.empty .btn { margin-top: var(--s3); }
.empty p + p { margin-top: var(--s1); }
.story { font-size: 18px; line-height: 1.45; font-weight: 500; max-width: 70ch; margin-bottom: var(--s4); }
.red-line { color: var(--bad); font-weight: 600; border-left: 3px solid var(--bad); padding-left: var(--s2); }
.msg { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: var(--s3); }

/* Chips: status only (plain text for plain facts) */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.owner-tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 1px 6px; white-space: nowrap; vertical-align: middle; }
.owner-tag.me { color: var(--accent); border-color: var(--accent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-right: 6px; vertical-align: baseline; flex: 0 0 auto; }

/* Tabs */
.tabs { display: flex; gap: var(--s1); overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: var(--s3); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 12px; min-height: 44px;
  cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; flex: 0 0 auto; }
.tab:hover { color: var(--text); }
.tab:focus-visible, .subnav a:focus-visible { outline-offset: -2px; }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 0 7px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count, .tab[aria-current="page"] .count { background: var(--accent-soft); color: var(--accent); }

/* Board counts */
.countbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: var(--s2); margin-bottom: var(--s4); }
.count-btn { font: inherit; text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2) var(--s3);
  min-height: 60px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; text-decoration: none; min-width: 0; font-size: 13px; }
.count-btn strong, .count-btn .n { font-size: 22px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.count-btn:hover { border-color: var(--line-strong); }
.count-btn[aria-pressed="true"], .count-btn[aria-selected="true"], .count-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.count-btn.bad strong, .count-btn.bad .n { color: var(--bad); }
.count-btn.warn strong, .count-btn.warn .n { color: var(--warn); }

/* Queue (inbox pattern): li > .mark + div + .actions */
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }
.queue li:first-child { border-top: 0; }
.queue .mark { align-self: stretch; border-radius: 4px; background: var(--line-strong); }
.queue .mark.bad { background: var(--bad); } .queue .mark.warn { background: var(--warn); } .queue .mark.ok { background: var(--ok); }
.queue .mark.info { background: var(--info); } .queue .mark.accent { background: var(--accent); }
.queue .who { font-weight: 600; }
.queue .meta { color: var(--muted); font-size: 13px; }
.queue .issue { font-size: 14px; margin-top: 2px; }
.queue .actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 767.98px) {
  .queue li { grid-template-columns: 4px minmax(0, 1fr); }
  .queue .actions { grid-column: 2; justify-content: flex-start; }
}

/* Tables (list pattern): always inside a visible frame */
.table-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
th, td { padding: 10px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); background: none; white-space: normal; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.r, th.r { text-align: right; }
td.empty { padding: var(--s6) var(--s4); }
tr.day-row td { background: var(--surface-2); font-weight: 650; font-size: 13px; color: var(--text); padding-top: 8px; padding-bottom: 8px; }
/* table.stack: on a phone each row becomes a small block; give cells data-label="Column name" */
@media (max-width: 767.98px) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody, table.stack tr, table.stack td, table.stack tbody th { display: block; width: 100%; }
  table.stack tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td, table.stack tbody th { border: 0; padding: 2px 0; text-align: left; }
  table.stack td:first-child, table.stack tbody th { font-weight: 600; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; font-weight: 400; }
  table.stack td:empty { display: none; }
  table.stack tr.day-row { padding: 8px var(--s4); background: var(--surface-2); }
  table.stack tr.empty-row { padding: 0; }
}
/* Rules table: first column stays put, changed cells stand out */
.matrix th, .matrix td { white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); white-space: normal; min-width: 132px; text-align: left; }
.matrix thead th:first-child { background: var(--surface-2); }
.matrix td.changed { background: var(--accent-soft); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }

/* Numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4); min-width: 0; }
.stat .k { font-size: 13px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.numline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px var(--s3); align-items: baseline; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.numline:first-child { border-top: 0; }
.numline .label small { display: block; color: var(--muted); font-size: 13px; }
.numline .value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.numline .delta { font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); min-width: 56px; text-align: right; }
.numline .delta.up { color: var(--ok); }
.numline .delta.down { color: var(--bad); }
.kv { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 6px var(--s4); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.step-list { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.step-list li { counter-increment: step; position: relative; padding: var(--s2) 0 var(--s2) 36px; border-top: 1px solid var(--line); min-height: 40px; }
.step-list li:first-child { border-top: 0; }
.step-list li::before { content: counter(step); position: absolute; left: 0; top: var(--s2); width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong);
  font-size: 12px; font-weight: 700; display: grid; place-items: center; color: var(--muted); }
.step-list li.done::before { content: "\2713"; background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

/* Calendar: 7 columns on wide screens, a day list on a phone. Tile color: style="--tile: #1f5fd1" */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-day { background: var(--surface); min-height: 96px; padding: var(--s2); min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cal-day.today { box-shadow: inset 0 2px 0 var(--accent); }
.cal-day.out { background: var(--surface-2); color: var(--muted); }
.tile { display: block; border-left: 4px solid var(--tile, var(--line-strong)); background: var(--surface-2); border-radius: 6px; padding: 4px 6px; font-size: 12px; line-height: 1.3;
  color: var(--text); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
a.tile:hover, button.tile:hover { background: var(--accent-soft); }
button.tile { font: inherit; font-size: 12px; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; width: 100%; cursor: pointer; }
.tile.open { background: var(--warn-soft); }
@media (max-width: 767.98px) {
  .cal { grid-template-columns: minmax(0, 1fr); }
  .cal-day { min-height: 0; padding: var(--s3) var(--s4); }
  .tile { padding: 8px; font-size: 13px; min-height: 44px; display: flex; align-items: center; }
}

/* Nurse clock */
.clock-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s4); min-width: 0; }
.bigbtn { font: inherit; width: 100%; min-height: 72px; font-size: 20px; font-weight: 700; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: var(--s3) var(--s4); text-decoration: none; text-align: center; }
.bigbtn small { font-size: 13px; font-weight: 500; }
.bigbtn.out, .bigbtn.danger { background: var(--bad); color: var(--bad-ink); }
.bigbtn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
.bigbtn[disabled], .bigbtn[aria-disabled="true"] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.bigbtn[aria-busy="true"] { opacity: .75; cursor: progress; }

/* ---------- Overlays ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(10, 12, 16, .45); }
/* Slide-over: full height, full width on a phone */
dialog.sheet { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); width: min(440px, 100%); max-width: 100%;
  height: 100%; max-height: 100%; background: var(--surface); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s2) var(--s2) var(--s4); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.sheet-body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s4); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.sheet-error { margin: 0 var(--s4) var(--s3); color: var(--bad); font-weight: 600; font-size: 14px; }
.sheet-foot { padding: var(--s3) var(--s4); border-top: 1px solid var(--line); display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; background: var(--surface); flex: 0 0 auto; }
/* Small centered box for a yes or no */
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); width: min(480px, calc(100% - 32px)); max-width: calc(100% - 32px); max-height: calc(100% - 32px);
  background: var(--surface); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); overflow-y: auto; }
dialog.modal > form { display: flex; flex-direction: column; gap: var(--s3); margin: 0; }
.modal-foot { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--s2); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; z-index: 70; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .2); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .18s ease-out; } @keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } } }

/* ---------- Print ---------- */
.print-only { display: none !important; }
@media print {
  .no-print, .topbar, .subnav, .tabbar, .toast, .skip { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; color: #000; padding-bottom: 0 !important; }
  .page { max-width: none; padding: 0; }
  .card, .table-frame { border-color: #999; }
}
