/* Prysen modern theme layer (18 Nov 2026). Loaded last. Refines the look without changing behaviour:
   Inter type scale, softer surfaces, 10-12px radii, layered shadows, refined blue tints, polished chips/badges/tables,
   subtle motion (off under prefers-reduced-motion). Every text/background pair here is >= 4.5:1, UI borders >= 3:1. */
:root {
  --blue:#0b5fd8; --blue-600:#0a52bd; --blue-700:#0843a0; --blue-50:#f2f7ff; --blue-100:#e3edff; --blue-200:#c6dbff;
  --navy:#0b1630; --ink:#1b2540; --muted:#566477; --line:#e6eaf1; --line-strong:#d5dbe6; --bg:#f6f8fb; --card:#fff;
  --label:#2d3a52; --input:#7b8798;
  --r-sm:8px; --r:10px; --r-lg:12px;
  --sh-1:0 1px 2px rgba(16,24,40,.05); --sh-2:0 1px 3px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.05); --sh-3:0 4px 8px rgba(16,24,40,.06), 0 16px 32px rgba(16,24,40,.10);
  --ease:cubic-bezier(.2,.7,.2,1);
}
body { font-family:Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-feature-settings:"cv11","ss01"; -webkit-font-smoothing:antialiased; background:var(--bg); color:var(--ink); font-size:14px; line-height:1.5; }
h1 { font-family:Inter, ui-sans-serif, system-ui, sans-serif; font-size:24px; font-weight:700; letter-spacing:-.022em; color:var(--navy); }
h2 { font-family:Inter, ui-sans-serif, system-ui, sans-serif; font-size:15px; font-weight:600; letter-spacing:-.01em; color:var(--navy); }
h3 { font-weight:600; letter-spacing:-.005em; color:var(--navy); }
a { color:var(--blue); text-underline-offset:2px; }
a:hover { color:var(--blue-700); }
.sub { color:var(--muted); }

/* Header */
.topbar { background:rgba(255,255,255,.92); backdrop-filter:saturate(180%) blur(8px); border-bottom:1px solid var(--line); box-shadow:var(--sh-1); position:sticky; top:0; }
nav#nav a, .navgroup-btn { color:#3b4862; font-weight:500; border-radius:var(--r-sm); transition:background-color .15s var(--ease), color .15s var(--ease); }
nav#nav a:hover, .navgroup-btn:hover { background:var(--blue-50); color:var(--blue-700); }
nav#nav a.on, .navgroup.on > .navgroup-btn { background:var(--blue-100); color:var(--blue-700); box-shadow:inset 0 0 0 1px var(--blue-200); }
.navmenu { border-radius:var(--r-lg); box-shadow:var(--sh-3); border-color:var(--line); padding:6px; }
nav#nav .navmenu a { border-radius:var(--r-sm); }
.testbanner { background:linear-gradient(90deg,#eef4ff,#f4f8ff); color:#0b3a8c; border-bottom:1px solid var(--blue-200); }

/* Surfaces */
.card { border-radius:var(--r-lg); border:1px solid var(--line); box-shadow:var(--sh-2); }
.card.section, .card.filters { box-shadow:var(--sh-1); }
.callcard, .lp-q { border-radius:var(--r-lg); border:1px solid var(--line); box-shadow:var(--sh-1); transition:box-shadow .18s var(--ease), border-color .18s var(--ease); }
.callcard:hover, .lp-q:hover { box-shadow:var(--sh-2); border-color:var(--line-strong); }
.callcard.emerg { border-left:3px solid #dc2626; }

/* Stat tiles */
.stat { background:#fff; border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--sh-1); padding:16px 18px; }
.stat .k { font-size:12px; text-transform:none; letter-spacing:0; color:var(--muted); font-weight:500; display:flex; align-items:center; gap:8px; }
.stat .v { font-family:Inter, ui-sans-serif, system-ui, sans-serif; font-size:26px; font-weight:700; letter-spacing:-.025em; color:var(--navy); font-variant-numeric:tabular-nums; }
.stat .s { color:var(--muted); font-size:12px; }
.stat-link { transition:border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease); }
.stat-link:hover { border-color:var(--blue-200); box-shadow:var(--sh-3); transform:translateY(-2px); }
.ico { width:18px; height:18px; flex:none; display:inline-block; vertical-align:-3px; }
.stat .k .ico { width:28px; height:28px; padding:6px; border-radius:8px; background:var(--blue-50); color:var(--blue); }
.stat .k .ico.i-red { background:#fef2f2; color:#b91c1c; } .stat .k .ico.i-green { background:#ecfdf5; color:#047857; } .stat .k .ico.i-amber { background:#fffbeb; color:#b45309; } .stat .k .ico.i-violet { background:#f5f3ff; color:#6d28d9; }

/* Buttons */
.btn { border-radius:var(--r-sm); font-family:Inter, ui-sans-serif, system-ui, sans-serif; font-weight:600; box-shadow:0 1px 2px rgba(11,95,216,.25), inset 0 1px 0 rgba(255,255,255,.12); transition:background-color .15s var(--ease), box-shadow .15s var(--ease), transform .05s; }
.btn:hover { background:var(--blue-600); }
.btn:active { transform:translateY(1px); }
.btn.secondary { background:#fff; color:var(--ink); border:1px solid var(--line-strong); box-shadow:var(--sh-1); }
.btn.secondary:hover { background:#f8fafd; border-color:#b9c3d3; }
.btn.soft { background:var(--blue-50); color:var(--blue-700); border:1px solid var(--blue-200); box-shadow:none; }

/* Inputs */
input, select, textarea { border-radius:var(--r-sm); border-color:var(--input); transition:border-color .15s var(--ease), box-shadow .15s var(--ease); }
input:focus, select:focus, textarea:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(11,95,216,.16); }

/* Chips & badges */
.chip { border-radius:999px; border:1px solid var(--line-strong); background:#fff; color:#3b4862; font-weight:500; transition:background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.chip:hover { border-color:var(--blue-200); background:var(--blue-50); color:var(--blue-700); }
.chip.on, .chip[aria-pressed="true"] { background:var(--blue-100); border-color:var(--blue); color:var(--blue-700); font-weight:600; box-shadow:inset 0 0 0 1px var(--blue); }
.badge { border-radius:999px; font-size:12px; font-weight:600; padding:3px 10px 3px 8px; display:inline-flex; align-items:center; gap:6px; }
.badge::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.85; flex:none; }
.lp-chip { border-radius:999px; font-weight:600; }

/* Tables */
table.list th, table.tbl th, .sm-tbl th { font-size:12px; text-transform:none; letter-spacing:0; color:var(--muted); font-weight:600; background:#fafbfd; border-bottom:1px solid var(--line); }
table.list td, table.tbl td { border-bottom:1px solid #eef1f6; }
table.list tbody tr:hover td { background:#fafcff; }
td.num, th.num { font-variant-numeric:tabular-nums; text-align:right; }
.tscroll { border-radius:var(--r); }

/* Do this first / panels */
.dofirst { border-left:0; background:linear-gradient(180deg,#fff, #fbfcff); }
.df-row { border-radius:var(--r); transition:background-color .15s var(--ease); }
.df-row:hover { background:var(--blue-50); }
.df-n { background:var(--blue); color:#fff; font-variant-numeric:tabular-nums; box-shadow:0 1px 2px rgba(11,95,216,.3); }
.df-done .df-n { background:#047857; }
.morningpanel { background:linear-gradient(135deg,#f2f7ff 0%, #ffffff 70%); border-color:var(--blue-200); }
.chipbar { gap:8px; }

/* Charts */
figure.chart { background:#fff; border:1px solid var(--line); border-radius:var(--r-lg); padding:14px 16px; box-shadow:var(--sh-1); }
figure.chart figcaption { font-weight:600; color:var(--navy); }

/* Empty states: soft illustration (data: SVG, CSP img-src data: allowed) */
.empty, #cbNone, .lp-empty { text-align:center; padding:36px 16px 28px; color:var(--muted); }
.empty::before, #cbNone::before, .lp-empty::before { content:""; display:block; width:120px; height:84px; margin:0 auto 12px;
  background:no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 84'%3E%3Crect x='14' y='14' width='92' height='60' rx='10' fill='%23f2f7ff' stroke='%23c6dbff' stroke-width='2'/%3E%3Crect x='26' y='28' width='44' height='6' rx='3' fill='%23c6dbff'/%3E%3Crect x='26' y='40' width='64' height='6' rx='3' fill='%23e3edff'/%3E%3Crect x='26' y='52' width='36' height='6' rx='3' fill='%23e3edff'/%3E%3Ccircle cx='94' cy='20' r='12' fill='%23ecfdf5' stroke='%2334d399' stroke-width='2'/%3E%3Cpath d='M88 20l4 4 8-8' fill='none' stroke='%23047857' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* Feedback / dialogs */
.pvmodal-box, .fbbox { border-radius:14px; box-shadow:0 24px 60px rgba(16,24,40,.22); border:1px solid var(--line); }
.fbbtn { border-radius:999px; box-shadow:var(--sh-3); }

@media (prefers-reduced-motion: reduce) { * , *::before, *::after { transition:none !important; animation:none !important; } .stat-link:hover { transform:none; } }
@media print { .topbar { position:static; box-shadow:none; backdrop-filter:none; } .card, .stat, figure.chart, .callcard { box-shadow:none !important; } }
/* A8: every printed page carries a PHI reminder */
@media print { body::after { content:"This page has patient information. Do not leave it out; shred when done."; display:block; margin-top:16px; padding-top:6px; border-top:1px solid #999; font-size:9pt; color:#333; } }
/* Group A badges (18 Nov 2026): desk status, network, language; About this data */
.desk, .net, .langchip { display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:3px 10px; font-size:12px; font-weight:600; border:1px solid; white-space:nowrap; }
.desk::before { content:""; width:8px; height:8px; border-radius:50%; background:currentColor; }
.desk-ok { background:#ecfdf5; color:#047857; border-color:#a7f3d0; }
.desk-collect { background:#fffbeb; color:#92400e; border-color:#fcd34d; }
.desk-call { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.desk-collect::before { border-radius:2px; } .desk-call::before { width:0; height:0; border-radius:0; background:none; border-left:5px solid transparent; border-right:5px solid transparent; border-bottom:8px solid currentColor; }
.net-in { background:#ecfdf5; color:#047857; border-color:#a7f3d0; } .net-out { background:#fffbeb; color:#92400e; border-color:#fcd34d; }
.net-both { background:var(--blue-50); color:var(--blue-700); border-color:var(--blue-200); } .net-none { background:#f8fafc; color:#475569; border-color:#cbd5e1; }
.langchip { background:#f5f3ff; color:#5b21b6; border-color:#ddd6fe; }
details.aboutdata { margin:10px 0 14px; border:1px solid var(--line); border-radius:var(--r); background:#fff; padding:0 14px; }
details.aboutdata > summary { cursor:pointer; padding:10px 0; font-weight:600; color:var(--blue-700); min-height:24px; list-style-position:inside; }
details.aboutdata dl { display:grid; grid-template-columns:minmax(140px,180px) 1fr; gap:6px 16px; margin:0 0 12px; font-size:13px; }
details.aboutdata dt { color:var(--muted); font-weight:600; } details.aboutdata dd { margin:0; color:var(--ink); }
@media (max-width:640px) { details.aboutdata dl { grid-template-columns:1fr; } }
.deskcopy { display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:500; margin:0 0 0 12px; color:var(--label); }
.deskcopy input { width:auto; }
.closedbanner { display:flex; gap:10px; align-items:flex-start; background:#f2f7ff; border:1px solid var(--blue-200); color:#0b3a8c; border-radius:var(--r-lg); padding:12px 16px; margin:0 0 14px; }
.ckl { display:inline-flex; gap:4px; flex-wrap:wrap; } .ckl span { font-size:12px; border-radius:6px; padding:2px 6px; border:1px solid; }
.ckl .y { background:#ecfdf5; color:#047857; border-color:#a7f3d0; } .ckl .n { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
@media print { details.aboutdata { display:none; } }

/* ---- Optional add-ons (release 2) ---- */
.consentbox { max-height: 180px; overflow: auto; border: 1px solid var(--line, #e6eaf1); border-radius: 10px; background: #f7f9fc; padding: 10px 12px; margin: 6px 0 8px; font-size: 13px; line-height: 1.5; color: #1e293b; }
.consentbox:focus-visible { outline: 2px solid var(--blue, #0b5fd8); outline-offset: 2px; }
.consenttick { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; margin: 4px 0 10px; }
.warnbox { background: #fff7e6; border: 1px solid #f3c56b; color: #6b4300; border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.slotlist { list-style: none; margin: 0; padding: 0; }
.slotlist li { padding: 8px 0; border-bottom: 1px solid var(--line, #e6eaf1); }
.slotlist li:last-child { border-bottom: 0; }
@media (max-width: 700px) { #app .grid2[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; } #edT { min-width: 0; overflow-wrap: anywhere; } #edT pre, #edT iframe { max-width: 100%; } }
/* Inter is wider than the old face: keep the desktop nav on one row at 1440 */
@media (min-width: 1180px) { nav#nav a, .navgroup-btn { padding: 6px 6px; font-size: 13px; } nav#nav { gap: 0; } }

/* a11y target size (WCAG 2.5.8): header Sign out link-button at least 24x24 */
#signout{min-height:24px;min-width:24px;padding:3px 6px;display:inline-flex;align-items:center}

/* Investor accounts: read-only investor view only (web/ops.js), no portal navigation. */
body.investor #nav { display: none; }
.ops-state { font-weight: 700; }
.ops-ok::before { content: "OK - "; } .ops-warn::before { content: "Check - "; } .ops-fail::before { content: "Problem - "; } .ops-unknown::before { content: "Unknown - "; }
.ops-status-big { font-size: 1.5rem; font-weight: 700; margin: 8px 0; }

/* Errors with a next step (UX P1-11). Red text #991b1b on #fef2f2 = 7.9:1; focus ring for the role="alert" box moved into view. */
.pverr { color:#991b1b; background:#fef2f2; border:1px solid #fca5a5; border-left:4px solid #b91c1c; padding:12px 14px; border-radius:8px; margin:0 0 16px; }
.pverr:focus { outline:3px solid #1d4ed8; outline-offset:2px; }
.pverr p { margin:0 0 6px; } .pverr .pverr-todo { color:#7f1d1d; }
.pverr .actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.pvnote { color:#1e3a8a; background:#eff6ff; border:1px solid #bfdbfe; padding:10px 14px; border-radius:8px; margin:0 0 16px; }
.pverr .btn, .pverr .link, .pvnote .link { min-height:24px; min-width:24px; }

/* Layout fixes (20 Nov 2026, staging report known issues 1 + 3). WCAG 2.2 AA 1.4.10 Reflow: no sideways page scroll. */
/* 1. Admin nav fits one row at 1440 px: History moved into More (index.html); "(review)" shown only on very wide screens.
      The link's accessible name stays "Overnight bookings (review)" (aria-label), so the visible text is part of it (2.5.3). */
@media (max-width:1680px) { #nav .navx { display:none; } }
/*    Between tablet and very wide, the signed-in email is cut shorter (full address is on Account) so More and Admin stay on the row. */
@media (min-width:1381px) and (max-width:1600px) { #whoami { max-width:110px; } .topbar-in { gap:10px; } .who { gap:8px; } }
/* 2. Toolbars (page title + date/clinic pickers) wrap instead of pushing the page wider; long clinic names are cut by the box. */
.toolbar { flex-wrap:wrap; row-gap:8px; }
.toolbar > div { flex-wrap:wrap; min-width:0; max-width:100%; }
#app select { max-width:100%; }
/* 3. Charts never wider than their card (they have a viewBox, so they scale). */
#app .ch-scroll svg { max-width:100%; height:auto; }
