/* Parkside Clinical Risk Watch — design tokens and components.
   Navy #1e3d66, gold #d8b968. Archivo (headings, numbers), Figtree (body), Cinzel (wordmark only). */
:root {
  --navy: #1e3d66; --navy-dark: #14294a; --navy-tint: #e8eef6; --navy-100: #c9d7e8;
  --gold: #d8b968; --gold-tint: #f8f1dc; --gold-dark: #7a5f14;
  --bg: #f4f6f9; --white: #ffffff; --border: #dde2ea; --border-strong: #b9c2d0;
  --text: #1a2333; --muted: #4a566e; --subtle: #5d6a83;
  --critical: #b42318; --critical-tint: #fdecea; --critical-text: #9b1c12;
  --high-tint: #fff0e0; --high-border: #d9822b; --high-text: #8f3f00;
  --mod-tint: #fdf6c8; --mod-border: #c9a800; --mod-text: #5c4a00;
  --low-tint: #e6f0fb; --low-border: #7ba7dc; --low-text: #1f4f8f;
  --success-tint: #e4f4ea; --success-border: #7bbf93; --success-text: #14532d;
  --concern-tint: #efe9f8; --concern-border: #b7a3dd; --concern-text: #4b2e83;
  --neutral-tint: #eceff3; --neutral-border: #b9c2d0; --neutral-text: #3d485e;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 41, 74, .08), 0 2px 8px rgba(20, 41, 74, .05);
  --font-head: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mark: 'Cinzel', Georgia, serif;
  --sidebar-w: 232px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/21px var(--font-body); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy-dark); margin: 0; }
h1 { font-size: 24px; line-height: 30px; font-weight: 700; }
h2 { font-size: 18px; line-height: 24px; font-weight: 600; }
h3 { font-size: 15px; line-height: 20px; font-weight: 600; }
p { margin: 0 0 8px; }
a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: var(--navy-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--neutral-tint); padding: 1px 4px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-radius: 4px; }
.on-dark :focus-visible, .sidebar :focus-visible { outline-color: var(--gold); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 200; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.boot-note { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); } .subtle { color: var(--subtle); }
.small { font-size: 13px; line-height: 18px; } .caption { font-size: 12px; line-height: 16px; font-weight: 500; }
.overline { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--subtle); }
.num { font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- demo banner ---------- */
.demo-banner { position: sticky; top: 0; z-index: 120; background: var(--gold); color: #1a1405; font-weight: 700; padding: 6px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; border-bottom: 2px solid var(--gold-dark); }
.demo-banner select { border: 1px solid var(--gold-dark); border-radius: 4px; background: #fff; padding: 2px 6px; font-weight: 500; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy-dark); color: #fff; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.demo-on .sidebar { top: 35px; height: calc(100vh - 35px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; display: block; object-fit: cover; flex: none; }
.brand-name { font-family: var(--font-mark); font-weight: 700; font-size: 13px; letter-spacing: 1px; line-height: 16px; }
.brand-sub { font-size: 11px; opacity: .8; letter-spacing: .3px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #e8eef6; text-decoration: none; font-weight: 500; min-height: 44px; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav a[aria-current='page'] { background: var(--navy); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--navy-100); padding: 8px; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 50; }
.demo-on .topbar { top: 35px; }
.topbar .spacer { flex: 1; }
.facility-select { display: flex; align-items: center; gap: 8px; }
.facility-select select { max-width: min(440px, 62vw); text-overflow: ellipsis; }
.facility-select label { font-size: 12px; font-weight: 700; color: var(--subtle); text-transform: uppercase; letter-spacing: .6px; }
.user-menu { position: relative; border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 10px; margin-top: 4px; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; background: none; color: #fff; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; min-height: 44px; text-align: left; font: inherit; font-weight: 600; }
.user-btn:hover { background: rgba(255, 255, 255, .1); }
.user-btn .uname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn svg { transform: rotate(180deg); opacity: .8; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--navy-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--font-head); flex: none; }
.menu { position: fixed; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 41, 74, .18); min-width: 240px; padding: 6px; z-index: 60; }
.menu .menu-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu button { display: flex; gap: 8px; align-items: center; width: 100%; background: none; border: 0; padding: 10px; text-align: left; border-radius: 6px; cursor: pointer; min-height: 44px; }
.menu button:hover { background: var(--navy-tint); }
main.page { padding: 24px 32px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 13px; margin-bottom: 6px; }

/* ---------- cards, tables ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card + .card, .section + .section { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpi { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: block; box-shadow: var(--shadow); }
a.kpi:hover { border-color: var(--navy); }
.kpi .label { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--subtle); }
.kpi .value { font: 700 32px/38px var(--font-head); color: var(--navy-dark); margin: 2px 0; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.critical { border-left: 4px solid var(--critical); } .kpi.high { border-left: 4px solid var(--high-border); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
table.table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--subtle); background: #f8f9fb; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--navy-tint); }
.table td.num, .table th.num { text-align: right; }
.table a.rowlink { font-weight: 600; text-decoration: none; }
.table a.rowlink:hover { text-decoration: underline; }
.table caption { text-align: left; padding: 0; }

/* ---------- badges, chips, pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 3px 8px 3px 6px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge svg { flex: none; }
.badge.critical { background: var(--critical); border-color: var(--critical); color: #fff; }
.badge.high { background: var(--high-tint); border-color: var(--high-border); color: var(--high-text); }
.badge.moderate { background: var(--mod-tint); border-color: var(--mod-border); color: var(--mod-text); }
.badge.low { background: var(--low-tint); border-color: var(--low-border); color: var(--low-text); }
.badge.none { background: #fff; border-color: var(--border-strong); color: var(--subtle); text-transform: none; letter-spacing: 0; font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 16px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 6px; border: 1px solid; }
.chip.success { background: var(--success-tint); border-color: var(--success-border); color: var(--success-text); }
.chip.moderate { background: var(--mod-tint); border-color: var(--mod-border); color: var(--mod-text); }
.chip.high { background: var(--high-tint); border-color: var(--high-border); color: var(--high-text); }
.chip.concern { background: var(--concern-tint); border-color: var(--concern-border); color: var(--concern-text); }
.chip.neutral { background: var(--neutral-tint); border-color: var(--neutral-border); color: var(--neutral-text); }
.chip.critical { background: var(--critical-tint); border-color: var(--critical); color: var(--critical-text); }
.chip.low { background: var(--low-tint); border-color: var(--low-border); color: var(--low-text); }
.chip.dashed { background: #fff; border-style: dashed; color: var(--muted); border-color: var(--border-strong); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--navy-tint); color: var(--navy-dark); border: 1px solid var(--navy-100); white-space: nowrap; }
.pill.success { background: var(--success-tint); color: var(--success-text); border-color: var(--success-border); }
.pill.warn { background: var(--high-tint); color: var(--high-text); border-color: var(--high-border); }
.pill.gold { background: var(--gold-tint); color: var(--gold-dark); border-color: var(--gold); }
.pill.neutral { background: var(--neutral-tint); color: var(--neutral-text); border-color: var(--neutral-border); }
.pill.critical { background: var(--critical-tint); color: var(--critical-text); border-color: var(--critical); }
.ai-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--gold-dark); background: var(--gold-tint); border: 1px solid var(--gold); padding: 3px 10px; border-radius: 6px; }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--navy); color: #fff; }
.btn:hover { background: var(--navy-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.secondary:hover { background: var(--navy-tint); color: var(--navy-dark); }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: var(--navy-tint); }
.btn.danger { background: #fff; color: var(--critical-text); border-color: var(--critical); }
.btn.danger:hover { background: var(--critical-tint); }
.btn.accent { background: var(--gold); color: #1a1405; }
.btn.accent:hover { background: #c9a84f; color: #1a1405; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
/* Inline text button, e.g. "Add" next to a value in a header line. */
.linkbtn { background: none; border: 0; padding: 0 2px; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }
.linkbtn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label, .field > .label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--critical-text); font-weight: 600; display: flex; gap: 6px; align-items: center; }
input[type='text'], input[type='email'], input[type='password'], input[type='date'], input[type='time'], input[type='search'], input[type='number'], select, textarea {
  min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; background: #fff; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
select { padding-right: 8px; }
input[aria-invalid='true'] { border-color: var(--critical); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; flex: 0 1 180px; }
.filters .field:has(> .seg) { flex: none; min-width: 0; max-width: 100%; }
.seg { display: inline-flex; flex-wrap: nowrap; flex: none; max-width: 100%; overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
.seg button { display: inline-flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; border: 0; background: #fff; min-height: 40px; padding: 0 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--navy); color: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--navy); }
.check.dimmed { opacity: .7; background: #f8f9fb; }
.check:has(input:checked) { border-color: var(--navy); background: var(--navy-tint); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 16px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; min-height: 44px; white-space: nowrap; }
.tabs button[aria-selected='true'] { color: var(--navy-dark); border-bottom-color: var(--gold); }
.tabs .count { background: var(--navy-tint); border-radius: 999px; padding: 0 8px; margin-left: 6px; font-size: 12px; }

/* ---------- states ---------- */
.state { text-align: center; padding: 32px 16px; color: var(--muted); }
.state .icon { color: var(--subtle); margin-bottom: 8px; }
.state.error { color: var(--critical-text); }
.alert { display: flex; gap: 10px; align-items: flex-start; border: 1px solid; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.alert.error { background: var(--critical-tint); border-color: var(--critical); color: var(--critical-text); }
.alert.info { background: var(--low-tint); border-color: var(--low-border); color: var(--low-text); }
.alert.warn { background: var(--mod-tint); border-color: var(--mod-border); color: var(--mod-text); }
.alert.success { background: var(--success-tint); border-color: var(--success-border); color: var(--success-text); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--navy-100); border-top-color: var(--navy); border-radius: 50%; animation: spin .9s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: 380px; }
.toast { background: var(--navy-dark); color: #fff; border-radius: 8px; padding: 10px 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast.error { background: var(--critical-text); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 41, 74, .55); z-index: 250; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; max-width: 560px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; padding: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.modal.wide { max-width: 760px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand { background: var(--navy-dark); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.auth-brand .brand-mark { width: 56px; height: 56px; border-radius: 10px; }
.auth-brand h1 { color: #fff; font-family: var(--font-mark); letter-spacing: 2px; font-size: 26px; }
.auth-brand p { color: var(--navy-100); max-width: 420px; }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 24px; margin-bottom: 4px; }
.qr { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; width: 200px; height: 200px; }
.qr img { width: 100%; height: 100%; display: block; }
.secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; word-break: break-all; background: var(--neutral-tint); padding: 8px 10px; border-radius: 6px; display: block; }

/* ---------- review ---------- */
.review-head { margin-bottom: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); margin-top: 6px; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--neutral-tint); color: var(--neutral-text); border: 1px solid var(--neutral-border); }
.step.done { background: var(--success-tint); color: var(--success-text); border-color: var(--success-border); }
.step.current { background: var(--gold); color: #1a1405; border-color: var(--gold-dark); }
.step.optional { border-style: dashed; }
.summary-card { border-left: 4px solid var(--gold); }
.review-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.review-grid.wide { grid-template-columns: 300px minmax(0, 4fr) minmax(0, 5fr); }
.review-grid > .col { min-width: 0; }
.group-title { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 8px; }
.group-title:first-child { margin-top: 0; }
.finding-card { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; margin-bottom: 8px; }
.finding-card:hover { border-color: var(--navy); }
.finding-card[aria-pressed='true'] { border: 2px solid var(--navy); background: var(--navy-tint); padding: 11px; }
.finding-card .title { font: 600 15px/20px var(--font-head); margin: 6px 0 4px; color: var(--navy-dark); }
.detail h3 { margin-top: 18px; margin-bottom: 4px; color: var(--navy-dark); }
.detail h3:first-of-type { margin-top: 0; }
.quote { border-left: 3px solid var(--gold); background: #fbf9f1; padding: 8px 12px; margin: 6px 0; border-radius: 0 6px 6px 0; }
.quote cite { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 4px; }
.linklike { background: none; border: 0; padding: 0; color: var(--navy); text-decoration: underline; cursor: pointer; font: inherit; }
.example { background: #f8f9fb; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 12px; }
mark.verify { background: var(--gold-tint); color: var(--gold-dark); border: 1px solid var(--gold); border-radius: 4px; padding: 0 4px; font-weight: 600; }
.notice { font-size: 13px; background: var(--gold-tint); border: 1px solid var(--gold); color: #4a3a0a; border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--navy-100); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy); border: 2px solid #fff; }
.timeline li.gap { border-left: 2px dashed var(--critical); }
.timeline li.gap::before { background: #fff; border: 2px solid var(--critical); }
.timeline .gapbox { border: 1.5px dashed var(--critical); background: var(--critical-tint); border-radius: 8px; padding: 8px 10px; color: var(--critical-text); }
.timeline .when { font-size: 12px; font-weight: 700; color: var(--subtle); }
.timeline .what { font-weight: 500; }
.sect-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--navy-tint); border-radius: 8px; margin: 16px 0 8px; }
.sect-head:first-child { margin-top: 0; }
.crit { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.crit .row { align-items: flex-start; }
.crit details summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center; }
.doc-row:last-child { border-bottom: 0; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; background: #fafbfc; padding: 28px 16px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--navy); background: var(--navy-tint); }
.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.upload-grid aside { position: sticky; top: 80px; }
.step-card h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-no { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 700 14px var(--font-head); flex: none; }
.step-no.done { background: var(--success-text); }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.radio-card { border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px; cursor: pointer; background: #fff; display: flex; gap: 10px; }
.radio-card:has(input:checked) { border: 2px solid var(--navy); background: var(--navy-tint); padding: 11px; }
.radio-card input { width: 20px; height: 20px; accent-color: var(--navy); }
.typegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; max-width: 360px; }
.progress.large { max-width: none; }
.progress-track { flex: 1; height: 8px; background: var(--navy-tint); border: 1px solid var(--navy-100); border-radius: 999px; overflow: hidden; }
.progress.large .progress-track { height: 12px; }
.progress-fill { height: 100%; background: var(--navy); border-radius: 999px; transition: width .2s ease; }
.progress.large .progress-fill { background: linear-gradient(90deg, var(--navy), var(--navy) calc(100% - 4px), var(--gold) calc(100% - 4px)); }
.progress-text { font-size: 12px; font-weight: 600; color: var(--navy-dark); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.picklist { border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow-y: auto; }
.picklist label { display: flex; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: center; min-height: 44px; }
.picklist label:last-child { border-bottom: 0; }
.picklist label:has(input:checked) { background: var(--navy-tint); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 500 11px var(--font-body); fill: var(--muted); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- report preview ---------- */
.paper { background: #fff; border: 1px solid var(--border-strong); box-shadow: var(--shadow); max-width: 816px; margin: 0 auto; padding: 48px 56px; aspect-ratio: auto; }
.paper h1 { font-size: 22px; }
.paper .foot { border-top: 1px solid var(--border-strong); margin-top: 28px; padding-top: 8px; font-size: 11px; color: var(--muted); }
.paper table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.paper th, .paper td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ---------- misc ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 4px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 6px 12px; }
.kv dt { color: var(--subtle); font-weight: 600; font-size: 13px; }
.kv dd { margin: 0; }
.bar { height: 8px; border-radius: 4px; background: var(--neutral-tint); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy); }
.idle-warn { position: fixed; inset: auto 16px 16px auto; z-index: 400; max-width: 380px; }

/* ---------- responsive ---------- */
@media (max-width: 1360px) { .review-grid.wide { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
@media (max-width: 1100px) {
  :root { --sidebar-w: 64px; }
  .brand-name, .brand-sub, .nav a span.label, .sidebar-foot { display: none; }
  .brand { justify-content: center; padding: 4px 0 16px; }
  .nav a { justify-content: center; padding: 10px 0; }
  .user-btn { justify-content: center; padding: 6px 0; }
  .user-btn .uname, .user-btn svg { display: none; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .upload-grid aside { position: static; }
  main.page { padding: 16px; }
  .topbar { padding: 8px 16px; }
}
@media (max-width: 860px) {
  .review-grid, .review-grid.wide { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 24px; }
  .typegrid, .radio-cards { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .user-btn .uname { display: none; }
  .paper { padding: 24px 20px; }
}
@media print {
  .sidebar, .topbar, .demo-banner, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .paper { border: 0; box-shadow: none; }
}

/* ---------- admission module ---------- */
.dev-badge { display: inline-block; font: 700 10px/14px var(--font-body); letter-spacing: .5px; text-transform: uppercase; background: var(--gold); color: #1a1405; border: 1px solid var(--gold-dark); border-radius: 4px; padding: 0 5px; margin-left: 8px; vertical-align: middle; white-space: nowrap; }
.nav a .label { display: inline-flex; align-items: center; flex-wrap: wrap; }
h1 .dev-badge { font-size: 12px; line-height: 18px; padding: 1px 8px; }
.dev-badge.test-badge { background: var(--navy); color: #fff; border-color: var(--navy-dark); }
.synthetic-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--gold-tint); border: 2px solid var(--gold-dark); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; color: #4a3a0a; font-size: 15px; }
.doc-types { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.recon-table th.recon-cat { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); background: transparent; white-space: normal; min-width: 180px; font-weight: 600; }
.recon-table td { vertical-align: top; min-width: 110px; }
.recon-table tbody tr[aria-selected='true'] { background: var(--navy-tint); box-shadow: inset 3px 0 0 var(--gold); }
.recon-block { background: #fafbfc; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.evidence-side { min-width: 0; }
.overdue-text { color: var(--critical-text); font-weight: 600; }
.overview-count { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.signal { border: 1px solid var(--border); border-left: 4px solid var(--high-border); border-radius: 8px; padding: 10px 12px; background: #fff; }
.signal.acknowledged { border-left-color: var(--gold); }
.signal.resolved { border-left-color: var(--success-border); background: #fafcfb; }
.signal-msg { margin: 6px 0; font-weight: 500; }
@media (max-width: 860px) { .evidence-grid { grid-template-columns: 1fr; } }
/* resident risk timeline: each kind of entry has its own tag, rule colour and icon (never colour alone) */
.lane-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; border: 1px solid; }
.lane-tag.lane-clinical { background: var(--navy-tint); color: var(--navy-dark); border-color: var(--navy); }
.lane-tag.lane-audit { background: var(--gold-tint); color: var(--gold-dark); border-color: var(--gold); border-style: dashed; }
.lane-tag.lane-signal { background: var(--high-tint); color: var(--high-text); border-color: var(--high-border); }
.lane-tag.lane-review { background: var(--neutral-tint); color: var(--neutral-text); border-color: var(--neutral-border); }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-entry { padding: 8px 0 10px 14px; border-left: 4px solid var(--border-strong); margin-bottom: 6px; }
.tl-entry.lane-clinical { border-left-color: var(--navy); }
.tl-entry.lane-audit { border-left: 4px dashed var(--gold); }
.tl-entry.lane-signal { border-left-color: var(--high-border); }
.tl-entry .when { font-size: 12px; font-weight: 700; color: var(--subtle); }
.tl-entry .what { font-weight: 500; margin-top: 2px; }
.lane-card.lane-audit { border-left: 4px dashed var(--gold); }
.lane-card.lane-clinical { border-left: 4px solid var(--navy); }
.lane-card.lane-signal { border-left: 4px solid var(--high-border); }
.lane-card .value { font-size: 28px; }
.table tbody th[scope='row'] { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); background: #fff; white-space: normal; font-weight: 600; }
.barlist li { margin-bottom: 12px; }
.barlist li:last-child { margin-bottom: 0; }
