/* Forecourt POS v7 — design system */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&display=swap');

/* ================= tokens ================= */
:root {
  --accent: #673DE6;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* every neutral shade takes a light tint of the chosen colour, so the whole app follows it */
  --bg: color-mix(in srgb, var(--accent) 4%, #F4F4F6);
  --surface: #FFFFFF;
  --surface-2: color-mix(in srgb, var(--accent) 2.5%, #FAFAFB);
  --ink: color-mix(in srgb, var(--accent) 10%, #16161C);
  --ink-2: color-mix(in srgb, var(--accent) 12%, #34343E);
  --muted: color-mix(in srgb, var(--accent) 14%, #6A6A76);
  --line: color-mix(in srgb, var(--accent) 8%, #E5E5E9);
  --line-strong: color-mix(in srgb, var(--accent) 10%, #D3D3D9);
  --hover: color-mix(in srgb, var(--accent) 6%, #F2F2F4);
  --ok: #0B8A5E;   --ok-soft: #E3F5EE;
  --warn: #A66300; --warn-soft: #FDF1DE;
  --bad: #CF3340;  --bad-soft: #FCE8EA;
  --accent-ink: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 30%, var(--surface));
  --accent-text: color-mix(in srgb, var(--accent) 88%, var(--ink));
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 26%, transparent);
  --shade: color-mix(in srgb, var(--accent) 25%, #101018);
  --r-sm: 6px; --r: 9px; --r-lg: 14px;
  --sidebar-open: 248px;
  --sidebar-closed: 72px;
  --sidebar: var(--sidebar-open);
  --topbar: 64px;
  --gap: 18px;
  --pad: 28px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow-pop: 0 18px 48px -14px color-mix(in srgb, var(--shade) 30%, transparent);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
[data-accent="pump"]     { --accent: #E10600; }
[data-accent="ocean"]    { --accent: #1F6FD1; }
[data-accent="emerald"]  { --accent: #0C8A62; }
[data-accent="amber"]    { --accent: #C26A06; }
[data-accent="rose"]     { --accent: #C2265A; }
[data-accent="graphite"] { --accent: #3D4656; }
[data-theme="dark"] {
  --bg: color-mix(in srgb, var(--accent) 6%, #0E0E12); --surface: color-mix(in srgb, var(--accent) 5%, #16161B); --surface-2: color-mix(in srgb, var(--accent) 6%, #1B1B21);
  --ink: color-mix(in srgb, var(--accent) 6%, #EDEDF2); --ink-2: color-mix(in srgb, var(--accent) 8%, #CDCDD6); --muted: color-mix(in srgb, var(--accent) 12%, #96969F);
  --line: color-mix(in srgb, var(--accent) 10%, #27272E); --line-strong: color-mix(in srgb, var(--accent) 12%, #37373F); --hover: color-mix(in srgb, var(--accent) 8%, #202027);
  --ok: #3CC48F; --ok-soft: #12291F; --warn: #E6A443; --warn-soft: #2D2312; --bad: #F06B74; --bad-soft: #321619;
  --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 45%, var(--surface));
  --shadow-pop: 0 18px 48px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
[data-theme="dark"][data-accent="graphite"] { --accent: #6B7890; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: color-mix(in srgb, var(--accent) 6%, #0E0E12); --surface: color-mix(in srgb, var(--accent) 5%, #16161B); --surface-2: color-mix(in srgb, var(--accent) 6%, #1B1B21);
    --ink: color-mix(in srgb, var(--accent) 6%, #EDEDF2); --ink-2: color-mix(in srgb, var(--accent) 8%, #CDCDD6); --muted: color-mix(in srgb, var(--accent) 12%, #96969F);
    --line: color-mix(in srgb, var(--accent) 10%, #27272E); --line-strong: color-mix(in srgb, var(--accent) 12%, #37373F); --hover: color-mix(in srgb, var(--accent) 8%, #202027);
    --ok: #3CC48F; --ok-soft: #12291F; --warn: #E6A443; --warn-soft: #2D2312; --bad: #F06B74; --bad-soft: #321619;
    --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
    --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
    --accent-line: color-mix(in srgb, var(--accent) 45%, var(--surface));
    --shadow-pop: 0 18px 48px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ================= base ================= */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; overflow-x: hidden; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 19px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0 0 10px; }
code { font-size: 12.5px; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.num { text-align: right; white-space: nowrap; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); }
.up { color: var(--ok); } .down { color: var(--bad); }
:focus-visible { outline: none; box-shadow: var(--focus); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= shell ================= */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar); z-index: 50;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transition: width .18s ease;
}
.brand { display: flex; align-items: center; gap: 11px; height: var(--topbar); padding: 0 18px; border-bottom: 1px solid var(--line); flex: none; text-decoration: none !important; color: var(--ink); overflow: hidden; }
.brand:hover { background: var(--hover); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px; overflow: hidden; }
.brand-mark svg, .brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 8px; }
.brand-mark.lg { width: 48px; height: 48px; border-radius: 12px; }
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 14.5px; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.nav:hover { scrollbar-color: var(--line-strong) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: transparent; border: 0; }
.nav:hover::-webkit-scrollbar-thumb { background: var(--line-strong); }
.nav-label { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 16px 12px 6px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; height: 40px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px;
  margin: 2px 0; padding: 0 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; text-decoration: none !important; white-space: nowrap; overflow: hidden;
  transition: background .12s, color .12s;
}
.nav a svg { width: 19px; height: 19px; flex: none; color: var(--muted); transition: color .12s; }
.nav a span { overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a:hover svg { color: var(--ink-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav a.active svg { color: var(--accent); }
.nav a.active::before { content: ''; position: absolute; left: 3px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }

.sb-toggle {
  flex: none; display: flex; align-items: center; gap: 12px; height: 52px; margin: 0; padding: 0 24px;
  border: 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; overflow: hidden; padding-bottom: var(--safe-b);
}
.sb-toggle:hover { background: var(--hover); color: var(--ink); }
.sb-toggle svg { width: 19px; height: 19px; flex: none; color: var(--muted); transition: transform .18s; }

/* collapsed: icons only */
.shell.collapsed { --sidebar: var(--sidebar-closed); }
.shell.collapsed .brand { padding: 0; justify-content: center; }
.shell.collapsed .brand-text, .shell.collapsed .nav a span, .shell.collapsed .sb-toggle span { display: none; }
.shell.collapsed .nav { padding: 4px 12px 12px; }
.shell.collapsed .nav-label { height: 17px; padding: 8px 0; }
.shell.collapsed .nav-label span { display: block; height: 1px; background: var(--line); font-size: 0; }
.shell.collapsed .nav-group:first-child .nav-label span { background: transparent; }
.shell.collapsed .nav a { justify-content: center; padding: 0; }
.shell.collapsed .nav a.active::before { left: 2px; }
.shell.collapsed .sb-toggle { justify-content: center; padding: 0 0 var(--safe-b); }
.shell.collapsed .sb-toggle svg { transform: scaleX(-1); }

.nav-backdrop { display: none; }
.main { margin-left: var(--sidebar); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; min-width: 0; transition: margin-left .18s ease; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 var(--pad); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .spacer { flex: 1; }
.topbar-brand { display: none; text-decoration: none !important; }
.after-title { min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 8px; }
.clock { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--hover); white-space: nowrap; font-weight: 550; }
.clock svg { width: 14px; height: 14px; }
.after-title:empty, .page-actions:empty { display: none; }
.page-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.btn.menu-btn { display: none; }
.content { padding: 24px var(--pad) calc(36px + var(--safe-b)); flex: 1; min-width: 0; }
.content.flush { padding: 0; }
body.loading .content { opacity: .55; transition: opacity .15s .1s; }
body.loading::before { content: ''; position: fixed; top: 0; left: 0; height: 2px; width: 40%; background: var(--accent); z-index: 400; animation: loadbar 1s ease-in-out infinite; }
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ================= controls ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: background .12s, border-color .12s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--surface)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { position: relative; }
.user-btn { padding: 0 8px; gap: 8px; }
.dot-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 650; display: grid; place-items: center; border: 2px solid var(--surface); }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; font-weight: 600; font-style: normal; color: var(--muted); text-align: center; background: var(--surface); }
.btn.primary .kbd { color: #fff; border-color: rgba(255,255,255,.4); background: transparent; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.field > label small { font-weight: 450; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); height: 38px; padding: 0 11px; width: 100%; min-width: 0;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 38px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6A82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px;
}
select[multiple] { background-image: none; padding-right: 11px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--bad); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; flex: none; }
input[type="file"] { height: auto; padding: 8px; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.money-in { height: 48px; font-size: 20px; font-weight: 650; text-align: right; }
.pin-input { height: 54px; font-size: 26px; letter-spacing: 12px; text-align: center; font-weight: 700; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.options { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.options label { position: relative; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 12px; cursor: pointer; font-weight: 550; display: flex; flex-direction: column; gap: 2px; }
.options label small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.options input { position: absolute; opacity: 0; pointer-events: none; }
.options label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.options label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.options label:has(input:focus-visible) { box-shadow: var(--focus); }

/* ================= layout surfaces ================= */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-height: 54px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 18px; }
.panel.fill { display: flex; flex-direction: column; }
.panel.fill > .scroll { flex: 1; overflow-y: auto; min-height: 0; }
.stack-page { display: flex; flex-direction: column; gap: var(--gap); }
.cols { display: grid; gap: var(--gap); align-items: stretch; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols > .span-2 { grid-column: span 2; }
.h-320 { height: 340px; }

/* toolbars always fill the row: the search grows into free space */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }
.toolbar > .suggest-wrap { flex: 1 1 280px; min-width: 220px; }
.toolbar select, .toolbar input[type=date] { width: auto; }
.toolbar .count-note { margin-left: auto; white-space: nowrap; }

.range-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-bar input[type=date] { width: auto; height: 34px; }
.range-bar.dim { opacity: .45; }
.seg-tabs { display: inline-flex; background: var(--hover); border-radius: var(--r); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-tabs button { font: inherit; font-size: 13px; font-weight: 550; color: var(--muted); background: none; border: 0; border-radius: 6px; padding: 5px 11px; cursor: pointer; white-space: nowrap; }
.seg-tabs button:hover { color: var(--ink); }
.seg-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--shade) 12%, transparent); }
.seg-tabs .count, .tabs .count { font-size: 11.5px; margin-left: 4px; color: var(--muted); font-weight: 600; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { font: inherit; font-weight: 550; color: var(--muted); background: none; border: 0; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ================= tables ================= */
.table-wrap { overflow-x: auto; border-radius: inherit; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 12.5px; font-weight: 550; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: break-word; }
table.data.dense th, table.data.dense td { padding-left: 10px; padding-right: 10px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr.click { cursor: pointer; }
table.data tr.selected td { background: var(--accent-soft); }
table.data th.num, table.data td.num { text-align: right; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--line); }
table.data tr.flash td { animation: flash .6s ease-out; }
.panel > .table-wrap:first-child table.data thead tr:first-child th:first-child { border-top-left-radius: var(--r-lg); }
.panel > .table-wrap:first-child table.data thead tr:first-child th:last-child { border-top-right-radius: var(--r-lg); }
.cell-title { font-weight: 550; }
.cell-sub { font-size: 12px; color: var(--muted); }
tr.void td { color: var(--muted); }
tr.void td .cell-title { text-decoration: line-through; }
.empty-row td { padding: 0 !important; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; font-size: 16px; }
.empty p { max-width: 460px; margin: 0 auto; }
.pnl-sub td { font-weight: 650; background: var(--surface-2); }
.pnl-total td { font-weight: 750; font-size: 15px; border-top: 2px solid var(--line-strong); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--hover); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }

.alert { padding: 10px 14px; border-radius: var(--r); font-size: 13.5px; border: 1px solid; }
.alert.success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert.danger { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.info { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }

/* ================= stats & small widgets ================= */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats.s3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.s5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px 18px; color: inherit; text-decoration: none !important; display: block; min-width: 0; }
.stat .label { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value { font-size: clamp(18px, 1.6vw, 23px); font-weight: 650; margin-top: 3px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value small, .stat .value .muted { font-size: .65em; }
.stat .foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.stat:hover, button.stat:hover { border-color: var(--accent-line); }
button.stat { font: inherit; text-align: left; cursor: pointer; width: 100%; }

.kv { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 550; }
.kv .strong { font-weight: 700; color: var(--ink); font-size: 15px; padding-top: 7px; border-top: 1px dashed var(--line-strong); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }
.list li .grow > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list li.empty-li { color: var(--muted); justify-content: center; padding: 26px 18px; }

.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 180px; padding: 16px 18px 10px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 40px; border-radius: 6px 6px 2px 2px; background: var(--accent-line); min-height: 3px; }
.bar.hi i { background: var(--accent); }
.bar small { font-size: 11.5px; color: var(--muted); }
.bar b { font-size: 11px; font-weight: 550; color: var(--muted); white-space: nowrap; }
.progress { height: 6px; border-radius: 999px; background: var(--hover); overflow: hidden; min-width: 90px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .2s; }
.report-head h2 { font-size: 18px; margin-bottom: 2px; }
.report-head p { margin: 0; }

/* ================= right-side panels ================= */
.drawer-layer { position: fixed; inset: 0; z-index: 100; }
.drawer-layer .backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--shade) 38%, transparent); animation: fade .2s ease-out; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; animation: slide-in .24s cubic-bezier(.2, .8, .2, 1);
}
.drawer.sm { width: min(420px, 100vw); }
.drawer.lg { width: min(720px, 100vw); }
.drawer.xl { width: min(920px, 100vw); }
.drawer-layer.closing .drawer { animation: slide-out .18s ease-in forwards; }
.drawer-layer.closing .backdrop { animation: fade .18s ease-in reverse forwards; }
@keyframes slide-in { from { transform: translateX(100%); } }
@keyframes slide-out { to { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-head .titles { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 17px; overflow-wrap: anywhere; }
.drawer-head .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 22px; }
.drawer-foot { flex: none; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 14px 22px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }
.drawer .section { margin-bottom: 20px; }
.drawer .section:last-child { margin-bottom: 0; }
.drawer .section > h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.drawer .err-box { margin-top: 12px; }
.summary-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-line); flex-wrap: wrap; }
.summary-card .grow { flex: 1; min-width: 0; }
.summary-card strong { display: block; font-size: 15px; }
.summary-card.new { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.big-number { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.total-box { padding: 16px 18px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.total-box strong { font-size: 22px; }
.total-box.short strong, .total-box.bad strong { color: var(--bad); }
.total-box.over strong { color: var(--warn); }
.total-box.match strong, .total-box.ok strong { color: var(--ok); }

/* ================= menus, toasts ================= */
.toasts { position: fixed; right: 20px; bottom: calc(20px + var(--safe-b)); z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 400px; background: var(--ink); color: var(--surface); padding: 11px 14px; border-radius: var(--r); font-weight: 500; font-size: 13.5px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.35); display: flex; gap: 10px; align-items: flex-start; animation: fade .18s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok::before, .toast.bad::before, .toast.warn::before { content: ''; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.toast.ok::before { background: #3CC48F; } .toast.warn::before { background: #E6A443; } .toast.bad::before { background: #fff; }
.notif-wrap, .menu { position: relative; }
.pop { position: absolute; right: 0; top: 46px; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
#notifPanel { width: 380px; max-width: calc(100vw - 24px); }
.pop header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.pop header strong { flex: 1; }
.notif-list { max-height: min(420px, 70vh); overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.notif .ico { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.notif .ico svg { width: 16px; height: 16px; }
.notif .ico.low_stock, .notif .ico.expiring { background: var(--warn-soft); color: var(--warn); }
.notif .ico.out_of_stock, .notif .ico.expired { background: var(--bad-soft); color: var(--bad); }
.notif b { display: block; font-weight: 600; font-size: 13.5px; }
.notif p { margin: 1px 0 2px; font-size: 12.5px; color: var(--ink-2); }
.notif time { font-size: 11.5px; color: var(--muted); }
.notif-empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.menu-list { width: 260px; max-width: calc(100vw - 24px); padding: 6px; }
.menu-list a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.menu-list a:hover { background: var(--hover); }
.menu-list a.active { background: var(--accent-soft); color: var(--accent-text); }
.menu-list a svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-list .label { font-size: 12px; color: var(--muted); padding: 6px 10px 4px; }
.menu-who { display: flex; gap: 10px; align-items: center; padding: 8px 10px; }
.menu-who strong { display: block; font-size: 13.5px; }
.menu-who small { color: var(--muted); font-size: 12px; }
.seg { display: flex; gap: 4px; padding: 2px 6px 6px; }
.seg button { flex: 1; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 12.5px; height: 30px; }
.seg button.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.swatches { display: flex; gap: 8px; padding: 4px 10px 8px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 12.5px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* search-as-you-type */
.suggest-wrap { position: relative; min-width: 0; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 35; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); max-height: 380px; overflow-y: auto; }
.suggest button { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; width: 100%; padding: 10px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.suggest button:last-child { border-bottom: 0; }
.suggest button.on, .suggest button:hover { background: var(--accent-soft); }
.suggest button[disabled] { opacity: .5; cursor: not-allowed; }
.suggest .s-name { font-weight: 550; }
.suggest .s-code { font-size: 12px; color: var(--muted); }

.scan-box { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-lg); padding: 0 8px 0 16px; height: 56px; min-width: 0; }
.scan-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.scan-box > svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.scan-box input { border: 0; box-shadow: none !important; height: 52px; font-size: 16px; padding: 0; background: transparent; min-width: 0; }
.scan-box.md { height: 48px; } .scan-box.md input { height: 44px; font-size: 15px; }
.scan-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; padding-right: 8px; }
.scan-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.scan-state.ready { color: var(--ok); }
.scan-state.ready i { background: var(--ok); animation: beacon 2s ease-in-out infinite; }
@keyframes beacon { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 18%, transparent); } }

/* ================= POS ================= */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); }
.pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px 20px; gap: 14px; }
.pos-head-row { display: flex; gap: 10px; }
.pos-head-row .suggest-wrap { flex: 1; }
.pos-head-row > .btn { height: 56px; border-radius: var(--r-lg); padding: 0 16px; }
.pos-work { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cart { flex: 1; min-height: 0; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
.cart table { width: 100%; border-collapse: collapse; }
.cart th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12.5px; font-weight: 550; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cart td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cart tr.sel td { background: var(--accent-soft); }
.cart tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cart tr.flash td { animation: flash .6s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); } }
.cart .line-no { color: var(--muted); width: 36px; }
.stock-note { font-size: 12px; color: var(--muted); }
.stock-note.max { color: var(--warn); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.qty button { width: 32px; height: 32px; border: 0; background: var(--surface-2); color: var(--ink); font-size: 16px; cursor: pointer; }
.qty button:hover { background: var(--hover); }
.qty button[disabled] { color: var(--line-strong); cursor: not-allowed; }
.qty input { width: 52px; height: 32px; border: 0; border-radius: 0; text-align: center; padding: 0; font-weight: 600; box-shadow: none !important; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.cart-empty { display: grid; place-items: center; min-height: 100%; text-align: center; color: var(--muted); padding: 40px 20px; }
.cart-empty svg { width: 54px; height: 54px; color: var(--line-strong); margin-bottom: 10px; }
.cart-empty h2 { color: var(--ink); margin-bottom: 4px; }
.shortcut-strip { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 12.5px; color: var(--muted); }
.shortcut-strip span { display: inline-flex; gap: 6px; align-items: center; }
.browse { position: absolute; inset: 0; z-index: 25; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.browse-head { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.browse-head input { height: 36px; max-width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chip { flex: none; font: inherit; font-size: 13px; font-weight: 550; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent-line); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tiles { flex: 1; overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; }
.tile { position: relative; text-align: left; font: inherit; color: var(--ink); cursor: pointer; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 10px 12px; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.tile:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.tile:active { transform: scale(.98); }
.tile[disabled] { opacity: .45; cursor: not-allowed; }
.tile .t-name { font-weight: 550; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-foot { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.tile .t-foot strong { color: var(--ink); font-size: 14px; }
.tile .t-qty { position: absolute; top: 6px; right: 6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.ticket { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ticket-head { padding: 16px 22px 14px; border-bottom: 1px dashed var(--line-strong); }
.ticket-head .row { justify-content: space-between; }
.ticket-head .inv { font-weight: 600; }
.ticket-head .meta { font-size: 12.5px; color: var(--muted); }
.cust-pill { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: var(--r); margin-top: 10px; cursor: pointer; background: none; width: 100%; font: inherit; color: inherit; text-align: left; }
.cust-pill:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.cust-pill.set { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); }
.cust-pill .grow { flex: 1; min-width: 0; }
.cust-pill .grow div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-lines { flex: 1; overflow-y: auto; padding: 4px 22px; font-size: 13px; }
.ticket-lines .tl { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.ticket-lines .tl:last-child { border-bottom: 0; }
.ticket-lines .tl span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-lines .tl.empty-li { justify-content: center; color: var(--muted); border: 0; padding: 18px 0; }
.ticket-sum { padding: 12px 22px; border-top: 1px dashed var(--line-strong); }
.ticket-sum .tl { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink-2); }
.ticket-sum .tl button { font: inherit; background: none; border: 0; color: var(--accent-text); cursor: pointer; padding: 0; font-weight: 550; }
.ticket-total { position: relative; padding: 16px 22px 18px; background: var(--surface-2); border-top: 1px solid var(--line); }
.ticket-total::before { content: ''; position: absolute; left: 0; right: 0; top: -6px; height: 12px; background: radial-gradient(circle at 7px 6px, var(--bg) 4px, transparent 4.5px) 0 0 / 14px 12px repeat-x; }
.ticket-total .label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.ticket-total .amount { font-size: 42px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin: 4px 0 14px; overflow-wrap: anywhere; }
.ticket-total .amount small { font-size: 18px; font-weight: 600; color: var(--muted); margin-right: 6px; letter-spacing: 0; }
.ticket-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ticket-actions .btn { padding: 0 6px; }
.ticket-actions .pay { grid-column: span 4; height: 54px; font-size: 16px; justify-content: space-between; padding: 0 18px; }
.shift-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--hover); text-decoration: none !important; white-space: nowrap; }
.shift-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: none; }
.shift-chip.on i { background: var(--ok); }
.shift-chip.off { background: var(--warn-soft); color: var(--warn); }
.shift-chip.off i { background: var(--warn); }
.quick-cash { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-cash .btn { flex: 1; }
.done-check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 4px auto 12px; }
.done-check svg { width: 28px; height: 28px; }

/* ================= misc page parts ================= */
.den-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.den { display: grid; grid-template-columns: 56px 1fr 84px; align-items: center; gap: 8px; font-size: 13.5px; }
.den b { text-align: right; }
.den input { height: 34px; text-align: center; }
.den span { text-align: right; color: var(--muted); }
.ret-qty, .count-input { width: 84px; height: 32px; text-align: center; }
.drop { display: block; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.drop svg { width: 28px; height: 28px; margin-bottom: 6px; }
.layer { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; }
.layer.first { border-color: var(--accent-line); background: var(--accent-soft); }
.layer .meta { font-size: 12px; color: var(--muted); }
.logo-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 84px; height: 84px; border-radius: 14px; border: 1px dashed var(--line-strong); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); flex: none; }
.logo-preview img, .logo-preview svg { width: 100%; height: 100%; object-fit: contain; }

/* barcode label preview (same layout as the printed label) */
.label-prev-row { display: flex; gap: 12px; flex-wrap: wrap; }
.label-prev { width: 228px; height: 114px; background: #fff; color: #000; border: 1px solid var(--line); border-radius: 4px; display: flex; font-family: Arial, Helvetica, sans-serif; overflow: hidden; }
.label-prev .lb-brand { flex: none; width: 22px; background: #000; color: #fff; writing-mode: vertical-rl; transform: rotate(180deg); display: grid; place-items: center; font-weight: 800; font-size: 9px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; }
.label-prev .lb-main { flex: 1; min-width: 0; padding: 6px 8px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.label-prev .ln { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.2; max-height: 27px; overflow: hidden; }
.label-prev img { width: 100%; height: 46px; object-fit: fill; }
.label-prev .lp { font-size: 14px; font-weight: 800; }

/* ================= sign in / set up ================= */
.auth-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.auth-card h1 { margin: 16px 0 6px; font-size: 22px; }
.auth-card > .muted { margin-bottom: 20px; }
.auth-card .stack { margin-top: 18px; }
.choice { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; align-items: flex-start; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; }
.choice small { display: block; color: var(--muted); font-size: 12.5px; }
.cred-table { width: 100%; border-collapse: collapse; margin: 14px 0 8px; font-size: 13.5px; }
.cred-table th, .cred-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.cred-table th { color: var(--muted); font-weight: 550; }
.demo-logins { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.demo-logins .row button { flex: 1; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; left: -9999px; }

/* ================= responsive ================= */
@media screen and (max-width: 1280px) {
  :root { --pad: 22px; }
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
  .ticket-total .amount { font-size: 34px; }
  .stats.s5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 > .span-2 { grid-column: 1 / -1; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* tablets and phones: menu slides in from the left */
@media screen and (max-width: 900px) {
  :root { --pad: 16px; --gap: 14px; --topbar: 58px; }
  .shell, .shell.collapsed { --sidebar: 0px; }
  .sidebar, .shell.collapsed .sidebar { width: 272px; transform: translateX(-102%); transition: transform .22s ease; }
  .shell.collapsed .brand { padding: 0 18px; justify-content: flex-start; }
  .shell.collapsed .brand-text, .shell.collapsed .nav a span { display: block; }
  .shell.collapsed .nav a { justify-content: flex-start; padding: 0 12px; }
  .shell.collapsed .nav-label { height: 40px; padding: 16px 12px 6px; }
  .shell.collapsed .nav-label span { height: auto; background: none; font-size: 11.5px; }
  .sb-toggle { display: none; }
  .nav { padding-bottom: calc(16px + var(--safe-b)); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: color-mix(in srgb, var(--shade) 40%, transparent); animation: fade .2s ease-out; }
  body.nav-open { overflow: hidden; }
  .btn.menu-btn { display: inline-flex; margin-left: -6px; }
  .topbar { gap: 8px; }
  .topbar-brand { display: block; }
  .topbar h1 { font-size: 17px; }
  .after-title { display: none; }
  .cols-2, .cols-2-1, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .cols > .span-2, .cols-3 > .span-2 { grid-column: auto; }
  .h-320 { height: auto; max-height: 360px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .stats.s3, .stats.s5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .den-grid { grid-template-columns: minmax(0, 1fr); }
  .hide-sm, .shortcut-strip, .scan-state span { display: none !important; }
  .page-actions .btn:not(.icon) { padding: 0 10px; }
  /* counter: cart on top, ticket below with the total pinned to the bottom of the screen */
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pos-left { padding: 12px var(--pad); }
  .cart { min-height: 220px; max-height: 55vh; border-radius: var(--r-lg); border-bottom: 1px solid var(--line); }
  .ticket { border-left: 0; border-top: 1px solid var(--line); }
  .ticket-lines { max-height: 220px; }
  .ticket-total { position: sticky; bottom: 0; z-index: 20; padding-bottom: calc(14px + var(--safe-b)); box-shadow: 0 -10px 24px -16px color-mix(in srgb, var(--shade) 35%, transparent); }
  .ticket-total .amount { font-size: 30px; margin-bottom: 10px; }
}

/* phones: every table row becomes a card */
@media screen and (max-width: 640px) {
  body { font-size: 13.5px; }
  h1 { font-size: 16px; }
  .content { padding: 14px 12px calc(84px + var(--safe-b)); }
  .content.flush { padding: 0 0 var(--safe-b); }
  .topbar { padding: 0 12px; }
  .page-actions { gap: 6px; }
  .page-actions .btn { height: 34px; }
  .page-actions .btn:has(> svg):not(.primary) { width: 34px; padding: 0; }
  .page-actions .btn:has(> svg):not(.primary) > :not(svg) { display: none; }
  .user-btn { padding: 0 2px; }
  .btn { height: 38px; }
  .btn.sm { height: 32px; }
  .stats, .stats.s3, .stats.s5 { gap: 10px; }
  .stat { padding: 11px 12px; border-radius: 12px; }
  .stat .label { font-size: 12px; }
  .stat .value { font-size: 17px; }
  .stat .foot { font-size: 11.5px; }
  .big-number { font-size: 24px; }
  .total-box strong { font-size: 18px; }
  .panel-head { padding: 12px 14px; min-height: 48px; }
  .panel-body { padding: 14px; }
  .list li { padding: 10px 14px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .toolbar { gap: 8px; }
  .toolbar > *, .toolbar .search, .toolbar > .suggest-wrap, .toolbar select { flex: 1 1 100%; width: 100%; min-width: 0; }
  .toolbar .seg-tabs, .range-bar .seg-tabs { display: flex; width: 100%; }
  .seg-tabs button { flex: 1 1 auto; padding: 6px 8px; font-size: 12.5px; }
  .range-bar { width: 100%; }
  .range-bar input[type=date] { flex: 1 1 0; min-width: 0; width: auto; }
  .tabs { gap: 0; }
  .tabs button { padding: 9px 10px; font-size: 13px; }
  .scan-box { height: 50px; padding-left: 12px; gap: 10px; }
  .scan-box input { height: 46px; font-size: 15px; }
  .drawer, .drawer.sm, .drawer.lg, .drawer.xl { width: 100vw; border-left: 0; }
  .drawer-head { padding: 14px 16px; }
  .drawer-body { padding: 16px; }
  .drawer-foot { padding: 12px 16px calc(12px + var(--safe-b)); gap: 8px; }
  .drawer-foot .btn { flex: 1 1 auto; }
  .drawer-foot .spacer { display: none; }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); }
  .toast { min-width: 0; max-width: none; }
  .bars { gap: 4px; padding: 12px 10px 8px; height: 160px; }
  .bar b { display: none; }
  .bar small { font-size: 10.5px; }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .suggest button { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; }
  .suggest button .badge { display: none; }

  /* table rows as cards (labels come from the header via data-label) */
  .table-wrap { overflow: visible; }
  .panel:has(> .table-wrap) { background: transparent; border: 0; }
  .panel:has(> .table-wrap) > .chips { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 10px; }
  table.data, table.data tbody, table.data tfoot, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tbody, table.data tfoot { display: flex; flex-direction: column; gap: 10px; }
  table.data tfoot { margin-top: 10px; }
  table.data tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
  table.data tbody tr:hover td { background: transparent; }
  table.data tr.selected, table.data tr.click:active { border-color: var(--accent-line); }
  table.data td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 0; border: 0 !important; text-align: left !important; font-size: 13px; min-width: 0; overflow-wrap: anywhere; white-space: normal; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.3; }
  table.data td[data-label=""]::before, table.data td:not([data-label])::before { display: none; }
  table.data td > :only-child { min-width: 0; }
  table.data td:first-child { grid-column: 1 / -1; display: block; font-size: 14px; padding: 0 0 8px; margin-bottom: 2px; border-bottom: 1px solid var(--line) !important; }
  table.data td.actions, table.data td:has(.count-input), table.data td:has(.ret-qty) { grid-column: 1 / -1; }
  table.data td:first-child::before { display: none; }
  table.data td.actions { flex-direction: row; justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
  table.data tr.empty-row, table.data tfoot tr { display: block; }
  table.data tfoot tr { display: grid; }
  table.data td.actions:empty, table.data td:empty { display: none; }
  table.data tr.empty-row { padding: 0; }
  table.data tr.empty-row td { display: block; border: 0 !important; }
  table.data tr.void { opacity: .75; }
  table.data .count-input, table.data .ret-qty { width: 96px; }
  table.data tfoot tr { background: var(--surface-2); }
  .pnl-sub td, .pnl-total td { background: transparent; }

  /* counter cart: name on top, price · qty · total below */
  .cart thead { display: none; }
  .cart table, .cart tbody { display: block; }
  .cart tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name name del" "price qty total"; align-items: center; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .cart td { padding: 0; border: 0; display: block; }
  .cart td.line-no { display: none; }
  .cart td:nth-child(2) { grid-area: name; }
  .cart td:nth-child(3) { grid-area: price; text-align: left; color: var(--muted); }
  .cart td:nth-child(4) { grid-area: qty; }
  .cart td:nth-child(5) { grid-area: total; text-align: right; min-width: 70px; }
  .cart td:nth-child(6) { grid-area: del; }
  .cart tr.sel td, .cart tr.sel td:first-child { background: transparent; box-shadow: none; }
  .cart tr.sel { background: var(--accent-soft); }
  .qty button { width: 34px; height: 34px; }
  .qty input { width: 44px; height: 34px; }
  .pos-head-row > .btn { height: 50px; padding: 0 12px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .ticket-head, .ticket-sum, .ticket-total { padding-left: 14px; padding-right: 14px; }
  .ticket-lines { padding: 4px 14px; }
  .ticket-total .amount { font-size: 26px; }
  .ticket-total .amount small { font-size: 14px; }
  .ticket-actions .pay { height: 48px; }
  .auth-card { padding: 22px 18px; }
  .den { grid-template-columns: 48px 1fr 72px; }
  .label-prev { width: 100%; max-width: 260px; }
  .logo-box .btn { flex: 1; }
}

/* ================= print ================= */
.print-only { display: none; }
@media print {
  @page { margin: 10mm; }
  html, body { background: #fff !important; }
  .sidebar, .topbar, .toolbar, .toasts, .tabs, .btn, #drawers, .seg-tabs, .range-bar, .nav-backdrop, .pager, [id$="Pg"] { display: none !important; }
  .print-only { display: block; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .shell, .shell.collapsed { --sidebar: 0px; }
  .app, .main { display: block !important; margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .stack-page { gap: 10px; }
  .panel { border: 0; box-shadow: none; background: #fff; }
  .stat { break-inside: avoid; padding: 8px 10px; }
  .stat .value { font-size: clamp(9pt, 2.4vw, 13pt); white-space: nowrap; }
  .bars, .bars * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bars { height: 130px; padding: 8px 4px 4px; break-inside: avoid; overflow: hidden; gap: 3px; }
  .bars .bar { min-width: 0; }
  .table-wrap { overflow: visible !important; }
  /* tables shrink with the page width and the number of columns, so they always fit */
  table.data { width: 100% !important; table-layout: auto; font-variant-numeric: tabular-nums;
    font-size: clamp(4.6pt, calc(100vw / (var(--cols, 7) + 0.6) / 6), 10.5pt); }
  table.data.dense th, table.data.dense td { padding: .34em .3em !important; }
  table.data th, table.data td { padding: .38em .5em !important; font-size: 1em; }
  table.data th { white-space: normal; font-size: .92em; background: #f3f3f3 !important; color: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data td { border-bottom: 1px solid #e3e3e3; }
  table.data td.num, table.data td.nowrap { white-space: nowrap; }
  table.data thead { display: table-header-group; }
  table.data tfoot { display: table-row-group; }
  table.data tr { break-inside: avoid; }
  table.data tbody tr:hover td { background: none; }
  .report-head h2 { font-size: 16px; margin: 0; }
}

/* roles & permissions */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.role-card { text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.role-card:hover { border-color: var(--accent-line); }
.role-card p { margin: 0; flex: 1; }
.role-card.add { align-items: center; justify-content: center; border-style: dashed; color: var(--accent-text); font-weight: 600; }
.role-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.perm-group { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px 12px; margin: 0; }
.perm-group legend { padding: 0 6px; font-weight: 600; }
.perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding-top: 6px; }
.pw { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.pw.pw-on { color: var(--accent-text); font-weight: 600; }
@media screen and (max-width: 640px) { .perm-list { grid-template-columns: minmax(0, 1fr); } }

/* chart colours: categorical slots in fixed order + status (validated, see dataviz palette) */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s-other: #9a978f;
        --st-ok: #0b8a5e; --st-warn: #d99a00; --st-serious: #eb6834; --st-bad: #cf3340; }
[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s-other: #7d7a72;
        --st-ok: #3cc48f; --st-warn: #e6a443; --st-serious: #d95926; --st-bad: #f06b74; }
@media (prefers-color-scheme: dark) { [data-theme="system"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s-other: #7d7a72;
        --st-ok: #3cc48f; --st-warn: #e6a443; --st-serious: #d95926; --st-bad: #f06b74; } }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.donut { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-svg { width: 150px; height: 150px; flex: none; }
.donut-svg .seg { transition: stroke-width .15s; cursor: default; }
.donut-svg .seg:hover { stroke-width: 22; }
.donut-value { font-size: 20px; font-weight: 700; fill: var(--ink); letter-spacing: -0.02em; }
.donut-label { font-size: 11px; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 36px; gap: 8px; align-items: center; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .lg-name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .lg-val { color: var(--ink); font-weight: 600; text-align: right; }
.donut-legend .lg-pct { color: var(--muted); text-align: right; }
.donut-empty { margin: 0; }
@media screen and (max-width: 1280px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media screen and (max-width: 640px) { .cols-4 { grid-template-columns: minmax(0, 1fr); } .donut { flex-direction: row; align-items: center; } .donut-svg { width: 120px; height: 120px; } }

/* pager */
.pager { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .pg-info b { color: var(--ink); font-weight: 600; }
.pager .pg-per { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.pager .pg-per select { height: 30px; width: auto; padding-left: 8px; padding-right: 30px; background-position: right 8px center; font-size: 13px; }
.pager .pg-nav { display: flex; gap: 4px; align-items: center; }
.pager .pg-nav .btn { min-width: 32px; }
.pager .pg-gap { padding: 0 4px; }
@media screen and (max-width: 640px) {
  .pager { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-top: 10px; justify-content: center; padding: 10px 12px; }
  .pager .pg-per { margin-left: 0; }
  .pager .pg-nav { width: 100%; justify-content: center; }
}

/* bank & cash */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.acc-card { position: relative; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 168px; overflow: hidden; }
.acc-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--s1); }
.acc-card.t-cash::before { background: var(--s3); } .acc-card.t-wallet::before { background: var(--s2); } .acc-card.t-owner::before { background: var(--s4); }
.acc-card:hover { border-color: var(--accent-line); }
.acc-card.add { align-items: center; justify-content: center; border-style: dashed; color: var(--accent-text); font-weight: 600; }
.acc-card.add::before { display: none; }
.acc-name { font-size: 15.5px; margin-top: 6px; }
.acc-bal { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: auto; }
.acc-meta { display: flex; gap: 10px; font-size: 12.5px; }
@media screen and (max-width: 640px) { .acc-grid { grid-template-columns: minmax(0, 1fr); } .acc-card { min-height: 0; } .acc-bal { font-size: 20px; } }
.points-box { padding: 12px 14px; border: 1px dashed var(--accent-line); border-radius: var(--r); background: var(--accent-soft); display: flex; flex-direction: column; gap: 10px; }
.gc-code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.gift-visual { position: relative; border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; color: #fff; display: grid; gap: 10px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); box-shadow: 0 14px 30px -18px var(--accent); }
.gift-visual small { display: block; opacity: .8; font-size: 12px; }
.gift-visual strong { font-size: 18px; }
.gift-visual .gv-bal { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.gift-visual .badge { background: rgba(255,255,255,.2); color: #fff; }
.gift-visual .gv-code { background: #fff; border-radius: 8px; padding: 6px 10px; height: 64px; width: 100%; max-width: 320px; object-fit: contain; }
@media screen and (max-width: 900px) { .panel.fill > .bars { height: 190px !important; flex: none !important; } }

/* switches */
input.sw { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; cursor: pointer; margin: 0; transition: background .15s; }
input.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
input.sw:checked { background: var(--accent); }
input.sw:checked::after { transform: translateX(16px); }
input.sw:focus-visible { box-shadow: var(--focus); outline: 0; }

/* receipt designer */
.rc-cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.tgl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.tgl { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.tgl > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tgl b { font-weight: 600; font-size: 14px; }
.tgl small { color: var(--muted); font-size: 12.5px; }
.rc-prev { position: sticky; top: calc(var(--topbar) + 14px); display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar) - 28px); }
.rc-stage { flex: 1; min-height: 260px; overflow: auto; background: var(--surface-2); padding: 16px; display: flex; justify-content: center; align-items: flex-start; }
.rc-sheet { position: relative; flex: none; box-shadow: 0 10px 28px -12px color-mix(in srgb, var(--shade) 35%, transparent); background: #fff; }
.rc-sheet iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #fff; display: block; }
.rc-note { padding: 10px 16px; border-top: 1px solid var(--line); }
.logo-none { color: var(--muted); display: grid; place-items: center; }
.logo-none svg { width: 26px !important; height: 26px !important; }
@media screen and (max-width: 1100px) { .rc-cols { grid-template-columns: minmax(0, 1fr); } .rc-prev { position: static; max-height: none; } .rc-stage { max-height: 70vh; } }
@media screen and (max-width: 640px) { .tgl-grid { grid-template-columns: minmax(0, 1fr); } }

/* five-card stat rows: no half-empty rows at any width */
@media screen and (max-width: 1280px) and (min-width: 1101px) {
  .stats.s5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats.s5 > * { grid-column: span 2; }
  .stats.s5 > :nth-child(n+4) { grid-column: span 3; }
}
@media screen and (max-width: 1100px) {
  .stats.s5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.s5 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media screen and (max-width: 1360px) { .after-title { display: none; } }

/* two-wide stat row (each card = two of the four columns below) */
.stats.s1 { grid-template-columns: minmax(0, 1fr); }
.stats.s2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat.wide { display: flex; align-items: center; gap: 18px; }
.stat.wide > div:first-child { flex: 1; min-width: 0; }
.stat-break { margin: 0; display: grid; gap: 6px; padding-left: 18px; border-left: 1px solid var(--line); font-size: 13px; flex: none; min-width: 190px; }
.stat-break > div { display: flex; justify-content: space-between; gap: 16px; }
.stat-break dt { color: var(--muted); }
.stat-break dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
@media screen and (max-width: 1100px) {
  .stats.s3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media screen and (max-width: 760px) {
  .stat.wide { flex-direction: column; align-items: stretch; gap: 10px; }
  .stat-break { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 8px; min-width: 0; }
}
@media screen and (max-width: 640px) {
  .stats.s2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .stats.s1, .stats.s2 { grid-template-columns: minmax(0, 1fr) !important; }
  .stat .value { font-size: 16px; }
}
@media screen and (max-width: 640px) { .stat .foot { white-space: normal; overflow: visible; text-overflow: clip; } }

/* ================= v4: sign-in, consent, main panel, super admin ================= */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 42px; }
.eye-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.eye-btn:hover { color: var(--ink); background: var(--hover); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand svg, .auth-brand .brand-mark { width: 42px; height: 42px; flex: none; }
.auth-brand b { display: block; font-size: 15px; }
.auth-brand span { font-size: 12.5px; color: var(--muted); }
.auth-card .c { text-align: center; display: block; }
.auth-foot { text-align: center; margin: 18px 0 0; }
.otp-input { font-size: 22px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.totp-setup { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.totp-qr { width: 150px; height: 150px; background: #fff; border-radius: 8px; padding: 4px; }
.totp-qr svg { width: 100%; height: 100%; display: block; }
.totp-steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: grid; gap: 6px; }
.totp-key { display: block; margin-top: 4px; font-size: 13px; letter-spacing: .06em; background: var(--surface); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; word-break: break-all; }
@media screen and (max-width: 520px) { .totp-setup { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
.blocked-card { text-align: center; }
.blocked-card .blocked-msg { margin: 16px 0; padding: 14px 16px; border-radius: var(--r); background: var(--bad-soft); color: var(--ink); text-align: left; line-height: 1.55; }
.blocked-icon { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); }
.blocked-icon.not_started { background: var(--accent-soft); color: var(--accent-text); }
.consent { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 400; width: min(720px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 14px 16px; display: flex; gap: 16px; align-items: center; animation: fade .2s ease-out; }
.consent.out { opacity: 0; transition: opacity .2s; }
.consent-text { flex: 1; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.consent-text b { color: var(--ink); font-size: 14px; }
.consent-actions { display: flex; gap: 8px; flex: none; }
@media screen and (max-width: 640px) { .consent { flex-direction: column; align-items: stretch; } .consent-actions .btn { flex: 1; } }
.menu-list .menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.menu-list .menu-item:hover { background: var(--hover); }
.menu-list .menu-item svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.sub-warn { display: flex; align-items: center; gap: 10px; margin: 14px var(--pad) 0; padding: 10px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.sub-warn svg { flex: none; width: 18px; height: 18px; }
.sub-warn span { flex: 1; color: var(--ink-2); } .sub-warn b { color: var(--warn); }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); align-items: start; }

/* main panel */
.hub-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; align-items: center; padding: 22px 26px; border-radius: var(--r-lg); color: #fff;
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #0c0c12)); }
.hub-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.hub-big { font-size: clamp(28px, 3vw, 38px); font-weight: 700; letter-spacing: -0.02em; margin: 4px 0; }
.hub-sub { font-size: 13.5px; opacity: .9; }
.hub-sub .up, .hub-sub .down { font-weight: 650; color: #fff; }
.hub-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.hub-facts > div { background: rgba(255, 255, 255, .12); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.hub-facts dt { font-size: 12px; opacity: .8; }
.hub-facts dd { margin: 3px 0 0; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-facts small { display: block; color: inherit !important; opacity: .8; font-weight: 500; font-size: 12px; margin-top: 1px; }
.hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.hub-mod { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.hub-mod header { display: flex; gap: 12px; align-items: flex-start; }
.hub-mod header > div { flex: 1; min-width: 0; }
.hub-mod h2 { font-size: 16px; margin: 0 0 2px; }
.hub-mod p { margin: 0; font-size: 12.5px; color: var(--muted); }
.hub-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.hub-ic svg { width: 21px; height: 21px; }
.hub-mod.soon { background: var(--surface-2); border-style: dashed; }
.hub-mod.soon .hub-ic { background: var(--hover); color: var(--muted); }
.hub-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.hub-mini > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.hub-mini dt { font-size: 11.5px; color: var(--muted); }
.hub-mini dd { margin: 2px 0 0; font-weight: 650; }
.hub-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.hub-plan { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; display: grid; gap: 4px; }
.hub-soon { margin-top: auto; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.hub-month { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 8px; flex: 1; min-height: 0; padding: 4px 18px 14px; }
.hub-pl { margin: 0; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.hub-pl > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.hub-pl dt { color: var(--muted); } .hub-pl dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hub-pl .net { border-top: 1px solid var(--line); padding-top: 10px; font-size: 15px; } .hub-pl .net dt { color: var(--ink); font-weight: 600; }
.hub-bars { height: auto; min-height: 200px; flex: 1; padding: 14px 18px 10px; gap: 3px; }
.hub-bars .bar b { display: none; }
.list li a.grow { color: inherit; text-decoration: none; }
@media screen and (max-width: 1280px) { .hub-hero { grid-template-columns: minmax(0, 1fr); } }
@media screen and (max-width: 1100px) { .hub-grid { grid-template-columns: minmax(0, 1fr); } .hub-mini { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hub-month { grid-template-columns: minmax(0, 1fr); } }
@media screen and (max-width: 640px) {
  .hub-hero { padding: 18px; } .hub-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hub-bars { height: 150px; } .hub-bars .bar small { font-size: 9px; }
  .sub-warn { margin: 10px 12px 0; }
}

/* super admin */
.sa-mark { background: #1C1830; color: #fff; display: grid; place-items: center; border-radius: 10px; }
.sa-mark svg { width: 20px; height: 20px; }
.sa-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
body.sa .brand-mark.sa-mark { width: 36px; height: 36px; }
.sa-who { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.sa-search { width: min(320px, 100%); height: 36px; }
.sa-flash { margin-bottom: 14px; }
.form-section { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 4px; }
.drawer .chips { border: 0; padding: 0; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; margin-top: 4px; font: inherit; font-size: 12.5px; color: var(--accent-text); cursor: pointer; align-self: flex-start; }
dl.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; text-align: left; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline { display: inline; }
.inline-form select { height: 34px; width: auto; }
.secret { display: inline-flex; align-items: center; gap: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.secret.shown .secret-val { color: var(--accent-text); font-weight: 650; }
.danger-zone { border-color: var(--bad-soft); }
.danger-zone .panel-head h2 { color: var(--bad); }
.plain-list { margin: 0; padding-left: 18px; }
.sa-preview { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2); }
.sa-preview .brand-mark { width: 36px; height: 36px; }
.sa-preview .brand-text { display: flex; flex-direction: column; } .sa-preview .brand-text span { font-size: 12px; color: var(--muted); }
.auth-card .totp-setup { grid-template-columns: minmax(0, 1fr); justify-items: center; } .auth-card .totp-steps { justify-self: stretch; }
.hub-bars .bar:nth-child(even) small { visibility: hidden; }

/* ================= v5: one platform for the whole pump ================= */
/* menu areas */
.area-switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin: 4px 12px 2px; padding: 4px; background: var(--hover); border-radius: 12px; }
.area-switch button { font: inherit; border: 0; background: none; color: var(--muted); border-radius: 9px; padding: 7px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font-size: 11.5px; font-weight: 600; }
.area-switch button svg { width: 18px; height: 18px; }
.area-switch button:hover { color: var(--ink); }
.area-switch button.active { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 2px color-mix(in srgb, var(--shade) 12%, transparent); }
.nav-area-name { font-size: 15px; font-weight: 650; color: var(--ink); padding: 14px 12px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a .soon { margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 650; color: var(--muted); background: var(--hover); border-radius: 999px; padding: 1px 6px; }
.nav a.active .soon { background: var(--surface); }
.shell.collapsed .area-switch { grid-auto-flow: row; margin: 6px 10px; }
.shell.collapsed .area-switch button span, .shell.collapsed .nav-area-name, .shell.collapsed .nav a .soon { display: none; }
@media screen and (max-width: 900px) {
  .shell.collapsed .area-switch { grid-auto-flow: column; }
  .shell.collapsed .area-switch button span, .shell.collapsed .nav-area-name { display: block; }
}
/* small buttons that fit one row inside cards */
.btn.xs { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn.xs svg { width: 14px; height: 14px; }
.badge.phase { background: var(--hover); color: var(--ink-2); }
.seg-tabs a.seg-link { font-size: 13px; font-weight: 550; color: var(--muted); border-radius: 6px; padding: 5px 11px; text-decoration: none; white-space: nowrap; }
.seg-tabs a.seg-link:hover { color: var(--ink); }
.seg-tabs a.seg-link.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--shade) 12%, transparent); }
/* main panel: business cards */
.hub-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hub-bar h2 { margin: 0; font-size: 17px; }
.hub-bar .spacer { flex: 1; }
.biz-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.biz-card header { display: flex; gap: 12px; align-items: flex-start; }
.biz-card header .grow { min-width: 0; }
.biz-card h3 { margin: 0 0 2px; font-size: 15.5px; }
.biz-card header p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.biz-card .hub-ic { width: 38px; height: 38px; }
.biz-pl { margin: 0; display: grid; gap: 7px; }
.biz-pl > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.biz-pl dt { color: var(--muted); }
.biz-pl dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.biz-pl .net { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 2px; font-size: 15.5px; }
.biz-pl .net dt { color: var(--ink); font-weight: 600; }
.biz-pl .net dd { font-weight: 700; }
.biz-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.biz-links { display: flex; gap: 6px; flex-wrap: nowrap; margin-top: auto; }
.biz-links .btn { flex: 1 1 0; min-width: 0; justify-content: center; }
.biz-card.soon { background: var(--surface-2); border-style: dashed; }
.biz-card.soon .hub-ic { background: var(--hover); color: var(--muted); }
.biz-card.soon .biz-pl dd { color: var(--ink-2); }
.biz-card.total { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); border-color: var(--accent-line); }
.biz-card.total .hub-ic { background: var(--accent); color: #fff; }
.cols-4 > .span-3 { grid-column: span 3; }
@media screen and (max-width: 1280px) { .cols-4 > .span-3 { grid-column: 1 / -1; } }
@media screen and (max-width: 640px) { .biz-links { flex-wrap: wrap; } }
/* pump reports */
.range-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-form input[type=date] { width: auto; height: 36px; }
table.pnl-grid tr.pnl-sub td { font-weight: 650; background: var(--surface-2); }
table.pnl-grid tr.pnl-total td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--line-strong); }
.badge.biz-pump { background: var(--accent-soft); color: var(--accent-text); }
.badge.biz-oil { background: var(--warn-soft); color: var(--warn); }
.badge.biz-fuel { background: var(--bad-soft); color: var(--bad); }
/* pages of later phases */
.coming-hero { display: flex; gap: 16px; align-items: center; padding: 22px 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px dashed var(--line-strong); }
.coming-hero .hub-ic { width: 52px; height: 52px; border-radius: 14px; }
.coming-hero .hub-ic svg { width: 26px; height: 26px; }
.coming-hero .grow { flex: 1; min-width: 0; }
.coming-hero h2 { margin: 2px 0 4px; font-size: 20px; }
.coming-hero p { margin: 0; color: var(--ink-2); max-width: 760px; }
.coming-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.coming-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.coming-feat { display: flex; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.coming-feat > svg { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 2px; }
.coming-feat b { display: block; margin-bottom: 3px; }
.coming-feat p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.ghosted { opacity: .62; }
.stat.ghosted .value { color: var(--muted); }
@media screen and (max-width: 1100px) { .coming-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media screen and (max-width: 640px) { .coming-grid { grid-template-columns: minmax(0, 1fr); } .coming-hero { flex-direction: column; align-items: flex-start; padding: 18px; } }
.biz-card header p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.biz-pl dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media screen and (max-width: 1500px) and (min-width: 1281px) {
  .biz-card { padding: 14px; gap: 12px; }
  .biz-card .hub-ic { display: none; }
  .biz-pl > div { font-size: 12.5px; }
  .biz-pl .net { font-size: 14px; }
  .biz-links .btn.xs { padding: 0 6px; font-size: 12px; }
}

/* ================= v7: soft motion (transform/opacity only, short, skipped for "reduce motion") ================= */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes grow-up { from { transform: scaleY(0); } }
@keyframes seg-in { from { stroke-dasharray: 0 400; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
/* page content arrives softly after each page change; the first blocks follow one another */
.content.enter > :not(.stack-page), .content.enter > .stack-page > * { animation: rise .32s var(--ease) both; }
.content.enter > .stack-page > :nth-child(2) { animation-delay: .04s; }
.content.enter > .stack-page > :nth-child(3) { animation-delay: .08s; }
.content.enter > .stack-page > :nth-child(4) { animation-delay: .12s; }
.content.enter > .stack-page > :nth-child(n+5) { animation-delay: .15s; }
/* charts */
.bars .bar i { transform-origin: bottom; animation: grow-up .55s var(--ease) both; }
.bars .bar:nth-child(odd) i { animation-delay: .04s; }
.donut-svg .seg { animation: seg-in .8s var(--ease) both; }
/* menus, alerts and messages */
.pop:not(.hidden) { animation: pop-in .16s var(--ease); transform-origin: top right; }
.toast { animation: toast-in .22s var(--ease); }
.consent { animation: rise .3s var(--ease); }
.auth-card { animation: rise .35s var(--ease) both; }
/* things you can press respond gently */
.btn { transition: background .15s, border-color .15s, box-shadow .15s, transform .12s var(--ease); }
.btn:active:not([disabled]) { transform: scale(.97); }
.nav a { transition: background .15s, color .15s; }
.nav a.active::before { animation: pop-in .2s var(--ease); }
.area-switch button { transition: background .18s, color .18s, box-shadow .18s; }
.nav-area:not(.hidden) { animation: rise .22s var(--ease); }
.seg-tabs button, .seg-tabs a.seg-link, .tabs button, .chip { transition: background .15s, color .15s, box-shadow .15s, border-color .15s; }
input, select, textarea { transition: border-color .15s, box-shadow .15s; }
input.sw, input.sw::after { transition: background .18s, transform .2s var(--ease); }
/* cards that open something lift a little */
a.stat, button.stat, .acc-card, .role-card { transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; }
a.stat:hover, button.stat:hover, .acc-card:hover, .role-card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -18px color-mix(in srgb, var(--shade) 45%, transparent); }
.biz-card { transition: box-shadow .2s, border-color .2s; }
.biz-card:hover { box-shadow: 0 14px 30px -24px color-mix(in srgb, var(--shade) 45%, transparent); }
table.data tbody tr td { transition: background .12s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
