/* ═══════════════════════════════════════════════════════════════════════════
   FCMS Journey layer — LIFE by Dr. Pat design system
   Builds on /design-system/tokens.css (Cloud font, Ruby / Emerald / Sapphire).
   Brand components: pill buttons · uppercase letter-spaced tag pills · light card
   (soft border, 6px radius) · highlight card (.ink: sapphire tint, gold top rule — no dark surfaces).
   Colours: Ruby / Emerald / Sapphire / white / black only (+ gold accents); greys are tints of black.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --ink: #000000;
  --btn-top: var(--key-top); --tab-edge: var(--border-strong);   /* defaults of the per-button / per-tab custom properties (regress_observe token rule) */
  --gold: #C9A24B;
  --cream: #FFFFFF;   /* name kept; the page ground is white */
  --border-soft: #E6E6E6;
  /* warm surfaces / lines of the lab board and the patient app (journey tokens, so pages carry no raw colours) */
  --sand: #F2F2F2;
  --sand-deep: #EBEBEB;
  --border-warm: #D9D9D9;
  --ink-soft: #141414;
  --warning-muted: #FDEEF4;
  --emerald-line: #BFE4DC;
  --ruby-line: #F6B8CF;
  /* text and lines */
  --ink-body: #000000;
  --border-strong: #BFBFBF;
  --cream-deep: #F7F7F7;
  /* status pills (4.5:1 contrast): info = sapphire tint, ok = emerald tint, warning = ruby tint with a ruby edge,
     danger / critical = solid ruby */
  --pill-info-bg: #DDE6F5;   --pill-info-ink: #151667;
  --pill-ok-bg: #CCEAE3;     --pill-ok-ink: #006B54;
  --pill-danger-bg: #E0115F; --pill-danger-ink: #FFFFFF;
  --pill-warn-bg: #FCE4EE;   --pill-warn-ink: #A00040;
  /* white on dark surfaces (sidebar, ink cards, D0 column) and overlays */
  --on-dark-hover: rgba(255,255,255,.16);
  /* white at low opacity on the dark (sapphire-deep) screens: witness tablet, ink cards, hero bars */
  --on-dark-05: rgba(255,255,255,.05);
  --on-dark-07: rgba(255,255,255,.07);
  --on-dark-08: rgba(255,255,255,.08);
  --on-dark-15: rgba(255,255,255,.15);
  --on-dark-16: rgba(255,255,255,.16);
  --on-dark-25: rgba(255,255,255,.25);
  --on-dark-30: rgba(255,255,255,.3);
  --on-dark-45: rgba(255,255,255,.45);
  --on-dark-70: rgba(255,255,255,.7);
  --on-dark-80: rgba(255,255,255,.8);
  --on-dark-85: rgba(255,255,255,.85);
  --on-dark-90: rgba(255,255,255,.9);
  --scrim: rgba(0,0,0,.45);
  /* black at low opacity: the "on-dark" tokens inside a highlight card (.ink) */
  --black-03: rgba(0,0,0,.03); --black-04: rgba(0,0,0,.04); --black-05: rgba(0,0,0,.05); --black-07: rgba(0,0,0,.07);
  --black-10: rgba(0,0,0,.1); --black-18: rgba(0,0,0,.18); --black-22: rgba(0,0,0,.22); --black-35: rgba(0,0,0,.35);
  --black-62: rgba(0,0,0,.62); --black-70: rgba(0,0,0,.7); --black-75: rgba(0,0,0,.75); --black-80: rgba(0,0,0,.8);
  --shadow-sapphire: rgba(21,22,103,.25);
  /* raised keys (buttons, language switch): the light line along the top of a key — never remapped inside .ink */
  --key-top: rgba(255,255,255,.3);
  --key-top-strong: rgba(255,255,255,.45);
  --sidebar-w: 236px;
}
html, body { height: 100%; }
body { background: var(--dept-ground); color: var(--ink-body); font-family: var(--font-primary, 'Cloud', system-ui, 'Apple Symbols', 'Segoe UI Symbol', 'Noto Sans Symbols 2', sans-serif); margin: 0; font-size: 16px; line-height: 1.5; font-weight: 400; }
* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
a { color: var(--dept); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── App shell ─────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); color: var(--white); padding: 22px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
/* the brand block is the gold logo (design-system/tokens.css .luxe-brand); the panel itself is .luxe-panel */
.sidebar .brand { flex: none; }
.sidebar nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 0; }
.sidebar nav a { color: var(--white); padding: 8px 14px 8px calc(14px + var(--sidebar-item-indent, 10px)); border-radius: 999px; font-family: var(--font-primary, 'Cloud', system-ui, sans-serif); font-size: var(--sidebar-item-size, 14px); font-weight: var(--sidebar-item-weight, 400); display: flex; align-items: center; gap: 8px; opacity: 1; text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--on-dark-hover); opacity: 1; font-weight: var(--sidebar-item-weight, 400); }
/* the page you are on: a fine gold outline round the pill and a gold ring on its dot */
.sidebar nav a.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 75%, transparent); }
.sidebar nav a.active::before { box-shadow: 0 0 0 2px var(--gold); }
.sidebar nav { scrollbar-width: thin; scrollbar-color: var(--on-dark-25) transparent; }
/* the department dot of every sidebar row: emerald = medical, ruby = laboratory, sapphire = office — ringed in white so it
   reads on any sidebar colour */
.sidebar nav a::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--white); box-shadow: 0 0 0 1.5px var(--on-dark-85); }
.sidebar nav a[data-dept="medical"]::before { background: var(--emerald); }
.sidebar nav a[data-dept="lab"]::before { background: var(--ruby); }
.sidebar nav a[data-dept="office"]::before { background: var(--sapphire); }
.sidebar nav .sec { font-family: var(--font-primary, 'Cloud', system-ui, sans-serif); font-size: var(--sidebar-heading-size, 16px); font-weight: var(--sidebar-heading-weight, 700); color: var(--sidebar-heading-color, var(--white)); opacity: 1; text-transform: none; letter-spacing: normal; margin: 16px 14px 4px; }
.sidebar nav .sec:not(:first-child) { padding-top: 14px; border-top: 1px solid var(--on-dark-15); }
.sidebar nav button.sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: calc(100% - 28px); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; line-height: 1.3; }
.sidebar nav button.sec:not(:first-child) { padding-top: 14px; border-top: 1px solid var(--on-dark-15); }
.sidebar nav button.sec .sec-chev { font-style: normal; font-size: 12px; opacity: .75; }
.sidebar nav button.sec:hover .sec-chev, .sidebar nav button.sec:focus-visible .sec-chev { opacity: 1; }
.sidebar .foot { margin-top: auto; font-size: 13px; font-weight: 600; opacity: .95; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.sidebar .foot button { width: 100%; margin-top: 10px; margin-bottom: 4px; }
.sidebar .foot .foot-name { font-weight: 600; }
.sidebar .foot .foot-role { font-weight: 400; font-size: 12.5px; line-height: 1.35; opacity: .92; }
.sidebar .foot .foot-ver { font-weight: 400; font-size: 11.5px; line-height: 1.3; opacity: .75; text-align: center; margin-top: 4px; font-variant-numeric: tabular-nums; }
/* "Ask Claude" (app/static/ask-claude.js): a small pill on the right of the "Recently deleted" row; the panel's own CSS loads on first click */
.sidebar .foot .foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.sidebar .foot button.ask-claude-pill { width: auto; margin: 0; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  color: inherit; background: var(--on-dark-15); border: 1.5px solid var(--gold); border-radius: 999px; cursor: pointer; }
.sidebar .foot button.ask-claude-pill:hover { background: var(--on-dark-25); }
.sidebar .foot button.ask-claude-pill:focus-visible { outline: 2px solid var(--gold-shine); outline-offset: 2px; }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 27px; font-weight: 600; color: var(--ink); margin: 0; }
.topbar-title { display: flex; flex-direction: column; gap: 3px; }
/* the department over the page title: a gem dot and the department's name in its colour */
.dept-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--dept-deep); line-height: 1; }
.dept-tag i { width: 9px; height: 9px; border-radius: 50%; background: var(--dept); box-shadow: 0 0 0 2px var(--dept-tint); }
.topbar .spacer { flex: 1; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
/* Raised keys: each button stands on an edge of its own colour (mixed with black), lifts a little on hover and sinks onto
   the edge when pressed (the edge vanishes, the face darkens). --btn-edge / --btn-glow are set per colour below. */
.btn { border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: 14.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; line-height: 1;
  position: relative; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  --btn-edge: var(--black-35); --btn-glow: var(--black-18); --btn-top: var(--key-top);
  box-shadow: 0 3px 0 var(--btn-edge), 0 5px 10px -2px var(--btn-glow), inset 0 1px 0 var(--btn-top);
  transition: transform .09s cubic-bezier(.2,.7,.3,1.3), box-shadow .09s ease, filter .12s ease, border-color .12s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05);
  box-shadow: 0 4px 0 var(--btn-edge), 0 9px 16px -3px var(--btn-glow), inset 0 1px 0 var(--btn-top); }
.btn:active:not(:disabled) { transform: translateY(3px); filter: brightness(.95); transition-duration: .05s;
  box-shadow: 0 0 0 var(--btn-edge), 0 1px 2px var(--btn-glow), inset 0 2px 5px var(--black-22); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--dept) 45%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--dept-deep); color: var(--white); --btn-edge: color-mix(in srgb, var(--dept-deep) 60%, var(--black)); --btn-glow: var(--dept-shadow); }
.btn.ruby { background: var(--ruby); color: var(--white); --btn-edge: color-mix(in srgb, var(--ruby) 60%, var(--black)); --btn-glow: color-mix(in srgb, var(--ruby) 32%, transparent); }
.btn.emerald { background: var(--emerald-muted); color: var(--emerald-dark); border: 1.5px solid var(--emerald); --btn-edge: var(--emerald); --btn-glow: color-mix(in srgb, var(--emerald) 20%, transparent); --btn-top: var(--emerald-muted); }   /* soft, outlined: a solid green block tires the eyes (Dr. Pat, 29 Nov 2026) */
.btn.gold { background: var(--gold); color: var(--ink); --btn-edge: color-mix(in srgb, var(--gold) 58%, var(--black)); --btn-glow: color-mix(in srgb, var(--gold) 40%, transparent); --btn-top: var(--key-top-strong); }
.btn.ghost { background: var(--white); color: var(--dept-deep); border: 1.5px solid var(--border-strong); --btn-edge: var(--border-strong); --btn-glow: var(--black-10); --btn-top: var(--white); }
.btn.ghost:hover { border-color: var(--dept); --btn-edge: var(--dept); }
.btn.sm { padding: 7px 14px; font-size: 13.5px; }
.btn.xs { padding: 5px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; filter: none; }
.btn.block { width: 100%; justify-content: center; }

/* ── Tags & status pills ───────────────────────────────────────────────────── */
.tag { display: inline-block; border: 1.5px solid currentColor; border-radius: 999px; padding: 4px 11px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--dept-deep); }
.tag.ruby { color: var(--ruby); } .tag.emerald { color: var(--emerald-dark); } .tag.gold { color: var(--gold-dark); } .tag.gray { color: var(--gray-500); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 600; }
.pill.pending { background: var(--pill-info-bg); color: var(--pill-info-ink); }
.pill.done, .pill.match, .pill.signed, .pill.active, .pill.sent { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.pill.failed, .pill.mismatch, .pill.overdue, .pill.cancelled { background: var(--pill-danger-bg); color: var(--pill-danger-ink); }
.pill.blocked, .pill.due, .pill.manual { background: var(--pill-warn-bg); color: var(--pill-warn-ink); box-shadow: inset 0 0 0 1.5px var(--ruby); }
.pill.gray { background: var(--sand-deep); color: var(--ink); }
table.t .pill { white-space: nowrap; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border-soft); border-radius: 6px; padding: 18px 20px; }
.card + .card { margin-top: 14px; }
.card h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.card h2 .tag { margin-left: auto; }
/* highlight card: sapphire tint with a gold top rule (formerly a dark surface). Inside it the "on-dark" tokens
   turn into tints of black and gold text turns into readable dark gold, so the pages need no change. */
.ink { background: var(--dept-tint); color: var(--ink-body); border: 1px solid var(--border-soft); border-top: 4px solid var(--gold-light);
  --gold: var(--gold-dark);
  --on-dark-hover: var(--black-07); --on-dark-05: var(--black-03); --on-dark-07: var(--black-04); --on-dark-08: var(--black-05);
  --on-dark-15: var(--black-10); --on-dark-16: var(--black-10); --on-dark-25: var(--black-18); --on-dark-30: var(--black-22);
  --on-dark-45: var(--black-35); --on-dark-70: var(--black-62); --on-dark-80: var(--black-70); --on-dark-85: var(--black-75); --on-dark-90: var(--black-80); }
.ink h2 { color: var(--dept-deep); }
.ink .btn.gold { background: var(--gold-light); color: var(--black); }
.ink .muted { color: var(--ink-soft); }
.ink .stat b { color: var(--dept-deep); }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.c6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid.c6 { grid-template-columns: repeat(3, minmax(0,1fr)); } .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .grid.c2, .grid.c3, .grid.c4, .grid.c6 { grid-template-columns: 1fr; } .sidebar { display: none; } .main { padding: 16px; } }
/* a field written to span 3 columns made three columns again on a phone (the one-column grid grew two extra columns and the
   form ran off the screen — staff chat app review round 3 T15, the booking page inside LIFE Inbox): on a narrow screen every
   field takes the row */
@media (max-width: 1100px) { .grid.c3 > [style*="span 3"], .grid.c4 > [style*="span 3"], .grid.c4 > [style*="span 4"] { grid-column: 1 / -1 !important; } }
@media (max-width: 760px) { .grid.c2 > *, .grid.c3 > *, .grid.c4 > *, .grid.c6 > * { grid-column: 1 / -1 !important; min-width: 0; } }
/* Rows that keep a name and its surname (and other pairs) side by side: first on the left, surname on the right. They stack
   only on a phone (under 640px). .pair = two fields; .name3 = title | first | last; .name4 = title | first | last | nickname. */
.grid.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.pair > .full { grid-column: 1 / -1; }
.grid.name3 { grid-template-columns: minmax(0, .6fr) repeat(2, minmax(0, 1fr)); }
.grid.name4 { grid-template-columns: minmax(0, .6fr) repeat(2, minmax(0, 1fr)) minmax(0, .8fr); }
@media (max-width: 639px) { .grid.pair, .grid.name3, .grid.name4 { grid-template-columns: 1fr; } }
.stat { padding: 14px 16px; }
.stat .label { font-size: 14px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.stat b { display: block; font-size: 52px; line-height: 1.1; font-weight: 600; color: var(--dept-deep); margin-top: 6px; }
.stat small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.stat small .alert { color: var(--ruby-dark); font-weight: 600; }
/* A tile that is also a tab (Stat with onClick): a raised key; the chosen tab is the highlight card with a ring in the department colour */
button.stat.tab { appearance: none; -webkit-appearance: none; display: block; width: 100%; margin: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
  position: relative; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  --tab-edge: color-mix(in srgb, var(--dept-deep) 28%, var(--border-strong));
  box-shadow: 0 3px 0 var(--tab-edge), 0 6px 12px -4px var(--dept-shadow);
  transition: transform .09s cubic-bezier(.2,.7,.3,1.3), box-shadow .09s ease, filter .12s ease; }
.grid > button.stat.tab, .card + button.stat.tab { margin-top: 0; }
button.stat.tab:hover { transform: translateY(-1px); filter: brightness(1.03); box-shadow: 0 4px 0 var(--tab-edge), 0 9px 16px -4px var(--dept-shadow); }
button.stat.tab:active { transform: translateY(3px); filter: brightness(.97); transition-duration: .05s; box-shadow: 0 0 0 var(--tab-edge), 0 1px 2px var(--dept-shadow); }
button.stat.tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--dept) 45%, transparent); outline-offset: 2px; }
button.stat.tab.on { --tab-edge: var(--dept); box-shadow: 0 3px 0 var(--tab-edge), 0 0 0 2px var(--dept), 0 8px 14px -4px var(--dept-shadow); }
button.stat.tab.on:active { box-shadow: 0 0 0 var(--tab-edge), 0 0 0 2px var(--dept), 0 1px 2px var(--dept-shadow); }
.stat.tab .label, .stat.tab b, .stat.tab small { pointer-events: none; }
/* Column headers that rank the list (list-tools.js for client lists, SortTh for server lists) */
th[data-rn-sort] { cursor: pointer; user-select: none; -webkit-user-select: none; white-space: nowrap; }
th[data-rn-sort]:hover { text-decoration: underline; text-underline-offset: 3px; }
th[data-rn-sort]:focus-visible { outline: 2px solid var(--gold-light); outline-offset: -2px; }
th[data-rn-sort]::after { content: '\2195'; display: inline-block; margin-left: 6px; font-size: .85em; opacity: .38; }
th[data-rn-sort][aria-sort="ascending"]::after { content: '\25B2'; opacity: 1; color: var(--gold-light); }
th[data-rn-sort][aria-sort="descending"]::after { content: '\25BC'; opacity: 1; color: var(--gold-light); }
.muted { color: var(--ink-soft); font-size: 14px; font-weight: 500; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.t-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
table.t th { text-align: left; background: var(--dept-deep); color: var(--white); font-weight: 600; padding: 10px 12px; font-size: 13.5px; letter-spacing: .03em; }
table.t th:first-child { border-radius: 6px 0 0 0; } table.t th:last-child { border-radius: 0 6px 0 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.t tr:hover td { background: var(--gray-50); }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--ink); font-weight: 600; }
label.f input, label.f select, label.f textarea, .input { border: 1.5px solid var(--border-strong); border-radius: 6px; padding: 9px 11px; font-size: 15px; background: var(--white); font-weight: 500; color: var(--ink-body); }
label.f input:focus, label.f select:focus, label.f textarea:focus, .input:focus { outline: none; border-color: var(--dept); box-shadow: 0 0 0 3px var(--dept-tint); }
/* a diagnosis field (CodedDiagnosisField): a field, not a <label> — its buttons and ticks must not be activated by the caption */
div.f.dx-field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--ink); font-weight: 600; }
div.f.dx-field .input-text { border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--white); font-weight: 500; color: var(--ink-body); }
div.f.dx-field .input-text:focus { outline: none; border-color: var(--dept); box-shadow: 0 0 0 3px var(--dept-tint); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.row > .fixed { flex: 0 0 auto; }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border-soft); margin-bottom: 16px; }
.tabs button { background: transparent; border: 0; padding: 10px 16px; font-weight: 600; color: var(--ink-soft); border-bottom: 3px solid transparent; cursor: pointer; font-size: 15.5px;
  border-radius: 6px 6px 0 0; transition: transform .08s ease, color .12s ease, background-color .12s ease, border-color .12s ease; -webkit-tap-highlight-color: transparent; }
.tabs button:hover:not(.on) { color: var(--ink); background: var(--black-04); border-bottom-color: var(--border-strong); }
.tabs button:active { transform: translateY(2px); background: var(--black-07); }
.tabs button.on { color: var(--dept-deep); border-bottom-color: var(--dept); }
.tabs.groups { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs.groups button { padding: 10px 12px; white-space: nowrap; flex: 0 0 auto; }
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0 2px; margin-bottom: 16px; }
.subtabs button { background: var(--white); border: 1px solid var(--border-soft); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 600; font-size: 14.5px;
  color: var(--ink-soft); cursor: pointer; transition: color .12s ease, background-color .12s ease, border-color .12s ease; -webkit-tap-highlight-color: transparent; }
.subtabs button:hover:not(.on) { color: var(--ink); background: var(--black-04); }
.subtabs button.empty:not(.on) { color: var(--ink-soft); opacity: .6; }
.subtabs button.on { background: var(--dept-tint); border-color: var(--dept); color: var(--dept-deep); }
.daytabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.daytabs button { border: 1.5px solid var(--border-strong); background: var(--white); border-radius: 999px; padding: 7px 15px; font-weight: 600; font-size: 14.5px; cursor: pointer; color: var(--dept-deep);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 var(--border-strong), 0 3px 6px var(--black-10), inset 0 1px 0 var(--white);
  transition: transform .09s cubic-bezier(.2,.7,.3,1.3), box-shadow .09s ease, background-color .12s, border-color .12s; }
.daytabs button:hover:not(.on) { transform: translateY(-1px); border-color: var(--dept); box-shadow: 0 3px 0 var(--dept), 0 6px 10px -2px var(--dept-shadow), inset 0 1px 0 var(--white); }
.daytabs button:active { transform: translateY(2px); transition-duration: .05s; box-shadow: 0 0 0 var(--border-strong), inset 0 2px 4px var(--black-18); }
.daytabs button.on { background: var(--dept-deep); color: var(--white); border-color: var(--dept-deep);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--dept-deep) 60%, var(--black)), 0 3px 6px var(--dept-shadow), inset 0 1px 0 var(--key-top); }
.daytabs button.on:active { box-shadow: 0 0 0 color-mix(in srgb, var(--dept-deep) 60%, var(--black)), inset 0 2px 5px var(--black-35); }
.daytabs button.today { outline: 2px solid var(--gold); outline-offset: 0; }

/* ── Stimulation chart grid ────────────────────────────────────────────────── */
.chart { overflow: auto; }
.chart table { border-collapse: collapse; font-size: 14.5px; min-width: 100%; }
.chart th, .chart td { border: 1px solid var(--border-warm); padding: 7px 8px; text-align: center; white-space: nowrap; min-width: 58px; height: 40px; color: var(--ink-body); }
.chart th.drug, .chart td.drug { text-align: left; position: sticky; left: 0; background: var(--white); min-width: 230px; z-index: 1; font-size: 15px; }
.chart td.drug b { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.chart td.drug .muted { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.chart th { background: var(--sand); font-weight: 600; font-size: 14px; color: var(--ink); }
.chart th .muted { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.chart th.d0 { background: var(--ruby); color: var(--white); }
.chart th.d0 .muted { color: var(--on-dark-90); }
.chart th.today { background: var(--gold); color: var(--ink); }
.chart td.dose { background: var(--sapphire); color: var(--white); font-weight: 600; font-size: 15px; cursor: pointer; }
.chart td.dose.taken { background: var(--emerald); color: var(--white); }
.chart td.mon { background: var(--cream-deep); font-size: 13.5px; font-weight: 600; color: var(--sapphire-deep); }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--white); color: var(--ink-body); border: 1px solid var(--border-soft); padding: 14px 18px; border-radius: 6px; box-shadow: var(--shadow-lg); z-index: 80; max-width: 460px; font-size: 15px; font-weight: 600; border-left: 4px solid var(--gold); }
.toast.err { border-left-color: var(--ruby); }
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 16px; }
.modal { background: var(--white); border-radius: 10px; padding: 22px; width: min(720px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0 0 14px; font-size: 18px; color: var(--ink); }
/* A window on a phone never freezes (Dr. Pat, 3 Dec 2026, lab order window after "Cancel order": "This page freeze"):
   while a window is open the page behind does not scroll, a swipe moves the window only, the window fits the visible
   screen (dvh: Safari's toolbars), and its title row with the close button stays at the top of the window. */
@media screen { html:has(.modal-bg), html:has(.modal-bg) body { overflow: hidden; } }
.modal-bg { overscroll-behavior: contain; }
.modal { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; max-height: 92dvh; }
.modal-head { position: sticky; top: -22px; z-index: 3; margin: -22px -22px 0; padding: 22px 22px 0; background: var(--white); border-radius: 10px 10px 0 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 15px; }
.kv div:nth-child(odd) { color: var(--ink-soft); font-weight: 600; }
.ink .kv div:nth-child(odd) { color: var(--on-dark-80); }
.hr { height: 1px; background: var(--border-soft); margin: 14px 0; }
.big { font-size: 40px; font-weight: 600; }
.center { text-align: center; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-soft); }
.sig { border: 1.5px dashed var(--border-soft); border-radius: 6px; background: var(--white); touch-action: none; width: 100%; height: 160px; }
/* language switch (sidebar foot, patient app, questionnaires): a sunken track holding two keys. The chosen language is
   the key held down — sapphire, lit, sunk into the track; the other one stands up and can be pressed. */
.lang { display: inline-flex; gap: 3px; padding: 3px 3px 4px; border: 0; border-radius: 999px; background: var(--black-18); vertical-align: middle;
  box-shadow: inset 0 2px 4px var(--black-22), inset 0 -1px 0 var(--key-top), 0 1px 0 var(--key-top); }
.lang button { border: 0; border-radius: 999px; background: var(--white); color: var(--ink-soft); padding: 6px 13px; min-width: 52px; text-align: center;
  font-weight: 600; font-size: 13.5px; line-height: 1.25; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 var(--border-strong), 0 3px 5px var(--black-18), inset 0 1px 0 var(--white);
  transition: transform .09s cubic-bezier(.2,.7,.3,1.3), box-shadow .09s ease, background-color .12s ease, color .12s ease; }
.lang button:hover:not(.on) { transform: translateY(-1px); color: var(--dept-deep);
  box-shadow: 0 3px 0 var(--border-strong), 0 6px 10px -2px var(--black-22), inset 0 1px 0 var(--white); }
.lang button:active { transform: translateY(2px); transition-duration: .05s;
  box-shadow: 0 0 0 var(--border-strong), inset 0 2px 4px var(--black-22); }
.lang button.on { background: var(--dept-deep); color: var(--white); transform: translateY(2px); cursor: default;
  box-shadow: 0 0 0 color-mix(in srgb, var(--dept-deep) 60%, var(--black)), inset 0 2px 5px var(--black-35), inset 0 -1px 0 var(--key-top); }
.lang button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.spark { width: 100%; height: 70px; }
.witness-screen { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; padding: 30px; text-align: center; }
.witness-screen.match { background: var(--emerald); color: var(--white); }
.witness-screen.mismatch { background: var(--ruby); color: var(--white); animation: flash .6s ease-in-out 3; }
@keyframes flash { 50% { filter: brightness(1.4); } }
video.cam { width: 100%; max-width: 520px; border-radius: 10px; background: var(--black); }

/* ── overrides of the global form rules in tokens.css ─────────────────────── */
.topbar > .input, .topbar > input, .topbar > select { width: auto; flex: 0 0 auto; }
/* the count on a tab or a card title (same look as the patient chart's tabs) */
.tabs button .cnt, .subtabs button .cnt, h2 .cnt { display: inline-block; margin-left: 6px; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--sand-deep); color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; }
.tabs button.on .cnt { background: var(--dept-tint); color: var(--dept-deep); }
.subtabs button.on .cnt { background: var(--white); color: var(--dept-deep); }
/* A table row that opens its record (To scan, Scanned): the whole row is the button */
table.t tr.rowlink { cursor: pointer; }
table.t tr.rowlink:hover td, table.t tr.rowlink:focus-visible td { background: color-mix(in srgb, var(--dept-deep) 6%, transparent); }
table.t tr.rowlink:focus-visible { outline: 2px solid var(--dept); outline-offset: -2px; }

/* A page's button row in two groups: Create (nouns that start with +) and Go to (a page, with its icon) */
.act-groups { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; }
.act-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.act-group + .act-group { padding-left: 16px; border-left: 1px solid var(--border-soft); }
.act-cap { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-right: 2px; }
@media (max-width: 639px) { .act-group + .act-group { padding-left: 0; border-left: 0; } }
.stat.ink .label { color: var(--on-dark-70); }
.stat.ink b { color: var(--dept-deep); }
.stat.ink small { color: var(--on-dark-70); }
table .input, .flex > .input, .flex > select.input { width: auto; }

/* camera / file buttons (journey-shared.js FilePick): the file input sits inside its label, invisible but present
   (iPadOS opens the camera only from a real tap on the input or its label) */
.vh-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; left: 0; top: 0; }
label.btn.disabled { opacity: .45; box-shadow: none; transform: none; filter: none; }
.doc-thumb { width: 120px; height: 86px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-soft); display: block; }
.doc-pdf { width: 120px; height: 86px; border-radius: 6px; border: 1px solid var(--border-soft); background: var(--sand); color: var(--ruby);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; letter-spacing: .08em; }
.scan-preview { max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid var(--border-soft); display: block; margin-top: 8px; }
/* the pages of a signed paper consent (PaperConsentDialog): one thumbnail per photo / scan, each removable */
.scan-pages { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.scan-page { position: relative; width: 132px; border: 1px solid var(--border-soft); border-radius: 8px; padding: 6px; background: var(--white);
  display: flex; flex-direction: column; gap: 4px; }
.scan-page img, .scan-page .doc { width: 100%; height: 150px; object-fit: cover; border-radius: 6px; display: block; }
.scan-page .doc { background: var(--sand); color: var(--ruby); display: flex; align-items: center; justify-content: center; font-weight: 600; letter-spacing: .08em; }
.scan-page .nm { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-page .rm { position: absolute; top: 10px; right: 10px; background: var(--white); }

/* touch devices — the clinic iPad (html.touch, set by journey-shared.js): finger-size targets (≥ 44 px), text and fields at
   16 px or more (iOS zooms into smaller fields), no double-tap zoom, no horizontal scrolling */
html.touch { -webkit-text-size-adjust: 100%; }
html.touch .btn, html.touch .tabs button, html.touch .subtabs button, html.touch .daytabs button, html.touch .lang button { min-height: 44px; touch-action: manipulation; }
html.touch .btn { font-size: 16px; padding: 11px 18px; }
html.touch .btn.sm, html.touch .btn.xs { font-size: 16px; padding: 10px 14px; }
html.touch label.f input, html.touch label.f select, html.touch label.f textarea, html.touch .input,
html.touch input[type="text"], html.touch input[type="date"], html.touch input[type="tel"], html.touch input[type="email"], html.touch select, html.touch textarea {
  font-size: 16px; min-height: 44px; }
html.touch input[type="checkbox"], html.touch input[type="radio"] { width: 24px; height: 24px; flex: 0 0 auto; }
html.touch label.flex { min-height: 44px; }
html.touch label.f, html.touch div.f.dx-field { font-size: 15px; }
html.touch .sig { height: 220px; }
html.touch .modal { padding: 24px; }
html.touch .modal-head { top: -24px; margin: -24px -24px 0; padding: 24px 24px 0; }
html.touch .scan-page { width: 150px; }
html.touch .scan-page .nm { font-size: 16px; }
html.touch .scan-page .rm { min-width: 44px; }

/* Save button + save status (journey-shared.js SaveState) on forms that also save by themselves */
.savestate-wrap { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; vertical-align: middle; }
.savestate { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  padding: 3px 10px; border-radius: 999px; background: var(--cream); border: 1px solid var(--border-warm); vertical-align: middle; }
.savestate.ok { color: var(--emerald-dark); background: var(--emerald-muted); border-color: var(--emerald); }
.savestate.warn { color: var(--color-warning-dark); background: var(--warning-muted); border-color: var(--color-warning); }
.savestate.bad { color: var(--ruby-dark); background: var(--ruby-muted); border-color: var(--ruby); }
h2 .savestate-wrap { margin-left: 10px; font-weight: 600; }

/* Reference numbers (visit, booking, cycle, embryo): a small label before the number; a click copies the number */
.ref { display: inline-flex; align-items: baseline; gap: 6px; cursor: copy; white-space: nowrap; }
.ref .ref-l { font-size: 10px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--gray-500); }
.ref .ref-n { font-weight: 600; letter-spacing: normal; text-transform: none; }
.ref .ref-n a, a.ref-n { cursor: pointer; }
.ref.tag { padding: 3px 11px; }
.ref.tag .ref-l { color: inherit; opacity: .75; }
.ref .ref-ok { color: var(--emerald-dark); font-weight: 600; }
@media print { .ref { cursor: auto; } .ref .ref-ok { display: none; } body { background: var(--white); } }
.card.ink .ref .ref-l { color: inherit; opacity: .75; }

/* rows-per-page selector beside a page's own Previous / Next (list-tools.js draws the in-table footer itself) */
.rn-rows { margin-right: auto; font-size: 13.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 8px; }
.rn-rows select { padding: 5px 8px; font-size: 13.5px; border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--white); color: var(--ink-body); font-family: inherit; width: auto; }

/* consent-forms checklist (journey-shared ConsentFormsChecklist): the form number is what staff recognise — large and gold-keyed */
.rtcog-no { display: inline-block; min-width: 76px; padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: 15px;
  color: var(--sapphire-deep); background: var(--white); border: 1.5px solid var(--gold); text-align: center; white-space: nowrap; }
tr.rtcog-on td { background: var(--emerald-muted); }
.consent-nos { display: inline-flex; gap: 4px; margin-left: 6px; flex-wrap: wrap; vertical-align: middle; }
.consent-nos .rtcog-no { min-width: 0; font-size: 12.5px; padding: 1px 7px; }
.consent-sec-h { font-weight: 600; color: var(--sapphire-deep); margin: 6px 0; }

/* In-page consent print preview (Dr. Pat, 9 Nov + 18 Nov 2026 — cx-R13):
   every page as it prints, one Print button inside the current page (no second window) */
.consent-print-host { z-index: 60; }
.cp-modal { width: min(920px, 100%); display: flex; flex-direction: column; gap: 10px; }
.cp-bar { display: flex; align-items: center; gap: 10px; }
.cp-bar h3 { margin: 0; flex: 1; }
.cp-pages { max-height: 68vh; overflow: auto; background: var(--gray-100); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cp-pg { position: relative; width: min(820px, 100%); background: var(--white); box-shadow: var(--shadow); }
.cp-pg img { display: block; width: 100%; height: auto; }
.cp-no { position: absolute; top: 6px; right: 8px; font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--white); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border-soft); }
.cp-msg { padding: 24px; text-align: center; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.cp-msg.err { color: var(--ruby-dark); }
.cp-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; flex-wrap: wrap; }
.cp-actions label.f { flex: 0 1 440px; min-width: 0; }
.cp-actions select { max-width: 100%; }
.cp-actions .cp-witnesses { flex: 1 1 520px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; }
.cp-actions .cp-witnesses label.f { min-width: 0; }
.cp-actions .cp-witnesses select { width: 100%; }
@media print {
  body.consent-printing > *:not(.consent-print-host) { display: none !important; }
  body.consent-printing .consent-print-host { position: static !important; inset: auto !important;
    background: var(--white) !important; padding: 0 !important; display: block !important; }
  body.consent-printing .cp-modal { width: 100% !important; max-width: none !important; max-height: none !important;
    overflow: visible !important; padding: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
  body.consent-printing .cp-bar,
  body.consent-printing .cp-actions,
  body.consent-printing .cp-no,
  body.consent-printing .cp-msg { display: none !important; }
  body.consent-printing .cp-pages { display: block !important; max-height: none !important; overflow: visible !important;
    background: var(--white) !important; border: 0 !important; padding: 0 !important; }
  body.consent-printing .cp-pg { width: 100% !important; box-shadow: none !important; margin: 0 !important;
    break-after: page; page-break-after: always; }
  body.consent-printing .cp-pg:last-child { break-after: auto; page-break-after: auto; }
  body.consent-printing .cp-pg img { width: 99.6%; margin: 0 auto; }
}
/* No side menu (Dr. Pat, 19 Nov 2026: "do not use the side menu anymore. Just go back to the home page"): one strip at the top of
   every Shell page — ← Home at the left; who is signed in, Recently deleted, Ask Claude, the language, Sign out, the version at the right */
.home-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 0 12px; margin-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); }
.home-strip .spacer { flex: 1; }
.home-strip .home-back { display: inline-flex; align-items: center; gap: 8px; padding: 9px 22px; border-radius: 999px; background: var(--dept-deep); color: var(--white); font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; box-shadow: inset 0 0 0 1.5px var(--gold); }
.home-strip .home-back:hover { filter: brightness(1.1); }
.home-strip .home-back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.home-strip .home-back span { font-size: 17px; line-height: 1; }
.home-strip .hs-who { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
.home-strip .hs-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.home-strip .hs-role { font-size: 12px; color: var(--ink-soft); }
.home-strip .hs-link { font-weight: 600; font-size: 13.5px; color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.home-strip .hs-link:hover, .home-strip .hs-link.active { color: var(--dept-deep); text-decoration: underline; }
.home-strip button.ask-claude-pill { padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; color: var(--dept-deep); background: var(--white); border: 1.5px solid var(--gold); border-radius: 999px; cursor: pointer; }
.home-strip button.ask-claude-pill:hover { background: color-mix(in srgb, var(--gold) 12%, var(--white)); }
.home-strip .hs-ver { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
@media print { .home-strip { display: none !important; } }

/* Alert tiles (Dr. Pat, 29 Nov 2026: "something about to expire looks the same as everything else … a distinct colour, a blink"):
   tone-alert = a problem now — solid ruby, white text, a slow pulse; tone-warn = needs attention — ruby tint with a ruby edge.
   The pulse stops for people who ask their system for less motion. */
.stat.tone-warn { background: var(--ruby-muted); border: 2px solid var(--ruby); }
.stat.tone-warn b, .stat.tone-warn .label { color: var(--ruby-dark); }
.stat.tone-alert, button.stat.tab.tone-alert { background: var(--ruby); border: 2px solid var(--ruby-dark); animation: stat-pulse 1.5s ease-in-out infinite; }
.stat.tone-alert .label, .stat.tone-alert b, .stat.tone-alert small, .stat.tone-alert small .alert { color: var(--white); }
@keyframes stat-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ruby) 55%, transparent); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--ruby) 0%, transparent); filter: brightness(1.12); } }
@media (prefers-reduced-motion: reduce) { .stat.tone-alert { animation: none; } }
