/* ============================================================================
   Hera — Daybreak v3
   ----------------------------------------------------------------------------
   Pine and honey, taken from a working-grade UI to a product-grade one.

   What changed from v2, and why:

   1. NAV ICONS ARE NOW UNCONDITIONALLY VISIBLE. Cause: Chrome for Android's
      "auto dark theme" pass was inverting pale icon strokes into the pine rail.
      Active items survived because they carry their own background. Three parts
      to the fix, and all three are needed:
        (a) `color-scheme` is declared here on :root, and on [data-theme] below;
        (b) app.js sets the theme attribute on <html>, NOT <body> — color-scheme
            only governs the browser's own treatment of the page from the root
            element, so on <body> it was declared too late to take effect;
        (c) nav icons set stroke/fill in CSS rather than relying solely on the
            SVG attributes, and pin opacity, so nothing about an icon depends on
            a single inherited value.
   2. Density. Care staff scan long lists on a phone, at arm's length, in a
      corridor. Vertical rhythm is tighter and rows are shorter, so more of a
      medication round fits on one screen without losing tap comfort.
   3. Status is structural, not decorative. Row cards grow a coloured spine
      derived from the pill they already contain (via :has()), so state is legible
      in peripheral vision before any text is read.
   4. Elevation is crisper. Wide soft blurs read consumer; hairline borders with a
      tight shadow read clinical, which is what a regulated record system should
      look like.
   5. Numerals are tabular wherever they represent data, so times, doses and
      counts align down a column.

   Bricolage Grotesque (display) · Schibsted Grotesk (body) · Sono (data).
   The honey notch remains the single wayfinding mark for "you are here".
   ========================================================================== */

:root {
  /* Declaring color-scheme stops the browser inventing its own dark treatment
     over ours. Nocturne is our night mode; the UA must not add a second one.
     This only works because the theme attribute is set on <html> (see app.js
     applyTheme) — color-scheme is honoured from the root element, not <body>. */
  color-scheme: light;

  --bg:#F1F1E7; --surface:#FFFEFB; --surface-2:#F7F6EE; --sunken:#EAE9DE;
  --line:#E1E0D2; --line-soft:#EDECE0;
  --ink:#122E27; --ink-soft:#4D5F58; --ink-faint:#78877F;

  --rail:#0F2A24; --rail-ink:#DCE9E0; --rail-ink-dim:#93AA9E;
  --rail-active:#1E4A3F; --rail-line:#1C3F36; --rail-hover:#183B32;

  --sky:linear-gradient(118deg,#FCF7E9 0%,#F4F0DE 46%,#E8EEE4 100%);
  --arc-base:#D9D8C6; --sun:#E9A93C;

  --accent:#DFA032; --accent-deep:#A9721A; --accent-soft:#F9EED6; --accent-ink:#1E1608;
  --given:#3F7A57; --given-soft:#E2EEE4;
  --due:#A6710F; --due-soft:#F9EED6;
  --alert:#A8463C; --alert-soft:#F7E4E0;
  --info:#2F5D77; --info-soft:#E2EDF3;

  /* Tight, layered elevation. Depth comes from the hairline, not the blur. */
  --shadow:0 1px 2px rgba(18,46,39,.05);
  --shadow-raise:0 2px 4px rgba(18,46,39,.06), 0 6px 14px -8px rgba(18,46,39,.14);
  --shadow-lift:0 18px 44px -14px rgba(18,46,39,.34), 0 2px 8px rgba(18,46,39,.08);

  --r-card:14px; --r-chip:10px; --r-pill:999px;

  --display:'Bricolage Grotesque',sans-serif;
  --body:'Schibsted Grotesk',system-ui,-apple-system,sans-serif;
  --data:'Sono',ui-monospace,monospace;

  --tabbar-h:66px;
  --tap:46px;               /* minimum comfortable touch target */
  --ease:cubic-bezier(.32,.72,.35,1);

  /* legacy aliases — older markup and inline styles still reference these */
  --sage:var(--given); --amber:var(--due); --clay:var(--alert);
  --clay-bg:var(--alert-soft); --parchment:var(--surface-2);
}

[data-theme="nocturne"] {
  color-scheme: dark;

  --bg:#0B1512; --surface:#111E18; --surface-2:#16261E; --sunken:#0E1A16;
  --line:#233830; --line-soft:#1B2C24;
  --ink:#ECF3ED; --ink-soft:#A3B8AC; --ink-faint:#74897E;

  --rail:#071110; --rail-ink:#C2D6C9; --rail-ink-dim:#667C71;
  --rail-active:#1C3830; --rail-line:#14241E; --rail-hover:#152A23;

  --sky:linear-gradient(118deg,#0D1A16 0%,#111E18 58%,#16261E 100%);
  --arc-base:#26392F; --sun:#F0C878;

  --accent:#F0C878; --accent-deep:#E0B25C; --accent-soft:#2A2416; --accent-ink:#141008;
  --given:#8FD0A5; --given-soft:#173428;
  --due:#F0BE6B; --due-soft:#332C18;
  --alert:#EB958A; --alert-soft:#3A2320;
  --info:#8FBBD6; --info-soft:#1B2E3A;

  --shadow:0 1px 2px rgba(0,0,0,.4);
  --shadow-raise:0 2px 6px rgba(0,0,0,.45);
  --shadow-lift:0 20px 50px -14px rgba(0,0,0,.7), 0 2px 10px rgba(0,0,0,.5);
}

/* ============================================================================
   BASE
   ========================================================================== */
*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
html { -webkit-text-size-adjust:100%; }
body {
  font-family:var(--body); background:var(--bg); color:var(--ink);
  font-size:14px; line-height:1.45; -webkit-font-smoothing:antialiased;
  transition:background .3s var(--ease), color .3s var(--ease);
}
h1, h2, h3, .display {
  font-family:var(--display); font-weight:700; line-height:1.15; letter-spacing:-.018em;
}
h1 { font-size:23px; } h2 { font-size:18px; } h3 { font-size:15px; }
.mono { font-family:var(--data); font-variant-numeric:tabular-nums; letter-spacing:-.01em; }

button { font-family:inherit; cursor:pointer; border:none; border-radius:var(--r-chip);
  font-size:13px; background:none; color:inherit; line-height:1.3; }

input, select, textarea {
  font-family:inherit; font-size:16px;   /* 16px stops iOS zooming the page on focus */
  border:1px solid var(--line); border-radius:10px; padding:11px 12px; width:100%;
  background:var(--surface); color:var(--ink); line-height:1.35;
  transition:border-color .14s ease, box-shadow .14s ease;
}
input::placeholder, textarea::placeholder { color:var(--ink-faint); }
input:hover, select:hover, textarea:hover { border-color:var(--ink-faint); }
input:focus, select:focus, textarea:focus {
  outline:none; border-color:var(--accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
}
@media (min-width:761px){ input, select, textarea { font-size:13.5px; padding:9px 11px; } }
select { appearance:none; padding-right:32px; cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,var(--ink-soft) 50%),
                   linear-gradient(135deg,var(--ink-soft) 50%,transparent 50%);
  background-position:calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size:5px 5px, 5px 5px; background-repeat:no-repeat; }

label { display:block; font-size:10.5px; font-weight:600; color:var(--ink-soft);
  margin:12px 0 5px; letter-spacing:.07em; text-transform:uppercase; }
label.plain { text-transform:none; letter-spacing:0; font-size:13px; font-weight:500; color:var(--ink); }

::selection { background:var(--accent-soft); color:var(--ink); }
a { color:inherit; }
:focus-visible { outline:2.5px solid var(--accent); outline-offset:2px; border-radius:4px; }

/* ============================================================================
   APP FRAME — topbar (mobile) · rail (desktop) · stage · tabbar (mobile)
   ========================================================================== */
.layout { display:flex; min-height:100vh; min-height:100dvh; }

/* ---------- topbar: mobile only ---------- */
.topbar { display:none; }
@media (max-width:860px){
  .topbar { position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:9px;
    height:54px; padding:0 12px; background:var(--rail); color:var(--rail-ink);
    padding-left:max(12px, env(safe-area-inset-left));
    padding-right:max(12px, env(safe-area-inset-right));
    box-shadow:0 1px 0 var(--rail-line); }
  .topbar .brand-mark { width:29px; height:29px; border-radius:9px; font-size:15px; }
  .topbar-name { font-family:var(--display); font-weight:700; font-size:15px;
    color:#fff; letter-spacing:-.005em; }
  .topbar-spacer { flex:1; }
  .topbar .icon-btn { color:var(--rail-ink); width:40px; height:40px; }
  .topbar .icon-btn:hover, .topbar .icon-btn:active { color:#fff; background:var(--rail-hover); }
  .topbar .who-chip { width:32px; height:32px; font-size:11px; }
}

/* ---------- rail: desktop only ---------- */
.rail { width:88px; flex-shrink:0; background:var(--rail); display:flex; flex-direction:column;
  align-items:center; padding:15px 0 13px; position:sticky; top:0;
  height:100vh; height:100dvh; transition:background .3s var(--ease); }
.brand { margin-bottom:13px; }
.brand-mark { width:38px; height:38px; border-radius:12px; background:var(--sun); color:#0F2A24;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--display); font-weight:800; font-size:19px; }

.rail-nav { display:flex; flex-direction:column; gap:1px; flex:1; min-height:0;
  overflow-y:auto; width:100%; align-items:center; padding:2px 0; scrollbar-width:none;
  -webkit-mask-image:linear-gradient(to bottom, transparent, #000 12px, #000 calc(100% - 12px), transparent);
          mask-image:linear-gradient(to bottom, transparent, #000 12px, #000 calc(100% - 12px), transparent); }
.rail-nav::-webkit-scrollbar { display:none; }

.rail-item { position:relative; width:74px; min-height:56px; padding:8px 2px 7px;
  border-radius:13px; color:var(--rail-ink); text-decoration:none;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px;
  font-size:10px; font-weight:500; letter-spacing:.015em; text-align:center;
  transition:background .14s ease, color .14s ease; }

/* ---- THE NAV ICON FIX ----
   Stroke and fill are set here rather than left to the SVG's own attributes, and
   opacity is pinned. Combined with color-scheme above, an inactive icon has no
   remaining way to render invisibly. */
.rail-item svg, .tab-item svg, .sheet-item svg, .sheet-row svg {
  fill:none; stroke:currentColor; stroke-width:1.8; opacity:1;
  stroke-linecap:round; stroke-linejoin:round; }
.rail-item svg { width:22px; height:22px; display:block; flex-shrink:0; }
.rail-item span { display:block; max-width:100%; overflow:hidden;
  text-overflow:ellipsis; white-space:nowrap; }

.rail-item:hover { background:var(--rail-hover); color:#fff; }
.rail-item.active { background:var(--rail-active); color:#fff; font-weight:600; }
.rail-item.active svg { stroke-width:2.1; }
.rail-item.active::before { content:""; position:absolute; left:-7px; top:50%;
  transform:translateY(-50%); width:3.5px; height:24px; border-radius:0 4px 4px 0;
  background:var(--sun); }                            /* honey notch */

.rail-foot { display:flex; flex-direction:column; align-items:center; gap:8px; padding-top:11px;
  border-top:1px solid var(--rail-line); width:74px; }
.icon-btn { width:38px; height:38px; border-radius:50%; background:transparent;
  color:var(--rail-ink); display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:background .14s ease, color .14s ease; }
.icon-btn svg { width:19px; height:19px; fill:none; stroke:currentColor;
  stroke-width:1.8; opacity:1; }
.icon-btn:hover { background:var(--rail-hover); color:#fff; }
.who-chip { width:34px; height:34px; border-radius:50%; background:var(--rail-active); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700;
  flex-shrink:0; letter-spacing:.02em; }
.linkbtn { background:none; color:var(--rail-ink-dim); padding:4px 2px; font-size:10px;
  text-decoration:underline; text-underline-offset:2px; }
.linkbtn:hover { color:#fff; }

/* ---------- home switcher ---------- */
.rail-home { width:74px; margin:0 0 9px; padding:6px 4px; border-radius:10px;
  background:var(--rail-active); color:#fff; font-size:10px; font-weight:700;
  letter-spacing:.05em; display:flex; align-items:center; justify-content:center; gap:3px;
  transition:background .14s ease, color .14s ease; }
.rail-home svg { width:11px; height:11px; fill:none; stroke:currentColor; stroke-width:2.2; }
.rail-home:hover { background:var(--sun); color:#0F2A24; }
.topbar-name.home-switch { display:inline-flex; align-items:center; gap:5px; background:none;
  color:#fff; font-family:var(--display); font-weight:700; font-size:15px; padding:4px 2px; }
.topbar-name.home-switch svg { width:13px; height:13px; opacity:.75; fill:none;
  stroke:currentColor; stroke-width:2.2; }

/* ---------- stage ---------- */
.stage { flex:1; min-width:0; padding:26px 32px 64px; }
.stage > * { max-width:1180px; }
@media (max-width:860px){
  .layout { flex-direction:column; }
  .rail { display:none; }
  .stage { padding:14px 13px calc(var(--tabbar-h) + 34px);
    padding-left:max(13px, env(safe-area-inset-left));
    padding-right:max(13px, env(safe-area-inset-right)); }
}

/* ---------- tabbar: mobile only ---------- */
.tabbar { display:none; }
@media (max-width:860px){
  .tabbar { position:fixed; left:9px; right:9px; bottom:max(9px, env(safe-area-inset-bottom));
    z-index:40; display:flex; align-items:stretch; justify-content:space-around; gap:2px;
    height:var(--tabbar-h); padding:6px; border-radius:21px; background:var(--rail);
    box-shadow:0 12px 30px -6px rgba(7,17,14,.5), 0 0 0 1px rgba(255,255,255,.05); }
  .tab-item { position:relative; flex:1; display:flex; flex-direction:column; align-items:center;
    justify-content:center; gap:3px; border-radius:15px; color:var(--rail-ink);
    font-size:9.5px; font-weight:600; letter-spacing:.015em; min-width:0; padding:4px 2px;
    text-decoration:none; transition:background .14s ease, color .14s ease; }
  .tab-item svg { width:22px; height:22px; flex-shrink:0; }
  .tab-item span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .tab-item:active { background:var(--rail-hover); }
  .tab-item.active { background:var(--accent); color:var(--accent-ink); font-weight:700; }
  .tab-item.active svg { stroke-width:2.2; }
  .tab-dot { position:absolute; top:5px; right:calc(50% - 17px); min-width:8px; height:8px;
    border-radius:var(--r-pill); background:var(--sun); box-shadow:0 0 0 2px var(--rail); }
  .tab-item.active .tab-dot { background:var(--rail); box-shadow:0 0 0 2px var(--accent); }
}

/* ---------- More sheet (mobile) ---------- */
.sheet-overlay { position:fixed; inset:0; z-index:45; background:rgba(7,17,14,.52);
  display:flex; align-items:flex-end; animation:fadein .16s ease both; }
.sheet { width:100%; background:var(--surface); border-radius:20px 20px 0 0;
  padding:10px 15px calc(15px + env(safe-area-inset-bottom)); box-shadow:var(--shadow-lift);
  animation:sheetup .24s var(--ease) both; max-height:80vh; overflow-y:auto; }
.sheet-grip { width:38px; height:4px; border-radius:4px; background:var(--line); margin:2px auto 12px; }
.sheet-title { font-family:var(--display); font-size:11px; font-weight:700; color:var(--ink-faint);
  text-transform:uppercase; letter-spacing:.1em; margin:6px 2px 9px; }
.sheet-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.sheet-item { position:relative; display:flex; flex-direction:column; align-items:center; gap:7px;
  padding:15px 6px 12px; border-radius:14px; background:var(--surface-2);
  border:1px solid var(--line-soft); color:var(--ink); font-size:11.5px; font-weight:600;
  text-decoration:none; text-align:center; transition:background .14s ease, border-color .14s ease; }
.sheet-item svg { width:22px; height:22px; color:var(--ink-soft); }
.sheet-item:active { background:var(--sunken); }
.sheet-item.active { background:var(--accent-soft); border-color:var(--accent); }
.sheet-item.active svg { color:var(--accent-deep); stroke-width:2.1; }
.sheet-row { display:flex; align-items:center; gap:11px; width:100%; min-height:var(--tap);
  padding:12px 10px; margin-top:3px; border-radius:12px; background:none;
  font-size:13.5px; font-weight:500; color:var(--ink); text-align:left; text-decoration:none; }
.sheet-row svg { width:19px; height:19px; color:var(--ink-soft); flex-shrink:0; }
.sheet-row:active { background:var(--surface-2); }
.sheet-row.active { background:var(--accent-soft); font-weight:700; }
.sheet-row.active svg { color:var(--accent-deep); }
.sheet-sep { height:1px; background:var(--line-soft); margin:11px 0 4px; }
@keyframes sheetup { from { transform:translateY(38px); opacity:.3; } }
@keyframes fadein { from { opacity:0; } }

/* ============================================================================
   HERO + DAY ARC — the signature
   ========================================================================== */
.hero { background:var(--sky); border:1px solid var(--line); border-radius:var(--r-card);
  padding:19px 22px 4px; box-shadow:var(--shadow); margin-bottom:16px;
  transition:background .3s var(--ease); overflow:hidden; }
.hero-top { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.eyebrow { font-size:10.5px; letter-spacing:.15em; text-transform:uppercase;
  color:var(--ink-soft); font-weight:600; }
.hero-title { font-size:29px; margin-top:3px; }
.hero-clock { font-family:var(--data); font-size:20px; color:var(--ink-soft); font-weight:500;
  font-variant-numeric:tabular-nums; letter-spacing:-.02em; flex-shrink:0; padding-top:2px; }
@media (max-width:860px){
  .hero { padding:15px 15px 2px; }
  .hero-title { font-size:22px; }
  .hero-clock { font-size:16px; }
}

.arc-wrap svg { width:100%; height:auto; display:block; overflow:visible; }
.arc-base { fill:none; stroke:var(--arc-base); stroke-width:3.5; stroke-linecap:round; }
.arc-fill { fill:none; stroke:var(--given); stroke-width:3.5; stroke-linecap:round; opacity:.92;
  animation:draw 1.1s var(--ease) both; transition:stroke-dasharray .7s ease; }
.arc-now { fill:none; stroke:var(--accent); stroke-width:1.5; stroke-linecap:round; opacity:.5;
  animation:draw 1.4s var(--ease) both; }
@keyframes draw { from { stroke-dasharray:0 100; } }
.arc-node { cursor:pointer; }
.node-ring { fill:var(--surface); stroke:var(--line); stroke-width:1.6; transition:.25s; }
.node-core { fill:var(--ink-soft); transition:.25s; }
.node-done .node-ring { stroke:var(--given); } .node-done .node-core { fill:var(--given); }
.node-due .node-ring { stroke:var(--due); animation:pulse 2.2s ease-in-out infinite; }
.node-due .node-core { fill:var(--due); }
.node-focus .node-ring { stroke:var(--accent); stroke-width:3; }
@keyframes pulse { 0%,100%{stroke-width:1.6} 50%{stroke-width:4} }
.arc-node:hover .node-ring { stroke:var(--accent); }
.node-time { font-family:var(--data); font-size:12.5px; fill:var(--ink-soft); text-anchor:middle;
  font-variant-numeric:tabular-nums; }
.node-check { font-size:9px; fill:var(--surface); text-anchor:middle; pointer-events:none; }
.marker-halo { fill:var(--sun); opacity:.22; } .marker-disc { fill:var(--sun); }
.arc-cap { font-family:var(--data); font-size:11px; fill:var(--ink-soft); opacity:.7; }
.arc-legend { display:flex; align-items:center; gap:7px; color:var(--ink-soft); font-size:12px;
  padding:2px 4px 12px; }
.arc-legend svg { width:15px; height:15px; flex-shrink:0; }

/* ---------- quick actions ---------- */
.quick-actions { display:flex; gap:8px; margin:0 0 16px; overflow-x:auto; scrollbar-width:none;
  padding-bottom:2px; }
.quick-actions::-webkit-scrollbar { display:none; }
.qa-btn { display:inline-flex; align-items:center; gap:7px; white-space:nowrap; flex-shrink:0;
  min-height:40px; padding:9px 15px; border-radius:var(--r-pill); background:var(--surface);
  border:1px solid var(--line); color:var(--ink); font-size:13px; font-weight:600;
  box-shadow:var(--shadow);
  transition:border-color .14s ease, background .14s ease, transform .1s ease; }
.qa-btn svg { width:16px; height:16px; color:var(--accent-deep); fill:none;
  stroke:currentColor; stroke-width:1.9; flex-shrink:0; }
.qa-btn:hover { border-color:var(--accent); background:var(--surface-2); }
.qa-btn:active { transform:scale(.97); }
@media (max-width:860px){ .qa-btn { min-height:var(--tap); } }

/* ============================================================================
   CARDS · ROWS · PILLS · KPIS
   ========================================================================== */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card);
  padding:15px 17px; box-shadow:var(--shadow); }

.row-card { position:relative; background:var(--surface); border:1px solid var(--line);
  border-radius:12px; padding:11px 14px 11px 15px; display:flex; align-items:center;
  justify-content:space-between; gap:10px; box-shadow:var(--shadow); overflow:hidden;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.row-card:hover { border-color:var(--ink-faint); box-shadow:var(--shadow-raise); }

/* Status spine. The pill inside the row already carries state, so the colour is
   derived from it rather than duplicated as another class in the markup. State
   becomes legible in peripheral vision — which is the whole point when a carer is
   scanning forty rows of a medication round. */
.row-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px;
  background:transparent; transition:background .16s ease; }
.row-card:has(.pill.sage)::before  { background:var(--given); }
.row-card:has(.pill.amber)::before { background:var(--due); }
.row-card:has(.pill.clay)::before  { background:var(--alert); }
@media (max-width:640px){ .row-card { flex-wrap:wrap; padding:10px 12px 10px 14px; } }

/* ---------- dose card: the medication round row ----------
   The single most-used surface in the product. A carer stands in a corridor,
   phone in one hand, and needs three facts in this order: who, what, and is it
   done. The layout is a grid so that order holds at every width — the action
   stays pinned to the right edge, under a right-handed thumb, while who/what
   stack beneath each other rather than collapsing into one run of middots.

   Dose and route are shown, always. They come back in the rounds payload and
   were previously dropped, which left a MAR round listing the drug but not how
   much of it — the sort of thing an inspector asks about once. */
.dose-card { position:relative; background:var(--surface); border:1px solid var(--line);
  border-radius:12px; padding:10px 13px 10px 15px; box-shadow:var(--shadow); overflow:hidden;
  display:grid; gap:3px 14px; align-items:center;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-areas:"who foot" "what foot" "flag flag" "log log";
  transition:border-color .16s ease, box-shadow .16s ease; }
.dose-card:hover { border-color:var(--ink-faint); box-shadow:var(--shadow-raise); }

/* Status spine, derived from the pill the row already carries. */
.dose-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px;
  background:transparent; transition:background .16s ease; }
.dose-card:has(.pill.sage)::before  { background:var(--given); }
.dose-card:has(.pill.amber)::before { background:var(--due); }
.dose-card:has(.pill.clay)::before  { background:var(--alert); }

.dose-who { grid-area:who; display:flex; align-items:center; gap:9px; min-width:0;
  text-decoration:none; color:inherit; }
.dose-who-text { display:flex; flex-direction:column; min-width:0; line-height:1.25; }
.dose-name { font-weight:650; color:var(--ink); font-size:14px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dose-who:hover .dose-name { text-decoration:underline; text-underline-offset:2px; }
.dose-room { font-size:11.5px; color:var(--ink-faint); font-variant-numeric:tabular-nums; }

.dose-what { grid-area:what; display:flex; align-items:baseline; gap:7px;
  flex-wrap:wrap; min-width:0; padding-left:47px; }
.dose-drug { font-size:13.5px; font-weight:600; color:var(--ink-soft); }
.dose-strength { font-family:var(--data); font-size:12px; font-weight:500;
  color:var(--ink); background:var(--sunken); border-radius:6px; padding:1px 6px;
  font-variant-numeric:tabular-nums; }

/* A controlled drug is a legal safeguard, not a footnote. It was previously the
   tail of a middot-separated run and read as an afterthought. */
.dose-flag { grid-area:flag; display:flex; align-items:center; gap:6px; margin-top:5px;
  padding:4px 9px; border-radius:8px; background:var(--alert-soft); color:var(--alert);
  font-size:11.5px; font-weight:650; line-height:1.3; }
.dose-flag svg { width:14px; height:14px; flex-shrink:0; fill:none; stroke:currentColor;
  stroke-width:1.9; }

.dose-log { grid-area:log; font-size:11.5px; color:var(--ink-faint); margin-top:3px;
  padding-left:47px; line-height:1.4; }
.dose-note { display:block; color:var(--ink-soft); font-style:italic; }

.dose-foot { grid-area:foot; display:flex; align-items:center; gap:9px; align-self:center; }
/* 44px is the accessible minimum tap target, and a carer may be wearing gloves. */
.dose-action { min-height:44px; min-width:84px; justify-content:center; }

@media (max-width:640px){
  .dose-card { padding:9px 11px 9px 14px; gap:2px 10px; }
  .dose-what, .dose-log { padding-left:0; }
  .dose-action { min-width:72px; padding-left:14px; padding-right:14px; }
}

.pill { display:inline-flex; align-items:center; gap:5px; padding:3px 10px;
  border-radius:var(--r-pill); font-size:11px; font-weight:700; white-space:nowrap;
  letter-spacing:.01em; }
.pill::before { content:""; width:5px; height:5px; border-radius:50%;
  background:currentColor; flex-shrink:0; }
.pill.sage  { background:var(--given-soft); color:var(--given); }
.pill.amber { background:var(--due-soft);   color:var(--due); }
.pill.clay  { background:var(--alert-soft); color:var(--alert); }
.pill.grey  { background:var(--sunken);     color:var(--ink-soft); }

.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(158px,1fr)); gap:11px; margin:0 0 20px; }
@media (max-width:640px){ .kpis { grid-template-columns:1fr 1fr; gap:9px; } }
.kpi { background:var(--surface); border:1px solid var(--line); border-radius:var(--r-card);
  padding:13px 15px; box-shadow:var(--shadow); }
.kpi .label { font-size:10.5px; color:var(--ink-soft); letter-spacing:.06em;
  text-transform:uppercase; font-weight:600; }
.kpi .value { font-family:var(--display); font-size:28px; font-weight:700; margin:4px 0 2px;
  font-variant-numeric:tabular-nums; letter-spacing:-.025em; line-height:1; }
.kpi .sub { font-size:11.5px; color:var(--ink-soft); }
.kpi .sub a { text-decoration:underline; text-underline-offset:2px; }

/* ============================================================================
   BUTTONS
   ========================================================================== */
.btn { background:var(--ink); color:var(--bg); padding:10px 16px; font-weight:600;
  border-radius:var(--r-chip); display:inline-flex; align-items:center; justify-content:center;
  gap:7px; min-height:38px; white-space:nowrap;
  transition:filter .14s ease, transform .1s ease, background .14s ease, border-color .14s ease; }
[data-theme="nocturne"] .btn { color:#0B1512; }
.btn svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.9; flex-shrink:0; }
.btn:hover { filter:brightness(1.14); }
.btn:active { transform:scale(.98); }
.btn.small { padding:6px 12px; font-size:12px; min-height:32px; }
.btn.ghost { background:transparent; color:var(--ink); border:1px solid var(--line); }
.btn.ghost:hover { background:var(--surface-2); border-color:var(--ink-faint); filter:none; }
.btn.danger { background:var(--alert-soft); color:var(--alert); border:1px solid transparent; }
.btn.danger:hover { border-color:var(--alert); filter:none; }
.btn.sage { background:var(--given); color:#fff; }
[data-theme="nocturne"] .btn.sage { color:#0B1512; }
.btn.accent { background:var(--accent); color:var(--accent-ink); }
.btn:disabled { background:var(--sunken); color:var(--ink-faint); cursor:not-allowed;
  transform:none; filter:none; border-color:transparent; }
@media (max-width:640px){ .btn:not(.small) { min-height:var(--tap); padding:11px 16px; } }

.chip-btn { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600;
  padding:6px 13px; min-height:32px; border-radius:var(--r-pill); background:var(--surface-2);
  color:var(--ink-soft); border:1px solid var(--line); transition:.14s ease; }
.chip-btn:hover { color:var(--ink); border-color:var(--ink-faint); }
.chip-btn.on { background:var(--ink); color:var(--bg); border-color:var(--ink); }
[data-theme="nocturne"] .chip-btn.on { color:#0B1512; }

/* ============================================================================
   PAGE FURNITURE
   ========================================================================== */
.page-head { display:flex; align-items:center; justify-content:space-between;
  margin-bottom:5px; gap:12px; flex-wrap:wrap; }
.page-head h1 { font-size:25px; }
.page-sub { color:var(--ink-soft); font-size:13px; margin-bottom:18px; max-width:62ch; }

/* Section headers stay put while a long list scrolls, so context is never lost
   half-way down a medication round or an audit trail. */
.section-title { font-family:var(--display); font-size:11.5px; font-weight:700;
  text-transform:uppercase; letter-spacing:.1em; color:var(--ink-soft);
  margin:22px 0 9px; position:sticky; top:0; z-index:5;
  background:linear-gradient(var(--bg) 72%, transparent); padding:7px 0 5px; }
@media (max-width:860px){ .section-title { top:54px; } }
@media print { .section-title { position:static; background:none; } }

.muted { color:var(--ink-soft); font-size:12.5px; }
.sub { font-size:12.5px; color:var(--ink-soft); }
.stack { display:flex; flex-direction:column; gap:7px; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.flex { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.spread { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.clickable { cursor:pointer; }
.badge-note { font-size:11px; color:var(--ink-faint); font-style:italic; }

.avatar { width:44px; height:44px; border-radius:12px; background:var(--accent-soft);
  color:var(--accent-deep); display:flex; align-items:center; justify-content:center;
  font-family:var(--display); font-weight:800; font-size:15px; flex-shrink:0; letter-spacing:-.01em; }
.avatar.ink { background:var(--rail-active); color:#fff; }
.avatar.tiny { width:38px; height:38px; border-radius:11px; font-size:13px; }
.avatar.lg { width:58px; height:58px; border-radius:16px; font-size:19px; }

/* Per-person colour identity. `--tint` is a hue set from a hash of the name in
   app.js (hueOf), so a resident carries the same colour on every screen and is
   recognisable before the name is read. Two rules cover the whole palette
   because the hue is data and only the lightness changes between themes. */
.avatar[style*="--tint"] { background:hsl(var(--tint, 42) 40% 91%); color:hsl(var(--tint, 42) 52% 27%); }
[data-theme="nocturne"] .avatar[style*="--tint"] { background:hsl(var(--tint, 42) 26% 19%);
  color:hsl(var(--tint, 42) 46% 71%); }

/* ---------- search ---------- */
.search-bar { position:relative; margin-bottom:14px; max-width:440px; }
.search-bar svg { position:absolute; left:13px; top:50%; transform:translateY(-50%);
  width:16px; height:16px; color:var(--ink-faint); pointer-events:none;
  fill:none; stroke:currentColor; stroke-width:1.9; }
.search-bar input { padding-left:38px; border-radius:var(--r-pill); }

/* ---------- alert banner ---------- */
.alert-banner { display:flex; align-items:flex-start; gap:9px; background:var(--alert-soft);
  color:var(--alert); border:1px solid var(--alert); border-radius:12px; padding:10px 13px;
  font-size:13px; font-weight:600; margin:12px 0 4px; }
.alert-banner svg { width:17px; height:17px; flex-shrink:0; margin-top:1px;
  fill:none; stroke:currentColor; stroke-width:2; }

/* ---------- tabs ---------- */
.tabs { display:flex; gap:1px; border-bottom:1px solid var(--line); margin:16px 0;
  overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch; scroll-behavior:smooth; }
.tabs::-webkit-scrollbar { display:none; }
@media (max-width:860px){
  /* The scrollbar is hidden, so the fade is the only cue that more tabs exist.
     Without it, later tabs are effectively invisible on a phone. */
  .tabs { -webkit-mask-image:linear-gradient(to right, #000 calc(100% - 26px), transparent);
                  mask-image:linear-gradient(to right, #000 calc(100% - 26px), transparent); }
}
.tabs button { padding:10px 13px; min-height:42px; color:var(--ink-soft); font-weight:500;
  border-bottom:2.5px solid transparent; border-radius:0; white-space:nowrap;
  text-transform:capitalize; flex-shrink:0; transition:color .14s ease, border-color .14s ease; }
.tabs button:hover { color:var(--ink); }
.tabs button.active { color:var(--ink); border-bottom-color:var(--accent); font-weight:700; }

/* ---------- resident detail header ---------- */
.detail-head { display:flex; gap:14px; align-items:center; margin-top:12px; }
.detail-id { min-width:0; }
.detail-pref { font-size:14px; font-family:var(--body); font-weight:400; color:var(--ink-faint); }
.detail-sub { font-variant-numeric:tabular-nums; }

/* Safety ribbon.
   These four facts were each a tab away: the diet texture, the high risks, the
   care plan review date and who to ring. A carer standing at the door needs them
   before they need anything else on this screen — a modified-texture diet in
   particular is a choking safeguard, and it read as a nutrition detail rather
   than a safety one. Allergies stay as a full-width banner above: they are the
   one thing severe enough to be unmissable rather than merely present. */
.ribbon { display:flex; flex-wrap:wrap; gap:7px; margin:11px 0 2px; }
.rib { display:flex; flex-direction:column; gap:1px; min-width:0;
  background:var(--surface); border:1px solid var(--line); border-radius:10px;
  padding:6px 11px; box-shadow:var(--shadow); }
.rib-l { font-size:9.5px; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  color:var(--ink-faint); }
.rib-v { font-size:12.5px; font-weight:600; color:var(--ink); line-height:1.35; }
.rib-v a { color:var(--accent-deep); text-decoration:none; border-bottom:1px solid currentColor; }
.rib-v .muted { font-weight:400; }
.rib.warn { border-color:var(--due); background:var(--due-soft); }
.rib.warn .rib-l, .rib.warn .rib-v { color:var(--due); }
.rib.alert { border-color:var(--alert); background:var(--alert-soft); }
.rib.alert .rib-l, .rib.alert .rib-v { color:var(--alert); }
@media (max-width:640px){
  .ribbon { gap:6px; }
  .rib { flex:1 1 calc(50% - 3px); padding:6px 9px; }
}
.backlink { display:inline-flex; align-items:center; gap:5px; color:var(--ink-soft);
  text-decoration:none; font-size:12.5px; font-weight:500; padding:4px 0; }
.backlink svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2.1; }
.backlink:hover { color:var(--ink); }

/* ---------- medication round timeline ---------- */
.timeline-row { display:flex; gap:14px; margin-bottom:15px; }
.timeline-time { width:50px; flex-shrink:0; padding-top:7px; color:var(--ink-soft);
  font-family:var(--data); font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; }
.timeline-body { flex:1; min-width:0; border-left:2px solid var(--line); padding-left:14px;
  display:flex; flex-direction:column; gap:7px; }
@media (max-width:640px){
  .timeline-row { gap:8px; margin-bottom:13px; }
  .timeline-time { width:40px; font-size:12px; }
  .timeline-body { padding-left:9px; }
}

/* ---------- tables ---------- */
.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; border:1px solid var(--line);
  border-radius:var(--r-card); background:var(--surface); box-shadow:var(--shadow); }
table { width:100%; border-collapse:collapse; }
th { text-align:left; font-size:10.5px; color:var(--ink-soft); font-weight:700;
  text-transform:uppercase; letter-spacing:.07em; padding:10px 12px;
  border-bottom:1px solid var(--line); white-space:nowrap;
  background:var(--surface-2); position:sticky; top:0; z-index:2; }
td { padding:11px 12px; border-bottom:1px solid var(--line-soft); font-size:13px;
  vertical-align:middle; font-variant-numeric:tabular-nums; }
tbody tr { transition:background .12s ease; }
tbody tr:hover { background:var(--surface-2); }
tr:last-child td { border-bottom:none; }

/* ---------- onboarding wizard ---------- */
.wizard-steps { display:flex; gap:5px; margin-bottom:15px; }
.wizard-steps .dot { flex:1; height:4px; border-radius:4px; background:var(--line);
  transition:background .3s var(--ease); }
.wizard-steps .dot.done { background:var(--given); }

/* ---------- incidents ---------- */
.inc-card { align-items:flex-start; }
.inc-main { flex:1; min-width:0; }
.inc-title { flex-wrap:wrap; gap:7px; }
.inc-meta { margin:3px 0; }
.inc-what { font-size:13px; }
.inc-filters { margin-bottom:14px; }
.inc-side { display:flex; flex-direction:column; gap:6px; align-items:flex-end; flex-shrink:0; }
.inc-side .inc-status { width:auto; font-size:12px; }
.inc-noaction { margin-top:7px; font-size:11.5px; color:var(--due); font-weight:600; }

/* An outstanding statutory notification is the one thing on this screen that
   carries a legal deadline, so it gets a spine of its own rather than relying on
   the reader noticing a badge. */
.inc-card.inc-urgent { border-color:var(--alert); }
.inc-card.inc-urgent::before { background:var(--alert); width:4px; }

/* Live notifiability hint inside the report form. Shown while the carer is still
   choosing the type — the point is that they learn before submitting, not after. */
.ir-notif { display:flex; gap:8px; align-items:flex-start; margin:10px 0 2px;  padding:9px 12px; border-radius:10px; background:var(--alert-soft); color:var(--alert);
  border:1px solid var(--alert); font-size:12px; line-height:1.45; }
.ir-notif[hidden] { display:none; }
.ir-notif.ir-mgr { background:var(--line-soft); color:var(--ink); border:1px solid var(--line); }
.notif-badge.mgr-only { background:transparent; color:var(--ink); border:1.5px solid var(--ink); font-weight:600; }
.ir-notif svg { width:16px; height:16px; flex-shrink:0; margin-top:1px; fill:none;
  stroke:currentColor; stroke-width:1.9; }

@media (max-width:640px){
  .inc-card { flex-direction:column; }
  .inc-side { flex-direction:row; align-items:center; width:100%; flex-wrap:wrap; margin-top:8px; }
}
.inc-actions { margin-top:9px; padding-top:9px; border-top:1px dashed var(--line);
  font-size:12px; color:var(--ink-soft); display:flex; flex-direction:column; gap:3px; }
.notif-badge { display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700;
  padding:3px 9px; border-radius:var(--r-pill); letter-spacing:.03em; }
.notif-badge.pending { background:var(--due-soft); color:var(--due); border:1px dashed var(--due); }
.notif-badge.sent { background:var(--given-soft); color:var(--given); }

/* ---------- handover ---------- */
/* ---------- shift handover ----------
   A handover is read once, fast, by someone who has just walked in. Order is
   triage: counts, then anything notifiable, then the residents who need
   something, then a one-line roll-call of everyone who doesn't. */
.ho-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  flex-wrap:wrap; margin-bottom:14px; }
.ho-title { font-size:24px; }
.page-sub.tight { margin-bottom:0; }

.ho-stats { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px;
  margin-bottom:14px; }
.ho-stat { background:var(--surface); border:1px solid var(--line); border-radius:11px;
  padding:9px 11px; box-shadow:var(--shadow); }
.ho-stat-v { font-family:var(--display); font-weight:800; font-size:21px; color:var(--ink);
  line-height:1.1; font-variant-numeric:tabular-nums; }
.ho-stat-l { font-size:10.5px; color:var(--ink-faint); letter-spacing:.02em; margin-top:2px; }
.ho-stat.warn  { border-color:var(--due);   background:var(--due-soft); }
.ho-stat.warn .ho-stat-v { color:var(--due); }
.ho-stat.alert { border-color:var(--alert); background:var(--alert-soft); }
.ho-stat.alert .ho-stat-v { color:var(--alert); }
@media (max-width:720px){ .ho-stats { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.ho-banner { display:flex; gap:9px; align-items:flex-start; padding:10px 13px; margin-bottom:16px;
  border-radius:11px; background:var(--alert-soft); color:var(--alert);
  border:1px solid var(--alert); font-size:12.5px; line-height:1.45; }
.ho-banner svg { width:17px; height:17px; flex-shrink:0; margin-top:1px; fill:none;
  stroke:currentColor; stroke-width:1.9; }

.section-title.flush { margin-top:0; }
.ho-house { margin-bottom:16px; }

.ho-card { margin-bottom:11px; }
.ho-card-head { display:flex; align-items:center; gap:10px; }
.ho-who { display:flex; flex-direction:column; min-width:0; flex:1; line-height:1.25; }
.ho-name { font-family:var(--display); font-size:15px; overflow:hidden;
  text-overflow:ellipsis; white-space:nowrap; }
.ho-meta { font-size:11.5px; color:var(--ink-faint); font-variant-numeric:tabular-nums; }
.ho-body { margin-top:8px; border-top:1px solid var(--line-soft); padding-top:6px; }
.ho-line { display:flex; gap:9px; align-items:baseline; font-size:12.5px; padding:3px 0;
  line-height:1.45; }
.ho-line .mono { color:var(--ink-faint); font-size:11.5px; }

/* A fixed-width tag column so the eye can run down the left edge and pick out
   incidents without reading every line. */
.ho-tag { flex-shrink:0; width:74px; font-size:10px; font-weight:700; letter-spacing:.03em;
  text-transform:uppercase; color:var(--ink-faint); padding-top:2px; }
.ho-tag.alert { color:var(--alert); }
.ho-tag.rx { color:var(--info); }
.ho-notif { display:inline-block; background:var(--alert); color:#fff; border-radius:5px;
  padding:1px 6px; font-size:10px; font-weight:700; letter-spacing:.02em; }

.ho-quiet { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:7px; }
.ho-quiet-item { display:flex; align-items:center; gap:8px; padding:7px 10px; min-width:0;
  background:var(--surface); border:1px solid var(--line); border-radius:10px;
  text-decoration:none; color:inherit; transition:border-color .16s ease; }
.ho-quiet-item:hover { border-color:var(--ink-faint); }
.ho-quiet-text { display:flex; flex-direction:column; min-width:0; line-height:1.25; font-size:12.5px; }
.ho-quiet-text b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ho-quiet-note { margin-top:9px; font-size:11.5px; }
@media (max-width:640px){ .ho-tag { width:62px; } }

/* ---------- notes composer ---------- */
.note-fields { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
@media (max-width:640px){ .note-fields { grid-template-columns:1fr 1fr; } .grid2 { grid-template-columns:1fr; } }

/* Note capture.
   The type was a <select>: tap, wait for the native picker, scroll, choose,
   dismiss. Seven types fit as chips, so it is one tap. This is the most
   frequently repeated interaction in the product — a carer may record a dozen
   observations in a round — and the dropdown was costing four actions each time. */
.note-capture { margin-bottom:12px; }
.note-types { display:flex; flex-wrap:wrap; gap:6px; margin:2px 0 11px; }
.note-types .chip-btn { min-height:38px; }
.note-save { margin-top:11px; min-height:44px; }

/* Advisory only — never blocks a save. A genuinely unwell resident can have
   alarming observations, and refusing to record them would be worse. */
.note-caution { display:flex; gap:7px; align-items:flex-start; margin-top:9px;
  padding:8px 11px; border-radius:9px; background:var(--due-soft); color:var(--due);
  border:1px solid var(--due); font-size:12px; font-weight:600; line-height:1.4; }
.note-caution svg { width:15px; height:15px; flex-shrink:0; margin-top:1px;
  fill:none; stroke:currentColor; stroke-width:1.9; }

.note-row { align-items:flex-start; }
.note-body { min-width:0; flex:1; }
.note-line { display:flex; gap:7px; align-items:baseline; flex-wrap:wrap; }
.note-text { font-size:13px; }
.note-by { margin-top:2px; font-size:11.5px; }

/* ---------- dashboard columns ---------- */
.dash-cols { display:grid; grid-template-columns:1.7fr 1fr; gap:28px; align-items:start; }
@media (max-width:900px){ .dash-cols { grid-template-columns:1fr; gap:6px; } }

/* ============================================================================
   MODALS — centred on desktop, bottom sheet on mobile
   ========================================================================== */
.modal-overlay { position:fixed; inset:0; background:rgba(7,17,14,.52);
  display:flex; align-items:center; justify-content:center; z-index:50; padding:18px;
  animation:fadein .15s ease both; }
.modal { background:var(--surface); color:var(--ink); border-radius:var(--r-card); padding:22px;
  width:100%; max-width:480px; max-height:90vh; overflow-y:auto; box-shadow:var(--shadow-lift);
  animation:modalin .2s var(--ease) both; }
@keyframes modalin { from { transform:translateY(10px) scale(.99); opacity:.4; } }
.modal h2 { font-size:18px; margin-bottom:2px; }
.modal .sub { font-size:12.5px; color:var(--ink-soft); margin-bottom:10px; }
.modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px;
  position:sticky; bottom:0; background:var(--surface); padding-top:12px; }
@media (max-width:640px){
  .modal-overlay { align-items:flex-end; padding:0; }
  .modal { max-width:none; border-radius:20px 20px 0 0; max-height:88vh;
    padding:14px 17px calc(17px + env(safe-area-inset-bottom));
    animation:sheetup .24s var(--ease) both; }
  .modal::before { content:""; display:block; width:38px; height:4px; border-radius:4px;
    background:var(--line); margin:0 auto 13px; }
  .modal-actions { padding-bottom:2px; }
  .modal-actions .btn { flex:1; }
}
.login-demo .error-box { margin-top:10px; }
.error-box { background:var(--alert-soft); color:var(--alert); border-radius:10px;
  padding:10px 12px; font-size:12.5px; margin:10px 0; border-left:3px solid var(--alert); }
.ok-box { background:var(--given-soft); color:var(--given); border-radius:10px;
  padding:10px 12px; font-size:12.5px; margin:10px 0; border-left:3px solid var(--given); }
.temp-pass { font-family:var(--data); font-size:16px; font-weight:600; background:var(--sunken);
  border:1px dashed var(--line); border-radius:10px; padding:11px 12px; margin:8px 0;
  text-align:center; letter-spacing:.04em; user-select:all; }

/* ============================================================================
   FEEDBACK — skeletons · toasts · empty states
   ========================================================================== */
.skel { border-radius:12px;
  background:linear-gradient(100deg, var(--line-soft) 40%, var(--surface) 50%, var(--line-soft) 60%);
  background-size:200% 100%; animation:shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position:-200% 0; } }
.skel-row { height:54px; margin-bottom:8px; }
.skel-hero { height:150px; margin-bottom:16px; border-radius:var(--r-card); }
.skel-kpi { height:80px; border-radius:var(--r-card); }

.toast-wrap { position:fixed; left:50%; transform:translateX(-50%); z-index:70; display:flex;
  flex-direction:column; gap:8px; align-items:center; bottom:22px; pointer-events:none;
  width:max-content; max-width:92vw; }
@media (max-width:860px){
  .toast-wrap { bottom:calc(var(--tabbar-h) + max(9px, env(safe-area-inset-bottom)) + 12px); }
}
.toast { display:flex; align-items:center; gap:9px; background:var(--rail); color:#fff;
  font-size:13px; font-weight:600; padding:11px 17px; border-radius:var(--r-pill);
  box-shadow:var(--shadow-lift); animation:toastin .25s var(--ease) both; }
.toast svg { width:15px; height:15px; color:var(--sun); flex-shrink:0;
  fill:none; stroke:currentColor; stroke-width:2.2; }
.toast.leaving { animation:toastout .22s ease both; }
@keyframes toastin { from { transform:translateY(14px); opacity:0; } }
@keyframes toastout { to { transform:translateY(10px); opacity:0; } }

.empty { text-align:center; padding:36px 20px; color:var(--ink-soft); background:var(--surface-2);
  border:1px dashed var(--line); border-radius:var(--r-card); font-size:13px; }
.empty b { display:block; font-family:var(--display); font-size:15px; color:var(--ink);
  margin-bottom:5px; letter-spacing:-.01em; }

/* ---------- notifications ---------- */
.icon-btn.bell { position:relative; }
.bell-dot { position:absolute; top:1px; right:1px; min-width:16px; height:16px; padding:0 4px;
  border-radius:var(--r-pill); background:var(--sun); color:#0F2A24; font-size:9.5px;
  font-weight:800; display:flex; align-items:center; justify-content:center; line-height:1;
  font-variant-numeric:tabular-nums; }
.topbar .bell-dot, .rail-foot .bell-dot { box-shadow:0 0 0 2px var(--rail); }
/* `display:flex` above beats the user-agent rule for [hidden], so the dot stayed
   visible whether or not anything was unread. An author rule has to put it back. */
.bell-dot[hidden] { display:none; }
.notif { display:flex; gap:11px; align-items:flex-start; width:100%; text-align:left;
  padding:11px 12px; border-radius:12px; background:var(--surface-2);
  border:1px solid var(--line-soft); color:var(--ink); font-size:12.5px; }
.notif.unread { background:var(--accent-soft); border-color:var(--accent); }
.notif b { display:block; font-family:var(--display); font-size:13.5px; margin-bottom:2px; }
.notif-ico { flex-shrink:0; width:32px; height:32px; border-radius:9px; background:var(--surface);
  display:flex; align-items:center; justify-content:center; color:var(--ink-soft); }
.notif-ico svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.9; }
.notif-ico.urgent { background:var(--alert-soft); color:var(--alert); }

/* ============================================================================
   LOGIN
   ========================================================================== */
/* ---------- the Hera front door ----------
   Generic by design. It names no home and no organisation: the product serves
   unrelated legal entities, and a sign-in page carrying one customer's name tells
   anyone who finds the URL whose business is behind it. Identity appears after
   authentication, not before.

   Blues and white, fixed rather than themed — per-home accents only mean
   something once we know which home, which is after sign-in. */
.login-wrap { min-height:100vh; min-height:100dvh; display:flex; align-items:center;
  justify-content:center; padding:22px 20px; position:relative; overflow:hidden;
  background:#0A2040; }
/* Plain navy field. The drawn Hera background was reverted — the element and its
   scrim are kept so the imagery can go back in by changing these two rules and
   nothing else. */
.login-bg { position:absolute; inset:0;
  background:radial-gradient(120% 85% at 50% 8%, #16447E 0%, #0D2A52 46%, #071B36 100%); }
.login-scrim { position:absolute; inset:0;
  background:linear-gradient(180deg, rgba(6,20,40,0) 0%, rgba(6,20,40,.34) 100%); }

.login-stack { position:relative; width:100%; max-width:392px; }

/* The badge overlaps the card's top edge, which is what gives the layout its
   anchor. Half of it sits above, so the card needs matching top padding. */
.login-badge { width:74px; height:74px; margin:0 auto -37px; position:relative; z-index:2;
  border-radius:20px; background:linear-gradient(150deg,#1B4A85,#0C2A52); color:#9DD2FA;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 10px 26px -8px rgba(3,14,30,.75); }
.login-badge .hera-glyph { width:42px; height:42px; }

.login-card { position:relative; background:#fff; border-radius:22px;
  padding:52px 30px 28px; text-align:center; color:#0E1F33;
  box-shadow:0 26px 64px -20px rgba(3,14,30,.7), 0 2px 10px rgba(3,14,30,.2); }

.hera-word { font-size:clamp(46px, 15vw, 62px); line-height:.92; margin:0;
  letter-spacing:-.03em; color:#111F3A; text-transform:uppercase; font-weight:800; }
.hera-sub { font-family:var(--display); font-size:clamp(15px, 4.6vw, 19px); font-weight:700;
  letter-spacing:.02em; text-transform:uppercase; color:#16294A; margin:2px 0 22px; }

/* A status message reads as a badge on the card rather than an error box: being
   signed out is information, not a fault. */
.login-flag { display:inline-block; margin:0 0 14px; padding:6px 13px; border-radius:8px;
  background:#1C7A46; color:#fff; font-size:11.5px; font-weight:800;
  letter-spacing:.08em; text-transform:uppercase; }

.login-card label { display:block; text-align:left; color:#233A56; font-weight:800;
  font-size:11px; letter-spacing:.09em; text-transform:uppercase; margin:0 0 5px; }
.login-card input { background:#fff; border:1.5px solid #1B3D6B; border-radius:11px;
  color:#0E1F33; padding:13px 14px; margin-bottom:15px; font-size:15px; }
.login-card input::placeholder { color:#93A6BC; }
.login-card input:focus { border-color:#12406F; box-shadow:0 0 0 3px rgba(27,74,133,.18); }

/* Gold hairline on the button: the one warm note, and it marks the primary
   action without another colour competing with the navy. */
.login-go { width:100%; min-height:52px; margin-top:3px; border-radius:11px;
  background:linear-gradient(180deg,#1F5391,#153C6C); color:#F0D9A2;
  border:1.5px solid #C9A24A; font-weight:800; font-size:16px;
  letter-spacing:.09em; text-transform:uppercase; }
.login-go:hover { background:linear-gradient(180deg,#245EA3,#17427A); }

.login-foot { margin-top:15px; font-size:11.5px; line-height:1.5; color:#41566F;
  font-weight:600; }

@media (max-width:400px){ .login-card { padding:48px 22px 24px; } }
@media (prefers-reduced-motion:no-preference){
  .login-stack { animation:loginIn .38s cubic-bezier(.2,.7,.3,1) both; }
  @keyframes loginIn { from { opacity:0; transform:translateY(11px); } to { opacity:1; transform:none; } }
}

/* ============================================================================
   PRINT + MOTION
   ========================================================================== */
@media print {
  .rail, .topbar, .tabbar, .toast-wrap, .quick-actions, .no-print { display:none !important; }
  .stage { padding:0; }
  body { background:#fff; font-size:11pt; }
  .card, .row-card, .dose-card, .table-wrap, .kpi, .hero { box-shadow:none; break-inside:avoid; }
  .ho-card, .ho-quiet-item, .ho-banner, .ho-stat { break-inside:avoid; }
  .ho-quiet { grid-template-columns:repeat(3,1fr); }
  th { position:static; }
}
@media (prefers-reduced-motion:reduce){
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important;
    transition-duration:.01ms !important; scroll-behavior:auto !important; }
}

/* Inline "new course" row inside the training modal. Inline rather than a nested
   modal because openModal() replaces #modal-root wholesale, which would destroy
   the half-filled form behind it. */
.tr-newcourse-btn { color:var(--ink-soft); margin-top:8px; }
.tr-newrow { display:flex; gap:7px; align-items:center; margin-top:8px; }
.tr-newrow[hidden] { display:none; }
.tr-newrow input { flex:1; min-width:0; margin:0; }

/* ---------- medications tab ----------
   Active and discontinued are separated rather than distinguished by opacity
   alone: a dimmed row is still a row, and on a phone in daylight the difference
   between .65 and 1 opacity is not something to stake a drug round on. */
.med-add-btn { margin-bottom:10px; min-height:44px; }
.med-row { align-items:flex-start; }
.med-main { flex:1; min-width:0; }
.med-title { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.med-dose { font-family:var(--data); font-size:12.5px; font-weight:600; color:var(--ink);
  background:var(--sunken); border-radius:6px; padding:1px 7px; font-variant-numeric:tabular-nums; }
.med-meta { font-size:12px; color:var(--ink-faint); margin-top:3px;
  display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
.med-time { font-family:var(--data); font-size:11px; background:var(--sunken);
  border-radius:5px; padding:1px 5px; margin-right:3px; font-variant-numeric:tabular-nums; }
.med-acts { flex-shrink:0; }
.med-stopped { background:var(--sunken); }
.med-stopped .med-title b { text-decoration:line-through; text-decoration-thickness:1px; }

/* The allergy strip is always present when allergies are recorded. It is the
   safety mechanism; the name matching below it only catches the obvious cases. */
.med-allergies { display:flex; gap:9px; align-items:flex-start; margin-bottom:12px;
  padding:10px 13px; border-radius:11px; background:var(--alert-soft); color:var(--alert);
  border:1px solid var(--alert); font-size:12.5px; line-height:1.45; }
.med-allergies svg { width:17px; height:17px; flex-shrink:0; margin-top:1px;
  fill:none; stroke:currentColor; stroke-width:1.9; }
.med-clash { border-color:var(--alert); }
.med-clash::before { background:var(--alert); width:4px; }
.med-clash-note { display:flex; gap:6px; align-items:flex-start; margin-top:6px;
  padding:5px 9px; border-radius:8px; background:var(--alert-soft); color:var(--alert);
  font-size:11.5px; font-weight:650; line-height:1.35; }
.med-clash-note svg { width:14px; height:14px; flex-shrink:0; margin-top:1px;
  fill:none; stroke:currentColor; stroke-width:1.9; }

/* ---------- risks tab ---------- */
.rk-add-btn { margin-bottom:10px; min-height:44px; }
.risk-row { align-items:flex-start; }
.risk-main { flex:1; min-width:0; }
.risk-summary { margin:2px 0; font-size:12.5px; }
.risk-due { font-size:12px; color:var(--ink-faint); font-variant-numeric:tabular-nums; }
.risk-due.late { color:var(--alert); font-weight:650; }
.risk-acts { flex-shrink:0; }
.risk-overdue { border-color:var(--alert); }
.risk-overdue::before { background:var(--alert); width:4px; }

@media (max-width:640px){
  .med-row, .risk-row { flex-direction:column; }
  .med-acts, .risk-acts { width:100%; margin-top:8px; }
}

/* ---------- resuscitation ----------
   The most consequential single fact on a resident's record. It gets its own
   card, and "not recorded" is styled as a warning rather than as neutral: the
   absence of a decision is information, and it must not look like a settled
   state. */
.cp-owner { margin:6px 0 10px; }
.cp-label { display:block; text-transform:uppercase; font-size:10px; letter-spacing:.05em;
  color:var(--ink-faint); font-weight:700; margin-bottom:4px; }

.resus-card { margin-top:12px; border-left-width:3px; border-left-style:solid; }
.resus-card.is-dnacpr { border-left-color:var(--alert); }
.resus-card.is-cpr    { border-left-color:var(--given); }
.resus-card.is-blank  { border-left-color:var(--due); }
.resus-badge { display:inline-flex; align-items:center; font-size:11px; font-weight:750;
  letter-spacing:.03em; border-radius:7px; padding:3px 9px; text-transform:uppercase; }
.resus-badge.dnacpr { background:var(--alert); color:#fff; }
.resus-badge.cpr    { background:var(--given-soft); color:var(--given); }
.resus-badge.blank  { background:var(--due-soft); color:var(--due); border:1px dashed var(--due); }
.resus-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; margin:11px 0 4px;
  font-size:13px; }
.resus-note { margin:8px 0 4px; font-size:12.5px; }
@media (max-width:640px){ .resus-grid { grid-template-columns:1fr; gap:9px; } }

/* ================================================================
 * Per-home accent palettes
 * ================================================================
 *
 * A home picks one of these; app.js writes the key to
 * document.documentElement.dataset.accent. On the ROOT element, for the same
 * reason the theme is (see applyTheme) — and so that one attribute can carry
 * both without either fighting the other.
 *
 * THESE RULES OVERRIDE FOUR TOKENS AND NO OTHERS: --accent, --accent-deep,
 * --accent-soft, --accent-ink. They must never touch --given, --due, --alert or
 * --info. Those four carry clinical meaning — given, overdue, alert,
 * informational — and if a home\'s branding could change what "given" looks like,
 * a nurse moving between two homes in the same group would be reading two
 * different colour languages. Branding is chrome; status is not brandable.
 *
 * Hues avoid the clinical greens and reds for the same reason. Honey is the
 * default and sits close to --due, which is pre-existing: --accent-soft and
 * --due-soft are in fact the same value. Worth separating one day.
 */
[data-accent="teal"] {
  --accent:#1E7F76; --accent-deep:#145A54; --accent-soft:#DFEFEC; --accent-ink:#FFFFFF;
}
[data-accent="indigo"] {
  --accent:#4A5AA8; --accent-deep:#333F7D; --accent-soft:#E4E7F5; --accent-ink:#FFFFFF;
}
[data-accent="plum"] {
  --accent:#7B4A73; --accent-deep:#5A3454; --accent-soft:#F0E5EF; --accent-ink:#FFFFFF;
}
[data-accent="bronze"] {
  --accent:#8C6239; --accent-deep:#6A4926; --accent-soft:#F1E7DA; --accent-ink:#FFFFFF;
}
[data-accent="slate"] {
  --accent:#4F6472; --accent-deep:#374954; --accent-soft:#E4EAEE; --accent-ink:#FFFFFF;
}

/* Nocturne variants: same hue, lifted for a dark surface. Night shift is when
   the theming matters least and legibility matters most, so these are brighter
   and the soft tone becomes a dark tint rather than a pale wash. */
[data-theme="nocturne"][data-accent="teal"] {
  --accent:#6FC9BE; --accent-deep:#57B0A5; --accent-soft:#16302C; --accent-ink:#08201C;
}
[data-theme="nocturne"][data-accent="indigo"] {
  --accent:#98A5E4; --accent-deep:#7D8BD0; --accent-soft:#1D2140; --accent-ink:#0B0F26;
}
[data-theme="nocturne"][data-accent="plum"] {
  --accent:#C99BC1; --accent-deep:#B181A9; --accent-soft:#332230; --accent-ink:#1E1020;
}
[data-theme="nocturne"][data-accent="bronze"] {
  --accent:#D3A874; --accent-deep:#BA8F5C; --accent-soft:#302518; --accent-ink:#1A1208;
}
[data-theme="nocturne"][data-accent="slate"] {
  --accent:#A3B6C4; --accent-deep:#889CAA; --accent-soft:#1F282E; --accent-ink:#0C1418;
}

/* ---------- home logo ---------- */
.rail-logo { width:40px; height:40px; border-radius:10px; object-fit:contain;
  background:#fff; padding:3px; display:block; }
/* Same approach as the avatars: the W stays in the markup and is hidden only
   while a logo is present, so onerror stripping .has-logo reveals it. */
.brand.has-logo .brand-mark { display:none; }
.brand-preview { display:flex; align-items:center; gap:12px; margin:10px 0; }
.brand-preview img { width:56px; height:56px; border-radius:12px; object-fit:contain;
  background:#fff; padding:4px; border:1px solid var(--line); }
.brand-none { width:56px; height:56px; border-radius:12px; border:1px dashed var(--line);
  display:flex; align-items:center; justify-content:center; color:var(--ink-faint);
  font-size:10px; text-align:center; line-height:1.2; padding:4px; }

.accent-row { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 4px; }
.accent-dot { width:34px; height:34px; border-radius:50%; border:2px solid var(--line);
  cursor:pointer; padding:0; position:relative; transition:transform .14s ease; }
.accent-dot:hover { transform:scale(1.09); }
.accent-dot.on { border-color:var(--ink); }
.accent-dot.on::after { content:""; position:absolute; inset:0; margin:auto;
  width:11px; height:11px; border-radius:50%; background:#fff;
  box-shadow:0 0 0 1.5px rgba(0,0,0,.28); }

/* ---------- avatars with photographs ----------
   The initials sit underneath the image rather than being replaced by it, so if
   the bytes fail to load the onerror handler removes the <img> and the initials
   are simply revealed. An empty box next to a resident's name looks like a fault. */
.avatar { position:relative; overflow:hidden; }
.avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover;
  display:block; border-radius:inherit; }
.avatar.has-photo { background:var(--sunken); }
/* Hidden only while a photo is present. The onerror handler strips .has-photo,
   which is what makes the initials reappear rather than leaving an empty box. */
.avatar.has-photo .avatar-initials { display:none; }
.avatar.xl { width:132px; height:132px; border-radius:20px; font-size:38px; }

.avatar-edit { position:relative; flex-shrink:0; }
.avatar-btn { position:absolute; right:-4px; bottom:-4px; width:28px; height:28px;
  border-radius:50%; border:2px solid var(--surface); background:var(--rail-active);
  color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer;
  padding:0; box-shadow:var(--shadow); transition:transform .14s ease; }
.avatar-btn:hover { transform:scale(1.08); }
.avatar-btn svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; }

.photo-preview { display:flex; justify-content:center; margin:14px 0 4px; }
.btn.ghost.danger { color:var(--alert); }
.btn.ghost.danger svg { width:14px; height:14px; margin-right:5px; fill:none;
  stroke:currentColor; stroke-width:1.9; vertical-align:-2px; }

/* ---------- account page ---------- */
.acc-card { max-width:460px; margin-bottom:12px; }
.acc-note { font-size:12px; margin:5px 0 11px; line-height:1.45; }
.acc-photo { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.acc-save-btn { margin-top:12px; min-height:44px; }

.home-row-card { align-items:flex-start; }
.home-row-main { min-width:0; flex:1; }
@media (max-width:640px){ .home-row-card { flex-direction:column; } }

/* ---------- user access management ---------- */
.admin-table { padding:4px 8px; }
.u-role { width:auto; }
.u-actions { text-align:right; white-space:nowrap; }
.access-count { font-variant-numeric:tabular-nums; font-size:12px; }
.ac-home { display:flex; align-items:center; gap:9px; padding:7px 2px; font-size:13px;
  cursor:pointer; border-bottom:1px solid var(--line-soft); }
.ac-home:last-of-type { border-bottom:0; }
.ac-home input { width:auto; margin:0; flex-shrink:0; }

/* ---------- team cards ---------- */
.team-card-head { align-items:flex-start; }
.team-card-body { flex:1; min-width:0; }
.cb-row { display:flex; align-items:center; gap:8px; margin-top:12px; font-size:13px; cursor:pointer; }
.cb-row input { width:auto; margin:0; flex-shrink:0; }
#h-entity-new[hidden] { display:none; }

/* ---------- entity grouping on the Homes list ----------
   With separate legal entities the grouping is the information: which
   registration a home sits under decides who is accountable for it. */
.entity-head { display:flex; align-items:baseline; justify-content:space-between;
  gap:10px; margin:16px 0 7px; padding-bottom:5px; border-bottom:1px solid var(--line); }
.entity-head:first-of-type { margin-top:4px; }
.entity-name { font-family:var(--display); font-weight:700; font-size:14px; color:var(--ink);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.entity-count { font-size:11px; color:var(--ink-faint); flex-shrink:0;
  font-variant-numeric:tabular-nums; }
.entity-group { margin-bottom:4px; }
.home-row-label { flex:1; min-width:0; }

.lbl-opt { font-weight:400; color:var(--ink-faint); text-transform:none; letter-spacing:0; font-size:10px; }

/* ---------- governance ---------- */
.gov-range { margin:12px 0 4px; }
.gov-row { align-items:center; }
.gov-row-main { flex:1; min-width:0; font-size:13px; }
tr.gov-due td { background:var(--alert-soft); }
.conf-list { margin:12px 0 4px; padding-left:20px; font-size:13px; line-height:1.6; }
.conf-list li { margin-bottom:7px; }
/* An undertaking that can be dismissed by clicking away is not an undertaking. */
.modal-overlay.no-dismiss { pointer-events:auto; }
.res-actions { margin:10px 0 2px; display:flex; gap:8px; flex-wrap:wrap; }

/* ---------- evidence documents ---------- */
.tr-grid3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:6px; }
@media (max-width:640px){ .tr-grid3 { grid-template-columns:1fr; } }
.doc-list { margin:4px 0 8px; }
.doc-row { display:flex; align-items:baseline; gap:9px; flex-wrap:wrap; padding:7px 0;
  border-bottom:1px solid var(--line-soft); font-size:12.5px; }
.doc-row:last-child { border-bottom:0; }
.doc-row a { color:var(--accent-deep); font-weight:600; }
.doc-row .muted { font-size:11.5px; }
.doc-row .doc-del { color:var(--alert); margin-left:auto; }
.doc-empty { font-size:12.5px; padding:6px 0; }
.team-actions { margin-top:10px; gap:7px; }

.ta-r { text-align:right; }

/* ---------- screen lock ----------
   Covers everything. The server refuses requests anyway, so this is presentation
   rather than protection — but it must look deliberate, not like a crash. */
.lock-overlay { position:fixed; inset:0; z-index:9000; display:flex;
  align-items:center; justify-content:center; padding:24px;
  background:var(--bg); }
.lock-card { width:100%; max-width:320px; text-align:center; }
.lock-mark { width:56px; height:56px; margin:0 auto 14px; border-radius:15px;
  background:var(--accent); color:var(--accent-ink); display:flex; align-items:center;
  justify-content:center; font-family:var(--display); font-weight:800; font-size:26px; }
.lock-sub { margin:5px 0 18px; font-size:13px; }
.pin-input { width:100%; text-align:center; font-family:var(--data);
  font-size:26px; letter-spacing:.5em; text-indent:.5em; padding:13px 0; }
.lock-err { min-height:20px; color:var(--alert); font-size:12.5px; font-weight:600;
  margin:9px 0 4px; }
.lock-go { width:100%; min-height:46px; }
.lock-switch { width:100%; margin-top:10px; min-height:46px; display:flex; align-items:center;
  justify-content:center; gap:8px; }
.lock-switch svg { width:20px; height:20px; }
.lock-hint { margin-top:8px; font-size:12px; }

/* ---------- rota ---------- */
.page-head { align-items:center; margin-bottom:4px; }
.duty-card { margin:12px 0; }
.duty-people { display:flex; flex-wrap:wrap; gap:14px; margin-top:10px; }
.duty-person { display:flex; align-items:center; gap:9px; }
.duty-name { font-weight:650; font-size:13px; }
.duty-meta { font-size:11.5px; }

.rota-nav { align-items:center; margin:14px 0 2px; }
.rota-range { font-family:var(--display); font-weight:700; font-size:14px; }
.rota-today { display:block; margin:0 0 10px; font-size:12px; }

.rota-week { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:8px; }
.rota-day { background:var(--surface); border:1px solid var(--line); border-radius:12px;
  padding:8px; min-height:96px; }
.rota-day.is-today { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent) inset; }
.rota-day-head { display:flex; justify-content:space-between; align-items:baseline;
  gap:5px; margin-bottom:7px; font-size:12px; }
.rota-day-head .muted { font-size:10.5px; }
.rota-shift { border-radius:8px; background:var(--sunken); padding:6px 7px; margin-bottom:6px;
  cursor:pointer; border-left:3px solid var(--accent); }
.rota-shift.overnight { border-left-color:var(--info); }
.rota-shift-top { display:flex; justify-content:space-between; align-items:baseline; gap:5px; }
.rota-time { font-family:var(--data); font-size:10.5px; font-weight:650;
  font-variant-numeric:tabular-nums; }
.plus1 { color:var(--info); font-weight:700; }
.rota-who { font-size:12px; font-weight:650; margin-top:2px; line-height:1.25; }
.rota-role { font-size:10.5px; line-height:1.25; }
.rota-del { color:var(--ink-faint); font-size:15px; line-height:1; padding:0 2px; }
.rota-del:hover { color:var(--alert); }
.rota-empty { color:var(--ink-faint); font-size:12px; text-align:center; padding:6px 0; }

/* On a phone the week becomes a list — seven columns of anything is unreadable
   at 390px, and the rota is checked on a phone more than anywhere else. */
@media (max-width:820px){
  .rota-week { grid-template-columns:1fr; }
  .rota-day { min-height:0; }
  .rota-day-head { border-bottom:1px solid var(--line-soft); padding-bottom:5px; }
}

/* ---------- manager overview ---------- */
.ov-hero { margin-bottom:14px; }
.ov-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; }
.ov-panel { display:flex; flex-direction:column; }
.ov-panel .spread { margin-bottom:9px; }
.ov-empty { font-size:12.5px; line-height:1.5; }
.ov-note { margin-top:9px; }
.ov-list { margin-top:4px; }
.ov-row { display:flex; justify-content:space-between; align-items:baseline; gap:10px;
  padding:6px 0; border-bottom:1px solid var(--line-soft); font-size:12.5px; }
.ov-row:last-child { border-bottom:0; }
.ov-row .mono { font-family:var(--data); font-variant-numeric:tabular-nums; font-weight:650; }
.ov-row .mono.warn { color:var(--due); }
.ov-row .mono.alert { color:var(--alert); }
.ov-courses { font-size:11.5px; text-align:right; }
.ov-figure { font-family:var(--display); font-size:28px; font-weight:750;
  font-variant-numeric:tabular-nums; margin:2px 0 2px; }
.ov-emar { display:block; text-align:center; margin:16px 0 4px; min-height:46px;
  line-height:30px; }

.acc-pin { gap:10px; align-items:center; flex-wrap:wrap; }

.photo-check { width:150px; height:150px; border-radius:18px; object-fit:cover;
  display:block; box-shadow:var(--shadow); }

/* ---------- repeating row editors (admission wizard) ----------
   These replaced pipe-separated textareas. Labels sit above each field so the
   order is visible rather than remembered. */
.wiz-hint { margin-bottom:10px; font-size:12.5px; line-height:1.5; }
.rowset { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end;
  padding:10px; margin-bottom:8px; border:1px solid var(--line); border-radius:12px;
  background:var(--surface-2); position:relative; }
.rowset-field { display:flex; flex-direction:column; gap:3px; min-width:96px; }
.rowset-field > span { font-size:10px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--ink-faint); font-weight:700; }
.rowset-field input, .rowset-field select { margin:0; }
.rowset-check { display:flex; align-items:center; gap:7px; font-size:12px;
  width:100%; cursor:pointer; }
.rowset-check input { width:auto; margin:0; flex-shrink:0; }
.rowset-del { position:absolute; top:4px; right:7px; color:var(--ink-faint);
  font-size:17px; line-height:1; padding:2px 4px; }
.rowset-del:hover { color:var(--alert); }
.rowset-add { width:100%; min-height:42px; }
@media (max-width:640px){
  .rowset-field { min-width:calc(50% - 4px); flex:1 1 calc(50% - 4px) !important; }
}

.tr-docs { margin-top:8px; padding-top:7px; border-top:1px solid var(--line-soft); }
.tr-docs .doc-row { padding:5px 0; font-size:12px; }

/* ---------- calendar ---------- */
.ev-row { width:100%; text-align:left; cursor:pointer; align-items:flex-start; }
.ev-main { flex:1; min-width:0; }
.ev-title { gap:8px; flex-wrap:wrap; align-items:center; }
.ev-notes { font-size:12px; margin-top:3px; }
.ev-repeat { display:inline-flex; color:var(--ink-faint); }
.ev-repeat svg { width:13px; height:13px; fill:none; stroke:currentColor; stroke-width:2;
  stroke-linecap:round; stroke-linejoin:round; }
.section-title.is-today { color:var(--accent-deep); }

/* ---------- change history ----------
   Before/after on separate lines, nested values as bullets. A care record is read
   by nurses and inspectors; JSON asks them to parse punctuation. */
.chg { align-items:flex-start; }
.chg-main { flex:1; min-width:0; }
.chg-head { display:flex; justify-content:space-between; align-items:baseline; gap:10px;
  flex-wrap:wrap; margin-bottom:5px; }
.chg-who { font-size:11.5px; white-space:nowrap; }
.chg-line { display:flex; gap:9px; align-items:flex-start; font-size:12.5px; margin-top:3px; }
.chg-label { flex:0 0 46px; font-size:10px; text-transform:uppercase; letter-spacing:.05em;
  font-weight:700; color:var(--ink-faint); padding-top:2px; }
.chg-val { flex:1; min-width:0; }
.chg-val.was { color:var(--ink-faint); text-decoration:line-through;
  text-decoration-thickness:1px; }
.chg-val.was .chg-key { text-decoration:none; }
.chg-list { margin:0; padding-left:16px; list-style:disc; }
.chg-list li { margin:1px 0; }
.chg-key { font-weight:650; }
.chg-key::after { content:":"; }
.chg-none { color:var(--ink-faint); font-style:italic; }

/* ============================================================================
   HERA · LEIGHTON HOUSE — brand layer
   Appended last so it overrides the Daybreak tokens above without editing them:
   navy from the Hera roundel, cyan from the feather. Status colours (given / due /
   alert / info) are deliberately unchanged — they carry clinical meaning and must
   read the same whatever the brand. Removing this block restores Daybreak.
   ========================================================================== */
:root {
  --bg:#EEF2F6; --surface:#FFFFFF; --surface-2:#F5F8FB; --sunken:#E3E9F0;
  --line:#D5DEE8; --line-soft:#E6ECF2;
  --ink:#0C2238; --ink-soft:#4A5E74; --ink-faint:#768799;

  --rail:#04172E; --rail-ink:#D6E8F5; --rail-ink-dim:#8EA8C2;
  --rail-active:#0E3157; --rail-line:#0B2645; --rail-hover:#0A2747;

  --sky:linear-gradient(118deg,#F4F9FD 0%,#EAF2F9 46%,#E2EDF6 100%);
  --arc-base:#CCD9E6; --sun:#16D2F2;

  /* White on #0E7FAF is 4.6:1, so accent buttons stay legible. */
  --accent:#0E7FAF; --accent-deep:#095E83; --accent-soft:#DCF0F8; --accent-ink:#FFFFFF;

  --shadow:0 1px 2px rgba(4,23,46,.05);
  --shadow-raise:0 2px 4px rgba(4,23,46,.06), 0 6px 14px -8px rgba(4,23,46,.16);
  --shadow-lift:0 18px 44px -14px rgba(4,23,46,.36), 0 2px 8px rgba(4,23,46,.08);

  --brand-navy:#04172E; --brand-cyan:#16D2F2;
}

[data-theme="nocturne"] {
  --bg:#050F1C; --surface:#0A1828; --surface-2:#0E1F33; --sunken:#08131F;
  --line:#1B3049; --line-soft:#13253A;
  --ink:#E8F1F8; --ink-soft:#9DB3C8; --ink-faint:#6E8499;

  --rail:#020B16; --rail-ink:#BCD3E6; --rail-ink-dim:#5F7A93;
  --rail-active:#0F2B4A; --rail-line:#0C1D31; --rail-hover:#0C2239;

  --sky:linear-gradient(118deg,#071426 0%,#0A1828 58%,#0E1F33 100%);
  --arc-base:#1D3450; --sun:#5FE0F5;

  --accent:#5FD0F0; --accent-deep:#38B6DE; --accent-soft:#0F2A3E; --accent-ink:#04172E;
}

/* The feather is an <img>, so it no longer inherits currentColor. */
img.hera-glyph { display:block; height:78%; width:auto; object-fit:contain;
  -webkit-user-select:none; user-select:none; pointer-events:none; }

.brand-mark { background:var(--brand-navy); color:var(--brand-cyan);
  box-shadow:inset 0 0 0 1.5px var(--brand-cyan); }
.rail-home:hover { color:var(--brand-navy); }
.bell-dot { color:var(--brand-navy); }
.lock-mark { background:var(--brand-navy); box-shadow:inset 0 0 0 2px var(--brand-cyan); }

/* ---------- sign-in: Hera roundel above the card, home named on it ---------- */
.login-wrap { background:var(--brand-navy); align-items:flex-start;
  padding:max(28px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
@media (min-height:700px){ .login-wrap { align-items:center; } }
.login-bg { background:
  radial-gradient(70% 45% at 50% 18%, rgba(22,210,242,.16) 0%, rgba(22,210,242,0) 70%),
  radial-gradient(120% 85% at 50% 8%, #0B2A52 0%, #061D3A 46%, #03112A 100%); }

.login-logo { display:block; width:clamp(150px, 46vw, 196px); height:auto; aspect-ratio:1;
  margin:0 auto 18px; position:relative; z-index:2;
  filter:drop-shadow(0 12px 28px rgba(0,0,0,.45)) drop-shadow(0 0 22px rgba(22,210,242,.22));
  -webkit-user-select:none; user-select:none; }

.login-card { padding:26px 26px 24px; border-top:3px solid var(--brand-cyan); }
@media (max-width:400px){ .login-card { padding:22px 20px 22px; } }

.login-home { font-family:var(--display); font-size:clamp(24px, 7.2vw, 30px); font-weight:800;
  letter-spacing:-.02em; color:#0C2238; margin:0; line-height:1.1; }
.login-sub { font-size:13px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:#0E7FAF; margin:6px 0 20px; }

.login-card input { border-color:#9FB4CA; }
.login-card input:focus { border-color:#0E7FAF; box-shadow:0 0 0 3px rgba(14,127,175,.2); }
.login-go { background:linear-gradient(180deg,#0B2A52,#04172E); color:#FFFFFF;
  border:1.5px solid var(--brand-cyan); }
.login-go:hover { background:linear-gradient(180deg,#0E3462,#071F3D); }
.login-go:active { transform:translateY(1px); }

/* ---------- photo source: camera or file ---------- */
.photo-source { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:16px 0 4px; }
.photo-source-btn { display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px; min-height:104px; padding:14px 10px; border-radius:var(--r-card);
  background:var(--surface-2); border:1.5px solid var(--line); color:var(--ink);
  font-weight:700; font-size:14px; }
.photo-source-btn svg { width:30px; height:30px; color:var(--accent); }
.photo-source-btn:hover, .photo-source-btn:focus-visible { border-color:var(--accent); background:var(--accent-soft); }
.photo-source-btn:active { transform:scale(.98); }

/* ---------- camera viewfinder ----------
   Square, with the video covering it: what is on screen is exactly the square the
   avatar keeps (prepareImage takes the same centre crop). */
.cam-frame { position:relative; margin:14px auto 6px; width:100%; max-width:min(420px, 62vh);
  aspect-ratio:1; border-radius:var(--r-card); overflow:hidden; background:#000;
  box-shadow:inset 0 0 0 2px var(--brand-cyan, var(--accent)); }
.cam-frame video { width:100%; height:100%; object-fit:cover; display:block; }
.cam-frame video.mirror { transform:scaleX(-1); }
.cam-fallback { flex-wrap:wrap; gap:8px; margin-top:10px; }
#cam-switch svg, #cam-shot svg { width:18px; height:18px; }

/* ===================================================================
   October 2026: identifiers, PRN, notes entered in error, care plan,
   wound body maps. Tokens only, so Daybreak and Nocturne both work.
   =================================================================== */
.check-row { display:flex; align-items:center; gap:8px; margin-top:10px; font-size:13px; color:var(--ink);
  text-transform:none; letter-spacing:normal; font-weight:500; line-height:1.35; }
.check-row input { width:auto; margin:0; }
.grid3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.late { color:var(--alert); font-weight:650; }
.cp-label { display:block; font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-faint); margin-bottom:2px; }
.flash { box-shadow:0 0 0 3px var(--accent) !important; transition:box-shadow .3s; }

/* identifiers */
.ids-card { margin-top:12px; }
.ids-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 18px; margin-top:10px; }
@media (max-width:640px){ .ids-grid { grid-template-columns:1fr; } }

/* notes entered in error: struck through, never hidden */
.note-voided .note-text { text-decoration:line-through; color:var(--ink-faint); }
.note-voided .pill { opacity:.6; }
.note-void-why { font-size:12px; color:var(--alert); margin-top:4px; }

/* PRN */
.prn-card { border-left:3px solid var(--due); }
.prn-ind { margin-top:6px; font-size:13px; }
.prn-ind .cp-label { display:inline; margin-right:4px; }
.prn-row { align-items:flex-start; }
.prn-row-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; font-size:13px; }
.prn-protocol { margin:10px 0; background:var(--surface-2); }
.prn-protocol .cp-label { display:inline; margin-right:4px; }
.seg { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
.seg .chip-btn { min-height:40px; padding:0 14px; }

/* care plan */
.cp-head .cp-meta { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px 18px; margin-top:12px; font-size:13.5px; }
.about-me { margin-top:12px; }
.am-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 18px; margin:10px 0 6px; }
.am-item { font-size:13.5px; }
.am-key { grid-column:1 / -1; background:var(--accent-soft); border-radius:10px; padding:10px 12px; }
@media (max-width:640px){ .am-grid { grid-template-columns:1fr; } }
.cps-title { margin-top:22px; text-transform:none; letter-spacing:0; }
.cps-title span { text-transform:uppercase; letter-spacing:.06em; }
.cps-card { border-left:3px solid var(--given); }
.cps-card.cps-overdue { border-left-color:var(--alert); }
.cps-card.cps-resolved { border-left-color:var(--line); opacity:.8; }
.cps-head { margin-bottom:8px; }
.cps-domain { font-family:var(--display); font-size:15.5px; }
.cps-due { font-size:12px; color:var(--ink-soft); font-weight:600; }
.cps-due.late { color:var(--alert); }
.cps-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 18px; }
.cps-field { font-size:13.5px; }
.cps-support { grid-column:1 / -1; background:var(--surface-2); border-radius:10px; padding:10px 12px; }
.cps-text { white-space:pre-wrap; line-height:1.45; color:var(--ink); }
.cps-foot { margin-top:10px; padding-top:8px; border-top:1px solid var(--line-soft); }
.cps-mini { margin:10px 0; background:var(--surface-2); font-size:13px; }
@media (max-width:640px){ .cps-grid { grid-template-columns:1fr; } }
.cpr-row { align-items:flex-start; }
.cpr-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; font-size:13.5px; }

/* body map */
.bm-wrap { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,1fr); gap:18px; align-items:start; }
@media (max-width:760px){ .bm-wrap { grid-template-columns:1fr; } }
.bm-maps { display:grid; grid-template-columns:1fr 1fr; gap:10px; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r-card, 16px); padding:12px 10px 6px; }
.bm-fig { margin:0; text-align:center; }
.bm-fig figcaption { font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-faint); margin-top:2px; }
.bm-svg { width:100%; max-height:min(58vh, 470px); touch-action:manipulation; cursor:crosshair; display:block; margin:0 auto; }
.bm-body { fill:var(--surface-2); stroke:var(--ink-faint); stroke-width:1.4; }
.bm-guide { fill:none; stroke:var(--line); stroke-width:1.1; stroke-linecap:round; }
.bm-guide-dot { fill:var(--line); }
.bm-side { font-size:11px; font-weight:700; fill:var(--ink-faint); font-family:var(--display); }
.bm-mark { cursor:pointer; }
.bm-mark circle { stroke:#fff; stroke-width:1.6; }
.bm-mark text { font-size:9.5px; font-weight:800; fill:#fff; pointer-events:none; font-family:var(--display); }
.bm-mark.pu circle { fill:#B3261E; } .bm-mark.tear circle { fill:#C26A00; }
.bm-mark.bruise circle { fill:#6E4AA8; } .bm-mark.other circle { fill:#1F6FB2; }
.bm-mark.healed circle { fill:var(--surface); stroke:var(--ink-faint); stroke-dasharray:2 2; }
.bm-mark.healed text { fill:var(--ink-faint); }
.bm-mark:focus-visible circle { stroke:var(--accent); stroke-width:3; }
.bm-hint { font-size:13.5px; background:var(--accent-soft); border-radius:12px; padding:10px 12px; line-height:1.45; }
.bm-key { display:flex; flex-wrap:wrap; gap:6px 14px; margin:12px 0; font-size:12px; color:var(--ink-soft); }
.bm-key i { display:inline-block; width:11px; height:11px; border-radius:50%; margin-right:5px; vertical-align:-1px; }
.bm-key i.pu { background:#B3261E; } .bm-key i.tear { background:#C26A00; } .bm-key i.bruise { background:#6E4AA8; }
.bm-key i.other { background:#1F6FB2; } .bm-key i.healed { border:1.5px dashed var(--ink-faint); }
.bm-kpis { grid-template-columns:1fr 1fr !important; margin:0 0 6px; }

/* wound cards */
.w-card { scroll-margin:90px; }
.w-card.w-healed { opacity:.75; }
.w-head { display:flex; gap:10px; align-items:flex-start; }
.w-title { flex:1; min-width:0; font-size:14px; }
.w-num { flex-shrink:0; width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:800; font-size:13px; font-family:var(--display); }
.w-num.pu { background:#B3261E; } .w-num.tear { background:#C26A00; } .w-num.bruise { background:#6E4AA8; }
.w-num.other { background:#1F6FB2; } .w-num.healed { background:var(--surface); color:var(--ink-faint); border:1.5px dashed var(--ink-faint); }
.w-latest, .w-plan { margin-top:8px; font-size:13.5px; }
.w-latest .cp-label, .w-plan .cp-label { display:inline; margin-right:4px; }
.w-trend { display:inline-block; font-size:12px; font-weight:650; margin-left:4px; }
.w-trend.better { color:var(--given); } .w-trend.worse { color:var(--alert); } .w-trend.same { color:var(--ink-soft); }
.w-acts { margin-top:10px; }
.w-acts svg { width:15px; height:15px; }
.w-hist { margin-top:10px; border-top:1px solid var(--line-soft); padding-top:6px; }
.w-hist[hidden] { display:none; }
.w-hist-row { display:flex; gap:10px; padding:8px 0; border-bottom:1px solid var(--line-soft); font-size:13px; }
.w-hist-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.w-photo { padding:0; border:1px solid var(--line); border-radius:8px; overflow:hidden; width:64px; height:64px; flex-shrink:0; background:var(--sunken); }
.w-photo img { width:100%; height:100%; object-fit:cover; display:block; }
.w-photo-big { display:block; width:100%; max-height:70vh; object-fit:contain; border-radius:10px; margin-top:10px; background:#000; }

@media print {
  .bm-svg { max-height:none; }
  .cps-card, .w-card, .about-me, .cp-head { break-inside:avoid; }
  .tabs, .res-actions, .backlink { display:none !important; }
}

/* Username cell on the Users screen: tappable to rename. */
.link-btn { background:none; border:0; padding:2px 0; color:var(--ink); cursor:pointer; font:inherit; text-align:left; }
.link-btn:hover .mono { text-decoration:underline; }

/* ---------- tablet battery (kiosk apps hide the status bar) ---------- */
.batt { display:inline-flex; align-items:center; gap:4px; font-size:11.5px; font-weight:700; color:inherit;
  font-variant-numeric:tabular-nums; line-height:1; }
.batt[hidden] { display:none; }
.batt svg { width:24px; height:13px; flex-shrink:0; }
.batt .batt-shell { fill:none; stroke:currentColor; stroke-width:1.5; opacity:.85; }
.batt .batt-nub { fill:currentColor; opacity:.85; }
.batt .batt-fill { fill:currentColor; }
.batt .batt-bolt { fill:#FFFFFF; stroke:#04172E; stroke-width:.6; }
.batt.low { color:#F2B544; }
.batt.crit { color:#FF6B5E; animation:batt-pulse 1.6s ease-in-out infinite; }
.batt.charging { color:#5FD38D; }
@keyframes batt-pulse { 50% { opacity:.45; } }
.rail-foot .rail-batt { flex-direction:column; gap:3px; color:rgba(255,255,255,.82); margin-bottom:4px; font-size:10.5px; }
.rail-foot .rail-batt.low { color:#F2B544; } .rail-foot .rail-batt.crit { color:#FF6B5E; } .rail-foot .rail-batt.charging { color:#5FD38D; }
.topbar .top-batt { margin-right:4px; }
.lock-batt, .login-batt { justify-content:center; margin-top:14px; color:var(--ink-soft); font-size:13px; }
.lock-batt.low, .login-batt.low { color:#A6710F; } .lock-batt.crit, .login-batt.crit { color:#B3261E; }
.lock-batt.charging, .login-batt.charging { color:#2E7D4F; }
.login-batt { display:flex; color:#4A5D72; }
@media print { .batt { display:none !important; } }
.toast.toast-warn svg { color:#F2B544; }

/* ---------- Learning: in-house courses, competency sign-off, certificates ---------- */
.card-title { display:flex; align-items:center; gap:8px; font-size:15px; font-weight:700; margin:0 0 10px; }
.card-title svg { width:18px; height:18px; color:var(--due); }
.learn-assess { margin-bottom:18px; border-left:4px solid var(--due); }
.assess-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-top:1px solid var(--line-soft); }
.assess-row:first-of-type { border-top:0; }
.learn-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:14px; margin-bottom:22px; }
.learn-card { display:flex; flex-direction:column; gap:8px; }
.learn-card h3 { margin:0; font-size:17px; font-family:var(--display); }
.learn-card p { margin:0; color:var(--ink-soft); font-size:13.5px; line-height:1.5; flex:1; }
.learn-icon { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent-deep); }
.learn-icon svg { width:22px; height:22px; }
.learn-meta { font-size:12px; }
.learn-status { margin-top:2px; }
.learn-go { align-self:flex-start; margin-top:4px; text-decoration:none; }
.cert-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-top:1px solid var(--line-soft); }
.cert-row:first-child { border-top:0; }
.cert-row.revoked .cert-main b { text-decoration:line-through; }
.cert-main { display:flex; flex-direction:column; gap:3px; min-width:0; }
.cert-main .muted { font-size:12px; }
.btn.small svg { width:15px; height:15px; margin-right:5px; vertical-align:-3px; }
.learn-foot { margin-top:18px; font-size:12px; }
.learn-progress { height:6px; border-radius:99px; background:var(--sunken); overflow:hidden; margin:4px 0 16px; }
.learn-progress span { display:block; height:100%; background:var(--accent); border-radius:99px; transition:width .25s; }
.learn-reading { max-width:760px; font-size:15px; line-height:1.65; }
.learn-reading h2 { font-family:var(--display); font-size:21px; margin:0 0 10px; }
.learn-reading h4 { font-size:14px; margin:16px 0 6px; color:var(--accent-deep); }
.learn-reading p { margin:0 0 10px; }
.learn-reading ul, .learn-reading ol { margin:0 0 10px; padding-left:20px; }
.learn-reading li { margin-bottom:6px; }
.learn-nav { display:flex; justify-content:space-between; gap:10px; max-width:760px; margin:16px 0 30px; }
.learn-quiz { max-width:760px; display:flex; flex-direction:column; gap:12px; }
.quiz-q { border:1px solid var(--line); margin:0; }
.quiz-q legend { font-weight:600; font-size:15px; line-height:1.45; padding:0; display:flex; gap:10px; margin-bottom:8px; float:left; width:100%; }
.quiz-q legend + * { clear:both; }
.quiz-n { flex:none; width:26px; height:26px; border-radius:50%; background:var(--accent-soft); color:var(--accent-deep); display:grid; place-items:center; font-size:12.5px; font-weight:700; }
.quiz-opt { display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border:1px solid var(--line-soft); border-radius:10px; margin-top:7px;
  cursor:pointer; font-size:14px; line-height:1.45; text-transform:none; letter-spacing:0; font-weight:400; color:var(--ink); clear:both; }
.quiz-opt input { margin-top:3px; flex:none; width:18px; height:18px; accent-color:var(--accent); }
.quiz-opt:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); }
.learn-result { max-width:760px; padding:24px 22px; }
.learn-result .learn-score, .learn-result h2 { text-align:center; }
.learn-result.pass { border-top:5px solid var(--given); }
.learn-result.fail { border-top:5px solid var(--due); }
.learn-result h2 { font-family:var(--display); margin:10px 0; }
.learn-result ul { padding-left:20px; }
.learn-score span { font-size:46px; font-weight:800; font-family:var(--display); display:block; line-height:1; }
.learn-score small { color:var(--ink-soft); }
.quiz-review { max-width:760px; margin-bottom:8px; display:flex; flex-direction:column; gap:4px; font-size:13.5px; border-left:4px solid var(--given); }
.quiz-review.bad { border-left-color:var(--alert); }
.assess-list { display:flex; flex-direction:column; gap:4px; margin:6px 0 12px; }
.learn-banner { text-decoration:none; color:inherit; }
@media (max-width: 640px) {
  .assess-row, .cert-row { flex-direction:column; align-items:flex-start; }
  .learn-nav { position:sticky; bottom:calc(64px + env(safe-area-inset-bottom)); background:var(--bg); padding:10px 0; margin-bottom:10px; }
}
.ho-banner.soon { background:var(--due-soft); color:var(--due); border-color:var(--due); }
.ho-banner a { color:inherit; font-weight:700; }
.learn-aud { font-size:12px; font-weight:700; color:var(--accent-deep); }
.learn-summary { display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:6px; }
.ls-main { display:flex; align-items:center; gap:12px; font-size:14px; color:var(--ink-soft); }
.ls-big { font-family:var(--display); font-size:32px; font-weight:800; color:var(--ink); line-height:1; }
.ls-big small { font-size:16px; color:var(--ink-faint); }
.ls-pills { display:flex; gap:6px; flex-wrap:wrap; }
.learn-ext > p { margin:0 0 6px; font-size:13px; }
.ext-row { display:flex; justify-content:space-between; gap:14px; padding:11px 0; border-top:1px solid var(--line-soft); align-items:flex-start; }
.ext-row .muted { font-size:12.5px; line-height:1.45; margin-top:2px; }
.ext-status { flex:none; }
@media (max-width: 640px) { .ext-row { flex-direction:column; } }

/* ---------- controlled-drug witness ---------- */
.wit-card { display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:10px; border-left:4px solid var(--due); }
.wit-main { display:flex; flex-direction:column; gap:3px; font-size:14px; }
.wit-actions { display:flex; gap:8px; flex-wrap:wrap; }
.wit-ok { color:var(--given); font-weight:800; }
@media (max-width: 640px) { .wit-card { flex-direction:column; align-items:flex-start; } }

/* ---------- spreadsheet import ---------- */
.imp-step { display:flex; gap:14px; align-items:flex-start; margin-bottom:12px; max-width:820px; }
.imp-step p { margin:4px 0 10px; font-size:13px; }
.imp-n { flex:none; width:30px; height:30px; border-radius:50%; background:var(--accent-soft); color:var(--accent-deep); display:grid; place-items:center; font-weight:800; }
.imp-step input[type=file] { max-width:320px; font-size:13px; }
.imp-summary { margin:16px 0; }
.imp-summary.ok { border-top:5px solid var(--given); }
.imp-summary.bad { border-top:5px solid var(--alert); }
.imp-summary h2 { font-family:var(--display); margin:0 0 10px; font-size:19px; }
.imp-counts { display:flex; gap:22px; flex-wrap:wrap; margin-bottom:12px; }
.imp-counts div { display:flex; flex-direction:column; }
.imp-counts b { font-size:26px; font-family:var(--display); line-height:1.1; }
.imp-counts span { font-size:12px; color:var(--ink-soft); }
.imp-issues { display:flex; flex-direction:column; border:1px solid var(--line); border-radius:10px; overflow:hidden; margin:8px 0; }
.imp-issue { display:grid; grid-template-columns:minmax(150px, 30%) 1fr; gap:12px; padding:8px 12px; font-size:13px; border-top:1px solid var(--line-soft); }
.imp-issue:first-child { border-top:0; }
.imp-issues.err .imp-where { color:var(--alert); font-weight:700; }
.imp-issues.warn .imp-where { color:var(--due); font-weight:700; }
.imp-summary details summary { cursor:pointer; font-weight:600; font-size:13px; margin-top:8px; }
.tbl-wrap { overflow-x:auto; }
.imp-table { width:100%; border-collapse:collapse; font-size:13px; }
.imp-table th { text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.4px; color:var(--ink-soft); padding:6px 8px; border-bottom:1px solid var(--line); }
.imp-table td { padding:7px 8px; border-bottom:1px solid var(--line-soft); vertical-align:top; }
.imp-table tr.skipped td { color:var(--ink-faint); }
.imp-allergy { color:var(--alert); font-weight:600; }
.imp-go { display:flex; flex-direction:column; gap:10px; }
.imp-done { display:flex; justify-content:space-between; text-decoration:none; color:inherit; }
@media (max-width: 640px) { .imp-issue { grid-template-columns:1fr; gap:2px; } .imp-step { flex-direction:column; } }

/* Staff sign-in details after an import, and the printable slips */
.imp-note { margin:10px 0 0; font-size:12.5px; }
.imp-creds .imp-cred-actions { margin:12px 0; }
.imp-pw { font-size:14px; letter-spacing:.5px; }
#print-slips { display:none; }
@media print {
  body.printing-slips > *:not(#print-slips) { display:none !important; }
  body.printing-slips { background:#fff !important; }
  body.printing-slips #print-slips { display:grid; grid-template-columns:1fr 1fr; gap:0; }
  .slip { border:1px dashed #888; padding:14px 16px; break-inside:avoid; font-family:Arial, sans-serif; color:#000; min-height:62mm; }
  .slip-head { font-size:10px; text-transform:uppercase; letter-spacing:1px; color:#555; margin-bottom:6px; }
  .slip-name { font-size:16px; font-weight:700; margin-bottom:10px; }
  .slip-name span { font-weight:400; font-size:12px; color:#444; margin-left:6px; }
  .slip-row { display:flex; justify-content:space-between; gap:10px; font-size:12px; padding:4px 0; border-bottom:1px solid #ddd; }
  .slip-row b { font-family:"Courier New", monospace; font-size:14px; word-break:break-all; text-align:right; }
  .slip-pw { font-size:16px !important; letter-spacing:1px; }
  .slip-foot { font-size:10px; color:#444; margin-top:8px; line-height:1.35; }
}

/* Daily activities on the note form */
.act-box { margin:10px 0 4px; border:1px solid var(--line); border-radius:12px; padding:8px 12px; background:var(--surface, #fff); }
.act-box summary { cursor:pointer; padding:4px 0; font-size:14px; }
.act-cat { margin-top:10px; }
.act-cat-name { font-size:11.5px; font-weight:700; letter-spacing:.4px; text-transform:uppercase; color:var(--ink-soft); margin-bottom:6px; }
.act-chips, .act-outs { display:flex; flex-wrap:wrap; gap:6px; }
.act-list { margin-top:12px; display:flex; flex-direction:column; gap:10px; }
.act-row { border-top:1px solid var(--line-soft); padding-top:10px; }
.act-row-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.act-out.refuse.on { background:var(--clay, #B3261E); border-color:var(--clay, #B3261E); color:#fff; }
.act-detail { margin-top:8px; width:100%; }
.act-line { display:flex; flex-wrap:wrap; gap:5px; margin-top:5px; }
.act-pill { font-size:11.5px; font-weight:600; padding:2px 8px; border-radius:999px; background:var(--accent-soft); color:var(--accent-deep); }
.act-pill.refused { background:#FBE3E0; color:#9A2B1F; }
.act-pill.notposs { background:#FFF1D6; color:#8A5A00; }
.act-pill.notneed { background:var(--line-soft); color:var(--ink-soft); }
.act-why { font-size:12px; color:var(--ink-soft); margin-top:3px; }

/* Possessions */
.poss-head { margin-bottom:8px; }
.check-row.small { font-size:12.5px; }
.form-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:0 12px; }
@media (max-width:560px) { .form-grid2 { grid-template-columns:1fr; } }

/* Reports */
.rep-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(250px, 1fr)); gap:12px; margin:14px 0 6px; }
.rep-card { display:flex; flex-direction:column; gap:6px; text-decoration:none; color:inherit; transition:transform .15s ease; }
.rep-card:hover { transform:translateY(-2px); }
.rep-card b { font-size:15px; }
.rep-controls .flex { gap:12px; align-items:flex-end; }
.rep-f { display:flex; flex-direction:column; font-size:12px; color:var(--ink-soft); gap:4px; }
.rep-f input, .rep-f select { min-width:140px; }
.rep-actions { margin-left:auto; display:flex; gap:6px; }
.rep-meta { margin:12px 0 0; }
.rep-table td { font-size:12.5px; }
.rep-none { margin:4px 0 12px; }
@media print { .rep-table td, .rep-table th { font-size:9pt; } }

.bk-offsite { margin:10px 0 12px; display:flex; flex-direction:column; gap:6px; align-items:flex-start; }

/* Help and support */
.help-tabs a { padding:10px 13px; min-height:42px; color:var(--ink-soft); font-weight:500; text-decoration:none; border-bottom:2px solid transparent; display:inline-flex; align-items:center; }
.help-tabs a.active { color:var(--ink); border-bottom-color:var(--accent); font-weight:700; }
.help-search { width:100%; max-width:560px; margin:14px 0; font-size:15px; }
.help-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:12px; }
.help-topic { display:flex; flex-direction:column; gap:6px; text-decoration:none; color:inherit; transition:transform .15s ease; }
.help-topic:hover { transform:translateY(-2px); }
.help-topic b { font-size:15px; }
.help-for { font-size:11.5px; font-weight:600; color:var(--accent-deep); }
.help-hit { display:flex; flex-direction:column; align-items:flex-start; text-align:left; gap:4px; text-decoration:none; color:inherit; }
.help-hit mark { background:var(--amber-soft, #FFF1C2); color:inherit; border-radius:3px; padding:0 2px; }
.help-jump { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0 12px; }
.help-article { line-height:1.6; font-size:15px; max-width:860px; }
.help-article h3 { font-family:var(--display); font-size:18px; margin:22px 0 8px; scroll-margin-top:80px; }
.help-article h3:first-child { margin-top:4px; }
.help-article p { margin:0 0 10px; }
.help-article ol, .help-article ul { padding-left:22px; margin:0 0 12px; }
.help-article li { margin:0 0 6px; }
.help-article figure { margin:12px 0 16px; text-align:center; }
.help-article figure img { max-width:100%; max-height:520px; border:1px solid var(--line); border-radius:12px; }
.help-article figcaption { font-size:12.5px; color:var(--ink-soft); margin-top:6px; font-style:italic; }
.help-article table { width:100%; border-collapse:collapse; font-size:13.5px; margin:8px 0 14px; }
.help-article th { text-align:left; background:var(--surface-2); padding:7px 9px; }
.help-article td { border-top:1px solid var(--line-soft); padding:7px 9px; vertical-align:top; }
.help-article li[data-checked] { list-style:none; margin-left:-18px; }
.help-article li[data-checked] p { display:flex; gap:8px; }
.help-article .box { flex:none; width:15px; height:15px; border:1.5px solid var(--accent); border-radius:3px; margin-top:4px; }
.help-nav { margin:14px 0; max-width:860px; }
.help-cta { display:flex; flex-wrap:wrap; gap:10px; align-items:center; max-width:860px; }
.tk-row { align-items:flex-start; }
.tk-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.tk-desc { white-space:pre-wrap; font-size:13.5px; margin-top:4px; }
.tk-reply { background:var(--accent-soft); border-radius:10px; padding:8px 10px; font-size:13.5px; margin-top:4px; }
.tk-mail { color:var(--clay, #B3261E); }
.tk-email { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:10px; }
.error-text { color:var(--clay, #B3261E); font-size:12.5px; }
.help-train{display:flex;flex-direction:column;gap:4px;margin:0 0 14px;text-decoration:none;color:inherit;border-left:4px solid var(--cyan, #56D0E0)}

/* ---------- printing (print dialog, printer chooser) ---------- */
.pr-paper { display:flex; align-items:center; gap:8px; color:var(--ink-soft); font-size:13.5px; margin:4px 0 12px; }
.pr-paper svg, .res-actions svg, .pr-item > svg, .pr-searching svg { width:18px; height:18px; flex:none; }
.res-actions .btn svg { margin-right:6px; vertical-align:-3px; }
.pr-printer { padding:12px 14px; margin-bottom:12px; }
.pr-printer b { font-size:16px; }
.pr-state { font-size:13px; margin-top:4px; }
.pr-copies { gap:8px; align-items:center; margin-bottom:12px; }
.pr-copies input { width:72px; text-align:center; min-height:var(--tap); }
.pr-copies .btn { min-width:var(--tap); min-height:var(--tap); font-size:20px; }
.pr-how { font-size:13.5px; margin-bottom:10px; }
.pr-note { display:flex; gap:8px; align-items:flex-start; font-size:12.5px; color:var(--ink-soft); background:var(--surface-2); border-radius:10px; padding:9px 11px; margin:6px 0 4px; }
.pr-note svg { width:16px; height:16px; flex:none; margin-top:1px; color:var(--due); }
.pr-progress { margin-top:10px; padding:10px 12px; border-radius:10px; background:var(--info-soft); font-size:14px; }
.pr-progress.bad { background:var(--alert-soft); }
.pr-retry { gap:8px; margin-top:8px; flex-wrap:wrap; }
.pr-list { max-height:min(52vh, 420px); overflow:auto; margin:8px 0; }
.pr-item { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; text-align:left; cursor:pointer; min-height:var(--tap); font:inherit; color:inherit; }
.pr-item.on { border-color:var(--given); box-shadow:inset 3px 0 0 var(--given); }
.pr-item .muted { font-size:12.5px; }
.pr-searching { display:flex; gap:8px; align-items:center; padding:8px 2px; }
.pr-searching svg { animation:pr-pulse 1.2s ease-in-out infinite; }
@keyframes pr-pulse { 50% { opacity:.35; } }
@media (prefers-reduced-motion: reduce) { .pr-searching svg { animation:none; } }
.pr-manual { margin:6px 0; font-size:14px; }
.pr-manual summary { cursor:pointer; color:var(--ink-soft); padding:6px 0; }
.pr-manual .flex { gap:8px; margin-top:6px; }
.pr-manual input { flex:1; min-width:0; }

/* ---------- demo build (Ashdown Lodge) ---------- */
.login-demo { margin-top:14px; background:rgba(255,255,255,.96); border-radius:18px; padding:16px 16px 14px; color:#0E1F33;
  box-shadow:0 18px 44px -20px rgba(3,14,30,.7); text-align:left; }
.login-demo-head { display:flex; flex-direction:column; gap:3px; margin-bottom:10px; }
.login-demo-head b { font-size:12px; letter-spacing:.09em; text-transform:uppercase; color:#1B4A85; }
.login-demo-head span { font-size:13px; line-height:1.4; color:#41566F; }
.login-demo-list { display:flex; flex-direction:column; gap:7px; }
.login-demo-btn { display:grid; grid-template-columns:auto 1fr; column-gap:10px; row-gap:1px; align-items:baseline; text-align:left; width:100%;
  min-height:48px; padding:9px 12px; border-radius:11px; border:1.5px solid #D5E0EC; background:#F6F9FC; color:#0E1F33; font:inherit; cursor:pointer; }
.login-demo-btn:hover, .login-demo-btn:focus-visible { border-color:#1B4A85; background:#EEF4FB; }
.login-demo-btn .ld-role { grid-row:1 / span 2; align-self:center; font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase;
  color:#fff; background:#1B4A85; border-radius:6px; padding:4px 7px; width:96px; text-align:center; line-height:1.25; }
.login-demo-btn .ld-name { font-weight:800; font-size:14.5px; }
.login-demo-btn .ld-what { font-size:12px; color:#52677F; line-height:1.3; }
.login-demo-foot { margin-top:10px; font-size:12px; color:#41566F; }
.login-demo-foot code { background:#EEF4FB; border-radius:5px; padding:1px 6px; font-size:12.5px; color:#0E1F33; }
.demo-card { margin-top:16px; max-width:860px; }
.demo-card h2 { margin-top:0; }
.demo-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:10px; margin:10px 0 12px; }
.demo-stats div { background:var(--surface-2); border-radius:10px; padding:9px 11px; display:flex; flex-direction:column; gap:2px; }
.demo-stats span { font-size:12px; color:var(--ink-soft); }

/* ---------- Account: access by role ---------- */
.access-card { max-width:860px; }
.access-area { margin:16px 0 4px; font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); }
.access-table { width:100%; border-collapse:collapse; font-size:13.5px; }
.access-table thead, .access-table thead tr, .access-table th { position:static; top:auto; background:transparent; }
.access-table th { font-size:11.5px; font-weight:700; color:var(--ink-soft); text-align:center; padding:4px 2px; width:64px; }
.access-table th:first-child { width:auto; }
.access-table td { padding:7px 4px; border-top:1px solid var(--line, rgba(0,0,0,.08)); vertical-align:middle; }
.access-table td:not(:first-child) { text-align:center; }
.access-cb { width:22px; height:22px; min-height:0; margin:0; accent-color:var(--accent); }
@media (max-width:520px){ .access-table th { width:48px; font-size:10.5px; } .access-table { font-size:12.5px; } }

/* amending allergies and conditions */
.cond-head{margin:14px 0 8px}
.cd-rows{display:flex;flex-direction:column;gap:8px;margin:10px 0}
.cd-row{display:grid;grid-template-columns:120px 1fr 1fr auto;gap:6px;align-items:center;padding:6px;border-radius:10px}
.cd-row.is-allergy{background:var(--clay-bg)}
.cd-row input,.cd-row select{margin:0}
.cd-add{flex-wrap:wrap;gap:6px;margin-bottom:6px}
@media (max-width:560px){.cd-row{grid-template-columns:1fr auto}.cd-row .cd-desc,.cd-row .cd-sev{grid-column:1 / span 2}.cd-row .cd-del{grid-row:1;grid-column:2}}

/* photographs of possessions */
.ps-thumb{position:relative;display:inline-block;width:52px;height:52px;padding:0;border:1px solid var(--line, #d5dde8);border-radius:8px;overflow:hidden;background:#fff;cursor:pointer}
.ps-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.ps-thumb span{position:absolute;right:2px;bottom:2px;min-width:18px;padding:0 4px;border-radius:9px;background:rgba(4,23,46,.85);color:#fff;font-size:11px;font-weight:700;line-height:18px;text-align:center}
.pp-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:10px;margin:12px 0}
.pp-cell{margin:0}
.pp-open{display:block;width:100%;aspect-ratio:1;padding:0;border:1px solid var(--line, #d5dde8);border-radius:10px;overflow:hidden;background:#fff;cursor:pointer}
.pp-open img{width:100%;height:100%;object-fit:cover;display:block}
.pp-cell figcaption{font-size:11.5px;color:var(--muted, #5a6b80);margin-top:4px;line-height:1.35}
.pp-big{margin:12px 0;text-align:center}
.pp-big img{max-width:100%;max-height:60vh;border-radius:10px}
.pp-big.small img{max-height:30vh}
.pp-none{margin:12px 0}
.pp-del{background:none;border:0;padding:0;margin-left:2px;color:#B3261E;font-size:11.5px;text-decoration:underline;cursor:pointer}
.ps-itemcell{display:flex;gap:10px;align-items:center}
.ps-thumb.ps-empty{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;flex:none;border-style:dashed;color:var(--muted, #5a6b80)}
.ps-thumb.ps-empty svg{width:20px;height:20px}
.ps-thumb.ps-empty small{font-size:10px;font-weight:600}
.ps-thumb{flex:none}
.modal.modal-wide{max-width:min(760px, calc(100vw - 32px));width:100%}
.cd-row{grid-template-columns:120px minmax(0,1.3fr) minmax(0,1fr) auto}
.note-void{font-size:12px;color:#8A3B12;margin-top:4px}
.w-hist-row.voided, .prn-row .note-void{opacity:.9}
.w-hist-row.voided s{color:var(--muted, #5a6b80)}
