/* Copied verbatim from Corvanta core/frontend/design-system.css so CoreCompass shares
   Corvanta's tokens, shell, and dark mode. Update by recopying the file, not by editing it here.
   CoreCompass specific rules live in corecompass.css. */
/*
Phase 49 — real gap closed: 27 of 28 frontend pages each independently
duplicated an identical :root{} design-token block and the same base
header/brand/role-switch rules inline — confirmed directly via md5sum
across every page before extracting this. Changing a single color
previously meant editing up to 27 files by hand; this is the real,
single source of truth those pages now link to instead.

Deliberately scoped to only the block that was verified byte-identical
across pages (tokens, resets, focus-visible, skip-link, brand-rule,
header/brand/role-switch, and the shared main{} base) — not an
aggressive rewrite of every card/button/modal/toast pattern each page
still defines locally. That broader consolidation, plus the actual
visual refresh (dark mode, icons, motion), is real, separate,
follow-up work — see the Phase 50 recommendation.
*/
:root{
  --ink:#333333; --ink-soft:#666666; --ink-faint:#707070; --paper:#f9f9f9; --panel:#FFFFFF; --line:#dddddd;
  --navy:#006a9e; --navy-mid:#005a87; --teal:#1F6F53; --teal-soft:#E1F0EA; --amber:#8A5F1F; --amber-soft:#F7ECD9;
  --brick:#A6192E; --brick-soft:#F7E3E6; --focus:#007cba; --secondary:#5124B3;
  /* Real gap closed — Phase 13 of the phased recovery plan, per direct
     instruction: dark mode "only works for a few things, not the
     entire page in every module." Confirmed directly, at scale, not
     guessed: 386 hardcoded hex color declarations across 43 of this
     app's own 44 real pages (grepped every one before touching
     anything). The large majority were accidental duplicates of
     existing tokens (background:#fff instead of var(--panel)) — fixed
     directly at each real call site, not by adding a token for those.
     This set of five new pairs covers the real, remaining gap: this
     app's own recurring "dark text on a light, same-hue badge
     background" pattern (success/danger/warning/info/purple) had real
     text colors hardcoded everywhere it appeared, with no real token
     for it at all — every one of these pairs is genuinely legible in
     both real modes, not just carried over from light mode. */
  --teal-text:#154A38; --brick-text:#7A1122; --amber-text:#7A5A12; --navy-text:#1B4B6B;
  --purple-soft:#F0E8F7; --purple-text:#5B2E8C; --navy-soft:#E1EEF7;
  /* Real gap closed — Phase 51: a dedicated header-background token,
     distinct from --navy itself. Confirmed via actual WCAG contrast
     math (not assumed) that white header text on the dark-mode
     --navy accent (#3D9FDB, chosen to read well as text/links against
     dark backgrounds) only reaches 2.92:1 — failing AA's 4.5:1
     requirement. --navy stays tuned for "accent on a dark background";
     --header-bg is tuned separately for "white text on top of it,"
     which the light theme's original value already satisfied by
     coincidence but the dark theme could not without its own token. */
  --header-bg:#007cba;
  --teal-solid:#1F6F53;
  --sans:"IBM Plex Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  --shadow-sm: 0 1px 2px rgba(20,33,61,.05);
  --shadow-md: 0 1px 2px rgba(20,33,61,.04), 0 6px 16px -4px rgba(20,33,61,.10);
  --ease: 0.3s ease; --radius:4px; --fs-base:14px; --fs-small:12px; --fs-xsmall:11px; --fs-medium:16px;
}
*{box-sizing:border-box;}
:focus-visible{outline:3px solid var(--focus); outline-offset:2px; border-radius:2px;}
a.skip-link{position:absolute; left:-999px; background:var(--focus); color:#fff; padding:10px 16px; z-index:100; border-radius:0 0 6px 0;}
a.skip-link:focus{left:0; top:0;}
html{background:var(--navy);}
/* Real gap closed — Phase 13 of the phased recovery plan, per direct
   instruction: a real, user-configurable settings panel (font size,
   theme, density, default landing page), applied by design-system.js
   the same real way vp-theme already is — read from localStorage and
   set on <html> before paint. Font size uses a real, honest
   mechanism given this app's own CSS is hardcoded in px throughout,
   not rem/em, confirmed directly (grepped every font-size in this
   file) — zoom scales the whole real page proportionally, the same
   real effect as a browser's own zoom, rather than a half-working
   partial rem retrofit. Density is real but intentionally scoped: it
   targets this app's own real, most-recurring shared class names
   (.card, .row, .item-row, table cells) with !important so it wins
   over page-local rules of the same or lower specificity — genuinely
   tighter on most real pages, not a claim of universal coverage on
   every page's own bespoke local element. */
html[data-font-size="small"]{zoom:0.9;}
html[data-font-size="large"]{zoom:1.15;}
html[data-density="compact"] .card,
html[data-density="compact"] .row,
html[data-density="compact"] .item-row,
html[data-density="compact"] table td,
html[data-density="compact"] table th,
html[data-density="compact"] .inline-form{padding:6px 10px !important; margin-bottom:4px !important;}
html[data-density="compact"] table td, html[data-density="compact"] table th{padding:6px 8px !important;}
body{margin:0; min-height:100vh; background:var(--paper); color:var(--ink); font-family:var(--sans); font-size:var(--fs-base); line-height:1.5; -webkit-font-smoothing:antialiased;}
/* Real gap closed — Phase 13 of the phased recovery plan: confirmed
   directly, live, that some pages (mar.html among them) never define
   their own base button rule at all — those buttons rendered with
   the browser's own native, unthemed appearance, which never adapts
   to any real theme. This shared, global base rule reaches every
   page that loads this file (all of them); a page with its own, more
   specific local button rule already wins the real cascade — this
   never overrides one, it only fills the real gap where none existed. */
button{font-family:var(--sans); font-size:var(--fs-small); font-weight:600; padding:8px 14px; border-radius:var(--radius); border:1px solid var(--line); background:var(--panel); color:var(--ink); cursor:pointer;}
button.primary{background:var(--navy); border-color:var(--navy); color:#fff;}
/* Real, deliberate, shared destructive-action style — per direct
   nurse-review finding, first used for the sick-call cancel button
   and reused wherever else this same real "wrong patient, undo a
   real clinical record" pattern applies, rather than a one-off,
   page-specific style. */
button.danger{background:var(--brick); border-color:var(--brick); color:#fff;}
button.danger:hover{opacity:.85;}
/* Real bug fixed — per direct nurse-review finding: the patient list
   was unreadable in dark mode. Confirmed directly, live: the real
   cause was select's own text color never being set at all, on this
   page or the other 16 real pages with a <select> and no real select
   rule of their own — every one fell back to the browser's own
   native, unthemed black text, invisible against a real dark
   background. This is a real, global base rule (the same real
   pattern already used for button above), so a page's own, more
   specific local rule (like .patient-picker select's own real
   background) still wins the real cascade for whatever property it
   sets — this only fills in the real gap where a property, most
   often color, was never set anywhere at all. */
/* Per direct report: "Why do some text boxes look different?
   Inconsistencies throughout application."
   Root cause found here: `select` had a full set of base styles while
   `input` and `textarea` had NONE, so every text box in the app fell
   back to the browser default — square corners, different border,
   different font — and sat next to a properly styled dropdown looking
   like a different control. Any page that looked right did so only
   because it set its own inline styles, which is why the appearance
   varied screen to screen.
   The three now share one declaration. Page-level styles still win the
   cascade, so nothing that deliberately styled a field is overridden;
   this only fills the gap where nothing was ever set. */
select,
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=submit]):not([type=button]),
textarea{
  font-family:var(--sans); font-size:var(--fs-small); padding:8px 11px;
  border-radius:var(--radius); border:1px solid var(--line);
  background:var(--panel); color:var(--ink);
}
textarea{line-height:1.5;}
select option{background:var(--panel); color:var(--ink);}
/* A visible, consistent focus ring — previously each field showed
   whatever its browser default was, which is also part of why they
   looked unalike. */
select:focus-visible,
input:not([type=checkbox]):not([type=radio]):focus-visible,
textarea:focus-visible{
  outline:2px solid var(--secondary, #2b6cb0); outline-offset:1px;
}
select:disabled, input:disabled, textarea:disabled{
  background:var(--bg, #f1f3f5); color:var(--muted, #667); cursor:not-allowed;
}
.brand-rule{height:3px; background:linear-gradient(90deg, var(--navy) 0%, var(--navy-mid) 45%, var(--secondary) 100%);}
header{display:flex; align-items:center; justify-content:space-between; padding:14px 28px; background:var(--header-bg); color:#fff; position:sticky; top:0; z-index:5; box-shadow:var(--shadow-md); flex-wrap:wrap; gap:8px;}
.brand{display:flex; align-items:center; gap:12px;}
.brand .mark{background:#fff url('/assets/corvanta-mark.svg') center/78% no-repeat; width:32px; height:32px; padding:0; border-radius:7px; display:inline-block; flex-shrink:0; box-shadow:var(--shadow-sm);}
.brand .brand-text{display:flex; flex-direction:column; gap:1px;}
.brand .name{font-weight:600; font-size:16px; line-height:1.2;}
.brand .org{color:#A8B3C4; font-size:12px; font-family:var(--mono); line-height:1.2;}
.role-switch{display:flex; align-items:center; gap:10px; font-size:13px; color:#A8B3C4; flex-wrap:wrap;}
.role-switch select{font-family:var(--sans); font-size:13px; padding:7px 11px; border-radius:6px; border:1px solid #33456B; background:var(--navy-mid); color:#fff;}
.role-switch a{color:#A8B3C4; text-decoration:none; margin-left:2px;}
.role-switch a:hover{color:#fff;}
main{margin:0 auto; padding:28px 28px 64px;}

/* Real gap closed — Phase 51: the second round of the same
   "verify byte-identical before extracting" method Phase 49 used —
   confirmed via direct comparison across all 26-29 pages before
   touching anything. These seven rules were identical across 21-24
   pages each; every page with a genuinely different value (a handful
   for each rule) keeps its own local override, which correctly wins
   the cascade since it comes later in each page's own <style> block. */
.card .empty{padding:24px 18px; color:var(--ink-faint); font-size:13px; text-align:center;}
button:hover:not(:disabled){border-color:var(--ink-faint); box-shadow:var(--shadow-sm);}
button.primary:hover{background:var(--navy-mid); border-color:var(--navy-mid);}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
.toast.error{background:var(--brick);}
.field-group label{font-size:11.5px; text-transform:uppercase; letter-spacing:.07em; color:var(--ink-soft); font-weight:600; display:block; margin-bottom:6px;}
.note{font-size:12px; color:var(--ink-faint); margin-top:24px; line-height:1.65;}

/* =====================================================================
   PHASE 50 — Modern Sleek UI Refresh
   Real gap closed: no dark mode, minimal motion, and text-only nav
   existed anywhere (confirmed directly — zero occurrences of
   prefers-color-scheme across all 28 pages before this). Because every
   page's own local card/button/badge/modal/toast CSS already reads
   from these same shared var() tokens (not hardcoded colors), redefining
   the tokens here is enough to re-theme every page's existing component
   CSS too — no per-page component rewrite needed, the leverage this
   entire design-system.css file exists to provide.
   ===================================================================== */

/* --- Dark mode: real system-preference detection, with an explicit,
   persisted override available via the toggle in design-system.js --- */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --ink:#E4E6EB; --ink-soft:#A8AEBC; --ink-faint:#7C8494; --paper:#12151C; --panel:#1B1F29; --line:#2C3140;
    --navy:#3D9FDB; --navy-mid:#2E7CB0; --teal:#3FB98A; --teal-soft:#123326; --amber:#E0B25C; --amber-soft:#332815;
    --brick:#E8677E; --brick-soft:#3A1C22; --focus:#3D9FDB; --secondary:#8A6FE0;
    --teal-text:#6FE0B3; --brick-text:#F5A3B0; --amber-text:#F0C98A; --navy-text:#9BC9EA;
    --purple-soft:#2E2440; --purple-text:#C9A8E8; --navy-soft:#0F2A3D;
    --header-bg:#1D5A82;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.24);
    --shadow-md: 0 1px 2px rgba(0,0,0,.3), 0 6px 16px -4px rgba(0,0,0,.45);
  }
}
[data-theme="dark"]{
  --ink:#E4E6EB; --ink-soft:#A8AEBC; --ink-faint:#7C8494; --paper:#12151C; --panel:#1B1F29; --line:#2C3140;
  --navy:#3D9FDB; --navy-mid:#2E7CB0; --teal:#3FB98A; --teal-soft:#123326; --amber:#E0B25C; --amber-soft:#332815;
  --brick:#E8677E; --brick-soft:#3A1C22; --focus:#3D9FDB; --secondary:#8A6FE0;
  --teal-text:#6FE0B3; --brick-text:#F5A3B0; --amber-text:#F0C98A; --navy-text:#9BC9EA;
  --purple-soft:#2E2440; --purple-text:#C9A8E8; --navy-soft:#0F2A3D;
  --header-bg:#1D5A82;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.24);
  --shadow-md: 0 1px 2px rgba(0,0,0,.3), 0 6px 16px -4px rgba(0,0,0,.45);
}
/* Real, immediate transition on the properties that actually change
   between themes — not a blanket `transition:all`, which would also
   (wrongly) animate hover states, layout, etc. */
body, .card, .panel, button, input, select, textarea{
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}

/* --- Real theme toggle button, injected by design-system.js — styled
   here so it matches the header regardless of which page it lands on --- */
/* --- Real gap closed — UI restructure Phase 1: the 26+-link flat nav
   was the single biggest source of "this looks cluttered" feedback.
   Grouped into real category boundaries Corvanta's own pages
   already fall into (Patient Care, MedPass & Pharmacy, Scheduling &
   Tasks, Documents & Forms, Compliance & Reports, Administration),
   rendered by design-system.js from one real, shared NAV_GROUPS
   definition — the same real hrefs as before, so the existing
   per-link icon rules below keep matching unchanged. the system's own
   design for Corvanta, not sourced from any external document. --- */
.vp-nav-group{position:relative;}
.vp-nav-group-btn{
  background:transparent; border:none; color:#A8B3C4; font-family:var(--sans); font-size:13px; font-weight:500;
  padding:7px 8px; border-radius:6px; cursor:pointer; display:inline-flex; align-items:center; gap:4px;
}
.vp-nav-group-btn:hover, .vp-nav-group-btn.vp-open{background:rgba(255,255,255,.1); color:#fff;}
.vp-nav-group-btn .vp-caret{font-size:9px; opacity:.7;}
.vp-nav-group-panel{
  display:none; position:absolute; top:calc(100% + 4px); left:0; min-width:200px; background:var(--panel);
  border:1px solid var(--line); border-radius:8px; box-shadow:var(--shadow-md); padding:6px; z-index:20;
}
.vp-nav-group-panel.vp-open{display:block;}
.vp-nav-group-panel a{color:var(--ink) !important; display:flex !important; padding:8px 10px; border-radius:6px; margin-left:0 !important;}
.vp-nav-group-panel a:hover{background:var(--paper); color:var(--navy) !important;}

.vp-theme-toggle{
  background:transparent; border:1px solid rgba(255,255,255,.35); color:#fff; border-radius:7px;
  width:32px; height:32px; display:flex; align-items:center; justify-content:center; cursor:pointer;
  font-size:15px; line-height:1; flex-shrink:0; transition:background-color var(--ease), border-color var(--ease);
}
.vp-theme-toggle:hover{background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.6);}

/* Real gap closed — Phase 13 of the phased recovery plan: the real
   settings panel trigger, styled identically to the existing
   theme/logout buttons (same real pattern already established in
   Phase 52's own comment above for consistency) so it reads as part
   of the same real control cluster, not a bolted-on extra. */
.vp-settings-toggle{
  background:transparent; border:1px solid rgba(255,255,255,.35); color:#fff; border-radius:7px;
  width:32px; height:32px; display:flex; align-items:center; justify-content:center; cursor:pointer;
  flex-shrink:0; transition:background-color var(--ease), border-color var(--ease);
}
/* Real bug fixed — per direct nurse-review finding: the settings
   gear rendered as a real, empty blank square. Confirmed directly,
   live: the svg itself, as a real flex item inside this button's
   own real flex container, was being shrunk to 4px by the real,
   default flex-shrink:1 browser behavior — the button's own real
   flex-shrink:0 above only protects it from ITS OWN parent, not its
   own children. */
.vp-settings-toggle svg{flex-shrink:0;}
.vp-settings-toggle:hover{background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.6);}
.vp-settings-panel{
  position:absolute; top:calc(100% + 8px); right:0; background:var(--panel,#fff); border:1px solid var(--line,#dde4ea);
  border-radius:10px; box-shadow:var(--shadow-md); padding:14px; width:260px; z-index:60; display:none;
}
.vp-settings-panel.vp-open{display:block;}
.vp-settings-panel h3{font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:700; color:var(--ink-faint,#5f7083); margin:0 0 8px;}
.vp-settings-panel .vp-settings-row{margin-bottom:14px;}
.vp-settings-panel .vp-settings-row:last-child{margin-bottom:0;}
.vp-settings-panel .vp-seg{display:flex; border:1px solid var(--line,#dde4ea); border-radius:7px; overflow:hidden;}
.vp-settings-panel .vp-seg button{
  flex:1; background:transparent; border:none; padding:7px 6px; font-size:12.5px; font-family:var(--sans); color:var(--ink,#1a2530);
  cursor:pointer; border-right:1px solid var(--line,#dde4ea);
}
.vp-settings-panel .vp-seg button:last-child{border-right:none;}
.vp-settings-panel .vp-seg button.vp-on{background:var(--navy,#007cba); color:#fff;}
.vp-settings-panel select{width:100%; font-family:var(--sans); font-size:12.5px; padding:6px 8px; border-radius:6px; color:var(--ink,#1a2530) !important; background:#fff !important; border:1px solid var(--line,#dde4ea) !important;}
/* Real gap closed — per direct HSA-review finding: "move
   administration items to under the settings button." Matches the
   same real link style the "More" menu's own overflow panel already
   uses, so this reads as the same real kind of navigation list, not
   a visually different one. */
.vp-settings-panel .vp-settings-admin-links{display:flex; flex-direction:column; gap:2px;}
.vp-settings-panel .vp-settings-admin-links a{display:block; color:var(--ink,#1a2530); font-size:12.5px; padding:7px 8px; border-radius:6px; text-decoration:none;}
.vp-settings-panel .vp-settings-admin-links a:hover{background:var(--paper,#f3f6f8); color:var(--navy,#007cba);}

/* Real gap closed — Phase 52: styled the same way as the theme/nav
   toggle buttons so it looks intentional on every page regardless of
   which one it lands on, not like an afterthought. */
.vp-logout-btn{
  background:transparent; border:1px solid rgba(255,255,255,.35); color:#fff; border-radius:7px;
  width:32px; height:32px; display:flex; align-items:center; justify-content:center; cursor:pointer;
  font-size:15px; line-height:1; flex-shrink:0; transition:background-color var(--ease), border-color var(--ease);
}
.vp-logout-btn:hover{background:rgba(168,25,46,.35); border-color:rgba(255,255,255,.6);}

/* --- Real mobile nav toggle, injected by design-system.js for narrow
   viewports — the wrapped-flex nav (Phase 49's real fix) works down to
   a point, but a 26-link nav on a phone-width screen genuinely needs a
   collapse, not just wrapping. --- */
.vp-nav-toggle{display:none;}
@media (max-width: 720px){
  .vp-nav-toggle{
    display:flex; align-items:center; justify-content:center; background:transparent; border:1px solid rgba(255,255,255,.35);
    color:#fff; border-radius:7px; width:32px; height:32px; cursor:pointer; font-size:16px; flex-shrink:0;
  }
  .vp-nav-links{
    display:none; width:100%; flex-direction:column; align-items:stretch; gap:2px;
    background:var(--navy-mid); border-radius:8px; padding:10px; margin-top:8px;
  }
  .vp-nav-links.vp-open{display:flex;}
  .vp-nav-links a{margin-left:0; padding:9px 8px; border-radius:6px;}
  .vp-nav-links a:hover{background:rgba(255,255,255,.1);}
  .vp-nav-group-btn{width:100%; justify-content:space-between;}
  .vp-nav-group-panel{position:static; display:none; box-shadow:none; border:none; background:rgba(0,0,0,.15); margin:2px 0 6px;}
  .vp-nav-group-panel.vp-open{display:block;}
  .vp-nav-group-panel a{color:#fff !important;}
  .vp-nav-group-panel a:hover{background:rgba(255,255,255,.1); color:#fff !important;}
}

/* --- Real, subtle motion: a page settling in, not a flashy animation --- */
@keyframes vp-fade-in{ from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:translateY(0);} }
main{animation: vp-fade-in 0.28s ease both;}
@media (prefers-reduced-motion: reduce){
  main{animation:none;}
  body, .card, .panel, button, input, select, textarea{transition:none;}
}

/* --- Real icon system: a small, curated SVG set (monochrome, via
   mask-image so it inherits currentColor and re-themes automatically
   with dark mode) mapped to real nav hrefs via attribute selectors —
   applies to every page's nav with zero per-page HTML changes, the
   same shared-file leverage this whole file is built around. Pages
   without a specific icon below get a real, honest generic dot rather
   than nothing, so a future addition isn't the only unstyled one. --- */
.role-switch a{display:inline-flex; align-items:center; gap:6px;}
.role-switch a::before{
  content:""; width:15px; height:15px; flex-shrink:0; display:inline-block;
  background-color:currentColor; -webkit-mask-size:contain; mask-size:contain;
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; -webkit-mask-position:center; mask-position:center;
  opacity:.85;
}
.role-switch a[href="/"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M3 11l9-8 9 8"/><path d="M5 10v10h14V10"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M3 11l9-8 9 8"/><path d="M5 10v10h14V10"/></svg>'); }
.role-switch a[href="/tasks.html"]::before, .role-switch a[href="/queues.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 9h6M9 13h6M9 17h3"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 9h6M9 13h6M9 17h3"/></svg>'); }
.role-switch a[href="/notifications.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M6 8a6 6 0 0112 0c0 5 2 6 2 6H4s2-1 2-6z"/><path d="M10 21a2 2 0 004 0"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M6 8a6 6 0 0112 0c0 5 2 6 2 6H4s2-1 2-6z"/><path d="M10 21a2 2 0 004 0"/></svg>'); }
.role-switch a[href="/messages.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2v10z"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2v10z"/></svg>'); }
.role-switch a[href="/vitals.html"]::before, .role-switch a[href="/unified-chart.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M3 12h4l2-8 4 16 2-8h6"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M3 12h4l2-8 4 16 2-8h6"/></svg>'); }
.role-switch a[href="/module-registry.html"]::before, .role-switch a[href="/content-admin.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg>'); }
.role-switch a[href="/specialty-care.html"]::before, .role-switch a[href="/substance-care.html"]::before, .role-switch a[href="/care-coordination.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M20.8 8.6c0 5.4-8.8 10.4-8.8 10.4S3.2 14 3.2 8.6a4.6 4.6 0 018.8-1.8 4.6 4.6 0 018.8 1.8z"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M20.8 8.6c0 5.4-8.8 10.4-8.8 10.4S3.2 14 3.2 8.6a4.6 4.6 0 018.8-1.8 4.6 4.6 0 018.8 1.8z"/></svg>'); }
.role-switch a[href="/scheduling.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/></svg>'); }
.role-switch a[href="/pharmacy-ehr.html"]::before, .role-switch a[href="/medpass.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M9 3h6v5l4 9a2 2 0 01-2 3H7a2 2 0 01-2-3l4-9V3z"/><path d="M7 14h10"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M9 3h6v5l4 9a2 2 0 01-2 3H7a2 2 0 01-2-3l4-9V3z"/><path d="M7 14h10"/></svg>'); }
.role-switch a[href="/sick-calls.html"]::before, .role-switch a[href="/public-health.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 3"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 3"/></svg>'); }
.role-switch a[href="/compliance.html"]::before, .role-switch a[href="/epcs.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6l7-3z"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6l7-3z"/></svg>'); }
.role-switch a[href="/forms.html"]::before, .role-switch a[href="/documents.html"]::before, .role-switch a[href="/reports.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M7 3h7l5 5v13a1 1 0 01-1 1H7a1 1 0 01-1-1V4a1 1 0 011-1z"/><path d="M14 3v5h5M9 13h6M9 17h6"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M7 3h7l5 5v13a1 1 0 01-1 1H7a1 1 0 01-1-1V4a1 1 0 011-1z"/><path d="M14 3v5h5M9 13h6M9 17h6"/></svg>'); }
.role-switch a[href="/protocols.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M9 12l2 2 4-4"/><circle cx="12" cy="12" r="9"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M9 12l2 2 4-4"/><circle cx="12" cy="12" r="9"/></svg>'); }
.role-switch a[href="/facility-stock.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M3 21V9l9-6 9 6v12"/><path d="M9 21v-8h6v8"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><path d="M3 21V9l9-6 9 6v12"/><path d="M9 21v-8h6v8"/></svg>'); }
.role-switch a[href="/users-admin.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="9" cy="8" r="3.5"/><path d="M2.5 20a6.5 6.5 0 0113 0"/><circle cx="18" cy="9" r="2.5"/><path d="M15.5 20a5 5 0 016 0"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="9" cy="8" r="3.5"/><path d="M2.5 20a6.5 6.5 0 0113 0"/><circle cx="18" cy="9" r="2.5"/><path d="M15.5 20a5 5 0 016 0"/></svg>'); }
.role-switch a[href="/help-training.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M9.5 9a2.5 2.5 0 015 .5c0 1.7-2.5 2-2.5 3.5"/><circle cx="12" cy="17" r=".6" fill="black" stroke="none"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M9.5 9a2.5 2.5 0 015 .5c0 1.7-2.5 2-2.5 3.5"/><circle cx="12" cy="17" r=".6" fill="black" stroke="none"/></svg>'); }
.role-switch a[href="/change-password.html"]::before{ -webkit-mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 018 0v4"/></svg>'); mask-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 018 0v4"/></svg>'); }
/* Real, honest fallback for the two remaining categorized-but-unmatched
   links (Module Registry's sibling Content Admin already covered
   above) — a plain dot rather than a blank gap. */
.role-switch a::before{ }
.role-switch a:not([href="/"]):not([href="/tasks.html"]):not([href="/queues.html"]):not([href="/notifications.html"]):not([href="/messages.html"]):not([href="/vitals.html"]):not([href="/unified-chart.html"]):not([href="/module-registry.html"]):not([href="/content-admin.html"]):not([href="/specialty-care.html"]):not([href="/substance-care.html"]):not([href="/care-coordination.html"]):not([href="/scheduling.html"]):not([href="/pharmacy-ehr.html"]):not([href="/medpass.html"]):not([href="/sick-calls.html"]):not([href="/public-health.html"]):not([href="/compliance.html"]):not([href="/epcs.html"]):not([href="/forms.html"]):not([href="/documents.html"]):not([href="/reports.html"]):not([href="/protocols.html"]):not([href="/facility-stock.html"]):not([href="/users-admin.html"]):not([href="/help-training.html"]):not([href="/change-password.html"])::before{
  -webkit-mask-image:none; mask-image:none; background-color:currentColor; border-radius:50%; width:6px; height:6px; opacity:.6;
}

/* =====================================================================
   COMMAND DECK — shell restyle (Phase 53)
   The chosen visual direction: a dense, data-forward EMR shell modeled
   on real clinical command centers (Epic/Cerner lineage), built on
   VitalCore's real brand palette. Activated per-page by design-system.js
   setting data-shell="command-deck" on <html> once it confirms a real
   app-shell header is present, so standalone pages (signature-pad,
   webauthn-test) are untouched. Everything below is scoped under that
   attribute, so this is additive — the pre-existing light/grouped-nav
   shell remains the exact fallback if the attribute is ever absent.

   Leverage, same as the rest of this file: pages already read shared
   var() tokens and shared .card/.badge/table classes, so restyling the
   shell + these shared components re-skins every page's chrome at once;
   only each page's *local* component overrides need a later per-page
   pass, verified live.
   ===================================================================== */
:root[data-shell="command-deck"]{
  --cd-rail:#0a2a3d; --cd-rail-soft:#a9c4d4; --cd-paper:#eef2f6; --cd-panel:#ffffff;
  --cd-line:#dde4ea; --cd-ink:#1a2530; --cd-ink-soft:#5a6b7d; --cd-ink-faint:#5f7083;
  --cd-navy:#006a9e; --cd-teal:#1F6F53; --cd-brick:#A6192E; --cd-amber:#8A5F1F;
}
/* Real gap closed — Phase 13 of the phased recovery plan, per direct
   instruction: dark mode "only works for a few things, not the entire
   page in every module." Root cause confirmed directly, live, not
   guessed — every page's own .card/.line/.ink styling reads
   var(--cd-panel, var(--panel)), the Command Deck shell's own real
   token namespace with the shared token as fallback. That fallback
   only ever fires when the first variable is undefined — and
   --cd-panel/--cd-paper/--cd-line/--cd-ink* WERE always defined, just
   never redefined for dark mode, so the fallback silently never
   triggered and every real page's own main content stayed light
   regardless of theme. The rail itself (--cd-rail/--cd-rail-soft)
   is deliberately NOT overridden here — it's already dark navy by
   design in both real modes, matching the header's own real, existing
   intent from Phase 50. */
@media (prefers-color-scheme: dark){
  :root[data-shell="command-deck"]:not([data-theme="light"]){
    --cd-paper:#12151C; --cd-panel:#1B1F29; --cd-line:#2C3140;
    --cd-ink:#E4E6EB; --cd-ink-soft:#A8AEBC; --cd-ink-faint:#9AA1AF;
    --cd-navy:#3D9FDB; --cd-teal:#3FB98A; --cd-brick:#E8677E; --cd-amber:#E0B25C;
  }
}
:root[data-shell="command-deck"][data-theme="dark"]{
  --cd-paper:#12151C; --cd-panel:#1B1F29; --cd-line:#2C3140;
  --cd-ink:#E4E6EB; --cd-ink-soft:#A8AEBC; --cd-ink-faint:#9AA1AF;
  --cd-navy:#3D9FDB; --cd-teal:#3FB98A; --cd-brick:#E8677E; --cd-amber:#E0B25C;
}
:root[data-shell="command-deck"] body{background:var(--cd-paper); color:var(--cd-ink);}
:root[data-shell="command-deck"]{background:var(--cd-paper);}   /* html bg — short pages shouldn't reveal the base navy below the fold */
:root[data-shell="command-deck"] .brand-rule{display:none;}

/* --- Dark top rail (replaces the sticky light header) --- */
:root[data-shell="command-deck"] header{
  /* min-height, not height: a fixed height cannot contain a wrapped
     nav, and flex-wrap:wrap so the right-hand cluster can drop to its
     own row on a narrow screen rather than being squeezed off. */
  background:var(--cd-rail); color:#fff; min-height:52px; padding:6px 20px; gap:16px;
  box-shadow:none; border-bottom:1px solid #0f3852; flex-wrap:wrap; align-items:center;
}
:root[data-shell="command-deck"] header .brand{gap:9px;}
/* Real gap closed — this used to swap in a leftover VitalPrism logo
   asset for the dark rail; now points at the same real Corvanta mark
   the base .brand .mark rule uses, just with the rail's own shadow
   treatment. */
:root[data-shell="command-deck"] header .brand .mark{
  background:#fff url('/assets/corvanta-mark.svg') center/78% no-repeat;
  width:32px; height:32px; padding:0; border-radius:7px;
  display:inline-block; flex-shrink:0; box-shadow:0 1px 2px rgba(0,0,0,.25);
}
:root[data-shell="command-deck"] header .brand .name{font-size:15px; color:#fff;}
:root[data-shell="command-deck"] header .brand .org{display:none;}   /* facility moves into the rail-right pill */

/* --- Rail nav: horizontal tabs (built by design-system.js) --- */
/* HEADER OVERFLOW — fixed structurally rather than by shaving pixels
   off whichever control was added last. This has now recurred at least
   twice (a duplicated logout button, then the facility switcher), and
   the reason is the shape of the rule above: the command-deck header is
   `flex-wrap:nowrap`, so when its children exceed the window they do
   not wrap — they push the header wider than the viewport, which gives
   the whole PAGE a horizontal scrollbar. Scroll right to reach the
   controls and the header's own background stays behind, which is
   exactly what the report showed: a dark bar ending mid-screen with the
   facility switcher and logout sitting past it on bare page.

   The fix makes the header structurally incapable of causing that:
   - the nav is the only elastic region, and it shrinks and scrolls
     WITHIN itself instead of pushing;
   - the right-hand controls never shrink, because losing access to the
     facility switcher or logout is worse than losing a nav label;
   - nothing in the header may exceed the viewport width.
   Adding another control can now crowd the nav, but can no longer take
   the page's layout with it. */
:root[data-shell="command-deck"] header{max-width:100vw; min-width:0;}
/* NOT overflow:hidden. That was the first attempt at this and it broke
   the More menu and the settings panel: both are position:absolute
   children of the header, so clipping the header clipped them out of
   existence. Reported immediately, and worth recording — "stop the box
   overflowing" and "let popovers escape the box" pull in opposite
   directions, and the popovers must win.
   The nav's own overflow-x below is what actually absorbs the excess,
   so the header no longer needs to clip at all. */
:root[data-shell="command-deck"] header .brand{flex:0 0 auto;}
:root[data-shell="command-deck"] header .role-switch{flex:0 0 auto; flex-wrap:nowrap;}
:root[data-shell="command-deck"] .cd-nav{
  display:flex; gap:2px; align-items:center;
  /* NO overflow here. This is the third time this bar has eaten its own
     popovers, and the cause each time was a clipping ancestor:
       1. overflow:hidden on the header  -> More and settings vanished
       2. overflow-x:auto on THIS element -> More vanished again
     A scroll container clips absolutely positioned descendants, and the
     More panel is exactly that. Removing the header clip was only half
     the fix; this was still clipping one layer down.

     Scrolling is no longer needed anyway: priority-plus now moves tabs
     that do not fit INTO the More menu (vpApplyNavOverflow), so nothing
     has to scroll out of sight. `min-width:0` is what lets this flex
     item shrink below its content so the spill logic gets a chance to
     run. If that logic ever fails, the header's max-width:100vw still
     stops the page going wide. */
  /* WRAPS. Per direct request — "can this be more than a single row, I
     think things are getting lost".
     It was flex-wrap:nowrap on a fixed 52px header, so anything that
     did not fit had to go somewhere: first off the edge, then into
     More. Both lose things, and the screenshot that prompted this
     showed the worst case — More itself had been pushed off, taking
     every spilled tab with it and leaving no route back.
     Wrapping means nothing has to be hidden to make room. The bar grows
     a row instead, which costs a little vertical space and loses
     nothing. */
  flex:1 1 auto; min-width:0; flex-wrap:wrap; row-gap:4px;
}
:root[data-shell="command-deck"] .cd-nav > *{flex-shrink:0;}
/* Tabs that did not fit on the bar and moved into the More menu. They
   were styled as horizontal nav tabs; inside a vertical panel they need
   to read as menu rows. Without this they inherit the bar's dark-rail
   colours and become invisible on the panel's light background — which
   would have swapped one undiscoverable state for another. */
:root[data-shell="command-deck"] .cd-nav-spill{border-bottom:1px solid var(--cd-line); margin-bottom:4px; padding-bottom:4px;}
:root[data-shell="command-deck"] .cd-nav-spill a.cd-spilled{
  display:flex; align-items:center; gap:9px; width:100%;
  color:var(--cd-ink); background:none; font-size:13px;
  padding:7px 10px; border-radius:6px; text-decoration:none; white-space:nowrap;
}
:root[data-shell="command-deck"] .cd-nav-spill a.cd-spilled:hover{background:var(--cd-paper,#eef2f5);}
/* A dot on "More" when it is holding tabs that would normally be on the
   bar, so the user has a reason to open it. */
:root[data-shell="command-deck"] .cd-nav-more.cd-has-spill .cd-nav-more-btn::after{
  content:""; display:inline-block; width:5px; height:5px; border-radius:50%;
  background:var(--cd-accent,#4da3d8); margin-left:5px; vertical-align:middle;
}
/* The search box is the widest freely-sizable control in the bar, so it
   gives up space first rather than forcing the issue. */
:root[data-shell="command-deck"] header input[type="search"],
:root[data-shell="command-deck"] header .cd-search{min-width:0; flex:0 1 auto;}
/* Below this width the bar cannot hold everything even with the nav
   scrolling, so items yield in order of what you can least afford to
   lose. The clock goes first, then the search box (the same search is
   reachable from the "/" shortcut and from within pages), then the
   brand wordmark. The facility switcher, the role and the logout
   control are never hidden — those are the ones the original report
   was about. */
@media (max-width: 1100px){
  :root[data-shell="command-deck"] header .cd-clock{display:none;}
}
@media (max-width: 950px){
  :root[data-shell="command-deck"] header input[type="search"],
  :root[data-shell="command-deck"] header .cd-search{display:none;}
}
@media (max-width: 820px){
  :root[data-shell="command-deck"] header .brand .name{display:none;}
}
:root[data-shell="command-deck"] .cd-nav a{
  color:var(--cd-rail-soft); font-size:13px; font-weight:500; padding:7px 13px; border-radius:7px;
  text-decoration:none; white-space:nowrap;
  display:inline-flex; align-items:center; gap:7px;
}
:root[data-shell="command-deck"] .cd-nav a:hover{background:rgba(255,255,255,.10); color:#fff;}
:root[data-shell="command-deck"] .cd-nav a.cd-on{background:rgba(255,255,255,.14); color:#fff;}
:root[data-shell="command-deck"] .cd-nav .cd-icon{flex-shrink:0;}
:root[data-shell="command-deck"] .cd-nav-more{position:relative;}
:root[data-shell="command-deck"] .cd-nav-more-btn{
  background:transparent; border:none; color:var(--cd-rail-soft); font:inherit; font-size:13px; font-weight:500;
  padding:7px 13px; border-radius:7px; cursor:pointer; display:inline-flex; align-items:center; gap:5px;
}
:root[data-shell="command-deck"] .cd-nav-more-btn:hover{background:rgba(255,255,255,.10); color:#fff;}
:root[data-shell="command-deck"] .cd-nav-more-panel{
  /* Anchored to the RIGHT edge of its button, not the left.
     The More button sits at the end of the nav, so left:0 pushed a
     230px panel off the right edge of the viewport — the categories
     were rendered but unreadable and partly unclickable, which is
     indistinguishable from an incomplete menu. */
  display:none; position:absolute; top:calc(100% + 6px); right:0; left:auto;
  max-width:calc(100vw - 24px); min-width:230px; background:var(--cd-panel);
  border:1px solid var(--cd-line); border-radius:8px; box-shadow:0 8px 24px rgba(10,42,61,.18); padding:6px; z-index:30;
  /* Real gap closed — confirmed directly: with 6 categories and 25+
     links, this panel had no max-height and no overflow rule at all,
     so on a short viewport it silently extended past the visible
     page with no scrollbar and no indication anything was cut off —
     exactly the "I can't tell if I'm missing options" report. A real
     cap plus a real, visibly-styled scrollbar (not relying on the
     browser's own default, which auto-hides on macOS until actively
     scrolling) makes the panel always fully reachable and always
     visibly show there's more below, rather than a fragile scroll-
     position-tracking gradient trick that's easy to get subtly wrong. */
  max-height:min(70vh, 520px); overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:var(--cd-ink-faint) var(--cd-panel);
}
:root[data-shell="command-deck"] .cd-nav-more-panel::-webkit-scrollbar{width:8px;}
:root[data-shell="command-deck"] .cd-nav-more-panel::-webkit-scrollbar-thumb{background:var(--cd-ink-faint); border-radius:4px;}
:root[data-shell="command-deck"] .cd-nav-more-panel::-webkit-scrollbar-track{background:var(--cd-panel);}
:root[data-shell="command-deck"] .cd-nav-more-panel.cd-open{display:block;}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-grp-btn{
  display:flex; align-items:center; justify-content:space-between; width:100%; background:transparent; border:none;
  font-size:10px; text-transform:uppercase; letter-spacing:.06em; color:var(--cd-ink-faint); font-weight:700;
  padding:8px 10px; cursor:pointer; border-radius:6px; font-family:inherit;
}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-grp-btn:hover{background:var(--cd-paper); color:var(--cd-navy);}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-grp-btn .vp-caret{transition:transform var(--ease,.15s); font-size:9px;}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-grp-btn.cd-grp-open .vp-caret{transform:rotate(180deg);}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-grp-links{display:none;}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-grp-links.cd-grp-open{display:block;}
:root[data-shell="command-deck"] .cd-nav-more-panel a{display:flex; align-items:center; gap:9px; color:var(--cd-ink); font-size:13px; padding:7px 10px; border-radius:6px; text-decoration:none;}
:root[data-shell="command-deck"] .cd-nav-more-panel a:hover{background:var(--cd-paper); color:var(--cd-navy);}
:root[data-shell="command-deck"] .cd-nav-more-panel a.cd-on{color:var(--cd-navy); font-weight:600;}
:root[data-shell="command-deck"] .cd-nav-more-panel .cd-icon{flex-shrink:0; color:var(--cd-ink-faint);}
:root[data-shell="command-deck"] .cd-nav-more-panel a:hover .cd-icon, :root[data-shell="command-deck"] .cd-nav-more-panel a.cd-on .cd-icon{color:var(--cd-navy);}
:root[data-shell="command-deck"] .cd-nav-more-hint{
  display:none; position:sticky; bottom:-6px; margin:4px -6px -6px; padding:5px 0;
  text-align:center; font-size:10.5px; font-weight:700; letter-spacing:.03em; color:var(--cd-ink-faint);
  background:linear-gradient(rgba(255,255,255,0), var(--cd-panel) 40%);
  pointer-events:none;
}

/* --- Rail right cluster: facility pill, clock, user, controls --- */
:root[data-shell="command-deck"] header .role-switch{margin-left:auto; gap:14px; color:var(--cd-rail-soft); flex-wrap:nowrap;}
:root[data-shell="command-deck"] header .role-switch label{display:none;}   /* "Viewing as" label hidden; select stands alone */
:root[data-shell="command-deck"] header .role-switch select{
  background:rgba(255,255,255,.10); color:#fff; border:1px solid rgba(255,255,255,.18); font-size:12px; padding:6px 10px; border-radius:7px;
}
:root[data-shell="command-deck"] .cd-clock{font-family:var(--mono); font-size:12px; color:var(--cd-rail-soft);}
:root[data-shell="command-deck"] .cd-fac{background:rgba(255,255,255,.10); color:#fff; padding:6px 12px; border-radius:7px; font-size:12px; font-weight:600; white-space:nowrap;}
:root[data-shell="command-deck"] .cd-whoami{color:#fff; padding:6px 4px; font-size:12.5px; font-weight:600; white-space:nowrap;}
:root[data-shell="command-deck"] .vp-theme-toggle, :root[data-shell="command-deck"] .vp-logout-btn{width:30px; height:30px; border-color:rgba(255,255,255,.30);}

/* --- Subbar: breadcrumb + inline stat strip (built per page) --- */
:root[data-shell="command-deck"] .cd-subbar{
  background:var(--cd-panel); border-bottom:1px solid var(--cd-line); height:44px; display:flex; align-items:center;
  padding:0 20px; gap:18px; position:sticky; top:0; z-index:4;
}
:root[data-shell="command-deck"] .cd-crumb{font-size:12px; color:var(--cd-ink-faint);}
:root[data-shell="command-deck"] .cd-crumb b{color:var(--cd-ink);}
:root[data-shell="command-deck"] .cd-substat{margin-left:auto; display:flex; gap:22px;}
:root[data-shell="command-deck"] .cd-substat span{font-size:12px; color:var(--cd-ink-soft);}
:root[data-shell="command-deck"] .cd-substat b{font-size:13px; color:var(--cd-ink); font-weight:700;}
:root[data-shell="command-deck"] .cd-substat b.crit{color:var(--cd-brick);}
:root[data-shell="command-deck"] .cd-substat b.ok{color:var(--cd-teal);}

/* --- Main content area: denser, wider, no fade-in offset --- */
:root[data-shell="command-deck"] main{padding:16px 20px 48px;}

/* --- Shared Command Deck components pages can use directly --- */
/* Ring gauge (conic-gradient); a page sets --cd-pct inline. */
:root[data-shell="command-deck"] .cd-ring{
  width:78px; height:78px; border-radius:50%; flex-shrink:0;
  background:conic-gradient(var(--cd-teal) 0% calc(var(--cd-pct,0)*1%), var(--cd-line) calc(var(--cd-pct,0)*1%) 100%);
  display:flex; align-items:center; justify-content:center;
}
:root[data-shell="command-deck"] .cd-ring .in{width:58px; height:58px; background:var(--cd-panel); border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center;}
:root[data-shell="command-deck"] .cd-ring .in b{font-size:16px;}
:root[data-shell="command-deck"] .cd-ring .in span{font-size:9px; color:var(--cd-ink-faint); text-transform:uppercase; letter-spacing:.04em;}
/* Metric row */
:root[data-shell="command-deck"] .cd-metric-row{display:flex; gap:10px;}
:root[data-shell="command-deck"] .cd-metric{flex:1;}
:root[data-shell="command-deck"] .cd-metric .v{font-size:26px; font-weight:700; letter-spacing:-.01em; line-height:1.1;}
:root[data-shell="command-deck"] .cd-metric .l{font-size:11px; color:var(--cd-ink-soft); margin-top:2px;}
:root[data-shell="command-deck"] .cd-metric .d{font-size:10.5px; font-weight:600; margin-top:3px;}
:root[data-shell="command-deck"] .cd-metric .d.up{color:var(--cd-teal);} :root[data-shell="command-deck"] .cd-metric .d.dn{color:var(--cd-brick);} :root[data-shell="command-deck"] .cd-metric .d.z{color:var(--cd-ink-faint);}

/* --- Shared tab styling: many pages use .tabs/.tab-btn. Restyle them
   once here to the Command Deck pill-tab look so every tabbed page
   converts consistently, rather than per-page. Scoped under the shell
   and !important-free — pages that set their own later win only if they
   redefine these exact selectors, which the body pass removes. --- */
:root[data-shell="command-deck"] .tabs{display:flex; gap:6px; margin-bottom:14px; border-bottom:none;}
:root[data-shell="command-deck"] .tab-btn, :root[data-shell="command-deck"] .tab{
  font-family:var(--sans); font-size:12.5px; font-weight:700; padding:8px 15px; border:1px solid var(--cd-line);
  background:var(--cd-panel); color:var(--cd-ink-soft); cursor:pointer; border-radius:8px; margin-bottom:0;
}
:root[data-shell="command-deck"] .tab-btn.active, :root[data-shell="command-deck"] .tab.active{background:var(--cd-navy); color:#fff; border-color:var(--cd-navy);}

/* --- Patient banner (patient-banner.js) — persistent identity strip shown
   at the top of every patient-scoped page (chart, MAR, vitals, sick calls,
   forms, documents, scheduling, specialty/substance care, care coordination,
   pharmacy & EHR, public health). Uses the same --cd-x-with-fallback pattern
   as the rest of this file so it looks right whether or not the Command
   Deck shell is active. */
.patient-banner{
  display:flex; align-items:center; gap:16px; padding:12px 20px; margin:0 20px 16px;
  background:var(--cd-panel,var(--panel)); border:1px solid var(--cd-line,var(--line)); border-radius:8px;
  box-shadow:var(--shadow-sm); cursor:pointer; transition:border-color var(--ease), box-shadow var(--ease);
}
.patient-banner:hover, .patient-banner:focus-visible{border-color:var(--cd-navy,var(--navy)); box-shadow:var(--shadow-md);}
.patient-banner.pb-loading{opacity:.55;}
.pb-photo{
  width:56px; height:56px; border-radius:8px; overflow:hidden; flex-shrink:0;
  background:var(--cd-line,var(--line)); display:flex; align-items:center; justify-content:center;
}
.pb-photo img{width:100%; height:100%; object-fit:cover; display:block;}
.pb-photo-placeholder{font-family:var(--mono); font-weight:700; font-size:16px; color:var(--cd-ink-faint,var(--ink-faint));}
.pb-id{min-width:150px;}
.pb-name{font-weight:700; font-size:15px; color:var(--cd-ink,var(--ink));}
.pb-sub{font-family:var(--mono); font-size:11.5px; color:var(--cd-ink-soft,var(--ink-soft)); margin-top:2px;}
.pb-housing, .pb-intake, .pb-allergies{border-left:1px solid var(--cd-line,var(--line)); padding-left:16px;}
.pb-label{font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--cd-ink-faint,var(--ink-faint)); font-weight:600; margin-bottom:3px;}
.pb-value{font-size:13px; color:var(--cd-ink,var(--ink));}
.pb-allergies{flex:1; min-width:0;}
.pb-allergies .pb-value{display:flex; flex-wrap:wrap; gap:5px;}
.pb-allergy-chip{
  font-family:var(--mono); font-size:11px; font-weight:600; padding:2px 8px; border-radius:99px;
  background:var(--cd-brick-soft,var(--brick-soft)); color:var(--cd-brick,var(--brick)); white-space:nowrap;
}
.pb-allergy-chip.pb-nka{background:var(--cd-teal-soft,var(--teal-soft)); color:var(--cd-teal,var(--teal));}
.pb-restriction-flag{
  font-family:var(--mono); font-size:11px; font-weight:600; padding:4px 10px; border-radius:99px;
  background:var(--cd-amber-soft,var(--amber-soft)); color:var(--cd-amber,var(--amber)); white-space:nowrap; flex-shrink:0;
}
.pb-detainer-flag{
  font-family:var(--mono); font-size:11px; font-weight:600; padding:4px 10px; border-radius:99px;
  background:var(--cd-brick-soft,var(--brick-soft)); color:var(--cd-brick,var(--brick)); white-space:nowrap; flex-shrink:0;
}
.pb-safety-flag{
  font-family:var(--mono); font-size:11px; font-weight:700; padding:4px 10px; border-radius:99px;
  background:var(--cd-brick,var(--brick)); color:#fff; white-space:nowrap; flex-shrink:0;
  border:1px solid var(--cd-brick,var(--brick));
}
.pb-error{padding:12px 20px; margin:0 20px 16px; border-radius:8px; background:var(--cd-brick-soft,var(--brick-soft)); color:var(--cd-brick,var(--brick)); font-size:13px;}
@media (max-width: 760px){
  .patient-banner{flex-wrap:wrap;}
  .pb-housing, .pb-intake, .pb-allergies{border-left:none; padding-left:0;}
}

/* --- Patient picker (patient-picker.js) — search box that precedes a
   patient <select>, replacing the old "fetch every patient" default. */
.patient-picker-search{
  font-family:var(--sans); font-size:13px; padding:6px 10px; border-radius:5px;
  border:1px solid var(--cd-line,var(--line)); background:var(--cd-panel,var(--panel));
  color:var(--cd-ink,var(--ink)); width:220px; max-width:100%;
}
.patient-picker-search:focus{outline:2px solid var(--focus); outline-offset:1px;}
.patient-picker-status{font-size:11.5px; color:var(--cd-ink-faint,var(--ink-faint)); margin-left:8px;}

/* ============================================================
   SMALL SCREENS AND TOUCH
   Added once it was confirmed this runs on Chromebook, Windows,
   Apple and Android, across phone / tablet / laptop / desktop — so
   any screen size on the market.

   Two real gaps this closes, both found by checking rather than
   assuming:
   1. The smallest breakpoint anywhere was 720px. Phones are 360-430.
      Everything below 720 was simply untested territory.
   2. There was NO touch-target sizing in the design system at all.
      Controls were sized for a mouse pointer, which on a phone means
      a 24px chip you cannot reliably hit.
   ============================================================ */

/* Touch targets. Applied by INPUT TYPE rather than screen width — a
   touchscreen laptop is a real thing, and a wide screen does not mean
   a mouse. 44px is the figure both Apple and WCAG 2.5.5 land on. */
@media (pointer: coarse){
  button, .chip, select,
  input:not([type=checkbox]):not([type=radio]),
  .cd-nav a, .cd-nav-more-btn, .req, a.cd-spilled{
    min-height:44px;
  }
  button, .chip, .req{padding-top:10px; padding-bottom:10px;}
  /* Checkboxes and radios cannot simply grow without wrecking layout,
     so the tappable area is extended around them instead. */
  input[type=checkbox], input[type=radio]{
    min-width:22px; min-height:22px;
  }
  label{padding:4px 0;}
  /* Hover states never fire on touch, so anything that ONLY revealed
     itself on hover has to be visible by default. */
  table.roster tbody tr:hover{background:inherit;}
}

/* Tablet and below. */
@media (max-width: 680px){
  main{padding-left:12px; padding-right:12px;}
  .cd-subbar{flex-wrap:wrap; gap:6px;}
  .cd-substat{flex-wrap:wrap; gap:10px; font-size:12px;}
  .page-title{font-size:20px;}
  .page-sub{font-size:13px;}
  /* The patient banner stacks rather than scrolling sideways. */
  .patient-banner{flex-wrap:wrap; gap:8px;}
}

/* Phone. The header keeps only what a clinician cannot work without:
   brand mark, the nav (which spills the rest into More), the facility
   and post selectors, and logout. */
@media (max-width: 480px){
  :root[data-shell="command-deck"] header{padding:0 10px; gap:8px;}
  :root[data-shell="command-deck"] header .brand .name,
  :root[data-shell="command-deck"] header .brand .org{display:none;}
  :root[data-shell="command-deck"] header .role-switch label{display:none;}
  :root[data-shell="command-deck"] .cd-clock{display:none;}
  main{padding-left:10px; padding-right:10px;}
  .card, .panel{padding:12px;}
  /* Anything that would otherwise force a horizontal scrollbar on the
     whole page scrolls inside itself instead. */
  table{display:block; overflow-x:auto; -webkit-overflow-scrolling:touch;}
}

/* Mobile browser chrome makes 100vh taller than the visible area, so a
   height built from it puts content under the address bar. dvh tracks
   the real viewport where supported, with vh kept as the fallback. */
@supports (height: 100dvh){
  .roster-wrap{max-height:calc(100dvh - 260px);}
}

/* Global guard against page-level horizontal scroll on phones.
   A sweep found 16 elements at min-width:320px and more at 280px — on
   a 360px handset with page padding, any one of those forces the whole
   page sideways, and the fix has to be systemic because they are
   spread across dozens of pages written at different times.
   Capping min-width lets a control shrink instead of pushing.
   Scoped to the breakpoint so nothing changes on a laptop. */
@media (max-width: 480px){
  input, select, textarea, .card, .panel, .field-group, .item-row{
    min-width:0 !important;
    max-width:100%;
  }
  /* Deliberately NOT overflow-x:hidden on body: that would silently
     swallow the symptom, leaving content genuinely unreachable off the
     edge with no scrollbar to find it — the same mistake as hiding the
     nav's scrollbar. Let it scroll if something still overflows, so the
     problem stays visible and reachable. */
}

/* ============================================================
   HEADER: two explicit rows, left aligned.
   Per direct request — "the rows should be flipped and everything
   should be left justified".

   Previously one wrapping row, so which items landed on the second row
   depended on window width: the split moved as you resized, and the
   nav could end up above or below the identity controls. Making the
   rows explicit means the layout is the same everywhere.

   Row 1 is identity and context — who you are, where you are, what
   post you are working. Row 2 is navigation. That order puts the
   things you set once at the top and the things you click constantly
   directly above the page content they lead to.

   Left aligned throughout: `justify-content:space-between` pushed the
   identity cluster to the far right, which on a wide monitor left a
   long empty gap and put related controls at opposite ends of the
   screen.
   ============================================================ */
:root[data-shell="command-deck"] header{
  justify-content:flex-start;
  align-items:center;
  row-gap:6px;
}
:root[data-shell="command-deck"] header .brand{order:1; margin-right:8px;}
:root[data-shell="command-deck"] header .role-switch{
  order:2; margin-left:0; flex-wrap:wrap;
}
/* flex-basis:100% is what forces the nav onto its own row regardless of
   width, rather than leaving the break to wrapping chance. */
:root[data-shell="command-deck"] .cd-nav{
  order:3; flex-basis:100%; justify-content:flex-start;
  padding-top:2px;
}

/* Drag to reorder. Per direct request: "I want staff to be able to grab
   something and drag to a different sort order."
   The dragged item gets an obvious lifted state and the drop target a
   clear edge, because a drag with no feedback feels broken even when it
   works. */
:root[data-shell="command-deck"] .cd-nav a[draggable="true"]{cursor:grab;}
:root[data-shell="command-deck"] .cd-nav a.cd-dragging{opacity:.4; cursor:grabbing;}
:root[data-shell="command-deck"] .cd-nav a.cd-drop-before{box-shadow:inset 3px 0 0 var(--cd-accent,#4da3d8);}
:root[data-shell="command-deck"] .cd-nav a.cd-drop-after{box-shadow:inset -3px 0 0 var(--cd-accent,#4da3d8);}
@media (pointer: coarse){
  /* Drag is a poor primary interaction on touch, so the customise
     panel's checkboxes remain the route there rather than making
     reordering touch-only-impossible. */
  :root[data-shell="command-deck"] .cd-nav a[draggable="true"]{cursor:pointer;}
}
