/* =========================================================================
   MediFlow HMS — hand-written stylesheet (no build step, no Node.js).
   Colours live in the variables below; change --brand to re-theme.
   ========================================================================= */

:root {
  --brand: #0f766e;
  --brand-600: #0d6560;
  --brand-50: #ecfdf8;
  --brand-100: #d1faf0;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #f6f8fa;
  --card: #ffffff;
  --danger: #b42318;
  --danger-50: #fef3f2;
  --danger-100: #fee4e2;
  --warn: #b54708;
  --warn-50: #fffaeb;
  --ok: #067647;
  --ok-50: #ecfdf3;
  --info: #175cd3;
  --info-50: #eff8ff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .035);
  --shadow-lg: 0 8px 20px rgba(15, 23, 42, .08);
  --sidebar-w: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14.5px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 620; }
h3 { font-size: .98rem; font-weight: 620; }
p { margin: 0; }
small { font-size: .82em; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.icon { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-tight { gap: 6px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.input-narrow { max-width: 12em; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.strong { font-weight: 620; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #0b1f2a; color: #cbd5e1;
  display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark .icon { width: 20px; height: 20px; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #94a3b8; }
.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-heading { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-weight: 500; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--brand); color: #fff; }
.nav-link.disabled { opacity: .45; cursor: default; }
.nav-link.disabled:hover { background: none; color: #cbd5e1; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.role-pill { display: inline-block; font-size: .75rem; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: #e2e8f0; }
.nav-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 10px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.nav-open { display: none; }
.global-search { flex: 1; max-width: 560px; position: relative; display: flex; align-items: center; }
.global-search .icon { position: absolute; left: 12px; color: var(--muted); }
.global-search input { width: 100%; padding: 9px 40px 9px 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); font: inherit; }
.global-search input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-100); }
.global-search kbd { position: absolute; right: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; background: #fff; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { padding: 24px; max-width: 1400px; width: 100%; }

/* User menu (uses <details> — no JS needed) */
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); display: grid; place-items: center; font-weight: 700; }
.user-name { font-weight: 550; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; font: inherit; color: var(--ink); cursor: pointer; text-align: left; text-decoration: none; }
.menu-item:hover { background: var(--bg); text-decoration: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: #fbfcfd; border-radius: 0 0 var(--radius) var(--radius); }
a.card { color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: var(--brand-100); box-shadow: 0 0 0 3px var(--brand-50); text-decoration: none; }

/* ---------- Tiles (Patients OPD/IPD switch) ---------- */
.tiles { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tile { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: inherit; text-decoration: none; font-weight: 600; }
.tile:hover { border-color: var(--brand-100); text-decoration: none; }
.tile-active { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }

/* ---------- Ward board (bed tiles) ---------- */
.ward-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.ward-tabs a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: inherit; text-decoration: none; font-weight: 600; white-space: nowrap; }
.ward-tabs a.active { background: var(--ink); color: var(--card); border-color: var(--ink); }
.bed-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.bed-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); text-decoration: none; color: inherit; }
.bed-tile:hover { border-color: var(--brand-100); text-decoration: none; }
.bed-tile.bed-free { border-style: dashed; color: var(--muted); }
.bed-tile.bed-cleaning { border-style: dashed; border-color: var(--warn); }
.bed-tile.bed-occupied { border-color: var(--line); }
.bed-tile .bed-label { font-family: monospace; font-size: .8rem; color: var(--muted); }
.bed-tile .bed-name { font-weight: 700; font-size: 1.05rem; }
.bed-tile .bed-meta { font-size: .85rem; color: var(--muted); }

/* ---------- Entity tiles: an overview grid of named things (wards, stores, roles, …),
   each a clickable card with a quick-glance stat row. Reused across the app — don't rename
   per page; add a page-specific modifier instead if one page ever needs its own tweak. ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.entity-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; text-decoration: none; color: inherit; }
.entity-card:hover { border-color: var(--brand-100); box-shadow: 0 0 0 3px var(--brand-50); text-decoration: none; }
.entity-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.entity-card-head h3 { font-size: 1.05rem; font-weight: 700; }
/* A native <progress> (value/max attributes, not inline style) so the CSP's style-src 'self'
   never has to allow it — its fill width is drawn by the browser, not a width style. */
.entity-card-meter { appearance: none; -webkit-appearance: none; -moz-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); }
.entity-card-meter::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.entity-card-meter::-webkit-progress-value { border-radius: 999px; background: var(--ok); }
.entity-card-meter::-moz-progress-bar { border-radius: 999px; background: var(--ok); }
.entity-card-meter.meter-high::-webkit-progress-value { background: var(--warn); }
.entity-card-meter.meter-high::-moz-progress-bar { background: var(--warn); }
.entity-card-meter.meter-full::-webkit-progress-value { background: var(--danger); }
.entity-card-meter.meter-full::-moz-progress-bar { background: var(--danger); }
.entity-card-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.entity-card-foot { font-size: .85rem; color: var(--muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 580; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand); }

.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: inherit; font-weight: 560; cursor: pointer;
  text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--bg); border-color: var(--line-2); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { background: #fff; border-color: var(--line-2); color: var(--danger); }
.btn-danger:hover { background: var(--danger-50); border-color: #fda29b; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 11px; font-size: .88rem; }
.btn-lg { padding: 12px 20px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn .icon { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-9 { grid-column: span 9; } .col-7 { grid-column: span 7; } .col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.row > .select, .row > .input:not(.grow) { width: auto; }
.field label, .field-label { display: block; font-weight: 560; font-size: .88rem; margin-bottom: 5px; color: var(--ink-2); }
.req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff;
  font: inherit; color: var(--ink);
}
.textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.is-invalid { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: 4px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 8px 16px; margin: 0; cursor: pointer; font-weight: 560; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.segmented label:last-of-type { border-right: 0; }
.segmented input:checked + label { background: var(--brand); color: #fff; }
.segmented input:focus-visible + label { box-shadow: inset 0 0 0 2px var(--brand-100); }
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group .input { flex: 1; }
.disclosure { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 0; }
.disclosure > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 8px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--bg); color: var(--brand); font-weight: 700; }
.disclosure[open] > summary::before { content: "−"; }
.disclosure-body { padding: 4px 16px 16px; }

/* ---------- Alerts & badges ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 0; border-left: 3px solid; font-weight: 500; }
.alert-success { background: var(--ok-50); border-color: var(--ok); color: var(--ok); }
.alert-error { background: var(--danger-50); border-color: var(--danger); color: var(--danger); }
.alert-info { background: var(--info-50); border-color: var(--info); color: var(--info); }
.alert-warning { background: var(--warn-50); border-color: var(--warn); color: var(--warn); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--bg); color: var(--ink-2); border: 0; white-space: nowrap; }
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-brand { background: var(--brand-50); color: var(--brand-600); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fbfcfd; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--brand-50); }
.table .row-link { color: var(--ink); font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: .82rem; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; color: var(--line-2); margin-bottom: 8px; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }

/* ---------- Patient banner ---------- */
.patient-banner { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; padding: 18px 20px; }
.patient-avatar { width: 56px; height: 56px; border-radius: 14px; background: var(--brand-100); color: var(--brand-600); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; flex: none; }
.patient-main { flex: 1; min-width: 220px; }
.patient-main h1 { font-size: 1.3rem; }
.patient-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--ink-2); margin-top: 6px; font-size: .92rem; }
.patient-meta span { display: inline-flex; align-items: center; gap: 5px; }
.patient-meta .icon { width: 15px; height: 15px; color: var(--muted); }
.allergy-box { border-radius: var(--radius-sm); padding: 10px 14px; min-width: 220px; max-width: 360px; }
.allergy-box.has { background: var(--danger-50); border: 1px solid #fecdca; color: var(--danger); }
.allergy-box.none { background: var(--ok-50); border: 1px solid #abefc6; color: var(--ok); }
.allergy-box.unknown { background: var(--warn-50); border: 1px solid #fedf89; color: var(--warn); }
.allergy-box strong { display: flex; align-items: center; gap: 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.allergy-box .icon { width: 15px; height: 15px; }

.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 520; }

/* ---------- Search results (check-in picker) ---------- */
.picker { position: relative; }
.picker-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 20; max-height: 320px; overflow-y: auto; }
.picker-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover, .picker-item.focused { background: var(--brand-50); }
.picker-empty { padding: 12px 14px; color: var(--muted); }
.selected-patient { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: var(--radius); }

/* ---------- Queue board ---------- */
.board { display: grid; grid-template-columns: repeat(7, minmax(158px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: #eef2f5; border-radius: var(--radius); padding: 8px; min-height: 240px; display: flex; flex-direction: column; gap: 10px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 4px; font-weight: 650; font-size: .88rem; color: var(--ink-2); }
.lane-count { background: #fff; border-radius: 999px; padding: 0 9px; font-size: .78rem; border: 1px solid var(--line); }
.ticket { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; box-shadow: var(--shadow); }
.ticket.urgent { border-left: 4px solid var(--danger); }
.ticket-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ticket-top { flex-wrap: wrap; }
.ticket-top .row { gap: 4px; }
.ticket-top .badge { padding: 1px 6px; }
.ticket-top .badge .icon { width: 13px; height: 13px; }
.qno { font-weight: 800; font-size: 1.05rem; color: var(--brand-600); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ticket-name { font-weight: 620; margin-top: 4px; color: var(--ink); display: block; }
.ticket-meta { color: var(--muted); font-size: .82rem; }
.ticket-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.ticket-actions form { margin: 0; }
.wait-long { color: var(--danger); font-weight: 600; }
.lane-empty { color: #94a3b8; font-size: .85rem; text-align: center; padding: 18px 0; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 3px #d1fadf; }
.live-dot.offline::before { background: #f79009; box-shadow: 0 0 0 3px #fef0c7; }

/* ---------- Permission matrix ---------- */
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.perm-group h3 { margin-bottom: 10px; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }

/* ---------- Guest (login) ---------- */
.guest-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 480px) 1fr; }
.guest-panel { padding: 48px 44px; background: #fff; display: flex; flex-direction: column; justify-content: center; }
.guest-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.guest-brand div { display: flex; flex-direction: column; }
.guest-brand small { color: var(--muted); }
.guest-art { background: linear-gradient(135deg, #0b1f2a 0%, #0f766e 100%); color: #fff; display: flex; align-items: center; padding: 56px; }
.guest-art h2 { font-size: 2rem; letter-spacing: -.02em; }
.guest-art p { color: #cdeee8; margin-top: 10px; max-width: 460px; font-size: 1.05rem; }

/* ---------- Environment banner ---------- */
.env-banner { background: #fef0c7; color: #93370d; border-bottom: 1px solid #fedf89; text-align: center; font-size: .82rem; font-weight: 600; padding: 5px 12px; }
.guest .env-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; }

/* ---------- Error page ---------- */
.error-detail { margin: 0; padding: 16px 20px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-size: .8rem; line-height: 1.45; color: var(--ink-2); background: #fbfcfd; border-radius: 0 0 var(--radius) var(--radius); }
.error-page { text-align: center; padding: 56px 20px; }
.error-code { font-size: 3.2rem; font-weight: 800; color: var(--line-2); }

/* ---------- Printables (card, ticket) ---------- */
.print-sheet { display: flex; justify-content: center; margin: 0 auto; }
.id-card { width: 85.6mm; height: 54mm; border: 1px solid var(--line-2); border-radius: 3mm; padding: 4mm; display: flex; flex-direction: column; justify-content: space-between; background: #fff; overflow: hidden; }
.id-card-head { display: flex; align-items: center; gap: 2.5mm; border-bottom: 1px solid var(--line); padding-bottom: 2mm; }
.id-card-head .brand-mark, .id-card-head .brand-logo { width: 8mm; height: 8mm; border-radius: 2mm; }
.id-card-head .brand-mark .icon { width: 5mm; height: 5mm; }
.id-card-head strong { font-size: 9pt; display: block; line-height: 1.1; }
.id-card-head small { font-size: 6.5pt; color: var(--muted); }
.id-card-name { font-size: 11pt; font-weight: 700; line-height: 1.2; }
.id-card-meta { font-size: 7.5pt; color: var(--ink-2); }
.id-card .barcode { width: 100%; height: 11mm; }
.id-card-no { font-family: ui-monospace, Consolas, monospace; font-size: 8pt; text-align: center; letter-spacing: .1em; }
.queue-slip { width: 72mm; border: 1px dashed var(--line-2); padding: 5mm; text-align: center; background: #fff; }
.queue-slip .big { font-size: 34pt; font-weight: 800; line-height: 1.1; margin: 2mm 0; }
.queue-slip .barcode { width: 100%; height: 12mm; }
.print-actions { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }

@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  .sidebar, .topbar, .nav-backdrop, .print-actions, .alert, .page-head, .no-print { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 35; }
  .main { margin-left: 0; }
  .nav-open { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .col-9, .col-8, .col-7, .col-6, .col-5, .col-4, .col-3, .col-2 { grid-column: span 12; }
  .guest-wrap { grid-template-columns: 1fr; }
  .guest-art { display: none; }
  .guest-panel { padding: 32px 20px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .global-search kbd { display: none; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .stats, .grid-4 { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.4rem; }
  .table th, .table td { padding: 10px 12px; }
  .hide-mobile-col { display: none; }
}

.prefix-input { width: 5.5em; text-transform: uppercase; }

/* ---------- Patient flow / timelines ---------- */
.flex-end { display: flex; flex-direction: column; justify-content: flex-end; }
.stat-text { font-size: 1.15rem; }
.flow-row { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: 12px; }
.flow-label { font-weight: 600; color: var(--ink-2); }
.flow-value { text-align: right; font-variant-numeric: tabular-nums; }
.flow-bar { width: 100%; height: 14px; border-radius: 7px; overflow: hidden; display: block; }
.flow-track { fill: #eef2f5; }
.flow-fill, .seg { fill: var(--brand); }
.st-waiting { fill: #f79009; } .st-triage { fill: #2e90fa; } .st-with_doctor { fill: #6172f3; }
.st-pharmacy { fill: #0f766e; } .st-billing { fill: #9e77ed; }
.timeline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-step { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: .82rem; white-space: nowrap; }
.tl-step.ongoing { border-color: var(--brand); background: var(--brand-50); }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.tl-dot.waiting { background: #f79009; } .tl-dot.triage { background: #2e90fa; } .tl-dot.with_doctor { background: #6172f3; }
.tl-dot.pharmacy { background: #0f766e; } .tl-dot.billing { background: #9e77ed; }
.tl-arrow { color: var(--line-2); }
.tl-total { font-weight: 650; margin-left: 4px; }
.timeline-bar { width: 100%; height: 12px; display: block; border-radius: 6px; overflow: hidden; margin-top: 10px; }
@media (max-width: 600px) { .flow-row { grid-template-columns: 90px 1fr 70px; } }

/* ---------- Visit file ---------- */
.queue-badge { min-width: 64px; height: 56px; padding: 0 12px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; flex: none; }
.plain-link { color: inherit; }
.card-foot form { margin: 0; }
.unit { color: var(--muted); font-weight: 500; font-size: .78rem; }
.mt-sm { margin-top: 6px; }
.computed { padding: 9px 11px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--bg); font-weight: 650; font-variant-numeric: tabular-nums; }
.bp-group .input { min-width: 0; }
.note-area { min-height: 110px; }
.triage-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.priority { display: inline-flex; align-items: center; padding: 3px 12px; border-radius: 999px; font-weight: 700; font-size: .82rem; border: 1px solid transparent; }
.priority-emergency { background: #fee4e2; color: #912018; border-color: #fda29b; }
.priority-very_urgent { background: #ffead5; color: #9c2a10; border-color: #fdb022; }
.priority-urgent { background: #fef7c3; color: #854a0e; border-color: #fde272; }
.priority-routine { background: #dcfae6; color: #085d3a; border-color: #75e0a7; }
.pri-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.pri-dot.emergency { background: #d92d20; } .pri-dot.very_urgent { background: #f79009; }
.pri-dot.urgent { background: #eaaa08; } .pri-dot.routine { background: #17b26a; }
.flag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.flag-list .icon { width: 13px; height: 13px; }
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vitals-compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.vital { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; background: #fff; display: flex; flex-direction: column; }
.vital span { color: var(--muted); font-size: .78rem; font-weight: 600; }
.vital strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.vital small { color: var(--muted); }
.vital-warn { border-color: #fedf89; background: var(--warn-50); }
.vital-warn strong { color: var(--warn); }
.vital-danger { border-color: #fda29b; background: var(--danger-50); }
.vital-danger strong { color: var(--danger); }
.dx-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dx-row { display: grid; grid-template-columns: auto 90px 1fr 140px auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfcfd; }
.dx-code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: var(--brand-600); font-size: .85rem; }
.dx-list { list-style: none; margin: 6px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dx-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-section { margin-top: 14px; }
.note-section .section-title { margin-bottom: 4px; display: block; }
details.triage-summary > summary { list-style: none; cursor: pointer; }
details.triage-summary > summary::-webkit-details-marker { display: none; }
.ticket-name-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ticket-name-row .ticket-name { margin-top: 0; }
a.qno { text-decoration: none; }
a.qno:hover { text-decoration: underline; }
/* Orders: prescriptions, lab requests, lab work list */
.row.end { justify-content: flex-end; }
.subhead { font-size: .95rem; margin: 18px 0 8px; color: var(--ink-2); }
.orders-table td { vertical-align: top; }
.is-stopped td { color: var(--muted); }
.is-stopped strong { text-decoration: line-through; font-weight: 600; }
.result-text { margin-top: 6px; white-space: normal; font-size: .9rem; }
.order-form { border-top: 1px solid var(--line); background: #fbfcfd; }
.drug-chosen { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border: 1px solid var(--brand); border-radius: var(--radius-sm); background: var(--brand-50); }
.allergy-confirm { border: 1px solid #fda29b; background: var(--danger-50); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; }
.allergy-confirm p { margin: 0 0 8px; font-weight: 600; }
.test-filter { max-width: 260px; }
.test-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.test-section { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0; background: #fff; }
.test-section legend { font-weight: 650; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 0 4px; }
.test-item { display: flex; padding: 4px 0; align-items: flex-start; }
.test-item input { margin-top: 3px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0; }
.dl-grid dt { color: var(--muted); font-size: .8rem; font-weight: 600; }
.dl-grid dd { margin: 2px 0 0; font-weight: 520; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 6px; }
.qno-inline { font-weight: 800; margin-right: 6px; text-decoration: none; }
.ticket-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.ticket-flags .badge { font-size: .72rem; }
/* Pharmacy & stock */
.store-picker label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.qty-input { width: 110px; }
.give-cell { min-width: 220px; }
.give-cell .input + .input { margin-top: 6px; }
.line-table td { vertical-align: top; }
.line-table .select { min-width: 260px; }
.adjust-form { flex-wrap: nowrap; }
.adjust-form .input:not(.qty-input) { min-width: 120px; }
/* Patient photos & files */
img.patient-avatar { object-fit: cover; background: var(--line); padding: 0; }
.patient-avatar.avatar-sm { width: 34px; height: 34px; border-radius: 9px; font-size: .8rem; }
.patient-avatar.avatar-lg { width: 84px; height: 84px; border-radius: 16px; font-size: 1.5rem; }
.patient-avatar.avatar-xl { width: 160px; height: 160px; border-radius: 20px; font-size: 2.6rem; }
.avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.avatar-edit { font-size: .78rem; font-weight: 600; }
.name-cell { display: flex; align-items: center; gap: 10px; }
.photo-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.photo-current { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.photo-current img { max-width: 100%; max-height: 420px; border-radius: var(--radius); }
.camera video, .camera img { width: 100%; max-height: 420px; object-fit: contain; background: #0b1220; border-radius: var(--radius); display: block; }
.camera .row { margin-top: 10px; }
.file-input { padding: 8px; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-item { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.file-item:first-child { border-top: 0; }
.file-thumb { width: 64px; height: 64px; flex: none; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; background: #f8fafc; text-decoration: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-type { font-size: .72rem; font-weight: 800; color: var(--brand-600); letter-spacing: .04em; }
.file-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.id-card-body { display: flex; gap: 12px; align-items: center; }
.id-card-photo { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
@media (max-width: 760px) { .photo-layout { grid-template-columns: 1fr; } .file-item { flex-wrap: wrap; } .file-actions { width: 100%; justify-content: flex-end; } }
/* Billing */
.bill-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.bill-layout > .stack > * + * { margin-top: 16px; }
.patient-banner.compact { padding: 14px 18px; align-items: center; }
.payer-box { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: .9rem; }
.bill-table tfoot th, .bill-table tfoot td { border-top: 2px solid var(--line); }
.totals { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.totals .grand dt { color: var(--ink); font-weight: 700; }
.totals .grand dd { font-size: 1.5rem; font-weight: 800; }
.settled-note { color: var(--ok); font-weight: 650; margin: 12px 0 0; display: flex; align-items: center; gap: 6px; }
.method-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.method-option { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; cursor: pointer; font-weight: 550; font-size: .9rem; }
.method-option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.input-lg { font-size: 1.25rem; font-weight: 650; padding: 10px 12px; }
.foot-forms { flex-direction: column; align-items: stretch; }
.inline-form > summary { list-style: none; display: inline-flex; }
.inline-form > summary::-webkit-details-marker { display: none; }
.inline-form[open] { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; background: #fff; }
.claim-form { flex-wrap: nowrap; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: center; padding: 5px 0; }
.bar { width: 100%; height: 10px; }
.bar-bg { fill: #eef2f5; }
.bar-fg { fill: var(--brand); }
/* 80 mm till-slip receipt */
.receipt-80 { width: 72mm; background: #fff; border: 1px dashed var(--line-2); padding: 4mm; font-size: 9pt; line-height: 1.35; font-variant-numeric: tabular-nums; color: #000; }
.r-center { text-align: center; }
.r-logo { max-width: 30mm; max-height: 14mm; display: block; margin: 0 auto 2mm; }
.r-name { font-size: 11pt; display: block; }
.r-title { text-align: center; font-weight: 800; letter-spacing: .12em; margin: 3mm 0 2mm; font-size: 11pt; }
.r-row, .r-item { display: flex; justify-content: space-between; gap: 3mm; }
.r-row span:last-child, .r-item span:last-child { text-align: right; }
.r-item span:first-child { overflow-wrap: anywhere; }
.r-big { font-size: 12pt; font-weight: 800; margin: 1.5mm 0; }
.r-line { border-top: 1px dashed #000; margin: 2mm 0; }
.r-foot { margin-top: 3mm; }
@page receipt { size: 80mm auto; margin: 3mm; }
@media print { .receipt-80 { page: receipt; border: 0; padding: 0; width: auto; } }
@media (max-width: 900px) { .bill-layout { grid-template-columns: minmax(0, 1fr); } .patient-banner.compact { flex-wrap: wrap; gap: 10px; } .payer-box { align-items: flex-start; text-align: left; } .claim-form { flex-wrap: wrap; } }
/* Printable visit summary */
.doc { padding: 28px 32px; max-width: 900px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.doc-id { text-align: right; }
.doc-label { font-size: 1.6rem; font-weight: 800; }
.doc-section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.doc-section h2 { font-size: 1rem; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.doc-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; font-size: .9rem; }
.dl-compact { grid-template-columns: 110px 1fr; gap: 4px 12px; }
@media (max-width: 900px) { .dx-row { grid-template-columns: auto 1fr; } .dx-row .dx-desc, .dx-row .dx-cert { grid-column: 1 / -1; } }
@media print { .doc { padding: 0; border: 0; box-shadow: none; max-width: none; } .vital { break-inside: avoid; } }

/* ---------- Data import ---------- */
.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.import-card { display: flex; flex-direction: column; }
.import-card .card-body { flex: 1; }
.import-card .card-head h2 { display: flex; align-items: center; gap: 8px; }
.import-card.is-focus, .stat.is-focus { outline: 2px solid var(--brand-600); outline-offset: 2px; }
.import-cols { font-size: .85rem; line-height: 1.9; }
.import-cols code, code.col-req, code.col-new { font-size: .8rem; background: var(--bg, #f4f6f8); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
code.col-req { font-weight: 700; }
code.col-new { text-decoration: underline; }
.import-form { flex-wrap: wrap; gap: 8px; }
.import-form .file-input { flex: 1; min-width: 0; }
.import-stats a.stat { color: inherit; text-decoration: none; }
.import-table ul.plain { margin: 0; padding: 0; list-style: none; }
.row-error td { background: var(--danger-50); }
.row.wrap { flex-wrap: wrap; }
@media (max-width: 800px) { .import-grid { grid-template-columns: 1fr; } }

/* ---------- Visit cost so far (rolling bill) ---------- */
.cost-lines { margin: 0; display: grid; gap: 6px; }
.cost-lines > div { display: flex; justify-content: space-between; gap: 12px; }
.cost-lines dt { color: var(--muted); }
.cost-lines dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cost-lines .cost-total { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; font-weight: 700; font-size: 1.1rem; }
.cost-lines .cost-total dt { color: inherit; }
.cost-lines .cost-adding { color: var(--brand-600); font-weight: 600; }
.cost-lines .cost-adding dt { color: var(--brand-600); }
.cost-lines .cost-split { font-size: .9rem; }
.cost-say { background: var(--brand-50); color: var(--brand-600); border-radius: 6px; padding: 8px 10px; font-weight: 550; }
.orders-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.orders-layout > aside { position: sticky; top: 16px; }
.order-cost { font-weight: 600; color: var(--brand-600); }
@media (max-width: 980px) { .orders-layout { grid-template-columns: minmax(0, 1fr); } .orders-layout > aside { position: static; order: -1; } }

/* ---------- Menu button on wide screens: hide/show the side menu ---------- */
.topbar .nav-open { display: none; }
@media (min-width: 901px) {
  .topbar .nav-open { display: inline-grid; }
  body.nav-collapsed .sidebar { transform: translateX(-100%); }
  body.nav-collapsed .main { margin-left: 0; }
  .main { transition: margin-left .2s ease; }
}
@media (max-width: 900px) { .topbar .nav-open { display: inline-grid; } }

/* ---------- Top search bar suggestions ---------- */
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); max-height: min(70vh, 520px); overflow-y: auto; padding: 4px;
}
.suggest-item { display: flex; flex-direction: column; border-radius: 8px; cursor: pointer; }
.suggest-item.is-active, .suggest-item:hover { background: var(--brand-50); }
.suggest-main { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: inherit; text-decoration: none; }
.suggest-main:hover { text-decoration: none; }
.suggest-text { display: flex; flex-direction: column; min-width: 0; }
.suggest-name { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.suggest-sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-sub:first-letter { font-variant-numeric: tabular-nums; }
.suggest-visit { margin: -4px 10px 8px 54px; font-size: .85rem; color: var(--brand-600); align-self: flex-start; }
.suggest-empty { padding: 12px; color: var(--muted); }
.suggest-all { display: block; padding: 10px 12px; border-top: 1px solid var(--line); margin-top: 4px; font-weight: 600; }
@media (max-width: 600px) {
  .suggest { position: fixed; left: 8px; right: 8px; max-height: 70vh; }
}

/* ---------- Doctor's notes: signed entries + Plan panels ---------- */
.note-lock-hint { display: flex; align-items: center; gap: 6px; margin: 0; }
.note-entries { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.note-entry { background: var(--bg, #f4f6f8); border: 1px solid var(--line); border-left: 3px solid var(--brand-600); border-radius: 8px; padding: 10px 12px; }
.note-entry-body { white-space: normal; word-wrap: break-word; }
.note-entry-meta, .note-entry-view .note-entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.note-entry-meta .icon { width: 14px; height: 14px; color: var(--ok, #16a34a); }
.note-entry-view + .note-entry-view { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.plan-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 6px 0 12px; }
.plan-panel { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.plan-panel h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.plan-panel h3 .muted { font-weight: 500; font-size: .85rem; }
label.mini { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--ink-2, #334155); min-width: 0; }
label.mini .select, label.mini .input { font-weight: 400; }
.plan-existing { margin: 0; padding-left: 18px; font-size: .88rem; }
.plan-rows { display: grid; gap: 8px; }
.plan-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; background: var(--bg, #f8fafc); min-width: 0; }
.plan-row.has-error { border-color: var(--danger); background: var(--danger-50); }
.plan-row.flash { outline: 2px solid var(--brand-600); }
.plan-row-head { display: flex; align-items: flex-start; gap: 8px; }
.plan-row-name { flex: 1; min-width: 0; }
.plan-row-price { font-weight: 600; white-space: nowrap; font-size: .9rem; }
.plan-row-fields { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; align-items: end; }
.plan-row-fields > .input, .plan-row-fields > .select, .plan-row > .input { width: 100%; min-width: 0; }
.plan-row-fields.rx-fields { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }
.rx-fields label.mini .input, .rx-fields label.mini .select { width: 100%; min-width: 0; }
.plan-total { font-weight: 700; color: var(--brand-600); border-top: 1px solid var(--line); padding-top: 8px; }
@media (max-width: 1100px) { .plan-panels { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .plan-row-fields.rx-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
label.mini span[data-f="unit"] { font-weight: 400; color: var(--muted); }

/* ---------- Queue cards: "More" options open inside the card ----------
   The board scrolls sideways, so a floating menu would be cut off (the Waiting column is at the edge). */
.ticket-actions details.menu[open] { flex-basis: 100%; }
.ticket .menu-panel { position: static; min-width: 0; margin-top: 6px; box-shadow: none; background: var(--bg, #f8fafc); }
.ticket .menu-panel .menu-item { white-space: normal; }
.ticket details.menu[open] > summary { background: var(--bg, #f1f5f9); }

/* ---------- Queue cards: triage priority colours the whole card header ---------- */
.ticket.has-pri { padding-top: 0; overflow: hidden; }
.ticket.has-pri .ticket-top { margin: 0 -12px 8px; padding: 9px 12px; }
.ticket.has-pri.urgent { border-left-width: 1px; }
.pri-emergency .ticket-top   { background: #d92d20; }
.pri-very_urgent .ticket-top { background: #f79009; }
.pri-urgent .ticket-top      { background: #fac515; }
.pri-routine .ticket-top     { background: #17b26a; }
.pri-emergency .ticket-top .qno, .pri-very_urgent .ticket-top .qno, .pri-routine .ticket-top .qno,
.pri-emergency .pri-label, .pri-very_urgent .pri-label, .pri-routine .pri-label { color: #fff; }
.pri-urgent .ticket-top .qno, .pri-urgent .pri-label { color: #422006; }
.pri-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ticket.has-pri .ticket-top .badge { background: #fff; }

/* ---------- DICOM scan viewer (assets/dicom.js) ---------- */
.dv { display: flex; flex-direction: column; gap: 10px; }
.dv-toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.dv-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dv-group-end { margin-left: auto; }
.dv-toolbar [aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.dv-zoom { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .88rem; }
.select-sm { padding: 5px 30px 5px 9px; font-size: .88rem; width: auto; }
.dv-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.dv-show-details .dv-body { grid-template-columns: minmax(0, 1fr) 300px; }
.dv-stage { position: relative; height: calc(100vh - 290px); min-height: 360px; background: #000; border-radius: var(--radius); overflow: hidden; touch-action: none; user-select: none; cursor: crosshair; }
.dv-stage[data-mode="move"] { cursor: grab; }
.dv-stage[data-mode="zoom"] { cursor: zoom-in; }
.dv-stage canvas { display: block; }
.dv-corner { position: absolute; color: #e2e8f0; font-size: .8rem; text-shadow: 0 1px 2px #000; pointer-events: none; max-width: 48%; }
.dv-tl { top: 8px; left: 10px; } .dv-tr { top: 8px; right: 10px; text-align: right; }
.dv-bl { bottom: 8px; left: 10px; } .dv-br { bottom: 8px; right: 10px; text-align: right; }
.dv-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: #e2e8f0; background: #0b1220; font-weight: 500; }
.dv-failed .dv-corner { display: none; }
.dv-details { display: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; max-height: calc(100vh - 290px); overflow: auto; }
.dv-show-details .dv-details { display: block; }
.dv-details h2 { font-size: 1rem; margin: 0 0 10px; }
.dv-dl { margin: 0; display: grid; gap: 8px; }
.dv-dl dt { font-size: .76rem; color: var(--muted); }
.dv-dl dd { margin: 0; word-break: break-word; }
.dv-frames { display: flex; gap: 10px; align-items: center; }
.dv-slider { flex: 1; min-width: 0; accent-color: var(--brand); }
.dv-help { margin: 0; }
.dv:not(:has(.dv-frames:not(.hidden))) .dv-help-frames { display: none; }
@media (max-width: 900px) {
  .dv-show-details .dv-body { grid-template-columns: minmax(0, 1fr); }
  .dv-stage { height: 62vh; min-height: 300px; }
  .dv-details { max-height: none; }
  .dv-group-end { margin-left: 0; }
}

/* ---------- Result attachments ---------- */
.result-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.result-file { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink-2); font-size: .85rem; max-width: 100%; }
.result-file:hover { border-color: var(--brand); }
.result-file img, .result-file .file-type { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; }
.result-file .file-type { display: grid; place-items: center; background: var(--bg); font-size: .68rem; font-weight: 700; color: var(--muted); }
.result-file span.rf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-list { display: grid; gap: 8px; margin-top: 8px; }
.attach-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; align-items: center; }
.attach-row .attach-name { font-size: .88rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .attach-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Medical history ---------- */
.hist-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); background: var(--card); font-size: .88rem; font-weight: 560; text-decoration: none; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.hist-hint { margin: 0 0 12px; display: flex; gap: 6px; align-items: center; }
.hist-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 8px; align-items: start; }
.hist-summary .card-head h2 { display: flex; gap: 8px; align-items: center; }
.hist-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow: auto; }
.hist-list li { padding: 10px 16px; border-top: 1px solid var(--line); }
.hist-list li:first-child { border-top: 0; }
.hist-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hist-repeat { margin-left: auto; }
.hist-title { margin-top: 22px; }
.hist-visit { margin-bottom: 10px; }
.hist-sum { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; padding: 12px 16px; cursor: pointer; list-style: none; }
.hist-sum::-webkit-details-marker { display: none; }
.hist-sum::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--bg); color: var(--brand); font-weight: 700; flex: none; }
.hist-visit[open] > .hist-sum::before { content: "−"; }
.hist-visit[open] > .hist-sum { border-bottom: 1px solid var(--line); }
.hist-date { font-weight: 700; }
.hist-meta { color: var(--muted); }
.hist-dx { color: var(--ink-2); }
.hist-body { padding: 12px 16px 14px; }
.hist-triage { margin: 0 0 10px; color: var(--ink-2); }
.hist-section + .hist-section { margin-top: 14px; }
.hist-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 6px; }
.hist-h-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.hist-open { margin: 12px 0 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }
@media (max-width: 1100px) { .hist-summary { grid-template-columns: minmax(0, 1fr); } .hist-list { max-height: none; } }
@media print {
  .hist-bar, .hist-hint, .hist-repeat, .hist-open, .pager, .tabs { display: none !important; }
  .hist-visit { break-inside: avoid-page; }
  .hist-sum::before { display: none; }
  .hist-list { max-height: none; overflow: visible; }
  .result-file img { display: none; }
}

/* ---------- Previous visits (doctor's notes / visit file) ---------- */
.prev-visits .card-head h2 { display: flex; gap: 8px; align-items: center; }
.prev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; padding: 12px 16px 16px; }
.prev-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg); min-width: 0; }
.prev-card h3 { font-size: .92rem; margin: 0 0 4px; }
.prev-card ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.prev-card li { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: .88rem; }
.prev-card .btn { margin-left: auto; }
.prev-note { font-size: .86rem; color: var(--ink-2); margin: 4px 0 0; overflow-wrap: anywhere; }

.priority-sm { padding: 1px 8px; font-size: .72rem; vertical-align: middle; }

/* ---------- Triage: child ranges ---------- */
.age-ranges-note { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--info-50); color: var(--info); display: flex; gap: 8px; align-items: flex-start; }
.age-ranges-note.muted { background: var(--bg); color: var(--muted); }
.range-hint.range-warn { color: var(--warn); font-weight: 600; }
.range-hint.range-danger { color: var(--danger); font-weight: 700; }
.vr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.vr-input { max-width: 90px; }
.vr-table th { white-space: normal; }
.vr-table tr.has-error td { background: var(--danger-50); }
.plain-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
@media (max-width: 480px) { .vr-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Plan panels: one searchable list ---------- */
.plan-search { position: relative; margin-bottom: 10px; }
.plan-search .mini { display: block; margin-bottom: 4px; }
.plan-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px; max-height: 320px; overflow-y: auto; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.plan-opt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 9px 12px; cursor: pointer; border-top: 1px solid var(--line); }
.plan-opt:first-child { border-top: 0; }
.plan-opt.active, .plan-opt:hover { background: var(--brand-50); }
.plan-opt.is-added { color: var(--muted); }
.plan-opt-name { flex: 1 1 11rem; min-width: 0; overflow-wrap: break-word; }
.plan-opt-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.plan-opt-price { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .9rem; }
.plan-opt-empty { padding: 12px; color: var(--muted); }

/* ---------- Queue: choose a day ---------- */
.queue-day { gap: 6px; }
.input-date { width: auto; }

/* ---------- Allergy status banner (same wording everywhere) ---------- */
.allergy-status { margin-bottom: 12px; }
.allergy-status-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.allergy-status-main .icon { width: 16px; height: 16px; flex: none; }
.allergy-status .allergen.severe { font-weight: 700; text-decoration: underline; }
.allergy-status-sub { font-size: .8rem; font-weight: 450; opacity: .85; margin-top: 3px; }
.allergy-status-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.allergy-side { min-width: 0; max-width: 420px; flex: 1 1 260px; }
.allergy-side .allergy-status { margin-bottom: 0; }
.card-body-tight { padding-top: 10px; padding-bottom: 0; }

/* ---------- Critical-result alerts ---------- */
.crit-alert { border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; }
.crit-alert + .crit-alert { margin-top: 10px; }
.crit-open { border-left-color: var(--danger); background: var(--danger-50); }
.crit-overdue { border-left-color: #7a0b0b; background: var(--danger-50); box-shadow: 0 0 0 2px #fda29b inset; }
.crit-ack { border-left-color: var(--ok); }
.crit-withdrawn { border-left-color: var(--line); opacity: .85; }
.crit-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 4px; }
.crit-badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--danger); }
.crit-ack .crit-badge { color: var(--ok); }
.crit-withdrawn .crit-badge { color: var(--muted); }
.crit-badge .icon { width: 14px; height: 14px; }
.crit-body { margin: 2px 0 6px; }
.crit-trail { margin: 0; padding-left: 18px; font-size: .86rem; color: var(--ink-2, inherit); }
.crit-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.crit-form .input { flex: 1 1 260px; min-width: 0; }
.crit-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.nav-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 1px 7px; }

/* ---------- Grouped sidebar ---------- */
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; border-radius: 6px; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "▾"; font-size: .8rem; transition: transform .15s; }
.nav-group:not([open]) > summary::after { transform: rotate(-90deg); }
.nav-group > summary:hover { color: #cbd5e1; }
.nav-group > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Observations timeline ---------- */
.obs-table td { vertical-align: top; }
.obs-table .vital-cell.vital-warn { background: var(--warn-50); color: var(--warn); font-weight: 650; }
.obs-table .vital-cell.vital-danger { background: var(--danger-50); color: var(--danger); font-weight: 700; }
.obs-table tr.obs-error td { text-decoration: line-through; color: var(--muted); }
.obs-table tr.obs-sub.obs-error td, .obs-table tr.obs-sub.obs-error td * { text-decoration: none; }
.obs-table tr.obs-sub td { border-top: 0; padding-top: 0; }
.inline-menu { display: inline-block; position: relative; }
.inline-menu > summary { list-style: none; }
.inline-menu > summary::-webkit-details-marker { display: none; }
.inline-form { display: flex; gap: 6px; margin-top: 6px; }
.input-sm { padding: 5px 8px; font-size: .85rem; }
.stat-sub { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.hint-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }
.hint-list li + li { margin-top: 4px; }

/* ---------- Queue: layout switch, hide finished, compact list ---------- */
.queue-tools { justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn { padding: 6px 14px; font-size: .86rem; font-weight: 580; color: var(--muted); text-decoration: none; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--brand); color: #fff; }
.board.no-done { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
.queue-table .qrow td:first-child { border-left: 4px solid transparent; }
.queue-table .qrow.pri-emergency td:first-child { border-left-color: #d92d20; }
.queue-table .qrow.pri-very_urgent td:first-child { border-left-color: #f79009; }
.queue-table .qrow.pri-urgent td:first-child { border-left-color: #eaaa08; }
.queue-table .qrow.pri-routine td:first-child { border-left-color: #12b76a; }
.queue-table .qrow-done { opacity: .7; }
.queue-table .pri-label { margin-left: 6px; }
.queue-table .pri-label { color: #fff !important; padding: 1px 6px; border-radius: 4px; }
.queue-table .pri-emergency .pri-label { background: #d92d20; }
.queue-table .pri-very_urgent .pri-label { background: #f79009; }
.queue-table .pri-urgent .pri-label { background: #fac515; color: #422006 !important; }
.queue-table .pri-routine .pri-label { background: #17b26a; }
.queue-table .pri-label, .queue-table .badge { white-space: nowrap; }

/* ---------- Notification bell (header) ---------- */
.notif-bell { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; line-height: 1; padding: 2px 5px; min-width: 16px; text-align: center; }
.notif-panel { width: 320px; max-width: 86vw; max-height: 70vh; overflow-y: auto; padding: 4px; }
.notif-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 7px; text-decoration: none; color: var(--ink); }
.notif-item:hover { background: var(--bg); text-decoration: none; }
.notif-item strong { font-size: .88rem; }
.notif-item span { font-size: .8rem; color: var(--muted); }
.notif-item-unread { background: var(--brand-100); }
.notif-item-unread:hover { background: var(--brand-100); }
.notif-item-unread strong::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-right: 6px; vertical-align: middle; }
.notif-empty { padding: 18px 10px; text-align: center; color: var(--muted); font-size: .85rem; }
.notif-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.notif-foot a { font-size: .82rem; }
.notif-foot button[data-notif-mark-all] { border: 0; background: none; font: inherit; font-size: .82rem; color: var(--brand-600); cursor: pointer; padding: 0; }

/* ---------- Notifications: full page ---------- */
.notif-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; }
.notif-row + .notif-row { margin-top: 10px; }
.notif-row.notif-unread { border-left: 3px solid var(--brand); }
.notif-body p { margin: 4px 0 0; color: var(--ink-2); }
.notif-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- Notification popups (bottom-right toasts) ---------- */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { position: relative; pointer-events: auto; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 32px 12px 14px; cursor: pointer; opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.toast-in { opacity: 1; transform: translateY(0); }
.toast-out { opacity: 0; transform: translateY(4px); }
.toast-critical_result, .toast-low_stock { border-left-color: var(--danger); }
.toast-kind { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 2px; }
.toast-title { display: block; font-size: .9rem; }
.toast-body { display: block; margin-top: 3px; font-size: .82rem; color: var(--ink-2); }
.toast-close { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; border-radius: 6px; }
.toast-close:hover { background: var(--bg); color: var(--ink); }
@media (max-width: 480px) { .toast-stack { left: 16px; right: 16px; width: auto; } }

/* ---------- Notification settings (Administration) ---------- */
.notif-settings-card { margin-bottom: 16px; }
.notif-settings-card h3 { margin: 0 0 10px; }
.notif-settings-table th, .notif-settings-table td { text-align: left; }
.notif-settings-table th:not(:first-child), .notif-settings-table td:not(:first-child) { text-align: center; width: 160px; }
