/* Khbz & Zaad Dubai back office. Brand: one muted teal (#4A6B6A, sampled from the logo) on white,
   a deep-teal side menu that carries the logo, and cool mist neutrals that lean toward the teal.
   Kitchen tickets borrow thermal paper and the kitchen copy borrows the yellow carbon docket, inked
   in the brand's deep teal. Chart colours stay on the validated data palette so channels stay legible.
   Full guideline: docs/BRAND.md */
:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --sunken: #e6ecea;
  --ink: #172728;
  --ink-2: #43575a;
  --muted: #6c7f81;
  --line: #dce4e2;
  --line-strong: #c3d0ce;
  --accent: #4a6b6a;
  --accent-hover: #3c5857;
  --accent-ink: #ffffff;
  --accent-soft: #e2ebe9;
  --accent-text: #3a5958;
  --focus: #4a6b6a;

  --rail: #2f4a49;
  --rail-2: #3b5a59;
  --rail-ink: #e6efed;
  --rail-muted: #a6bcb9;
  --rail-line: #426261;
  --rail-accent: #d5e6e2;

  --good: #12823c;
  --good-soft: #e2f3e7;
  --good-mark: #0ca30c;
  --warn: #8f5d00;
  --warn-soft: #fcf0d4;
  --warn-mark: #f0a400;
  --serious-mark: #ec835a;
  --bad: #b8322c;
  --bad-soft: #fbe5e3;
  --bad-mark: #d03b3b;

  --paper: #fffdf6;
  --paper-ink: #1c1a15;
  --paper-muted: #6f6a5c;
  --paper-line: #e7e0cb;
  --carbon: #fff6cf;
  --carbon-ink: #2f4a49;
  --carbon-line: #e8d98f;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --grid: #e1e7e5;
  --axis: #c1ccca;

  --font-display: "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: 1.875rem;
  --step-4: 2.5rem;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 39, 40, 0.06), 0 0 0 1px rgba(23, 39, 40, 0.05);
  --shadow-pop: 0 18px 48px rgba(23, 39, 40, 0.2), 0 0 0 1px rgba(23, 39, 40, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1515;
    --surface: #152020;
    --surface-2: #1a2626;
    --sunken: #101818;
    --ink: #e6efed;
    --ink-2: #b3c4c1;
    --muted: #7f9592;
    --line: #223030;
    --line-strong: #314241;
    --accent: #84afaa;
    --accent-hover: #98c1bc;
    --accent-ink: #0e1515;
    --accent-soft: #1f3332;
    --accent-text: #a6ccc7;
    --focus: #98c1bc;
    --rail: #0a1111;
    --rail-2: #172322;
    --rail-ink: #d6e4e1;
    --rail-muted: #7d938f;
    --rail-line: #1a2726;
    --rail-accent: #84afaa;
    --good: #4cc56f;
    --good-soft: #15291d;
    --warn: #f2bd4a;
    --warn-soft: #2e2512;
    --bad: #ff7b72;
    --bad-soft: #351817;
    --paper: #f6f1df;
    --paper-ink: #1c1a15;
    --paper-muted: #6f6a5c;
    --paper-line: #ddd4b8;
    --carbon: #f5e9b5;
    --carbon-ink: #2f4a49;
    --carbon-line: #d9c879;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --grid: #22302f;
    --axis: #364846;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1515;
  --surface: #152020;
  --surface-2: #1a2626;
  --sunken: #101818;
  --ink: #e6efed;
  --ink-2: #b3c4c1;
  --muted: #7f9592;
  --line: #223030;
  --line-strong: #314241;
  --accent: #84afaa;
  --accent-hover: #98c1bc;
  --accent-ink: #0e1515;
  --accent-soft: #1f3332;
  --accent-text: #a6ccc7;
  --focus: #98c1bc;
  --rail: #0a1111;
  --rail-2: #172322;
  --rail-ink: #d6e4e1;
  --rail-muted: #7d938f;
  --rail-line: #1a2726;
  --rail-accent: #84afaa;
  --good: #4cc56f;
  --good-soft: #15291d;
  --warn: #f2bd4a;
  --warn-soft: #2e2512;
  --bad: #ff7b72;
  --bad-soft: #351817;
  --paper: #f6f1df;
  --paper-ink: #1c1a15;
  --paper-muted: #6f6a5c;
  --paper-line: #ddd4b8;
  --carbon: #f5e9b5;
  --carbon-ink: #2f4a49;
  --carbon-line: #d9c879;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --grid: #22302f;
  --axis: #364846;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-pop: 0 18px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  color-scheme: dark;
}

/* ───────────── Base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--step-3); font-weight: 800; line-height: 1.1; }
h2 { font-size: var(--step-2); line-height: 1.2; }
h3 { font-size: var(--step-1); }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: var(--step--1); }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; color: var(--muted); }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ───────────── Shell ───────────── */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--rail); color: var(--rail-ink);
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 14px;
}
.brand { display: grid; gap: 6px; padding: 4px 8px 14px; justify-items: start; }
.brand-logo {
  display: block; width: 118px; height: 100px; flex: none; background: var(--rail-ink);
  -webkit-mask: url(/img/logo.png) left center / contain no-repeat; mask: url(/img/logo.png) left center / contain no-repeat;
}
.brand-logo.sm { width: 46px; height: 39px; }
a.brand, a.brand:hover { text-decoration: none; }
.brand-logo.xl { width: 200px; height: 170px; }
.brand-place { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rail-muted); font-weight: 650; }
.emblem {
  display: inline-block; width: 22px; height: 22px; flex: none; background: currentColor;
  -webkit-mask: url(/img/emblem.png) center / contain no-repeat; mask: url(/img/emblem.png) center / contain no-repeat;
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: 0.02em; color: #fff; line-height: 1; }
.brand-sub { font-size: 0.72rem; color: var(--rail-muted); margin-top: 3px; }
.rail-section { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rail-muted); padding: 14px 10px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--rail-ink); font-weight: 500; font-size: 0.92rem; text-decoration: none; position: relative;
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: 0.8; }
.nav-link:hover { background: var(--rail-2); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--rail-2); color: #fff; }
.nav-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail-accent);
}
.nav-link[aria-current="page"] svg { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rail-accent);
  color: var(--rail); font-size: 0.72rem; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.nav-badge.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(213, 230, 226, 0.3); } }
.rail-foot { margin-top: auto; border-top: 1px solid var(--rail-line); padding: 12px 6px 0; display: grid; gap: 10px; }
.whoami { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--rail-2); color: #fff; font-weight: 700; font-size: 0.8rem; font-family: var(--font-display);
}
.whoami-name { color: #fff; font-weight: 600; font-size: 0.88rem; line-height: 1.2; }
.whoami-role { color: var(--rail-muted); font-size: 0.75rem; }
.rail-select {
  width: 100%; background: var(--rail-2); color: var(--rail-ink); border: 1px solid var(--rail-line); border-radius: 8px;
  padding: 7px 8px; font: inherit; font-size: 0.85rem;
}
.rail-actions { display: flex; gap: 6px; }
.rail-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: transparent;
  color: var(--rail-muted); border: 1px solid var(--rail-line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 0.8rem; cursor: pointer;
}
.rail-btn:hover { color: #fff; background: var(--rail-2); }
.rail-btn svg { width: 15px; height: 15px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 8px clamp(16px, 3vw, 36px); min-height: 56px;
}
.topbar .menu-btn, .topbar .topbar-logo { display: none; }
.topbar-context { font-size: 0.86rem; color: var(--ink-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ───────────── Notification bell ───────────── */
.bell-wrap { position: relative; }
.bell {
  position: relative; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: background 0.12s ease;
}
.bell:hover { background: var(--surface-2); color: var(--ink); }
.bell svg { width: 22px; height: 22px; }
.bell.has-waiting { color: var(--bad); border-color: color-mix(in srgb, var(--bad-mark) 45%, var(--line)); background: var(--bad-soft); }
.bell.ringing svg { animation: ring 0.9s ease-in-out 2; transform-origin: 50% 4px; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--bad-mark);
  color: #fff; font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums;
}
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(400px, calc(100vw - 32px)); max-height: min(70vh, 620px); overflow-y: auto;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); z-index: 60; animation: rise 0.14s ease;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.bell-panel section { padding: 10px 14px 4px; }
.bell-panel h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.bell-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bell-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.bell-item:last-child { border-bottom: 0; }
.bell-summary { font-weight: 600; font-size: 0.88rem; margin-top: 2px; }
.bell-actions { display: flex; align-items: center; gap: 8px; }
.bell-empty { padding: 4px 0 10px; }
.bell-settings { display: grid; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* ───────────── Typable dropdown ───────────── */
.combo { position: relative; }
.combo .input { padding-right: 34px; }
.combo-toggle { position: absolute; right: 4px; top: 50%; translate: 0 -50%; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; }
.combo-toggle svg { width: 15px; height: 15px; transform: rotate(90deg); }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 120; list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-pop);
}
.combo-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 0.9rem; }
.combo-list li:hover, .combo-list li.active { background: var(--accent-soft); }
.combo-list li.new { color: var(--accent-text); font-weight: 600; justify-content: flex-start; }
.combo-list li.new svg { width: 15px; height: 15px; }
.combo-list li.new .muted { margin-left: auto; font-weight: 400; }

/* ───────────── Photos, modifiers ───────────── */
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--sunken); display: inline-grid; place-items: center; }
.thumb.xs { width: 28px; height: 28px; border-radius: 6px; }
.thumb.md { width: 56px; height: 56px; border-radius: 10px; }
.thumb.no-photo { color: var(--muted); font-family: var(--font-display); font-weight: 800; font-size: 0.72rem; letter-spacing: 0.02em; }
.thumb.xs.no-photo { font-size: 0.6rem; }
.item-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mods { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mod { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font-size: 0.76rem; font-weight: 700; line-height: 1.6; }
.mod.note, .mod.remove { background: var(--bad-soft); color: var(--bad); }
.mod.remove { text-transform: uppercase; letter-spacing: 0.02em; }
.mod.add { background: var(--good-soft); color: var(--good); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.photo-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: grid; }
.photo-drop {
  position: relative; aspect-ratio: 4 / 3; max-width: 100%; display: grid; place-items: center; background: var(--sunken); cursor: pointer; overflow: hidden;
  border: 2px dashed transparent; transition: border-color 0.12s ease, background 0.12s ease;
}
.photo-drop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-drop.empty { border-color: var(--line-strong); color: var(--muted); text-align: center; padding: 12px; }
.photo-drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.photo-drop .busy { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.photo-drop svg { width: 26px; height: 26px; }
.photo-meta { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.accept-lines { display: grid; gap: 10px; }
details.payload { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
details.payload summary { cursor: pointer; font-weight: 650; }
details.payload pre { margin: 8px 0 0; max-height: 280px; overflow: auto; background: var(--sunken); padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; }

.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 900px) { .integration-grid { grid-template-columns: minmax(0, 1fr); } }
.copy-box { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 0.8rem; background: var(--sunken); border-radius: 8px; padding: 7px 10px; overflow-x: auto; white-space: nowrap; }

/* ───────────── Discounts ───────────── */
.pct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.pct-other { grid-column: span 2; }
.discount-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); font-size: 0.86rem; }
.discount-line b { font-variant-numeric: tabular-nums; }
.page { padding-block: 26px 64px; padding-inline: clamp(16px, 3vw, 36px); max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .lede { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 2.3fr) minmax(280px, 1fr); }
.stack > *, .split > *, .grid-2 > *, .grid-3 > *, .kpis > * { min-width: 0; }

@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform 0.2s ease; height: 100%; }
  .shell.nav-open .rail { transform: none; box-shadow: var(--shadow-pop); }
  .shell.nav-open .scrim { display: block; }
  .topbar { background: var(--rail); border-bottom: 0; color: #fff; padding-inline: 12px; backdrop-filter: none; }
  .topbar .menu-btn, .topbar .topbar-logo { display: inline-grid; }
  .topbar .menu-btn { color: #fff; }
  .topbar .menu-btn:hover { background: var(--rail-2); color: #fff; }
  .topbar-context { display: none; }
  .bell { background: var(--rail-2); border-color: var(--rail-line); color: var(--rail-ink); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(8, 9, 14, 0.45); z-index: 40; }

/* ───────────── Surfaces ───────────── */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { font-size: 1rem; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--ink-2); font-size: var(--step--1); }
.callout { border-radius: var(--radius-sm); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: var(--step--1); }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
.callout.good { background: var(--good-soft); color: var(--good); }
.callout.info { background: var(--accent-soft); color: var(--accent-text); }

/* ───────────── Buttons & inputs ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 8px 14px; font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; white-space: nowrap; line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { padding: 5px 10px; font-size: 0.82rem; border-radius: 7px; }
.btn.lg { padding: 12px 18px; font-size: 1rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 5px; min-width: 0; }
.field > * { min-width: 0; }
.field > label, .field > .label { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 0.76rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 0.92rem; min-width: 0;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input.num { text-align: right; }
.input.sm, .select.sm { padding: 5px 8px; font-size: 0.85rem; }
.textarea { min-height: 70px; resize: vertical; }
.with-unit { display: flex; align-items: stretch; }
.with-unit .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.with-unit .unit { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); font-size: 0.82rem; font-family: var(--font-mono); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.checkbox { display: inline-flex; gap: 8px; align-items: center; font-size: 0.9rem; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; }

.segmented { display: inline-flex; background: var(--sunken); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 600; font-size: 0.85rem;
  padding: 6px 12px; border-radius: 7px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented .count { font-size: 0.72rem; background: var(--line); color: var(--ink-2); border-radius: 8px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.segmented button[aria-pressed="true"] .count { background: var(--accent); color: var(--accent-ink); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 9px 14px; color: var(--ink-2); font-weight: 600; font-size: 0.9rem; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 6px; align-items: center;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }

/* ───────────── Pills & state ───────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--ink-2); line-height: 1.6;
}
.pill svg { width: 12px; height: 12px; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.pill.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.good { background: var(--good-mark); }
.dot.warn { background: var(--warn-mark); }
.dot.bad { background: var(--bad-mark); }
.dot.accent { background: var(--accent); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* ───────────── Tables ───────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th {
  text-align: left; font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0; z-index: 1;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.table .sub { color: var(--muted); font-size: 0.78rem; }
.table.compact td { padding: 7px 12px; }
.table.compact th { padding: 8px 12px; }
.table tr.flagged td { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.table tr.muted-row td { color: var(--muted); }

.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 44px 20px; color: var(--muted); }
.empty svg { width: 32px; height: 32px; opacity: 0.6; }
.empty strong { color: var(--ink); font-family: var(--font-display); font-size: 1rem; }

/* ───────────── KPI tiles ───────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; container-type: inline-size; }
.kpi .label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.kpi .value { font-family: var(--font-display); font-weight: 750; font-size: clamp(1.1rem, 12.5cqi, 1.65rem); line-height: 1.1; letter-spacing: -0.01em; }
.kpi .value small { font-size: 0.55em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-right: 3px; }
.kpi .delta { font-size: 0.78rem; color: var(--muted); }
.kpi.alert { box-shadow: var(--shadow), inset 3px 0 0 var(--bad-mark); }
.kpi.attention { box-shadow: var(--shadow), inset 3px 0 0 var(--warn-mark); }
a.kpi { color: inherit; text-decoration: none; }
@media (max-width: 480px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi .value { font-size: 1.45rem; } }
a.kpi:hover { box-shadow: var(--shadow-pop); }

/* ───────────── Insights ───────────── */
.insights { display: grid; }
.insight { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 14px; padding: 13px 18px 13px 0; border-bottom: 1px solid var(--line); align-items: center; }
.insights.stacked .insight, .insight.stacked { grid-template-columns: 4px minmax(0, 1fr); }
.insight-action { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 0.82rem; font-weight: 650; color: var(--accent-text); }
.insight-action svg { width: 14px; height: 14px; transition: transform 0.12s ease; }
.insight-action:hover { text-decoration: none; }
.insight-action:hover svg { transform: translateX(3px); }
.insight:last-child { border-bottom: 0; }
.insight .stripe { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--muted); }
.insight.critical .stripe { background: var(--bad-mark); }
.insight.warning .stripe { background: var(--warn-mark); }
.insight.info .stripe { background: var(--accent); }
.insight .title { font-weight: 650; font-size: 0.92rem; }
.insight .detail { color: var(--ink-2); font-size: 0.83rem; margin-top: 2px; }
.insight .meta { display: flex; align-items: center; gap: 10px; }
.insight .impact { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-2); white-space: nowrap; }
.insight .kind { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }

/* ───────────── Charts ───────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .hover-band, .chart .hover-band.on { opacity: 1; }
.chart .hover-band { fill: var(--sunken); opacity: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--bg); border-radius: 8px;
  padding: 8px 10px; font-size: 0.78rem; box-shadow: var(--shadow-pop); min-width: 150px; translate: -50% calc(-100% - 10px);
}
.tooltip .t-head { font-weight: 700; margin-bottom: 4px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tooltip .t-row span:first-child { display: inline-flex; align-items: center; gap: 6px; opacity: 0.85; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 0.85rem; }
.bar-track { height: 10px; background: var(--sunken); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }

/* ───────────── Modal, drawer, toast ───────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 9, 14, 0.5); z-index: 100; display: grid; place-items: center;
  padding: 16px; animation: fade 0.12s ease;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); width: min(560px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; animation: rise 0.16s ease;
}
.modal.wide { width: min(860px, 100%); }
.modal-head { padding: 18px 20px 6px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 1.25rem; }
.modal-body { padding: 10px 20px 18px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 9, 14, 0.35); z-index: 90; animation: fade 0.12s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 91; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; animation: slide 0.18s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { padding: 18px 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: 16px; z-index: 200; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-pop);
  font-size: 0.88rem; display: flex; gap: 10px; align-items: flex-start; animation: rise 0.18s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.bad svg { color: var(--bad-mark); }
.toast.good svg { color: var(--good-mark); }
.toast .t-title { font-weight: 700; }
.toast button { margin-left: auto; background: transparent; border: 0; color: inherit; opacity: 0.7; cursor: pointer; font: inherit; font-weight: 600; text-decoration: underline; }

.summary-list { display: grid; gap: 0; }
.summary-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list > div > span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.summary-list .total { border-top: 1px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 10px; font-weight: 800; font-size: 1rem; }
.summary-list .sub-row { padding-left: 14px; color: var(--ink-2); font-size: 0.85rem; }
.summary-list .neg > span:last-child { color: var(--bad); }

/* ───────────── POS ───────────── */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.pos-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.menu-tile {
  background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; text-align: left;
  font: inherit; color: inherit; cursor: pointer; display: grid; gap: 6px; min-height: 112px; align-content: space-between; position: relative;
  transition: box-shadow 0.12s ease, transform 0.06s ease;
}
.menu-tile:hover { box-shadow: var(--shadow-pop); }
.menu-tile:active { transform: scale(0.985); }
.menu-tile .name { font-weight: 650; line-height: 1.25; padding-right: 26px; }
.menu-tile.has-photo { padding: 0; align-content: start; gap: 0; }
.menu-tile.has-photo .tile-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; border-radius: var(--radius) var(--radius) 0 0; background: var(--sunken); }
.menu-tile.has-photo .tile-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.menu-tile.has-photo .in-cart { box-shadow: 0 0 0 2px var(--surface); }
.menu-tile[disabled] .tile-photo { filter: grayscale(1); }
.cart-line .note-btn { border: 0; background: transparent; color: var(--accent-text); font: inherit; font-size: 0.78rem; font-weight: 600; padding: 2px 0; cursor: pointer; }
.cart-line .note-row { grid-column: 1 / -1; display: grid; gap: 6px; }
.note-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.note-chips button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 2px 9px; font: inherit; font-size: 0.76rem; cursor: pointer; }
.note-chips button:hover { border-color: var(--accent); color: var(--accent-text); }
.menu-tile .price { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.menu-tile .price small { font-size: 0.65em; color: var(--muted); font-weight: 600; margin-right: 2px; }
.menu-tile .stockline { font-size: 0.74rem; color: var(--muted); }
.menu-tile .in-cart {
  position: absolute; top: 10px; right: 10px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 0.8rem; display: grid; place-items: center; padding: 0 7px;
}
.menu-tile[disabled] { cursor: not-allowed; opacity: 0.55; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface-2); }
.menu-tile[disabled] .price { text-decoration: line-through; }
.cart { position: sticky; top: 20px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.cart-lines { overflow-y: auto; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.cart-line .name { font-weight: 600; font-size: 0.9rem; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.qty-stepper button { width: 28px; height: 28px; border: 0; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1rem; font-weight: 700; }
.qty-stepper button:hover { background: var(--sunken); }
.qty-stepper span { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.cart-total { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
.choice {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 8px; font: inherit; font-weight: 600; font-size: 0.85rem;
  cursor: pointer; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; justify-content: center;
}
.choice svg { width: 16px; height: 16px; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.pos-bar { display: none; }
@media (max-width: 1100px) {
  .pos { grid-template-columns: minmax(0, 1fr); padding-bottom: 72px; }
  .cart { position: static; max-height: none; }
  .pos-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); box-shadow: 0 -8px 24px rgba(19, 21, 33, 0.18);
  }
  .pos-bar[hidden] { display: none !important; }
}
@media (max-width: 480px) { .menu-tile { min-height: 96px; padding: 12px; } }

/* ───────────── Thermal tickets (kitchen display) ───────────── */
.rail-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.lane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lane-head h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.lane { display: grid; gap: 14px; }
.ticket {
  background: var(--paper); color: var(--paper-ink); font-family: var(--font-mono); font-size: 0.86rem; border-radius: 3px;
  box-shadow: 0 1px 0 var(--paper-line), 0 6px 14px rgba(19, 21, 33, 0.12);
  padding: 14px 16px 18px; position: relative;
  -webkit-mask: radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) 0 0 / 14px 100% repeat-x;
          mask: radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) 0 0 / 14px 100% repeat-x;
}
.ticket::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--ticket-flag, transparent); }
.ticket.late { --ticket-flag: var(--bad-mark); }
.ticket.slow { --ticket-flag: var(--warn-mark); }
.ticket-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 1px dashed var(--paper-line); padding-bottom: 8px; margin-bottom: 8px; }
.ticket-no { font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; }
.ticket-meta { color: var(--paper-muted); font-size: 0.75rem; display: flex; justify-content: space-between; gap: 8px; }
.ticket-timer { font-weight: 700; font-variant-numeric: tabular-nums; }
.ticket.late .ticket-timer { color: #b8322c; }
.ticket.slow .ticket-timer { color: #8f5d00; }
.ticket-lines { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 5px; }
.ticket-lines li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px; }
.ticket-lines li.with-photo { grid-template-columns: 30px 34px minmax(0, 1fr); align-items: start; }
.ticket-lines .thumb { width: 30px; height: 30px; border-radius: 5px; }
.ticket-lines .thumb.no-photo { background: rgba(0, 0, 0, 0.06); color: var(--paper-muted); }
.ticket .mods { grid-column: 2 / -1; font-family: var(--font-body); }
.ticket li.with-photo .mods { grid-column: 3 / -1; }
.ticket .mod.note, .ticket .mod.remove { background: #fde2dd; color: #9b1c12; }
.ticket .mod.add { background: #dcefe1; color: #14532d; }
.ticket-ref { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em; background: rgba(0, 0, 0, 0.07); border-radius: 4px; padding: 1px 6px; }
.ticket-lines .q { font-weight: 700; }
.ticket-lines .n { font-weight: 600; }
.ticket-lines .nt { grid-column: 2 / -1; color: #9a3412; font-size: 0.78rem; }
.ticket-note { border-top: 1px dashed var(--paper-line); padding-top: 6px; margin-bottom: 10px; color: #9a3412; font-size: 0.78rem; }
.ticket .btn { font-family: var(--font-body); }
.ticket .btn:not(.primary) { background: transparent; color: var(--paper-ink); border-color: var(--paper-line); }
.ticket .btn:not(.primary):hover { background: rgba(0,0,0,0.04); }
.ticket .btn.primary { background: #1c1a15; border-color: #1c1a15; color: #fffdf6; }
.ticket .src { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 1000px) { .rail-board { grid-template-columns: minmax(0, 1fr); } }

.board-86 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.toggle-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 8px; }
.toggle-card.off { box-shadow: var(--shadow), inset 3px 0 0 var(--bad-mark); }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: 12px; transition: background 0.15s ease; cursor: pointer; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.switch input:checked + .track { background: var(--good-mark); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.platforms { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.74rem; color: var(--muted); }
.platforms span { display: inline-flex; align-items: center; gap: 5px; }

/* ───────────── Carbon docket (kitchen copy) ───────────── */
.docket {
  background: var(--carbon); color: var(--carbon-ink); font-family: var(--font-mono); border-radius: 4px; padding: 20px 22px 24px;
  box-shadow: 0 1px 0 var(--carbon-line), 0 8px 20px rgba(19, 21, 33, 0.14); position: relative; overflow: hidden;
}
.docket::after {
  content: "KITCHEN COPY · NO PRICES"; position: absolute; right: 22px; top: 18px; transform: rotate(-4deg);
  border: 2px solid var(--carbon-ink); border-radius: 4px; color: var(--carbon-ink); opacity: 0.75;
  font-size: 0.66rem; letter-spacing: 0.14em; padding: 4px 9px; font-weight: 700;
}
.docket h2 { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--carbon-ink); }
.docket .d-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px 18px; font-size: 0.8rem; margin: 12px 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--carbon-line); }
.docket .d-meta b { display: block; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7; font-weight: 700; }
.docket table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.docket th { text-align: left; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; padding: 6px 10px; border-bottom: 1px solid var(--carbon-ink); }
.docket td { padding: 8px 10px; border-bottom: 1px dotted var(--carbon-line); }
.docket .tick { width: 18px; height: 18px; border: 1.5px solid var(--carbon-ink); border-radius: 3px; display: inline-block; }
.docket .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; }
.docket .sign div { border-top: 1px solid var(--carbon-ink); padding-top: 6px; }

/* ───────────── Recipe builder ───────────── */
.recipe-line { display: grid; grid-template-columns: minmax(150px, 2.6fr) 104px 88px 96px 80px 32px; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.recipe-line.head { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; padding-top: 10px; padding-bottom: 8px; }
.recipe-line .calc { font-family: var(--font-mono); font-size: 0.82rem; text-align: right; color: var(--ink-2); }
.yield-bar { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; margin-top: 4px; }
.yield-bar span { display: block; height: 100%; background: var(--warn-mark); }
.cost-meter { height: 12px; border-radius: 0 6px 6px 0; background: var(--sunken); position: relative; overflow: visible; margin: 10px 0 18px; }
.cost-meter .fill { height: 100%; border-radius: 0 6px 6px 0; background: var(--good-mark); }
.cost-meter .fill.over { background: var(--bad-mark); }
.cost-meter .target { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }
.cost-meter .target-label { position: absolute; top: 15px; font-size: 0.7rem; color: var(--muted); translate: -50% 0; white-space: nowrap; }
@media (max-width: 760px) {
  .recipe-line { grid-template-columns: minmax(0, 1fr) 90px 80px 36px; }
  .recipe-line .hide-sm { display: none; }
}

/* ───────────── Brand page ───────────── */
.brand-sample { display: grid; place-items: center; padding: 28px; border-radius: var(--radius-sm); }
.brand-sample.light { background: #ffffff; box-shadow: inset 0 0 0 1px var(--line); }
.brand-sample.light .brand-logo { background: #4a6b6a; width: 160px; height: 136px; -webkit-mask-position: center; mask-position: center; }
.brand-sample.dark { background: #2f4a49; }
.brand-sample.dark .brand-logo { background: #ffffff; width: 160px; height: 136px; -webkit-mask-position: center; mask-position: center; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.swatch-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; }
.swatch-card .chip { width: 56px; height: 56px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(23, 39, 40, 0.12); }
.type-specimens { display: grid; gap: 22px; }
.spec-display { font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1.15; margin-top: 6px; }
.spec-figure { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--accent-text); }

/* ───────────── Login ───────────── */
.login { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-side { background: var(--rail); color: var(--rail-ink); padding: 48px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; position: relative; overflow: hidden; }
.login-side .brand-logo { background: #ffffff; }
.login-side h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.2rem); max-width: 14ch; }
.login-side p { color: var(--rail-muted); max-width: 46ch; margin-top: 14px; font-size: 1.02rem; }
.login-rail { display: flex; gap: 14px; overflow: hidden; margin-right: -64px; }
.login-rail .ticket { width: 190px; flex: none; transform: rotate(-2deg); font-size: 0.78rem; }
.login-rail .ticket:nth-child(2) { transform: rotate(1.5deg) translateY(10px); }
.login-rail .ticket:nth-child(3) { transform: rotate(-1deg) translateY(-4px); }
.login-form { display: grid; place-items: center; padding: 40px 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 18px; }
.demo-users { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.demo-user {
  text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 9px 11px; cursor: pointer;
  font: inherit; color: inherit; display: grid; gap: 1px;
}
.demo-user:hover { border-color: var(--accent); background: var(--accent-soft); }
.demo-user b { font-size: 0.86rem; }
.demo-user span { font-size: 0.74rem; color: var(--muted); }
@media (max-width: 860px) { .login { grid-template-columns: minmax(0, 1fr); } .login-rail { display: none; } }

/* ───────────── Misc ───────────── */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 0.88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.matrix .quad { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); min-height: 110px; }
.matrix .quad h4 { font-size: 0.85rem; display: flex; justify-content: space-between; }
.matrix .quad p { font-size: 0.8rem; color: var(--muted); margin: 2px 0 8px; }
.matrix .quad .items { display: flex; flex-wrap: wrap; gap: 4px; }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }
.flow .step { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); }
.flow .step.done { background: var(--good-soft); color: var(--good); border-color: transparent; }
.flow .step.now { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.flow svg { width: 14px; height: 14px; }
.diff-up { color: var(--bad); }
.diff-down { color: var(--good); }
@media print {
  .rail, .topbar, .page-actions, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .page { padding: 0; }
  .docket { box-shadow: none; }
}

/* ── Platform console (admin.<domain>) ─────────────────────────────────── */
.console-mark { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 9px; border-radius: 10px;
  background: var(--rail-accent); color: var(--rail); font-family: var(--font-display); font-weight: 900; font-size: 0.95rem; letter-spacing: 0.05em; }
.console-mark.lg { min-width: 60px; height: 60px; font-size: 1.25rem; border-radius: 14px; }
.stage-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.stage-chip { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink-2); text-decoration: none; font-size: var(--step--1); }
.stage-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.stage-count { font-size: 1.3rem; font-weight: 700; color: var(--ink); }
.app-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.app-chip { display: inline-flex; gap: 5px; align-items: baseline; padding: 2px 8px; border-radius: 999px; background: var(--sunken);
  color: var(--ink-2); font-size: 0.76rem; white-space: nowrap; }
.app-chip small { color: var(--muted); font-size: 0.7rem; }
.app-chip.direct, .app-chip.deliverect { background: var(--good-soft); color: var(--good); }
.app-chip.direct small, .app-chip.deliverect small { color: var(--good); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; gap: 2px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: var(--step--1); }
.activity li:first-child { border-top: 0; }
.form-section { margin: 6px 0 -4px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 600; }
.toolbar-scroll { overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
.restaurant-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.restaurant-meta a.pill { text-decoration: none; }
.table span.sub { display: block; }
.login-side .console-mark { align-self: flex-start; }
