/* CareLoop-Edge — clinical portal design system.
   Direction: radiology workstation (PACS). Flat surfaces, hairline rules, 2-3 px corners, no gradients or soft
   shadows; colour carries clinical meaning only (urgent / attention / normal / information). IBM Plex Sans for the
   interface, IBM Plex Mono for identifiers and measured values. Two themes from one token set:
     :root          light     patient pages, sign-in, printed report
     .theme-dark    graphite  staff workspace and the device screen (class on <body>)
   The image viewer is always dark. Offline: fonts, icons and scripts are served by this device. */

@font-face { font-family: "IBM Plex Sans"; src: url("fonts/plex-sans-latin-wght.woff2") format("woff2");
  font-weight: 100 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500 700; font-style: normal; font-display: swap; }

/* ================================================================== tokens */
:root {
  --fs-2xs: 11.5px; --fs-xs: 12.5px; --fs-sm: 13.5px; --fs-md: 14.5px; --fs-lg: 16px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, "Liberation Mono", monospace;
  --r: 3px; --r-sm: 2px;

  --bg: #f3f4f6; --surface: #ffffff; --surface-2: #f8f9fa; --surface-3: #eceef1;
  --text: #15181c; --text-2: #3c434b; --muted: #687079; --faint: #9aa1a9;
  --border: #dfe2e6; --border-2: #c7ccd2; --row-hover: #f5f8fa;
  --accent: #0b6a87; --accent-hover: #08576f; --accent-soft: #e2f0f4; --accent-ink: #064053; --on-accent: #ffffff;
  --ok: #1b7d4b; --ok-soft: #e4f2ea; --ok-line: #b6dcc5;
  --warn: #9a5800; --warn-soft: #fbf0dc; --warn-line: #ecd29f;
  --err: #c0262d; --err-soft: #fbe6e7; --err-line: #f0bcbf;
  --info: #2260b3; --info-soft: #e5edf8; --info-line: #bcd0ee;
  --violet: #5847b3; --violet-soft: #edebf8;
  --input-bg: #ffffff; --input-border: #c3c9cf; --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --shadow-pop: 0 8px 24px rgba(15, 20, 25, .14), 0 0 0 1px rgba(15, 20, 25, .06);
  --rail: #0e1013; --rail-2: #171a1e; --rail-text: #9aa3ad; --rail-active: #ffffff;
  /* viewer (always dark) */
  --v-bg: #050607; --v-bar: #0d0f12; --v-line: #1d2126; --v-text: #a9b1ba; --v-strong: #eef1f4; --v-btn: #161a1f;
  --v-on: #23303a; --v-accent: #3fb6d6;
  color-scheme: light;
}
.theme-dark {
  --bg: #0f1114; --surface: #16191d; --surface-2: #1b1f24; --surface-3: #23282e;
  --text: #e7e9ec; --text-2: #bcc2c9; --muted: #8a929b; --faint: #5d656e;
  --border: #262b31; --border-2: #353b43; --row-hover: #1c2126;
  --accent: #3fb6d6; --accent-hover: #63c6e0; --accent-soft: rgba(63, 182, 214, .13); --accent-ink: #a3dfee; --on-accent: #062530;
  --ok: #3fcf8e; --ok-soft: rgba(63, 207, 142, .12); --ok-line: rgba(63, 207, 142, .35);
  --warn: #f0b429; --warn-soft: rgba(240, 180, 41, .12); --warn-line: rgba(240, 180, 41, .35);
  --err: #f2555a; --err-soft: rgba(242, 85, 90, .13); --err-line: rgba(242, 85, 90, .4);
  --info: #6aa6f8; --info-soft: rgba(106, 166, 248, .13); --info-line: rgba(106, 166, 248, .35);
  --violet: #a898f6; --violet-soft: rgba(168, 152, 246, .13);
  --input-bg: #111418; --input-border: #3a4048; --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px var(--border-2);
  color-scheme: dark;
}

/* ================================================================== base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 var(--fs-md)/1.5 var(--font); -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 20px; line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 14.5px; margin: 0; font-weight: 600; }
h3 { font-size: var(--fs-sm); margin: 0; font-weight: 600; color: var(--text-2); }
p { margin: 0 0 8px; }
::selection { background: var(--accent-soft); }
.sprite { display: none; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; } .ic.lg { width: 22px; height: 22px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: var(--fs-xs); } .xs { font-size: var(--fs-2xs); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.pre { white-space: pre-wrap; } .grow { flex: 1; } .hide { display: none !important; }
.eyebrow { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ================================================================== staff shell (graphite) */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid #1c2025; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #fff; text-decoration: none; border-bottom: 1px solid #1c2025; min-height: 56px; }
.sb-brand:hover { text-decoration: none; }
.sb-brand .name { font-weight: 600; font-size: 13.5px; line-height: 1.2; letter-spacing: .02em; text-transform: uppercase; }
.sb-brand .sub { font-size: var(--fs-2xs); color: #6f7882; letter-spacing: .02em; }
.logo { width: 28px; height: 28px; flex: none; }
.logo-ring { fill: #0b6a87; } .logo-mark { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; } .logo-mark.thin { stroke-width: 1.7; }
.sb-nav { padding: 8px 0; display: flex; flex-direction: column; }
.sb-label { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #5a636d; padding: 14px 16px 6px; }
.sb-nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 7px 16px; color: var(--rail-text); font-weight: 500; font-size: var(--fs-sm); }
.sb-nav a:hover { background: var(--rail-2); color: #fff; text-decoration: none; }
.sb-nav a.active { background: #15232b; color: var(--rail-active); }
.sb-nav a.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: #3fb6d6; }
.sb-nav .count { margin-left: auto; font: 500 var(--fs-2xs) var(--mono); color: #cfe9f1; background: #12313d; border-radius: var(--r-sm); padding: 0 6px; min-width: 22px; text-align: center; }
.sb-foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid #1c2025; font-size: var(--fs-2xs); color: #5f6872; }
.sb-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3fcf8e; margin-right: 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 52px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); min-width: 0; }
.crumbs a { color: var(--muted); } .crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .ic { width: 13px; height: 13px; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.avatar { width: 30px; height: 30px; border-radius: var(--r); background: var(--surface-3); color: var(--text); display: grid; place-items: center;
  font-weight: 600; font-size: var(--fs-xs); flex: none; border: 1px solid var(--border-2); }
.user-menu .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-menu .who b { font-size: var(--fs-sm); font-weight: 600; } .user-menu .who small { color: var(--muted); font-size: var(--fs-2xs); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); border-color: var(--border); }
.content { padding: 20px 24px 28px; max-width: 1520px; width: 100%; }
.content.full { max-width: none; padding: 14px 16px 20px; }

/* ================================================================== patient shell (light) */
.pshell { min-height: 100vh; display: flex; flex-direction: column; }
.ptop { background: var(--surface); border-bottom: 1px solid var(--border); }
.ptop-in { max-width: 1040px; margin: 0 auto; height: 60px; display: flex; align-items: center; gap: 28px; padding: 0 24px; }
.pbrand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.pbrand:hover { text-decoration: none; }
.pbrand .name { font-weight: 600; font-size: 14px; letter-spacing: .02em; text-transform: uppercase; } .pbrand .sub { font-size: var(--fs-2xs); color: var(--muted); }
.pnav { display: flex; gap: 2px; align-self: stretch; }
.pnav a { display: flex; align-items: center; padding: 0 12px; color: var(--text-2); font-weight: 500; font-size: var(--fs-sm); border-bottom: 2px solid transparent; }
.pnav a:hover { color: var(--text); text-decoration: none; }
.pnav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.pcontent { max-width: 1040px; width: 100%; margin: 0 auto; padding: 28px 24px 48px; flex: 1; }
.pfoot { border-top: 1px solid var(--border); background: var(--surface); }
.pfoot-in { max-width: 1040px; margin: 0 auto; padding: 14px 24px; display: flex; gap: 16px; color: var(--muted); font-size: var(--fs-xs); }

/* ================================================================== building blocks */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); min-height: 46px; }
.card-h h2 { font-size: var(--fs-sm); font-weight: 600; letter-spacing: .01em; }
.card-b { padding: 16px; }
.card-b.tight { padding: 11px 16px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .icon-btn:focus-visible, .seg label:focus-within,
a:focus-visible, button:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; } .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--err); border-color: var(--err-line); background: transparent; } .btn.danger:hover { background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-xs); } .btn.lg { height: 42px; padding: 0 20px; font-size: var(--fs-md); }
.btn.block { width: 100%; } .btn[disabled] { opacity: .5; cursor: not-allowed; }
.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; background: var(--info-soft);
  color: var(--text); border: 1px solid var(--info-line); border-left: 3px solid var(--info); }
.alert > .ic { color: var(--info); margin-top: 2px; }
.alert.success { background: var(--ok-soft); border-color: var(--ok-line); border-left-color: var(--ok); } .alert.success > .ic { color: var(--ok); }
.alert.error { background: var(--err-soft); border-color: var(--err-line); border-left-color: var(--err); } .alert.error > .ic { color: var(--err); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); border-left-color: var(--warn); } .alert.warn > .ic { color: var(--warn); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: var(--fs-sm); color: var(--text-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=tel], input[type=number], input:not([type]), select, textarea {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--input-border); border-radius: var(--r); background: var(--input-bg);
  color: var(--text); font: 400 var(--fs-md)/1.4 var(--font); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { height: auto; padding: 9px 11px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--text-2); font-size: var(--fs-sm); }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.seg label { position: relative; padding: 7px 14px; font-weight: 500; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border-2); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--accent); color: var(--on-accent); }

/* status: square tags, colour = meaning */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); font-size: var(--fs-2xs);
  font-weight: 600; letter-spacing: .02em; white-space: nowrap; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.pill.plain::before { display: none; }
.s-awaiting_review { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.s-in_review { background: var(--violet-soft); color: var(--violet); }
.s-reupload_requested { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.s-finalized { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pri { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pri .bar { width: 3px; height: 20px; border-radius: 1px; background: var(--border-2); }
.pri.p3 { color: var(--err); } .pri.p3 .bar { background: var(--err); }
.pri.p2 { color: var(--warn); } .pri.p2 .bar { background: var(--warn); }
.pri.p1 { color: var(--muted); font-weight: 500; }
.tag { display: inline-block; font-size: var(--fs-2xs); font-weight: 600; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 1px 6px; margin: 1px 3px 1px 0; white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.tag.err { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.tag.brand { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* tables: dense, hairline, uppercase headers */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600;
  padding: 9px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.link { cursor: pointer; } .table tbody tr.link:hover td { background: var(--row-hover); }
.table tr.dim td { color: var(--faint); }
.cell-main { font-weight: 600; color: var(--text); white-space: nowrap; } .cell-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.empty { padding: 16px 18px; color: var(--muted); font-size: var(--fs-sm); }
.empty > .ic { display: none; }
.empty h2 { display: inline; font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin: 0 6px 0 0; }
.empty p { display: inline; margin: 0; }
.empty .btn { margin-top: 10px; display: flex; width: max-content; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin-bottom: 16px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--surface); overflow: hidden; }
.kpi { background: var(--surface); padding: 12px 16px; color: var(--text); display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); position: relative; }
.kpi:last-child { border-right: 0; }
a.kpi:hover { background: var(--row-hover); text-decoration: none; }
a.kpi.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); }
.kpi .k-label { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.kpi .k-label .ic { width: 13px; height: 13px; }
.kpi .k-val { font: 500 24px/1.2 var(--mono); letter-spacing: -.02em; }
.kpi .k-sub { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 360px; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 15px; height: 15px; }
.search input { padding-left: 32px; height: 32px; }

/* ================================================================== sign-in */
.auth { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.auth-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 28px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.auth-contact { text-align: right; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.auth-foot { padding: 12px 28px; font-size: var(--fs-2xs); color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }
.auth-main { flex: 1; display: grid; place-items: start center; padding: 48px 16px; }
.auth-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); padding: 26px 30px; }
.auth-box h2 { font-size: 19px; font-weight: 600; margin-bottom: 4px; }
.auth-box .lead { color: var(--muted); margin-bottom: 22px; }
.role-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.role-tabs button { border: 0; background: transparent; height: 40px; font: 500 var(--fs-sm) var(--font); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.role-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.auth-alt { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); text-align: center; }
.auth-box.wide { max-width: 600px; }

/* ================================================================== case review (staff) */
.case-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 16px; margin-bottom: 12px; }
.case-head .pt { display: flex; align-items: center; gap: 12px; }
.case-head .pt .avatar { width: 36px; height: 36px; font-size: var(--fs-sm); }
.case-head .pt h1 { font-size: 17px; }
.meta { display: flex; gap: 0; flex-wrap: wrap; margin-left: 4px; }
.meta div { display: flex; flex-direction: column; padding: 0 16px; border-left: 1px solid var(--border); }
.meta span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.meta b { font-size: var(--fs-sm); font-weight: 500; font-variant-numeric: tabular-nums; }
.case-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; align-items: start; }
.review.expanded { grid-template-columns: minmax(0, 1fr); }
.review.expanded .side { display: none; }
.viewer { background: var(--v-bg); border-radius: var(--r); overflow: hidden; border: 1px solid var(--v-line); display: flex; flex-direction: column; }
.v-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--v-bar); border-bottom: 1px solid var(--v-line); color: var(--v-text); flex-wrap: wrap; }
.v-modes { display: inline-flex; border: 1px solid var(--v-line); border-radius: var(--r); overflow: hidden; }
.v-modes button { border: 0; border-right: 1px solid var(--v-line); background: var(--v-btn); color: var(--v-text); font: 500 var(--fs-xs) var(--font); height: 28px; padding: 0 11px; cursor: pointer; }
.v-modes button:last-child { border-right: 0; }
.v-modes button:hover { color: var(--v-strong); }
.v-modes button.on { background: var(--v-on); color: var(--v-strong); box-shadow: inset 0 -2px 0 var(--v-accent); }
.v-tool { border: 1px solid transparent; background: transparent; color: var(--v-text); width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; cursor: pointer; }
.v-tool:hover { background: var(--v-btn); border-color: var(--v-line); color: var(--v-strong); }
.v-sep { width: 1px; height: 20px; background: var(--v-line); margin: 0 4px; }
.v-opacity { display: flex; align-items: center; gap: 8px; font-size: var(--fs-2xs); letter-spacing: .06em; text-transform: uppercase; color: var(--v-text); margin-left: auto; }
.v-opacity input { width: 110px; accent-color: var(--v-accent); }
.v-stage { position: relative; height: min(68vh, 720px); min-height: 420px; overflow: hidden; cursor: grab; touch-action: none; }
.review.expanded .v-stage { height: calc(100vh - 220px); }
.v-stage.grabbing { cursor: grabbing; }
.v-canvas { position: absolute; inset: 0; transform-origin: 0 0; }
.v-canvas img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.v-foot { display: flex; align-items: center; gap: 14px; padding: 6px 12px; background: var(--v-bar); border-top: 1px solid var(--v-line); color: var(--v-text); font-size: var(--fs-2xs); flex-wrap: wrap; }
.v-foot b { color: var(--v-strong); font-weight: 600; }
.v-series { padding: 7px 12px 9px; background: var(--v-bar); border-top: 1px solid var(--v-line); color: var(--v-text); font-size: var(--fs-2xs); display: grid; gap: 6px; }
.vs-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vs-range { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; letter-spacing: .06em; text-transform: uppercase; }
.vs-range input { flex: 1; accent-color: var(--v-accent); }
.vs-label { color: var(--v-strong); font-family: var(--mono); font-size: var(--fs-2xs); }
.vs-bars { display: flex; align-items: flex-end; gap: 1px; height: 26px; border-bottom: 1px solid var(--v-line); }
.vs-bars span { flex: 1; height: 4%; min-height: 2px; background: #2b3a45; cursor: pointer; }
.vs-bars span.key { background: #e0a43a; }
.vs-bars span.rej { background: #5a2b2b; }
.vs-bars span.on { outline: 1px solid var(--v-accent); outline-offset: 1px; }
.vs-keys { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vs-keys .btn { background: var(--v-btn); border-color: var(--v-line); color: var(--v-strong); font-family: var(--mono); font-size: var(--fs-2xs); }
.vs-keys .btn:hover { background: var(--v-on); }
.cbar { display: inline-block; width: 100px; height: 6px; border-radius: 1px; vertical-align: middle; margin: 0 6px;
  background: linear-gradient(90deg, #30123b, #4662d7, #36aaf9, #1ae4b6, #72fe5e, #c8ef34, #faba39, #f66b19, #ca2a04, #7a0403); }  /* Turbo colour-map legend: data, not decoration */
.swatch-green { display: inline-block; width: 14px; height: 2px; background: #00e600; vertical-align: middle; margin-right: 6px; }
.v-zoom { margin-left: auto; font-family: var(--mono); }
.side { display: flex; flex-direction: column; gap: 12px; }
.side > .card + .card { margin-top: 0; }
.finding { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.finding .dx { font-size: 20px; font-weight: 600; letter-spacing: -.005em; }
.finding .conf { font: 500 var(--fs-md) var(--mono); color: var(--text-2); }
.probs { display: grid; gap: 6px; margin: 12px 0 4px; }
.prob { display: grid; grid-template-columns: 112px minmax(0, 1fr) 54px; align-items: center; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); }
.prob .right { font-family: var(--mono); font-size: var(--fs-xs); }
.prob.top { color: var(--text); font-weight: 600; }
.prob meter { width: 100%; height: 6px; -webkit-appearance: none; appearance: none; border: 0; border-radius: 1px; background: var(--surface-3); }
.prob meter::-webkit-meter-bar { background: var(--surface-3); border: 0; border-radius: 1px; height: 6px; }
.prob meter::-webkit-meter-optimum-value { background: var(--faint); border-radius: 1px; }
.prob.top meter::-webkit-meter-optimum-value { background: var(--accent); }
.prob meter::-moz-meter-bar { background: var(--faint); border-radius: 1px; }
.prob.top meter::-moz-meter-bar { background: var(--accent); }
.kv { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.kv th { text-align: left; color: var(--muted); font-weight: 400; padding: 7px 0; width: 46%; vertical-align: top; }
.kv td { padding: 7px 0; font-weight: 500; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid var(--border); }
.flags { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.flags li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-xs); color: var(--text); background: var(--warn-soft); border-left: 2px solid var(--warn); border-radius: var(--r-sm); padding: 6px 10px; }
.flags .ic { color: var(--warn); width: 14px; height: 14px; margin-top: 2px; }
.section-label { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
details.panel { border-top: 1px solid var(--border); }
details.panel > summary { list-style: none; cursor: pointer; padding: 11px 16px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--fs-sm); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.panel[open] > summary::after { transform: rotate(-135deg); }
details.panel .panel-b { padding: 0 16px 14px; }
.signed-box { display: flex; gap: 10px; align-items: center; background: var(--ok-soft); color: var(--text); border: 1px solid var(--ok-line); border-left: 3px solid var(--ok);
  border-radius: var(--r); padding: 9px 12px; font-size: var(--fs-xs); margin-bottom: 14px; }
.signed-box .ic { color: var(--ok); }
.note-box { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: var(--r); padding: 9px 12px; font-size: var(--fs-sm); color: var(--text); }
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.hist li { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); padding: 7px 0; border-bottom: 1px solid var(--border); }
.hist li:last-child { border-bottom: 0; }
.hist .ic { vertical-align: -3px; color: var(--muted); }

/* ================================================================== patient pages */
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.welcome h1 { font-size: 24px; font-weight: 600; }
.study { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.study:last-child { border-bottom: 0; }
.study:hover { background: var(--row-hover); text-decoration: none; }
.study .thumb { width: 44px; height: 44px; border-radius: var(--r); background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; border: 1px solid var(--border); }
.study .t { font-weight: 600; } .study .d { font-size: var(--fs-xs); color: var(--muted); }
.track { display: flex; align-items: center; gap: 0; margin: 4px 0 2px; }
.track .stp { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; position: relative; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; text-align: center; }
.track .stp::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.track .stp:first-child::before { display: none; }
.track .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-2); background: var(--surface); display: grid; place-items: center; z-index: 1; color: #fff; }
.track .stp.done .dot { background: var(--ok); border-color: var(--ok); }
.track .stp.done::before, .track .stp.current::before { background: var(--ok); }
.track .stp.current .dot { border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 4px var(--accent-soft); }
.track .stp.current { color: var(--text); font-weight: 600; }
.track .dot .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps span { flex: 1; display: flex; gap: 8px; align-items: center; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.steps span b { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font: 500 var(--fs-2xs) var(--mono); }
.steps span.on { color: var(--text); border-color: var(--accent); } .steps span.on b { background: var(--accent); color: var(--on-accent); }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 32px 16px;
  border: 1px dashed var(--border-2); border-radius: var(--r); background: var(--surface-2); text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .ic { width: 30px; height: 30px; color: var(--accent); stroke-width: 1.4; }
.dropzone .dz-title { font-weight: 600; font-size: var(--fs-lg); }
.dz-folder { position: relative; margin-top: 8px; }
.dz-folder input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-file { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 600; color: var(--ok); }
.thumb-img { width: 100%; border-radius: var(--r); background: #000; display: block; aspect-ratio: 1; object-fit: contain; }

/* report document (patient view + print): paper, always light */
.doc { background: #fff; color: #15181c; border: 1px solid var(--border); border-radius: 2px; padding: 40px 48px; max-width: 820px; margin: 0 auto;
  box-shadow: 0 1px 3px rgba(15, 20, 25, .08); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 14px; border-bottom: 2px solid #15181c; }
.doc-head .org { display: flex; gap: 12px; align-items: center; }
.doc-head .org b { font-size: 16px; display: block; letter-spacing: .02em; text-transform: uppercase; } .doc-head .org small { color: #687079; font-size: var(--fs-xs); }
.doc-head .title { text-align: right; } .doc-head .title b { font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: #15181c; display: block; }
.doc-head .title small { color: #687079; font-size: var(--fs-xs); font-family: var(--mono); }
.doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 18px; padding: 14px 0; border-bottom: 1px solid #dfe2e6; }
.doc-meta div span { display: block; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #687079; }
.doc-meta div b { font-size: var(--fs-sm); font-weight: 500; }
.doc-sec { padding: 16px 0; border-bottom: 1px solid #dfe2e6; }
.doc-sec h3 { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #3c434b; margin-bottom: 8px; }
.doc-sec .dx { font-size: 19px; font-weight: 600; }
.doc-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding-top: 22px; }
.doc-sign .sig b { display: block; font-size: 15px; } .doc-sign .sig small { color: #687079; }
.doc-sign .ver { text-align: right; font: var(--fs-2xs) var(--mono); color: #687079; }
.doc-head small { display: block; }
.doc-status { display: inline-block; margin-top: 6px; padding: 2px 8px; border: 1px solid #1f6b3a; color: #1f6b3a; font-size: 11px;
  font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.doc-status.amended { border-color: #9a5800; color: #9a5800; }
.doc-imp .pre { margin-top: 4px; }
.doc-sign .sig small { display: block; }
.doc-foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid #dfe2e6; color: #687079; font-size: var(--fs-2xs); }
.doc-foot p { margin: 0 0 4px; }
.tpl-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); margin: 2px 0 6px; font-weight: 400; }
.doc-amend { background: #fbf0dc; border-left: 3px solid #9a5800; color: #15181c; border-radius: 2px; padding: 8px 12px; margin-top: 14px; font-size: var(--fs-sm); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--border); stroke-width: 1; }
.chart .b1 { fill: var(--faint); } .chart .b2 { fill: var(--accent); }
.chart text { font: var(--fs-2xs) var(--mono); fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: var(--fs-xs); color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 1px; margin-right: 6px; vertical-align: -1px; }
.legend .l1 { background: var(--faint); } .legend .l2 { background: var(--accent); }
.hbar { display: grid; grid-template-columns: 170px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: var(--fs-sm); padding: 5px 0; }
.hbar svg { width: 100%; height: 8px; display: block; } .hbar rect.track { fill: var(--surface-3); } .hbar rect.fill { fill: var(--accent); }
.hbar > :last-child { font-family: var(--mono); font-size: var(--fs-xs); text-align: right; }
.confusion td, .confusion th { text-align: center; } .confusion td { font-family: var(--mono); }
.confusion td.diag { background: var(--ok-soft); font-weight: 600; color: var(--ok); }
.confusion tbody th { text-align: left; background: var(--surface-2); text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); color: var(--text-2); }
.meter-line { height: 6px; border-radius: 1px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.meter-line svg { display: block; width: 100%; height: 6px; } .meter-line rect { fill: var(--accent); }

/* ================================================================== responsive */
@media (max-width: 1200px) { .review { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 1024px) {
  .shell { grid-template-columns: 60px minmax(0, 1fr); }
  .sb-brand .name, .sb-brand .sub, .sb-nav a span, .sb-label, .sb-foot, .sb-nav .count { display: none; }
  .sb-brand { justify-content: center; padding: 14px 0; } .sb-nav a { justify-content: center; padding: 10px 0; }
  .review, .g-side { grid-template-columns: minmax(0, 1fr); }
  .auth-head { padding: 10px 16px; } .auth-contact { display: none; } .auth-box { padding: 20px 18px; } .auth-main { padding: 20px 12px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); } .sidebar { display: none; }
  .content { padding: 14px; } .topbar { padding: 0 14px; } .user-menu .who { display: none; }
  .g2, .g3, .g4, .row2 { grid-template-columns: minmax(0, 1fr); }
  .ptop-in { gap: 12px; padding: 0 16px; } .pbrand .sub { display: none; } .pcontent { padding: 20px 16px 40px; }
  .study { grid-template-columns: 44px minmax(0, 1fr); } .study .pill, .study .go { grid-column: 2; justify-self: start; }
  .doc { padding: 22px 18px; } .doc-meta { grid-template-columns: 1fr 1fr; }
  .table.responsive thead { display: none; } .table.responsive td { display: block; border: 0; padding: 3px 14px; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .v-stage { height: 56vh; min-height: 300px; }
  .meta { margin-left: 0; } .meta div:first-child { border-left: 0; padding-left: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { border-bottom: 1px solid var(--border); }
  .mobile-nav { display: flex !important; }
}
.mobile-nav { display: none; gap: 2px; padding: 6px 12px; background: var(--rail); overflow-x: auto; border-bottom: 1px solid #1c2025; }
.mobile-nav a { color: var(--rail-text); padding: 6px 10px; border-radius: var(--r); font-size: var(--fs-sm); white-space: nowrap; }
.mobile-nav a.active { background: #15232b; color: #fff; }
@media print {
  body { background: #fff; color: #000; }
  .ptop, .pfoot, .no-print, .sidebar, .topbar, .alert { display: none !important; }
  .pcontent { padding: 0; max-width: none; }
  .doc { box-shadow: none; border: 0; padding: 0; max-width: none; }
  .doc-cta, .bell { display: none !important; }
}

/* ================================================================== secondary components */
.linkbtn { border: 0; background: none; color: var(--accent); font: 500 var(--fs-xs) var(--font); cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.who-link { display: flex; align-items: center; gap: 10px; color: var(--text); border-radius: var(--r); padding: 3px 8px 3px 4px; }
.who-link:hover { background: var(--surface-3); text-decoration: none; }
.bell { position: relative; }
.bell > summary { list-style: none; position: relative; }
.bell > summary::-webkit-details-marker { display: none; }
.bell-n { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-sm); background: var(--err); color: #fff;
  font: 600 10px/16px var(--mono); text-align: center; }
.bell-menu { position: absolute; right: 0; top: 40px; width: 340px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow-pop); z-index: 50; overflow: hidden; }
.bell-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.bell-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.bell-item:hover { background: var(--row-hover); text-decoration: none; }
.bell-item.unread { box-shadow: inset 2px 0 0 var(--accent); } .bell-item.unread .bi-t { font-weight: 600; }
.bell-item .bi-t { font-size: var(--fs-sm); } .bell-item .bi-d { font-size: var(--fs-2xs); color: var(--muted); font-family: var(--mono); }
.bell-empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.bell-all { display: block; text-align: center; padding: 9px; font-size: var(--fs-xs); font-weight: 500; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif:last-child { border-bottom: 0; } .notif:hover { background: var(--row-hover); text-decoration: none; }
.notif .n-dot { width: 6px; height: 6px; border-radius: 1px; margin-top: 8px; background: transparent; flex: none; }
.notif.unread .n-dot { background: var(--accent); } .notif.unread b { font-weight: 600; } .notif b { font-weight: 500; }
.notif .n-body { display: block; font-size: var(--fs-xs); color: var(--muted); white-space: pre-line; margin-top: 2px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.nav-seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.nav-seg a { padding: 5px 12px; font-weight: 500; font-size: var(--fs-xs); color: var(--text-2); border-right: 1px solid var(--border-2); }
.nav-seg a:last-child { border-right: 0; } .nav-seg a:hover { background: var(--surface-3); text-decoration: none; }
.nav-seg a.on { background: var(--accent); color: var(--on-accent); }
.empty.slim { padding: 18px; font-size: var(--fs-sm); }
.card-h.no-top { border-top: 1px solid var(--border); }
.card-h.day-empty { border-bottom: 0; padding: 10px 16px; } .card-h.day-empty h2 { font-weight: 500; color: var(--text-2); }
.k-val.sm-val { font-size: 17px; padding: 5px 0; }
.w-auto { width: auto; min-width: 160px; }
.overdue { color: var(--err); font-weight: 600; }
.err-text { color: var(--err); white-space: normal; }
.field.invalid input { border-color: var(--err); } .field.invalid .hint { color: var(--err); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--border); margin-top: 8px; }
.a-booked { background: var(--info-soft); color: var(--info); } .a-arrived { background: var(--violet-soft); color: var(--violet); }
.a-completed { background: var(--ok-soft); color: var(--ok); } .a-no_show { background: var(--err-soft); color: var(--err); }
.a-cancelled { background: var(--surface-3); color: var(--muted); }
.o-queued { background: var(--warn-soft); color: var(--warn); } .o-sent { background: var(--ok-soft); color: var(--ok); }
.o-failed { background: var(--err-soft); color: var(--err); } .o-disabled { background: var(--surface-3); color: var(--muted); }
.datestrip { display: flex; gap: 6px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.datestrip::-webkit-scrollbar { display: none; } .dchip { scroll-snap-align: start; }
.dchip { flex: none; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0; border: 1px solid var(--border-2); border-radius: var(--r); color: var(--text); background: var(--surface); }
.dchip:hover { border-color: var(--accent); text-decoration: none; }
.dchip .dw, .dchip .dm { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.dchip .dd { font: 500 19px/1.2 var(--mono); }
.dchip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } .dchip.on .dw, .dchip.on .dm { color: var(--on-accent); opacity: .8; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.slot { position: relative; }
.slot input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.slot span { display: block; text-align: center; padding: 8px 0; border: 1px solid var(--border-2); border-radius: var(--r); font: 500 var(--fs-sm) var(--mono); }
.slot:hover span { border-color: var(--accent); color: var(--accent); }
.slot input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.slot input:focus-visible + span { box-shadow: var(--focus); }
.confirm-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; margin-top: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); flex-wrap: wrap; }
.confirm-bar b { display: block; font-size: 15px; }
.doc-mini { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.doc-mini .avatar { width: 40px; height: 40px; font-size: var(--fs-md); }
.success-card { max-width: 560px; margin: 24px auto; padding: 32px; text-align: center; }
.success-card h1 { margin-bottom: 6px; }
.success-ic { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; border: 1px solid var(--ok-line); }
.success-ic .ic { width: 24px; height: 24px; stroke-width: 2.2; }
.success-ic.sm { width: 40px; height: 40px; margin: 0; background: var(--accent-soft); color: var(--accent); border-color: transparent; flex: none; }
.success-ic.sm .ic { width: 20px; height: 20px; stroke-width: 1.7; }
.success-ic.muted-ic { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.appt-ticket { display: flex; gap: 18px; align-items: center; text-align: left; margin: 22px auto; padding: 14px 18px; border: 1px solid var(--border-2); border-radius: var(--r); max-width: 420px; }
.appt-ticket .at-body { display: flex; flex-direction: column; gap: 2px; } .appt-ticket .at-body b { font-size: 16px; }
.success-card .row-actions { justify-content: center; }
.at-date { flex: none; width: 60px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border-2); text-align: center; background: var(--surface); display: flex; flex-direction: column; }
.at-date span:first-child { background: var(--text); color: var(--surface); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 3px 0; }
.at-date b { font: 500 21px/1.3 var(--mono); padding-top: 2px; } .at-date span:last-child { font-size: 10.5px; color: var(--muted); text-transform: uppercase; padding-bottom: 4px; }
.at-date.sm { width: 50px; } .at-date.sm b { font-size: 17px; }
.next-appt { display: flex; align-items: center; gap: 18px; padding: 14px 18px; margin-bottom: 16px; border-left: 3px solid var(--accent); }
.next-appt h2 { font-size: 15px; margin: 2px 0; } .next-appt.cta { background: var(--surface); }
.doc-cta { max-width: 820px; margin: 18px auto 0; }
.appt-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.appt-row:last-child { border-bottom: 0; }
.appt-row.dim { opacity: .55; } .appt-row.now { background: var(--row-hover); box-shadow: inset 2px 0 0 var(--accent); }
.time-col { width: 72px; display: flex; flex-direction: column; } .time-col b { font: 500 16px var(--mono); }
.time-col span { font-size: var(--fs-2xs); color: var(--muted); }
.card.attention { border-color: var(--warn-line); } .card.attention .card-h { background: var(--warn-soft); }
.card.attention .card-h h2 { display: flex; align-items: center; gap: 8px; } .card.attention .card-h .ic { color: var(--warn); }
.hours { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hours th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 6px 8px; }
.hours td { padding: 6px 8px; border-top: 1px solid var(--border); }
.hours th:first-child, .hours td:first-child { width: 128px; }
.hours td.nowrap { white-space: nowrap; } .hours td.nowrap > select { width: calc(50% - 10px); min-width: 0; height: 32px; padding: 0 6px; font: var(--fs-sm) var(--mono); }
.hours input[type=time] { height: 32px; padding: 0 6px; border: 1px solid var(--input-border); border-radius: var(--r); background: var(--input-bg); color: var(--text); font: var(--fs-sm) var(--mono); }
.hours .check { align-items: center; } .hours .check input { margin-top: 0; }
@media (max-width: 720px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .bell-menu { position: fixed; left: 8px; right: 8px; top: 56px; width: auto; }
  .next-appt { flex-wrap: wrap; } .hide-sm { display: none; }
  .hours th:first-child, .hours td:first-child { width: 96px; }
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip-f { padding: 4px 11px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; }
.chip-f:hover { border-color: var(--accent); text-decoration: none; } .chip-f.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-f .n { margin-left: 4px; opacity: .75; font-family: var(--mono); }
.day-h { padding: 7px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ev { display: grid; grid-template-columns: 52px 10px minmax(0, 1fr) 220px; gap: 12px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.ev-time { color: var(--muted); font: var(--fs-xs) var(--mono); }
.ev-dot { width: 7px; height: 7px; border-radius: 1px; background: var(--faint); }
.ev-dot.c-access { background: var(--muted); } .ev-dot.c-clinical { background: var(--accent); } .ev-dot.c-booking { background: var(--violet); }
.ev-dot.c-account { background: var(--ok); } .ev-dot.c-alert { background: var(--err); } .ev-dot.c-view { background: var(--border-2); }
.ev-sub { font-size: var(--fs-xs); color: var(--muted); }
.ev-who { display: flex; flex-direction: column; text-align: right; } .ev-who b { font-weight: 600; } .ev-who span { font-size: var(--fs-2xs); color: var(--muted); }
@media (max-width: 720px) { .ev { grid-template-columns: 44px 8px minmax(0, 1fr); } .ev-who { grid-column: 3; text-align: left; } }
.narrow-card { max-width: 640px; margin-left: auto; margin-right: auto; } .narrow-card.wide { max-width: 860px; }

/* CareLoop follow-up */
.risk { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 3px; border-radius: var(--r-sm); font-size: var(--fs-2xs); font-weight: 600; white-space: nowrap; cursor: help; border: 1px solid transparent; }
.risk b { min-width: 22px; height: 18px; padding: 0 4px; border-radius: var(--r-sm); display: grid; place-items: center; color: #fff; font: 500 var(--fs-2xs) var(--mono); }
.risk.r-high { background: var(--err-soft); color: var(--err); border-color: var(--err-line); } .risk.r-high b { background: var(--err); }
.risk.r-medium { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); } .risk.r-medium b { background: var(--warn); color: #1a1200; }
.risk.r-low { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); } .risk.r-low b { background: var(--ok); color: #04170d; }
.fu-row { display: grid; grid-template-columns: 108px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .9fr) auto; gap: 16px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.fu-row:last-child { border-bottom: 0; }
.fu-who a.cell-main { color: var(--text); } .fu-who a.cell-main:hover { color: var(--accent); }
.fu-step, .fu-last { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; font-size: var(--fs-sm); }
.fu-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.why { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.why span { font-size: var(--fs-2xs); color: var(--text-2); background: var(--surface-3); border-radius: var(--r-sm); padding: 1px 6px; }
details.pop { position: relative; }
details.pop > summary { list-style: none; } details.pop > summary::-webkit-details-marker { display: none; }
.pop-b { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 320px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 14px; }
.pill.pl-proposed { background: var(--warn-soft); color: var(--warn); } .pill.pl-approved { background: var(--info-soft); color: var(--info); }
.pill.pl-completed { background: var(--ok-soft); color: var(--ok); } .pill.pl-lost { background: var(--err-soft); color: var(--err); }
.pill.rf-draft { background: var(--surface-3); } .pill.rf-signed, .pill.rf-sent { background: var(--info-soft); color: var(--info); }
.pill.rf-appointment_made { background: var(--violet-soft); color: var(--violet); } .pill.rf-attended, .pill.rf-closed { background: var(--ok-soft); color: var(--ok); }
.side-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; } .side-stack > .card { margin: 0; }
.plan-box { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); margin-bottom: 12px; }
.plan-box b { font-size: 15px; } .plan-box span { color: var(--muted); font-size: var(--fs-xs); } .plan-box p { margin: 4px 0 0; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.doc-row:hover { background: var(--row-hover); text-decoration: none; } .doc-row > .ic { color: var(--muted); flex: none; }
details.panel.flat { border-top: 0; } details.panel.flat > summary { padding: 11px 16px; }
.tl .ev { grid-template-columns: 86px 10px minmax(0, 1fr) 48px; } .tl .ev-time { font-size: var(--fs-xs); }
.chain-ok { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ok); font-weight: 600; margin-bottom: 12px; }
fieldset.fu { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
fieldset.fu legend { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.fu-ref { display: none; flex-direction: column; gap: 10px; } .fu-ref.on { display: flex; }
.sm-input { height: 28px; padding: 0 8px; border: 1px solid var(--input-border); border-radius: var(--r); font: inherit; font-size: var(--fs-xs); background: var(--input-bg); color: var(--text); }
.journey { list-style: none; display: flex; padding: 0; margin: 0 0 18px; gap: 0; }
.journey li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); position: relative; }
.journey li:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); margin: 0 10px; }
.journey li.done:not(:last-child)::after { background: var(--ok); }
.journey .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-2); background: var(--surface); display: grid; place-items: center; font: 500 var(--fs-2xs) var(--mono); flex: none; }
.journey li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; } .journey li.done .dot .ic { width: 12px; height: 12px; stroke-width: 3; }
.journey li.current { color: var(--text); font-weight: 600; } .journey li.current .dot { border-color: var(--accent); color: var(--accent); }
.codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0 16px; }
.codes span { padding: 8px; text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); font: 500 var(--fs-md) var(--mono); }
.steps-list { margin: 0 0 6px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.key { background: var(--surface-3); padding: 2px 6px; border-radius: var(--r-sm); font-family: var(--mono); letter-spacing: .04em; word-break: break-all; }
.inline-form { flex-direction: row; align-items: flex-end; gap: 10px; } .inline-form .field { flex: 1; }
@media (max-width: 1024px) {
  .fu-row { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); } .fu-last { display: none; } .fu-act { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .fu-row { grid-template-columns: minmax(0, 1fr); gap: 8px; } .pop-b { left: 0; right: auto; width: min(320px, calc(100vw - 48px)); }
  .journey li { flex-direction: column; text-align: center; gap: 4px; font-size: var(--fs-2xs); } .journey li:not(:last-child)::after { display: none; }
  .codes { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tl .ev { grid-template-columns: 74px 8px minmax(0, 1fr); } .tl .ev-who { display: none; }
}
.section-h { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin: 24px 0 10px; color: var(--muted); }
@media (max-width: 860px) {
  /* patient header: brand + account on the first row, the section tabs scroll on a second row */
  .ptop-in { height: auto; flex-wrap: wrap; row-gap: 0; padding-top: 10px; }
  .ptop-in .user-menu { margin-left: auto; }
  .pnav { order: 3; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; margin: 6px -16px 0; padding: 0 12px; }
  .pnav::-webkit-scrollbar { display: none; }
  .pnav a { white-space: nowrap; padding: 10px 11px; }
  .pbrand .name { white-space: nowrap; }
}

/* ================================================================== compact landscape screens
   7" device screens (800x480, 1024x600, 1280x720) and small laptop windows. Larger type, slimmer chrome; the doctor's
   case page becomes tabs (Image | AI findings | Report) with the image filling the remaining height. */
.case-tabs { display: none; }
@media (max-height: 760px) and (max-width: 1300px) and (orientation: landscape) {
  :root { --fs-2xs: 12px; --fs-xs: 13px; --fs-sm: 14px; --fs-md: 15px; }
  h1 { font-size: 18px; }
  .shell { grid-template-columns: 56px minmax(0, 1fr); }
  .sb-brand .name, .sb-brand .sub, .sb-nav a span, .sb-label, .sb-foot, .sb-nav .count { display: none; }
  .sb-brand { justify-content: center; padding: 10px 0; min-height: 48px; } .sb-nav { padding: 4px 0; }
  .sb-nav a { justify-content: center; padding: 11px 0; } .sb-nav .ic { width: 21px; height: 21px; }
  .sidebar { overflow-y: auto; scrollbar-width: none; }
  .topbar { height: 48px; padding: 0 12px; }
  .user-menu .who { display: none; }
  .content { padding: 12px; } .content.full { padding: 8px 10px 10px; }
  .page-head { margin-bottom: 10px; }
  .kpis { margin-bottom: 10px; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); } .kpi { padding: 8px 12px; } .kpi .k-val { font-size: 20px; } .kpi .k-label .ic { display: none; }
  .card-h { padding: 8px 14px; min-height: 40px; } .card-b { padding: 14px; }
  .table th { padding: 7px 10px; } .table td { padding: 8px 10px; }
  .card:has(> .table), .card:has(> form + .table) { overflow-x: auto; }
  .worklist th:nth-child(5), .worklist td:nth-child(5) { display: none; }      /* flags: shown on the case page */
  .worklist .pri { font-size: 0; gap: 0; } .worklist .pri .bar { height: 26px; }  /* priority: colour bar only */
  .worklist th:first-child { font-size: 0; width: 14px; }
  .toolbar { padding: 8px 10px; }
  .case-head { padding: 7px 12px; margin-bottom: 8px; gap: 12px; }
  .case-head .pt .avatar { width: 30px; height: 30px; } .case-head .pt h1 { font-size: 15px; }
  .case-tabs { display: flex; gap: 0; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .case-tabs button { flex: 1; height: 40px; border: 0; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
    font: 500 var(--fs-sm) var(--font); display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
  .case-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
  /* the case page fills the screen exactly: the image takes whatever height is left, other tabs scroll inside */
  .main:has(.review) { height: 100dvh; }
  .content.full:has(.review) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .review { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .review .side { display: contents; }
  .review [data-pane] { display: none; }
  .review[data-tab="image"] [data-pane="image"] { display: flex; flex: 1; min-height: 0; }
  .review[data-tab="findings"] [data-pane="findings"], .review[data-tab="report"] [data-pane="report"] { display: flex; flex-direction: column; }
  .review[data-tab="findings"], .review[data-tab="report"] { overflow-y: auto; }
  .review [data-pane] + [data-pane] { margin-top: 0; }
  .v-stage { flex: 1; height: auto; min-height: 120px; }
  .review.expanded .v-stage { height: auto; }
  .v-bar { padding: 3px 6px; gap: 4px; } .v-opacity input { width: 80px; }
  .v-foot { padding: 3px 10px; gap: 10px; } .v-foot .cbar { width: 60px; } .v-zoom { display: none; }
  .v-series { padding: 4px 10px 6px; gap: 3px; } .vs-bars { height: 18px; }
  .vs-keys .small.muted { display: none; } .vs-keys .btn.sm { height: 26px; }
}
@media (max-height: 540px) and (max-width: 1300px) and (orientation: landscape) {
  .case-head { display: none; }                 /* the top bar already names the patient and record number */
  .case-tabs button { height: 36px; }
  .v-modes button { height: 28px; padding: 0 9px; } .v-tool { width: 30px; height: 30px; }
  .vs-row { gap: 8px; } .vs-keys { display: none; }    /* key slices: tap the amber bars */
}
body.case-expanded .case-head, body.case-expanded .case-tabs { display: none; }

/* ================================================================== touch screens */
@media (pointer: coarse) {
  .btn { height: 44px; padding: 0 16px; } .btn.sm { height: 40px; padding: 0 12px; }
  .icon-btn { width: 44px; height: 44px; }
  .v-modes button { height: 40px; padding: 0 12px; } .v-tool { width: 42px; height: 42px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input:not([type]), select { height: 46px; font-size: 16px; }
  .seg label { padding: 11px 16px; }
  .check input { width: 22px; height: 22px; margin-top: 1px; }
  .vs-range input, .v-opacity input { height: 32px; }
  .vs-bars { height: 30px; } .vs-bars span { min-width: 6px; }
  .table td { padding-top: 13px; padding-bottom: 13px; }
  .sb-nav a, .mobile-nav a, .pnav a { min-height: 44px; display: flex; align-items: center; }
  .role-tabs button { height: 46px; }
  a:hover { text-decoration: none; }
}

/* ================================================================== device home (kiosk, graphite)
   Built like an instrument's standby screen: a thin status bar, one state in large type, the two things a person can
   do, and a quiet connection strip. Problems are spelled out only when they exist. */
.device { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); color: var(--text); }
.ds-bar { display: flex; align-items: center; gap: 18px; height: 44px; padding: 0 20px; background: var(--rail); border-bottom: 1px solid #1c2025;
  color: #9aa3ad; font-size: var(--fs-xs); }
.ds-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.ds-brand .logo { width: 22px; height: 22px; }
.ds-brand b { color: #fff; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: var(--fs-xs); }
.ds-brand span { color: #6f7882; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-ind { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ds-ind .ic { width: 14px; height: 14px; color: #6f7882; }
.ds-ind.warn, .ds-ind.warn .ic { color: var(--warn); } .ds-ind .off { color: var(--warn); }
.ds-clock { color: #fff; font: 500 var(--fs-md) var(--mono); padding-left: 18px; border-left: 1px solid #23282e; }
.ds-main { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 28px 36px;
  width: 100%; max-width: 1120px; justify-self: center; }
.ds-visual { display: flex; flex-direction: column; align-items: center; min-width: 0; }
#brain { display: block; width: 100%; height: min(56vh, 440px); cursor: grab; touch-action: none; }
#brain:active { cursor: grabbing; }
.ds-caption { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 6px 0 0;
  font-size: var(--fs-sm); color: var(--muted); text-align: center; }
.ds-state-word { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ok); letter-spacing: .02em; }
.is-check .ds-state-word { color: var(--warn); }
.ds-issues { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.ds-issues li { font-size: var(--fs-sm); color: var(--text); padding: 7px 10px; border-left: 2px solid var(--warn); background: var(--warn-soft); }
.ds-actions { display: grid; gap: 12px; }
.ds-act { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 20px; min-height: 78px;
  border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface); color: var(--text); }
.ds-act:hover { background: var(--surface-3); text-decoration: none; }
.ds-act > .ic { width: 26px; height: 26px; color: var(--muted); }
.ds-act b { display: block; font-size: 19px; font-weight: 600; } .ds-act small { display: block; font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.ds-act .go { width: 18px; height: 18px; color: var(--faint); }
.ds-act.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ds-act.primary:hover { background: var(--accent-hover); }
.ds-act.primary > .ic, .ds-act.primary small, .ds-act.primary .go { color: var(--on-accent); opacity: .85; }
.ds-foot { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.ds-qr { width: 64px; height: 64px; background: #fff; padding: 4px; flex: none; border: 0; cursor: zoom-in; }
.ds-qrbig { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 7, .92); display: grid; place-items: center; cursor: zoom-out; }
.ds-qrbig[hidden] { display: none; }
.ds-qrbig-in { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; text-align: center; padding: 16px; }
.ds-qrbig-code { width: min(70vh, 80vw); height: min(70vh, 80vw); background: #fff; padding: 12px; }
.ds-qrbig-code svg { width: 100%; height: 100%; display: block; }
.ds-qrbig-in b { font: 500 var(--fs-lg) var(--mono); overflow-wrap: anywhere; }
.ds-qrbig-in span:last-child { font-size: var(--fs-sm); color: #b9c0c7; }
.ds-qr svg { width: 100%; height: 100%; display: block; }
.ds-url { display: flex; flex-direction: column; min-width: 0; }
.ds-url span { font-size: var(--fs-xs); color: var(--muted); } .ds-url b { font: 500 var(--fs-md) var(--mono); color: var(--text); overflow-wrap: anywhere; }
.ds-legal { margin-left: auto; font-size: var(--fs-2xs); color: var(--faint); text-align: right; }
@media (max-width: 720px) { .ds-main { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 20px; } .ds-ind { display: none; } }
@media (max-height: 520px) {
  .ds-bar { height: 38px; padding: 0 14px; gap: 14px; }
  .ds-main { padding: 14px 20px; gap: 24px; }
  #brain { height: min(62vh, 300px); }
  .ds-act { min-height: 64px; padding: 12px 16px; } .ds-act b { font-size: 17px; }
  .ds-foot { padding: 6px 14px; } .ds-qr { width: 52px; height: 52px; }
}
/* kiosk: a "device home" button in every page header (only when the kiosk cookie is set) */
.kiosk-home { display: none; }
.kiosk .kiosk-home { display: inline-grid; }
/* upload in progress: a whole study takes 10-30 s on the device */
.busy { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(8, 10, 12, .72); }
.busy.on { display: grid; }
.busy-box { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); padding: 22px 26px; max-width: 360px; text-align: center; box-shadow: var(--shadow-pop); }
.busy-box b { display: block; font-size: var(--fs-lg); font-weight: 600; margin: 12px 0 4px; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--accent); margin: 0 auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
/* row actions inside tables stay quiet: outlined, so the data, not the buttons, carries the eye */
.table .btn.primary { background: transparent; color: var(--accent); border-color: var(--accent); }
.table .btn.primary:hover { background: var(--accent-soft); }
/* back links and pager: icon + text, no typographic arrows */
a.small:has(> .ic), .pager .btn { display: inline-flex; align-items: center; gap: 4px; }
.ic.flip { transform: scaleX(-1); }

/* ================================================================== analytics */
.k-val .unit, .unit { font: 400 var(--fs-xs) var(--font); color: var(--muted); letter-spacing: 0; }
.v-err { color: var(--err); } .v-warn { color: var(--warn); } .c-err { color: var(--err); font-weight: 600; }
.note { margin: 12px 0 0; }
.funnel { width: 100%; border-collapse: collapse; }
.funnel th { text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text-2); padding: 7px 12px 7px 0; white-space: nowrap; width: 1%; }
.funnel td { padding: 7px 0 7px 10px; font-size: var(--fs-sm); }
.funnel td.f-bar { width: 100%; padding-left: 0; } .funnel td.f-bar svg { width: 100%; height: 14px; display: block; }
.funnel rect.track { fill: var(--surface-3); } .funnel rect.fill { fill: var(--accent); }
.funnel tr:last-child rect.fill { fill: var(--ok); }
.funnel td.num { width: 1%; font-family: var(--mono); white-space: nowrap; }
.risk-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.risk-tiles .rt { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-right: 1px solid var(--border); color: var(--text); border-top: 3px solid var(--border-2); }
.risk-tiles .rt:last-child { border-right: 0; } .risk-tiles .rt:hover { background: var(--row-hover); text-decoration: none; }
.risk-tiles .rt b { font: 500 24px/1.2 var(--mono); } .risk-tiles .rt span { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.risk-tiles .r-high { border-top-color: var(--err); } .risk-tiles .r-high b { color: var(--err); }
.risk-tiles .r-medium { border-top-color: var(--warn); } .risk-tiles .r-medium b { color: var(--warn); }
.risk-tiles .r-low { border-top-color: var(--ok); }
.stages { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 14px; padding: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.stages li { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-right: 1px solid var(--border); position: relative; }
.stages li:last-child { border-right: 0; }
.stages li b { font: 500 20px/1.2 var(--mono); } .stages li span { font-size: var(--fs-2xs); color: var(--muted); line-height: 1.25; }
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 12px; }
.mini-kpis div { display: flex; flex-direction: column; padding: 9px 12px; border-right: 1px solid var(--border); }
.mini-kpis div:last-child { border-right: 0; }
.mini-kpis span { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mini-kpis b { font: 500 22px/1.2 var(--mono); }
.confusion td.off { color: var(--warn); font-weight: 600; } .confusion td { color: var(--faint); }
.confusion td.diag, .confusion td.off { color: inherit; } .confusion td.off { color: var(--warn); }
.confusion thead th:first-child { text-transform: none; letter-spacing: 0; }
@media (max-width: 720px) { .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stages li { border-bottom: 1px solid var(--border); } }
/* analytics on narrow / short screens: one card per row, KPIs three across */
@media (max-width: 1100px) {
  .content.analytics .grid.g2, .content.analytics .grid.g-side { grid-template-columns: minmax(0, 1fr); }
  .content.analytics .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content.analytics .kpi { border-bottom: 1px solid var(--border); }
  .content.analytics .kpi .k-sub { white-space: normal; }
}

/* ================================================================== kiosk on-screen keyboard */
.okb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 200; display: none; padding: 6px 6px 8px; gap: 5px; flex-direction: column;
  background: #0b0d10; border-top: 1px solid #23282e; user-select: none; touch-action: manipulation; }
.okb.on { display: flex; }
.okb-row { display: flex; gap: 5px; justify-content: center; }
.okb-k { flex: 1 1 0; max-width: 76px; height: 40px; border: 1px solid #2a3038; border-radius: 3px; background: #1b1f24; color: #e7e9ec;
  font: 500 17px var(--font); cursor: pointer; padding: 0; }
.okb-k:active { background: #2c4250; }
.okb-k.fn { background: #23282e; color: #bcc2c9; font-size: 15px; max-width: 96px; }
.okb-k.wide { flex: 4 1 0; max-width: 360px; }
.okb-k.go { background: #0b6a87; border-color: #0b6a87; color: #fff; }
.okb-k.on { background: #3fb6d6; color: #062530; }
body.okb-open { padding-bottom: 240px; }

/* kiosk: no printing or saving from the device's shared screen */
.kiosk #print-btn, .kiosk .no-kiosk { display: none !important; }

/* patient: studies and status as plain tables / definition rows */
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); }
.next-step b { font-weight: 600; } .next-step .small { color: var(--muted); }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 16px; margin: 0 0 14px; font-size: var(--fs-sm); }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.kpi .ic { display: none; }                    /* counters are labels and numbers only */
