/* ProBite POS — design system (kept from ProPharma). System fonts only (store PCs work offline). Light + dark, motion respects reduced-motion. */
:root {
  color-scheme: light;
  /* Brand: pine green + lime (signature), forest-green accent for links/focus. Neutrals: warm cream. */
  --pine: #10372f; --pine-2: #174a3f; --pine-3: #1e5a4c; --lime: #d4f07a; --lime-2: #c3e35d; --on-pine: #e8f1ec;
  --serif: Georgia, Cambria, "Times New Roman", serif;
  --brand: #17806a; --brand-strong: #10372f; --brand-ink: #136b59; --brand-soft: rgb(23 128 106 / .09); --brand-ring: rgb(23 128 106 / .25);
  --brand-grad: linear-gradient(135deg, #2a7a66 0%, #174a3f 55%, #10372f 100%);
  --btn-grad: linear-gradient(180deg, #194f43 0%, #10372f 100%); --btn-ink: #ffffff; --btn-glow: rgb(16 55 47 / .45);
  --hero-bg: #10372f; --side-bg: #10372f;
  --bg: #f6f5ef; --bg-tint: rgb(212 240 122 / .16); --bg-tint-2: rgb(23 128 106 / .05);
  --card: #ffffff; --card-2: #fbfaf6; --elev: #ffffff;
  --text: #13231f; --text-2: #34443f; --muted: #66746f; --faint: #a3aea9;
  --line: rgb(16 55 47 / .08); --line-2: rgb(16 55 47 / .15); --fill: rgb(16 55 47 / .045); --fill-2: rgb(16 55 47 / .08);
  --glass: rgb(246 245 239 / .8); --glass-side: rgb(16 55 47 / .97);
  --ok: #0f8a4a; --ok-soft: rgb(16 163 90 / .11); --warn: #a15c00; --warn-soft: rgb(245 158 11 / .15);
  --danger: #c8312b; --danger-soft: rgb(220 50 47 / .1); --info: #1f6fd1; --info-soft: rgb(42 120 214 / .1);
  --violet: #5b48d0; --violet-soft: rgb(98 80 214 / .1);
  /* icon tiles (macOS-settings style squares) */
  --t-teal: linear-gradient(160deg, #3a9b80, #17614f); --t-blue: linear-gradient(160deg, #60a5fa, #2563eb);
  --t-green: linear-gradient(160deg, #4ade80, #16a34a); --t-orange: linear-gradient(160deg, #fdba74, #f97316);
  --t-amber: linear-gradient(160deg, #fcd34d, #f59e0b); --t-red: linear-gradient(160deg, #fb7185, #e11d48);
  --t-indigo: linear-gradient(160deg, #a5b4fc, #4f46e5); --t-violet: linear-gradient(160deg, #c4b5fd, #7c3aed);
  --t-pink: linear-gradient(160deg, #f9a8d4, #db2777); --t-cyan: linear-gradient(160deg, #67e8f9, #0891b2);
  --t-slate: linear-gradient(160deg, #cbd5e1, #64748b); --t-brown: linear-gradient(160deg, #d6b48a, #a16207);
  /* charts (validated reference palette, light) */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --grid: #e8ebef; --axis: #c3c8d0;
  --radius: 18px; --radius-md: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(16 55 47 / .04), 0 3px 12px -2px rgb(16 55 47 / .06);
  --shadow-2: 0 2px 4px rgb(16 55 47 / .05), 0 16px 36px -8px rgb(16 55 47 / .16);
  --shadow-lg: 0 30px 60px -12px rgb(16 55 47 / .32), 0 0 0 1px rgb(16 55 47 / .06);
  --sheen: linear-gradient(180deg, rgb(255 255 255 / .9), rgb(255 255 255 / 0) 60%);
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.4, .64, 1);
  --side-w: 256px;
  --font: "Segoe UI Variable Text", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
  --font-num: "Segoe UI Variable Display", -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #5fd3b2; --brand-strong: #8be3c8; --brand-ink: #7fdcbf; --brand-soft: rgb(95 211 178 / .12); --brand-ring: rgb(95 211 178 / .3);
    --btn-grad: linear-gradient(180deg, #dcf58a 0%, #c6e65f 100%); --btn-ink: #10372f; --btn-glow: rgb(212 240 122 / .25);
    --hero-bg: #0f2d26; --side-bg: #0c1b17; --on-pine: #e8f1ec;
    --bg: #0a100e; --bg-tint: rgb(212 240 122 / .05); --bg-tint-2: rgb(95 211 178 / .05);
    --card: #111a17; --card-2: #15201c; --elev: #1a2622;
    --text: #eef3ef; --text-2: #c9d6d0; --muted: #8fa199; --faint: #55665f;
    --line: rgb(255 255 255 / .075); --line-2: rgb(255 255 255 / .14); --fill: rgb(255 255 255 / .055); --fill-2: rgb(255 255 255 / .095);
    --glass: rgb(10 16 14 / .8); --glass-side: rgb(12 27 23 / .97);
    --ok: #34d399; --ok-soft: rgb(52 211 153 / .13); --warn: #fbbf24; --warn-soft: rgb(251 191 36 / .13);
    --danger: #fb7185; --danger-soft: rgb(251 113 133 / .13); --info: #60a5fa; --info-soft: rgb(96 165 250 / .13);
    --violet: #a78bfa; --violet-soft: rgb(167 139 250 / .13);
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --grid: #23272e; --axis: #343a43;
    --shadow: 0 0 0 1px rgb(255 255 255 / .03), 0 4px 14px -4px rgb(0 0 0 / .5); --shadow-2: 0 0 0 1px rgb(255 255 255 / .05), 0 16px 36px -8px rgb(0 0 0 / .65);
    --shadow-lg: 0 30px 60px -12px rgb(0 0 0 / .75), 0 0 0 1px rgb(255 255 255 / .08);
    --sheen: linear-gradient(180deg, rgb(255 255 255 / .035), rgb(255 255 255 / 0) 60%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #5fd3b2; --brand-strong: #8be3c8; --brand-ink: #7fdcbf; --brand-soft: rgb(95 211 178 / .12); --brand-ring: rgb(95 211 178 / .3);
  --btn-grad: linear-gradient(180deg, #dcf58a 0%, #c6e65f 100%); --btn-ink: #10372f; --btn-glow: rgb(212 240 122 / .25);
  --hero-bg: #0f2d26; --side-bg: #0c1b17; --on-pine: #e8f1ec;
  --bg: #0a100e; --bg-tint: rgb(212 240 122 / .05); --bg-tint-2: rgb(95 211 178 / .05);
  --card: #111a17; --card-2: #15201c; --elev: #1a2622;
  --text: #eef3ef; --text-2: #c9d6d0; --muted: #8fa199; --faint: #55665f;
  --line: rgb(255 255 255 / .075); --line-2: rgb(255 255 255 / .14); --fill: rgb(255 255 255 / .055); --fill-2: rgb(255 255 255 / .095);
  --glass: rgb(10 16 14 / .8); --glass-side: rgb(12 27 23 / .97);
  --ok: #34d399; --ok-soft: rgb(52 211 153 / .13); --warn: #fbbf24; --warn-soft: rgb(251 191 36 / .13);
  --danger: #fb7185; --danger-soft: rgb(251 113 133 / .13); --info: #60a5fa; --info-soft: rgb(96 165 250 / .13);
  --violet: #a78bfa; --violet-soft: rgb(167 139 250 / .13);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --grid: #23272e; --axis: #343a43;
  --shadow: 0 0 0 1px rgb(255 255 255 / .03), 0 4px 14px -4px rgb(0 0 0 / .5); --shadow-2: 0 0 0 1px rgb(255 255 255 / .05), 0 16px 36px -8px rgb(0 0 0 / .65);
  --shadow-lg: 0 30px 60px -12px rgb(0 0 0 / .75), 0 0 0 1px rgb(255 255 255 / .08);
  --sheen: linear-gradient(180deg, rgb(255 255 255 / .035), rgb(255 255 255 / 0) 60%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 14px/1.5 var(--font); letter-spacing: 0;
  background: radial-gradient(1100px 520px at 85% -8%, var(--bg-tint), transparent 70%),
    radial-gradient(900px 480px at 15% -12%, var(--bg-tint-2), transparent 70%), var(--bg) fixed;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "calt";
}
.num, .value, .n, .big, .total, .price, .val, td, .tip, .delta { font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--fill-2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }
.ico { width: 18px; height: 18px; flex: none; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--brand-ring); }

/* ───────── Sidebar (frosted, like a macOS source list) ───────── */
#sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40; display: flex; flex-direction: column;
  background: var(--glass-side); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid rgb(255 255 255 / .06); color: var(--on-pine);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 14px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--lime); color: var(--pine); display: grid; place-items: center; flex: none;
  box-shadow: 0 8px 18px -8px rgb(212 240 122 / .55), inset 0 1px 0 rgb(255 255 255 / .5); }
.logo svg { width: 20px; height: 20px; }
.brand-text { min-width: 0; }
#store { font: 650 15px/1.25 var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
#branch { display: block; color: rgb(232 241 236 / .6); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
#nav::before { content: 'Menu'; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: rgb(212 240 122 / .7); padding: 10px 10px 8px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 11px; color: rgb(232 241 236 / .82); font-size: 13.5px;
  font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease), box-shadow .2s; text-decoration: none; }
.nav-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--lime); background: rgb(255 255 255 / .07);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06); transition: transform .35s var(--spring), background .2s, color .2s; }
#nav .nav-ico[data-k] { background: rgb(255 255 255 / .07); }
.nav-ico .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.nav-ico[data-k="dashboard"] { background: var(--t-blue); } .nav-ico[data-k="billing"] { background: var(--t-green); }
.nav-ico[data-k="sales"] { background: var(--t-indigo); } .nav-ico[data-k="customers"] { background: var(--t-pink); }
.nav-ico[data-k="suppliers"] { background: var(--t-brown); } .nav-ico[data-k="reports"] { background: var(--t-violet); }
.nav-ico[data-k="companies"] { background: var(--t-cyan); } .nav-ico[data-k="branches"] { background: var(--t-amber); }
.nav-ico[data-k="users"] { background: var(--t-slate); }
.nav-ico[data-k="pos"] { background: var(--t-green); } .nav-ico[data-k="orders"] { background: var(--t-indigo); }
.nav-ico[data-k="tables"] { background: var(--t-amber); } .nav-ico[data-k="kitchen"] { background: var(--t-red); }
.nav-ico[data-k="shift"] { background: var(--t-teal); } .nav-ico[data-k="items"] { background: var(--t-orange); }
.nav-ico[data-k="setup"] { background: var(--t-slate); } .nav-ico[data-k="stock"] { background: var(--t-brown); }
#nav a:hover { background: rgb(255 255 255 / .06); color: #fff; }
#nav a:hover .nav-ico { transform: scale(1.08) rotate(-3deg); }
#nav a:active { transform: scale(.98); }
#nav a.active { background: var(--lime); color: var(--pine); font-weight: 650; box-shadow: 0 8px 20px -10px rgb(212 240 122 / .6); }
#nav a.active .nav-ico[data-k] { background: var(--pine); color: var(--lime); box-shadow: none; }
#provider { padding: 14px 18px 18px; font-size: 11.5px; line-height: 1.6; border-top: 1px solid rgb(255 255 255 / .08); color: rgb(232 241 236 / .5); }
#provider strong { color: rgb(232 241 236 / .85); font-weight: 600; }
#provider a { display: block; color: rgb(232 241 236 / .6); }
#scrim { display: none; }

/* ───────── Shell + top bar ───────── */
.shell { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 32px; min-height: 68px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line); }
.titles { min-width: 0; }
#pageTitle { margin: 0; font: 650 26px/1.1 var(--font-display); letter-spacing: -.035em; }
#pageSub { color: var(--muted); font-size: 12.5px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { display: none; background: var(--fill); color: var(--text); border: 0; padding: 8px; border-radius: var(--radius-sm); min-height: 0; }
.icon-btn:hover { background: var(--fill-2); }
#branchPick { min-width: 190px; }
main { padding: 26px 32px 56px; width: 100%; max-width: 1480px; flex: 1; }
main.enter > * { animation: rise .5s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .04s; } main.enter > *:nth-child(3) { animation-delay: .08s; }
main.enter > *:nth-child(4) { animation-delay: .12s; } main.enter > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }

/* Sync pill */
button.sync { display: inline-flex; align-items: center; gap: 7px; background: var(--card); color: var(--text); border: 1px solid var(--line); background-image: none;
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); min-height: 32px; }
button.sync:hover { background: var(--card-2); }
button.sync::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
button.sync.online::before { background: #34c759; box-shadow: 0 0 0 3px rgb(52 199 89 / .2); animation: breathe 2.8s ease-in-out infinite; }
button.sync.syncing::before { background: #ffcc00; animation: pulse 1s infinite; }
button.sync.offline { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
button.sync.offline::before { background: #ff9500; }
button.sync.locked { background: var(--danger); color: #fff; border-color: transparent; }
button.sync.locked::before { background: #fff; }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes breathe { 50% { box-shadow: 0 0 0 5px rgb(52 199 89 / .08); } }

/* User menu */
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 10px 4px 4px;
  border-radius: 999px; user-select: none; transition: background .2s var(--ease); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover, .usermenu[open] summary { background: var(--fill); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; letter-spacing: .02em;
  color: var(--lime); background: var(--pine); box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px rgb(212 240 122 / .7); }
.who { display: flex; flex-direction: column; line-height: 1.2; }
.who strong { font-size: 13px; font-weight: 600; }
.who small { color: var(--muted); font-size: 11.5px; }
.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .25s var(--ease); }
.usermenu[open] .chev { transform: rotate(180deg); }
.usermenu .menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--elev); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 230px; z-index: 50; transform-origin: top right; animation: menu .22s var(--spring); }
@keyframes menu { from { opacity: 0; transform: scale(.94) translateY(-4px); } }
.usermenu .menu button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; color: var(--text);
  padding: 9px 10px; border-radius: 8px; text-align: left; font-weight: 500; box-shadow: none; }
.usermenu .menu button:hover { background: var(--fill); }
.menu-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.menu .seg { margin: 0 6px 6px; display: flex; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* Banner */
#banner.banner { margin: 16px 32px 0; padding: 12px 16px; border-radius: var(--radius-md); font-weight: 600; animation: rise .4s var(--ease); }
#banner.warn { background: var(--warn-soft); color: var(--warn); }
#banner.danger { background: var(--danger-soft); color: var(--danger); }
#banner .banner-btn { margin-left: 12px; padding: 6px 14px; border-radius: 999px; border: 0; font: inherit; font-size: 13px; font-weight: 700;
  background: var(--danger); color: #fff; cursor: pointer; box-shadow: none; vertical-align: middle; }
#banner .banner-btn:hover { filter: brightness(1.08); }

/* ───────── Signed out (sign in / activate / setup) ───────── */
body.logged-out #sidebar, body.logged-out .topbar, body.logged-out #scrim { display: none; }
body.logged-out .shell { margin-left: 0; }
body.logged-out main { max-width: none; padding: 0; display: flex; }
/* ───────── Sign-in (pine green + lime, cream panel) ───────── */
.auth { --pine: #10372f; --pine-2: #174a3f; --lime: #d4f07a; --lime-ink: #10372f; --cream: #f8f7f2; --ink: #10372f; --ink-2: #4b5d57;
  --a-card: #eef2e2; --a-card-line: #dfe6cc; --a-input: #fff; --serif: Georgia, Cambria, "Times New Roman", serif;
  flex: 1; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(440px, 1fr); min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; isolation: isolate; color: #e8f1ec; background: var(--pine);
  padding: clamp(32px, 5vw, 56px) clamp(28px, 6vw, 100px); display: flex; flex-direction: column; }
.auth-hero .arcs { position: absolute; inset: auto -10% -18% auto; width: 760px; height: 760px; z-index: -1; fill: none; stroke: rgb(212 240 122 / .08); stroke-width: 1.2; }
.auth-hero .brand { padding: 0; display: flex; align-items: center; gap: 14px; }
.auth-hero .logo { width: 48px; height: 48px; border-radius: 13px; background: var(--lime); color: var(--lime-ink); box-shadow: none; }
.auth-hero .logo svg { width: 22px; height: 22px; }
.auth-hero .brand .name { color: #fff; font: 700 26px/1 var(--font-display); letter-spacing: -.03em; }
.auth-hero .brand .name em { font-style: normal; color: var(--lime); }
.auth .eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.auth-hero .hero-copy { margin: auto 0 0; padding-top: 48px; animation: rise .7s var(--ease) both; }
.auth-hero .eyebrow { color: var(--lime); opacity: .9; margin-bottom: 22px; }
.auth-hero h2 { color: #fff; font: 600 clamp(40px, 4.6vw, 66px)/1.02 var(--font-display); letter-spacing: -.045em; margin: 0 0 26px; max-width: 640px; }
.auth-hero h2 em { font: italic 400 1.08em/1 var(--serif); letter-spacing: -.03em; color: var(--lime); }
.auth-hero p.lead { margin: 0; max-width: 470px; font-size: 17px; line-height: 1.6; color: rgb(232 241 236 / .78); }
.status-card { margin: 44px 0 auto; max-width: 470px; border-radius: 18px; background: var(--pine-2); border: 1px solid rgb(255 255 255 / .09);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / .45); transform: rotate(-1.6deg); transform-origin: left top; animation: cardIn .9s var(--ease) both .15s; }
@keyframes cardIn { from { opacity: 0; transform: rotate(-1.6deg) translateY(16px); } }
.status-card .sc-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid rgb(255 255 255 / .08);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgb(232 241 236 / .85); }
.status-card .sc-head span { display: flex; align-items: center; gap: 9px; }
.status-card .sc-head i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgb(212 240 122 / .15); }
.status-card .sc-head b { color: var(--lime); font: italic 700 16px/1 var(--serif); letter-spacing: 0; text-transform: none; }
.status-card .sc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 20px; font-size: 14px; color: rgb(232 241 236 / .9); }
.status-card .sc-row + .sc-row { border-top: 1px solid rgb(255 255 255 / .06); }
.status-card .sc-row span { display: flex; align-items: center; gap: 10px; }
.status-card .sc-row .ico { width: 16px; height: 16px; color: var(--lime); opacity: .85; }
.status-card .sc-row em { font-style: normal; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  background: rgb(212 240 122 / .12); color: var(--lime); border: 1px solid rgb(212 240 122 / .18); }
.auth-hero .prov { font-size: 12.5px; color: rgb(232 241 236 / .5); margin-top: 36px; }
.auth-hero .prov a { color: rgb(232 241 236 / .78); }

.auth-panel { display: flex; flex-direction: column; background: var(--cream); color: var(--ink); padding: clamp(28px, 4vw, 52px) clamp(24px, 6vw, 96px); }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.auth-top a { text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink-2); text-decoration: none; }
.auth-top a:hover { color: var(--ink); text-decoration: underline; }
.auth-main { margin: auto 0; width: 100%; max-width: 520px; align-self: center; padding: 40px 0; animation: rise .7s var(--ease) both .08s; }
.auth-main .eyebrow { color: #17806a; margin-bottom: 18px; }
.auth-main h1 { margin: 0 0 12px; font: 600 clamp(36px, 3.6vw, 50px)/1.05 var(--font-display); letter-spacing: -.04em; color: var(--ink); }
.auth-main .sub { margin: 0 0 30px; font-size: 16.5px; line-height: 1.55; color: var(--ink-2); }
.auth-card { background: var(--a-card); border: 1px solid var(--a-card-line); border-radius: 20px; padding: 26px 28px 28px; }
.chip-live { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #17806a; }
.chip-live i { width: 8px; height: 8px; border-radius: 50%; background: #17806a; box-shadow: 0 0 0 4px rgb(23 128 106 / .15); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(23 128 106 / 0); } }
.auth-foot { font-size: 12.5px; color: var(--ink-2); opacity: .8; }

.login { width: 100%; display: grid; gap: 16px; }
.login p { margin: 0; }
.login label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink); }
.auth .login input { padding: 13px 15px; font-size: 15px; background: var(--a-input); color: var(--ink); border: 1px solid var(--a-card-line);
  border-radius: 12px; box-shadow: none; }
.auth .login input:focus { outline: none; border-color: #17806a; box-shadow: 0 0 0 4px rgb(23 128 106 / .14); }
.auth .login input::placeholder { color: #9aa7a1; }
.auth .login button.go { width: 100%; margin-top: 6px; display: flex; justify-content: space-between; align-items: center; padding: 17px 22px;
  border-radius: 12px; background: var(--pine); color: #fff; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; border: 0;
  box-shadow: 0 12px 24px -12px rgb(16 55 47 / .7); transition: transform .15s, box-shadow .2s, background .2s; }
.auth .login button.go:hover { background: #0b2b24; filter: none; transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgb(16 55 47 / .8); }
.auth .login button.go .arrow { font-size: 20px; transition: transform .2s var(--ease); }
.auth .login button.go:hover .arrow { transform: translateX(4px); }
.auth .login button.go:disabled { opacity: .7; transform: none; }
.auth .login .form-error { color: #b42318; }
.auth .login .form-error:empty { display: none; }
.login .muted.small { margin-top: 4px; color: var(--ink-2); font-size: 12px; }

html[data-theme="dark"] .auth { --cream: #0c1311; --ink: #eef3ef; --ink-2: #9db0a8; --a-card: #142420; --a-card-line: #22382f; --a-input: #0f1b18; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .auth { --cream: #0c1311; --ink: #eef3ef; --ink-2: #9db0a8; --a-card: #142420; --a-card-line: #22382f; --a-input: #0f1b18; }
}
html[data-theme="dark"] .auth .auth-main .eyebrow, html[data-theme="dark"] .auth .chip-live { color: #5fd3b2; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .auth .auth-main .eyebrow, html:not([data-theme="light"]) .auth .chip-live { color: #5fd3b2; }
}

/* ───────── Typography & basics ───────── */
h2 { margin: 0 0 14px; font: 650 16.5px/1.3 var(--font-display); letter-spacing: -.012em; }
h3 { margin: 18px 0 8px; font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 34px 16px; margin: 0; background: var(--card-2); border-radius: var(--radius-md); }
.card { background: var(--sheen), var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card + .card { margin-top: 20px; }
.card.click { cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.card.click:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar #cat { max-width: 200px; }
.toolbar label.muted { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cols-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.key { font-family: "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 1.3rem; letter-spacing: .06em; background: var(--brand-soft); color: var(--brand-ink);
  padding: 16px; border-radius: var(--radius-sm); text-align: center; user-select: all; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 2px 12px; }
.section-title h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }

/* ───────── Forms & buttons ───────── */
input, select, textarea { font: inherit; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background-color: var(--card);
  color: inherit; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s; min-height: 38px; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 14px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 17px; height: 17px; accent-color: var(--brand); }
input[type="date"] { min-height: 36px; }
button, label.button, a.button { font: inherit; font-weight: 600; background: var(--btn-grad); color: var(--btn-ink); border: 0; padding: 8px 16px;
  border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease), opacity .2s; min-height: 38px;
  box-shadow: 0 1px 2px rgb(16 55 47 / .1), 0 6px 14px -6px var(--btn-glow), inset 0 1px 0 rgb(255 255 255 / .12); text-decoration: none; }
button:hover, a.button:hover { background: var(--btn-grad); filter: brightness(1.12); text-decoration: none;
  box-shadow: 0 1px 2px rgb(16 55 47 / .1), 0 10px 20px -8px var(--btn-glow), inset 0 1px 0 rgb(255 255 255 / .12); }
button:active, label.button:active { transform: scale(.97); }
button:focus-visible, label.button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-ring); }
button.secondary, label.button.secondary, a.button.secondary { background: var(--card); color: var(--text); filter: none;
  box-shadow: 0 0 0 1px var(--line-2), 0 1px 2px rgb(15 23 41 / .05); }
button.secondary:hover, label.button.secondary:hover, a.button.secondary:hover { background: var(--card-2); filter: none;
  box-shadow: 0 0 0 1px var(--faint), 0 2px 6px -2px rgb(15 23 41 / .12); }
button.danger { color: #fff; background: linear-gradient(180deg, #ef4444, #d12f2f); box-shadow: 0 4px 12px -4px rgb(220 50 47 / .55), inset 0 1px 0 rgb(255 255 255 / .2); }
button.danger:hover { background: var(--danger); filter: brightness(.92); }
button.ghost { background: none; color: var(--brand-ink); box-shadow: none; }
button.ghost:hover { background: var(--brand-soft); filter: none; box-shadow: none; }
button.small, label.button.small { padding: 4px 11px; font-size: 12.5px; min-height: 30px; border-radius: 8px; }
button.icon { background: none; color: var(--muted); padding: 4px 8px; min-height: 0; box-shadow: none; }
button.icon:hover { background: var(--fill); color: var(--text); filter: none; box-shadow: none; }
button.big { padding: 12px 26px; font-size: 15px; min-height: 48px; border-radius: 12px; }
button:disabled { opacity: .5; cursor: default; transform: none; }
label.button { margin: 0; }

/* Search field with icon */
.field-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; max-width: 300px; }
.field-search .ico { position: absolute; left: 12px; color: var(--muted); width: 17px; height: 17px; pointer-events: none; }
.field-search input { width: 100%; padding-left: 38px; border-radius: 12px; background-color: var(--fill); border-color: transparent; }
.field-search input:focus { background: var(--card); }

/* Segmented control (iOS) */
.seg { display: inline-flex; background: var(--fill-2); border-radius: 10px; padding: 2px; gap: 2px; position: relative; flex-wrap: wrap; }
.seg button { background: none; color: var(--text-2); box-shadow: none; min-height: 30px; padding: 4px 13px; font-size: 13px; font-weight: 500; border-radius: 8px; }
.seg button:hover { background: var(--fill); filter: none; box-shadow: none; }
.seg button.on, .seg button.on:hover { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgb(15 23 41 / .14), 0 0 0 .5px rgb(15 23 41 / .05); }
.seg.lg button { min-height: 36px; padding: 6px 18px; font-size: 14px; }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: var(--fill); color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer; border: 0; min-height: 32px; box-shadow: none; transition: background .2s var(--ease), color .2s, transform .15s; }
.chip:hover { background: var(--fill-2); filter: none; box-shadow: none; }
.chip.on { background: var(--btn-grad); color: var(--btn-ink); box-shadow: 0 4px 10px -4px var(--btn-glow); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .7; font-size: 12px; }

/* ───────── Tables ───────── */
.scroll-x { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--card); }
.card > table.grid { display: block; overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th, table.grid td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid th { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--card-2); white-space: nowrap; letter-spacing: .06em; text-transform: uppercase;
  position: sticky; top: 0; z-index: 1; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr { transition: background .15s; }
table.grid tbody tr:hover td { background: var(--brand-soft); }
table.grid tbody tr { animation: fade .35s var(--ease) both; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
td .actions-inline { display: flex; gap: 6px; justify-content: flex-end; }

/* Badges + status dots */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--fill); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / .18); } .dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgb(245 158 11 / .2); }
.dot.danger { background: #ef4444; box-shadow: 0 0 0 3px rgb(239 68 68 / .18); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--fill); color: var(--muted); white-space: nowrap; line-height: 1.35; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill small { font-weight: 500; opacity: .8; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

/* ───────── Stat tiles / KPIs ───────── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stats.k3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .stats.k3 { grid-template-columns: repeat(2, 1fr); } }
.stats > * { animation: rise .55s var(--ease) both; }
.stats > *:nth-child(2) { animation-delay: .05s; } .stats > *:nth-child(3) { animation-delay: .1s; } .stats > *:nth-child(4) { animation-delay: .15s; }
.stats > *:nth-child(5) { animation-delay: .2s; } .stats > *:nth-child(6) { animation-delay: .25s; } .stats > *:nth-child(n+7) { animation-delay: .3s; }
.stat { background: var(--sheen), var(--card); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); --tone: rgb(23 128 106 / .12);
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: start; align-content: start; position: relative; overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
a.stat { color: inherit; text-decoration: none; }
a.stat:hover, .stat.click:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat::after { content: ''; position: absolute; width: 180px; height: 180px; right: -70px; top: -90px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, var(--tone), transparent 70%); opacity: .9; transition: transform .6s var(--ease); }
.stat:hover::after { transform: scale(1.25); }
.stat .value { font: 700 27px/1.15 var(--font-num); letter-spacing: -.025em; margin-top: 8px; grid-column: 1; white-space: nowrap; }
.stat .sub { color: var(--muted); font-size: 12px; grid-column: 1 / -1; margin-top: 2px; }
.stat .bubble { --bc: var(--brand); grid-column: 2; grid-row: 1 / 3; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; z-index: 1;
  color: var(--bc); background: color-mix(in srgb, var(--bc) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bc) 18%, transparent); }
.stat .bubble .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.stat.blue { --tone: rgb(23 128 106 / .1); } .stat.blue .bubble { --bc: var(--brand); }
.stat.violet { --tone: rgb(212 240 122 / .22); } .stat.violet .bubble { --bc: #4d7c0f; }
.stat.amber { --tone: rgb(245 158 11 / .13); } .stat.amber .bubble { --bc: #b45309; }
.stat.slate { --tone: rgb(100 116 139 / .1); } .stat.slate .bubble { --bc: var(--muted); }
.stat.alert { --tone: rgb(225 29 72 / .11); }
.stat.alert .value { color: var(--danger); }
.stat.alert .bubble { --bc: var(--danger); }
.stat:not(.alert) .bubble.off, a.stat:not(.alert) .bubble { --bc: var(--muted); }
:root[data-theme="dark"] .stat.violet .bubble { --bc: var(--lime); } :root[data-theme="dark"] .stat.amber .bubble { --bc: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stat.violet .bubble { --bc: var(--lime); }
  :root:not([data-theme="light"]) .stat.amber .bubble { --bc: var(--warn); } }
.stat > *:not(.spark) { position: relative; z-index: 1; }
.stat .spark { grid-column: 1 / -1; margin-top: 10px; height: 34px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.delta svg { width: 12px; height: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
a.hint { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-ink) !important; font-weight: 600; }
a.hint .ico { width: 14px; height: 14px; transition: transform .25s var(--ease); }
a.hint:hover { text-decoration: none; } a.hint:hover .ico { transform: translateX(3px); }

/* Hero (dashboard greeting) */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 30px 32px; margin-bottom: 22px; color: #fff; isolation: isolate;
  background: radial-gradient(620px 300px at 100% 0%, rgb(212 240 122 / .16), transparent 62%),
    radial-gradient(700px 320px at 0% 130%, rgb(95 211 178 / .16), transparent 60%),
    linear-gradient(135deg, var(--pine) 0%, var(--pine-2) 100%);
  box-shadow: 0 24px 48px -22px rgb(16 55 47 / .6), inset 0 1px 0 rgb(255 255 255 / .08); animation: rise .6s var(--ease) both; }
.hero::before { content: ''; position: absolute; inset: auto -120px -260px auto; width: 560px; height: 560px; border-radius: 50%; z-index: -1;
  border: 1px solid rgb(212 240 122 / .1); box-shadow: 0 0 0 70px rgb(212 240 122 / .025), 0 0 0 71px rgb(212 240 122 / .08); }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgb(255 255 255 / .05) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .05) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(ellipse at 70% 30%, #000 10%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 10%, transparent 70%); }
.hero h2 { margin: 0; font: 700 28px/1.15 var(--font-display); letter-spacing: -.03em; color: #fff; }
.hero p { margin: 6px 0 0; color: rgb(255 255 255 / .78); }
.hero .hero-figure { margin-top: 18px; display: flex; gap: 34px; flex-wrap: wrap; }
.hero .hero-figure .big { font: 700 46px/1 var(--font-num); letter-spacing: -.03em; text-shadow: 0 2px 20px rgb(0 0 0 / .15); }
.hero .hero-figure > div + div { padding-left: 34px; border-left: 1px solid rgb(255 255 255 / .16); }
.hero .hero-figure small { display: block; color: rgb(255 255 255 / .7); font-size: 12.5px; margin-top: 6px; }
.hero .delta.up, .hero .delta.down, .hero .delta.flat { color: var(--lime); background: rgb(212 240 122 / .12); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.hero .delta .muted { color: rgb(255 255 255 / .8) !important; }

/* ───────── Charts ───────── */
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; overflow: visible; }
.chart-box .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-box .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart-box .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-box .line { fill: none; stroke: var(--brand); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .line.draw { animation: draw 1.1s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: var(--len); } }
.chart-box .area { opacity: 0; animation: fadeIn .9s var(--ease) .35s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
.chart-box .enddot { fill: var(--brand); stroke: var(--card); stroke-width: 2; }
.chart-box .col { fill: var(--brand); transform-box: fill-box; transform-origin: bottom; animation: grow .7s var(--ease) both; }
.chart-box .col.muted { fill: var(--fill-2); }
.chart-box .col.hot { fill: var(--brand-strong); }
@keyframes grow { from { transform: scaleY(0); } }
.chart-box .hit { fill: transparent; cursor: crosshair; }
.chart-box .cross { stroke: var(--faint); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.chart-box .hoverdot { fill: var(--brand); stroke: var(--card); stroke-width: 2; pointer-events: none; }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--glass); backdrop-filter: blur(16px) saturate(180%); -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: var(--text); border-radius: 12px; padding: 9px 12px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); font-size: 12.5px; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); transition: opacity .12s;
  font-variant-numeric: tabular-nums; }
.tip strong { display: block; font-size: 14px; }
.tip .muted { font-size: 11.5px; }
/* Horizontal bar list */
.barlist { display: grid; gap: 12px; }
.barlist .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.barlist .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlist .name small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.barlist .val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.barlist .track { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.barlist .track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #9fd9a8, var(--brand)); width: 0; transition: width 1s var(--ease); }
.barlist .row:hover .track i { background: var(--brand-strong); }
/* Segmented (part-of-whole) bar + legend */
.segbar { display: flex; gap: 2px; height: 28px; border-radius: 6px; overflow: hidden; margin: 6px 0 14px; }
.segbar span { display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden;
  border-radius: 4px; min-width: 0; transform-origin: left; animation: growX .8s var(--ease) both; }
@keyframes growX { from { transform: scaleX(0); } }
.legend { display: grid; gap: 8px; }
.legend .item { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; }
.legend .item .num { color: var(--muted); }
.legend .item strong { font-variant-numeric: tabular-nums; }

/* ───────── Billing ───────── */
.billing { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.35fr); gap: 20px; align-items: start; }
.searchbox { position: relative; }
.searchbox .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
#q { width: 100%; padding: 14px 16px 14px 48px; font-size: 17px; min-height: 54px; border-radius: 14px; background: var(--fill); border-color: transparent; }
#q:focus { background: var(--card); }
.kbd-hints { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
kbd { font: 600 11px/1 "SF Mono", "Cascadia Mono", Consolas, monospace; padding: 3px 6px; border-radius: 5px; background: var(--card);
  border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--text-2); }
.results { list-style: none; padding: 0; margin: 12px 0 0; max-height: calc(100vh - 300px); overflow: auto; display: grid; gap: 6px; }
.results li { padding: 10px 12px; border-radius: 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center;
  transition: background .15s, box-shadow .2s, transform .15s; animation: rise .3s var(--ease) both; background: var(--card-2); }
.results li:hover { background: var(--fill); }
.results li:active { transform: scale(.99); }
.results li.sel { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand), 0 6px 16px -8px rgb(23 128 106 / .45); }
.results li.out { opacity: .5; cursor: not-allowed; }
.results li > span:first-child { font-weight: 600; }
.results small { color: var(--muted); display: block; font-weight: 400; }
.results .num { font-weight: 600; }
.search-empty { text-align: center; color: var(--muted); padding: 44px 10px 28px; }
.search-empty .ico { width: 44px; height: 44px; color: var(--faint); margin-bottom: 8px; }
.cart td { padding-top: 8px; padding-bottom: 8px; }
.cart tbody tr { animation: rise .3s var(--ease) both; }
.qty { display: inline-flex; align-items: center; border-radius: 10px; overflow: hidden; background: var(--fill); }
.qty button { background: none; color: var(--text); border: 0; border-radius: 0; min-height: 32px; width: 32px; padding: 0; font-size: 17px; box-shadow: none; }
.qty button:hover { background: var(--fill-2); }
.qty input { width: 46px; border: 0; border-radius: 0; text-align: center; min-height: 32px; padding: 4px; background: transparent; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { display: none; }
.qty input:focus { box-shadow: none; background: var(--brand-soft); }
.checkout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.checkout label, .form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.grand { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 18px 20px; gap: 12px; flex-wrap: wrap;
  background: radial-gradient(420px 200px at 100% 0%, rgb(212 240 122 / .14), transparent 60%), linear-gradient(135deg, var(--pine), var(--pine-2));
  color: rgb(255 255 255 / .85); border-radius: var(--radius); box-shadow: 0 18px 36px -18px rgb(16 55 47 / .6), inset 0 1px 0 rgb(255 255 255 / .08); }
.grand .muted { color: rgb(255 255 255 / .7); }
.grand a { color: var(--lime); }
.grand .total { font: 700 30px/1.1 var(--font-display); color: #fff; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.grand .change { color: var(--lime); font-weight: 600; }
.grand button.secondary { background: rgb(255 255 255 / .14); color: #fff; }
.grand button.secondary:hover { background: rgb(255 255 255 / .22); }
.grand button.big { background: var(--lime); color: var(--pine); box-shadow: 0 8px 18px -8px rgb(212 240 122 / .55); }
.grand button.big:hover { background: #e0f69a; filter: none; }
.bill-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bill-head h2 { margin: 0; }
.cart-count { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
#empty { text-align: center; padding: 30px 10px; color: var(--muted); }
#empty .ico { width: 38px; height: 38px; color: var(--faint); display: block; margin: 0 auto 8px; }

/* ───────── Dialogs + side sheet ───────── */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(520px, 94vw); box-shadow: var(--shadow-lg); color: var(--text); background: var(--elev); }
dialog.wide { width: min(960px, 96vw); }
dialog[open] { animation: pop .38s var(--spring); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
dialog::backdrop { background: rgb(0 0 0 / .32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .25s ease; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 12px; }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-head button.icon { width: 30px; height: 30px; border-radius: 50%; background: var(--fill); padding: 0; font-size: 13px; }
.dlg-body { padding: 8px 22px 22px; max-height: 78vh; overflow: auto; }
dialog.sheet { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border-radius: 22px 0 0 22px; }
dialog.sheet[open] { animation: slideIn .45s var(--ease); }
@keyframes slideIn { from { transform: translateX(100%); } }
dialog.sheet .dlg-body { max-height: calc(100vh - 64px); }
.form { display: grid; gap: 14px; }
.form label.check { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-size: 14px; font-weight: 500; }
.form .actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.form-error { color: var(--danger); margin: 0; min-height: 1em; font-size: 13px; font-weight: 500; }

/* Detail sheet */
.detail .thumb.xl { margin-bottom: 16px; padding: 20px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.detail h3 { font: 700 22px/1.2 var(--font-display); letter-spacing: -.025em; margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.kv div { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kv small { display: block; color: var(--muted); font-size: 11.5px; }
.kv strong { font-variant-numeric: tabular-nums; }

/* ───────── Reports ───────── */
.rep-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.rep-bar .grow { flex: 1; }
.rep-range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-range input[type="date"] { width: 150px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }

/* ───────── Progress, skeleton, toast ───────── */
.progress { height: 8px; background: var(--fill-2); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress > div { height: 100%; width: 0; background: var(--brand-grad); border-radius: 999px; transition: width .4s var(--ease); }
.loading { display: grid; gap: 16px; padding: 4px 0; }
.loading .sk { height: 110px; border-radius: var(--radius); }
.loading .sk.tall { height: 300px; }
.sk { background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 37%, var(--fill) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
/* Notifications: top centre, stacked, above dialogs (popover top layer) */
#toast { position: fixed; inset: 18px auto auto 50%; transform: translateX(-50%); margin: 0; padding: 0; border: 0; background: transparent;
  overflow: visible; z-index: 1000; width: min(460px, calc(100vw - 32px)); display: grid; gap: 10px; pointer-events: none; color: var(--text); }
#toast:empty { display: none; }
.toast { --tc: var(--ok); --ts: var(--ok-soft); position: relative; overflow: hidden; pointer-events: auto;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 14px 14px 16px 16px;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  border-left: 4px solid var(--tc); animation: toastIn .45s var(--spring) both; }
.toast.error { --tc: var(--danger); --ts: var(--danger-soft); }
.toast.out { animation: toastOut .26s var(--ease) both; }
.toast .t-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ts); color: var(--tc); }
.toast .t-ico .ico { width: 18px; height: 18px; stroke-width: 2.4; }
.toast .t-body { min-width: 0; padding-top: 1px; }
.toast .t-body strong { display: block; font-size: 14px; letter-spacing: -.01em; color: var(--tc); }
.toast .t-msg { font-size: 13.5px; line-height: 1.45; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.toast .t-x { width: 28px; height: 28px; padding: 0; border-radius: 8px; background: transparent; color: var(--muted); border: 0;
  box-shadow: none; font-size: 13px; cursor: pointer; }
.toast .t-x:hover { background: var(--fill); color: var(--text); filter: none; }
.toast .t-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tc); opacity: .55; transform-origin: left;
  animation: toastLife var(--life) linear both; }
.toast.paused .t-bar { animation-play-state: paused; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(.97); } }
@keyframes toastLife { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ───────── Responsive ───────── */
@media (max-width: 1200px) {
  .mrow, .mhead { grid-template-columns: 44px minmax(0, 2fr) 130px 100px 148px; }
  .mrow .cat, .mhead .cat, .mrow .exp, .mhead .exp { display: none; }
}
@media (max-width: 1100px) {
  .billing, .cols-3 { grid-template-columns: 1fr; }
  .results { max-height: 45vh; }
}
@media (max-width: 900px) {
  :root { --side-w: 270px; }
  #sidebar { transform: translateX(-100%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); background: var(--card); }
  body.nav-open #sidebar { transform: none; }
  body.nav-open #scrim { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .32); z-index: 35; animation: fade .25s ease; backdrop-filter: blur(4px); }
  .shell { margin-left: 0; }
  .icon-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; min-height: 60px; }
  #pageTitle { font-size: 19px; }
  main { padding: 18px 16px 36px; }
  #banner.banner { margin: 12px 16px 0; }
  .who, .chev { display: none; }
  #pageSub { display: none; }
  .cols, .cols-2, .checkout, .sk-row { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 24px 20px 28px; }
  .auth-hero .hero-copy { padding-top: 26px; }
  .auth-hero .eyebrow { margin-bottom: 12px; }
  .auth-hero h2 { font-size: 32px; margin-bottom: 0; }
  .status-card, .auth-hero p.lead, .auth-hero .prov, .auth-hero .arcs { display: none; }
  .auth-panel { padding: 24px 20px; }
  .auth-main { padding: 28px 0; }
  .auth-main h1 { font-size: 32px; }
  .auth-card { padding: 20px; }
  .hero { padding: 22px; }
  .hero .hero-figure .big { font-size: 36px; }
  .hero .hero-figure > div + div { padding-left: 0; border-left: 0; }
  .mrow, .mhead { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .mrow .stock, .mhead .stock, .mrow .acts { display: none; }
  .field-search { max-width: none; min-width: 100%; }
}
@media (max-width: 560px) {
  #branchPick { min-width: 0; max-width: 140px; }
  button.sync { padding: 6px 9px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 21px; }
  .stat .bubble { display: none; }
  .filter-tiles { grid-template-columns: repeat(2, 1fr); }
  .mgrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mcard .thumb { height: 110px; }
  dialog.sheet { border-radius: 0; }
  .card { padding: 16px; border-radius: 16px; }
  .toolbar { gap: 8px; }
  .toolbar .grow { display: none; }
  .toolbar select { flex: 1 1 40%; min-width: 0; }
  .toolbar > button, .toolbar > label.button { flex: 1 1 auto; padding: 8px 10px; font-size: 13px; }
  .rep-bar .seg { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .rep-bar .seg button { white-space: nowrap; }
  .rep-bar .seg button { flex: 1 1 auto; padding: 4px 8px; }
  .ftile { padding: 12px; gap: 1px 10px; }
  .ftile .fi { width: 32px; height: 32px; border-radius: 10px; }
  .ftile .n { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; }
}
@media print {
  #sidebar, .topbar, #toast, .rep-bar, .no-print { display: none !important; }
  .shell { margin: 0; } main { padding: 0; }
  .card, .stat { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  * { animation: none !important; }
}

/* ---------- Fit to the display height (laptops at 100% zoom, scaled Windows displays) ---------- */
/* Sign-in: scale with the window height too, never scroll on common laptop screens */
.auth { min-height: 100dvh; }
.auth-hero h2 { font-size: clamp(30px, min(4.6vw, 7.2vh), 66px); margin-bottom: clamp(12px, 2.6vh, 26px); }
.auth-main h1 { font-size: clamp(28px, min(3.6vw, 5.6vh), 50px); }
@media (min-width: 901px) and (max-height: 860px) {
  .auth-hero, .auth-panel { padding-top: 24px; padding-bottom: 22px; }
  .auth-hero .hero-copy { padding-top: 20px; }
  .auth-hero .eyebrow, .auth-main .eyebrow { margin-bottom: 10px; }
  .auth-hero p.lead { font-size: 15px; line-height: 1.5; }
  .auth-hero .prov { margin-top: 18px; }
  .status-card { margin-top: 22px; }
  .status-card .sc-head { padding: 11px 18px; } .status-card .sc-row { padding: 9px 18px; }
  .auth-main { padding: 14px 0; }
  .auth-main .sub { margin-bottom: 18px; font-size: 15px; }
  .auth-card { padding: 18px 22px 20px; }
  .auth .login input { padding: 10px 13px; }
  .auth .login button.go { padding: 13px 20px; }
}
@media (min-width: 901px) and (max-height: 700px) {
  /* Nothing hidden: everything just gets smaller */
  .auth-hero, .auth-panel { padding-top: 16px; padding-bottom: 14px; }
  .auth-hero .logo { width: 38px; height: 38px; } .auth-hero .brand .name { font-size: 21px; }
  .auth-hero .hero-copy { padding-top: 10px; }
  .auth-hero .eyebrow, .auth-main .eyebrow { margin-bottom: 6px; font-size: 11px; }
  .auth-hero p.lead { font-size: 13.5px; line-height: 1.4; }
  .auth-hero .prov { margin-top: 10px; font-size: 11.5px; }
  .status-card { margin-top: 12px; max-width: 400px; }
  .status-card .sc-head { padding: 8px 14px; font-size: 10.5px; } .status-card .sc-row { padding: 6px 14px; font-size: 12.5px; }
  .auth-main { padding: 8px 0; }
  .auth-main .sub { margin-bottom: 12px; font-size: 14px; }
  .auth-card { padding: 14px 18px 16px; }
  .auth .login input { padding: 8px 12px; font-size: 14px; }
  .auth .login button.go { padding: 10px 18px; }
}

/* Billing: the bill keeps its total and checkout on screen; only the item lines scroll */
@media (min-width: 901px) {
  .billing > .card:last-child { position: sticky; top: 88px; display: flex; flex-direction: column; max-height: calc(100dvh - 140px); }
  .billing > .card:last-child > .scroll-x { flex: 1 1 auto; min-height: 90px; overflow: auto; }
  .billing > .card:last-child > .scroll-x thead th { position: sticky; top: 0; z-index: 1; }
  .billing > .card:last-child > .checkout, .billing > .card:last-child > .grand { flex: none; }
}
@media (min-width: 901px) and (max-height: 760px) {
  .billing > .card:last-child > .checkout { margin-top: 10px; padding-top: 10px; gap: 8px; }
  .billing > .card:last-child > .grand { margin-top: 10px; padding: 12px 16px; }
  .grand .total { font-size: 24px; }
}
/* Dialogs never taller than the window */
.dlg-body { max-height: calc(100dvh - 120px); }
@media (min-width: 901px) { main:has(> .billing) { padding-bottom: 16px; } }


/* ═════════ ProBite restaurant screens ═════════ */
/* POS: menu on the left, current order on the right */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 16px; align-items: start; }
.pos-menu .chips { margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 86px; padding: 11px 12px; text-align: left;
  background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-left: 4px solid var(--tc, var(--brand)); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-weight: 600; font-size: 14px; line-height: 1.25; cursor: pointer; transition: transform .12s var(--ease), box-shadow .12s; }
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); filter: none; background: var(--card); }
.tile:active { transform: scale(.98); }
.tile .p { font-family: var(--font-num); font-weight: 700; color: var(--brand-ink); font-size: 13.5px; }
.tile.out { opacity: .45; } .tile.out .p::after { content: ' · sold out'; color: var(--danger); font-weight: 600; }
.tile .deal { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--violet); }
.pos-order { position: sticky; top: 88px; display: flex; flex-direction: column; max-height: calc(100dvh - 120px); }
.pos-order .lines { flex: 1 1 auto; overflow: auto; min-height: 120px; margin: 8px -4px; padding: 0 4px; }
.ol { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ol .nm { font-weight: 600; } .ol .sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.ol .amt { font-family: var(--font-num); font-weight: 600; text-align: right; }
.ol .qty { display: inline-flex; align-items: center; gap: 4px; }
.ol .qty button { min-height: 26px; padding: 0 9px; }
.ol.sent .nm::before { content: '● '; color: var(--ok); } .ol.void { opacity: .5; text-decoration: line-through; }
.ol .acts { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }
.pos-tot { border-top: 1px solid var(--line-2); padding-top: 10px; display: grid; gap: 3px; font-size: 13.5px; }
.pos-tot div { display: flex; justify-content: space-between; } .pos-tot .grand { font-size: 22px; font-weight: 800; font-family: var(--font-num); }
.pos-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; } .pos-acts .wide { grid-column: 1 / -1; }
.pick { display: grid; gap: 14px; } .pick h3 { margin: 0 0 6px; font-size: 14px; } .pick .chips .chip { cursor: pointer; }
.pick .need { color: var(--danger); font-size: 12px; font-weight: 600; margin-left: 6px; }
.pay-rows { display: grid; gap: 8px; } .pay-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.pay-sum { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; padding: 8px 0; }
/* Tables map */
.tmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tcell { display: grid; gap: 4px; padding: 14px; min-height: 96px; text-align: left; border-radius: var(--radius-md); background: var(--card);
  border: 1px solid var(--line-2); color: var(--text); box-shadow: var(--shadow); cursor: pointer; }
.tcell:hover { filter: none; background: var(--card-2); }
.tcell b { font-size: 20px; font-family: var(--font-display); } .tcell small { color: var(--muted); }
.tcell.busy { border-color: transparent; background: var(--warn-soft); } .tcell.ready { background: var(--ok-soft); }
/* Kitchen display */
.kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.kcard { background: var(--card); border-radius: var(--radius-md); box-shadow: var(--shadow); border-top: 5px solid var(--info); overflow: hidden; }
.kcard.late { border-top-color: var(--warn); } .kcard.very { border-top-color: var(--danger); } .kcard.done { border-top-color: var(--ok); }
.kcard header { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px 6px; }
.kcard header b { font-size: 22px; font-family: var(--font-display); } .kcard header span { font-size: 12.5px; color: var(--muted); }
.kcard .ki { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; border-top: 1px solid var(--line); background: none;
  color: var(--text); box-shadow: none; border-radius: 0; font-size: 15px; font-weight: 600; cursor: pointer; }
.kcard .ki:hover { background: var(--fill); filter: none; } .kcard .ki small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.kcard .ki.ready { color: var(--ok); text-decoration: line-through; } .kcard .ki .md { color: var(--warn); font-weight: 700; }
.kcard footer { display: flex; gap: 6px; padding: 8px 12px 12px; } .kcard footer button { flex: 1; }
@media (max-width: 900px) { .pos { grid-template-columns: 1fr; } .pos-order { position: static; max-height: none; } .pay-row { grid-template-columns: 1fr 1fr; } }
