/* ClinicBooks 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;
  --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); 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: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink-2); font-weight: 500; margin: 1px 0; }
.nav a:hover { background: var(--line-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--brand); color: var(--brand-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: rgba(255,255,255,.92); 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: #fff; }
.gsearch .ic { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.gsearch .results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; 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: #fff; 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: #fff; 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), #fff 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: #fafbfc; 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: #fafbfc; }
.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: #fafbfc; 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: #fff; }
.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: #fff; }
.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: #fff; } }
.dg td a.lnk { font-weight: 600; }
.dg tfoot td { position: sticky; bottom: 0; background: #fafbfc; 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: #fff; 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: #fff; 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: #fff; 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: #fff; 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: #fafbfc; 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: #fafbfc; 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: rgba(255,255,255,.96); 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: #fff; 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: #fff; 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: #fff; 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: #fff; 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: #fff; 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: #fff; 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: #fafbfc; 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); }
.week.compact .appt { padding: 1px 6px; font-size: 11px; line-height: 1.2; }
.week.compact .appt b { font-size: 11.5px; }
.week { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.week .h { display: block; height: 48px; padding: 7px 4px; border-bottom: 1px solid var(--line); background: #fafbfc; font-weight: 600; font-size: 13px; text-align: center; color: var(--ink); text-decoration: none; }
.week .h small { display: block; color: var(--muted); font-weight: 500; }
.week .tcol > div:not(.h) { font-size: 11.5px; color: var(--muted); text-align: right; padding: 2px 8px 0 0; border-top: 1px solid var(--line-2); box-sizing: border-box; }
.week .col { border-left: 1px solid var(--line-2); min-width: 0; }
.week .col.is-today .h { background: var(--brand-soft); color: var(--brand); }
.week .col-body { position: relative; }
.week .slotline { border-top: 1px solid var(--line-2); box-sizing: border-box; cursor: pointer; }
.week .slotline:hover { background: var(--brand-soft); }
.week .slotline.off { background: repeating-linear-gradient(135deg, #fafbfc, #fafbfc 6px, #f3f4f6 6px, #f3f4f6 12px); cursor: default; }
.appt { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 3px 7px; font-size: 11.5px; line-height: 1.3; background: #fff4e0; border-left: 3px solid var(--warn); overflow: hidden; color: var(--ink-2); text-decoration: none !important; z-index: 1; }
.appt b { display: block; font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.gov { background: var(--ok-soft); border-color: var(--ok); } .appt.pvt { background: #efe9fb; border-color: #7b52cc; }
.appt.st-done { opacity: .55; } .appt.st-no_show { opacity: .4; text-decoration: line-through !important; }
.appt:hover { box-shadow: var(--shadow); }
@media (max-width: 1100px) {
  .diary-layout, .diary-layout.side-open { grid-template-columns: minmax(0, 1fr); } .week { overflow-x: auto; }
  .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: #fff; 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; }
.appt.blk { background: repeating-linear-gradient(135deg, #f1f2f5, #f1f2f5 6px, #e8eaee 6px, #e8eaee 12px); border-color: #9aa1ad; color: var(--muted); z-index: 0; }
.appt.blk b { color: var(--ink-2); font-weight: 600; }
.appt.unlinked { border-left-style: dashed; }
.timeline li.blk { background: repeating-linear-gradient(135deg, #fafbfc, #fafbfc 6px, #f3f4f6 6px, #f3f4f6 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: #fff; 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: #fff; }
.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: #fff; 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: #fff; }
.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: #fafbfc; 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: #fff; }
.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; 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 .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: #fff; 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; }
.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: #fff; 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); }
