/* Admin: sidebar + content, built on the tokens in style.css (7 website\dashboard.md). Dense, calm, no motion. */
:root { --danger-line: #d9534f; }   /* --danger lives in style.css with the theme tokens (buttons use it too) */
.admin { display: grid; min-height: 100svh; }
@media (min-width: 900px) { .admin { grid-template-columns: var(--side-w, 240px) minmax(0, 1fr); } }

/* ---- Menu: one block (2026/11/12, drop-down sections; replaces the two-row top menu and the uppercase group heads) ----
   Side menu: brand, Overview, then one drop-down per section (Clinic, Finance, Medicine, HR, Staff & access, Website,
   Settings & rules), then the bottom block (My account, move the menu, Log out, version). Section buttons and Overview are
   the important words: bigger, 600, ink (Desmond 2026/11/12 "make it bigger and bold it"); the pages under them are 400.
   The open page in accent with a bar on its left. A closed section shows the sum of its counts. */
/* One left gutter (Desmond 2026/11/15 "margin need to fix"): the logo, Overview, the section names, My account and the version
   all start 16px from the menu's edge (6px side padding + 3px bar + 7px), the pages under a section one 16px step more (32px);
   counts and chevrons end 16px from the right edge (6px + 10px). */
.side { min-width: 0; padding: 20px 6px; overflow-x: hidden; overflow-x: clip; border-right: 1px solid var(--line); background: var(--bg-alt); font-size: var(--fs-ui); }
/* Brand: the real e-Rawat logo + name, "e-" in the accent colour (partner's design 2026/11/13) */
.side .brand { display: flex; align-items: center; gap: 10px; margin: 0 10px 16px; overflow-wrap: anywhere; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand-logo { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #0b2440; }
.brand-name em, .login-box .brand em { font-style: normal; color: var(--accent); }
.side .brand .brand-text { display: flex; flex-direction: column; min-width: 0; }
.side .brand .brand-tag { font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.nav-group, .nav-items { display: grid; gap: 2px; }
.nav-items[hidden] { display: none; }
.nav-group form { margin: 0; }
.nav-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.side nav a, .side nav button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 10px 0 7px; margin: 0; border: 0; border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0; font: inherit; font-weight: 400; color: var(--text); background: none; text-align: left; cursor: pointer; }
/* long words wrap inside the column, never a sideways scroll; the count keeps its place on the right */
.side nav a, .side nav button { min-width: 0; overflow-wrap: anywhere; }
.nav-label, .nav-sec-name { min-width: 0; padding-block: 6px; line-height: 1.35; }
.side nav .count { flex: none; margin-left: auto; }
.side nav .nav-home, .side nav .nav-sec-btn, .side nav .nav-dd-btn { font-size: calc(var(--fs-ui) + 2px); font-weight: 600; color: var(--ink); }
.nav-sec-name { flex: 1; }
.nav-sec .nav-items a { padding-left: 23px; }   /* the pages sit one 16px step in from their section */
.nav-sec-btn[aria-expanded="true"] .nav-sum { display: none; }
.side nav .count + .chev { margin-left: 0; }
.chev { flex: none; margin-left: auto; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[aria-expanded="true"] > .chev { transform: rotate(180deg); }
.side nav a[aria-current] { color: var(--accent); background: var(--surface); border-left-color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .side nav a:hover, .side nav button:hover { color: var(--ink); background: var(--surface); text-decoration: none; } }
/* Version and What's new at the end of the bottom block */
.side-ver { margin: 4px 10px 0; font-size: 13px; color: var(--muted); }
.side nav .side-ver a { display: inline-flex; width: auto; min-height: 32px; padding: 0 2px; border: 0; color: var(--accent); background: none; }
.side nav .side-ver a[aria-current] { color: var(--ink); background: none; }
/* Width: a drag handle on the right edge (clinic.js), saved in the side_w cookie and set by PHP as one of these classes */
.side-handle { display: none; }
@media (min-width: 900px) {
    .admin:not(.nav-top) .side-handle { display: block; position: fixed; top: 0; bottom: 0; left: calc(var(--side-w, 240px) - 6px); z-index: 12; width: 12px;
        cursor: col-resize; touch-action: none; }
    .side-handle::after { content: ""; position: absolute; top: 50%; left: 4px; width: 4px; height: 44px; margin-top: -22px; border-radius: 2px; background: transparent; }
    .side-handle:hover::after, .side-handle:focus-visible::after, .side-handle.is-dragging::after { background: var(--line-strong); }
    .side-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
    .side-handle.is-dragging::after { background: var(--accent); }
}
.side-w-200 { --side-w: 200px; } .side-w-208 { --side-w: 208px; } .side-w-216 { --side-w: 216px; } .side-w-224 { --side-w: 224px; }
.side-w-232 { --side-w: 232px; } .side-w-240 { --side-w: 240px; } .side-w-248 { --side-w: 248px; } .side-w-256 { --side-w: 256px; }
.side-w-264 { --side-w: 264px; } .side-w-272 { --side-w: 272px; } .side-w-280 { --side-w: 280px; } .side-w-288 { --side-w: 288px; }
.side-w-296 { --side-w: 296px; } .side-w-304 { --side-w: 304px; } .side-w-312 { --side-w: 312px; } .side-w-320 { --side-w: 320px; }
.side-w-328 { --side-w: 328px; } .side-w-336 { --side-w: 336px; } .side-w-344 { --side-w: 344px; } .side-w-352 { --side-w: 352px; }
.side-w-360 { --side-w: 360px; }
@media (min-width: 900px) {
    /* the sidebar stays in view; the bottom block sits at the foot of the screen */
    /* the side column is as tall as the page (no grey gap); the menu inside stays in view, and a menu taller than the
       screen scrolls with the page until its end shows (clinic.js sets --side-top), so every item can be reached */
    .admin:not(.nav-top) .side-in { position: sticky; top: var(--side-top, 0px); min-height: 100svh; display: flex; flex-direction: column; }
    .admin:not(.nav-top) .side { padding-top: 0; padding-bottom: 0; }
    .admin:not(.nav-top) .side-in { padding: 20px 0; }
    .admin:not(.nav-top) .side nav { flex: 1; }
    .admin:not(.nav-top) .nav-foot { margin-top: auto; }
}
/* Phone: the sidebar is a drawer under the top bar, opened by the Menu button, so every page starts with its own content */
@media (max-width: 899px) {
    .side { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
    .side.is-open { display: block; position: fixed; inset: 56px 0 0; z-index: 9; overflow-y: auto; }
}
/* Menu across the top (2026/11/12 "drop down section by section"): one row. Overview, a drop-down button per section (the
   admin's three in one Admin drop-down), the Account drop-down at the right. A panel opens below its button (clinic.js adds
   .nav-js: click, Esc, click outside); without JS a panel shows while its button has focus. The open page's section is underlined. */
.nav-dd-panel { display: none; }
.nav-bar.nav-js .nav-dd-btn[aria-expanded="true"] + .nav-dd-panel, .nav-bar:not(.nav-js) .nav-dd:focus-within > .nav-dd-panel { display: grid; gap: 2px; }
.nav-sub { margin: 10px 10px 2px; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); }
.nav-sub:first-child { margin-top: 4px; }
.nav-dd-panel .side-ver { margin: 6px 10px 2px; }
@media (max-width: 899px) {
    /* in the phone drawer the panels open in place under their button (all of them without JS) */
    .nav-bar:not(.nav-js) .nav-dd-panel { display: grid; gap: 2px; }
    .nav-dd-panel { padding-left: 12px; }
}
@media (min-width: 900px) {
    .nav-top.admin { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; }
    .nav-top .side { position: relative; z-index: 15; display: flex; align-items: center; gap: 16px; padding: 0 clamp(16px, 3vw, 40px);
        overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
    .nav-top .side-in { display: contents; }
    .nav-top .side .brand { margin: 0; font-size: 16px; white-space: nowrap; gap: 8px; }
    .nav-top .side .brand .brand-logo { width: 28px; height: 28px; }
    .nav-top .side .brand .brand-tag { display: none; }
    /* one row; at the biggest text size with long BM words at 900px it wraps instead of scrolling the page sideways */
    .nav-top .nav-bar { flex: 1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 4px; min-width: 0; }
    .nav-top .nav-bar > a, .nav-top .nav-bar .nav-dd-btn { width: auto; min-height: 48px; padding: 0 10px; border-left: 0; border-bottom: 2px solid transparent;
        border-radius: 0; white-space: nowrap; overflow-wrap: normal; }
    .nav-top .nav-bar > a[aria-current], .nav-top .nav-dd[data-current] > .nav-dd-btn { color: var(--accent); background: none; border-bottom-color: var(--accent); }
    .nav-dd { position: relative; }
    .nav-acct { margin-left: auto; }
    .nav-dd-panel { position: absolute; top: 100%; left: 0; z-index: 20; width: max-content; min-width: 220px; max-width: 320px;
        max-height: calc(100svh - 64px); overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
    .nav-acct .nav-dd-panel, .nav-dd-panel.nav-dd-end { left: auto; right: 0; }   /* nav-dd-end: clinic.js, near the right edge */
    .nav-top .nav-dd-panel a[aria-current] { background: var(--bg-alt); }
}
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
    .nav-top .nav-dd-panel a:hover, .nav-top .nav-dd-panel button:hover { background: var(--bg-alt); }
    .nav-top .nav-bar > a:hover, .nav-top .nav-bar .nav-dd-btn:hover { background: none; border-bottom-color: var(--line-strong); }
    .nav-top .nav-bar > a[aria-current]:hover, .nav-top .nav-dd[data-current] > .nav-dd-btn:hover { border-bottom-color: var(--accent); }
}

/* Top bar, one 56px row, 8px gaps: Menu (phones) · search (grows) · notifications · language · theme · name and role */
.admin-body { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 clamp(12px, 3vw, 40px);
    border-bottom: 1px solid var(--line); background: var(--bg); font-size: var(--fs-ui); }
.menu-btn { display: none; flex: none; }
.find { flex: 1 1 auto; min-width: 0; max-width: 560px; }
.find input { width: 100%; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.topbar-tools { display: flex; flex: none; align-items: center; gap: 8px; margin-left: auto; }
.topbar-user { flex: none; max-width: 240px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.topbar-user b { color: var(--ink); font-weight: 600; }
.lang-pick { display: flex; align-items: center; gap: 8px; margin: 0; }
.lang-pick select { min-height: 44px; padding: 0 6px 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
    font: 600 var(--fs-ui)/1.2 var(--sans); cursor: pointer; }
.topbar .theme, .login-tools .theme { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--surface); }
.bell { position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; color: var(--ink); }
.bell svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.bell .count { position: absolute; top: 2px; right: 0; min-width: 18px; margin: 0; padding: 0 5px; font-size: 11px; line-height: 18px; }
.bell[aria-current] { color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .bell:hover, .topbar .theme:hover { background: var(--bg-alt); text-decoration: none; } }
/* Phone: Menu button in, the user's name out (it is in My account) */
@media (max-width: 899px) {
    .menu-btn { display: inline-flex; }
    .topbar-user { display: none; }
}
/* Login and 2FA tools row (2026/11/15): the brand, then language and theme, all 44px high; the two controls never shrink and
   wrap together to the right on a narrow box instead of squeezing the theme name */
.login-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.login-box .login-tools .brand { flex: 1 1 0; min-width: 140px; min-height: 44px; margin: 0; white-space: normal; line-height: 1.3; }
.login-pick { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; max-width: 100%; margin-left: auto; }   /* may wrap: at 122% on a 320 px phone the row was 30 px too wide (kit 92760dd) */
.login-tools .lang-pick select, .login-tools .theme { height: 44px; min-height: 44px; }
.login-tools .lang-pick select { padding: 0 8px 0 12px; }
.login-tools .theme { flex: none; gap: 8px; min-width: 44px; padding: 0 14px 0 12px; font-weight: 600; }
@media (pointer: coarse) { .filters a { min-height: 44px; } }

.admin-main { min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 64px; }
.admin-main > * + * { margin-top: 16px; }
.admin-main h2 { font-size: 16px; margin-bottom: 10px; }
.sub { margin-top: 32px; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tile-num { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: var(--fs-ui); color: var(--muted); }
.tile-num b { font-size: 26px; font-weight: 600; color: var(--ink); }
.tile-num.alert { border-color: var(--accent); }
.cols { display: grid; gap: 16px; }
@media (min-width: 1100px) { .cols { grid-template-columns: 1fr 1fr; } }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.panel.narrow { max-width: 520px; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-ui); }
.message p { margin-block: 10px; white-space: normal; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; font-weight: 600; color: var(--muted); background: var(--surface); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.panel table th { background: none; }

/* .pill = a status label only (buttons use .btn) */
.pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 13px; color: var(--text); }
.pill.ok { border-color: var(--accent); color: var(--ink); }
.pill.bad { border-color: var(--danger-line); color: var(--danger); }
.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline select, .inline input, .search input { min-height: 44px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.search { display: flex; gap: 8px; max-width: 420px; }
.search input { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px; color: var(--text); font-size: var(--fs-ui); }
.filters a[aria-current] { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.notice.error { border-color: var(--danger-line); }
code { font-size: 12px; }

.admin-login { display: grid; place-items: center; min-height: 100svh; padding: 16px; }
.login-box { width: min(100%, 380px); }
.login-box .brand { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-ui); margin-bottom: 8px; }
.login-box .brand .brand-logo { width: 28px; height: 28px; }
.login-box h1 { margin-bottom: 20px; }
.login-box .form { margin-top: 16px; }
.login-box .form > .btn { justify-self: stretch; }   /* one main action: full width */
.login-box .small { margin-top: 16px; }

/* Profile and blog forms: wide, two columns (BM | EN) from 900px */
.form.wide { max-width: 1100px; }
.form.wide .panel { display: grid; gap: 14px; }
.grid2 { display: grid; gap: 14px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.form textarea { resize: vertical; line-height: 1.5; }
.thumb { width: 120px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb.wide-thumb { width: 240px; aspect-ratio: 16 / 9; }

/* Top bar, page head, counts and steps (layout as Up Album, Desmond 2026/10/27) */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 26px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; color: var(--on-accent); background: var(--accent); }
.side .side-item { margin: 6px 0 2px 10px; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.side .step { padding-left: 18px; }
.step-n { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; margin-right: 8px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 12px; font-weight: 600; }
.step-box { scroll-margin-top: 72px; }
.step-box h2 { display: flex; align-items: center; }
.qa { display: grid; gap: 4px; }
.qa-q { color: var(--ink); font-weight: 600; }
.qa-why { color: var(--muted); font-size: 13px; }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line); }
.checks { display: grid; gap: 6px; margin-bottom: 12px; }
.checks li { color: var(--muted); }
.checks li.is-ok { color: var(--ink); }
.checks li span[aria-hidden] { display: inline-block; width: 1.4em; color: var(--accent); }
.alert-line { border-color: var(--accent); }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.switch-row small { display: block; }

/* ---- Clinic (projects\medirawat\CLAUDE.md): search, language, patient banner, chips, queue states, print ---- */
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
td.num, th.num { text-align: right; }

/* Patient banner: sticky under the top bar, one calm row; the allergy is an outlined chip */
.pbanner { position: sticky; top: 56px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    margin: -24px calc(-1 * clamp(16px, 3vw, 40px)) 16px; padding: 10px clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--line); background: var(--surface); font-size: var(--fs-ui); }
.pbanner-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; color: var(--muted); }
.pbanner-who b { font-size: 16px; color: var(--ink); }
.pbanner-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 13px; color: var(--text); }
.chip--alert { border-color: var(--danger-line); color: var(--danger); font-weight: 600; }
.chip--alert > span { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--danger); color: var(--surface); font-size: 11px; }
.chip--warn { border-color: #b7791f; color: var(--warn); }

/* Status: a word and a small dot, never colour alone */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.st--waiting::before, .st--unpaid::before, .st--to_claim::before { background: #d69e2e; }
.st--called::before, .st--in_consult::before, .st--claimed::before { background: var(--accent); }
.st--done::before, .st--paid::before, .st--settled::before { background: #2f855a; }
.st--cancelled::before, .st--no_show::before, .st--void::before, .st--rejected::before { background: var(--danger-line); }
.row-now td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.wait-long { color: var(--warn); font-weight: 600; }

/* Long forms: labelled sections, two columns only for short pairs */
.fsec { display: grid; gap: 12px; }
.fsec + .fsec { margin-top: 20px; }
.fsec h2 { margin: 0; }
.pair { display: grid; gap: 12px; }
/* v0.3.12 (Desmond screenshot, Add to queue): a label beside one with a hint line was stretched to the same height, so its select
   or input grew taller; labels keep their own height and line up at the top */
.pair > label { align-content: start; }
@media (min-width: 720px) { .pair { grid-template-columns: 1fr 1fr; } .pair.three { grid-template-columns: 1fr 1fr 1fr; } }
.hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.hint.warn-old { color: var(--warn); font-weight: 600; }   /* v0.3.14.3: nationality free text from before the country list */
.form label[hidden] { display: none; }   /* v0.3.14.3: next of kin "Other" box until Other is chosen */
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Print: the same page, no app chrome (receipt, MC, prescription) */
.print-only { display: none; }
@media print {
    @page { size: A5; margin: 12mm; }
    /* Paper is white in every theme: the colour tokens go back to the light values (else Dark prints pale text) */
    :root, :root[data-theme] { --bg: #fff; --bg-alt: #f6f7f9; --surface: #fff; --ink: #121212; --text: #2b2b2b; --muted: #5c5c5c;
        --line: #e2e5ea; --line-strong: #8a909a; --accent: #1d5fc4; --on-ink: #fafaf7; --on-accent: #fafaf7; --danger: #b3261e; color-scheme: light; }
    .side, .topbar, .page-head .btn, .no-print, .skip, .toasts, [data-idle], .save-bar, .help-bar { display: none !important; }
    .admin { display: block; }
    .admin-main { padding: 0; }
    .print-only { display: block; }
    body { background: #fff; color: #000; font-size: 12px; }
    .panel, .table-wrap { border: 0; padding: 0; }
    .pbanner { position: static; margin: 0 0 8px; padding: 0 0 8px; border-bottom: 1px solid #000; }
    tr, .panel { break-inside: avoid; }
}

/* Front desk: patient list, register form, queue board */
.list-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.empty { display: grid; justify-items: start; gap: 12px; padding: 20px 0; color: var(--muted); }
.pform { max-width: 760px; }
.pform select.short { max-width: 160px; }
.switch-row span { color: var(--ink); }
.form .switch-row { display: flex; }
.form .switch-row input { min-height: 0; padding: 0; }
.qcounts { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: var(--fs-ui); }
.qcounts b { color: var(--ink); font-weight: 600; }
.queue .qno { font-size: 22px; font-weight: 600; color: var(--ink); text-align: right; }
.queue td { vertical-align: top; }
.queue .chip { margin-top: 4px; }
.qact { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.picks { display: grid; gap: 0; margin: 0; padding: 0; border: 0; }
.picks legend { margin-bottom: 4px; font-size: var(--fs-ui); color: var(--muted); }
.pdetails { min-width: 0; }
.pdetails .row > span:last-child { min-width: 0; overflow-wrap: anywhere; text-align: right; }

/* Care: consultation form, bills, claims */
.last-visit { margin: 0; }
.rx-rows { display: grid; gap: 12px; }
.rx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.rx-row label:first-child { grid-column: 1 / -1; }
.rx-row input { width: 100%; }
.rx-remove { min-height: 44px; min-width: 44px; justify-self: end; grid-column: 2; }
.rx-head { display: none; }
@media (min-width: 720px) {
    .rx-head, .rx-row { display: grid; grid-template-columns: 2fr 2fr 90px 130px 44px; gap: 8px; }
    .rx-head { font-size: var(--fs-ui); color: var(--muted); }
    .rx-row { padding-bottom: 0; border-bottom: 0; }
    .rx-row label:first-child { grid-column: auto; }
    .rx-remove { grid-column: auto; }
    .rx-lab { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
.care-notes { padding: 6px 0; font-size: var(--fs-ui); }
.care-notes p { margin: 4px 0 0; color: var(--ink); }
.care-old { color: var(--muted); }
.care-methods { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.care-methods legend { margin-bottom: 6px; font-size: var(--fs-ui); color: var(--muted); }
.form .care-methods label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); cursor: pointer; }
.form .care-methods input { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.care-methods label:has(input:checked) { border-color: var(--ink); font-weight: 600; }
.care-void summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: var(--fs-ui); cursor: pointer; }
.care-void .form { max-width: 420px; }
.care-payer { display: grid; gap: 10px; }
.care-payer + .care-payer { margin-top: 32px; }
.care-payer .page-head h2 { margin: 0; }
.st--billed::before { background: #2f855a; }
.claim-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.claim-act + .claim-act { margin-top: 6px; }
/* Claims row at phone width: date, note and buttons stack, each full width */
@media (max-width: 639px) {
    .claim-act { display: grid; gap: 6px; min-width: 220px; }
    .claim-act input { width: 100%; }
    .claim-btns .btn { flex: 1 1 auto; }
}
tfoot th { position: static; text-align: right; font-weight: 400; }
tfoot th, tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }

/* Print / PDF / Download for one document, kept together in the actions row (the documents themselves: document.css) */
.doc-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* Overview tiles: room for the words and RM amounts (Desmond 2026/11/11 "margin problem") */
.tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile-num { min-width: 0; overflow-wrap: anywhere; }
.tile-num b.num { text-align: left; }

/* Overview as Up Album (Desmond 2026/11/11): 5 numbers on top, boxes in columns, staff online, notification status */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 639px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { display: grid; gap: 4px; min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi__label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kpi__value { font-size: 30px; font-weight: 600; line-height: 1.15; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi.is-hot { border-color: var(--accent); }
.kpi.is-hot .kpi__value { color: var(--accent); }
.dash { columns: 3 320px; column-gap: 16px; margin-top: 16px; }
.admin-main .dash > .panel { display: block; break-inside: avoid; margin: 0 0 16px; }
.box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.box-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.box-head h2 .count { margin-left: 0; }
.box-head a { flex: none; font-size: 13px; white-space: nowrap; }
.empty-state { margin: 0; padding: 16px 8px; text-align: center; font-size: var(--fs-ui); color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.box-foot { margin-top: 10px; }
.need-list { display: grid; margin: 0; padding: 0; list-style: none; }
.need-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-ui); color: var(--ink); }
.need-list li:last-child { border-bottom: 0; }
.need-list small { color: var(--muted); }
.live { display: grid; margin: 0; padding: 0; list-style: none; }
.live__row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--line); font-size: var(--fs-ui); color: var(--ink); }
.live__row:last-child { border-bottom: 0; }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: #2f855a; }
.live__who small, .live__seen { font-size: 12px; color: var(--muted); }
.live__seen { white-space: nowrap; font-variant-numeric: tabular-nums; }
.home-numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 8px; }
.home-numbers div { padding: 10px 12px; border-radius: 8px; background: var(--bg-alt); }
.home-numbers dt { font-size: 12px; color: var(--muted); }
.home-numbers dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-numbers .is-late dd { color: var(--warn); }
.home-numbers dd .st { font-size: 12px; font-weight: 400; margin-left: 6px; }

/* Overview: date and a live clock, top right */
.today { font-size: 14px; }
.today .clock { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Notes: staff notes (doctor -> nurse / counter), replies, reminder; overdue = the word "Lewat" with a dot, not colour alone */
.notes { display: grid; gap: 12px; }
.note { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.note + .note { margin-top: 0; }
#notes .note { margin-bottom: 12px; }
.note--late { border-color: #b7791f; box-shadow: inset 3px 0 0 #b7791f; }
.note--done { background: var(--bg-alt); }
.note-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; }
.note-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-ui); color: var(--muted); }
.note-line { margin: 0; }
.note-body { margin: 0; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.note-replies { display: grid; gap: 4px; margin: 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); list-style: none; font-size: var(--fs-ui); }
.note-replies li { overflow-wrap: anywhere; }
.note-reply { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.note-reply input { flex: 1 1 200px; min-width: 0; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.note-reply .btn, .note-form .btn { min-height: 44px; }
.note-edit summary, .note-add > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); font-size: var(--fs-ui); font-weight: 600; }
.note-add { margin-top: 12px; }
.note-add[open] > summary { margin-bottom: 8px; }
.note-add--row { margin-top: 6px; }
.note-add--row[open] { min-width: 260px; }
.note-form { display: grid; gap: 10px; }
.note-form textarea, .note-form select { width: 100%; }
.note-remind { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; padding: 0; border: 0; }
.note-remind legend { margin-bottom: 4px; font-size: var(--fs-ui); color: var(--muted); }
.form .note-remind > label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); cursor: pointer; font-size: var(--fs-ui); }
.form .note-remind input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.note-remind label:has(input:checked) { border-color: var(--ink); font-weight: 600; }
.form .note-remind .note-at input { min-height: 36px; padding: 2px 8px; }
.note-remind .hint { flex-basis: 100%; }
.st--late { color: var(--warn); font-weight: 600; }
.st--late::before { background: #d69e2e; }
.note-chip { text-decoration: none; }
.note-chip .st { gap: 0; }
.note-link { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--fs-ui); }
.qmarks { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 13px; }
.note-mark { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; }
.note-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (pointer: coarse) { .note-mark { min-height: 44px; } }
/* Notifications: the bell count, the live cards bottom-right (notify.js), the list page */
[data-notify-count][hidden], [data-notify-num][hidden] { display: none; }
/* Live cards: newest on top, a 1px border and a stripe by kind, no shadow. Phones: full width with 16px gutters. On a page
   with a Save bar (consultation, patient form) or the help chat bar they sit above it. Under the idle sign-out bar (z 30). */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 25; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    width: min(360px, calc(100% - 32px)); pointer-events: none; }
body:has(.save-bar) .toasts { bottom: 96px; }
.toast { position: relative; padding: 10px 52px 6px 16px; border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: 10px;
    background: var(--surface); color: var(--text); font-size: var(--fs-ui); line-height: 1.45; pointer-events: auto; }
.toast p { margin: 0; overflow-wrap: anywhere; }
.toast-head { display: flex; flex-wrap: wrap; gap: 0 8px; }
.toast-kind { color: var(--ink); font-weight: 600; }
.toast-time, .toast-meta { color: var(--muted); }
.toast-text { color: var(--ink); }
.toast-view, .toast-more { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.toast-more { align-self: flex-end; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); pointer-events: auto; }
.toast-close { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px;
    background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.toast-close:hover { color: var(--ink); }
.toast--note, .toast--reply, .toast--due { border-left-color: var(--accent); }
.toast--help { border-left-color: var(--ink); }
.toast--stock, .toast--ops { border-left-color: var(--danger); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in 0.2s var(--ease); } }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } }
@media (max-width: 639px) {
    .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; }
    body:has(.save-bar) .toasts { bottom: 112px; }   /* the Save bar wraps to two rows on a phone */
}
@media (max-width: 899px) { body:has(.help-bar) .toasts { bottom: 88px; } }

/* v0.3.8 staff chat box: a Chat button bottom right (z 24, under the cards and the idle bar); the panel opens above it.
   On a page with a Save bar or the phone help bar the button sits above that bar, and the cards sit above the button.
   v0.3.10: chat windows (one per person) dock to the left of the list, newest nearest; a minimised one is its title bar. */
.chat { position: fixed; right: 24px; bottom: 24px; z-index: 24; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.chat > * { pointer-events: auto; }
.chat-main { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chat-dock { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; align-items: flex-end; gap: 8px; max-width: calc(100vw - 400px); }   /* minimised bars wrap above, never off screen */
.chat-dock:empty { display: none; }
.chat-win { display: flex; flex-direction: column; width: 300px; max-height: min(440px, calc(100dvh - 120px)); border: 1px solid var(--line-strong);
    border-radius: 12px; background: var(--surface); color: var(--ink); overflow: hidden; }
.chat-win--min { width: 220px; }
.chat-win--min .chat-head { border-bottom: 0; }
.chat-win-title { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none;
    color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.chat-win-title strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-win .chat-back { display: none; }
.chat-win .chat-x { width: 44px; }
.chat-win .chat-count { background: var(--danger); }
.chat-seen { align-self: flex-end; margin: -2px 0 0; color: var(--muted); font-size: 11px; }
.chat-foot { border-top: 1px solid var(--line); }
.chat-foot .chat-kept { border-top: 0; padding-top: 0; }
.chat-hide { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px 0; color: var(--muted); cursor: pointer; }
.chat-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong);
    border-radius: 99px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.chat-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.chat-btn .chat-count, .chat-person .chat-count { margin-left: 0; background: var(--danger); }
.chat [hidden] { display: none !important; }
.chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body:has(.chat) .admin-main { padding-bottom: 72px; }   /* the Chat button never covers the last row or the page links */
.chat-panel { display: flex; flex-direction: column; width: min(340px, calc(100vw - 32px)); max-height: min(480px, calc(100dvh - 200px));
    border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--line); }
.chat-head strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-x, .chat-back { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: none;
    color: var(--muted); font-size: 20px; cursor: pointer; }
.chat-x:hover, .chat-back:hover { color: var(--ink); }
.chat-people { margin: 0; padding: 4px 0; list-style: none; overflow-y: auto; }
.chat-person { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 44px; padding: 6px 12px; border: 0; background: none;
    color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.chat-line { display: flex; align-items: center; gap: 8px; width: 100%; }
.chat-when { flex: none; color: var(--muted); font-size: 12px; }
.chat-preview { display: block; padding-left: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.chat-person.unread .chat-name, .chat-person.unread .chat-preview { font-weight: 700; color: var(--ink); }
.chat-people--hide .chat-preview { visibility: hidden; }
.chat-person:hover, .chat-person:focus-visible { background: var(--bg); }
.chat-dot { flex: none; width: 10px; height: 10px; border: 1px solid var(--line-strong); border-radius: 50%; }
.chat-dot.on { border-color: #1e8e3e; background: #1e8e3e; }
.chat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-role { flex: none; color: var(--muted); font-size: 12px; }
.chat-none { padding: 12px; color: var(--muted); }
.chat-thread { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.chat-msgs { flex: 1 1 auto; min-height: 160px; padding: 8px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { align-self: flex-start; max-width: 85%; padding: 6px 10px; border-radius: 12px; background: var(--bg); }
.chat-msg.mine { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.chat-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-time { display: block; font-size: 11px; opacity: 0.75; text-align: right; }
.chat-empty { margin: auto; color: var(--muted); }
.chat-form { display: flex; gap: 8px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 120px; padding: 8px 10px; border: 1px solid var(--line-strong);
    border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.chat-error { margin: 0; padding: 0 12px 8px; color: var(--danger); }
.chat-kept { margin: 0; padding: 6px 12px; border-top: 1px solid var(--line); color: var(--muted); }
body:has(.chat) .toasts { bottom: 84px; }
/* v0.3.12 (Desmond screenshot: "this 3 column can adjust to one line"): on a computer the open chat windows and the chat list
   form one row: same height, same top and bottom (the windows sit above the Chat button like the list). Minimised bars unchanged. */
@media (min-width: 640px) {
    .chat:has(.chat-panel:not([hidden])) .chat-dock { margin-bottom: 52px; }   /* the Chat button (44) + the gap (8) */
    .chat-win:not(.chat-win--min), .chat-panel { height: min(480px, calc(100dvh - 200px)); max-height: none; }
}
body:has(.save-bar) .chat { bottom: 96px; }
body:has(.save-bar):has(.chat) .toasts { bottom: 156px; }
@media (max-width: 639px) {
    .chat { right: 16px; bottom: 16px; }
    body:has(.chat-panel:not([hidden])) .toasts { display: none; }   /* a card would cover the chat's typing box */
    body:has(.chat) .toasts { bottom: 76px; }
    body:has(.save-bar) .chat { bottom: 112px; }
    body:has(.save-bar):has(.chat) .toasts { bottom: 172px; }
}
@media (max-width: 899px) {
    body:has(.help-bar) .chat { bottom: 88px; } body:has(.help-bar):has(.chat) .toasts { bottom: 148px; }
    /* one window, full width above the Chat button, with a Back arrow to the list; minimised windows wait in the list */
    .chat-dock { position: fixed; left: 16px; right: 16px; bottom: 76px; }
    body:has(.save-bar) .chat-dock { bottom: 168px; }
    body:has(.help-bar) .chat-dock { bottom: 148px; }
    .chat-win { flex: 1 1 auto; width: auto; max-height: calc(100dvh - 200px); }
    .chat-win--min { display: none; }
    .chat-win .chat-back { display: grid; }
    .chat-dock { max-width: none; flex-wrap: nowrap; }
    body:has(.chat-win:not(.chat-win--min)) .toasts { display: none; }
}
@media (min-width: 900px) { body:has(.chat--win) .toasts { top: 72px; bottom: auto; } }   /* cards never cover a chat window's typing box */
@media print { .chat { display: none !important; } }
.row-new td { background: var(--bg); }
.logins-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.blocked-ip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.notify-desktop { max-width: 520px; }
.notify-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.notify-list a { display: grid; gap: 2px; padding: 12px 0; min-height: 44px; border-bottom: 1px solid var(--line); color: var(--text); }
.notify-list--new a b { color: var(--accent); }

/* Vitals: one short screen of number boxes, flags as words with a dot (screening cut-offs, not diagnosis) */
.vform { max-width: 760px; }
.vgrid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .vgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.vgrid input { width: 100%; min-height: 48px; font-size: 20px; font-variant-numeric: tabular-nums; }
.vgrid .vnote { grid-column: 1 / -1; }
.vgrid .vnote input { font-size: inherit; min-height: 44px; }
.vgrid input[aria-invalid="true"] { border-color: var(--danger-line); }
.vlast { margin: 0; }
.vitems { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.vitem { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.vflag { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.vflag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.vflag--warn { color: var(--warn); }
.vflag--warn::before { background: #d69e2e; }
.vflag--alert { color: var(--danger); }
.vflag--alert::before { background: var(--danger-line); }
.vflag--info { color: var(--muted); font-weight: 400; }
.vshort { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; color: var(--ink); }
.vline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: var(--fs-ui); }
.vtable td { white-space: nowrap; }

/* Content spacing (Sonnet audit): one rhythm for .admin-main, steps of 8/12/16/24; cards 12px radius, 16px padding */
.admin-main h2 { margin-bottom: 12px; }
.page-head > h1, .page-head > h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }   /* title and actions share one baseline; no stray h2 margin */
.page-head + .filters, .page-head + .list-bar { margin-top: 16px; }
.sub { margin-top: 24px; }
.sub > * + * { margin-top: 12px; }                      /* inside a section: head, table, hint, form at an even 12px */
.care-payer { gap: 12px; }
.care-payer + .care-payer { margin-top: 24px; }
.fsec + .fsec { margin-top: 0; }                       /* the .form grid already has a 16px gap */
.form.wide .panel { gap: 12px; }
.grid2 { gap: 16px; }
.pair, .note-form, .notes { gap: 12px; }
.row { padding: 8px 0; overflow-wrap: anywhere; }
.panel > .row:last-child, .panel > p.row:last-child { border-bottom: 0; }
.panel .table-wrap { border: 0; border-radius: 0; }    /* no box inside a box */
.empty { padding: 16px 0; }
.box-head { margin-bottom: 12px; }
.home-numbers { gap: 12px; }
.kpi, .note { padding: 16px; }
.notice, .vline { border-radius: 12px; }
.notice { padding: 12px 16px; }
.note-add[open] > summary { margin-bottom: 12px; }
@media (max-width: 639px) {
    .admin-main { padding-bottom: 48px; }
    .page-head > .actions-row, .page-head > .filters { width: 100%; }
    .search, .pform, .vform, .form.wide { max-width: 100%; }
    .panel.narrow, .care-void .form, .notify-desktop { max-width: 100%; }
}

/* Text size 1 to 5 per staff member (Desmond 2026/11/11): the whole clinic screen scales; 3 = normal */
html[data-text="1"] body.admin, html[data-text="1"] body.admin-login { zoom: 0.88; }   /* the login page too (this PC's ui_text cookie) */
html[data-text="2"] body.admin, html[data-text="2"] body.admin-login { zoom: 0.94; }
html[data-text="4"] body.admin, html[data-text="4"] body.admin-login { zoom: 1.1; }
html[data-text="5"] body.admin, html[data-text="5"] body.admin-login { zoom: 1.22; }
/* Full height at every text size (Desmond 2026/11/16 "text 1 to 5 also able to show until footer"): the zoom above also
   zooms 100svh, so size 1-2 left a gap under the menu and size 4-5 pushed My account / Log out below the screen.
   --tz is the same zoom; dividing by it gives exactly one screen height again. */
html[data-text="1"] { --tz: 0.88; } html[data-text="2"] { --tz: 0.94; } html[data-text="4"] { --tz: 1.1; } html[data-text="5"] { --tz: 1.22; }
.admin, .admin-login { min-height: calc(100svh / var(--tz, 1)); }
@media (min-width: 900px) { .admin:not(.nav-top) .side-in { min-height: calc(100svh / var(--tz, 1)); } }
/* S7: the small "New" after a menu name (config site.new, the current version only) */
sup.new { margin-left: 4px; font-size: 11px; font-weight: 600; line-height: 0; vertical-align: super; color: var(--accent); }
/* S4: text size = two buttons A- and A+ (5 steps; a button is off at its end) */
.text-pick { display: inline-flex; gap: 4px; margin: 0; }
.text-pick button { min-width: 44px; min-height: 44px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.text-pick button:disabled { opacity: .45; cursor: default; }
.text-pick .text-now { align-self: center; min-width: 44px; text-align: center; font-size: var(--fs-ui); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }   /* the size now, 88% to 122% (100% = normal) */

/* Idle sign-out warning (clinic.js, 9 of 10 minutes): one calm bar at the bottom, above everything, not a modal */
[data-idle] { position: fixed; left: 50%; bottom: 16px; z-index: 30; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    width: min(560px, calc(100% - 32px)); margin: 0; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); color: var(--ink); }
[data-idle][hidden] { display: none; }

/* Help: the top-bar button, the help chat (bubbles: me on the right, the help / admin on the left), Ask the admin, the book.
   Flat surfaces, no shadows; on phones the chat bar sits at the bottom of the chat panel and stays in view while scrolling */
.help-btn { display: inline-flex; flex: none; align-items: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 10px; border: 1px solid var(--line-strong);
    border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; }
.help-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.help-btn[aria-current] { border-color: var(--accent); color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .help-btn:hover { background: var(--bg-alt); text-decoration: none; } }
@media (max-width: 599px) {
    .help-btn { justify-content: center; padding: 0; }
    .help-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.help { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .help { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.help > * + * { margin-top: 0; }
.help-chat { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.help-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.help-chat-head h2 { margin: 0; }
.help-bar { display: flex; gap: 8px; }
.help-bar input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.help-bar .btn { flex: none; min-height: 44px; }
.help-thread { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.bubble { display: grid; gap: 4px; max-width: min(88%, 560px); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
    font-size: var(--fs-ui); color: var(--text); overflow-wrap: anywhere; }
.bubble p { margin: 0; white-space: pre-line; }
.bubble--me { align-self: flex-end; border-bottom-right-radius: 4px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--ink); }
.bubble--bot { align-self: flex-start; border-bottom-left-radius: 4px; background: var(--bg-alt); }
.bubble--wait { color: var(--muted); }
.bubble-who { font-size: 12px; font-weight: 600; color: var(--muted); }
.bubble-q { font-weight: 600; color: var(--ink); }
.bubble-time { justify-self: end; font-size: 12px; color: var(--muted); }
.bubble a { display: inline-flex; align-items: center; min-height: 32px; }
.bubble .btn { justify-self: start; }
.bubble-links { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.help-ask { border-top: 1px solid var(--line); padding-top: 8px; }
.help-ask > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); font-weight: 600; font-size: var(--fs-ui); }
.help-ask[open] > summary { margin-bottom: 8px; }
.help-mine { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.help-mine h3 { margin: 0; font-size: 15px; }
.hq-list { display: grid; gap: 12px; }
.hq { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.hq-list > * + * { margin-top: 0; }
.help-mine .hq { padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.hq--closed { background: var(--bg-alt); }
.hq-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-ui); }
.hq-actions form { display: flex; flex-wrap: wrap; gap: 8px; }
.hq-actions .btn { min-height: 44px; }
.help-book { display: grid; gap: 8px; min-width: 0; }
.help-book > * + * { margin-top: 0; }
.help-book-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.help-book-head h2 { margin: 0; }
.help-find { flex: 1 1 200px; max-width: 320px; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.help-topic { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.help-topic > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px; cursor: pointer; font-weight: 600; color: var(--ink); }
.help-topic[open] > summary { border-bottom: 1px solid var(--line); }
.help-topic > :not(summary) { margin: 0; padding: 0 16px; }
.help-what { padding-top: 12px !important; color: var(--muted); font-size: var(--fs-ui); }
.help-qa { border-bottom: 1px solid var(--line); }
.help-topic > .help-qa:last-of-type { border-bottom: 0; }
.help-qa > summary { display: flex; align-items: center; min-height: 44px; padding: 8px 0; cursor: pointer; color: var(--ink); }
.help-qa > p { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg-alt); color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.help-steps, .help-tips { padding: 12px 16px 12px 36px !important; }
.help-topic[hidden], .help-qa[hidden] { display: none; }
/* Phone: the bar under the thread, kept in view at the bottom while the chat scrolls */
@media (max-width: 899px) {
    .help-chat-head { order: 1; }
    .help-thread { order: 2; }
    .help-bar { order: 3; position: sticky; bottom: 0; z-index: 2; margin: 0 -16px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--surface); }
    .help-ask { order: 4; }
    .help-mine { order: 5; }
}

/* Payroll: runs table, payslip in three calm boxes (earnings, deductions, employer), net pay big, "how it was worked out" fold */
.st--pay-draft::before { background: #d69e2e; }
.st--pay-approved::before { background: var(--accent); }
.st--pay-paid::before { background: #2f855a; }
.pay-run tfoot th, .pay-run tfoot td { border-top: 2px solid var(--line-strong); font-weight: 600; }
.pay-run td .small { display: block; }
.pay-cols { display: grid; gap: 16px; }
@media (min-width: 900px) { .pay-cols { grid-template-columns: repeat(3, 1fr); } }
.pay-cols .panel h2 { margin: 0 0 8px; }
.pay-cols .row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.pay-total { border-bottom: 0; border-top: 2px solid var(--line-strong); margin-top: 4px; }
.pay-net { margin: 16px 0 0; font-size: 18px; }
.pay-net b { font-size: 28px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.pay-how summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.pay-steps { margin: 8px 0; padding-left: 20px; font-size: var(--fs-ui); line-height: 1.5; }
.pay-steps li + li { margin-top: 6px; }
.pay-steps li { overflow-wrap: anywhere; }
.pay-allow { display: grid; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.pay-allow legend { padding: 0 4px; font-weight: 600; }
.pay-files { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pay-files li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-rates { margin-top: 24px; }

/* Phone top bar (2026/11/11 check at 375 px: 6 controls were 32 px too wide): the tools may wrap onto a second row,
   the search takes its own full row, and the patient banner stops sticking so it never sits under a taller bar */
@media (max-width: 639px) {
    .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding-block: 6px; row-gap: 6px; }
    .topbar-tools { flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
    .topbar .find { order: 5; flex: 1 1 100%; max-width: none; }
    .topbar .lang-pick select { padding: 0 4px; }
    .pbanner { position: static; }
}

/* Login check boxes: Show password, Keep me logged in (44px rows) */
.form .check-row, .check-row { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; min-height: 44px; font-size: var(--fs-ui); color: var(--text); cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.check-row .hint { display: block; }

/* Staff notes like the Overview (Desmond 2026/11/11): numbers on top are the filters, notes on the left,
   the "Write a note" box on the right (stays in view while scrolling); one column on phones */
.kpi.is-current { border-color: var(--ink); }
.notes-page { display: grid; gap: 16px; align-items: start; margin-top: 16px; }
@media (min-width: 1000px) {
    .notes-page { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
    .notes-write { position: sticky; top: 72px; }
}
.notes-list > .notes { display: grid; gap: 12px; }
.notes-list .note { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px; }
.notes-list .note--late { border-color: #d69e2e; }
.notes-list .note--done { opacity: 0.85; }
.notes-list .note .note-reply { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.notes-list .note .note-reply input { flex: 1 1 200px; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.notes-write .note-form { display: grid; gap: 12px; }
.notes-write .note-form select, .notes-write .note-form textarea { width: 100%; }

/* One main button per queue row and per bill; the rest under "More" (44px summary, opens in place) */
.qmore[open] { flex-basis: 100%; }
.qmore > summary, .bill-more > summary { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; color: var(--muted); font-size: var(--fs-ui); cursor: pointer; }
.qmore[open] > summary, .bill-more[open] > summary { color: var(--ink); }
.qmore-list, .bill-more-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bill-more { margin-top: 16px; }
.bill-more-list { flex-direction: column; align-items: flex-start; gap: 12px; }
.draft-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.draft-offer[hidden], [data-draft-saved][hidden] { display: none; }

/* Medicines and stock (StockController): warnings are words with a dot, never colour only */
.st--stock-low::before, .st--stock-exp::before { background: #d69e2e; }
.st--stock-out::before { background: var(--danger-line); }
.st--stock-out, .st--stock-low { font-weight: 600; }

/* Privacy & PDPA, MyInvois, Notifiable diseases (Desmond 2026/11/11 "privacy-pdpa margin problem"):
   two boxes side by side from 1100 px, even 12 px spacing inside every box, folds with room under their title */
.page-compliance .cgrid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .page-compliance .cgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.page-compliance .panel > * + * { margin-top: 12px; }
.page-compliance .panel > .box-head + * { margin-top: 0; }
.page-compliance .panel.narrow { max-width: 640px; }
.page-compliance .notice + .panel, .page-compliance .panel + .panel, .page-compliance .filters + .panel { margin-top: 16px; }
.page-compliance .cfold { border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; background: var(--bg-alt); }
.page-compliance .cfold + .cfold { margin-top: 12px; }
.page-compliance .cfold > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; }
.page-compliance .cfold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.page-compliance .cfold > form { padding-bottom: 16px; }
.page-compliance .form { display: grid; gap: 12px; }
.page-compliance .form label:not(.switch-row):not(.check):not(.check-row) { display: grid; gap: 4px; }
.page-compliance .form input:not([type=checkbox]):not([type=radio]), .page-compliance .form textarea, .page-compliance .form select { width: 100%; }
.page-compliance .cgrid > .panel { margin-top: 0; }   /* the grid gap is the only space between the two boxes */
.page-compliance .row { padding: 8px 0; }

/* Stock home (Desmond 2026/11/19 "stock system ... notification when stock low"): six numbers on top are the filters,
   two boxes (Need to order, Expiring soon), then every item; states are words with a dot, never colour only */
.st--stock-ok::before { background: #2f855a; }
.st--stock-new::before, .st--stock-empty::before { background: var(--muted); }
.stock-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.stock-more { position: relative; display: none; }
.stock-more > summary { list-style: none; cursor: pointer; }
.stock-more > summary::-webkit-details-marker { display: none; }
.stock-more-list { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; display: grid; min-width: 200px; padding: 6px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 20px rgb(0 0 0 / 0.12); }
.stock-more-list a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 8px; }
@media (max-width: 639px) {
    .stock-wide { display: none; }
    .stock-more { display: block; }
}
.stock-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 639px) { .stock-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stock-dash { columns: 2 340px; }
.stock-order li, .stock-exp li { align-items: flex-start; }
.stock-order li > span:first-child, .stock-exp li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.stock-order .st, .stock-exp .st { margin-left: 4px; }
.stock-suggest { flex: none; text-align: right; white-space: nowrap; }
.stock-suggest b { font-size: 1.15em; }
.stock-exp form { flex: none; }
.stock-items { margin-top: 0; }
.stock-items .list-bar { margin-bottom: 12px; }
.stock-items > .hint { margin-top: 8px; }
.stock-status { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.stock-use { position: relative; }
.stock-use > summary { list-style: none; cursor: pointer; }
.stock-use > summary::-webkit-details-marker { display: none; }
.stock-use[open] > form { display: grid; gap: 8px; min-width: 220px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stock-use form label { display: grid; gap: 4px; }
.stock-use form input { min-height: 44px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
[data-medicine-only][hidden] { display: none; }
.stock-unit { display: none; }
.stock-lbl { display: none; }
/* Phone: each item is a small card (name on top, then on hand, nearest expiry, status, Use), no sideways scroll */
@media (max-width: 639px) {
    .stock-table .opt, .stock-table thead { display: none; }
    .stock-unit, .stock-lbl { display: inline; }
    .stock-lbl { color: var(--muted); font-size: 0.85em; }
    .stock-items .search { max-width: none; width: 100%; }
    .stock-items .table-wrap { overflow: visible; }
    .stock-table, .stock-table tbody { display: block; width: 100%; }
    .stock-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
    .stock-table td { display: block; padding: 0; border: 0; text-align: left; }
    .stock-table td:first-child { flex-basis: 100%; }
    .stock-table td:empty { display: none; }
}

/* ---- Builder OPS (2026/11/12): go-live red box on the Overview, breach steps on Privacy & PDPA ---- */
.golive-box { margin-bottom: 16px; padding: 12px 16px; border: 2px solid var(--danger-line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.golive-box h2 { margin: 0 0 4px; color: var(--danger); font-size: 1.05em; font-weight: 600; }
.golive-box p { margin: 4px 0; }
.golive-box ul { margin: 8px 0; padding-left: 20px; }
.golive-box li { min-height: 28px; }
.breach-steps { display: grid; gap: 0; margin: 8px 0 4px; padding-left: 24px; }
.breach-steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 44px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.breach-steps li:last-child { border-bottom: 0; }
.breach-steps li.is-done b { font-weight: 400; color: var(--muted); }
.breach-steps li.is-overdue b { color: var(--danger); }
/* Money (2026/11/21): day-end closing, payment reference, short-paid claims, returning-patient card */
.dayend-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dayend-pick input { min-height: 44px; }
.dayend-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dayend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.dayend-grid > .panel { margin-top: 0; }
.dayend-cash { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.dayend-cash dt { color: var(--muted); }
.dayend-cash dd { margin: 0; }
.dayend-reopen > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.dayend-history { margin: 0; padding-left: 20px; }
.claim-settled { display: inline-flex; align-items: center; gap: 6px; }
.claim-settled input { width: 90px; }
.short-paid { margin-top: 24px; }
.pcard { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 0.9em; color: var(--muted); }
.pcard .chip { color: inherit; }
.pcard-owe { color: var(--ink); font-weight: 600; }
/* ---- Doctor tools (builder DOCTOR 2026/11/12): allergy line, override, dose preview, favourites, review list ---- */
.rx-allergy { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; }
.rx-allergy--has { border-color: var(--danger-line); }
.rx-allergy--has > b { color: var(--danger); }
.rx-allergy .hint { display: block; }
.rx-warn { margin: 0 0 12px; }
.rx-override { display: grid; gap: 8px; margin: 0 0 12px; }
.rx-preview { grid-column: 1 / -1; min-height: 0; }
.rx-preview:empty { display: none; }
.fav-pick { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.fav-pick .hint { flex-basis: 100%; margin: 0; }
.fav-save { margin-top: 12px; }
.pair[data-medicine-only][hidden] { display: none; }
.review-table .st { white-space: nowrap; }

/* What's new (v0.2.0): the release list page (the link under the menu is with the menu rules at the top) */
/* What's new, wide (Desmond 2026/11/16): version + date on the left, changes on the right; one column on phones */
.wn-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 1200px; margin: 0 0 16px; }
.wn-jump a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .9em; }
.wn-jump a:hover, .wn-jump a:focus-visible { border-color: var(--accent); color: var(--accent); }
.whatsnew { display: grid; gap: 16px; max-width: 1200px; }
.wn-release { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 28px; padding: 20px 24px; scroll-margin-top: 80px; }
.wn-release.is-latest { border-left: 4px solid var(--accent); }
.wn-head { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.wn-head h2 { margin: 0; font-size: 1.35em; font-weight: 700; }
.wn-date { color: var(--muted); font-size: .92em; }
.wn-tag { padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8em; font-weight: 600; }
.wn-items { margin: 0; padding: 0; list-style: none; }
.wn-items li { position: relative; padding: 10px 0 10px 22px; border-top: 1px solid var(--line); line-height: 1.6; font-size: 1.04em; }
.wn-items li:first-child { border-top: 0; padding-top: 2px; }
.wn-items li::before { content: ''; position: absolute; left: 4px; top: 1.15em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.wn-items li:first-child::before { top: calc(2px + .65em); }
@media (max-width: 639px) {
    .wn-release { grid-template-columns: 1fr; padding: 16px; }
    .wn-head { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
}

/* Split login (partner design 2026/11/12): form left, dark e-Rawat panel right; one column on phones */
.login-split { padding: 0; }
@media (min-width: 900px) {
    .login-split { grid-template-columns: minmax(380px, 27%) 1fr; place-items: stretch; }
    .login-split .login-box { align-self: center; justify-self: center; width: min(100% - 48px, 340px); }
}
.login-split .login-box { padding: 24px 16px; }
.login-intro { margin: -12px 0 8px; }
.login-panel { display: none; }
@media (min-width: 900px) {
    .login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: calc(100svh / var(--tz, 1)); padding: 32px; text-align: center; color: #c9d6e6; background: #0b2440; }
    .login-panel img { width: 150px; height: 150px; margin-bottom: 20px; border-radius: 50%; }
    .login-name { margin: 0; font-size: 56px; font-weight: 600; line-height: 1.1; color: #fff; letter-spacing: -0.01em; }
    .login-name span { color: #2ec8ec; }
    .login-tag { margin: 4px 0 16px; font-size: 14px; letter-spacing: 0.3em; color: #2ec8ec; }
    .login-line { max-width: 280px; margin: 0; font-size: 15px; }
}

/* What's new box on the Overview */
.whatsnew-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* Drug box picks from the medicine stock (doctor-tools.js): a list under the box, in stock first */
.rx-row label { position: relative; }
.drug-pick { position: absolute; left: 0; top: 100%; z-index: 30; width: max(100%, 320px); max-width: calc(100vw - 32px); max-height: 300px; overflow-y: auto; margin: 4px 0 0; padding: 4px; list-style: none; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.drug-pick li { display: flex; flex-direction: column; gap: 2px; min-height: 44px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.drug-pick li[aria-selected="true"], .drug-pick li:hover { background: var(--bg-alt); }
.drug-pick__name { color: var(--ink); font-weight: 600; }
.drug-pick__meta { font-size: 13px; color: var(--muted); }
.drug-pick li.is-out .drug-pick__name { color: var(--muted); font-weight: 400; }
.drug-pick li.drug-pick__none { color: var(--muted); cursor: default; font-size: 13px; }

/* Phone top bar and warning colour (builder PHONE 2026/11/15).
   --warn: the warning text colour (waiting long, late, amber chips and flags), 4.5:1 or better on every theme:
   #8a5a00 on Light and Silver, #f0c36d on Dark. Use var(--warn) for any new warning text. */
:root, :root[data-theme="light"], :root[data-theme="silver"] { --warn: #8a5a00; }
:root[data-theme="dark"] { --warn: #f0c36d; }
/* Status dots on Claude Code black: the green of Light and Silver is 2.9:1 on a dark card, this one 5.1:1 (S6) */
[data-theme="dark"] :is(.st--done, .st--paid, .st--settled, .st--billed, .st--pay-paid, .st--stock-ok)::before, [data-theme="dark"] .live__dot { background: #4cb37f; }
/* No data-theme (a page before the theme is set): the light value from :root, or dark when the device is dark. That is
   enough; the review (2026/11/16, B14) left it as it is. */
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { --warn: #f0c36d; } }
/* A field moved into view never hides under the sticky bar: clinic.js measures the bar (--topbar-h on screen, --topbar-in
   inside the text-size zoom); 56px without JavaScript */
html { scroll-padding-top: calc(var(--topbar-h, 56px) + 8px); }
@media (max-width: 899px) { .side.is-open { top: var(--topbar-in, 56px); } }
/* Text size, language and theme: in the top bar on wider screens, in the Menu drawer on phones */
.side-picks { display: none; }
@media (max-width: 639px) {
    /* one row: Menu, search (takes what is left), help, bell */
    .topbar { flex-wrap: nowrap; height: auto; min-height: 56px; padding-block: 6px; }
    .topbar-tools { flex-wrap: nowrap; gap: 6px; }
    .topbar .find { order: 0; flex: 1 1 auto; min-width: 0; max-width: none; }
    .topbar-picks { display: none; }
    .side-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; padding: 12px 16px; border-top: 1px solid var(--line); }
    .side-picks .theme { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--surface); }
    .side-picks .theme .theme-name { display: inline; }
    /* a long button word wraps instead of pushing the page wider than the phone (text size 5 made it 385 px) */
    .btn { max-width: 100%; white-space: normal; }
}
@media (min-width: 640px) { .topbar-picks { display: contents; } }
/* v0.3.10.5 tight top bar (A- 100% A+ added about 52 px): measured on the bar's own width, so text size 5 (zoom 1.22) and an
   open side menu count too. Under 860 px the Help word and the theme name hide (icon and label stay), so the search keeps room. */
.topbar { container: topbar / inline-size; }
@container topbar (max-width: 860px) {
    .topbar .help-btn { justify-content: center; padding: 0; }
    .topbar .help-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .topbar .theme .theme-name { display: none; }
}
/* under 700 px (text size 5 with the side menu open on a 1024 px screen) the name goes too; it is in My account */
@container topbar (max-width: 700px) { .topbar-user { display: none; } }
/* Builder FLOW (2026/11/15): Next patient button (key X), "vitals done" tick for doctors, + Queue on patient search
   results, 1 / 2 / 3-day MC buttons */
.next-patient { display: inline-flex; margin: 0; }
.next-patient kbd { font: inherit; font-size: 12px; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; opacity: 0.8; }
.vdone { color: var(--muted); }
.qadd { display: inline-flex; margin: 0 0 0 8px; vertical-align: middle; }
.qadd .btn { min-height: 44px; }
.qin { display: inline-flex; align-items: center; min-height: 44px; margin-left: 8px; }
.mc-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; }
.mc-quick .btn { min-height: 44px; min-width: 44px; }
/* ---- Night build 2026/11/15, builder MONEY: cash received box on the bill page (till.js; display only) ---- */
.till-cash { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-alt); }
.till-cash[hidden] { display: none; }
.till-notes { display: flex; flex-wrap: wrap; gap: 8px; }
.till-notes .btn { min-width: 72px; min-height: 44px; }
.till-change { margin: 0; min-height: 1.5em; font-size: 1.25em; font-weight: 600; color: var(--ink); }
.till-change--short { color: var(--danger); }

/* Demo server bar (v0.3.2): every clinic screen and the login page say the data is made up and cleared each night */
.demo-bar { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; border: 1px solid #e0b100; background: #fff4c2; color: #4a3800; font-size: .9em; }
[data-theme="dark"] .demo-bar { background: #3a3000; border-color: #8a6d00; color: #ffe79a; }
/* Demo bar above a patient banner (Desmond 2026/11/20 screenshot): the banner's -24px top margin (it hugs the top bar) slid it 12 px over
   the yellow bar; after the demo bar it starts below it instead */
.demo-bar + .pbanner { margin-top: 0; }
/* (same screenshot) the vitals line said margin 0 0 12px, which cancelled the 16px gap .admin-main gives under the page title and
   its buttons; now only its bottom margin is set */
.owner-made textarea { width: 100%; min-height: 11em; font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.owner-table td, .owner-table th { vertical-align: top; }
.owner-table .actions-row form { display: inline; }
.owner-msg { padding: 10px 0; border-bottom: 1px solid var(--line); }
.owner-msg:last-child { border-bottom: 0; }
.owner-msg p { margin: 0; }
.owner-msg p + p { margin-top: 4px; }

/* Sales console (v0.3.3) */
.flag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .78em; font-weight: 600; border: 1px solid var(--line); }
.flag-hot { background: #ffe1d6; border-color: #e8794f; color: #7a2a0c; }
.flag-warm { background: #fff4c2; border-color: #e0b100; color: #4a3800; }
.flag-idle, .flag-never { background: var(--surface); color: var(--muted, #666); }
[data-theme="dark"] .flag-hot { background: #4a2112; color: #ffc3ab; }
[data-theme="dark"] .flag-warm { background: #3a3000; color: #ffe79a; }
.chip { display: inline-block; margin: 0 6px 6px 0; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: .9em; }
.owner-form, .owner-lead-form { max-width: 640px; }
.owner-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 16px; }
.owner-text { overflow-wrap: anywhere; white-space: pre-line; }
.owner-lead { margin-bottom: 12px; }
.owner-lead p { margin: 0 0 6px; }
.owner-line { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.owner-line:last-child { border-bottom: 0; }
.owner-actions { margin-top: 8px; }
.owner-actions form { display: inline; }
.owner-tiles { margin-bottom: 16px; }
.tl-did td{font-weight:600}
.journey{border-top:1px solid var(--line,#ddd);padding-top:12px;margin-top:14px}
.journey-head{font-size:1rem;margin:0 0 4px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.journey-meta{margin:0 0 8px;font-size:.9rem}
.journey-links{margin:0 0 8px;padding-left:18px}

/* Medicine guide inside the clinic (admin/guide/show.blade.php + partials/guide-body) */
.gd-h2{font-size:1rem;margin:12px 0 4px}
.gd-facts,.gd-dose{margin:0 0 8px;display:grid;gap:2px 16px;grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}
.gd-facts dt,.gd-dose dt{font-size:.85rem;opacity:.75}
.gd-facts dd,.gd-dose dd{margin:0;font-weight:600}
.gd-med{margin:0 0 8px;padding:8px 12px;border:1px solid var(--line, #d8dee6);border-radius:8px}
.gd-name{margin:0 0 4px;font-size:1rem}
.gd-flag{margin:0 0 4px;font-weight:700}
.guide-line{margin-left:8px}
/* Patient questions thread (Desmond 2026/11/20 screenshot: the last message touched the reply box and Switch off sat on the Reply row):
   space after the messages, after the reply row, the Reply button as tall as the box */
.guide-thread .help-thread{margin:0 0 16px}
.guide-thread .note-reply{margin:0 0 16px;align-items:stretch}
.guide-thread .note-reply .btn{min-width:96px}
.guide-thread > .actions-row{padding-top:12px;border-top:1px solid var(--line)}

/* Security page (2026/11/20, admin/security/index): one panel per part, the You card as label / value pairs */
.sec-page > .panel { margin: 0 0 16px; }
.sec-page > .panel h2 { margin-top: 0; }
.sec-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; margin: 0 0 12px; }
.sec-facts dt { font-size: var(--fs-ui); color: var(--muted); }
.sec-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.row-me td { background: var(--bg); }
.sec-block input[type="text"] { width: 12em; }
.sec-allow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sec-allow-add { margin-top: 12px; gap: 12px; }

/* ---- Past visits beside the consultation form (feat-history, Desmond 2026/11/20 "patient visit history side by side").
   .cform is a container: when the content column is 980px or more (text size 1-3 on a wide screen) the history is a
   column right of the form, sticky under the top bar + the sticky patient banner (care.js measures the banner into
   --pbanner-in, inside the text-size zoom like --topbar-in) with its own scroll. Narrower (or text size 4-5, whose zoom
   makes the column narrower): a section above the form that opens and closes (closed on phones, care.js). ---- */
.cform { container: cform / inline-size; }
.cform-grid { display: grid; gap: 16px; align-items: start; }
.cform-main { min-width: 0; }
.cform-main > .form.wide { max-width: none; }
.chx { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: var(--fs-ui); }
.chx-sum { display: flex; align-items: center; min-height: 44px; padding: 8px 14px; cursor: pointer; }
.chx-sum h2 { margin: 0; font-size: 16px; }
.chx-n { color: var(--muted); font-weight: 400; }
.chx-box[open] > .chx-sum { border-bottom: 1px solid var(--line); }
.chx-body { padding: 4px 14px 12px; }
.chx-none { margin: 8px 0 0; }
.chx-list { margin: 0; padding: 0; list-style: none; }
.chx-item { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.chx-item:last-child { border-bottom: 0; }
.chx-item p { margin: 0; }
.chx-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.chx-head a { font-weight: 600; }
.chx-text { white-space: pre-line; }
.chx-notes > summary { cursor: pointer; }
.chx-notes[open] > summary .chx-more { display: none; }
.chx-notes > p { margin: 4px 0 0; }
.chx-more { color: var(--accent); font-weight: 600; }
.chx-rx { margin: 0; padding-left: 18px; }
.chx-vitals .vitems { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.chx-older { margin: 8px 0 0; }
@container cform (min-width: 980px) {
    .cform-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
    .cform-main { grid-column: 1; grid-row: 1; }
    .chx { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--topbar-in, 56px) + var(--pbanner-in, 0px) + 12px);
        max-height: calc(100svh / var(--tz, 1) - var(--topbar-in, 56px) - var(--pbanner-in, 0px) - 24px); overflow-y: auto; overscroll-behavior: contain; }
    .chx-sum { cursor: default; list-style: none; }   /* always open beside the form (care.js keeps it open) */
    .chx-sum::-webkit-details-marker { display: none; }
    .chx-box > .chx-sum { position: sticky; top: 0; z-index: 1; background: var(--surface); border-radius: 12px 12px 0 0; }
}
@media print { .chx { display: none; } }

/* Staff activity timeline (v0.3.12, admin/staffday/show): one line per step with a left rule and a dot, no list numbers */
.staffday-line { margin: 0 0 16px; padding: 0 0 0 16px; list-style: none; border-left: 2px solid var(--line); }
.staffday-line li { position: relative; padding: 6px 0 6px 12px; line-height: 1.45; }
.staffday-line li::before { content: ""; position: absolute; left: -22px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.staffday-line li b { font-variant-numeric: tabular-nums; margin-right: 4px; }

/* Password eye (Desmond 2026/11/20, partials/password-eye + main.js): a 44 px button over the right end of the field.
   Colours from the theme tokens, so it follows silver/dark; the admin text size (--tz) zooms it with the page. */
.pw-field { position: relative; display: block; }
span.pw-field { display: inline-block; }
.pw-field input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 1px; bottom: 1px; display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover { color: var(--ink); }
.pw-eye[hidden] { display: none; }
.pw-eye svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .pw-eye-shut, .pw-eye[aria-pressed="true"] .pw-eye-open { display: none; }
.pw-eye[aria-pressed="true"] .pw-eye-shut { display: block; }
@media (forced-colors: active) { .pw-eye { color: ButtonText; } }

/* Patient flow after the doctor (2026/11/21): Prepare medicine -> Collect payment -> Paid on the queue row; take over another doctor's patient */
.st--stage-prepare::before { background: #d69e2e; }
.st--stage-prepare, .qcount-prepare b { font-weight: 600; }
.st--stage-pay::before { background: var(--accent); }
.st--stage-paid::before { background: #2f855a; }
[data-theme="dark"] .st--stage-paid::before { background: #4cb37f; }
.next-others { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 12px; }
/* Visit times (admin): averages on top, slowest step marked */
.vt-avg { margin-bottom: 12px; }
.vt-avg .kpi.is-hot .kpi__value { color: var(--warn); }
.vt-table td.num, .vt-table th.num { white-space: nowrap; }
.vt-table tfoot td { font-weight: 600; border-top: 2px solid var(--line-strong); }
