/* Waaberi Hospital ERP — design tokens.
   Brand colours are PROVISIONAL until the hospital supplies its official logo files:
   change --brand* here and the whole interface follows. */
:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #fafbf9;
  --ink: #142120;
  --ink-2: #4b5855;
  --ink-3: #85908c;
  --line: #e3e7e3;
  --line-2: #eef1ee;
  --brand: #0f5b5f;
  --brand-ink: #0a4447;
  --brand-soft: #e6f0ef;
  --brand-tint: #f1f7f6;
  --good: #1d7a4c;
  --good-soft: #e5f3eb;
  --warn: #9a6512;
  --warn-soft: #fbf1df;
  --bad: #b83a33;
  --bad-soft: #fbe9e7;
  --info: #2a5fa8;
  --info-soft: #e8eff9;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(20, 33, 32, 0.04), 0 1px 1px rgba(20, 33, 32, 0.03);
  --shadow-lg: 0 12px 32px rgba(20, 33, 32, 0.12);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; letter-spacing: 0.01em; }
.upper { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 15px; height: 15px; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr); min-height: 100vh; background: var(--surface); }
.login-visual {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 600px at 110% 120%, rgba(255,255,255,0.10), transparent 60%),
    radial-gradient(700px 500px at -10% -10%, rgba(255,255,255,0.08), transparent 60%),
    linear-gradient(160deg, #0f5b5f 0%, #0b4a4e 55%, #093c3f 100%);
  background-size: cover; background-position: center;
}
.login-visual::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,0.18) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: linear-gradient(180deg, transparent, #000 40%, #000 70%, transparent);
}
.login-visual > * { position: relative; z-index: 1; }
.wordmark { display: flex; flex-direction: column; gap: 2px; }
.wordmark b { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.wordmark span { font-size: 12px; opacity: 0.75; letter-spacing: 0.04em; }
.login-hero h1 { font-family: var(--serif); font-weight: 400; font-size: 54px; line-height: 1.04; letter-spacing: -0.01em; max-width: 520px; }
.login-hero p { margin-top: 18px; font-size: 15px; opacity: 0.82; max-width: 430px; }
.login-flow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.login-flow span { border: 1px solid rgba(255,255,255,0.28); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; opacity: 0.92; }
.login-foot { font-size: 12px; opacity: 0.7; display: flex; gap: 18px; flex-wrap: wrap; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(28px, 6vw, 88px); }
.login-card { width: 100%; max-width: 380px; margin: 0 auto; }
.login-card h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.login-card .sub { color: var(--ink-2); margin: 6px 0 28px; }
.login-card form { display: grid; gap: 16px; }
.demo-accounts { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-accounts .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hb-credit { margin-top: 36px; font-size: 12px; color: var(--ink-3); }
.hb-credit b { color: var(--ink-2); font-weight: 600; }

/* ---------- Forms ---------- */
label.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 11px; width: 100%; outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.check input { margin-top: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 500; font-size: 13.5px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: #d3d9d4; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--bad); }
.btn.lg { padding: 11px 18px; font-size: 14.5px; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; background: var(--surface); cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 500; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .wordmark { padding: 22px 22px 18px; color: var(--ink); }
.side .wordmark span { color: var(--ink-3); opacity: 1; }
.nav { padding: 6px 12px; display: grid; gap: 1px; overflow-y: auto; flex: 1; align-content: start; }
.nav .group { margin: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav a .badge { margin-left: auto; }
.nav a.owner { color: var(--brand-ink); }
.side-foot { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11.5px; color: var(--ink-3); }
.main { min-width: 0; display: flex; flex-direction: column; }
.demo-bar { background: #fff8e8; color: #7a5a14; border-bottom: 1px solid #f1e3bf; font-size: 12px; padding: 6px 28px; display: flex; gap: 8px; align-items: center; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 18px 32px 0; }
.topbar .search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.topbar .search input { padding-left: 34px; background: var(--surface); }
.topbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 20; overflow: hidden; }
.search-results a { display: flex; justify-content: space-between; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.search-results a:hover { background: var(--brand-tint); text-decoration: none; }
.content { padding: 22px 32px 64px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font-size: 14.5px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.side-r { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid.side-l { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.sep { height: 1px; background: var(--line-2); margin: 4px 0; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }
.empty svg { width: 28px; height: 28px; margin-bottom: 8px; color: var(--ink-3); }

/* ---------- Tables / lists ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
th.num, td.num { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--brand-tint); }
.table-wrap { overflow-x: auto; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: none; }
.list-item.click { cursor: pointer; }
.list-item.click:hover { background: var(--brand-tint); }
.list-item .grow { flex: 1; min-width: 0; }
.qno { width: 34px; height: 34px; border-radius: 9px; background: var(--line-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--ink-2); flex: none; }
.qno.live { background: var(--brand); color: #fff; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 500; font-size: 13.5px; color: var(--ink-2); background: none; border: none; padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; }
.seg button { font: inherit; font-size: 12.5px; font-weight: 500; border: none; background: none; padding: 5px 12px; border-radius: 6px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.kpi { padding: 22px 24px; border-right: 1px solid var(--line-2); cursor: pointer; transition: background 0.12s; }
.kpi:last-child { border-right: none; }
.kpi:hover { background: var(--brand-tint); }
.kpi.on { background: var(--brand-tint); box-shadow: inset 0 -2px 0 var(--brand); }
.kpi .label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.kpi .value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }
.kpi .help { margin-top: 12px; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.kpi .help i { display: block; font-style: normal; color: var(--ink-2); }
.stat { padding: 18px 20px; }
.stat .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ---------- Insights ---------- */
.insight { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; }
.insight:last-child { border-bottom: none; }
.insight .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.insight.attention .ic { background: var(--warn-soft); color: var(--warn); }
.insight.critical .ic { background: var(--bad-soft); color: var(--bad); }
.insight.good .ic { background: var(--good-soft); color: var(--good); }
.insight h3 { font-size: 14px; margin-bottom: 8px; }
.insight dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 5px 14px; margin: 0; font-size: 13px; }
.insight dt { color: var(--ink-3); font-weight: 500; }
.insight dd { margin: 0; color: var(--ink); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--ink-3); }
.chart .grid line { stroke: var(--line-2); }
.chart .axis line { stroke: var(--line); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--ink-3) 0 4px, transparent 4px 7px) !important; }
.tooltip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px; z-index: 50; box-shadow: var(--shadow-lg); white-space: nowrap; }
.bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 90px; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; }
.bar-track { height: 10px; background: var(--line-2); border-radius: 4px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); border-radius: 0 4px 4px 0; }
.bar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: 0.6; }

/* ---------- Payment ---------- */
.pay-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pay-method { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 10px; text-align: center; cursor: pointer; background: var(--surface); font: inherit; font-weight: 500; color: var(--ink); }
.pay-method:hover { border-color: var(--brand); }
.pay-method.on { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 2px var(--brand-soft); }
.split { display: grid; grid-template-columns: 1fr 120px 1fr 32px; gap: 8px; align-items: center; }
.amount-due { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------- Clinical ---------- */
.patient-band { display: flex; gap: 18px; align-items: center; padding: 16px 22px; }
.patient-band .avatar { width: 44px; height: 44px; font-size: 15px; }
.patient-band .facts { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.allergy { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.result-table td.flag-high, .result-table td.flag-low { color: var(--warn); font-weight: 600; }
.result-table td.flag-critical { color: var(--bad); font-weight: 700; }
.timeline { display: grid; gap: 0; }
.timeline .ev { display: grid; grid-template-columns: 90px 14px minmax(0, 1fr); gap: 12px; padding: 10px 0; }
.timeline .ev .t { font-size: 12px; color: var(--ink-3); text-align: right; }
.timeline .ev .b { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--brand); margin-top: 5px; background: var(--surface); }

/* ---------- Workflow / blueprint ---------- */
.flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; counter-reset: step; }
.flow .step { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); position: relative; counter-increment: step; }
.flow .step::before { content: counter(step); position: absolute; top: 12px; right: 14px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.flow .step b { display: block; font-size: 13.5px; margin-bottom: 4px; padding-right: 18px; }
.flow .step .who { font-size: 12px; color: var(--brand-ink); font-weight: 500; }
.flow .step .next { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.matrix td, .matrix th { padding: 7px 10px; font-size: 12.5px; }
.matrix td.c { text-align: center; }
.yes { color: var(--good); }
.no { color: var(--ink-3); }
.lock { color: var(--bad); }

/* ---------- Toast / modal ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 100; display: flex; gap: 8px; align-items: center; }
.toast.bad { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(20, 33, 32, 0.32); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal .card-head { position: sticky; top: 0; background: var(--surface); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); }

.denied { max-width: 520px; margin: 60px auto; text-align: center; }
.denied .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; margin: 0 auto 18px; }
.denied code { background: var(--line-2); padding: 2px 6px; border-radius: 5px; font-size: 12px; }

@media (max-width: 1100px) {
  .grid.side-r, .grid.side-l { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: none; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-visual { min-height: 300px; padding: 32px 24px; }
  .login-hero h1 { font-size: 38px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { grid-auto-flow: column; overflow-x: auto; }
  .nav .group, .side-foot { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr) 70px; }
  .pay-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight dl { grid-template-columns: 1fr; }
}
@media print {
  .side, .topbar, .demo-bar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}

/* ======================================================================
   Patient experience redesign: menus, searchable selects, journey board,
   checkout drawer, 360° profile and the three-column consultation.
   ====================================================================== */
.ctx-menu { position: absolute; z-index: 80; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; display: grid; }
.ctx-menu button, .ctx-menu a { font: inherit; font-size: 13.5px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; gap: 16px; }
.ctx-menu button span { color: var(--ink-3); font-size: 12px; }
.ctx-menu button:hover, .ctx-menu a:hover, .ctx-menu button:focus-visible, .ctx-menu a:focus-visible { background: var(--brand-tint); text-decoration: none; outline: none; }
.ctx-menu .danger { color: var(--bad); }
.ctx-menu button:disabled { color: var(--ink-3); cursor: not-allowed; background: none; }
.ctx-menu .sep { height: 1px; background: var(--line-2); margin: 4px 2px; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--ink-2); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg); padding: 4px; max-height: 300px; overflow: auto; }
.combo-list [role=option] { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.combo-list [role=option].on, .combo-list [role=option]:hover { background: var(--brand-tint); }
.combo-foot { padding: 6px 10px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line-2); margin-top: 4px; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.token { display: inline-flex; gap: 6px; align-items: center; background: var(--brand-soft); color: var(--brand-ink); border-radius: 6px; padding: 3px 4px 3px 9px; font-size: 13px; font-weight: 500; }
.token button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 3px; font-size: 14px; line-height: 1; border-radius: 4px; }
.token button:hover { background: rgba(15, 91, 95, 0.12); }

/* Journey clock pill */
.clock-pill { display: inline-flex; gap: 8px; align-items: center; background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-pill .dot { width: 8px; height: 8px; background: var(--brand); }
.clock-pill.over { background: var(--warn-soft); color: var(--warn); }
.clock-pill.over .dot { background: var(--warn); }
.clock-pill.done { background: var(--good-soft); color: var(--good); }

/* KPI tiles (clickable) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: left; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px; transition: border-color .12s, background .12s; }
.tile:hover { border-color: var(--brand); }
.tile.on { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.tile .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .l { font-size: 12.5px; color: var(--ink-2); }
.tile .s { font-size: 11.5px; color: var(--ink-3); }
.tile.warn .v { color: var(--warn); }
.tile.bad .v { color: var(--bad); }

/* Journey board */
.board { display: grid; grid-template-columns: repeat(6, minmax(168px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 160px; }
.lane > header { padding: 11px 12px 9px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line-2); }
.lane > header b { font-size: 13px; }
.lane > header span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.lane .cards { padding: 8px; display: grid; gap: 8px; align-content: start; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; display: grid; gap: 4px; cursor: pointer; text-align: left; font: inherit; color: inherit; position: relative; }
.vcard:hover { border-color: var(--brand); }
.vcard.over { border-left: 3px solid var(--warn); padding-left: 9px; }
.vcard .nm { font-weight: 600; font-size: 13.5px; padding-right: 26px; }
.vcard .meta { font-size: 12px; color: var(--ink-3); }
.vcard .tm { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.vcard.over .tm { color: var(--warn); font-weight: 500; }
.vcard .icon-btn { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; }
.vcard .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.vcard .tags .badge { font-size: 11px; padding: 1px 7px; }

/* Side drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 33, 32, 0.24); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); z-index: 61; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer > header { padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: flex-start; }
.drawer > .body { padding: 18px 22px; overflow: auto; flex: 1; display: grid; gap: 18px; align-content: start; }
.drawer > footer { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.checklist { display: grid; gap: 2px; }
.checklist .ci { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.checklist .ci:last-child { border-bottom: 0; }
.checklist .ci .m { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.checklist .ci.ok .m { background: var(--good-soft); color: var(--good); }
.checklist .ci.no .m { background: var(--warn-soft); color: var(--warn); }
.checklist .ci .m svg { width: 13px; height: 13px; stroke-width: 2.2; }
.measures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; font-size: 13px; }
.measures div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.measures b { font-variant-numeric: tabular-nums; font-weight: 600; }
.split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); }
.split-bar i { display: block; height: 100%; }
.msg-bubble { background: #e9f6ee; border-radius: 12px 12px 12px 4px; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; max-width: 360px; }

/* 360° profile */
.profile-head { display: flex; gap: 18px; align-items: center; padding: 18px 22px; flex-wrap: wrap; }
.photo { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 600; font-size: 20px; flex: none; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-head h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; letter-spacing: 0; }
.profile-head .facts { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.alerts { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 22px 16px; }
.alerts .allergy { padding: 6px 10px; }
.alert-chip { display: inline-flex; gap: 6px; align-items: center; border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; font-weight: 500; background: var(--warn-soft); color: var(--warn); }
.alert-chip.info { background: var(--info-soft); color: var(--info); }
.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.filters select, .filters input { padding: 8px 10px; font-size: 13px; }

/* Three-column consultation */
.consult-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 16px; }
.consult-head .who b { font-size: 17px; display: block; }
.consult-head .who span { font-size: 12.5px; color: var(--ink-3); }
.consult { display: grid; grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(280px, 340px); gap: 16px; align-items: start; }
.consult .col { display: grid; gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.panel h2 { font-size: 14px; }
.panel h3.upper { margin: 0; }
.note-head { display: flex; gap: 12px; align-items: baseline; }
.note-head h1 { font-family: var(--serif); font-weight: 400; font-size: 28px; letter-spacing: 0; }
.vitals-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-variant-numeric: tabular-nums; }
.vitals-grid span { font-size: 11.5px; color: var(--ink-3); display: block; }
.interval { display: flex; flex-wrap: wrap; gap: 6px; }
.warn-box { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; line-height: 1.4; }
.ok-box { background: var(--good-soft); color: var(--good); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.saved-at { font-size: 12px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }

/* Arrivals */
.big-search { position: relative; }
.big-search input { font-size: 17px; padding: 14px 16px 14px 44px; border-radius: 12px; }
.big-search > svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 20px; height: 20px; }

.bars { display: grid; gap: 6px; }
.hbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .t { height: 10px; background: var(--line-2); border-radius: 3px; position: relative; overflow: hidden; }
.hbar .t i { position: absolute; inset: 0 auto 0 0; background: var(--brand); border-radius: 0 3px 3px 0; }
.hbar .t i.over { background: var(--warn); }
.hbar .t em { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .55; }

@media (max-width: 1180px) {
  .consult { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
  .consult .col.left { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
  .consult { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: repeat(6, minmax(220px, 82vw)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: 1 / -1; }
  .measures { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 100px minmax(0, 1fr) 56px; }
  .profile-head h1 { font-size: 24px; }
}
@media print { .ctx-menu, .drawer, .drawer-bg { display: none !important; } }
.nowrap { white-space: nowrap; }

/* ======================================================================
   Compact, livelier layout (feedback 20 Oct): smaller type and spacing so
   more fits on screen, a dark brand sidebar and colour-coded tiles and lanes.
   ====================================================================== */
:root { --radius: 8px; --radius-sm: 6px; --accent-1: #0f5b5f; --accent-2: #2a78d6; --accent-3: #d9822b; --accent-4: #7a4fc4; --accent-5: #1d7a4c; --accent-6: #c2416b; --accent-7: #5b6b78; }
body { font-size: 13px; line-height: 1.42; }
h1 { font-size: 19px; letter-spacing: -0.015em; }
h2 { font-size: 14.5px; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
svg.i { width: 16px; height: 16px; }
svg.i.sm { width: 14px; height: 14px; }

/* Sidebar: dark brand panel */
.shell { grid-template-columns: 208px minmax(0, 1fr); }
.side { background: linear-gradient(180deg, #0d4f53 0%, #093b3e 100%); border-right: 0; color: #fff; }
.side .wordmark { padding: 16px 16px 12px; color: #fff; }
.side .wordmark b { font-size: 15.5px; }
.side .wordmark span { color: rgba(255,255,255,0.6); }
.nav { padding: 4px 8px; }
.nav .group { margin: 12px 8px 4px; color: rgba(255,255,255,0.45); font-size: 10.5px; }
.nav a { padding: 6px 9px; gap: 9px; font-size: 13px; color: rgba(255,255,255,0.78); }
.nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,0.14); color: #fff; box-shadow: inset 3px 0 0 #7fd1c7; }
.nav a.owner { color: #bfe9e3; }
.side-foot { border-top: 1px solid rgba(255,255,255,0.12); padding: 10px 12px; }
.side-foot .who b { color: #fff; font-size: 12.5px; }
.side-foot .who span { color: rgba(255,255,255,0.55); font-size: 11px; }
.side-foot .avatar { background: rgba(255,255,255,0.16); color: #fff; width: 28px; height: 28px; font-size: 11px; }
.side-foot .btn, .side-foot button { color: rgba(255,255,255,0.75); }

/* Page frame */
.demo-bar { padding: 4px 24px; font-size: 11.5px; }
.topbar { padding: 10px 24px 0; }
.topbar .search input { padding-top: 6px; padding-bottom: 6px; }
.content { padding: 12px 24px 40px; max-width: 1480px; }
.page-head { margin-bottom: 14px; gap: 12px; }
.page-head p { margin-top: 2px; font-size: 12.5px; }
.crumb { margin-bottom: 4px; font-size: 12px; }

/* Controls */
input, select, textarea { padding: 6px 9px; font-size: 13px; }
textarea { min-height: 60px; }
label.field { gap: 4px; font-size: 12px; }
.form-grid { gap: 10px; }
.btn { padding: 6px 11px; font-size: 13px; gap: 6px; }
.btn.lg { padding: 8px 14px; font-size: 13.5px; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.primary { box-shadow: 0 1px 0 rgba(0,0,0,0.08); }
.chip { padding: 3px 9px; font-size: 12px; }
.icon-btn { width: 26px; height: 26px; }

/* Surfaces */
.card { box-shadow: 0 1px 2px rgba(20,33,32,0.05); }
.card-pad { padding: 12px 14px; }
.card-head { padding: 9px 14px; gap: 10px; }
.card-head h2 { font-size: 13.5px; }
.grid { gap: 12px; }
.grid.side-r { grid-template-columns: minmax(0, 1fr) 300px; }
.grid.side-l { grid-template-columns: 260px minmax(0, 1fr); }
.stack { gap: 10px; }
.empty { padding: 22px 16px; }
th { padding: 7px 10px; font-size: 10.5px; }
td { padding: 7px 10px; }
.list-item { padding: 8px 14px; gap: 10px; }
.qno { width: 28px; height: 28px; font-size: 12px; border-radius: 7px; }
.badge { padding: 1px 7px; font-size: 11px; }
.tabs { margin-bottom: 12px; }
.tabs button { padding: 7px 11px; font-size: 13px; }
.tabs button.on { font-weight: 600; }
.seg button { padding: 3px 10px; font-size: 12px; }
.kpi { padding: 14px 16px; }
.kpi .value { font-size: 23px; margin: 3px 0 2px; }
.kpi .help { margin-top: 8px; }
.stat { padding: 12px 14px; }
.stat .v { font-size: 21px; }
.insight { padding: 12px 14px; gap: 10px; }
.modal { border-radius: 12px; }
.modal-foot { padding: 10px 16px; }
.toast { padding: 8px 14px; font-size: 13px; }
.timeline .ev { padding: 6px 0; }

/* Tiles: colour-coded accent strip */
.tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.tile { padding: 9px 12px 9px 14px; position: relative; overflow: hidden; gap: 0; }
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tile-accent, var(--accent-1)); }
.tile:nth-child(7n+1) { --tile-accent: var(--accent-1); }
.tile:nth-child(7n+2) { --tile-accent: var(--accent-2); }
.tile:nth-child(7n+3) { --tile-accent: var(--accent-3); }
.tile:nth-child(7n+4) { --tile-accent: var(--accent-4); }
.tile:nth-child(7n+5) { --tile-accent: var(--accent-5); }
.tile:nth-child(7n+6) { --tile-accent: var(--accent-6); }
.tile:nth-child(7n+7) { --tile-accent: var(--accent-7); }
.tile .v { font-size: 21px; }
.tile .l { font-size: 12px; }
.tile .s { font-size: 11px; }
.tile.warn { --tile-accent: var(--warn); }

/* Journey board: coloured lane headers, tighter cards */
.board { grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 8px; }
.lane { min-height: 120px; }
.lane > header { flex-direction: column; align-items: flex-start; gap: 0; padding: 7px 10px; border-top: 3px solid var(--lane-accent, var(--accent-1)); border-radius: var(--radius) var(--radius) 0 0; }
.lane:nth-child(1) { --lane-accent: var(--accent-7); }
.lane:nth-child(2) { --lane-accent: var(--accent-3); }
.lane:nth-child(3) { --lane-accent: var(--accent-1); }
.lane:nth-child(4) { --lane-accent: var(--accent-2); }
.lane:nth-child(5) { --lane-accent: var(--accent-4); }
.lane:nth-child(6) { --lane-accent: var(--accent-5); }
.lane > header b { font-size: 12.5px; }
.lane > header span { font-size: 11px; }
.lane .cards { padding: 6px; gap: 6px; }
.vcard { padding: 7px 9px; gap: 2px; border-radius: 7px; }
.vcard .nm { font-size: 13px; }
.vcard .meta, .vcard .tm { font-size: 11.5px; }

/* Drawer, checklist, profile, consultation */
.drawer { width: min(440px, 100%); }
.drawer > header { padding: 12px 16px 10px; }
.drawer > .body { padding: 12px 16px; gap: 12px; }
.drawer > footer { padding: 10px 16px; }
.checklist .ci { padding: 5px 0; font-size: 13px; }
.measures { gap: 4px 14px; font-size: 12.5px; }
.measures div { padding: 2px 0; }
.msg-bubble { font-size: 13px; padding: 8px 10px; }
.profile-head { padding: 12px 16px; gap: 14px; }
.profile-head h1 { font-family: var(--font); font-weight: 600; font-size: 21px; letter-spacing: -0.015em; }
.profile-head .facts { font-size: 12.5px; margin-top: 2px; }
.photo { width: 48px; height: 48px; font-size: 16px; }
.alerts { padding: 0 16px 10px; gap: 6px; }
.alerts .allergy, .alert-chip { padding: 4px 9px; font-size: 12.5px; }
.allergy { padding: 6px 10px; font-size: 12.5px; }
.dl { gap: 5px 12px; font-size: 13px; grid-template-columns: 120px minmax(0, 1fr); }
.filters { padding: 10px 12px; gap: 8px; }
.filters select, .filters input { padding: 6px 8px; font-size: 12.5px; }
.consult-head { padding: 9px 14px; margin-bottom: 10px; gap: 8px 16px; }
.consult-head .who b { font-size: 15px; }
.consult { gap: 10px; grid-template-columns: minmax(210px, 250px) minmax(0, 1fr) minmax(260px, 310px); }
.consult .col { gap: 10px; }
.panel { padding: 11px 12px; gap: 7px; }
.panel h2 { font-size: 13px; }
.note-head h1 { font-family: var(--font); font-weight: 600; font-size: 19px; letter-spacing: -0.015em; }
.big-search input { font-size: 15px; padding: 10px 12px 10px 38px; border-radius: 10px; }
.big-search > svg { left: 12px; width: 18px; height: 18px; }
.hbar { grid-template-columns: 140px minmax(0, 1fr) 60px; font-size: 12.5px; }
.hbar .t { height: 8px; }
.bar-row { padding: 4px 0; font-size: 12.5px; }
.amount-due { font-size: 28px; }
.pay-method { padding: 9px 8px; }
.flow .step { padding: 10px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { min-width: 0; }
  .side .wordmark { padding: 10px 12px 4px; }
  .nav { flex: none; padding: 4px 8px 8px; }
  .nav a { color: rgba(255,255,255,0.85); white-space: nowrap; }
  .demo-bar { padding: 4px 12px; }
  .content, .topbar { padding-left: 12px; padding-right: 12px; }
  .board { grid-template-columns: repeat(6, minmax(200px, 78vw)); }
}

/* ======================================================================
   Top menu bar with dropdowns (replaces the left sidebar, 20 Oct).
   ====================================================================== */
.shell { display: block; min-height: 100vh; }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 0 20px; height: 50px;
  background: linear-gradient(90deg, #0d4f53 0%, #0a4245 100%); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,0.12); }
.appbar .brand { display: flex; flex-direction: column; line-height: 1.1; color: #fff; text-decoration: none; padding-right: 10px; border-right: 1px solid rgba(255,255,255,0.15); flex: none; }
.appbar .brand b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.appbar .brand span { font-size: 10.5px; color: rgba(255,255,255,0.6); letter-spacing: 0.03em; }
.topnav { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.topnav > a, .appbar .dd-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; color: rgba(255,255,255,0.82); font: inherit; font-size: 13px; font-weight: 500; background: none; border: 0; cursor: pointer; white-space: nowrap; text-decoration: none; }
.topnav > a:hover, .appbar .dd-btn:hover, .appbar .dd.open > .dd-btn { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.topnav > a.active, .appbar .dd.active > .dd-btn { background: rgba(255,255,255,0.16); color: #fff; box-shadow: inset 0 -2px 0 #7fd1c7; }
.topnav > a svg.i { opacity: 0.85; }
.dd { position: relative; }
.appbar .dd-btn svg.i.sm { width: 13px; height: 13px; opacity: 0.8; }
.dd-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 40; }
.dd-menu.right { left: auto; right: 0; }
.dd.open > .dd-menu { display: grid; }
.dd-menu a, .dd-menu > button { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 6px; color: var(--ink); font: inherit; font-size: 13px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none; }
.dd-menu a:hover, .dd-menu > button:hover { background: var(--brand-tint); text-decoration: none; }
.dd-menu a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.dd-menu a svg.i { color: var(--ink-3); }
.dd-head { padding: 7px 10px 9px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; display: grid; }
.dd-head b { font-size: 13px; }
.dd-head span { font-size: 11.5px; color: var(--ink-3); }
.appbar .search { position: relative; width: 240px; flex: none; }
.appbar .search > span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,0.6); display: flex; }
.appbar .search input { background: rgba(255,255,255,0.1); border-color: transparent; color: #fff; padding: 6px 10px 6px 31px; }
.appbar .search input::placeholder { color: rgba(255,255,255,0.6); }
.appbar .search input:focus { background: #fff; color: var(--ink); box-shadow: none; }
.appbar .search input:focus::placeholder { color: var(--ink-3); }
.appbar .search .search-results { color: var(--ink); }
.dd.user > .dd-btn { padding: 4px 8px 4px 4px; }
.dd.user .avatar { width: 28px; height: 28px; font-size: 11px; background: rgba(255,255,255,0.18); color: #fff; }
.dd.user .nm { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.demo-bar { padding: 3px 20px; }
.content { padding: 14px 20px 40px; max-width: 1560px; margin: 0 auto; }
.topbar { display: none; }

@media (max-width: 1180px) {
  .dd.user .nm { display: none; }
  .appbar .search { width: 180px; }
  .topnav > a svg.i { display: none; }
  .topnav > a, .appbar .dd-btn { padding: 6px 8px; }
}
@media (max-width: 860px) {
  .appbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; position: static; }
  .appbar .brand { border-right: 0; }
  .appbar .search { order: 3; width: 100%; }
  .dd.user { margin-left: auto; }
  .topnav { order: 4; width: 100%; flex: none; overflow-x: auto; }
  .dd-menu { position: fixed; top: auto; left: 12px; right: 12px; }
  .content { padding: 12px 12px 32px; }
}

/* Consultation: patient bar with dropdowns, note left, large tabbed orders right */
.consult-bar { position: sticky; top: 50px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(20,33,32,0.05); }
.consult-bar .who { display: grid; line-height: 1.25; }
.consult-bar .who b { font-size: 15px; }
.consult-bar .who span { font-size: 12px; color: var(--ink-3); }
.consult-bar .actions { margin-left: auto; gap: 8px; }
.alert-chip.bad { background: var(--bad-soft); color: var(--bad); }
.dd-menu.pop { min-width: 260px; }
.dd-menu.wide { min-width: 340px; }
.consult2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 12px; align-items: start; }
.panel.note { padding: 14px 16px; gap: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel.orders { padding: 0; gap: 0; overflow: visible; }
.otabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 8px; background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; overflow-x: auto; }
.otabs button { font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink-2); background: none; border: 0; padding: 11px 12px 9px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.otabs button:hover { color: var(--ink); }
.otabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; background: var(--surface); }
.otabs .cnt { font-size: 11px; background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 0 7px; font-weight: 600; }
.otabs .cnt.alert { background: var(--warn-soft); color: var(--warn); }
.obody { padding: 12px 14px 14px; min-height: 320px; }
.obody table td, .obody table th { padding: 7px 8px; }
.obody td input, .obody td select { padding: 5px 7px; }
.order-entry { display: flex; gap: 8px; align-items: center; padding-bottom: 10px; flex-wrap: wrap; }
.order-entry > div:first-child, .order-entry .combo { flex: 1; min-width: 200px; }
.rx-draft { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--brand-tint); }
.rx-draft th { background: transparent; }
@media (max-width: 1100px) { .consult2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .consult-bar { position: static; } .two-col { grid-template-columns: 1fr; } }

.consult-bar .clock-pill { padding: 1px 9px; font-size: 11.5px; }
.consult-bar .clock-pill .dot { width: 6px; height: 6px; }

/* Collapsible sections (profile summary and similar side panels) */
.summary { overflow: hidden; }
.acc { border-top: 1px solid var(--line-2); }
.acc:first-of-type { border-top: 0; }
.acc > summary { list-style: none; cursor: pointer; padding: 9px 14px; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; }
.acc[open] > summary::after { transform: rotate(45deg); }
.acc > summary:hover { background: var(--brand-tint); }
.acc > summary .cnt { font-size: 11px; background: var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 0 7px; font-weight: 600; }
.acc-body { padding: 0 14px 12px; display: grid; gap: 7px; }

/* ======================================================================
   Smaller, calmer type everywhere; reception desk, flow toolbar, cashier kiosk.
   ====================================================================== */
h1 { font-size: 17px; }
.page-head { margin-bottom: 10px; }
.tile { padding: 7px 10px 7px 12px; }
.tile .v { font-size: 18px; font-weight: 600; }
.tile .l { font-size: 11.5px; }
.kpi .value { font-size: 20px; }
.stat .v { font-size: 18px; }
.vcard .nm { font-weight: 500; font-size: 12.5px; }
.vcard { padding: 6px 8px; }
.vcard.over .tm { font-weight: 400; }
.lane > header b { font-size: 12px; font-weight: 600; }
.lane { background: var(--surface); }
.lane .cards { background: var(--surface-2); flex: 1; border-radius: 0 0 var(--radius) var(--radius); }
.late { color: var(--warn); }
td.late { font-weight: 500; }

/* Reception desk */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 12px; align-items: start; }
.desk-main { display: grid; gap: 12px; }
.desk-side { display: grid; gap: 12px; position: sticky; top: 64px; }
.desk-search { padding: 10px; }
.desk-search .big-search input { font-size: 14px; padding: 9px 12px 9px 36px; }
.search-list { margin-top: 8px; border-top: 1px solid var(--line-2); }
.search-list .list-item { padding: 7px 6px; }
.search-list .avatar { width: 28px; height: 28px; font-size: 11px; }
#aqueue .otabs { border-radius: var(--radius) var(--radius) 0 0; }
.countlist { display: grid; padding: 4px 0; }
.countrow { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 10px; padding: 7px 14px; font: inherit; font-size: 13px; background: none; border: 0; text-align: left; color: var(--ink); }
button.countrow { cursor: pointer; }
button.countrow:hover { background: var(--brand-tint); }
.countrow i { width: 8px; height: 8px; border-radius: 50%; }
.countrow b { font-variant-numeric: tabular-nums; }
.quick { display: grid; padding: 4px; }
.quick a { display: flex; gap: 9px; align-items: center; padding: 7px 10px; border-radius: 6px; color: var(--ink); font-size: 13px; }
.quick a:hover { background: var(--brand-tint); text-decoration: none; }
.quick a svg { color: var(--brand); }

/* Patient flow toolbar */
.flow-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; margin-bottom: 10px; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.summary-strip b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-strip em { font-style: normal; color: var(--ink-3); }
.summary-strip .late b { color: var(--warn); }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar select { width: auto; padding: 4px 8px; font-size: 12.5px; }
.toolbar .seg button { padding: 3px 10px; }
.dd-menu.checks { min-width: 220px; padding: 6px; }
.dd-menu.checks label { display: flex; gap: 8px; align-items: center; padding: 5px 8px; font-size: 13px; border-radius: 6px; cursor: pointer; }
.dd-menu.checks label:hover { background: var(--brand-tint); }

/* Cashier kiosk */
.kiosk { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; align-items: start; }
.kiosk-queue { position: sticky; top: 64px; max-height: calc(100vh - 84px); display: flex; flex-direction: column; }
.kq-list { overflow: auto; padding: 4px; }
.kq { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; color: var(--ink); border: 1px solid transparent; }
.kq:hover { background: var(--brand-tint); text-decoration: none; }
.kq.on { background: var(--brand-soft); border-color: var(--brand); }
.kq .grow { display: grid; min-width: 0; }
.kq .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.kiosk-main { max-width: 760px; }
.kiosk-idle { padding: 48px 24px; text-align: center; color: var(--ink-2); display: grid; gap: 8px; justify-items: center; }
.kiosk-idle svg { width: 36px; height: 36px; color: var(--brand); }
.kiosk-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 10px; }
.kiosk-say { margin: 0 18px; padding: 14px 16px; border-radius: 10px; background: linear-gradient(135deg, #0d4f53, #0f5b5f); color: #fff; display: flex; gap: 12px; align-items: center; }
.kiosk-say div { display: grid; gap: 2px; }
.kiosk-say span { font-size: 12px; opacity: 0.8; }
.kiosk-say b { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.kiosk-say.done { background: var(--good-soft); color: var(--good); }
.kiosk-say.done b { font-size: 15px; }
.kiosk-say.done span { opacity: 1; color: var(--ink-2); font-size: 13px; }
.steps { list-style: none; margin: 0; padding: 14px 18px 6px; display: grid; gap: 4px; }
.steps > li { border-left: 2px solid var(--line); padding: 0 0 14px 18px; margin-left: 11px; position: relative; display: grid; gap: 8px; }
.steps > li:last-child { border-left-color: transparent; }
.steps .sh { display: flex; align-items: center; gap: 10px; margin-left: -31px; }
.steps .n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.steps li.done .n { background: var(--good); }
.steps h3 { font-size: 13.5px; }
.charges > summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 2px 0 6px; }
.charges table td { padding: 6px 8px; }
.pay-block { display: grid; gap: 8px; padding-bottom: 8px; }
.pay-methods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pay-method { padding: 10px 8px; font-size: 13.5px; }
.pay-other { padding: 9px 8px; text-align: center; font-weight: 500; }
.pay-other.on { border-color: var(--brand); background: var(--brand-tint); }
.tell { background: var(--info-soft); color: var(--info); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.tell svg { margin-top: 1px; }
.change { background: var(--warn-soft); color: var(--warn); border-radius: 7px; padding: 8px 10px; font-size: 13px; }
.confirm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 1000px) {
  .desk, .kiosk { grid-template-columns: minmax(0, 1fr); }
  .desk-side, .kiosk-queue { position: static; max-height: none; }
  .pay-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.filter-bar { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.filter-bar > input { max-width: 420px; }
.filter-menu { width: 320px; padding: 10px; gap: 8px; }
.dd-btn .cnt:empty { display: none; }
.dd-btn .cnt { font-size: 11px; background: var(--brand); color: #fff; border-radius: 999px; padding: 0 6px; }
.toolbar select#fdoc { max-width: 220px; }

/* Tables take the page's text size even where a host page renders without a doctype. */
table { font-size: inherit; }

@media (max-width: 860px) { .board { grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: minmax(210px, 76vw); } }

/* ======================================================================
   Light blue and white theme (chosen 20 Oct). Provisional until the official
   logo and brand colours are supplied; change the tokens here.
   ====================================================================== */
:root {
  --bg: #f3f7fc;
  --surface-2: #f7fafd;
  --ink: #13243a;
  --ink-2: #4a5b70;
  --ink-3: #8293a7;
  --line: #e1e9f2;
  --line-2: #edf2f8;
  --brand: #1f74c4;
  --brand-ink: #165a9c;
  --brand-soft: #e2effb;
  --brand-tint: #f1f7fd;
  --sky: #5aa9e6;
  --accent-1: #1f74c4;
  --accent-2: #5aa9e6;
  --accent-7: #8293a7;
}
.appbar { background: #fff; color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 2px 10px rgba(31, 116, 196, 0.05); }
.appbar .brand { color: var(--brand-ink); border-right-color: var(--line); }
.appbar .brand span { color: var(--ink-3); }
.topnav > a, .appbar .dd-btn { color: var(--ink-2); }
.topnav > a:hover, .appbar .dd-btn:hover, .appbar .dd.open > .dd-btn { background: var(--brand-tint); color: var(--brand-ink); }
.topnav > a.active, .appbar .dd.active > .dd-btn { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 0 -2px 0 var(--brand); }
.appbar .search > span { color: var(--ink-3); }
.appbar .search input { background: var(--brand-tint); border-color: var(--line); color: var(--ink); }
.appbar .search input::placeholder { color: var(--ink-3); }
.appbar .search input:focus { background: #fff; border-color: var(--brand); }
.dd.user .avatar { background: var(--brand-soft); color: var(--brand-ink); }
.demo-bar { background: #fffaf0; }
.token button:hover { background: rgba(31, 116, 196, 0.12); }
.kiosk-say { background: linear-gradient(135deg, #e2effb, #d3e7fa); color: var(--brand-ink); border: 1px solid #c7def5; }
.kiosk-say span { color: var(--ink-2); opacity: 1; }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.otabs, .lane > header { background: #fff; }
.lane .cards { background: var(--brand-tint); }
.card { border-color: var(--line); }

/* Front page (sign in): light, calm, little text */
.login2 { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden;
  background: radial-gradient(900px 500px at 10% 0%, #d9ecfb 0%, transparent 60%), radial-gradient(800px 500px at 100% 100%, #e6f2fc 0%, transparent 60%), #f6faff; }
.login2::before, .login2::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.login2::before { width: 420px; height: 420px; right: -120px; top: -140px; background: radial-gradient(circle, rgba(90,169,230,0.22), transparent 70%); }
.login2::after { width: 360px; height: 360px; left: -120px; bottom: -140px; background: radial-gradient(circle, rgba(31,116,196,0.14), transparent 70%); }
.lg-card { position: relative; z-index: 1; width: min(920px, 100%); display: grid; grid-template-columns: 1fr 1fr; background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(19, 36, 58, 0.10); overflow: hidden; border: 1px solid var(--line); }
.lg-hero { padding: 40px 36px; background: linear-gradient(160deg, #eaf4fd 0%, #d6eafa 100%); display: flex; flex-direction: column; justify-content: space-between; gap: 28px; position: relative; overflow: hidden; }
.lg-hero .mark { display: flex; align-items: center; gap: 10px; color: var(--brand-ink); }
.lg-hero .mark .dotmark { width: 34px; height: 34px; border-radius: 10px; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(31,116,196,0.15); color: var(--brand); }
.lg-hero .mark b { font-size: 16px; display: block; }
.lg-hero .mark span { font-size: 12px; color: var(--ink-3); }
.lg-hero h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); font-weight: 600; }
.lg-hero h1 em { font-style: normal; color: var(--brand); }
.lg-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.lg-pills span { background: rgba(255,255,255,0.8); color: var(--brand-ink); border-radius: 999px; padding: 4px 10px; font-size: 12px; display: inline-flex; gap: 5px; align-items: center; }
.lg-pills svg.i { width: 13px; height: 13px; }
.lg-hero .foot { font-size: 11.5px; color: var(--ink-3); }
.lg-hero .ring { position: absolute; right: -70px; top: -70px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(255,255,255,0.45); }
.lg-form { padding: 40px 36px; display: grid; gap: 16px; align-content: center; }
.lg-form h2 { font-size: 20px; letter-spacing: -0.01em; }
.lg-form form { display: grid; gap: 12px; }
.lg-form input { padding: 9px 11px; font-size: 14px; }
.lg-demo { border-top: 1px solid var(--line-2); padding-top: 14px; display: grid; gap: 8px; }
.lg-demo .upper { font-size: 10.5px; }
.roles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.roles button { font: inherit; display: grid; justify-items: center; gap: 4px; padding: 9px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 11.5px; color: var(--ink-2); transition: border-color .12s, background .12s, transform .12s; }
.roles button:hover { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); transform: translateY(-1px); }
.roles button svg.i { width: 18px; height: 18px; color: var(--brand); }
.lg-credit { font-size: 11px; color: var(--ink-3); text-align: center; }
@media (max-width: 760px) {
  .lg-card { grid-template-columns: 1fr; }
  .lg-hero { padding: 24px 22px; gap: 16px; }
  .lg-hero h1 { font-size: 22px; }
  .lg-hero .ring, .lg-pills { display: none; }
  .lg-form { padding: 24px 22px; }
}

/* Official logo in the app bar; PDF download button */
.appbar .brand { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.appbar .brand .brand-logo { height: 34px; width: auto; display: block; }
.appbar .brand .brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.appbar .brand .brand-txt b { color: #1d3b6a; }
.appbar .pdf-btn { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; margin-right: 6px; }
.appbar .search + .pdf-btn { margin-left: 8px; }
@media (max-width: 760px) { .appbar .brand .brand-txt, .appbar .pdf-btn span { display: none; } }
@media print { .appbar, .demo-bar { display: none; } }
.lg-hero .mark { flex-direction: column; align-items: flex-start; gap: 6px; }
.lg-hero .mark .lg-logo { width: 150px; height: auto; display: block; }
.lg-hero .mark > span { font-size: 12.5px; color: var(--ink-2); }

/* ======================================================================
   Staff Connect: the chat button and popup, on every screen.
   ====================================================================== */
.sc-root { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
.sc-root > * { pointer-events: auto; }
.sc-launch { position: relative; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(31, 116, 196, 0.35); cursor: pointer; transition: transform .15s; }
.sc-launch:hover { transform: translateY(-2px); background: var(--brand-ink); }
.sc-launch svg.i { width: 24px; height: 24px; }
.sc-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d0262c; color: #fff; font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.sc-launch .sc-count { position: absolute; top: -3px; right: -3px; height: 21px; min-width: 21px; border: 2px solid var(--bg); }
.sc-panel { width: 384px; max-width: calc(100vw - 24px); height: min(580px, calc(100vh - 110px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 48px rgba(19, 36, 58, 0.18), 0 2px 6px rgba(19, 36, 58, 0.08); display: flex; flex-direction: column; overflow: hidden; animation: sc-rise .18s ease-out; }
@keyframes sc-rise { from { transform: translateY(8px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sc-panel { animation: none; } .sc-launch { transition: none; } }
.sc-head { display: flex; align-items: center; gap: 10px; padding: 11px 10px 2px 14px; }
.sc-head b { display: block; font-size: 14.5px; }
.sc-head span:not(.avatar) { display: block; font-size: 11.5px; color: var(--ink-3); }
.sc-icon { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--ink-2); cursor: pointer; flex: none; }
.sc-icon:hover { background: var(--brand-tint); color: var(--brand-ink); }
.sc-tabs { display: flex; padding: 6px 10px 0; border-bottom: 1px solid var(--line); }
.sc-tabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px 9px; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; display: inline-flex; gap: 6px; justify-content: center; align-items: center; cursor: pointer; }
.sc-tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.sc-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.sc-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px 6px; }
.sc-sec { padding: 12px 14px 0; }
.sc-empty { padding: 26px 18px; color: var(--ink-3); font-size: 13px; text-align: center; }
.sc-hint { padding: 0 14px; font-size: 12px; color: var(--ink-3); }
.sc-form .sc-hint { padding: 0; }
.sc-err { margin: 10px 12px 0; padding: 7px 10px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 12.5px; }
.sc-row { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; font: inherit; color: inherit; cursor: pointer; }
button.sc-row:hover { background: var(--brand-tint); }
.sc-row.note { cursor: default; }
.sc-row .grow { min-width: 0; display: grid; gap: 1px; }
.sc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sc-top b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.sc-top time { font-size: 11px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-prev { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-row.unread .sc-prev, .sc-row.unread .sc-top b { color: var(--ink); font-weight: 600; }
.sc-row.note.unread { background: var(--brand-tint); }
.sc-body-txt { font-size: 12.5px; color: var(--ink-2); }
.sc-tag { justify-self: start; display: inline-flex; gap: 4px; align-items: center; font-size: 11px; color: var(--brand-ink); background: var(--brand-soft); padding: 1px 7px; border-radius: 6px; margin-top: 3px; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sc-nic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); flex: none; }
.sc-nic.good { background: var(--good-soft); color: var(--good); }
.sc-nic.bad { background: var(--bad-soft); color: var(--bad); }
.sc-nic.approval { background: var(--warn-soft); color: var(--warn); }
.sc-mini { border: 0; background: transparent; color: var(--ink-3); width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; font-size: 18px; flex: none; }
.sc-mini:hover { background: var(--brand-tint); color: var(--brand-ink); text-decoration: none; }
.sc-chip { margin: 8px 12px 0; border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 7px 10px; display: flex; gap: 10px; align-items: center; font-size: 12px; }
.sc-chip .grow { min-width: 0; display: grid; }
.sc-form .sc-chip, .sc-card .sc-chip { margin: 0; }
.sc-thread { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sc-thead { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.sc-thead .grow { min-width: 0; display: grid; }
.sc-thead b { font-size: 13px; }
.sc-thead span:not(.avatar) { font-size: 11.5px; color: var(--ink-3); }
.sc-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.sc-day { text-align: center; font-size: 11px; color: var(--ink-3); margin: 4px 0; }
.sc-msg { max-width: 82%; align-self: flex-start; padding: 7px 10px 5px; border-radius: 12px 12px 12px 4px; background: var(--line-2); font-size: 13px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.sc-msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-radius: 12px 12px 4px 12px; }
.sc-msg .sc-q { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .75; }
.sc-meta { display: block; text-align: right; font-size: 10.5px; opacity: .7; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sc-sys { align-self: center; font-size: 12px; color: var(--ink-2); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; text-align: center; }
.sc-quick { display: flex; gap: 6px; padding: 6px 12px; overflow-x: auto; scrollbar-width: none; }
.sc-quick button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; white-space: nowrap; color: var(--ink-2); cursor: pointer; }
.sc-quick button:hover { border-color: var(--brand); color: var(--brand-ink); }
.sc-compose { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line-2); }
.sc-compose input { flex: 1; min-width: 0; }
.sc-form { display: grid; gap: 10px; padding: 10px 14px 14px; }
.sc-form .field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.sc-back { justify-self: start; border: 0; background: transparent; color: var(--brand-ink); font: inherit; font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; padding: 0; cursor: pointer; }
.sc-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc-seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; color: var(--ink); }
.sc-seg button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.sc-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.sc-card { margin: 8px 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 7px; background: var(--surface); }
.sc-card.attn { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.sc-card.attn-soft { border-color: var(--brand-soft); }
.sc-card .sc-top b { display: inline-flex; gap: 5px; align-items: center; }
.sc-card input { width: 100%; }
.sc-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 12.5px; }
.sc-kv dt { color: var(--ink-3); }
.sc-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.sc-reason { font-size: 12.5px; background: var(--surface-2); border-radius: 7px; padding: 6px 8px; color: var(--ink-2); overflow-wrap: anywhere; }
.sc-refund { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc-refund .btn { grid-column: 1 / -1; justify-self: end; }
.sc-pill { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.sc-pill.good { background: var(--good-soft); color: var(--good); }
.sc-pill.warn { background: var(--warn-soft); color: var(--warn); }
.sc-pill.bad { background: var(--bad-soft); color: var(--bad); }
.sc-toast { max-width: 320px; display: flex; gap: 9px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 12px 32px rgba(19, 36, 58, 0.16); font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; animation: sc-rise .2s ease-out; }
.sc-toast > span:last-child { display: grid; gap: 2px; }
.sc-toast > span:last-child span { color: var(--ink-2); }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 5px; flex: none; }
.sc-toast.ok .sc-dot { background: var(--good); }
@media (max-width: 560px) {
  .sc-root { right: 12px; bottom: 12px; left: 12px; }
  .sc-panel { width: 100%; max-width: none; height: calc(100vh - 96px); }
  .sc-toast { max-width: none; }
}
@media print { .sc-root { display: none !important; } }

/* How it works (owner only) */
.hw-roles { display: grid; gap: 8px; margin-bottom: 26px; }
.hw-role { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hw-role .chip { cursor: default; }
.chip.lane-reception { background: var(--brand-soft); color: var(--brand-ink); }
.chip.lane-doctor { background: #e2f3f1; color: #0b6b63; }
.chip.lane-dept { background: #f0ebf8; color: #5b3f94; }
.chip.lane-owner { background: var(--ink); color: #fff; }
.hw-h { margin-bottom: 12px; }
.hw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 26px; }
.hw-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hw-card .badge { font-size: 12px; padding: 3px 10px; }
.hw-card .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.hw-card p { color: var(--ink-2); line-height: 1.55; }
.hw-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hw-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.hw-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hw-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hw-legend i.lane-reception { background: var(--brand); }
.hw-legend i.lane-doctor { background: #0f8a7e; }
.hw-legend i.lane-dept { background: #6b4fa8; }
.hw-legend i.lane-owner { background: var(--ink); }
.hw-legend i.lane-ex { background: var(--bad); }
.hw-flow { max-width: 960px; margin: 0 auto; }
.hw-row { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: center; }
.hw-side { display: flex; align-items: center; }
.hw-branch { width: 36px; flex: none; border-top: 2px dashed var(--bad); position: relative; }
.hw-branch::after { content: ''; position: absolute; right: -1px; top: -6px; border: 5px solid transparent; border-left-color: var(--bad); }
.hw-side .hw-node { flex: 1; }
.hw-arrow { width: calc(100% - 280px); height: 26px; position: relative; }
.hw-arrow::before { content: ''; position: absolute; left: 50%; top: 2px; bottom: 6px; border-left: 2px solid var(--line); }
.hw-arrow::after { content: ''; position: absolute; left: calc(50% - 4px); bottom: 0; border: 5px solid transparent; border-top-color: var(--ink-3); border-bottom: 0; }
.hw-par { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hw-node { border: 1px solid; border-left-width: 4px; border-radius: var(--radius-sm); padding: 10px 13px; display: flex; flex-direction: column; gap: 2px; }
.hw-node b { font-size: 13.5px; }
.hw-node span { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.hw-node.lane-reception { border-color: var(--brand); background: var(--brand-tint); }
.hw-node.lane-doctor { border-color: #0f8a7e; background: #eef8f6; }
.hw-node.lane-dept { border-color: #6b4fa8; background: #f5f1fb; }
.hw-node.lane-owner { border-color: var(--ink); background: var(--ink); }
.hw-node.lane-owner b, .hw-node.lane-owner span { color: #fff; }
.hw-node.lane-ex { border-color: var(--bad); background: var(--bad-soft); border-style: dashed; border-left-style: solid; }
.hw-node.decision b::before { content: ''; display: inline-block; width: 8px; height: 8px; border: 2px solid currentColor; transform: rotate(45deg); margin: 0 9px 1px 2px; }
@media (max-width: 860px) {
  .hw-row { grid-template-columns: 1fr; }
  .hw-side { padding-left: 18px; margin-top: 8px; }
  .hw-side:empty { display: none; }
  .hw-branch { width: 18px; }
  .hw-arrow { width: 100%; }
  .hw-par { grid-template-columns: 1fr; }
}
.chip.lane-sys { background: var(--line-2); color: var(--ink-2); }
.hw-legend i.lane-sys { background: #8a948f; }
.hw-node.lane-sys { border-color: #8a948f; background: var(--surface-2); }
.hw-jump { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.hw-fns { display: grid; gap: 14px; }
.hw-fn { scroll-margin-top: 70px; }
.hw-fn-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.hw-fn-head h3 { font-size: 15px; }
.hw-steps { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 26px; align-items: start; }
.hw-step { position: relative; display: flex; flex-direction: column; }
.hw-step > .hw-node:first-child { min-height: 74px; }
.hw-step:not(:last-child) > .hw-node:first-child::after { content: ''; position: absolute; right: -22px; top: 30px; width: 16px; border-top: 2px solid var(--ink-3); }
.hw-step:not(:last-child)::after { content: ''; position: absolute; right: -24px; top: 27px; border: 4px solid transparent; border-left: 5px solid var(--ink-3); }
.hw-drop { height: 22px; margin-left: 22px; border-left: 2px dashed var(--bad); position: relative; }
.hw-drop::after { content: ''; position: absolute; left: -6px; bottom: 0; border: 5px solid transparent; border-top-color: var(--bad); border-bottom: 0; }
.hw-rec { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-2); }
@media (max-width: 1000px) {
  .hw-steps { grid-template-columns: 1fr; gap: 22px; }
  .hw-step > .hw-node:first-child { min-height: 0; }
  .hw-step:not(:last-child) > .hw-node:first-child::after { right: auto; left: 22px; top: auto; bottom: -18px; width: 0; height: 14px; border-top: 0; border-left: 2px solid var(--ink-3); }
  .hw-step:not(:last-child)::after { display: none; }
  .hw-step:not(:last-child)::before { content: ''; position: absolute; left: 18px; bottom: -22px; border: 5px solid transparent; border-top-color: var(--ink-3); border-bottom: 0; }
}
/* The top menu keeps its full width; the search box gives way instead of covering it. */
.topnav { flex: 1 0 auto; }
.appbar .search { flex: 0 1 240px; width: auto; min-width: 120px; }
@media (max-width: 1180px) { .appbar .search { flex-basis: 180px; } }
@media (max-width: 860px) { .topnav { flex: none; } .appbar .search { flex: none; width: 100%; } }
@media (max-width: 1320px) {
  .dd.user .nm, .topnav > a svg.i { display: none; }
  .topnav > a, .appbar .dd-btn { padding: 6px 8px; }
}
@media (max-width: 1100px) and (min-width: 861px) {
  .appbar { gap: 10px; }
  .appbar .pdf-btn span { display: none; }
  .appbar .search { min-width: 100px; }
}
@media (max-width: 1000px) { .hw-step > .hw-node.lane-ex { margin-left: 22px; } }

/* Clinical Quality & Intelligence */
.cq-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.cq-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; }
.cq-tile span { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.cq-tile b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cq-tile small { font-size: 12px; color: var(--ink-3); }
.cq-tile small .delta { font-size: 12px; }
.legend i.cq-dash { background: repeating-linear-gradient(90deg, var(--series-2) 0 6px, transparent 6px 10px); }
.chart text.lbl { font-size: 12px; font-weight: 600; }
.cq-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.45; }
.cq-list.good li::marker { color: var(--good); }
.cq-list li::marker { color: var(--warn); }
.cq-quote { margin: 0; padding: 10px 14px; border-left: 3px solid var(--brand); background: var(--brand-tint); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--ink-2); }
.cq-finding.urgent { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad-soft); }
.cq-rule { padding: 8px 0; border-top: 1px solid var(--line-2); }
.cq-rule:first-of-type { border-top: none; }
.cq-review textarea { width: 100%; }
tr.total td { background: var(--surface-2); border-top: 1px solid var(--line); }
.cq-check { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); display: grid; gap: 8px; }
.cq-check h3 { font-size: 13px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.cq-check .grp { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin-top: 4px; }
.cq-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: center; font-size: 13px; }
.cq-item > span:first-child { flex: 1 1 180px; }
.cq-opts { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.cq-opts button { white-space: nowrap; font: inherit; font-size: 12px; border: none; background: none; padding: 3px 9px; cursor: pointer; color: var(--ink-2); }
.cq-opts button + button { border-left: 1px solid var(--line); }
.cq-opts button.on { background: var(--brand); color: #fff; }
.cq-opts button.on.flag { background: var(--bad); }
.cq-opts button:disabled { cursor: default; }
@media (max-width: 860px) { .cq-item { grid-template-columns: 1fr; } }
