@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212; }
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+1E00-1E9F; }
@font-face { font-family: 'Bricolage'; src: url('../fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2'); font-weight: 300 800; font-display: swap; }

/* ================= Tokens ================= */
:root {
  --brand: #1565d8; --brand2: #0fa89a; --on-brand: #fff;
  --bg: #f1f4f9; --surface: #ffffff; --surface2: #f6f8fc; --surface3: #edf1f7;
  --line: #e2e8f1; --line2: #cfd8e6;
  --text: #0e1b2c; --text2: #35465e; --muted: #5d6c84;
  --good: #0b7f57; --warn: #9a5b00; --bad: #c92f3c;
  --good-soft: #dcf5ea; --warn-soft: #fdf0d5; --bad-soft: #fde4e6;
  --accent-text: color-mix(in oklab, var(--brand) 88%, black);
  --brand-soft: color-mix(in oklab, var(--brand) 11%, var(--surface));
  --brand-line: color-mix(in oklab, var(--brand) 30%, var(--surface));
  --brand-strong: color-mix(in oklab, var(--brand) 86%, black);
  --chart-a: #2a6fdb; --chart-b: #d9690f;
  --shadow: 0 1px 2px rgb(16 32 56 / .05), 0 4px 16px -6px rgb(16 32 56 / .08);
  --shadow-lg: 0 24px 60px -16px rgb(10 24 48 / .3), 0 4px 14px rgb(10 24 48 / .1);
  --r-s: 9px; --r: 13px; --r-l: 20px;
  --side: 254px;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #080e17; --surface: #0f1927; --surface2: #142032; --surface3: #1a293e;
  --line: #1f2d43; --line2: #304261;
  --text: #e9eff8; --text2: #c2cfe2; --muted: #8e9fb9;
  --good: #4fd6a2; --warn: #f1b44c; --bad: #ff7d86;
  --good-soft: #0e2e26; --warn-soft: #33270f; --bad-soft: #391a22;
  --accent-text: color-mix(in oklab, var(--brand) 48%, white);
  --brand-soft: color-mix(in oklab, var(--brand) 22%, var(--surface));
  --brand-line: color-mix(in oklab, var(--brand) 48%, var(--surface));
  --brand-strong: color-mix(in oklab, var(--brand) 82%, white);
  --chart-a: #3f87ea; --chart-b: #d2711f;
  --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 6px 20px -8px rgb(0 0 0 / .5);
  --shadow-lg: 0 28px 70px -12px rgb(0 0 0 / .75), 0 0 0 1px rgb(255 255 255 / .04);
  color-scheme: dark;
}
/* Theme change: the new look grows out of the button that was pressed */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: reveal .55s var(--ease); }
@keyframes reveal { from { clip-path: circle(0 at var(--tx, 90%) var(--ty, 5%)); } to { clip-path: circle(150% at var(--tx, 90%) var(--ty, 5%)); } }

/* ================= Base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14.5px/1.5 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: 'Bricolage', 'Figtree', system-ui, sans-serif; line-height: 1.18; margin: 0; letter-spacing: -.012em; }
h1 { font-size: 27px; font-weight: 700; } h2 { font-size: 17px; font-weight: 650; } h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; } button:disabled { cursor: not-allowed; }
img { max-width: 100%; }
[hidden] { display: none !important; }
svg.lucide { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }
i[data-lucide] { display: inline-block; width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: color-mix(in oklab, var(--brand) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.t-good { color: var(--good); } .t-bad { color: var(--bad); } .t-warn { color: var(--warn); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--surface); padding: 10px 14px; border-radius: var(--r-s); }
.skip:focus { top: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ================= Buttons ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 15px; border: 1px solid var(--line2); border-radius: var(--r-s); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .16s, border-color .16s, transform .12s, box-shadow .16s; text-decoration: none; color: var(--text); position: relative; }
.btn:hover { background: var(--surface2); border-color: var(--muted); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px -8px var(--brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
:root[data-theme='dark'] .btn-danger { color: #2a0a0e; }
.btn-danger:hover { background: var(--bad); filter: brightness(1.08); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--accent-text); }
.btn-soft:hover { background: var(--brand-soft); border-color: var(--brand-line); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-sm svg.lucide { width: 15px; height: 15px; }
.btn-lg { min-height: 48px; font-size: 15px; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after { content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--on-brand); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-danger).busy::after { border-color: var(--brand); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-s); border: 1px solid transparent; background: transparent; color: var(--text2); position: relative; flex: none; transition: background .16s, color .16s; }
.icon-btn:hover { background: var(--surface3); color: var(--text); }
.icon-btn.sm { width: 31px; height: 31px; } .icon-btn.sm svg.lucide { width: 16px; height: 16px; }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.actions { display: flex; gap: 2px; justify-content: flex-end; }

/* ================= Forms ================= */
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > span:first-child, .label { font-weight: 600; font-size: 13px; color: var(--text2); }
input:not([type=checkbox]):not([type=radio]):not([type=color]), textarea, select { width: 100%; min-height: 42px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r-s); outline: none; transition: border-color .15s, box-shadow .15s; }
:root[data-theme='dark'] input:not([type=checkbox]):not([type=radio]):not([type=color]), :root[data-theme='dark'] textarea { background: var(--surface2); }
input:focus, textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3.5px color-mix(in oklab, var(--brand) 20%, transparent); }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input[type=number] { -moz-appearance: textfield; } input::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type=file] { padding: 5px !important; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: 700 13px 'Figtree', sans-serif; margin-right: 10px; padding: 7px 13px; border: 0; border-radius: 9px; background: var(--brand-soft); color: var(--accent-text); cursor: pointer; }
input[type=file]:hover::file-selector-button { background: var(--brand-line); color: var(--text); }
input:disabled, textarea:disabled { opacity: .65; }
.field.invalid input, .field.invalid textarea, .field.invalid .sel-btn { border-color: var(--bad) !important; }
.field-error { color: var(--bad); font-size: 12.5px; font-weight: 500; }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: var(--r-s); padding: 10px 13px; font-weight: 600; font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input, .perm input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.switch { appearance: none; width: 40px !important; height: 23px !important; border-radius: 30px; background: var(--line2); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #fff; left: 3px; top: 3px; transition: transform .22s var(--ease); box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.switch:checked { background: var(--brand); } .switch:checked::after { transform: translateX(17px); }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 44px !important; }
.input-wrap .peek { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); border-radius: 7px; }
.money-input { position: relative; display: block; }
.money-input b { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.money-input input { padding-left: 50px !important; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Custom select, date and popovers */
select.enhanced, input.enhanced { display: none !important; }
.sel { position: relative; min-width: 0; display: block; }
.sel-btn { width: 100%; min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 12px; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r-s); text-align: left; transition: border-color .15s, box-shadow .15s; }
:root[data-theme='dark'] .sel-btn { background: var(--surface2); }
.sel-btn:hover { border-color: var(--muted); }
.sel-btn[aria-expanded=true], .sel-btn:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3.5px color-mix(in oklab, var(--brand) 20%, transparent); outline: none; }
.sel-btn:disabled { opacity: .6; }
.sel-btn .sel-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn .placeholder { color: var(--muted); }
.sel-btn svg.lucide { width: 16px; height: 16px; color: var(--muted); }
.pop { position: fixed; z-index: 140; background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow-lg); animation: pop .16s var(--ease); overflow: hidden; display: flex; flex-direction: column; }
:root[data-theme='dark'] .pop { background: var(--surface2); }
.pop.up { animation-name: popup; }
@keyframes pop { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
@keyframes popup { from { opacity: 0; transform: translateY(5px) scale(.98); } }
.pop-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pop-search input { border: 0 !important; box-shadow: none !important; background: transparent !important; min-height: 28px !important; padding: 2px 0 !important; color: var(--text); }
.pop-list { overflow-y: auto; padding: 5px; overscroll-behavior: contain; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; }
.opt .grow { overflow: hidden; }
.opt b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt.active { background: var(--surface3); }
.opt[aria-selected=true] b { color: var(--accent-text); font-weight: 700; }
.opt[aria-selected=true] svg.lucide { color: var(--accent-text); }
.opt[aria-disabled=true] { opacity: .45; }
.pop-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.pop-group { padding: 8px 10px 3px; font-size: 12px; color: var(--muted); font-weight: 700; }
.cal { padding: 10px; width: 292px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { border: 0; background: none; font-weight: 700; padding: 6px 10px; border-radius: 8px; }
.cal-title:hover { background: var(--surface3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid.big { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cal-grid span { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 3px 0; }
.cal-day { border: 0; background: none; height: 36px; border-radius: 9px; font-variant-numeric: tabular-nums; }
.cal-day:hover:not(:disabled) { background: var(--surface3); }
.cal-day.other { color: var(--muted); opacity: .55; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.cal-day.picked { background: var(--brand); color: var(--on-brand); font-weight: 700; opacity: 1; }
.cal-day:disabled { opacity: .25; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; }

/* Segmented control and tabs */
.seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface3); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(10 25 50 / .12); }
:root[data-theme='dark'] .seg button.on { background: var(--line2); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-pick { display: inline-flex; cursor: pointer; }
.chip-pick input { position: absolute; opacity: 0; pointer-events: none; }
.chip-pick span { padding: 7px 13px; border: 1px solid var(--line2); border-radius: 30px; font-size: 13px; font-weight: 600; transition: .15s; }
.chip-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip-pick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.searchbox { position: relative; flex: 1 1 240px; max-width: 380px; }
.searchbox svg.lucide { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.searchbox input { padding-left: 40px !important; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .sel { width: 175px; } .toolbar .sel.date { width: 165px; }

/* ================= Shell ================= */
.sidebar { position: fixed; inset: 12px auto 12px 12px; width: var(--side); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); display: flex; flex-direction: column; z-index: 60; transition: transform .32s var(--ease), width .28s var(--ease); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 12px; min-width: 0; }
.brand:hover { text-decoration: none; }
.logo-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: linear-gradient(140deg, var(--brand), var(--brand2)); color: #fff; overflow: hidden; }
.logo-tile svg.lucide { width: 22px; height: 22px; stroke-width: 2.6; }
.logo-tile img { display: none; width: 100%; height: 100%; object-fit: contain; }
.logo-tile.has-img { background: #fff; box-shadow: inset 0 0 0 1px #e2e8f1; padding: 3px; }
.logo-tile.has-img img { display: block; } .logo-tile.has-img svg { display: none; }
.brand-text { min-width: 0; color: var(--text); }
.brand-text b { display: block; font-family: 'Bricolage', sans-serif; font-size: 15.5px; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brand-text small { color: var(--muted); font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; overscroll-behavior: contain; }
.nav h4 { font: 600 12px 'Figtree', sans-serif; color: var(--muted); padding: 14px 10px 5px; letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 11px; color: var(--text2); font-weight: 550; position: relative; transition: background .16s, color .16s; }
.nav a:hover { background: var(--surface3); text-decoration: none; color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--accent-text); font-weight: 700; }
.nav a.on::before { content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav a .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 20px; background: var(--surface3); color: var(--text2); font-size: 11.5px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.nav a.on .count { background: var(--brand); color: var(--on-brand); }
.side-foot { padding: 10px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 12px; width: 100%; border: 0; background: none; text-align: left; }
.me:hover { background: var(--surface3); }
.me b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); }
.me .grow { overflow: hidden; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 13px; background: color-mix(in oklab, hsl(var(--h, 215) 70% 50%) 18%, var(--surface)); color: color-mix(in oklab, hsl(var(--h, 215) 70% 45%) 75%, var(--text)); }
.avatar.lg { width: 66px; height: 66px; font-size: 22px; font-family: 'Bricolage', sans-serif; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.main { margin-left: calc(var(--side) + 24px); padding: 0 20px 40px 4px; min-height: 100vh; transition: margin .28s var(--ease); }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 12px 0; background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.search-trigger { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 13px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; color: var(--muted); width: min(400px, 100%); min-width: 0; }
.search-trigger:hover { border-color: var(--line2); }
.search-trigger span { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font: 600 11px 'Figtree', sans-serif; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.spacer { flex: 1; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--good); padding: 5px 11px; border-radius: 30px; background: var(--good-soft); }
.live svg { width: 30px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.live path { stroke-dasharray: 60; animation: beat 2.4s linear infinite; }
.live.off { color: var(--warn); background: var(--warn-soft); } .live.off path { animation: none; stroke-dasharray: 3 5; }
@keyframes beat { from { stroke-dashoffset: 120; } to { stroke-dashoffset: 0; } }
.bell-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--bg); }
.progress { position: fixed; top: 0; left: 0; height: 2.5px; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand2)); z-index: 300; opacity: 0; transition: width .5s var(--ease), opacity .3s; }
.progress.on { opacity: 1; width: 75%; } .progress.done { width: 100%; opacity: 0; }
.view { outline: none; max-width: 1480px; margin: 0 auto; padding-top: 4px; }
.view > .page { animation: enter .28s var(--ease); display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 4px 0 2px; }
.page-head p { color: var(--muted); margin-top: 3px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.scrim { position: fixed; inset: 0; background: rgb(5 12 24 / .5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.dock { display: none; }
body.mini { --side: 78px; }
@media (min-width: 1001px) {
  body.mini .brand-text, body.mini .nav h4, body.mini .nav a span, body.mini .me .grow, body.mini .me > svg { display: none; }
  body.mini .nav h4 { display: block; height: 1px; padding: 0; margin: 10px 8px; background: var(--line); overflow: hidden; color: transparent; }
  body.mini .brand { justify-content: center; padding-inline: 8px; }
  body.mini .nav a { justify-content: center; }
  body.mini .nav a .count { position: absolute; top: 2px; right: 4px; display: block; min-width: 18px; padding: 0 4px; font-size: 10px; }
  body.mini .me { justify-content: center; }
  .menu-btn { display: none; }
}
@media (max-width: 1000px) {
  .collapse-btn { display: none; }
  .sidebar { transform: translateX(calc(-100% - 20px)); width: 266px; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding: 0 14px 40px; }
  .search-trigger { width: auto; flex: 1; } .search-trigger kbd { display: none; } .topbar .spacer { display: none; }
}

/* ================= Surfaces ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-body { padding: 16px 18px 18px; }
.card-body.tight { padding: 8px 8px 10px; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 15px 17px; box-shadow: var(--shadow); display: grid; gap: 4px; align-content: start; min-width: 0; }
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 600; font-size: 13px; gap: 8px; }
.stat .stat-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--accent-text); }
.stat.good .stat-icon { background: var(--good-soft); color: var(--good); } .stat.warn .stat-icon { background: var(--warn-soft); color: var(--warn); } .stat.bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.stat strong { font-family: 'Bricolage', sans-serif; font-size: 26px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.stat small { color: var(--muted); }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stats.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.tiles:where(:has(> :nth-child(4):last-child)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats.tiles:where(:has(> :nth-child(5):last-child)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats.tiles:where(:has(> :nth-child(7):last-child), :has(> :nth-child(8):last-child)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1700px) { .stats.tiles.tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .stats.tiles.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .stats.tiles.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 10px; border-radius: 30px; font-size: 12px; font-weight: 700; background: var(--surface3); color: var(--text2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--brand-soft); color: var(--accent-text); }
.badge svg.lucide { width: 12px; height: 12px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr[data-link] { cursor: pointer; }
.table tbody tr:hover { background: var(--surface2); }
.table .right { text-align: right; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line2); border-bottom: 0; }
.table tr.struck td:not(:last-child) { text-decoration: line-through; opacity: .55; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who b { display: block; font-weight: 650; } .who small { color: var(--muted); display: block; font-size: 12.5px; }
@media (max-width: 720px) {
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  /* The label sits left; everything in the cell stays together on the right */
  .table.cards td { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 8px; border: 0; padding: 3px 0; text-align: right; }
  .table.cards td::before { content: attr(data-label); margin-right: auto; padding-right: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; }
  .table.cards td:first-child { text-align: left; justify-content: flex-start; padding-bottom: 6px; }
  .table.cards td:first-child::before, .table.cards td[data-label='']::before { display: none; }
  .table.cards td[data-label=''] { justify-content: flex-end; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .row { gap: 5px; }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 38px 20px; color: var(--muted); }
.empty .empty-icon { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: var(--brand-soft); color: var(--accent-text); }
.empty .empty-icon svg { width: 26px; height: 26px; }
.empty b { color: var(--text); font-size: 15px; }
.empty p { max-width: 42ch; }
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--surface3) 25%, var(--surface2) 50%, var(--surface3) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { display: grid; gap: 12px; padding: 18px; }

.list { display: grid; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: var(--text); width: 100%; border: 0; background: none; text-align: left; }
a.item:hover, button.item:hover { background: var(--surface2); text-decoration: none; }
.item .grow { overflow: hidden; }
.item b { display: block; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-tag { font-family: 'Bricolage', sans-serif; font-weight: 700; font-size: 13.5px; min-width: 52px; text-align: center; padding: 6px 4px; border-radius: 10px; background: var(--surface3); font-variant-numeric: tabular-nums; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12.5px; font-weight: 600; } .facts dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; white-space: pre-line; }
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 15px; border-radius: var(--r); background: var(--brand-soft); color: var(--text); }
.alert.warn { background: var(--warn-soft); } .alert.bad { background: var(--bad-soft); }
.alert.bad > svg { color: var(--bad); } .alert.warn > svg { color: var(--warn); }

/* ================= Dashboard: live patient flow ================= */
.flow { padding: 18px; overflow: hidden; }
.flow-rail { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; overflow-x: auto; padding: 14px 2px 2px; }
.stage { position: relative; min-width: 0; }
.stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; position: relative; }
.stage-node { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line2); color: var(--muted); z-index: 1; flex: none; transition: .3s; }
.stage.busy-now .stage-node { border-color: var(--brand); background: var(--brand-soft); color: var(--accent-text); }
.stage:last-child .stage-node { border-color: var(--good); color: var(--good); background: var(--good-soft); }
.stage-head::after { content: ''; position: absolute; left: 46px; right: -12px; top: 22px; height: 2px; background: linear-gradient(90deg, var(--brand-line), var(--line)); }
.stage:last-child .stage-head::after { display: none; }
.stage-meta { position: relative; z-index: 1; background: var(--surface); padding: 0 6px 0 0; }
.stage-meta strong { display: block; font-family: 'Bricolage', sans-serif; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.stage-meta span { color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.mini-patient { display: block; padding: 8px 10px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--line); margin-bottom: 6px; color: var(--text); transition: border-color .15s, transform .15s; }
.mini-patient:hover { text-decoration: none; border-color: var(--brand-line); transform: translateY(-1px); }
.mini-patient b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-patient small { color: var(--muted); font-size: 11.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-patient.urgent { border-color: var(--warn); background: var(--warn-soft); } .mini-patient.emergency { border-color: var(--bad); background: var(--bad-soft); }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 30% { color: var(--accent-text); transform: scale(1.22); } }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.quick button, .quick a { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); font-weight: 650; color: var(--text); text-align: left; transition: .16s; box-shadow: var(--shadow); }
.quick button:hover, .quick a:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.quick svg.lucide { color: var(--accent-text); width: 21px; height: 21px; }

/* ================= Charts ================= */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font: 500 11px 'Figtree', sans-serif; font-variant-numeric: tabular-nums; }
.chart .bar-a { fill: var(--chart-a); } .chart .bar-b { fill: var(--chart-b); }
.chart .hit { fill: transparent; } .chart g.col:hover .hit { fill: color-mix(in oklab, var(--text) 6%, transparent); }
.legend { display: flex; gap: 14px; font-size: 12.5px; font-weight: 600; color: var(--text2); flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; background: var(--chart-a); }
.legend i.b { background: var(--chart-b); }
.tip { position: fixed; z-index: 220; pointer-events: none; background: var(--text); color: var(--surface); padding: 8px 11px; border-radius: 10px; font-size: 12.5px; font-weight: 550; box-shadow: var(--shadow-lg); white-space: nowrap; }
.tip b { display: block; margin-bottom: 2px; }
.hbars { display: grid; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.hbar-top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--surface3); border-radius: 8px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--chart-a); transition: width .6s var(--ease); }

/* ================= Visit board ================= */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.lane { background: var(--surface3); border-radius: var(--r-l); padding: 10px; min-height: 280px; transition: box-shadow .15s, background .15s; }
.lane.drop { box-shadow: inset 0 0 0 2px var(--brand); background: var(--brand-soft); }
.lane-head { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px 10px; font-weight: 700; gap: 8px; }
.lane-head span { display: flex; align-items: center; gap: 8px; }
.lane-body { display: grid; gap: 9px; max-height: 62vh; overflow-y: auto; overscroll-behavior: contain; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); display: grid; gap: 8px; cursor: grab; }
.ticket.urgent { border-color: var(--warn); box-shadow: inset 0 3px 0 var(--warn), var(--shadow); }
.ticket.emergency { border-color: var(--bad); box-shadow: inset 0 3px 0 var(--bad), var(--shadow); }
.lane[data-lane=completed] .ticket.emergency { border-color: var(--line); box-shadow: var(--shadow); }
.ticket.dragging { opacity: .4; }
.ticket a.name { font-weight: 700; color: var(--text); }
.ticket p { font-size: 13px; color: var(--text2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ================= Appointment calendar ================= */
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.month > span { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px; }
.month button { min-height: 76px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 8px; text-align: left; transition: .14s; min-width: 0; }
.month button:hover { border-color: var(--brand); }
.month button.other { background: var(--surface2); color: var(--muted); }
.month button.today b { background: var(--brand); color: var(--on-brand); border-radius: 7px; padding: 0 7px; }
.month button.picked { box-shadow: 0 0 0 2px var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.month small { font-size: 11.5px; font-weight: 700; color: var(--accent-text); }
@media (max-width: 720px) { .month button { min-height: 52px; padding: 5px; } .month small span { display: none; } }

/* ================= Cards grids ================= */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 17px; box-shadow: var(--shadow); display: grid; gap: 12px; align-content: start; min-width: 0; }
.tile.off { opacity: .6; }
.tile-top { display: flex; gap: 12px; align-items: center; }
.tile-top .grow b { display: block; font-size: 15px; } .tile-top .grow small { color: var(--muted); }
.price { font-family: 'Bricolage', sans-serif; font-size: 21px; font-weight: 700; }

.wallet-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--accent-text); flex: none; overflow: hidden; }
.wallet-icon img { width: 100%; height: 100%; object-fit: cover; }
.wallet-icon.sm { width: 32px; height: 32px; border-radius: 10px; }
.wallet-balance { font-family: 'Bricolage', sans-serif; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ================= Money desk ================= */
.desk { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.kinds label { cursor: pointer; }
.kinds input { position: absolute; opacity: 0; }
.kinds div { border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 5px; transition: .16s; height: 100%; }
.kinds div b { font-size: 14px; } .kinds div small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.kinds div:hover { border-color: var(--line2); }
.kinds input:checked + div { border-color: var(--brand); background: var(--brand-soft); }
.kinds input:checked + div svg { color: var(--accent-text); }
.kinds input:focus-visible + div { outline: 2px solid var(--brand); outline-offset: 2px; }
.split-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 160px) auto; gap: 9px; align-items: start; }
.receipt-preview { position: sticky; top: 76px; }
.slip { border: 1.5px dashed var(--line2); border-radius: var(--r); padding: 16px; display: grid; gap: 11px; background: var(--surface2); }
.slip-amount { font-family: 'Bricolage', sans-serif; font-size: 32px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.slip-line { display: flex; justify-content: space-between; gap: 14px; font-size: 13.5px; }
.slip-line span:first-child { color: var(--muted); } .slip-line span:last-child { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.slip hr { border: 0; border-top: 1px dashed var(--line2); margin: 2px 0; }

/* Lines editor (prescriptions, invoice items) */
.lines { display: grid; gap: 10px; }
.line { display: grid; gap: 8px; align-items: start; grid-template-columns: minmax(0, 2.2fr) minmax(0, .6fr) minmax(0, 1fr) auto; }
.line.rx { grid-template-columns: repeat(6, minmax(0, 1fr)) auto; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.line.rx > :nth-child(1), .line.rx > :nth-child(2) { grid-column: span 3; }
.line.rx > :nth-child(3), .line.rx > :nth-child(4), .line.rx > :nth-child(5) { grid-column: span 2; grid-row: 2; }
.line.rx > :nth-child(6) { grid-column: 7; grid-row: 1; }
.totals { margin-left: auto; width: min(320px, 100%); display: grid; gap: 7px; }
.totals .slip-line.big { font-size: 18px; font-weight: 800; border-top: 2px solid var(--line2); padding-top: 8px; }
.totals .slip-line span:last-child { white-space: nowrap; }

.perm-group { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.perm-group h3 { padding: 11px 15px; background: var(--surface2); border-bottom: 1px solid var(--line); }
.perm { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 15px; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm:last-child { border-bottom: 0; }
.perm.child { padding-left: 30px; }
.perm.locked { opacity: .45; cursor: not-allowed; }
.perm-grid { columns: 2 340px; column-gap: 14px; }
.perm-grid > * { break-inside: avoid; margin-bottom: 14px; }
.perm .sel { width: 150px; flex: none; }

.timeline { display: grid; gap: 14px; position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.event { position: relative; }
.event::before { content: ''; position: absolute; left: -24px; top: 20px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 38px; height: 38px; border-radius: 12px; border: 2px solid transparent; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); box-shadow: inset 0 0 0 2px var(--surface); transition: transform .15s; }
.swatch:hover { transform: scale(1.08); } .swatch.on { border-color: var(--text); }
input[type=color] { width: 52px; height: 42px; padding: 3px; border: 1px solid var(--line2); border-radius: var(--r-s); background: var(--surface); cursor: pointer; }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.theme-card { border: 1.5px solid var(--line); border-radius: var(--r); padding: 8px; background: none; display: grid; gap: 7px; justify-items: center; font-weight: 650; font-size: 13px; transition: .16s; }
.theme-card:hover { border-color: var(--line2); }
.theme-card.on { border-color: var(--brand); background: var(--brand-soft); }
.theme-art { width: 100%; height: 46px; border-radius: 8px; border: 1px solid var(--line2); background: #f1f4f9; position: relative; overflow: hidden; }
.theme-art::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 24%; border-radius: 4px; background: #fff; }
.theme-art::after { content: ''; position: absolute; left: calc(24% + 12px); right: 6px; top: 8px; height: 9px; border-radius: 4px; background: var(--brand); }
.theme-art.dark { background: #080e17; } .theme-art.dark::before { background: #16243a; }
.theme-art.system { background: linear-gradient(105deg, #f1f4f9 50%, #080e17 50%); } .theme-art.system::before { background: #fff; }

/* ================= Modal, toasts, search ================= */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgb(6 14 28 / .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: grid; place-items: center; padding: 18px; animation: fade .2s; }
:root[data-theme='dark'] .overlay { background: rgb(0 3 9 / .68); }
.overlay.closing { animation: fade .18s reverse forwards; }
.overlay.closing .modal { animation: rise .18s reverse forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 36px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: rise .28s var(--ease); }
.modal.lg { width: min(780px, 100%); } .modal.xl { width: min(980px, 100%); } .modal.sm { width: min(430px, 100%); }
.modal-head { display: flex; align-items: center; gap: 13px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--accent-text); flex: none; }
.modal.danger .modal-icon { background: var(--bad-soft); color: var(--bad); }
.modal-head .grow p { color: var(--muted); font-size: 13px; }
.modal form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 15px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 250; display: grid; gap: 9px; width: min(370px, calc(100vw - 36px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line2); box-shadow: var(--shadow-lg); font-weight: 550; animation: slide .3s var(--ease); }
.toast.good > svg { color: var(--good); } .toast.bad > svg { color: var(--bad); } .toast.warn > svg { color: var(--warn); } .toast.info > svg { color: var(--accent-text); }
.toast.out { animation: slide .22s reverse forwards; }
@keyframes slide { from { opacity: 0; transform: translateX(30px); } }
.palette { align-items: start; padding-top: 11vh; }
.palette .modal { width: min(620px, 100%); }
.palette .pop-search { padding: 14px 18px; }
.palette .pop-search input { font-size: 16px; }
.palette .pop-list { max-height: 55vh; padding: 8px; }
.menu { min-width: 230px; padding: 6px; }
.menu a, .menu button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border: 0; background: none; border-radius: 9px; font-weight: 550; color: var(--text); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface3); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.panel { width: min(340px, calc(100vw - 24px)); }
.panel .pad { padding: 14px; display: grid; gap: 14px; overflow-y: auto; }

/* ================= Sign in and setup ================= */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-theme { position: fixed; right: 16px; top: 16px; z-index: 5; background: var(--surface); border-color: var(--line); }
.auth-shell { width: min(940px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow-lg); animation: rise .45s var(--ease); }
.auth-art { padding: 36px; color: #fff; background: radial-gradient(120% 90% at 100% 0, var(--brand2), transparent 60%), linear-gradient(160deg, var(--brand), color-mix(in oklab, var(--brand) 55%, #04101f)); display: flex; flex-direction: column; justify-content: space-between; gap: 28px; min-height: 520px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-family: 'Bricolage', sans-serif; }
.auth-art .logo-tile:not(.has-img) { background: rgb(255 255 255 / .18); }
.auth-art p { font-family: 'Bricolage', sans-serif; font-size: 27px; line-height: 1.25; font-weight: 600; max-width: 15em; }
.ecg { width: 100%; height: 150px; fill: none; stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ecg path { stroke-dasharray: 1100; stroke-dashoffset: 1100; animation: draw 2.4s .3s var(--ease) forwards; vector-effect: non-scaling-stroke; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.auth-form { display: grid; align-content: center; padding: 40px; }
.auth-form form { display: grid; gap: 15px; }
.auth-logo-mobile { display: none; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.setup { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 30px; box-shadow: var(--shadow-lg); }
.setup form { display: grid; gap: 16px; }
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 440px; }
  .auth-art { display: none; }
  .auth-form { padding: 28px 22px; }
  .auth-logo-mobile { display: grid; }
}

.table-toggle { margin-top: 10px; }
.table-toggle summary { cursor: pointer; font-weight: 650; font-size: 13px; color: var(--accent-text); width: max-content; }
.table-toggle .table-wrap { margin-top: 8px; max-height: 300px; overflow: auto; }

html.locked, html.locked body { overflow: hidden; }
.logo-preview { display: flex; align-items: center; gap: 16px; }
.logo-preview .logo-tile { width: 76px; height: 76px; border-radius: 20px; }
.report-pick { text-align: left; transition: border-color .16s, box-shadow .16s; }
.report-pick:hover { border-color: var(--line2); }
.report-pick.on { border-color: var(--brand); background: var(--brand-soft); }
.report-pick small { display: block; }
.report-scroll { max-height: 62vh; overflow: auto; }
.report-scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* Appears at the bottom only while something is unsaved */
.save-bar { position: sticky; bottom: 14px; z-index: 30; display: none; align-items: center; gap: 10px; padding: 11px 12px 11px 18px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line2); box-shadow: var(--shadow-lg); font-weight: 650; }
.save-bar.show { display: flex; animation: enter .22s var(--ease); }
@media (max-width: 920px) { .save-bar { bottom: 86px; flex-wrap: wrap; } .save-bar .grow { flex-basis: 100%; } }

/* ================= Responsive ================= */
@media (max-width: 1180px) { .cols, .desk { grid-template-columns: minmax(0, 1fr); } .receipt-preview { position: static; } .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .live span { display: none; } }
@media (max-width: 360px) { .live:not(.off) { display: none; } }
@media (max-width: 700px) {
  .line.rx { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .line.rx > :nth-child(n) { grid-column: auto; grid-row: auto; }
  .line.rx > :nth-child(1) { grid-column: 1 / 3; }
  .line.rx > :nth-child(6) { grid-column: 3; grid-row: 1; }
  .line.rx > :nth-child(5) { grid-column: 1 / 3; }
}
@media (max-width: 700px) {
  body.app { padding-bottom: 70px; }
  h1 { font-size: 23px; }
  .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .grid4.vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .line > :first-child { grid-column: 1 / -1; }
  .split-line { grid-template-columns: minmax(0, 1fr) 110px auto; }
  .toolbar .sel, .toolbar .sel.date, .searchbox { width: 100%; max-width: none; flex: 1 1 100%; }
  .overlay { padding: 0; place-items: end stretch; }
  .overlay .modal { width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .palette { padding: 12px; place-items: start stretch; } .palette .modal { border-radius: 20px; }
  .dock { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 10px; right: 10px; bottom: max(8px, env(safe-area-inset-bottom)); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); z-index: 45; padding: 5px; }
  .dock a, .dock button { display: grid; justify-items: center; gap: 2px; padding: 7px 2px; font-size: 11px; font-weight: 650; color: var(--muted); border: 0; background: none; border-radius: 14px; }
  .dock a.on { color: var(--accent-text); background: var(--brand-soft); }
  .dock a:hover { text-decoration: none; }
  .toasts { bottom: 86px; }
  /* The bottom bar already has the menu button */
  body.app .menu-btn { display: none; }
  .topbar { gap: 7px; }
}
@media (max-width: 700px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 13px; }
  /* Report choices become a compact two-column list so the report is close by */
  .tiles:has(> .report-pick) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .report-pick { padding: 10px; }
  .report-pick small, .report-pick .wallet-icon { display: none; }
}
@media (max-width: 420px) { .stat strong { font-size: 21px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* ================= Pharmacy: shared pieces ================= */
.thumb { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; overflow: hidden; background: var(--brand-soft); color: var(--accent-text); }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.thumb.lg { width: 72px; height: 72px; border-radius: var(--r); } .thumb.lg svg.lucide { width: 28px; height: 28px; }
.thumb.xl { width: 84px; height: 84px; border-radius: var(--r-l); } .thumb.xl svg.lucide { width: 34px; height: 34px; }
.center { text-align: center; }
.wrap, .item b.wrap { white-space: normal; overflow-wrap: anywhere; }
.item.wraps b, .item.wraps small { white-space: normal; overflow-wrap: anywhere; }
.item.wraps { align-items: flex-start; }
.item.wraps > svg.lucide { margin-top: 3px; }
.item.plain { padding-inline: 0; }
.chips .chip { padding: 7px 14px; border: 1px solid var(--line2); border-radius: 30px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text2); white-space: nowrap; transition: .15s; }
.chips .chip:hover { border-color: var(--muted); color: var(--text); }
.chips .chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn .count { font-style: normal; min-width: 21px; padding: 0 6px; border-radius: 20px; background: var(--brand); color: var(--on-brand); font-size: 11.5px; line-height: 21px; text-align: center; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: var(--r-s); background: var(--surface); overflow: hidden; flex: none; }
.stepper button { width: 32px; height: 34px; border: 0; background: none; display: grid; place-items: center; color: var(--text2); }
.stepper button:hover { background: var(--surface3); color: var(--text); }
.stepper button svg.lucide { width: 15px; height: 15px; }
.stepper input[inputmode]:not([type=checkbox]):not([type=radio]) { width: 50px; min-height: 34px; padding: 2px; border: 0; border-inline: 1px solid var(--line); border-radius: 0; text-align: center; font-weight: 700; background: transparent; font-variant-numeric: tabular-nums; }
.stat-button { display: grid; border: 0; padding: 0; background: none; text-align: left; border-radius: var(--r-l); min-width: 0; }
.stat-button .stat { transition: border-color .16s, transform .16s; }
.stat-button:hover .stat { border-color: var(--brand); transform: translateY(-2px); }
.pay-total { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 13px 18px; border-radius: var(--r); background: var(--brand-soft); }
.pay-total span { font-weight: 650; color: var(--text2); }
.pay-total strong { font-family: 'Bricolage', sans-serif; font-size: 30px; line-height: 1.1; overflow-wrap: anywhere; }
.pay-note { font-weight: 650; padding: 9px 13px; border-radius: var(--r-s); }
.pay-note:empty { display: none; }
.pay-note.on { background: var(--good-soft); color: var(--good); }
.pay-note.bad { background: var(--bad-soft); color: var(--bad); }

/* ================= Point of sale ================= */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 16px; align-items: start; }
.pos-shelf { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; }
.searchbox.pos-search { max-width: none; flex: none; }
.pos-search input { min-height: 50px; font-size: 15.5px; border-radius: var(--r) !important; box-shadow: var(--shadow); }
.pos-search svg.lucide { top: 16px; left: 15px; }
.pos-search input[type=search] { padding-left: 46px !important; }
.pos-cats:empty { display: none; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(162px, 1fr)); gap: 11px; }
.pos-item { position: relative; display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow); text-align: left; min-width: 0; transition: border-color .15s, transform .12s; }
.pos-item:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-2px); }
.pos-item:active:not(:disabled) { transform: scale(.98); }
.pos-item:disabled { opacity: .55; }
.pos-item .thumb.lg { width: 100%; height: 82px; }
.pos-name { display: block; min-width: 0; flex: 1; }
.pos-name b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.pos-name small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.pos-foot strong { font-family: 'Bricolage', sans-serif; font-size: 15px; }
.pos-foot small { font-size: 12px; font-weight: 600; }
.pos-count { position: absolute; top: 6px; right: 6px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 30px; background: var(--brand); color: var(--on-brand); font-style: normal; font-weight: 800; font-size: 13px; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--surface); }

.card.cart { position: sticky; top: 72px; display: flex; flex-direction: column; max-height: calc(100dvh - 86px); overflow: hidden; }
.cart > .card-head { padding-bottom: 12px; flex: none; }
.cart-close { display: none; }
.cart-form { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow-y: auto; }
.cart-who { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); flex: none; }
.row.cart-patient { flex-wrap: nowrap; gap: 6px; }
.cart-who .grid2 { gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cart-lines { flex: 1 1 auto; min-height: 118px; overflow-y: auto; padding: 0 16px; }
.cart-lines .empty { padding: 24px 6px; gap: 5px; }
.cart-lines .line { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0; border-bottom: 1px dashed var(--line2); }
.cart-lines .line:last-child { border-bottom: 0; }
.cart-lines .line.flash { animation: line-flash .9s var(--ease); }
@keyframes line-flash { 25% { background: var(--brand-soft); } }
.line-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.line-top b { font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; padding-top: 5px; }
.line-low { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; }
.line-price { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; min-width: 0; }
.line-price input[data-price]:not([type=checkbox]):not([type=radio]) { width: 88px; min-height: 34px; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.line-amount { margin-left: auto; white-space: nowrap; }
.cart-sum { display: grid; gap: 7px; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--surface2); flex: none; }
.cart-sum .r-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--text2); }
.cart-adjust { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cart-adjust label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); white-space: nowrap; min-width: 0; }
.cart-adjust input:not([type=checkbox]):not([type=radio]):not([type=color]) { flex: 1; width: 100%; min-width: 0; min-height: 34px; padding: 3px 9px; text-align: right; font-variant-numeric: tabular-nums; }
.cart-sum .r-line.cart-total { color: var(--text); font-weight: 700; padding-top: 5px; border-top: 1px dashed var(--line2); }
.cart-total strong { font-family: 'Bricolage', sans-serif; font-size: 27px; line-height: 1.15; overflow-wrap: anywhere; text-align: right; }
.cart-sum .btn-lg { white-space: normal; }
.cart-more { flex-wrap: nowrap; gap: 8px; }
.pos-bar, .cart-scrim { display: none; }
@media (max-width: 1260px) and (min-width: 1001px) { .pos { grid-template-columns: minmax(0, 1fr) 350px; } .pos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
@media (max-width: 1000px) {
  .pos { grid-template-columns: minmax(0, 1fr); }
  .view > .page:has(.pos) { padding-bottom: 76px; }
  .pos-bar { display: flex; position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 44; justify-content: flex-start; box-shadow: var(--shadow-lg); }
  .pos-bar:hover { background: var(--brand); }
  .pos-bar .grow { text-align: left; }
  .cart-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgb(5 12 24 / .55); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .cart-open .cart-scrim { opacity: 1; pointer-events: auto; }
  .card.cart { position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0 auto; width: min(560px, 100%); height: 92dvh; max-height: 92dvh; z-index: 70; border-radius: 22px 22px 0 0; transform: translateY(105%); visibility: hidden; transition: transform .32s var(--ease), visibility 0s .32s; }
  .cart-open .card.cart { transform: none; visibility: visible; transition: transform .32s var(--ease), visibility 0s; }
  .cart-close { display: inline-grid; }
  .cart-form { overscroll-behavior: contain; }
  .cart-lines { flex: 1 0 auto; overflow: visible; min-height: 130px; }
}
@media (max-width: 700px) {
  .pos-bar { bottom: 82px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 9px; }
  .pos-cats .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  input[name], .stepper input[inputmode]:not([type=checkbox]):not([type=radio]) { scroll-margin: 90px; }
}

/* ================= Receipt ================= */
.receipt-shell { background: var(--surface3); border-radius: var(--r); padding: 16px 10px; }
.receipt { width: min(300px, 100%); margin: 0 auto; padding: 18px 15px; background: #fff; color: #111; font-size: 12.5px; line-height: 1.45; border-radius: 4px; box-shadow: 0 8px 24px -12px rgb(0 0 0 / .35); }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r-head { display: grid; justify-items: center; text-align: center; gap: 1px; }
.receipt .r-head img { max-height: 46px; max-width: 150px; object-fit: contain; margin-bottom: 5px; }
.receipt .r-head b { font-size: 15px; }
.receipt .r-line { display: flex; justify-content: space-between; gap: 10px; }
.receipt .r-line span { min-width: 0; overflow-wrap: anywhere; }
.receipt .r-line span:last-child { text-align: right; flex: none; max-width: 65%; font-variant-numeric: tabular-nums; }
.receipt .r-item { margin-bottom: 4px; }
.receipt .r-item > span { display: block; font-weight: 650; overflow-wrap: anywhere; }
.receipt .r-item small { display: block; color: #555; }
.receipt .r-total { font-weight: 800; font-size: 14px; margin: 3px 0; }
.receipt .r-foot { text-align: center; overflow-wrap: anywhere; white-space: pre-line; }

/* ================= Sales history and products ================= */
.clip-cell .clip { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-cell > .muted { display: block; }
.returns { display: grid; grid-template-columns: minmax(0, 1fr); }
.return-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 220px; gap: 10px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.return-line b { display: block; } .return-line small { display: block; font-size: 12.5px; }
.returns + .btn { justify-self: start; margin-top: 6px; }
@media (max-width: 620px) { .return-line { grid-template-columns: minmax(0, 1fr) auto; } .return-line .sel { grid-column: 1 / -1; } .clip-cell .clip { max-width: 100%; white-space: normal; } }
.seg.tabs { justify-self: start; }
.seg.tabs svg.lucide { width: 15px; height: 15px; }
.product-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.product-head h1 { overflow-wrap: anywhere; }
.row.picture { flex-wrap: nowrap; align-items: center; gap: 14px; }
.picture .grow { display: grid; gap: 8px; }
.badge.cat-tag { padding: 3px 4px 3px 12px; font-size: 13px; gap: 4px; }
.cat-tag .icon-btn.sm { width: 24px; height: 24px; }
.cat-tag .icon-btn.sm svg.lucide { width: 13px; height: 13px; }
.kinds.stock-kinds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .kinds.stock-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stock-kinds small { display: none; } .row.picture { align-items: flex-start; } }
.label-row { display: flex; align-items: center; gap: 12px; }
.label-row .grow b, .label-row .grow small { display: block; overflow-wrap: anywhere; }
.label-row label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.label-row input[data-count]:not([type=checkbox]):not([type=radio]) { width: 78px; min-height: 36px; padding: 4px 8px; }
.tags.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tag { display: grid; justify-items: center; align-content: start; gap: 2px; text-align: center; padding: 10px; background: #fff; color: #111; border: 1px dashed #b8c0cc; border-radius: 8px; font-size: 12px; line-height: 1.3; min-width: 0; }
.tag b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tag strong { font-size: 13.5px; }
.barcode { display: block; width: 100%; height: 40px; }

/* ================= Pharmacy on finance and dashboard ================= */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.figures > div { display: grid; gap: 2px; align-content: start; padding: 12px 14px; border-radius: var(--r); background: var(--surface2); border: 1px solid var(--line); min-width: 0; }
.figures span { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.figures strong { font-family: 'Bricolage', sans-serif; font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.figures small { font-size: 12px; color: var(--muted); }
.attention-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.attention-row a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 13px; align-items: center; padding: 12px 15px; border-radius: var(--r); border: 1px solid transparent; color: var(--text); background: var(--surface2); transition: transform .14s, border-color .14s; }
.attention-row a:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--brand); }
.attention-row a svg.lucide { grid-row: span 2; width: 24px; height: 24px; color: var(--muted); }
.attention-row a strong { font-family: 'Bricolage', sans-serif; font-size: 23px; line-height: 1.1; }
.attention-row a span { font-size: 12.5px; font-weight: 600; color: var(--text2); }
.attention-row a.bad { background: var(--bad-soft); } .attention-row a.bad svg.lucide { color: var(--bad); }
.attention-row a.warn { background: var(--warn-soft); } .attention-row a.warn svg.lucide { color: var(--warn); }
@media (max-width: 480px) { .attention-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .attention-row a { padding: 10px; gap: 0 9px; } }

/* ================= Print ================= */
#print-area { display: none; }
@media print {
  body.printing { background: #fff !important; color: #000; padding: 0 !important; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; font-size: 12px; color: #111; }
  #print-area h1 { font-size: 19px; } #print-area h2 { font-size: 13px; margin: 14px 0 5px; }
  #print-area table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  #print-area th, #print-area td { text-align: left; border-bottom: 1px solid #ccc; padding: 5px 4px; }
  #print-area .right { text-align: right; }
  #print-area header { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 12px; }
  #print-area header img { max-height: 56px; max-width: 150px; object-fit: contain; }
  #print-area .sign { margin-top: 40px; display: flex; justify-content: space-between; }
  @page { margin: 12mm; }
}
/* Till receipts: narrow paper, black on white */
@media print {
  body.printing #print-area.till { width: 80mm; margin: 0; }
  body.printing #print-area.till.w58 { width: 58mm; }
  #print-area.till .receipt { width: 100%; margin: 0; padding: 3mm 4mm; box-shadow: none; border-radius: 0; color: #000; font-size: 12px; }
  #print-area.till.w58 .receipt { padding: 2mm 3mm; font-size: 10.5px; }
  #print-area.till.w58 .r-total { font-size: 12px; }
  #print-area.till .receipt hr { border-top-color: #000; }
  /* Barcode labels: three across the page */
  #print-area.sheet .tags { font-size: 0; }
  #print-area.sheet .tag { display: inline-block; vertical-align: top; width: 33.33%; height: 33mm; overflow: hidden; break-inside: avoid; padding: 2.5mm 4mm; border: 1px dashed #bbb; border-radius: 0; font-size: 10px; }
  #print-area.sheet .tag b, #print-area.sheet .tag span, #print-area.sheet .tag strong { display: block; font-size: 10px; }
  #print-area.sheet .tag strong { font-size: 11.5px; }
  #print-area.sheet .barcode { height: 12mm; margin: 1mm 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
