/* Staff Genius Shifts shared styles. Look "calm shift desk": docs/build/LOOK.md. Phone first: 16px form text, 44px targets. */

/* == Tokens (dark sets change colors only) == */
:root {
  --vp-narrow:375px; --vp-medium:768px; --vp-wide:1280px;

  /* Color roles, light */
  --bg:#f2f4f8; --surface:#fff; --surface-2:#f0f2f6; --surface-3:#e5e8ee;
  --line:#e1e5eb; --line-strong:#cbd1db; --edge:#788196;
  --text:#121926; --muted:#4a5367;
  --accent:#2550d4; --accent-strong:#1c42b5; --accent-ink:#fff; --accent-soft:#e9effd; --accent-line:#c3d2f7;
  --ok:#11703a; --ok-soft:#e3f3e9; --ok-line:#b5dcc3;
  --warn:#874b00; --warn-soft:#fcf0da; --warn-line:#ecd09c;
  --bad:#b3261e; --bad-soft:#fdeceb; --bad-line:#f0bcb6; --bad-ink:#fff;
  --info:#5a3ec2; --info-soft:#f0ecfd; --info-line:#d3c9f5;
  --chrome:#121a2b; --chrome-ink:#f1f4f9; --chrome-muted:#aeb8ca; --chrome-hover:#ffffff14; --chrome-active:#ffffff26;
  --chrome-line:#ffffff1a; --chrome-focus:#a3bcff; --mark:#4f78ee;
  --banner-bg:#fff2c2; --banner-ink:#5c3c00; --banner-line:#ead48c;
  --inverse:#172033; --inverse-ink:#f3f5f9;
  --focus:var(--accent); --focus-ring:#2550d43d;
  --scrim:#0a0f197a;

  /* Type: system fonts only. Scale 13 / 15 / 16 / 18 / 22 / 28 / 36 */
  --font:ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs:.8125rem; --text-sm:.9375rem; --text-md:1rem; --text-lg:1.125rem; --text-xl:1.375rem; --text-2xl:1.75rem; --text-3xl:2.25rem;
  --lh-tight:1.2; --lh-body:1.55;
  --w-regular:400; --w-medium:500; --w-strong:600;

  /* Space: 4 / 8 rhythm */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:40px; --s8:48px; --s10:64px;
  --gutter:16px;

  /* Radius: controls 10, panels 16, overlays 20 */
  --r-xs:4px; --r-sm:6px; --r-md:10px; --r-lg:12px; --r-xl:20px; --r-round:999px;
  --radius:16px;

  /* Elevation: hairline first, then a soft shadow (alpha under .08) */
  --shadow-1:0 1px 2px #121a280a;
  --shadow-2:0 1px 2px #121a280a, 0 6px 16px -4px #121a2812;
  --shadow-3:0 2px 6px #121a280d, 0 24px 48px -12px #121a2813;

  /* Motion: short, only in answer to a tap */
  --ease-out:cubic-bezier(.25, 1, .5, 1); --dur-1:120ms; --dur-2:220ms; --t:var(--dur-1) var(--ease-out);

  color-scheme:light;
}
@media (min-width: 768px) { :root { --gutter:24px; } }
@media (min-width: 1280px) { :root { --gutter:40px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg:#0c0f15; --surface:#151a23; --surface-2:#1b212b; --surface-3:#242b38;
    --line:#262d39; --line-strong:#353d4c; --edge:#6e788b;
    --text:#e9ecf2; --muted:#a5aebd;
    --accent:#88a9ff; --accent-strong:#a6bfff; --accent-ink:#0a1020; --accent-soft:#1a2546; --accent-line:#2d406e;
    --ok:#58c987; --ok-soft:#10261a; --ok-line:#1f4a30;
    --warn:#f2ac55; --warn-soft:#2b200e; --warn-line:#4c3815;
    --bad:#ff8b7f; --bad-soft:#321619; --bad-line:#5a2b2c; --bad-ink:#2a0a07;
    --info:#b4a4ff; --info-soft:#201b3b; --info-line:#3b3172;
    --chrome:#111621; --chrome-ink:#e9ecf2; --chrome-muted:#a9b3c4; --chrome-line:#ffffff14; --mark:#5f86f2;
    --banner-bg:#382b06; --banner-ink:#f6d57e; --banner-line:#574410;
    --inverse:#e9ecf2; --inverse-ink:#10141b;
    --focus-ring:#88a9ff52; --scrim:#0000009e;
    --shadow-1:inset 0 1px 0 #ffffff09;
    --shadow-2:inset 0 1px 0 #ffffff0d, 0 6px 16px -6px #00000073;
    --shadow-3:inset 0 1px 0 #ffffff0f, 0 24px 48px -12px #00000099;
    color-scheme:dark;
  }
}
:root[data-theme=dark] {
  --bg:#0c0f15; --surface:#151a23; --surface-2:#1b212b; --surface-3:#242b38;
  --line:#262d39; --line-strong:#353d4c; --edge:#6e788b;
  --text:#e9ecf2; --muted:#a5aebd;
  --accent:#88a9ff; --accent-strong:#a6bfff; --accent-ink:#0a1020; --accent-soft:#1a2546; --accent-line:#2d406e;
  --ok:#58c987; --ok-soft:#10261a; --ok-line:#1f4a30;
  --warn:#f2ac55; --warn-soft:#2b200e; --warn-line:#4c3815;
  --bad:#ff8b7f; --bad-soft:#321619; --bad-line:#5a2b2c; --bad-ink:#2a0a07;
  --info:#b4a4ff; --info-soft:#201b3b; --info-line:#3b3172;
  --chrome:#111621; --chrome-ink:#e9ecf2; --chrome-muted:#a9b3c4; --chrome-line:#ffffff14; --mark:#5f86f2;
  --banner-bg:#382b06; --banner-ink:#f6d57e; --banner-line:#574410;
  --inverse:#e9ecf2; --inverse-ink:#10141b;
  --focus-ring:#88a9ff52; --scrim:#0000009e;
  --shadow-1:inset 0 1px 0 #ffffff09;
  --shadow-2:inset 0 1px 0 #ffffff0d, 0 6px 16px -6px #00000073;
  --shadow-3:inset 0 1px 0 #ffffff0f, 0 24px 48px -12px #00000099;
  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:var(--w-regular) var(--text-md)/var(--lh-body) var(--font); min-height:100vh; min-height:100dvh;
  overflow-wrap:break-word; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
h1, h2, h3 { margin:0; font-weight:600; line-height:var(--lh-tight); text-wrap:balance; }
h1 { font-size:var(--text-2xl); letter-spacing:-.02em; }
h2 { font-size:var(--text-xl); letter-spacing:-.012em; line-height:1.25; }
h3 { font-size:var(--text-lg); letter-spacing:-.006em; line-height:1.3; }
@media (min-width: 768px) { h1 { font-size:var(--text-3xl); line-height:1.12; letter-spacing:-.024em; } }
p { margin:0; }
a { color:var(--accent); text-underline-offset:.2em; text-decoration-thickness:from-font; }
a:hover { color:var(--accent-strong); }
strong, b { font-weight:600; }
img, svg, video, canvas { max-width:100%; }
pre { white-space:pre-wrap; overflow-wrap:anywhere; margin:0; font:var(--text-sm)/1.5 var(--font-mono); }
[hidden] { display:none !important; }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
::selection { background:var(--accent-soft); color:var(--text); }
.muted { color:var(--muted); }
.small { font-size:var(--text-sm); }
.lead { font-size:var(--text-lg); line-height:1.5; color:var(--muted); max-width:68ch; }
.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:-64px; z-index:60; background:var(--surface); color:var(--text); padding:12px 16px; border-radius:var(--r-md); border:1px solid var(--line-strong); box-shadow:var(--shadow-2); }
.skip:focus { top:var(--s2); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
}

/* == Test banner (every page, always visible) == */
.testbar { background:var(--banner-bg); color:var(--banner-ink); font-size:var(--text-xs); font-weight:600; line-height:1.4;
  text-align:center; padding:7px var(--gutter); border-bottom:1px solid var(--banner-line); }

/* == App chrome: the ink bar (full width, never capped) == */
.topbar { background:var(--chrome); color:var(--chrome-ink); border-bottom:1px solid var(--chrome-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(--gutter); min-height:64px; }
.topbar :focus-visible { outline-color:var(--chrome-focus); }
.brand { font-size:var(--text-lg); font-weight:600; letter-spacing:-.01em; text-decoration:none; color:var(--chrome-ink); white-space:nowrap; min-height:44px;
  display:inline-flex; align-items:center; gap:6px; }
.brand:hover { color:var(--chrome-ink); }
.brand span { color:var(--chrome-muted); font-weight:500; }
.brand .brand-mark { width:28px; height:28px; flex:0 0 auto; color:var(--mark); margin-right:6px; }
.topbar .btn { font-size:var(--text-sm); }
.topbar .btn.ghost { color:var(--chrome-ink); }
.topbar .btn.ghost:hover { background:var(--chrome-hover); color:var(--chrome-ink); }
.topbar .muted { color:var(--chrome-muted); }
.menu-btn { margin-left:auto; }
.nav { display:none; }
.nav a { text-decoration:none; color:var(--chrome-muted); font-size:var(--text-sm); font-weight:500; padding:0 14px; border-radius:var(--r-md); min-height:40px; display:flex; align-items:center; }
.nav a:hover { color:var(--chrome-ink); background:var(--chrome-hover); }
.nav a[aria-current] { color:var(--chrome-ink); background:var(--chrome-active); 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(--s2); }
.me-name strong, .me-name .small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.me-name strong { font-size:var(--text-sm); }
.me-name .small { font-size:var(--text-xs); }
.me-box.always { display:flex; margin-left:auto; }

/* Narrow: the menu button opens the same destinations */
@media (max-width: 767.98px) {
  .topbar-in { column-gap:var(--s2); min-height:60px; }
  .topbar .btn.ghost { padding-inline:12px; }
  .brand { font-size:var(--text-md); }
  .brand .brand-mark { width:26px; height:26px; margin-right:4px; }
  .topbar.open .nav { display:block; flex:1 1 100%; max-height:calc(100vh - 150px); overflow-y:auto; border-top:1px solid var(--chrome-line); padding:var(--s2) 0; }
  .topbar.open .me-box { display:flex; flex:1 1 100%; border-top:1px solid var(--chrome-line); padding:var(--s3) 0; }
  .topbar.open .menu-btn { background:var(--chrome-active); }
  .nav-group { padding:var(--s2) 0; }
  .nav .nav-sec { pointer-events:none; min-height:32px; padding:0 var(--s1); font-size:var(--text-xs); font-weight:600; color:var(--chrome-muted); background:none; }
  .nav-pages { display:grid; grid-template-columns:1fr 1fr; gap:0 var(--s2); }
  .nav-pages a { padding:0 var(--s3); min-height:48px; color:var(--chrome-ink); font-size:var(--text-md); font-weight:400; }
  .nav-pages a[aria-current] { font-weight:600; box-shadow:inset 3px 0 0 var(--chrome-focus); }
  .me-box.always .me-name { max-width:30vw; }
  .me-box.always { column-gap:0; } .me-box.always .btn.ghost { padding-inline:10px; }
  .me-box.always .me-name .small, .me-box.always.has-out .me-name { display:none; }
}
/* Medium and wide: sections in the bar, pages in the sub-menu */
@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(--s3); }
  .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(--s5); }
  .me-box { order:3; }
}

/* Sub-menu: the pages of the open section */
.subnav { display:flex; gap:var(--s2); padding:0 var(--gutter); 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:52px; display:inline-flex; align-items:center; white-space:nowrap; color:var(--muted); font-size:var(--text-sm); font-weight:500;
  text-decoration:none; border-bottom:3px solid transparent; margin-bottom:-1px; padding-top:3px; }
.subnav a:hover { color:var(--text); }
.subnav a[aria-current=page] { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }

/* Nurse tab bar: the open tab gets a pill behind its icon */
.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); box-shadow:0 -4px 16px -8px #121a2814; padding:6px 0 env(safe-area-inset-bottom); }
.tabbar a { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-height:60px; font-size:var(--text-xs); font-weight:500; color:var(--muted); text-decoration:none; }
.tabbar a svg { width:60px; height:32px; padding:4px 18px; border-radius:var(--r-round); }
.tabbar a:hover { color:var(--text); }
.tabbar a[aria-current=page] { color:var(--text); font-weight:600; }
.tabbar a[aria-current=page] svg { background:var(--accent-soft); color:var(--accent); }
.tabbar a:focus-visible { outline-offset:-4px; border-radius:var(--r-md); }
@media (min-width: 768px) { .tabbar { padding-inline:calc((100% - 640px) / 2); } }
body.has-tabbar { padding-bottom:calc(80px + env(safe-area-inset-bottom)); }
body.has-tabbar .toast { bottom:calc(88px + env(safe-area-inset-bottom)); }

/* == Page (capped and centered; the chrome is not) == */
main, .page { width:100%; max-width:var(--vp-wide); margin-inline:auto; }
.page { padding:var(--s5) var(--gutter) var(--s10); min-width:0; }
@media (min-width: 768px) { .page { padding-top:var(--s7); } }
.page-head { display:flex; flex-wrap:wrap; align-items:flex-end; gap:var(--s4); margin-bottom:var(--s6); }
.page-head .grow { flex:1 1 280px; min-width:0; }
.page-head p { color:var(--muted); font-size:var(--text-md); margin-top:var(--s2); max-width:70ch; }
@media (min-width: 768px) { .page-head { margin-bottom:var(--s7); } .page-head p { font-size:var(--text-lg); } }
@media (max-width: 767.98px) { .page-head > .btn.primary { flex:1 1 100%; } }
.toolbar { display:flex; flex-wrap:wrap; gap:var(--s2) var(--s3); align-items:center; margin-bottom:var(--s4); min-width:0; }
.toolbar > * { max-width:100%; }
.section { margin-top:var(--s8); }
.section-head { display:flex; flex-wrap:wrap; gap:var(--s2) var(--s3); align-items:center; justify-content:space-between; margin-bottom:var(--s4); }
/* Explainer: own row under the title, text held to 72ch */
.section-head > p { color:var(--muted); flex:1 1 100%; max-width:none; padding-right:max(0px, calc(100% - 72ch)); }

/* == Controls == */
button, input, select, textarea { font:inherit; }
.btn { font:inherit; font-size:var(--text-sm); font-weight:600; line-height:1.25; border:1px solid var(--line-strong); background:var(--surface); color:var(--text);
  border-radius:var(--r-md); padding:11px 18px; 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%; box-shadow:var(--shadow-1);
  transition:background-color var(--t), border-color var(--t), color var(--t); }
.btn:hover { background:var(--surface-2); border-color:var(--edge); color:var(--text); }
.btn:active { background:var(--surface-3); }
.btn.primary { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.btn.primary:hover { background:var(--accent-strong); border-color:var(--accent-strong); color:var(--accent-ink); }
.btn.ghost { border-color:transparent; background:transparent; box-shadow:none; }
.btn.ghost:hover { background:var(--surface-2); border-color:transparent; }
.btn.danger { border-color:var(--bad-line); color:var(--bad); }
.btn.danger:hover { background:var(--bad-soft); border-color:var(--bad); color:var(--bad); }
.btn.primary.danger { background:var(--bad); border-color:var(--bad); color:var(--bad-ink); }
.btn.primary.danger:hover { filter:brightness(.94); background:var(--bad); }
.btn.small { min-height:36px; padding:7px 14px; }
@media (pointer: coarse) { .btn.small { min-height:44px; } }
.btn[disabled], .btn[aria-disabled=true] { opacity:.5; cursor:not-allowed; box-shadow:none; }
.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]), select, textarea {
  font-size:16px; line-height:1.35; color:var(--text); background-color:var(--surface); border:1px solid var(--edge); border-radius:var(--r-md);
  padding:11px 14px; min-height:48px; width:100%; max-width:100%; min-width:0; transition:border-color var(--t), box-shadow var(--t); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):hover, select:hover, textarea:hover { border-color:var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline:none; border-color:var(--accent); box-shadow:0 0 0 4px var(--focus-ring); }
select:not([multiple]):not([size]) { appearance:none; padding-right:40px; background-repeat:no-repeat; background-position:right 14px center; background-size:12px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23788196' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
input:disabled, select:disabled, textarea:disabled { background-color:var(--surface-2); color:var(--muted); cursor:not-allowed; }
textarea { min-height:96px; resize:vertical; line-height:1.5; }
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]) { width:auto; flex:0 1 auto; min-height:44px; }
.toolbar .field select, .toolbar .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]) { width:100%; }
.toolbar .grow, .toolbar input.grow:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]) { flex:1 1 220px; }
::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:var(--text-sm); margin-bottom:var(--s2); padding:0; }
.field > label.check, .field > label.switch { display:flex; font-weight:400; font-size:inherit; margin-bottom:0; }
.field .help { font-size:var(--text-sm); color:var(--muted); margin-top:6px; }
.field .err { font-size:var(--text-sm); color:var(--bad); margin-top:6px; font-weight:600; }
.field [aria-invalid=true] { border-color:var(--bad) !important; box-shadow:0 0 0 4px var(--bad-soft); }
fieldset.field { border:0; margin:0; padding:0; }
.check { display:flex; align-items:center; gap:12px; min-height:44px; font-weight:400; cursor:pointer; }
.row2 { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); gap:var(--s4); }

/* Switch: <label class="switch"><input type="checkbox"> Text</label> */
.switch { display:inline-flex; align-items:center; gap:12px; min-height:44px; cursor:pointer; }
.switch input[type=checkbox] { appearance:none; width:46px; height:28px; border-radius:14px; background:var(--edge); border:0; position:relative; cursor:pointer; flex:0 0 auto; }
.switch input[type=checkbox]::before { content:""; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff; box-shadow:0 1px 2px #00000040; }
.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 .14s var(--ease-out), background-color .14s var(--ease-out); } }

/* Week stepper */
.stepper { display:inline-flex; align-items:center; border:1px solid var(--line-strong); border-radius:var(--r-md); background:var(--surface); max-width:100%; box-shadow:var(--shadow-1); }
.stepper .btn { border:0; border-radius:9px; background:transparent; box-shadow:none; font-size:var(--text-lg); padding-inline:14px; }
.stepper .btn:hover { background:var(--surface-2); }
.stepper .label { padding:0 var(--s2); font-weight:600; white-space:nowrap; font-size:var(--text-md); font-variant-numeric:tabular-nums; }

/* == Surfaces == */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-1); min-width:0; }
.card-pad { padding:20px; }
@media (min-width: 768px) { .card-pad { padding:var(--s6); } }
.notice { border-radius:var(--r-lg); padding:var(--s4) 20px; background:var(--warn-soft); color:var(--text); border:1px solid var(--warn-line); margin-bottom:var(--s5); }
.notice strong { color:var(--warn); }
.notice p + p { margin-top:var(--s2); }
.notice .msg { background:var(--surface); }
.notice.info { background:var(--accent-soft); border-color:var(--accent-line); } .notice.info strong { color:var(--accent); }
.notice.bad { background:var(--bad-soft); border-color:var(--bad-line); } .notice.bad strong { color:var(--bad); }
.notice.ok { background:var(--ok-soft); border-color:var(--ok-line); } .notice.ok strong { color:var(--ok); }
.empty { padding:var(--s8) var(--s5); text-align:center; color:var(--muted); }
.empty p { max-width:56ch; margin-inline:auto; }
.empty strong { color:var(--text); font-size:var(--text-lg); }
.empty .btn { margin-top:var(--s4); }
.empty p + p { margin-top:var(--s2); }
.story { font-size:var(--text-lg); line-height:1.5; font-weight:500; letter-spacing:-.006em; max-width:64ch; margin-bottom:var(--s6); color:var(--text); }
@media (min-width: 768px) { .story { font-size:var(--text-xl); line-height:1.45; } }
.red-line { color:var(--bad); font-weight:600; }
.red-line::before { content:""; display:inline-block; width:8px; height:8px; border-radius:1px; background:currentColor; margin-right:var(--s2); vertical-align:.1em; }
.msg { white-space:pre-wrap; overflow-wrap:anywhere; background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-lg); padding:var(--s4); }
.danger-zone { margin-top:var(--s8); padding:20px; border:1px solid var(--bad-line); border-radius:var(--radius); background:color-mix(in srgb, var(--bad-soft) 45%, var(--surface)); }

/* Chips: status only, with a shape per tone: ok dot, warn triangle, bad square, info diamond */
.chip { display:inline-flex; align-items:center; gap:6px; font-size:var(--text-xs); font-weight:600; line-height:20px; padding:2px 10px; border-radius:var(--r-round);
  background:var(--surface-2); color:var(--muted); border:1px solid var(--line); white-space:nowrap; vertical-align:middle; font-variant-numeric:tabular-nums; }
.chip:is(.ok, .warn, .bad, .info)::before { content:""; flex:0 0 auto; width:8px; height:8px; background:currentColor; }
.chip.ok { background:var(--ok-soft); color:var(--ok); border-color:var(--ok-line); }
.chip.ok::before { border-radius:50%; }
.chip.warn { background:var(--warn-soft); color:var(--warn); border-color:var(--warn-line); }
.chip.warn::before { width:9px; clip-path:polygon(50% 0, 100% 100%, 0 100%); }
.chip.bad { background:var(--bad-soft); color:var(--bad); border-color:var(--bad-line); }
.chip.bad::before { border-radius:1px; }
.chip.info { background:var(--info-soft); color:var(--info); border-color:var(--info-line); }
.chip.info::before { width:7px; height:7px; transform:rotate(45deg); margin:0 1px; }
.chip.accent { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-line); }
.owner-tag { display:inline-flex; align-items:center; font-size:var(--text-xs); font-weight:500; line-height:20px; color:var(--muted); border:1px solid var(--line-strong); border-radius:var(--r-sm);
  padding:0 7px; white-space:nowrap; vertical-align:middle; background:var(--surface); }
.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:8px; vertical-align:baseline; flex:0 0 auto; box-shadow:inset 0 0 0 1px #0000001f; }

/* Tabs */
.tabs { display:flex; gap:var(--s2); overflow-x:auto; border-bottom:1px solid var(--line); margin-bottom:var(--s5); scrollbar-width:none; }
.tabs::-webkit-scrollbar { display:none; }
.tab { font:inherit; font-size:var(--text-sm); font-weight:500; background:none; border:0; border-bottom:3px solid transparent; margin-bottom:-1px; color:var(--muted); padding:12px 12px 9px; min-height:48px;
  cursor:pointer; white-space:nowrap; display:inline-flex; gap:8px; 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; border-radius:var(--r-sm); }
.tab[aria-selected=true], .tab[aria-current=page] { color:var(--text); border-bottom-color:var(--accent); font-weight:600; }
.tab .count { font-size:var(--text-xs); font-weight:600; line-height:20px; background:var(--surface-3); border-radius:var(--r-round); padding:0 8px; 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(128px, 1fr)); gap:var(--s3); margin-bottom:var(--s5); }
.count-btn { font:inherit; text-align:left; background:var(--surface); color:var(--muted); border:1px solid var(--line); border-radius:var(--radius); padding:var(--s3) var(--s4); box-shadow:var(--shadow-1);
  min-height:76px; cursor:pointer; display:flex; flex-direction:column; justify-content:center; gap:2px; text-decoration:none; min-width:0; font-size:var(--text-sm); line-height:1.3;
  transition:border-color var(--t), background-color var(--t); }
.count-btn strong, .count-btn .n { font-size:var(--text-2xl); line-height:1.1; font-weight:600; font-variant-numeric:tabular-nums; color:var(--text); letter-spacing:-.02em; }
@media (min-width: 768px) { .count-btn { padding:var(--s4) 20px; min-height:96px; } .count-btn strong, .count-btn .n { font-size:var(--text-3xl); } }
.count-btn:hover { border-color:var(--edge); color:var(--text); }
.count-btn[aria-pressed=true], .count-btn[aria-selected=true], .count-btn.on { border-color:var(--accent); background:var(--accent-soft); box-shadow:inset 0 0 0 1px var(--accent); color:var(--text); }
.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(--s4); align-items:center; padding:var(--s4) 20px; border-top:1px solid var(--line); }
.queue li:first-child { border-top:0; }
.queue .mark { align-self:stretch; border-radius:2px; 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; font-size:var(--text-md); }
.queue .meta { color:var(--muted); font-size:var(--text-sm); }
.queue .issue { font-size:var(--text-sm); margin-top:4px; }
.queue .actions { display:flex; gap:var(--s2); align-items:center; flex-wrap:wrap; justify-content:flex-end; }
/* A row's main action is soft accent: no wall of filled buttons */
.queue .actions .btn.primary { background:var(--accent-soft); border-color:var(--accent-line); color:var(--accent); box-shadow:none; }
.queue .actions .btn.primary:hover { background:var(--accent-soft); border-color:var(--accent); color:var(--accent-strong); }
@media (min-width: 768px) { .queue li { padding:20px var(--s5); } }
@media (max-width: 767.98px) {
  .queue li { grid-template-columns:4px minmax(0, 1fr); gap:var(--s3); }
  .queue .actions { grid-column:2; justify-content:flex-start; }
  .queue .actions > :is(.btn, details) { flex:1 1 auto; }
  table.stack td .chip, .kv dd .chip { white-space:normal; border-radius:var(--r-md); }
}

/* Tables (list pattern): always inside a visible frame */
.table-frame { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-1); 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:var(--text-sm); font-variant-numeric:tabular-nums; }
th { text-align:left; font-size:var(--text-xs); color:var(--muted); font-weight:600; background:var(--surface-2); white-space:nowrap; }
th, td { padding:14px var(--s4); border-bottom:1px solid var(--line); vertical-align:middle; }
th:first-child, td:first-child { padding-left:20px; } th:last-child, td:last-child { padding-right:20px; }
thead th { padding-top:11px; padding-bottom:11px; }
tbody th { font-size:var(--text-sm); color:var(--text); background:none; white-space:normal; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom:0; }
@media (hover: hover) { tbody tr:not(.day-row):not(.empty-row):hover > td, tbody tr:not(.day-row):not(.empty-row):hover > th { background:color-mix(in srgb, var(--surface-2) 60%, transparent); } }
td.r, th.r { text-align:right; }
td.empty { padding:var(--s8) var(--s4); }
tr.day-row td { background:var(--surface-2); font-weight:600; font-size:var(--text-sm); color:var(--text); padding-top:10px; padding-bottom:10px; }
/* table.stack: rows become blocks on a phone; cells carry data-label */
@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(--s4) 20px; 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:3px 0; text-align:left; }
  table.stack td:first-child, table.stack tbody th { font-weight:600; font-size:var(--text-md); padding-bottom:6px; }
  table.stack td[data-label]::before { content:attr(data-label) ": "; color:var(--muted); font-weight:400; }
  table.stack td:empty { display:none; }
  table.stack tr.day-row { padding:10px 20px; 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:140px; text-align:left; box-shadow:inset -1px 0 0 var(--line); }
.matrix thead th:first-child { background:var(--surface-2); }
.matrix td.changed { background:var(--accent-soft); font-weight:600; box-shadow:inset 3px 0 0 var(--accent); }

/* Numbers: big, tabular, with a plain label */
.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:var(--s3); margin-bottom:var(--s5); }
@media (min-width: 768px) { .stats { gap:var(--s4); } }
.stat { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-1); padding:var(--s4) 20px; min-width:0; }
.stat .k { font-size:var(--text-sm); color:var(--muted); }
.stat .v { overflow-wrap:normal; font-size:var(--text-2xl); line-height:1.15; font-weight:600; font-variant-numeric:tabular-nums; letter-spacing:-.02em; margin-top:6px; }
@media (min-width: 768px) { .stat { padding:20px var(--s5); } .stat .v { font-size:var(--text-3xl); } }
.numline { display:grid; grid-template-columns:minmax(0, 1fr) auto auto; gap:4px var(--s4); align-items:baseline; padding:var(--s4) 0; border-top:1px solid var(--line); }
.numline:first-child { border-top:0; }
.numline .label { font-size:var(--text-md); }
.numline .label small { display:block; color:var(--muted); font-size:var(--text-sm); margin-top:2px; }
.numline .value { font-size:var(--text-xl); font-weight:600; font-variant-numeric:tabular-nums; text-align:right; letter-spacing:-.015em; }
@media (min-width: 768px) { .numline { padding:20px 0; } .numline .value { font-size:var(--text-2xl); } }
.delta { font-weight:600; white-space:nowrap; }
.numline .delta { font-size:var(--text-sm); color:var(--muted); min-width:64px; text-align:right; }
.delta.up { color:var(--ok); } .delta.down { color:var(--bad); }
.kv { display:grid; grid-template-columns:minmax(104px, max-content) minmax(0, 1fr); gap:10px var(--s5); 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(--s3) 0 var(--s3) 44px; border-top:1px solid var(--line); min-height:52px; }
.step-list li:first-child { border-top:0; }
.step-list li::before { content:counter(step); position:absolute; left:0; top:var(--s3); width:28px; height:28px; border-radius:50%; background:var(--surface); border:1px solid var(--line-strong);
  font-size:var(--text-xs); font-weight:600; display:grid; place-items:center; color:var(--muted); font-variant-numeric:tabular-nums; }
.step-list li.done::before { content:"\2713"; background:var(--ok-soft); color:var(--ok); border-color:var(--ok); }

/* Calendar: 7 columns wide, a day list on a phone. Tile color from data: --tile */
.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; box-shadow:var(--shadow-1); }
.cal-day { background:var(--surface); min-height:120px; padding:var(--s3) 10px; min-width:0; display:flex; flex-direction:column; gap:6px; font-size:var(--text-sm); }
.cal-day.today { box-shadow:inset 0 3px 0 var(--accent); background:color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }
.cal-day.out { background:var(--surface-2); color:var(--muted); }
.tile { display:block; border-left:3px solid var(--tile, var(--line-strong)); background:var(--surface-2); border-radius:var(--r-sm); padding:6px 8px; font-size:var(--text-xs); line-height:1.35;
  color:var(--text); text-decoration:none; min-width:0; overflow:hidden; text-overflow:ellipsis; transition:background-color var(--t); }
a.tile:hover, button.tile:hover { background:var(--accent-soft); color:var(--text); }
button.tile { font:inherit; font-size:var(--text-xs); 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(--s4) 20px; gap:var(--s2); }
  .tile, button.tile { padding:10px 12px; font-size:var(--text-sm); min-height:48px; display:flex; align-items:center; }
}

/* Nurse clock: the one big button on her phone */
.clock-card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-xl); box-shadow:var(--shadow-2); padding:20px; display:flex; flex-direction:column; gap:var(--s4); margin-bottom:var(--s6); min-width:0; }
@media (min-width: 768px) { .clock-card { padding:var(--s6); } }
.bigbtn { font:inherit; width:100%; min-height:80px; font-size:var(--text-xl); font-weight:600; line-height:1.2; border:0; border-radius:var(--r-lg); background:var(--accent); color:var(--accent-ink); cursor:pointer;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; padding:var(--s4) 20px; text-decoration:none; text-align:center; letter-spacing:-.01em;
  box-shadow:inset 0 -2px 0 #00000024; transition:background-color var(--t), transform var(--t); }
.bigbtn:hover { background:var(--accent-strong); color:var(--accent-ink); }
.bigbtn:active { transform:translateY(1px); }
.bigbtn small { font-size:var(--text-sm); font-weight:500; letter-spacing:0; opacity:.92; }
.bigbtn.out, .bigbtn.danger { background:var(--bad); color:var(--bad-ink); }
.bigbtn.out:hover, .bigbtn.danger:hover { background:var(--bad); filter:brightness(.94); }
.bigbtn.ghost { background:var(--surface); color:var(--text); border:1px solid var(--line-strong); box-shadow:var(--shadow-1); min-height:56px; font-size:var(--text-md); }
.bigbtn.ghost:hover { background:var(--surface-2); }
.bigbtn[disabled], .bigbtn[aria-disabled=true] { background:var(--surface-2); color:var(--muted); cursor:not-allowed; box-shadow:none; transform:none; filter:none; }
.bigbtn[aria-busy=true] { opacity:.75; cursor:progress; }

/* == Overlays == */
dialog { color:var(--text); }
dialog::backdrop { background:var(--scrim); }
/* 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(520px, 100%); max-width:100%;
  height:100%; max-height:100%; background:var(--surface); box-shadow:var(--shadow-3); 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) 20px; min-height:68px; border-bottom:1px solid var(--line); flex:0 0 auto; }
.sheet-body { padding:20px; display:flex; flex-direction:column; gap:20px; overflow-y:auto; flex:1 1 auto; min-height:0; }
@media (min-width: 768px) { .sheet-head { padding-left:var(--s6); padding-right:var(--s4); } .sheet-body { padding:var(--s6); gap:var(--s5); } }
.sheet-error { margin:0 20px var(--s3); color:var(--bad); font-weight:600; font-size:var(--text-sm); }
.sheet-foot { padding:var(--s4) 20px; border-top:1px solid var(--line); display:flex; gap:var(--s3); justify-content:flex-end; flex-wrap:wrap; background:var(--surface-2); flex:0 0 auto; }
@media (min-width: 768px) { .sheet-foot { padding-inline:var(--s6); } }
/* Small centered box for a yes or no */
dialog.modal { border:1px solid var(--line); border-radius:var(--r-xl); padding:var(--s5); width:min(520px, calc(100% - 32px)); max-width:calc(100% - 32px); max-height:calc(100% - 32px);
  background:var(--surface); box-shadow:var(--shadow-3); overflow-y:auto; }
@media (min-width: 768px) { dialog.modal { padding:var(--s6); } }
dialog.modal > form { display:flex; flex-direction:column; gap:var(--s4); margin:0; }
dialog.modal h2 { padding-right:var(--s4); }
dialog.modal p { color:var(--muted); }
.modal-foot { display:flex; gap:var(--s3); justify-content:flex-end; flex-wrap:wrap; margin-top:var(--s3); }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation:sheet-in var(--dur-2) var(--ease-out); }
  dialog.modal[open] { animation:pop-in .16s var(--ease-out); }
  dialog[open]::backdrop { animation:fade-in var(--dur-2) var(--ease-out); }
  @keyframes sheet-in { from { transform:translateX(32px); opacity:0; } }
  @keyframes pop-in { from { transform:translateY(4px) scale(.985); opacity:0; } }
  @keyframes fade-in { from { opacity:0; } }
}

/* Toast */
.toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:var(--inverse); color:var(--inverse-ink); padding:14px 20px; border-radius:var(--r-lg);
  font-size:var(--text-sm); font-weight:500; z-index:70; width:max-content; max-width:calc(100% - 32px); box-shadow:var(--shadow-3); }
@media (prefers-reduced-motion: no-preference) { .toast { animation:rise .18s var(--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, .stat, .cal { border-color:#999; box-shadow:none; }
}
