/* 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 .results a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.gsearch .results a.hl, .gsearch .results 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: 34px; 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: 1fr; } .cols-3 { grid-template-columns: 1fr 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: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .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; } }
