/*
 * Takeaway POS — framed-sheet style (tasteskill app style, seed 129482486).
 * One tinted L-frame (sidebar + top bar) holds the navigation; the work sits on a white sheet
 * inset 8px with a 1px edge and 16px corners. No shadows at rest; colour goes on data.
 *
 * Grid arithmetic (1366 × 1024 landscape tablet):
 *   228 sidebar + 1130 sheet + 8 inset = 1366.
 *   Sheet: 24 pad + catalogue + 24 gap + 380 ticket rail + 24 pad → catalogue 676 = 4 × 160 + 3 × 12.
 * 1024 × 768 (sidebar folded into the top bar): 8 + 1008 sheet + 8 → catalogue 1008 − 48 − 24 − 340 = 596
 *   = 3 × 190 + 2 × 13 (tiles stretch via minmax).
 */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/plex-sans/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/plex-sans/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/plex-sans/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/plex-mono/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --frame: #f3f4f2;          /* the face: a cool stone frame */
  --ground: #f9fbfc;
  --surface: #ffffff;
  --raised: #f4f6f8;
  --active: #e6e8e9;
  --border: #e8eaec;
  --rule: #f0f1f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --accent: #1b6c80;
  --accent-pale: #e6f0f2;
  --primary: #1d1f20;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;
  --chart-1: #1b6c80;
  --grid: #e5e5e5;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee; --pill-neutral-ink: #353736;
  --on-accent: #ffffff;       /* text on an accent fill */
  --on-primary: #ffffff;      /* text on a primary fill */
  --primary-hover: #000000;
  --accent-ink: #1d4e5a;      /* text on accent-pale */
  --nav-ink: #3f4142;
  --hover: rgba(0, 0, 0, .035);
  --placeholder: #6b6b6b;
  --disabled-ink: #b3b5b7;
  --track: #c5c7ca;
  --switch-on: var(--primary);
  --danger-line: #e9b8b6;
  --panel: #fafafa;
  --panel-line: #e2e3e5;
  --axis: #c9cbcd;
  color-scheme: light;

  --radius-sheet: 16px;
  --radius-card: 8px;
  --radius-control: 6px;
  --sheet-inset: 8px;
  --sidebar-width: 228px;
  --topbar: 48px;
  --gap: 24px;
  --pad: 24px;
  --tile-gap: 12px;
  --rail: 380px;

  --control-height: 40px;     /* touch: taller than the desk default of 32 */
  --touch: 44px;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 28px;
  --fs-lead: 34px;
  --fs-body: 14px;
  --fs-small: 12px;
}

/* Dark mode: <html data-theme="dark">, set by js/theme.js from the shop's schedule or this
   device's choice. The same roles, lit for a dark room: surfaces step up in lightness instead of
   down, and accents are lifted so they read on them. */
:root[data-theme="dark"] {
  --frame: #141618;
  --ground: #1a1d20;
  --surface: #1f2225;
  --raised: #272b2f;
  --active: #31363b;
  --border: #30353a;
  --rule: #272b2f;
  --control: #4b5157;
  --text: #eceef0;
  --muted: #a3a9ae;
  --accent: #56b8cc;
  --accent-pale: #1b3a42;
  --primary: #eceef0;
  --positive: #4cc38a;
  --negative: #f2645f;
  --warning: #f0b45b;
  --chart-1: #56b8cc;
  --grid: #30353a;
  --pill-positive-bg: #173a27; --pill-positive-ink: #b6f0cd;
  --pill-negative-bg: #42201f; --pill-negative-ink: #ffc4bf;
  --pill-warning-bg: #3b2d12; --pill-warning-ink: #ffd99c;
  --pill-neutral-bg: #2d3135; --pill-neutral-ink: #d6d9dc;
  --on-accent: #06242c;
  --on-primary: #141618;
  --primary-hover: #ffffff;
  --accent-ink: #bfe8f1;
  --nav-ink: #c9cdd1;
  --hover: rgba(255, 255, 255, .06);
  --placeholder: #80868c;
  --disabled-ink: #5c6268;
  --track: #4b5157;
  --switch-on: var(--accent);
  --danger-line: #7a3431;
  --panel: #1a1d20;
  --panel-line: #353a3f;
  --axis: #5c6268;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html.theme-fading, html.theme-fading * { transition: background-color .4s, border-color .4s, color .4s !important; }
@media (prefers-reduced-motion: reduce) { html.theme-fading, html.theme-fading * { transition: none !important; } }
html, body { margin: 0; height: 100%; }

body {
  background: var(--frame);
  color: var(--text);
  font: 400 var(--fs-body)/20px var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-title); line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-section); line-height: 24px; font-weight: 600; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- shell: L-frame + sheet ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 16px;
  min-height: 0;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-scope { font-size: var(--fs-small); line-height: 16px; color: var(--muted); }
.mark { width: 28px; height: 28px; flex: none; }
.mark text { font: 600 13px var(--font); fill: #fff; }

.nav-group { font-size: var(--fs-small); color: var(--muted); padding: 20px 10px 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--nav-ink);
  text-align: left;
  font-weight: 400;
}
a.nav-item { text-decoration: none; }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row .nav-item { flex: 1; min-width: 0; }
.nav-qr { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; color: var(--muted); }
.nav-qr svg { width: 18px; height: 18px; }
.nav-qr:hover { background: var(--hover); color: var(--text); }
.qr-dlg { align-items: stretch; }
.qr-big { display: block; width: min(280px, 70vw); height: auto; aspect-ratio: 1; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: #fff; image-rendering: pixelated; }
.qr-url { margin: 0; text-align: center; word-break: break-all; font-family: var(--mono); font-size: 13px; }
.share-pick { display: flex; flex-direction: column; gap: 8px; }
.share-off { padding: 12px 16px; border-radius: var(--radius-card); background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.share-off p { margin: 0; }
.share-off p + p { margin-top: 6px; }
.share-off .title { font-weight: 600; }
.share-off .url, .qr-tile .url { font-family: var(--mono); font-size: 12px; }
.qr-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.qr-tile { display: flex; gap: 12px; align-items: center; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.qr-tile .title { font-weight: 500; }
.qr-tile .desc { color: var(--muted); font-size: 13px; word-break: break-all; }
.qr-thumb { flex: none; padding: 0; border: 0; background: #fff; border-radius: 6px; cursor: zoom-in; }
.qr-thumb img { display: block; width: 112px; height: 112px; image-rendering: pixelated; }
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 500; }
.nav-item.active svg { color: var(--text); }
.nav-count { margin-left: auto; font-size: var(--fs-small); font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }

.topbar {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 8px;
  min-width: 0;
}
.topbar .brand { display: none; padding: 0; }
.crumbs { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 500; }
.topbar-tabs { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; white-space: nowrap; }
/* the light / dark switch in every top bar (js/theme.js) */
.theme-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; }
.theme-btn:hover { border-color: var(--control); }
.theme-btn.quiet { border-color: transparent; background: none; color: var(--muted); }
@media (max-width: 1100px) { .theme-btn-label { display: none; } .theme-btn { padding: 0 7px; } }
.theme-hours { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); padding-top: 16px; }
.theme-hours .field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-hours .input { max-width: 150px; }
.queue-status { border: 0; background: none; padding: 6px 0; color: var(--muted); }
.queue-status b { color: var(--text); font-weight: 500; }
.queue-status.late b { color: var(--negative); }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
.live.offline { color: var(--negative); }
.live.offline::before { background: var(--negative); }
.clock { color: var(--text); font-variant-numeric: tabular-nums; }
.topbar .menu-btn { display: none; }

.sheet {
  grid-column: 2;
  grid-row: 2;
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
}
.sheet.fill { overflow: hidden; }
.sheet:focus { outline: none; }

/* ---------- shared pieces ---------- */

.page { padding: var(--pad); max-width: 1320px; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: var(--gap); flex-wrap: wrap; }
.title-row > div:first-child { min-width: 0; }
.subline { margin-top: 4px; color: var(--muted); font-size: 15px; line-height: 22px; }
.subline b { color: var(--text); font-weight: 500; }
.subline .late { color: var(--negative); font-weight: 500; }
.title-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { color: var(--muted); margin-bottom: 4px; }
.crumb button { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-height);
  padding: 0 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .12s, transform .06s;
}
.btn > svg { width: 18px; height: 18px; flex: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.primary:disabled { background: var(--active); color: var(--muted); }
.btn.secondary { background: var(--surface); border-color: var(--control); color: var(--text); }
.btn.secondary:hover:not(:disabled) { background: var(--raised); }
.btn.secondary:disabled { color: var(--muted); border-color: var(--border); }
.btn.danger { background: var(--negative); color: #fff; }
.btn.danger-outline { background: var(--surface); border-color: var(--danger-line); color: var(--negative); }
.btn.danger-outline:hover { background: var(--pill-negative-bg); }
.btn.block { width: 100%; }

.text-btn { border: 0; background: none; padding: 8px 0; color: var(--text); font-weight: 500; min-height: 32px; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-btn.danger { color: var(--negative); }
.text-btn.accent { color: var(--accent); }

.input, select.input {
  width: 100%;
  height: var(--control-height);
  padding: 0 12px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
}
.input::placeholder { color: var(--placeholder); }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=date].input { width: auto; }
.field { display: flex; flex-direction: column; gap: 8px; font-weight: 500; }
.field-hint { font-weight: 400; color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 180px; }
.field-row > .field.grow { flex: 3 1 260px; }

.pill { display: inline-flex; align-items: center; flex: none; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; white-space: nowrap; }
.pill.neutral { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.positive { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.negative { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); flex: none; }
.stepper button { width: var(--touch); height: var(--touch); border: 0; background: none; font-size: 20px; line-height: 1; color: var(--text); }
.stepper button:disabled { color: var(--disabled-ink); cursor: not-allowed; }
.stepper button:active:not(:disabled) { background: var(--raised); }
.stepper .value { min-width: 28px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper.small button { width: 36px; height: 36px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: var(--touch); }
/* the hidden checkbox stays inside its switch: placed against the page, one far down a long page
   made the whole page scroll away (blank) when focused */
.switch input { position: absolute; top: 50%; left: 0; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--track); position: relative; flex: none; transition: background-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--switch-on); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.empty { color: var(--muted); padding: 20px; border: 1px dashed var(--control); border-radius: var(--radius-card); text-align: center; grid-column: 1 / -1; }
.error-box { padding: 16px; border-radius: var(--radius-card); background: var(--pill-negative-bg); color: var(--pill-negative-ink); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.skeleton { display: inline-block; background: var(--active); border-radius: 4px; color: transparent !important; }

/* underline tabs on a rule */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  border: 0;
  background: none;
  height: var(--touch);
  padding: 0;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
}
.tab .count { font-weight: 400; margin-left: 4px; font-variant-numeric: tabular-nums; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }

/* ---------- New order ---------- */

.order-screen { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); height: 100%; }
.catalog { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: var(--pad) var(--pad) 0; }
.catalog .title-row { margin-bottom: 16px; align-items: center; }
.search { position: relative; flex: 0 1 300px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 36px; height: var(--touch); }
.title-actions .search { flex: 0 1 auto; width: 280px; max-width: 100%; }
.catalog .tabs { flex: none; }
.catalog .title-actions .search { width: 240px; }
.entry-switch button { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; }
.entry-switch svg { width: 18px; height: 18px; flex: none; }

/* a dish's number, wherever it is shown */
.dish-code { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); }
.tile-meta .dish-code { margin-right: 6px; }

/* ---------- number pad ---------- */

.numpad {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: var(--gap);
  padding: 4px 0 var(--pad);
}
.numpad-pad { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.numpad-display {
  border: 1px solid var(--control);
  border-radius: var(--radius-card);
  padding: 12px 16px;
  background: var(--surface);
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.numpad-entry { display: flex; align-items: baseline; gap: 10px; font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.numpad-digits { font-size: 40px; line-height: 44px; }
.numpad-digits.placeholder { color: var(--control); }
.numpad-qty { font-size: 40px; line-height: 44px; color: var(--accent); }
.numpad-qty .placeholder { color: var(--control); }
.numpad-status { min-height: 22px; font-size: 15px; line-height: 22px; display: flex; gap: 12px; justify-content: space-between; align-items: baseline; }
.numpad-status b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.numpad-price { font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.numpad-status { flex-wrap: wrap; row-gap: 0; }
.numpad-note { flex-basis: 100%; color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.numpad-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numkey {
  height: 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  font: 500 26px/1 var(--mono);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .1s, transform .06s;
}
.numkey:hover { border-color: var(--control); }
.numkey:active { background: var(--active); transform: scale(.97); }
.numkey.fn { background: var(--raised); color: var(--muted); font-family: var(--font); }
.numkey svg { width: 26px; height: 26px; }
.numpad-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.numpad-actions .btn { height: 56px; font-size: 16px; }

.numpad-list { min-height: 0; overflow-y: auto; border-top: 1px solid var(--border); }
.numpad-list ul { list-style: none; margin: 0; padding: 0; }
.numpad-row {
  width: 100%;
  min-height: var(--touch);
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  color: var(--text);
}
.numpad-row:hover:not(:disabled) { background: var(--raised); }
.numpad-row:active:not(:disabled) { background: var(--active); }
.numpad-row.match { background: var(--raised); box-shadow: inset 3px 0 0 var(--accent); } /* taste-skill-ignore: an inset edge marker, not elevation */
.numpad-row:disabled { color: var(--muted); cursor: not-allowed; }
.numpad-row .dish-code { color: inherit; }
.numpad-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.numpad-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-field { flex: 0 0 120px; }
.numpad-row-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: var(--fs-small); font-weight: 600; line-height: 22px; text-align: center; flex: none; }
.numpad-row-price { font-variant-numeric: tabular-nums; }
.numpad .empty { margin-top: 16px; }

.tile-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: max-content; /* rows grow to fit a tile with a photo, even in this scroll box */
  gap: var(--tile-gap);
  align-content: start;
  padding: 16px 0 var(--pad);
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 108px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
  transition: background-color .12s, border-color .12s, transform .06s;
}
.tile:hover:not(:disabled) { border-color: var(--control); }
.tile:active:not(:disabled) { transform: scale(.98); background: var(--raised); }
.tile.in-ticket { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -2px; }
.tile:disabled { cursor: not-allowed; background: var(--raised); }
.tile:disabled .tile-name { color: var(--muted); }
.tile-name { font-size: 15px; line-height: 20px; font-weight: 500; padding-right: 28px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { font-size: var(--fs-small); line-height: 16px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; width: 100%; }
.tile-price { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-save { font-size: var(--fs-small); color: var(--positive); font-weight: 500; }
.tile.has-img { padding-top: 0; }
.tile-img {
  display: block;
  width: calc(100% + 28px);
  margin: 0 -14px 8px;
  flex: none;
  border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 0 0;
  height: 96px; /* a fixed height, so the grid row makes room for it */
  object-fit: cover;
  background: var(--raised);
}
.tile:disabled .tile-img { filter: grayscale(1); opacity: .6; }
.tile.has-img .tile-count { top: 8px; right: 8px; box-shadow: 0 0 0 2px var(--surface); }
.dish-cell { display: flex; align-items: center; gap: 12px; }
.dish-thumb { flex: none; width: 40px; height: 40px; border-radius: var(--radius-control); object-fit: cover; background: var(--raised); }
.dish-thumb.none { border: 1px dashed var(--border); background: none; }
.photo-pick { display: flex; align-items: center; gap: 16px; font-weight: 400; }
.photo-preview { flex: none; width: 120px; height: 90px; border-radius: var(--radius-card); object-fit: cover; border: 1px solid var(--border); background: var(--raised); }
.photo-preview.none { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: var(--fs-small); border-style: dashed; background: none; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.photo-actions .btn { position: relative; cursor: pointer; } /* holds its hidden file input (see .switch) */
.photo-actions .btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-count {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* the ticket rail */
.ticket {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--ground);
  border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0;
}
.ticket-head { display: flex; align-items: center; justify-content: space-between; padding: var(--pad) var(--pad) 12px; }
.ticket-no { font-family: var(--mono); font-weight: 500; }
.ticket-customer { padding: 0 var(--pad) 12px; }
.ticket-customer .field { font-size: var(--fs-small); color: var(--muted); }
.ticket-lines { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--pad); }
.ticket-empty { padding: 20px var(--pad); color: var(--muted); flex: 1; display: flex; flex-direction: column; gap: 24px; }
.last-ticket { border-top: 1px solid var(--border); padding-top: 16px; display: grid; gap: 4px; color: var(--text); }
.last-ticket .label { color: var(--muted); font-size: var(--fs-small); }
.last-ticket .row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.last-ticket .qno { font-size: 18px; }
.last-ticket .meta { color: var(--muted); font-variant-numeric: tabular-nums; }
.last-ticket .actions { display: flex; gap: 16px; }
.tline { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tline:last-child { border-bottom: 0; }
.tline.fresh { animation: cds-fresh 1.6s ease-out; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius-control); }
.tline-main { flex: 1; min-width: 0; }
.tline-name { font-weight: 500; }
.tline-subs { color: var(--muted); font-size: 13px; line-height: 18px; margin-top: 2px; }
.tline-note { color: var(--warning); font-size: 13px; line-height: 18px; margin-top: 2px; }
.tline-tools { display: flex; gap: 16px; margin-top: 2px; }
.tline-tools .text-btn { font-size: 13px; color: var(--muted); }
.tline-tools .text-btn.danger { color: var(--negative); }
.tline-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.tline-total { font-weight: 500; font-variant-numeric: tabular-nums; }

.ticket-foot { padding: 16px var(--pad) var(--pad); border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius-sheet) 0; }
.sums { display: grid; gap: 4px; color: var(--muted); }
.sums div { display: flex; justify-content: space-between; }
.sums dd { font-variant-numeric: tabular-nums; }
.sums .discount dd { color: var(--positive); }
.ticket-total { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 16px; }
.ticket-total span:first-child { font-size: var(--fs-section); font-weight: 600; }
.ticket-total .amount { font-size: var(--fs-kpi); line-height: 36px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.ticket-actions { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.ticket-actions .btn { height: 52px; }
.ticket-actions .charge { font-size: 16px; }
.mobile-charge { display: none; }

/* ---------- Queue ---------- */

.count-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.count-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
}
.count-card:hover { border-color: var(--control); }
.count-card .label { font-size: 13px; color: var(--muted); }
.count-card .value { font-size: 20px; line-height: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.count-card.active { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -2px; background: var(--accent-pale); }
.count-card.active .label { color: var(--accent-ink); }

.rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; align-items: start; }
.qticket { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); display: flex; flex-direction: column; }
.qticket header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.qno { font-family: var(--mono); font-weight: 500; font-size: 22px; line-height: 28px; }
.qwait { color: var(--muted); font-variant-numeric: tabular-nums; }
.qwait b { color: var(--text); font-weight: 600; }
.qticket.late { border-color: var(--danger-line); }
.qticket.late .qwait, .qticket.late .qwait b { color: var(--negative); }
.qcustomer { padding: 2px 16px 0; font-weight: 500; }
.qlines { padding: 10px 16px 12px; display: grid; gap: 6px; }
.qlines > li { display: grid; grid-template-columns: 28px 1fr; }
.qqty { font-weight: 600; font-variant-numeric: tabular-nums; }
.qlines .tline-subs, .qlines .tline-note { grid-column: 2; }
.qstations { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.qticket footer { margin-top: auto; border-top: 1px solid var(--rule); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.qmeta { color: var(--muted); font-variant-numeric: tabular-nums; }
.qactions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qactions .btn { margin-right: auto; }
.qticket.void { background: var(--raised); }
.qticket.void .qlines { text-decoration: line-through; color: var(--muted); }

/* ---------- tables (dishes, bundles, reports) ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0 12px; height: 56px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table thead th { height: 40px; font-size: var(--fs-small); font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--border); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.group th { height: 48px; padding-top: 16px; font-size: var(--fs-section); font-weight: 600; border-bottom: 1px solid var(--border); }
.table tr.group th .muted { font-weight: 400; font-size: var(--fs-body); margin-left: 6px; }
.table .sub { display: block; font-size: 13px; line-height: 18px; color: var(--muted); }
.table .name { font-weight: 500; }
.row-actions { display: flex; justify-content: flex-end; gap: 20px; white-space: nowrap; }
.table.compact th, .table.compact td { height: 44px; }

/* ---------- bundle builder ---------- */

.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
.builder-form { display: flex; flex-direction: column; gap: var(--gap); }
.section-head { display: flex; flex-direction: column; gap: 4px; }
.group-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.group-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.group-head .field { flex: 1 1 200px; }
.group-head .qty-field { flex: none; }
.group-head .qty-field .stepper { align-self: flex-start; }
.group-mode { color: var(--muted); }
.opt-list { display: grid; }
.opt-row { display: flex; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--rule); }
.opt-row:first-child { border-top: 0; }
.opt-row .opt-name { flex: 1; min-width: 0; }
.opt-row .opt-base { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-left: 6px; }
.upcharge { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.upcharge .input { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.icon-btn { width: var(--touch); height: var(--touch); border: 0; background: none; border-radius: var(--radius-control); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn:hover { background: var(--raised); color: var(--negative); }
.icon-btn svg { width: 18px; height: 18px; }
.picker { border-top: 1px solid var(--rule); padding-top: 4px; }
.picker summary { cursor: pointer; font-weight: 500; color: var(--accent); min-height: var(--touch); display: flex; align-items: center; list-style: none; }
.picker summary::-webkit-details-marker { display: none; }
.picker summary::before { content: "+"; margin-right: 8px; font-size: 18px; }
.picker[open] summary::before { content: "−"; }
.picker-cat { margin-top: 8px; }
.picker-cat-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 4px 0; }
.picker-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 16px; }
.pick { display: flex; align-items: center; gap: 10px; min-height: var(--touch); cursor: pointer; }
.pick input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.pick .muted { font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }

.preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: var(--gap); padding: 20px; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-card); }
.preview .tile { width: 200px; pointer-events: none; }
.preview-block { display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; gap: 6px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; }
.kv dt { color: var(--muted); }
.kv dd { font-variant-numeric: tabular-nums; font-weight: 500; }
.kv .total { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.kv .total dt { color: var(--text); font-weight: 500; }
.choice-list { display: grid; gap: 6px; }
.choice-list li { display: flex; justify-content: space-between; gap: 12px; }
.choice-list li span:last-child { color: var(--muted); text-align: right; }
.notice { padding: 12px 14px; border-radius: var(--radius-card); font-size: var(--fs-body); }
.notice.negative { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.notice ul { display: grid; gap: 2px; }

/* ---------- reports ---------- */

.report-lead { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: var(--gap); align-items: stretch; margin-bottom: var(--gap); }
.lead { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.lead .label { color: var(--muted); }
.lead .figure { font-size: var(--fs-lead); line-height: 42px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi-strip > div { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi-strip > div + div { border-left: 1px solid var(--border); }
.kpi-strip dt { color: var(--muted); }
.kpi-strip dd { font-size: 24px; line-height: 32px; font-weight: 400; font-variant-numeric: tabular-nums; }
.kpi-strip dd small { font-size: var(--fs-body); color: var(--muted); margin-left: 3px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .muted { font-size: 13px; }
.chart { height: 220px; position: relative; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { font: 12px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.report-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.title-actions:has(.field) { align-items: flex-end; }
.title-actions .segmented { align-self: flex-end; }
.year-accounts { margin-top: var(--gap); }
.year-accounts .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.table-scroll .table { min-width: 720px; }
.table tfoot td { height: 48px; font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; font-variant-numeric: tabular-nums; }
.small-print { font-size: 13px; margin-top: 12px; }
.audit-list { display: flex; flex-direction: column; }
.audit-list li { padding: 12px 0; border-top: 1px solid var(--rule); }
.audit-list li:first-child { border-top: 0; padding-top: 0; }
.audit-list .title { font-weight: 500; }
.audit-list .desc { color: var(--muted); margin-top: 2px; }

/* ---------- settings ---------- */

.settings { max-width: 1152px; }
.set-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gap); padding: 32px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; padding-top: 8px; }
.set-label { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.set-label h2 { font-weight: 500; }
.set-label p { color: var(--muted); }
.set-panel { background: var(--panel); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.set-panel .field .input { border-color: var(--panel-line); height: 44px; border-radius: 10px; }
.set-panel .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch-row .title { font-weight: 500; }
.switch-row .desc { color: var(--muted); }
.danger-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-item + .danger-item { border-top: 1px solid var(--border); padding-top: 16px; }
.danger-item p { color: var(--muted); max-width: 420px; }
.danger-item .title { color: var(--text); font-weight: 500; }
.set-label p + p { margin-top: 4px; }
.station-list { display: grid; }
.station-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.station-row:first-child { border-top: 0; }
.station-row .title { font-weight: 500; }
.station-row .desc { color: var(--muted); font-size: 13px; }
.station-row .url { font-family: var(--mono); font-size: 12px; }
.station-row .actions { display: flex; gap: 16px; }
.station-row a.text-btn { text-decoration: none; display: inline-flex; align-items: center; }
.add-station { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.add-station .field { flex: 1 1 220px; }
.add-station .btn { height: 44px; }
a.btn { text-decoration: none; }
select.station-select { width: auto; min-width: 150px; height: 36px; font-size: 14px; }
.receipt-preview { margin-top: 12px; width: 240px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); font: 12px/1.45 var(--mono); color: var(--text); }
.receipt-preview .c { text-align: center; }
.receipt-preview .b { font-weight: 500; }
.receipt-preview .r { display: flex; justify-content: space-between; }
.receipt-preview hr { border: 0; border-top: 1px dashed var(--muted); margin: 6px 0; }

/* ---------- dialogs (they float, so they may carry a shadow) ---------- */

dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-sheet);
  background: var(--surface);
  color: var(--text);
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22); /* taste-skill-ignore: dialogs float */
}
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(19, 20, 22, .45); }
.dlg { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.dlg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.dlg-head .price { font-size: var(--fs-section); font-weight: 600; font-variant-numeric: tabular-nums; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dlg-actions .btn { height: 48px; padding: 0 20px; }
.dlg p { color: var(--muted); }

.choose-group { display: flex; flex-direction: column; gap: 10px; }
.choose-group-head { display: flex; justify-content: space-between; align-items: baseline; }
.choose-group-head .state { color: var(--muted); font-variant-numeric: tabular-nums; }
.choose-group-head .state.done { color: var(--positive); font-weight: 500; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  text-align: left;
  font-weight: 500;
}
.opt small { color: var(--muted); font-weight: 400; font-size: 13px; }
.opt.selected { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -2px; background: var(--accent-pale); }
.opt.fixed { background: var(--raised); border-color: var(--raised); cursor: default; }
.opt.counter { cursor: default; gap: 8px; }

.due { display: flex; align-items: baseline; justify-content: space-between; }
.due .amount { font-size: var(--fs-kpi); line-height: 36px; font-weight: 600; font-variant-numeric: tabular-nums; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--raised); border-radius: 10px; align-self: flex-start; }
.segmented button { border: 0; background: none; height: 40px; padding: 0 20px; border-radius: 7px; font-weight: 500; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); outline: 1px solid var(--border); }
.segmented.wrap { flex-wrap: wrap; }
.pay-hint { margin: 0; color: var(--muted); }
.pay-error { margin: 0; color: var(--negative); font-weight: 500; }
.pay-wait { display: flex; gap: 16px; align-items: flex-start; padding: 16px; background: var(--raised); border-radius: var(--radius-card); }
.pay-wait p { margin: 4px 0 0; }
.spinner { flex: none; width: 24px; height: 24px; border: 3px solid var(--control); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick .btn { height: 44px; font-variant-numeric: tabular-nums; }
.change { display: flex; align-items: baseline; justify-content: space-between; font-size: var(--fs-section); }
.change .amount { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.change.short .amount { color: var(--negative); }
.done-no { font-family: var(--mono); font-size: 40px; line-height: 48px; font-weight: 500; }

.navsheet { width: min(360px, calc(100vw - 32px)); margin: 0 auto 0 0; height: 100dvh; max-height: 100dvh; border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0; background: var(--frame); }
.navsheet .sidebar { display: flex; height: 100%; }
dialog:focus-visible { outline: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); /* taste-skill-ignore: a toast floats */
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tablet: the sidebar folds into the top bar ---------- */

@media (max-width: 1199px) {
  :root { --rail: 340px; --topbar: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { grid-column: 1; padding: 0 16px; gap: 20px; }
  .topbar .brand { display: flex; flex: none; }
  .topbar .brand-scope { display: none; }
  .crumbs, .queue-status { display: none; }
  .topbar-tabs { display: flex; gap: 20px; height: 100%; overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .topbar-tabs::-webkit-scrollbar { display: none; }
  .topbar-tabs .tab { height: 100%; }
  .topbar-tabs .tab.active::after { bottom: 0; }
  .sheet { grid-column: 1; margin: 0 var(--sheet-inset) var(--sheet-inset); }
  .builder-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .report-lead { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --rail: 300px; --pad: 20px; }
  .topbar .brand-name { display: none; }
  .clock { display: none; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .builder-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
  .report-cols { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 1fr; gap: 16px; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip > div:nth-child(3) { border-left: 0; }
  .kpi-strip > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .table .hide-md { display: none; }
}

/* a portrait tablet: the number list goes under the pad */
@media (max-width: 1000px) {
  .numpad { grid-template-columns: minmax(0, 420px); grid-template-rows: auto minmax(0, 1fr); }
  .numkey { height: 56px; }
}

/* ---------- phone ---------- */

@media (max-width: 640px) {
  :root { --pad: 16px; --topbar: 52px; }
  .topbar { padding: 0 16px 0 4px; gap: 8px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar-tabs { display: none; }
  .topbar .brand-name { display: block; }
  .sheet { margin: 0; border: 0; border-radius: 0; }
  .sheet.fill { overflow-y: auto; }
  .order-screen { display: block; height: auto; padding-bottom: 84px; }
  .catalog { padding-bottom: 0; }
  .tile-grid { overflow: visible; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { flex-basis: 100%; }
  .catalog .title-actions .search { width: 100%; }
  .numpad { grid-template-columns: minmax(0, 1fr); }
  .numpad-list { overflow: visible; }
  .ticket { border-left: 0; border-top: 1px solid var(--border); border-radius: 0; }
  .ticket-lines { overflow: visible; }
  .ticket-foot { border-radius: 0; }
  .mobile-charge {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    gap: 12px;
    align-items: center;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 5;
  }
  .mobile-charge .summary { flex: 1; color: var(--muted); }
  .mobile-charge .summary b { color: var(--text); display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
  .mobile-charge .btn { height: 48px; }
  .count-cards { display: flex; overflow-x: auto; gap: 8px; scrollbar-width: none; }
  .count-card { flex: 0 0 auto; min-width: 128px; }
  .rail { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
  .row-actions { gap: 14px; }
  .kpi-strip dd { font-size: 20px; }
  .lead .figure { font-size: 30px; }
}

/* ---------- kitchen screen (kitchen.html) ---------- */
/* Read from a step away with busy hands: larger type, one big Done button per ticket. */

.kds { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.kds .topbar { flex: none; height: 56px; padding: 0 16px; gap: 24px; }
.kds .topbar .brand { display: flex; padding: 0; flex: none; }
.kds-tabs { display: flex; gap: 24px; height: 100%; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.kds-tabs::-webkit-scrollbar { display: none; }
.kds-tabs .tab { height: 100%; font-size: 16px; }
.kds-tabs .tab.active::after { bottom: 0; }
.kds .sheet { flex: 1; margin: 0 var(--sheet-inset) var(--sheet-inset); }
.kpage { max-width: none; }

.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.kticket { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); display: flex; flex-direction: column; }
.kticket.new { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: -2px; }
.kticket.late { border-color: var(--danger-line); outline: 1px solid var(--danger-line); outline-offset: -2px; }
.kticket.late .kwait { color: var(--negative); font-weight: 600; }
.khead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 2px; }
.kno { font-family: var(--mono); font-weight: 500; font-size: 30px; line-height: 36px; }
.kno.small { font-size: 18px; line-height: 24px; }
.kwait { font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kcustomer { padding: 0 16px 6px; font-weight: 500; }
.kitems { padding: 4px 0; }
.kitems li { display: grid; grid-template-columns: 44px 1fr; padding: 8px 16px; border-top: 1px solid var(--rule); }
.kqty { font-size: 22px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kname { font-size: 18px; line-height: 28px; font-weight: 500; }
.kfrom { font-size: 13px; line-height: 18px; color: var(--muted); }
.knote { font-size: 15px; line-height: 20px; color: var(--warning); font-weight: 500; margin-top: 2px; }
.kothers { padding: 8px 16px 0; color: var(--muted); font-size: 13px; line-height: 18px; }
.kdone { margin: 12px 16px 16px; height: 56px; font-size: 17px; }
.kpart { border-top: 1px solid var(--border); margin-top: 6px; }
.kpart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 0; font-weight: 600; min-height: 44px; }
.kpart .kitems li { border-top: 0; padding-top: 4px; padding-bottom: 4px; }
.kpart.done .kitems { color: var(--muted); text-decoration: line-through; }
/* a station screen: the cooking order beside the ticket cards */
.kstation { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.kstation .kgrid { grid-row: 1; grid-column: 1; }
.kseq { grid-column: 2; position: sticky; top: 0; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 0 8px; max-height: calc(100dvh - 120px); overflow-y: auto; }
.kseq h2, .kseq > p { padding: 0 16px; }
.kseq > p { font-size: 13px; margin: 2px 0 8px; }
.kseq-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 16px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; }
.kseq-row:hover { background: var(--raised); }
.kseq-row:active { background: var(--active); }
.kseq-n { width: 28px; height: 28px; border-radius: 50%; background: var(--active); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.kseq li:first-child .kseq-n { background: var(--primary); color: var(--on-primary); }
.kseq-what { display: flex; flex-direction: column; min-width: 0; }
.kseq-name { font-size: 16px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kseq-name b { font-variant-numeric: tabular-nums; margin-right: 2px; }
.kseq .knote { font-size: 13px; line-height: 18px; margin: 0; }
.kseq-ticket { display: flex; flex-direction: column; align-items: flex-end; }
.kseq-wait { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kseq-row.late .kseq-wait { color: var(--negative); font-weight: 600; }
.kticket.flash { animation: kflash 1.4s ease-out; }
@keyframes kflash { 0%, 40% { outline: 3px solid var(--accent); outline-offset: 2px; } 100% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .kticket.flash { animation: none; outline: 3px solid var(--accent); } }
@media (max-width: 900px) {
  .kstation { grid-template-columns: 1fr; }
  .kstation .kgrid { grid-row: 2; }
  .kseq { grid-column: 1; position: static; max-height: none; }
}

.krecent { margin-top: 32px; }
.krecent h2 { margin-bottom: 8px; }
.krecent li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 72px; align-items: center; gap: 16px; min-height: 52px; border-top: 1px solid var(--rule); }
.krecent-what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.krecent li > :last-child { justify-self: end; }

@media (max-width: 900px) {
  .kds .brand-text { display: none; }
  .kds .clock { display: none; }
}
@media (max-width: 640px) {
  .kds .topbar { gap: 12px; padding: 0 16px; }
  .kds .sheet { margin: 0; border: 0; border-radius: 0; }
  .kgrid { grid-template-columns: 1fr; }
  .krecent li { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .krecent li > .muted.num { display: none; }
}

/* ---------- customer screen (customer.html) ---------- */
/* Read across the counter, a metre or two away: the order and its total are set larger than on
   the till, and the ticket number is the one big thing once paid. */

.cds { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.cds .topbar { flex: none; height: 56px; padding: 0 20px; }
.cds .topbar .brand { display: flex; padding: 0; }
.cds .brand-name { font-size: 17px; display: block; }
.cds .sheet { flex: 1; margin: 0 var(--sheet-inset) var(--sheet-inset); }
.cds-change { color: var(--muted); font-weight: 400; font-size: 13px; }

.cds-order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 38%); height: 100%; }
.cds-lines { padding: 32px 32px 0; display: flex; flex-direction: column; min-height: 0; }
.cds-lines h1, .cds-hello h1 { font-size: 30px; line-height: 38px; }
.cds-lines .subline { font-size: 17px; margin-bottom: 16px; }
#cds-list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 24px; }
.cds-line { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--border); }
.cds-line.fresh { animation: cds-fresh 2.4s ease-out; }
@keyframes cds-fresh { 0%, 30% { background: var(--accent-pale); } 100% { background: transparent; } }
.cds-qty { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cds-name { font-size: 22px; line-height: 30px; font-weight: 500; }
.cds-subs { font-size: 16px; line-height: 24px; color: var(--muted); }
.cds-note { font-size: 16px; line-height: 24px; color: var(--warning); }
.cds-price { font-size: 22px; font-weight: 500; }

.cds-total { background: var(--ground); border-left: 1px solid var(--border); border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0; padding: 32px; display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; }
.cds-total .sums { font-size: 18px; gap: 8px; }
.cds-due { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 16px; }
.cds-due span:first-child { font-size: 22px; font-weight: 600; }
.cds-due .amount { font-size: 56px; line-height: 64px; font-weight: 600; letter-spacing: -0.02em; } /* taste-skill-ignore: read across the counter */
.cds-pay { display: grid; gap: 8px; }
.cds-pay-line { display: flex; justify-content: space-between; font-size: 20px; }
.cds-pay-line.strong { font-size: 26px; font-weight: 600; color: var(--positive); }
.cds-pay-hint { font-size: 22px; font-weight: 500; }
.cds-check { font-size: 16px; }

.cds-done { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 32px; }
.cds-thanks { font-size: 30px; font-weight: 600; }
.cds-done .muted { font-size: 20px; margin-top: 16px; }
.cds-number { font-family: var(--mono); font-weight: 500; font-size: 140px; line-height: 1; color: var(--accent); } /* taste-skill-ignore: the number is called across the shop */
.cds-done .subline { font-size: 20px; }
.cds-done-change { font-size: 24px; margin-top: 16px; }

.cds-welcome { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 44%); }
.cds-hello { padding: 48px 32px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.cds-hello .subline { font-size: 18px; }
.cds-meals { background: var(--ground); border-left: 1px solid var(--border); border-radius: 0 var(--radius-sheet) var(--radius-sheet) 0; padding: 32px; overflow-y: auto; }
.cds-meals h2 { margin-bottom: 8px; font-size: 20px; }
.cds-meals li { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.cds-meal-name { font-size: 20px; font-weight: 500; }
.cds-meal-price { display: flex; flex-direction: column; align-items: flex-end; font-size: 20px; font-weight: 600; }
.cds-meal-price .positive { font-size: 14px; font-weight: 500; }

/* the shop's advert (Settings → Customer screen banner): big on the welcome screen, a strip
   under an order */
.cds-banner { --banner-bg: #1b6c80; --banner-ink: #fff; position: relative; overflow: hidden; border-radius: var(--radius-sheet); background: var(--banner-bg); color: var(--banner-ink); display: flex; align-items: flex-end; min-height: 180px; }
.cds-banner.theme-red { --banner-bg: #c0392b; }
.cds-banner.theme-gold { --banner-bg: #f2b632; --banner-ink: #2b1d00; }
.cds-banner.theme-dark { --banner-bg: #1f2328; }
.cds-banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cds-banner-copy { position: relative; padding: 24px 28px; display: grid; gap: 6px; width: 100%; }
.cds-banner.has-img .cds-banner-copy { background: linear-gradient(to top, var(--banner-bg) 0%, color-mix(in srgb, var(--banner-bg) 85%, transparent) 55%, transparent 100%); padding-top: 64px; }
.cds-banner p { color: inherit; margin: 0; max-width: none; }
.cds-banner-title { font-size: 34px; line-height: 40px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.cds-banner-text { font-size: 20px; line-height: 28px; opacity: .92; text-wrap: pretty; }
.cds-hello .cds-banner { flex: 1; min-height: 240px; margin-bottom: 24px; }
.cds-hello.with-banner { justify-content: flex-start; padding-top: 24px; }
.cds-banner-in { animation: cds-banner-in .6s ease-out; }
@keyframes cds-banner-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cds-banner-in { animation: none; } }
/* which banner is showing, when several take turns */
.cds-banner-dots { position: absolute; top: 14px; right: 16px; display: flex; gap: 6px; }
.cds-banner-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .5); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.cds-banner-dots i.on { background: #fff; }
/* the strip under an order or on the thank-you screen */
.cds-banner.strip { min-height: 0; align-items: center; border-radius: var(--radius-card); margin: 0 0 24px; }
.cds-banner.strip .cds-banner-img { position: static; flex: none; width: 160px; height: 96px; }
.cds-banner.strip .cds-banner-copy { padding: 12px 20px; background: none; gap: 2px; }
.cds-banner.strip .cds-banner-title { font-size: 22px; line-height: 28px; }
.cds-banner.strip .cds-banner-text { font-size: 16px; line-height: 22px; }
.cds-done .cds-banner.strip { width: min(720px, 100%); margin: 32px 0 0; text-align: left; }
/* the small copies in Settings and the banner dialog */
.banner-list { display: grid; gap: 8px; }
.banner-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.banner-info { min-width: 0; }
.banner-row .icon-btn:disabled { opacity: .3; cursor: default; }
.banner-info .title { font-weight: 500; }
.banner-info .desc { color: var(--muted); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-thumb .cds-banner { min-height: 68px; height: 68px; border-radius: var(--radius-control); }
.banner-thumb .cds-banner-copy { padding: 6px 8px; }
.banner-thumb .cds-banner.has-img .cds-banner-copy { padding-top: 20px; }
.banner-thumb .cds-banner-title { font-size: 11px; line-height: 14px; }
.banner-thumb .cds-banner-text { display: none; }
.banner-thumb .muted { font-size: 11px; }
.banner-timing { display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.banner-timing .field .input { max-width: 120px; }
.banner-preview { margin-top: 16px; }
.dlg .banner-preview { margin-top: 0; }
.banner-preview .cds-banner { min-height: 120px; }
.banner-preview .cds-banner-copy { padding: 14px 16px; }
.banner-preview .cds-banner.has-img .cds-banner-copy { padding-top: 40px; }
.banner-preview .cds-banner-title { font-size: 20px; line-height: 26px; }
.banner-preview .cds-banner-text { font-size: 14px; line-height: 20px; }

.cds-pair { max-width: 720px; }
.cds-code { text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.1em; }
.cds-pair-head { margin: 32px 0 12px; }
.cds-tills { display: flex; flex-wrap: wrap; gap: 8px; }
.cds-tills .btn { font-family: var(--mono); }

/* a set meal being chosen: numbered steps; the current one shows its options as large cards */
.cds-choosing { overflow-y: auto; padding-bottom: 32px; }
.cds-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cds-step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.cds-step-no {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid var(--control);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cds-step.done .cds-step-no { background: var(--positive); border-color: var(--positive); color: var(--on-accent); }
.cds-step.current .cds-step-no { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cds-step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 40px; }
.cds-step-head h2 { font-size: 22px; line-height: 30px; font-weight: 600; }
.cds-step.next .cds-step-head h2 { color: var(--muted); font-weight: 500; }
.cds-step-state { font-size: 16px; color: var(--muted); white-space: nowrap; }
.cds-step.current .cds-step-state { color: var(--accent); font-weight: 600; }
.cds-step.done .cds-step-state { color: var(--positive); font-weight: 500; }
.cds-step-picked { font-size: 20px; line-height: 28px; font-weight: 500; }
.cds-step-later { font-size: 16px; line-height: 24px; color: var(--muted); }
.cds-opts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cds-opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--control);
  border-radius: var(--radius-card);
  background: var(--surface);
  font-size: 20px;
  line-height: 26px;
  font-weight: 500;
}
.cds-opt.selected { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-pale); }
.cds-opt-extra { font-size: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.cds-opt-count { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 18px; font-weight: 600; line-height: 32px; text-align: center; flex: none; }

@media (max-width: 900px) {
  .cds-order, .cds-welcome { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .cds-total, .cds-meals { border-left: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-sheet) var(--radius-sheet); padding: 20px; }
  .cds-lines { padding: 20px 20px 0; }
  .cds-due .amount { font-size: 44px; line-height: 52px; }
  .cds-number { font-size: 104px; }
}
@media (max-width: 640px) {
  .cds .sheet { margin: 0; border: 0; border-radius: 0; }
  .cds-total, .cds-meals { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .cds-line.fresh, .tline.fresh { animation: none; background: var(--accent-pale); } }

/* ---------- collection board (collect.html) ---------- */
/* Read from across the shop: numbers are the content, set as large as the screen allows.
   Ready takes the larger share and the hue; preparing is quieter. */

.board { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.board .topbar { flex: none; height: 56px; padding: 0 24px; }
.board .topbar .brand { display: flex; padding: 0; }
.board .brand-name { font-size: 18px; display: block; }
.board-sound { color: var(--muted); font-weight: 400; font-size: 13px; }
.board-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sheet-inset); margin: 0 var(--sheet-inset) var(--sheet-inset); }
.board-col { border-radius: var(--radius-sheet); padding: 32px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.board-col-ready { background: var(--surface); border: 1px solid var(--border); }
.board-col-preparing { background: var(--ground); border: 1px solid var(--border); }
.board-col h1, .board-col h2 { font-size: 30px; line-height: 38px; font-weight: 600; margin-bottom: 24px; }
.board-col-ready h1 { color: var(--accent); }
.board-col-preparing h2 { color: var(--muted); }
.board-col ul { display: grid; align-content: start; gap: 16px; }
.board-ready { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.board-preparing { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.board-col li { display: flex; flex-direction: column; align-items: flex-start; border-radius: var(--radius-card); padding: 12px 16px; }
.board-no { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; }
.board-no::before { content: "#"; opacity: .55; margin-right: 2px; }
.board-ready .board-no { font-size: 88px; color: var(--accent); } /* taste-skill-ignore: read across the shop */
.board-preparing .board-no { font-size: 48px; color: var(--muted); } /* taste-skill-ignore: read across the shop */
.board-name { font-size: 20px; line-height: 28px; font-weight: 500; margin-top: 6px; }
.board-preparing .board-name { font-size: 16px; color: var(--muted); }
.board-ready li { background: var(--accent-pale); }
.board-ready li.latest { background: var(--accent); }
.board-ready li.latest .board-no, .board-ready li.latest .board-name { color: var(--on-accent); }
.board-ready li.latest { animation: board-pop 1.2s ease-out 2; }
@keyframes board-pop { 0% { transform: scale(1); } 30% { transform: scale(1.06); } 100% { transform: scale(1); } }
.board-empty { font-size: 20px; line-height: 30px; color: var(--muted); max-width: 520px; }
.board-hint { margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 16px; }

@media (max-width: 900px) {
  .board-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 3fr) minmax(0, 2fr); }
  .board-col { padding: 20px; }
  .board-ready .board-no { font-size: 64px; }
  .board-preparing .board-no { font-size: 36px; }
  .board-ready { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .board-preparing { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .board-ready li.latest { animation: none; } }

/* ---------- printing ---------- */

#print-area { display: none; }

/* ---------- sign-in (js/signin.js) and staff ---------- */
body.signin-open > :not(.signin) { visibility: hidden; }
.signin { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: var(--frame); color: var(--text); }
.signin-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); text-align: center; }
.signin-card h1 { margin: 0; font-size: var(--fs-title); font-weight: 600; }
.signin-shop { margin: 0; color: var(--muted); font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .06em; }
.signin-lead { margin: 0; color: var(--muted); }
.signin-form, .signin-setup { display: flex; flex-direction: column; gap: 12px; }
.signin-setup { text-align: left; }
.signin-pin { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.signin-dots { height: 44px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--ground); }
.signin-form:focus-within .signin-dots { border-color: var(--accent); }
.signin-dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--text); }
.signin-dots em { font-style: normal; color: var(--placeholder); }
.signin-error { min-height: 1.4em; margin: 0; color: var(--negative); font-size: 13px; }
.signin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.signin-pad button { height: 56px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--raised); color: var(--text); font-size: 22px; font-family: var(--mono); }
.signin-pad button:hover { background: var(--active); }
.signin-pad button:active { transform: scale(.97); }
.signin-go { height: 48px; }
.who-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; }
.who-btn:hover { border-color: var(--control); }
.who-name { font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.who-lock { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--raised); color: var(--muted); }
.who-lock svg { width: 14px; height: 14px; }
@media (max-width: 1100px) { .who-name { display: none; } .who-btn { padding: 0 4px; } }
/* shops: the switcher in the till's top bar, the shop picker, and staff's shops */
.shop-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 220px; padding: 0 12px 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; }
.shop-btn:hover { border-color: var(--control); }
.shop-btn svg { flex: none; width: 16px; height: 16px; }
.shop-btn-name { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .shop-btn-name { max-width: 90px; } }
.shop-pick { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; text-align: left; }
.shop-pick-btn { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: var(--text); text-align: left; }
.shop-pick-btn:hover { border-color: var(--control); background: var(--hover); }
.shop-pick-btn.active { border-color: var(--accent); background: var(--accent-pale); color: var(--accent-ink); }
.shop-pick-btn .title { font-weight: 500; }
.shop-pick-btn .desc { color: var(--muted); font-size: 13px; }
.shop-pick-btn.active .desc { color: inherit; }
.shop-checks { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.shop-checks legend { padding: 0; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
textarea.input { height: auto; min-height: 72px; padding-top: 8px; padding-bottom: 8px; resize: vertical; line-height: 1.4; font-family: inherit; }
.business-name { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.business-name .field { flex: 1; min-width: 200px; }
.staff-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.staff-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.staff-row .desc { color: var(--muted); font-size: 13px; }

@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  body { background: #fff; color: #000; }
  @page { margin: 4mm; }
}

.receipt { width: 72mm; font: 12px/1.35 var(--mono); color: #000; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.r-title { text-align: center; font-weight: 500; font-size: 15px; }
.r-no { text-align: center; font-weight: 500; font-size: 22px; margin: 4px 0; }
.r-center { text-align: center; }
.r-line { display: flex; justify-content: space-between; gap: 8px; }
.r-sub { padding-left: 14px; }
.r-note { font-style: italic; }
.r-total { font-weight: 500; font-size: 14px; margin: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- admin page (admin.html): the businesses on this server ---------- */
.admin-page { background: var(--frame); min-height: 100vh; }
.admin { max-width: 880px; margin: 0 auto; padding: 32px 20px 64px; display: flex; flex-direction: column; gap: 16px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: var(--fs-title); font-weight: 600; }
.admin-msg { margin: 0; padding: 10px 14px; border-radius: var(--radius-card); background: var(--panel); }
.admin-clients { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.admin-client { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.admin-client.paused { opacity: .75; }
.admin-client .title { font-weight: 600; }
.admin-client .desc { color: var(--muted); font-size: var(--fs-small); }
.admin-actions { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
.admin-actions a.text-btn { display: inline-flex; align-items: center; text-decoration: none; }
.admin-add h2 { margin: 0; font-size: 16px; font-weight: 600; }
.admin-add-form { display: flex; flex-direction: column; gap: 16px; }
.admin-cmd { margin: 0; padding: 10px 12px; text-align: left; white-space: pre-wrap; word-break: break-all; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-control); font-family: var(--font-mono, monospace); font-size: 13px; }
.signin-change { align-self: center; color: var(--muted); }
