/* CliniBooks UI. Brand colours are injected as CSS variables from Settings → Branding. */
:root {
  --brand: #3b6fe0;
  --brand-ink: #fff;
  --brand-soft: #eef3ff;
  --accent: #7c86a8;
  --sidebar: #ffffff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --topbar: #ffffff;
  --sidebar-ink: #1f2430;
  --nav-active: var(--brand);
  --nav-active-ink: var(--brand-ink);
  --ink: #1f2430;
  --ink-2: #4a5160;
  --muted: #7a8190;
  --line: #e5e7ec;
  --line-2: #eef0f3;
  --ok: #1f9d55;
  --ok-soft: #e6f6ed;
  --warn: #c77700;
  --warn-soft: #fff4e0;
  --bad: #d63c3c;
  --bad-soft: #fdecec;
  --info: #2f6fd6;
  --info-soft: #e9f1fd;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.ic { flex-shrink: 0; vertical-align: middle; }
[x-cloak] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; } .mb { margin-bottom: 16px; }
.hide { display: none !important; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-ink); border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); min-height: 64px; }
.sidebar .brand img { max-height: 84px; max-width: 180px; object-fit: contain; }
.sidebar .brand .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: color-mix(in srgb, var(--sidebar-ink) 62%, transparent); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: color-mix(in srgb, var(--sidebar-ink) 86%, transparent); font-weight: 500; margin: 1px 0; }
.nav a:hover { background: color-mix(in srgb, var(--sidebar-ink) 9%, transparent); text-decoration: none; color: var(--sidebar-ink); }
.nav a.active { background: var(--nav-active); color: var(--nav-active-ink); }
.nav a .count { margin-left: auto; font-size: 11px; background: var(--bad); color: #fff; border-radius: 10px; padding: 0 6px; }
.sidebar .me { border-top: 1px solid var(--line-2); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: var(--topbar); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; min-height: 60px; }
.topbar .menu-btn { display: none; }
.gsearch { position: relative; width: min(460px, 100%); }
.gsearch input { padding-left: 36px; background: var(--bg); border-color: transparent; }
.gsearch input:focus { background: var(--surface); }
.gsearch .ic { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.gsearch .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); max-height: 420px; overflow: auto; padding: 6px; }
.gsearch .results .grp { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; letter-spacing: .05em; }
.gsearch .res-list a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.gsearch .res-list a.hl, .gsearch .res-list a:hover { background: var(--brand-soft); text-decoration: none; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.backlink { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--line-2); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(.93); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: #f5c2c2; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(255,255,255,.35); }
.input, select.input, textarea.input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font: inherit; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.sm { height: 30px; font-size: 13px; }
input[type=color].input { padding: 3px; width: 56px; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; vertical-align: middle; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.req::after { content: " *"; color: var(--bad); }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all { grid-column: 1 / -1; }
.form-row { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.form-row:last-child { border-bottom: 0; }
.form-row > .lbl { padding-top: 8px; }
.input-group { display: flex; }
.input-group .addon { display: grid; place-items: center; padding: 0 10px; background: var(--line-2); border: 1px solid var(--line); border-right: 0; border-radius: 7px 0 0 7px; color: var(--muted); font-size: 13px; }
.input-group .input { border-radius: 0 7px 7px 0; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.card-body { padding: 16px 18px; }
.cols { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-side { grid-template-columns: minmax(0, 1fr) 340px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13.5px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; background: linear-gradient(110deg, var(--brand-soft), var(--surface) 70%); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kpi { padding: 18px 20px; border-right: 1px solid var(--line-2); }
.kpi:last-child { border-right: 0; }
.kpi .k-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .k-value { font-size: 21px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.warn .k-value { color: var(--warn); } .kpi.bad .k-value { color: var(--bad); } .kpi.ok .k-value { color: var(--ok); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.paid, .badge.accepted, .badge.closed, .badge.ok, .badge.invoiced { background: var(--ok-soft); color: var(--ok); }
.badge.sent, .badge.open, .badge.info { background: var(--info-soft); color: var(--info); }
.badge.partial, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.overdue, .badge.declined, .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.void { background: #eee; color: #888; text-decoration: line-through; }
.badge.draft { background: #f0f1f4; color: #6b7280; }
.badge.plain { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--ink-2); font-weight: 500; border: 0; background: none; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* Simple tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* ---------- Data grid ---------- */
.dg-toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.dg-toolbar .search { position: relative; width: 280px; max-width: 100%; }
.dg-toolbar .search .ic { position: absolute; left: 9px; top: 9px; color: var(--muted); }
.dg-toolbar .search input { padding-left: 32px; height: 34px; }
.dg-toolbar select.input { height: 34px; width: auto; }
.dg-scroll { overflow: auto; max-height: calc(100vh - 250px); min-height: 200px; }
.dg { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; table-layout: fixed; }
.dg th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 0; border-bottom: 1px solid var(--line); user-select: none; }
.dg th .th { display: flex; align-items: center; gap: 4px; padding: 11px 12px; cursor: pointer; overflow: hidden; }
.dg th .th span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg th.right .th { justify-content: flex-end; }
.dg th .sort { opacity: .7; font-size: 10px; }
.dg th .rz { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.dg th .rz:hover, .dg th.resizing .rz { background: var(--brand); opacity: .4; }
.dg th.drag-over { box-shadow: inset 3px 0 0 var(--brand); }
.dg th.sel, .dg td.sel { width: 42px; text-align: center; padding: 0 0 0 4px; }
.dg td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface); }
.dg tbody tr { cursor: pointer; }
.dg tbody tr:hover td { background: #f8f9fc; }
.dg tbody tr.checked td { background: var(--brand-soft); }
.dg td.right { text-align: right; font-variant-numeric: tabular-nums; }
.dg td.editable { cursor: text; position: relative; }
.dg td.editable:hover { box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); }
.dg td.editing { padding: 3px 4px; overflow: visible; }
.dg td.editing .input { height: 30px; font-size: 13px; }
.dg td.saved { animation: flash 1s; }
@keyframes flash { from { background: var(--ok-soft); } to { background: var(--surface); } }
.dg td a.lnk { font-weight: 600; }
.dg tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line); }
.dg .neg { color: var(--bad); font-weight: 600; } .dg .low { color: var(--warn); font-weight: 600; }
.dg-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line-2); gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.dg-empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.bulkbar { display: flex; align-items: center; gap: 10px; background: var(--brand-soft); padding: 8px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.colmenu { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 50; padding: 8px; max-height: 70vh; overflow: auto; }
.colmenu .ci { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: grab; font-size: 13px; }
.colmenu .ci:hover { background: var(--line-2); }
.colmenu .ci.drag-over { box-shadow: inset 0 2px 0 var(--brand); }
.colmenu .ci .ic { color: var(--muted); }

/* Dropdown */
.dd { position: relative; display: inline-block; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 60; padding: 6px; }
.dd-menu.left { left: 0; right: auto; }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; border-radius: 6px; cursor: pointer; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--line-2); text-decoration: none; }
.dd-menu .sep { border-top: 1px solid var(--line-2); margin: 4px 0; }
.dd-menu .danger { color: var(--bad); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 24, 33, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); }

/* Alerts & toasts */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.alert.ok { background: var(--ok-soft); color: #126b3a; }
.alert.bad { background: var(--bad-soft); color: #a32424; }
.alert.warn { background: var(--warn-soft); color: #8a5300; }
.alert.info { background: var(--info-soft); color: #1d4f9e; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2430; color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px; animation: slidein .18s ease-out; }
.toast.bad { background: var(--bad); } .toast.ok { background: #1c7c47; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* Combobox */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 70; max-height: 320px; overflow: auto; padding: 4px; min-width: 300px; }
.combo-list .opt { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.combo-list .opt.hl { background: var(--brand-soft); }
.combo-list .opt .meta { color: var(--muted); font-size: 12px; }
.combo-list .opt.add { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line-2); }

/* Document editor */
.doc-editor .lines { width: 100%; border-collapse: collapse; }
.doc-editor .lines th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.doc-editor .lines td { padding: 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.doc-editor .lines .input { height: 34px; }
.doc-editor .lines textarea.input { min-height: 34px; height: auto; padding-top: 6px; padding-bottom: 6px; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.doc-editor .lines .amt { text-align: right; padding-top: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-editor .lines .stockinfo { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.doc-editor .lines .stockinfo.low { color: var(--warn); }
.totals { width: 100%; max-width: 420px; margin-left: auto; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 16px; }
.totals .tr { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; font-variant-numeric: tabular-nums; }
.totals .tr.grand { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 24px; margin: 24px -24px -60px; display: flex; gap: 8px; z-index: 20; backdrop-filter: blur(6px); }
.pay-box { border: 1px dashed var(--line); border-radius: 10px; padding: 14px 16px; background: #fcfcfd; }

/* Document view */
.doc-frame { width: 100%; border: 0; background: #fff; min-height: 1000px; border-radius: 10px; box-shadow: var(--shadow); }
.ribbon { display: inline-block; padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; }

/* Charts */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.bars .bar .b { width: 100%; max-width: 34px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: .9; }
.bars .bar .b.cost { background: var(--accent); opacity: .55; position: absolute; bottom: 0; left: 0; right: 0; border-radius: 4px 4px 0 0; }
.bars .bar:hover .b { opacity: 1; }
.bars .bar .lbl2 { font-size: 11px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.list-compact { list-style: none; margin: 0; padding: 0; }
.list-compact li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.list-compact li:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
.settings-nav { position: sticky; top: 80px; align-self: start; }
.settings-nav a { display: block; padding: 8px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; }
.settings-nav a:hover { background: var(--line-2); text-decoration: none; }
.settings-nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.settings-nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 6px; }
.logo-preview { width: 200px; height: 90px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-preview img { max-width: 92%; max-height: 80px; }
.swatch-row { display: flex; gap: 10px; align-items: center; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 20% -10%, var(--brand-soft), transparent), var(--bg); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 30px; }
.auth-card .logo { text-align: center; margin-bottom: 18px; }
.auth-card .logo img { max-width: 200px; max-height: 140px; }

/* Print */
@media print {
  .sidebar, .topbar, .page-head .actions, .dg-toolbar, .dg-foot, .no-print, .sticky-actions { display: none !important; }
  .main { margin: 0; } .content { padding: 0; } .card { box-shadow: none; border: 0; }
  .dg-scroll { max-height: none; overflow: visible; }
}

/* Responsive */
@media (max-width: 1100px) { .cols-side { grid-template-columns: minmax(0, 1fr); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 60px; }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; min-width: 0; } .settings-nav a { white-space: nowrap; }
  .settings-nav .label { display: none; }
  .form-row { grid-template-columns: 1fr; gap: 6px; }
  .form-grid .span-2 { grid-column: auto; }
  .sticky-actions { margin: 24px -16px -60px; padding: 12px 16px; flex-wrap: wrap; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .doc-editor .lines thead { display: none; }
  .doc-editor .lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .doc-editor .lines td { border: 0; padding: 0; }
  .doc-editor .lines td.item-cell { grid-column: 1 / -1; }
}
.sidebar-backdrop { display: none; }
@media (max-width: 900px) { .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 35; } }

/* ---------- Dashboard sections ---------- */
.sec { margin-top: 26px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.sec-h h2 { font-size: 16px; }
.sec-h .sub { color: var(--muted); font-size: 12.5px; }
.sec-h .more { margin-left: auto; font-size: 12.5px; }
.counters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none !important; }
.counter:hover { border-color: var(--brand); }
.counter .n { font-size: 24px; font-weight: 700; line-height: 1.1; }
.counter .l { font-size: 12.5px; color: var(--muted); }
.counter .dot { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.counter.warn .dot { background: var(--warn-soft); color: var(--warn); } .counter.bad .dot { background: var(--bad-soft); color: var(--bad); } .counter.ok .dot { background: var(--ok-soft); color: var(--ok); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.timeline li:first-child { border-top: 0; }
.timeline .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline .who { font-weight: 600; }
.timeline li.done { opacity: .55; }
.timeline li.next { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); opacity: 1; }
.chip { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; background: #f1f2f5; color: var(--ink-2); margin: 2px 4px 0 0; font-weight: 500; }
.chip.gov { background: var(--ok-soft); color: #16794a; } .chip.pvt { background: #efe9fb; color: #6a43b8; }
.fc th.num, .fc td.num { text-align: right; }
.short { color: var(--bad); font-weight: 600; } .okc { color: var(--ok); font-weight: 600; }
.legend-dots span { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; font-size: 12px; color: var(--muted); }
.legend-dots i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
@media (max-width: 1100px) { .counters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .timeline li { grid-template-columns: 48px minmax(0, 1fr); } .timeline li > :last-child { grid-column: 2; justify-content: flex-start !important; } }

/* ---------- Booking ---------- */
.stepper { display: flex; margin: 4px 0 22px; }
.stepper > div { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.stepper > div.done { cursor: pointer; }
.stepper b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); font-size: 13px; background: var(--surface); flex-shrink: 0; }
.stepper > div.on { color: var(--ink); } .stepper > div.on b { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.stepper > div.done b { border-color: var(--brand); color: var(--brand); }
.stepper > div:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--line); margin: 0 12px; min-width: 12px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.svc { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; background: var(--surface); cursor: pointer; }
.svc.rec { border-color: var(--brand); background: var(--brand-soft); }
.svc.muted2 { opacity: .6; }
.svc input { margin-top: 3px; }
.next-card { display: flex; align-items: center; gap: 16px; border: 1.5px solid var(--brand); background: var(--brand-soft); border-radius: 12px; padding: 16px 18px; }
.next-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--brand); flex-shrink: 0; }
.next-actions { display: flex; flex-direction: column; gap: 6px; }
.big-time { font-size: 26px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.dt-title { font-size: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.dt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; margin-top: 20px; }
.dt-day { font-size: 16px; margin-bottom: 14px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 6px 2px; }
.cal .dh { font-size: 13px; color: var(--ink-2); padding: 6px 0; }
.cal .d { padding: 12px 0; font-size: 16px; color: #b3b7c0; position: relative; border-radius: 8px; }
.cal .d.av { color: var(--ink); cursor: pointer; font-weight: 500; }
.cal .d.av:hover { background: var(--brand-soft); }
.cal .d.av::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--brand); }
.cal .d.sel, .cal .d.sel:hover { background: var(--brand); color: var(--brand-ink); } .cal .d.sel::after { background: var(--brand-ink); }
.cal .d.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot { border: 1.5px solid var(--line); border-radius: 8px; padding: 11px 0; text-align: center; font-size: 15px; font-weight: 500; background: var(--surface); cursor: pointer; font-family: inherit; color: var(--ink); }
.slot:hover { border-color: var(--brand); }
.slot.sel { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.slot-chip { padding: 8px 14px; font-size: 14px; }
.summary-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.summary-box dl, dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.summary-box dt, dl.kv dt { color: var(--muted); } .summary-box dd, dl.kv dd { margin: 0; }
.form-grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fee-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.client-find { position: relative; }
.client-find .dd-menu { position: absolute; right: 0; top: 100%; z-index: 30; }
.hours-list div { display: flex; justify-content: space-between; padding: 3px 0; }
.confirm-card { max-width: 640px; margin: 0 auto; }
.done-tick { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 760px) {
  .dt-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .choice-grid, .form-grid.g2, .form-grid.g3, .fee-choice { grid-template-columns: minmax(0, 1fr); }
  .stepper span { display: none; } .stepper > div { flex: 0 1 auto; } .stepper > div:not(:last-child) { flex: 1; }
  .next-card { flex-wrap: wrap; } .next-actions { flex-direction: row; width: 100%; } .next-actions .btn { flex: 1; justify-content: center; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Diary ---------- */
.content:has(.diary-layout) { max-width: none; }
.diary-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.diary-layout.side-open { grid-template-columns: minmax(0, 1fr) 340px; }
.diary-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.diary-backdrop { display: none; }
.btn.btn-on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
@media (max-width: 1100px) {
  .diary-layout, .diary-layout.side-open { grid-template-columns: minmax(0, 1fr); }
  .diary-side { position: fixed; top: 0; right: 0; bottom: 0; max-height: none; width: min(360px, 92vw); padding: 12px; background: var(--bg); z-index: 70; box-shadow: -8px 0 24px rgba(0,0,0,.15); }
  .diary-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,20,30,.3); z-index: 69; }
}

/* ---------- Public booking page ---------- */
.public-page { background: var(--bg); }
.pub-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.pub-brand img { height: 64px; max-width: 220px; object-fit: contain; display: block; }
.pub-phone { font-weight: 600; }
.pub-main { max-width: 1060px; margin: 0 auto; padding: 24px 16px 40px; }
.pub-intro { margin-bottom: 18px; } .pub-intro p { margin: 6px 0 0; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 30px; }
.timeline li.blk { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--line-2) 6px, var(--line-2) 12px); color: var(--muted); }
.alt-contact { background: var(--brand-soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
.outside { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }

/* ---------- Setup wizard (client builder) ---------- */
.setup-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; flex-wrap: wrap; }
.setup-steps li { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); cursor: pointer; }
.setup-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.setup-steps li.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.setup-steps li.on span, .setup-steps li.done span { background: var(--brand); color: var(--brand-ink); }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.setup section h2 { margin: 0; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.choice input { margin-top: 3px; }
.choice > span { display: flex; flex-direction: column; gap: 2px; }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.swatch-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; }
.swatch-row .input:not([type=color]) { min-width: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; text-decoration: underline; }
.pv { display: grid; grid-template-columns: 96px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 190px; font-size: 11px; }
.pv-side { background: var(--surface); border-right: 1px solid var(--line); padding: 8px 6px; display: flex; flex-direction: column; gap: 4px; }
.pv-side img { max-width: 100%; max-height: 40px; object-fit: contain; margin-bottom: 6px; }
.pv-name { font-weight: 700; font-size: 11px; margin-bottom: 6px; line-height: 1.2; }
.pv-nav { padding: 4px 6px; border-radius: 5px; color: var(--ink-2); } .pv-nav.on { color: #fff; }
.pv-main { padding: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pv-btn { color: #fff; padding: 4px 8px; border-radius: 6px; font-weight: 600; }
.pv-doc { background: #fff; border-radius: 6px; padding: 8px; width: 100%; box-shadow: 0 1px 2px rgba(0,0,0,.06); display: flex; flex-direction: column; gap: 6px; }
.pv-doc-h { display: flex; justify-content: space-between; align-items: center; }
.pv-row { height: 10px; border-radius: 3px; } .pv-line { height: 6px; border-radius: 3px; background: var(--line-2); }
@media (max-width: 1000px) { .setup-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Bank statement (owner panel) ---------- */
.bank-line { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.bank-top { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; }
.bank-desc { font-weight: 600; overflow-wrap: anywhere; }
.bank-amt { font-weight: 600; color: var(--bad); }
.bank-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bank-ctl .input { width: auto; min-width: 0; }
.bank-ctl select.input { max-width: 240px; }
.bank-ctl input.input { width: 170px; }
.bad-text { color: var(--bad); }
.fin td { padding: 6px 10px; } .fin .sub td { padding-left: 26px; color: var(--ink-2); }
.fin .tot td { font-weight: 700; border-top: 1px solid var(--line); } .fin .grand td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--ink); }
.fin .h td { font-weight: 600; padding-top: 14px; }
@media (max-width: 700px) { .bank-top { grid-template-columns: minmax(0, 1fr) auto; } .bank-top > :first-child { grid-column: 1 / -1; } .bank-ctl input.input, .bank-ctl select.input { width: 100%; max-width: none; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; font-size: 13px; color: var(--ink-2); text-decoration: none; } .seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--brand); color: var(--brand-ink); }

/* ---------- Hover lists (hov()) ---------- */
.hov { cursor: help; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; outline: none; }
.counter .n .hov { text-decoration-thickness: 2px; text-underline-offset: 4px; }
.hov:focus-visible { box-shadow: 0 0 0 2px var(--brand-soft); border-radius: 3px; }
.hov > template { display: none; }
.hov-pop { position: fixed; z-index: 200; max-width: min(400px, calc(100vw - 16px)); max-height: min(560px, 80vh); overflow-y: auto; background: #1f2430; color: #fff;
  border-radius: 9px; padding: 9px 12px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.25); text-align: left; font-weight: 400; }
.hov-pop .hov-t { font-weight: 600; margin-bottom: 4px; color: #fff; }
.hov-pop ul { margin: 0; padding-left: 16px; } .hov-pop li { margin: 1px 0; } .hov-pop .hov-empty { color: #c9ced8; }

/* ---------- Dashboard layout ---------- */
.dash-top { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: stretch; }
.dash-top > .card { min-height: 100%; }
.counter .n { line-height: 1.25; }
.dash-stack { display: flex; flex-direction: column; gap: 12px; }
.dash-stock { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
.dash-stock.no-appts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fc-pair { align-items: stretch; }
.fc-pair > .card, .dash-stock > .card { display: flex; flex-direction: column; }
.fc-pair > .card > .table-wrap, .dash-stock > .card > .table-wrap { flex: 1; }
@media (max-width: 1250px) { .dash-stock { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .dash-top { grid-template-columns: minmax(0, 1fr); } .dash-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); } }
@media (max-width: 640px) { .dash-stock, .dash-stock.no-appts { grid-template-columns: minmax(0, 1fr); } }
.table.fc td.fc-ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.table.fc td.fc-short { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.table.fc th, .table.fc td { padding-left: 8px; padding-right: 8px; }
.table.fc th { white-space: nowrap; }
.table.fc td:first-child { overflow-wrap: break-word; }
/* Side by side whenever both tables fit; number columns stay compact and the vaccine name takes the spare width. */
.fc-pair { grid-template-columns: repeat(auto-fit, minmax(min(100%, 640px), 1fr)); }
.table.fc th.num, .table.fc td.num { width: 1%; white-space: nowrap; }
.table.fc th.num:not(.fc-stock), .table.fc td.num:not(.fc-stock) { min-width: 46px; }
.table.fc th.fc-stock, .table.fc td.fc-stock { border-left: 3px solid #c9ced8; padding-left: 12px; }
.btn.due-mail { display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; min-width: 52px; justify-content: center; }
.btn.due-pending, .due-legend .due-pending { color: var(--muted); }
.btn.due-sent { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); } .due-legend .due-sent { color: var(--ok); }
.btn.due-fail { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); } .due-legend .due-fail { color: var(--bad); }
.due-legend span { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; }
.table.fc td.fc-warn { background: #fff6e0; color: #b7791f; font-weight: 600; }
.table.fc td { vertical-align: top; }
.fc-due { display: block; font-size: 11.5px; font-weight: 500; color: #8a6d1f; line-height: 1.2; margin-top: 1px; }
.fc-due-t, .table.fc th.fc-due-h { color: #8a6d1f; } .table.fc td.fc-due-t { font-size: 12.5px; }
.fc-key span { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin: 0 3px 0 8px; }
.fc-key .fc-ok { background: var(--ok-soft); } .fc-key .fc-warn { background: #fff6e0; } .fc-key .fc-short { background: var(--bad-soft); }
.table tr.grp-row td { border-top: 3px solid #c9ced8; background: var(--surface-2); padding-top: 7px; padding-bottom: 7px; }
.table tbody tr.grp-row:first-child td { border-top: 0; }
.table tr.grp-row .chip { font-size: 12px; }
.due-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.due-actions form { display: flex; margin: 0; }
.due-actions .btn { height: 32px; }
.due-actions .btn-icon { width: 32px; }
.due-actions .btn.due-mail { padding: 0 8px; gap: 5px; min-width: 0; }
.due-actions .btn svg { display: block; }

/* ---------- Online booking closed ---------- */
.closed-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.closed-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none !important; color: var(--ink); background: var(--surface); }
.closed-opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.closed-opt .ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.closed-opt strong { font-size: 16px; }
.hov-pop .hov-tbl { border-collapse: collapse; width: 100%; }
.hov-pop .hov-tbl td { vertical-align: top; padding: 2px 0; }
.hov-pop .hov-tbl tr.hov-day td { padding: 9px 0 2px; color: #c9ced8; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.hov-pop .hov-tbl tr.hov-day:first-child td { padding-top: 2px; }
.hov-pop .hov-time { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; padding-right: 14px !important; width: 1%; }
.hov-pop .hov-note { display: block; font-size: 11.5px; color: #aeb4c0; } .hov-pop .hov-note.due { color: #f2c46d; }
/* Vaccines counter hover: green government and purple private, each line running down from its dot */
.hov-pop .hov-vac { border-collapse: collapse; width: 100%; }
.hov-pop .hov-vac th { font-size: 11px; color: #c9ced8; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; text-align: right; padding: 4px 0 4px 18px; }
.hov-pop .hov-vac th:first-child { text-align: left; padding-left: 0; }
.hov-pop .hov-vac td { padding: 2px 0; }
.hov-pop .hov-vac td.n { text-align: right; padding-left: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hov-pop .hov-vac td.d { text-align: right; padding-left: 18px; color: #f2c46d; font-variant-numeric: tabular-nums; }
.hov-pop .hov-vac tr.hv-grp td { padding: 9px 0 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; position: relative; }
.hov-pop .hov-vac tr.hv-grp i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 9px; vertical-align: 0; }
.hov-pop .hov-vac tr.hv-grp.government td { color: #6ee7a0; } .hov-pop .hov-vac tr.hv-grp.government i { background: #3fbf77; }
.hov-pop .hov-vac tr.hv-grp.private td { color: #c4a5ff; } .hov-pop .hov-vac tr.hv-grp.private i { background: #9b6bff; }
.hov-pop .hov-vac tr.hv-row td:first-child { position: relative; padding-left: 18px; }
.hov-pop .hov-vac tr.hv-row td:first-child::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 3px; }
.hov-pop .hov-vac tr.hv-row.government td:first-child::before { background: #3fbf77; }
.hov-pop .hov-vac tr.hv-row.private td:first-child::before { background: #9b6bff; }
.hov-pop .hov-vac tr.hv-tot td { border-top: 1px solid #3a4150; padding-top: 6px; font-weight: 700; }

/* Bay diary: one column per chair / room / doctor */
.bays-wrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.bays-side { display: grid; gap: 12px; }
.bays-cal { padding: 12px; }
.bays-cal > .row a { color: var(--ink); text-decoration: none; padding: 0 6px; font-size: 16px; }
.bays-cal .g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: 12px; text-align: center; margin-top: 8px; }
.bays-cal .g span, .bays-cal .g a { padding: 5px 0; border-radius: 4px; color: var(--ink); text-decoration: none; }
.bays-cal .g .dh { font-weight: 600; color: var(--muted); }
.bays-cal .g a:hover { background: var(--line-2); }
.bays-cal .g a.closed { color: #b5b9c2; }
.bays-cal .g a.td { box-shadow: inset 0 0 0 1px var(--brand); }
.bays-cal .g a.sel { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.bays-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bays { display: grid; grid-template-rows: 40px; grid-auto-rows: 26px; min-width: min-content; }
.bays .hd { grid-row: 1; background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 4px; border-right: 1px solid rgba(255,255,255,.15); position: sticky; top: 0; z-index: 2; }
.bays .hd small { display: block; font-size: 11px; font-weight: 400; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bays .tm { grid-column: 1; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line); }
.bays .tm.hr { font-weight: 600; color: var(--ink); }
.bays .cell { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); cursor: pointer; font-size: 11.5px; font-weight: 600; display: flex; align-items: center; padding-left: 8px; }
.bays .cell span { display: none; }
.bays .cell:hover, .bays .cell.drop { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); }
.bays .cell:hover span, .bays .cell.drop span { display: inline; }
.bays .cell.hrline { border-bottom-color: var(--line); }
.bays .cell.off { background: repeating-linear-gradient(135deg, #f4f4f5 0 6px, #e9e9eb 6px 12px); }
.bk { margin: 2px 3px; border-radius: 6px; padding: 3px 7px; font-size: 12px; line-height: 1.3; overflow: hidden; background: #f0f0f1; border-left: 4px solid var(--brand); color: var(--ink); text-decoration: none; z-index: 1; position: relative; cursor: grab; }
.bk b { display: block; font-size: 12.5px; }
.bk.short b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk .m { color: var(--ink-2); }
.bk.short .m { display: none; }
.bk:hover { box-shadow: var(--shadow); text-decoration: none; }
.bk.arr { background: var(--brand); color: var(--brand-ink); }
.bk.arr .m { color: inherit; opacity: .8; }
.bk.done { background: var(--surface); border: 1px solid #c9cbd0; border-left: 4px solid #9a9da5; color: var(--muted); }
.bk.ns { opacity: .55; text-decoration: line-through; }
.bk.unlinked { border-left-style: dashed; }
.bk.blk { background: repeating-linear-gradient(135deg, #ececee 0 6px, #e0e0e3 6px 12px); border-left-color: #9a9da5; color: var(--ink-2); cursor: pointer; }
.bk.vt { background: color-mix(in srgb, var(--vt) 20%, #fff); border-left-color: var(--vt); }
.bk.vt.arr { background: var(--vt); color: #fff; }
.bk.vt.done { background: var(--surface); border-left-color: var(--vt); }
.vt-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }
.vt-block { padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.vt-table td { vertical-align: middle; }
.vt-table .input.sm { width: auto; }
.vt-swatch { width: 34px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; vertical-align: middle; }
.vt-swatch.none { opacity: .45; }
.legend-dots .lg-bk { background: #f0f0f1; box-shadow: inset 3px 0 var(--brand); }
.legend-dots .lg-arr { background: var(--brand); }
.legend-dots .lg-done { background: var(--surface); border: 1px solid #c9cbd0; }
.legend-dots .lg-off { background: repeating-linear-gradient(135deg, #f4f4f5 0 3px, #dcdce0 3px 6px); }
@media (max-width: 1000px) { .bays-wrap { grid-template-columns: minmax(0, 1fr); } .bays-side { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); order: 2; } .bays-side > :last-child { display: none; } }
@media (max-width: 640px) { .bays-side { display: none; } }

/* Side drawer (one-screen booking) */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 460px); background: var(--surface); box-shadow: -12px 0 40px rgba(0,0,0,.18); z-index: 61; display: flex; flex-direction: column; }
.drawer-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 16px 22px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.drawer .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.drawer .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 480px) { .drawer .g2, .drawer .g3 { grid-template-columns: minmax(0, 1fr); } }
.picked { display: flex; gap: 12px; align-items: center; border: 1px solid var(--brand); border-radius: var(--radius); padding: 10px 12px; }
.picked .avatar { flex: none; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchips button { border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; font-size: 13px; background: var(--surface); color: var(--ink); cursor: pointer; font-family: inherit; }
.tchips button small { color: var(--muted); margin-left: 5px; }
.tchips button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tchips button.on small { color: inherit; opacity: .7; }
.freeline { font-size: 12.5px; background: var(--ok-soft); color: var(--ok); border-radius: 6px; padding: 8px 10px; }
.freeline.bad { background: var(--bad-soft); color: var(--bad); }
.dd-menu a.hl { background: var(--line-2); }

/* Client card beside the global search results */
.gsearch .results.with-card { width: min(800px, calc(100vw - 32px)); display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 1fr); padding: 0; max-height: 480px; }
.gsearch .results.with-card .res-list { padding: 6px; overflow: auto; border-right: 1px solid var(--line); }
.ccard { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.ccard-name { font-size: 18px; font-weight: 700; }
.ccard-kv { display: grid; gap: 6px; margin: 0; font-size: 13px; }
.ccard-kv > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.ccard-kv dt { color: var(--muted); }
.ccard-kv dd { margin: 0; overflow-wrap: anywhere; }
.ccard .pill { display: inline-block; background: var(--line-2); border-radius: 4px; padding: 0 6px; font-size: 11.5px; color: var(--ink); }

@media (max-width: 760px) { .gsearch .results.with-card { width: auto; grid-template-columns: minmax(0, 1fr); } .ccard { display: none; } }
.stock-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }

/* Reports page, "analytics" layout */
.rep-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; align-items: start; }
.rep-h { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 20px; }
.rep-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; background: #f6f6f7; padding: 10px 14px; margin-bottom: 6px; color: var(--ink); text-decoration: none; }
.rep-row:hover { background: var(--brand-soft); border-color: var(--brand); text-decoration: none; }
.rep-row .grow > span { display: block; margin-top: 2px; }
.rep-ar { font-size: 11px; color: var(--ink-2); }
.due-actions .due-remove { color: var(--muted); }
.due-actions .due-remove:hover { color: var(--danger, #c0392b); }
.due-removed summary { cursor: pointer; list-style: revert; }
.seg label { padding: 6px 12px; font-size: 13px; color: var(--ink-2); cursor: pointer; margin: 0; }
.seg label + label { border-left: 1px solid var(--line); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--brand); color: var(--brand-ink); }
.dep-inline { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--bg-soft, #fafafa); }
.dep-inline .field { margin: 0; min-width: 140px; flex: 1 1 140px; }
.dep-inline .field label { font-size: 12px; }

/* ---------- Diary grid (Google Calendar style) ---------- */
.diary-head .actions { align-items: center; }
.diary-nav { display: inline-flex; gap: 4px; }
.diary-nav .btn-icon { width: 36px; font-size: 18px; }
.diary-views a { padding: 7px 13px; }
.dcal { --gut: 56px; --c-gov: #c9eed9; --c-gov-ink: #0d5531; --c-pvt: #e4d9fb; --c-pvt-ink: #3b1c87; --c-oth: #ffe6c2; --c-oth-ink: #6a3d00; --c-blk: #eceef2; --c-blk-ink: #4a5160;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cal-head, .cal-allday { display: grid; grid-template-columns: var(--gut) repeat(var(--cols), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--line); }
.cal-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 8px; text-decoration: none !important; color: var(--ink-2); }
.cal-day .dn { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cal-day .dd { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; font-weight: 500; color: var(--ink); line-height: 1; }
.cal-day:hover .dd { background: var(--line-2); }
.cal-day.is-past .dd { color: var(--muted); }
.cal-day.is-today .dn { color: var(--brand); }
.cal-day.is-today .dd, .cal-day.is-today:hover .dd { background: var(--brand); color: var(--brand-ink); }
.cal-allday { border-bottom: 1px solid var(--line); padding: 3px 0; }
.cal-allday > div { padding: 0 3px; min-width: 0; }
.cal-chip { display: block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #d7efe6; color: #145c43; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-body { position: relative; display: grid; grid-template-columns: var(--gut) repeat(var(--cols), minmax(0, 1fr)); }
.cal-times { position: relative; }
.cal-times span.first { transform: none; }
.cal-times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); line-height: 1; background: var(--surface); padding: 2px 0; }
.cal-col { position: relative; border-left: 1px solid var(--line); min-width: 0; container-type: inline-size; }
.cal-col .cslot { box-sizing: border-box; cursor: pointer; }
.cal-col .cslot.hr { border-top: 1px solid var(--line); }
.cal-col .cslot:first-child { border-top: 0; }
.cal-col .cslot:hover { background: rgba(0, 0, 0, .035); }
.cal-col .cslot.off { background: #f7f8fa; cursor: default; }
.cal-col.is-today .slot:not(.off) { background: color-mix(in srgb, var(--brand-soft) 45%, #fff); }
.ev { position: absolute; z-index: 1; box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; padding: 3px 8px; border-radius: 6px;
  border: 1px solid #fff; background: var(--c-oth); color: var(--c-oth-ink); font-size: 12px; line-height: 1.3; text-decoration: none !important; min-height: 16px; }
.ev .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.ev .tm, .ev .sv { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ev .tm-inline { display: none; font-weight: 400; }
.ev.short { flex-direction: row; padding-top: 1px; padding-bottom: 1px; }
.ev.short .t { flex: 1 1 auto; min-width: 0; }
.ev.short .tm-inline { display: inline; }
.ev.short .tm, .ev.short .sv { display: none; }
.dcal.compact .ev:not(.short) { padding-top: 1px; padding-bottom: 1px; font-size: 11.5px; line-height: 1.25; }
.ev.gov { background: var(--c-gov); color: var(--c-gov-ink); }
.ev.pvt { background: var(--c-pvt); color: var(--c-pvt-ink); }
.ev.vt { background: color-mix(in srgb, var(--vt) 22%, #fff); color: #1d2b33; box-shadow: inset 3px 0 var(--vt); }
.ev.blk { background: var(--c-blk); color: var(--c-blk-ink); z-index: 0; }
.ev.blk .t { font-weight: 500; }
.ev.unlinked { background-image: linear-gradient(90deg, rgba(0,0,0,.12) 0 3px, transparent 3px); padding-left: 10px; }
.ev.st-done { opacity: .6; }
.ev.st-no_show { opacity: .45; text-decoration: line-through !important; }
.ev:hover { z-index: 3; box-shadow: 0 4px 12px rgba(20, 25, 40, .18); }
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background: #ea4335; z-index: 4; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: #ea4335; }
.diary-legend { margin-top: 10px; }
.diary-fab { display: none; }
/* Narrow columns (phone week view, or many days): title only, wrapping like Google. */
@container (max-width: 120px) {
  .ev { padding: 2px 4px; font-size: 11px; line-height: 1.2; }
  .ev .t, .ev.short .t { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; font-weight: 500; }
  .ev .tm, .ev .sv, .ev .tm-inline, .ev.short .tm-inline { display: none; }
  .ev.short { flex-direction: column; }
}
@media (max-width: 700px) {
  .content:has(.dcal) { padding-left: 0; padding-right: 0; }
  .content:has(.dcal) .page-head { padding: 0 12px; }
  .diary-head { margin-bottom: 8px; }
  .diary-head h1 { font-size: 20px; }
  .diary-head .actions { width: 100%; display: flex; flex-wrap: nowrap; gap: 6px; }
  .diary-head .diary-views { flex: 1 1 auto; display: flex; } .diary-views a { flex: 1; text-align: center; padding: 7px 4px; }
  .diary-date, .diary-book, .diary-legend { display: none !important; }
  .diary-quick span { display: none; }
  .dcal { --gut: 46px; border-radius: 0; border-left: 0; border-right: 0; }
  .cal-day { padding: 6px 0; } .cal-day .dd { width: 34px; height: 34px; font-size: 18px; }
  .cal-times span { right: 6px; font-size: 10.5px; }
  .ev { border-radius: 5px; }
  .diary-fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: 22px; width: 58px; height: 58px; border-radius: 18px; background: var(--brand); color: var(--brand-ink);
    box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 30; }
}
.diary-head .actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.diary-date { width: auto !important; }
.diary-views a { white-space: nowrap; }
.field .seg { width: fit-content; }

.menu-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.item-email summary { cursor: pointer; list-style: revert; }
.dup-box { margin-bottom: 14px; border-left: 4px solid var(--warn); }
.dup-list { display: grid; gap: 6px; margin-top: 10px; }
.dup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 0; border-top: 1px solid var(--line-2); }
.dup-row > span { flex: 1 1 320px; }
dialog.dlg { border: 0; border-radius: 14px; padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.dlg::backdrop { background: rgba(15,20,30,.4); }

/* Booking page with a column per person */
.bk-sec { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.bk-sec span { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.bk-sec h2 { margin: 0; }
.bk-cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 24px; }
.bk-cols .svc { margin-bottom: 8px; }
.bk-col-h { margin-bottom: 10px; }
.bk-col-h h3 { margin: 0; }
.bk-chip { min-width: 76px; }
@media (max-width: 760px) { .bk-cols { grid-template-columns: minmax(0, 1fr); } }

/* Dashboard → Customise (1.18) */
.cz-row { gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; }
.cz-mods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cz-mod { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; min-height: 56px; border-radius: 8px; font: inherit; color: var(--ink); cursor: pointer; background: var(--bg); border: 1px dashed var(--line); }
.cz-mod.on { background: var(--surface); border: 2px solid var(--brand); }
.cz-pill { flex-shrink: 0; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--line); color: var(--ink-2); }
.cz-mod.on .cz-pill { background: var(--brand); color: var(--brand-ink); }
@media (max-width: 480px) { .cz-mods { grid-template-columns: minmax(0, 1fr); } }
.seg button { padding: 6px 12px; font: inherit; font-size: 13px; color: var(--ink-2); background: none; border: 0; cursor: pointer; } .seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* Client tags (1.18) */
.tag-chip { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.5; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); position: relative; }
.tag-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tag-input input { flex: 1; min-width: 90px; border: 0; outline: none; font: inherit; background: none; color: var(--ink); height: 26px; }
.tag-input .tag-chip button { border: 0; background: none; color: inherit; font: inherit; margin-left: 4px; padding: 0; cursor: pointer; }
.tag-sugg { position: absolute; left: 0; top: calc(100% + 4px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 20; overflow: hidden; }
.tag-sugg button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; }
.tag-sugg button:hover, .tag-sugg button.hi { background: var(--brand-soft); }
.cz-mod { text-align: left; } .cz-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }


/* ---------- Interface colours: dark mode (1.18) ---------- */
.sidebar .muted { color: color-mix(in srgb, var(--sidebar-ink) 62%, transparent); }
html[data-mode="dark"] {
  color-scheme: dark;
  --bg: #121418; --surface: #1b1e24; --surface-2: #20242b; --topbar: #1b1e24;
  --ink: #e8eaef; --ink-2: #c3c8d2; --muted: #9aa1ad; --line: #30353e; --line-2: #262a31;
  --ok-soft: #16331f; --warn-soft: #382a10; --bad-soft: #3b1b1b; --info-soft: #182841;
  --brand-soft: color-mix(in srgb, var(--brand) 24%, #1b1e24);
  --sidebar: var(--sidebar-dark); --sidebar-ink: var(--sidebar-ink-dark); --nav-active: var(--nav-active-dark); --nav-active-ink: var(--nav-active-ink-dark);
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark) {
  html[data-mode="auto"] {
    color-scheme: dark;
    --bg: #121418; --surface: #1b1e24; --surface-2: #20242b; --topbar: #1b1e24;
    --ink: #e8eaef; --ink-2: #c3c8d2; --muted: #9aa1ad; --line: #30353e; --line-2: #262a31;
    --ok-soft: #16331f; --warn-soft: #382a10; --bad-soft: #3b1b1b; --info-soft: #182841;
    --brand-soft: color-mix(in srgb, var(--brand) 24%, #1b1e24);
    --sidebar: var(--sidebar-dark); --sidebar-ink: var(--sidebar-ink-dark); --nav-active: var(--nav-active-dark); --nav-active-ink: var(--nav-active-ink-dark);
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  }
}
html[data-mode="dark"] .alert.warn, html[data-mode="dark"] .badge.warn, html[data-mode="dark"] .badge.partial { color: #f2c46d; }
html[data-mode="dark"] .alert.info { color: #9cc2ff; }
html[data-mode="dark"] .alert.ok, html[data-mode="dark"] .badge.ok, html[data-mode="dark"] .badge.paid { color: #6fd39a; }
html[data-mode="dark"] .alert.bad, html[data-mode="dark"] .badge.overdue { color: #f19a9a; }
html[data-mode="dark"] .ev.vt { color: #1d2b33; }
@media (prefers-color-scheme: dark) {
  html[data-mode="auto"] .alert.warn, html[data-mode="auto"] .badge.warn, html[data-mode="auto"] .badge.partial { color: #f2c46d; }
  html[data-mode="auto"] .alert.info { color: #9cc2ff; }
  html[data-mode="auto"] .alert.ok, html[data-mode="auto"] .badge.ok, html[data-mode="auto"] .badge.paid { color: #6fd39a; }
  html[data-mode="auto"] .alert.bad, html[data-mode="auto"] .badge.overdue { color: #f19a9a; }
}

/* Settings → Branding → Interface colours */
.ui-wrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.ui-themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ui-theme { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; min-height: 44px; }
.ui-theme.on { border: 2px solid var(--brand); }
.ui-sw { display: flex; height: 36px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.ui-sw > span:first-child { width: 30%; border-right: 1px solid var(--line); }
.ui-sw > span:last-child { flex: 1; display: flex; align-items: center; justify-content: center; } .ui-sw i { width: 40%; height: 9px; border-radius: 3px; }
.ui-colours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.ui-col { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13.5px; cursor: pointer; }
.ui-col > span { display: flex; flex-direction: column; }
.ui-col input[type=color] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.ui-pv { display: flex; height: 260px; border-radius: 10px; overflow: hidden; font-size: 12.5px; }
.ui-pv-side { width: 140px; flex-shrink: 0; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.ui-pv-side > span { padding: 6px 8px; border-radius: 6px; }
@media (max-width: 560px) { .ui-themes { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ui-colours { grid-template-columns: minmax(0, 1fr); } }

/* Settings → Instructions (1.18) */
.ins-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.ins-list { flex: 1 1 240px; max-width: 300px; overflow: hidden; }
.ins-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none !important; }
.ins-item:last-child { border-bottom: 0; }
.ins-item.on { background: var(--brand-soft); box-shadow: inset 3px 0 var(--brand); }
.ins-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ins-auto { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ins-auto legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
@media (max-width: 720px) { .ins-two { grid-template-columns: minmax(0, 1fr); } .ins-list { max-width: none; } }
@media (max-width: 640px) { .form-grid.dep-row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Public pay pages (1.19) */
.pay-wrap { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.pay-sum { display: flex; flex-direction: column; gap: 8px; }
.pay-sum > div { display: flex; justify-content: space-between; gap: 12px; }
.pay-due { border-top: 1px solid var(--line-2); padding-top: 10px; font-size: 17px; }
.pay-amt { height: 48px; font-size: 18px; font-weight: 600; }
.pay-btn { height: 50px; font-size: 16px; justify-content: space-between; width: 100%; }
.pay-btn .tiny { opacity: .8; }
.pay-tick { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }
.op-prov.on { border: 2px solid var(--brand); }
.op-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }

/* ---------- Clinical records (1.20) ---------- */
.pchip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.pchip:hover { text-decoration: none; color: var(--ink); }
.pchip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.cl-visit { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; }
.cl-visit:hover { text-decoration: none; border-color: var(--brand); }
.cl-visit .top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.cl-visit .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.cl-type { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.cl-type i { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.cl-next { border-style: dashed; }
.cl-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cl-thumbs.sm { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cl-thumb { display: flex; flex-direction: column; gap: 4px; color: inherit; min-width: 0; }
.cl-thumb img, .cl-thumb .ph { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: block; }
.cl-thumbs.sm .cl-thumb img { aspect-ratio: 1; }
.cl-thumb .ph { display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.cl-thumb span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-note { border-top: 1px solid var(--line-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cl-note:first-child { border-top: 0; }
.cl-note.draft { background: var(--warn-soft, #fff8e6); }
.cl-note.amend { margin-left: 18px; border-left: 3px solid var(--line); }
.cl-sec { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 6px 16px; font-size: 14px; line-height: 1.55; }
.cl-sec dt { color: var(--muted); }
.cl-sec dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-drop { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cl-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cl-compare img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.flag-low, .flag-high { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #fff1dc; color: #8a5300; }
@media (max-width: 700px) {
  .cl-sec { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cl-sec dd { margin-bottom: 8px; }
  .cl-compare { grid-template-columns: minmax(0, 1fr); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.soon { border-style: dashed; }
.soon-badge { background: var(--brand-soft); color: var(--brand); }
.seg button { padding: 6px 12px; font: inherit; font-size: 13px; color: var(--ink-2); background: none; border: 0; cursor: pointer; } .seg button + button { border-left: 1px solid var(--line); } .seg button.on { background: var(--brand); color: var(--brand-ink); }
