/* Romato · Navalagund — base.css
   Design tokens and the components every window shares (customer, staff, rider, print preview).
   Rules: colours only through the tokens below; the dark theme swaps the same tokens; components
   never change size when their state changes (no layout shift); touch targets are 40 px or more.
   docs/FRONTEND.md lists every class; /staff/#/styleguide shows them live. */

/* ---- tokens: light (default) ------------------------------------------------------------------ */

:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Nirmala UI", sans-serif;
  --font-brand: "Baloo Tamma 2", "Nirmala UI", "Noto Sans Kannada", "Tunga", "Segoe UI", system-ui, sans-serif;
  --font-kn: "Baloo Tamma 2", "Noto Sans Kannada", "Nirmala UI", "Tunga", "Kedage", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace;

  /* brand */
  --tomato: #D7372B;
  --saffron: #F29F05;
  --leaf: #2E7D32;
  --egg-yellow: #E0A800;
  --nonveg-brown: #8B2E16;

  /* surfaces + text (slate) */
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #EEF2F6;
  --sunken: #E8ECF1;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;
  --overlay: rgba(15, 23, 42, .48);

  /* actions */
  --primary: #D7372B;
  --primary-hover: #BE2D22;
  --primary-press: #A9271D;
  --primary-soft: #FDECEA;
  --primary-ink: #B42B20;
  --on-primary: #FFFFFF;
  --accent: #F29F05;
  --accent-hover: #DE9004;
  --accent-soft: #FEF3DC;
  --accent-ink: #8A4F00;
  --on-accent: #1F1400;

  /* meaning */
  --success: #2E7D32; --success-hover: #256B29; --success-soft: #E3F4E5; --success-ink: #1B5E20;
  --warn: #E0A800;    --warn-soft: #FFF6D6;    --warn-ink: #7A5200;
  --danger: #B3261E;  --danger-hover: #9C2019; --danger-soft: #FDE7E5; --danger-ink: #A8221A;
  --info: #2563EB;    --info-soft: #E5EEFF;    --info-ink: #1E4FC2;
  --focus: #2563EB;

  /* Indian diet marks (FSSAI style: drawn on white in both themes) */
  --veg: #2E7D32;
  --egg: #E0A800;
  --nonveg: #8B2E16;
  --diet-paper: #FFFFFF;

  /* order status: background / text / dot */
  --st-placed-bg: #FFF1D6;    --st-placed-ink: #8A4B00;    --st-placed-dot: #F29F05;
  --st-accepted-bg: #E3EDFF;  --st-accepted-ink: #1E4FC2;  --st-accepted-dot: #3B6FE0;
  --st-ready-bg: #DFF3E3;     --st-ready-ink: #1B6B2A;     --st-ready-dot: #2E9A44;
  --st-out-bg: #EDE7FD;       --st-out-ink: #5B36C4;       --st-out-dot: #7C5CE6;
  --st-delivered-bg: #D9F2EE; --st-delivered-ink: #0E6B61; --st-delivered-dot: #14A090;
  --st-completed-bg: #E6EBF1; --st-completed-ink: #334155; --st-completed-dot: #64748B;
  --st-rejected-bg: #FDE4E1;  --st-rejected-ink: #B3261E;  --st-rejected-dot: #D7372B;
  --st-cancelled-bg: #EEF0F3; --st-cancelled-ink: #6B7280; --st-cancelled-dot: #9CA3AF;
  /* payment status */
  --pay-unpaid-bg: #FDE8E0;   --pay-unpaid-ink: #A3330F;   --pay-unpaid-dot: #E05A2B;
  --pay-partial-bg: #FFF4CC;  --pay-partial-ink: #7A5A00;  --pay-partial-dot: #E0A800;
  --pay-paid-bg: #DCF5E3;     --pay-paid-ink: #17663A;     --pay-paid-dot: #22A355;
  --pay-refunded-bg: #E8E6F7; --pay-refunded-ink: #4B3F99; --pay-refunded-dot: #7468C8;
  /* kitchen ticket age: green < warn_after_min <= amber < late_after_min <= red */
  --age-ok: #2E9A44; --age-warn: #E39B00; --age-late: #D7372B;

  /* staff sidebar: dark slate in both themes */
  --sb-bg: #0F172A;
  --sb-bg-2: #15203A;
  --sb-text: #CBD5E1;
  --sb-muted: #7C8BA1;
  --sb-hover: rgba(255, 255, 255, .06);
  --sb-active: rgba(255, 255, 255, .11);
  --sb-mark: #F29F05;

  /* shape */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .07);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .24);
  --ring: 0 0 0 3px rgba(37, 99, 235, .28);

  /* rhythm */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --tap: 40px;          /* smallest touch target */
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* ---- tokens: dark (staff console; also the rider app when the phone is dark) ----------------------
   The same block twice: once for the system preference (when no theme is chosen), once for
   data-theme="dark". .theme-dark makes any subtree dark (the kitchen screen is always dark). */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B111C; --surface: #121A27; --surface-2: #162031; --surface-3: #1C273A; --sunken: #0E1520;
    --border: #243247; --border-strong: #34465F;
    --text: #E6EBF2; --text-2: #C3CDDA; --muted: #8D9AAE; --faint: #64738A; --overlay: rgba(2, 6, 14, .66);
    --primary: #E5483B; --primary-hover: #EF5B4E; --primary-press: #D23D31; --primary-soft: #3B1916; --primary-ink: #FF8F84; --on-primary: #FFFFFF;
    --accent: #F5A623; --accent-hover: #FFB43C; --accent-soft: #3A2A0B; --accent-ink: #FFC35C; --on-accent: #1F1400;
    --success: #2F8F38; --success-hover: #37A341; --success-soft: #133524; --success-ink: #7FDA95;
    --warn: #F2C230; --warn-soft: #3A300A; --warn-ink: #F5CE5A;
    --danger: #D9443A; --danger-hover: #E5574D; --danger-soft: #44171A; --danger-ink: #FF9A91;
    --info: #60A5FA; --info-soft: #172A4D; --info-ink: #9DBBFF; --focus: #60A5FA;
    --st-placed-bg: #3A2A0A;    --st-placed-ink: #FFC761;    --st-placed-dot: #F5A623;
    --st-accepted-bg: #172A4D;  --st-accepted-ink: #9DBBFF;  --st-accepted-dot: #5B8DF0;
    --st-ready-bg: #123321;     --st-ready-ink: #7FDA95;     --st-ready-dot: #3DB858;
    --st-out-bg: #2A1F4D;       --st-out-ink: #C2B0FF;       --st-out-dot: #9479F0;
    --st-delivered-bg: #0E3330; --st-delivered-ink: #6FD9CA; --st-delivered-dot: #22B8A5;
    --st-completed-bg: #222B38; --st-completed-ink: #B6C2D1; --st-completed-dot: #7D8BA0;
    --st-rejected-bg: #44171A;  --st-rejected-ink: #FF9A91;  --st-rejected-dot: #E5483B;
    --st-cancelled-bg: #252A33; --st-cancelled-ink: #8F98A6; --st-cancelled-dot: #6B7280;
    --pay-unpaid-bg: #42200F;   --pay-unpaid-ink: #FFA27E;   --pay-unpaid-dot: #F07A4A;
    --pay-partial-bg: #3A300A;  --pay-partial-ink: #F5CE5A;  --pay-partial-dot: #E8B923;
    --pay-paid-bg: #133523;     --pay-paid-ink: #79D99A;     --pay-paid-dot: #34B868;
    --pay-refunded-bg: #29244A; --pay-refunded-ink: #B9B1F5; --pay-refunded-dot: #8C80E0;
    --age-ok: #3DB858; --age-warn: #F5B323; --age-late: #F05A4C;
    --sb-bg: #070C16; --sb-bg-2: #0D1526;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .28);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
    --ring: 0 0 0 3px rgba(96, 165, 250, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"], .theme-dark {
  --bg: #0B111C; --surface: #121A27; --surface-2: #162031; --surface-3: #1C273A; --sunken: #0E1520;
  --border: #243247; --border-strong: #34465F;
  --text: #E6EBF2; --text-2: #C3CDDA; --muted: #8D9AAE; --faint: #64738A; --overlay: rgba(2, 6, 14, .66);
  --primary: #E5483B; --primary-hover: #EF5B4E; --primary-press: #D23D31; --primary-soft: #3B1916; --primary-ink: #FF8F84; --on-primary: #FFFFFF;
  --accent: #F5A623; --accent-hover: #FFB43C; --accent-soft: #3A2A0B; --accent-ink: #FFC35C; --on-accent: #1F1400;
  --success: #2F8F38; --success-hover: #37A341; --success-soft: #133524; --success-ink: #7FDA95;
  --warn: #F2C230; --warn-soft: #3A300A; --warn-ink: #F5CE5A;
  --danger: #D9443A; --danger-hover: #E5574D; --danger-soft: #44171A; --danger-ink: #FF9A91;
  --info: #60A5FA; --info-soft: #172A4D; --info-ink: #9DBBFF; --focus: #60A5FA;
  --st-placed-bg: #3A2A0A;    --st-placed-ink: #FFC761;    --st-placed-dot: #F5A623;
  --st-accepted-bg: #172A4D;  --st-accepted-ink: #9DBBFF;  --st-accepted-dot: #5B8DF0;
  --st-ready-bg: #123321;     --st-ready-ink: #7FDA95;     --st-ready-dot: #3DB858;
  --st-out-bg: #2A1F4D;       --st-out-ink: #C2B0FF;       --st-out-dot: #9479F0;
  --st-delivered-bg: #0E3330; --st-delivered-ink: #6FD9CA; --st-delivered-dot: #22B8A5;
  --st-completed-bg: #222B38; --st-completed-ink: #B6C2D1; --st-completed-dot: #7D8BA0;
  --st-rejected-bg: #44171A;  --st-rejected-ink: #FF9A91;  --st-rejected-dot: #E5483B;
  --st-cancelled-bg: #252A33; --st-cancelled-ink: #8F98A6; --st-cancelled-dot: #6B7280;
  --pay-unpaid-bg: #42200F;   --pay-unpaid-ink: #FFA27E;   --pay-unpaid-dot: #F07A4A;
  --pay-partial-bg: #3A300A;  --pay-partial-ink: #F5CE5A;  --pay-partial-dot: #E8B923;
  --pay-paid-bg: #133523;     --pay-paid-ink: #79D99A;     --pay-paid-dot: #34B868;
  --pay-refunded-bg: #29244A; --pay-refunded-ink: #B9B1F5; --pay-refunded-dot: #8C80E0;
  --age-ok: #3DB858; --age-warn: #F5B323; --age-late: #F05A4C;
  --sb-bg: #070C16; --sb-bg-2: #0D1526;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(96, 165, 250, .35);
  color-scheme: dark;
}
.theme-dark { color: var(--text); background-color: var(--bg); }

/* ---- base ---------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 14px; line-height: 1.45;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.has-overlay { overflow: hidden; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
h4 { font-size: 13px; font-weight: 650; }
p { margin: 0; }
img, svg, video, canvas { display: block; }
svg { flex-shrink: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-4) 0; }
::selection { background: color-mix(in srgb, var(--primary) 22%, transparent); }
[hidden] { display: none !important; }

/* One visible focus ring for every control, shown for keyboard focus only. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--text); color: var(--surface); font-weight: 600; transition: top .15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---- utilities ------------------------------------------------------------------------------- */

.row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.col { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.start { align-items: flex-start; }
.baseline { align-items: baseline; }
.stretch { align-items: stretch; }
.grid { display: grid; gap: var(--sp-4); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.fill { grid-template-columns: repeat(auto-fill, minmax(var(--min, 220px), 1fr)); }
.gap-0 { gap: 0; } .gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-2 { color: var(--text-2); }
.ink-primary { color: var(--primary-ink); }
.ink-success { color: var(--success-ink); }
.ink-danger { color: var(--danger-ink); }
.ink-warn { color: var(--warn-ink); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.big { font-size: 16px; }
.strong { font-weight: 650; }
.bold { font-weight: 750; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.strike { text-decoration: line-through; }
.kn { font-family: var(--font-kn); font-weight: 600; }
.brand-font { font-family: var(--font-brand); }
.hidden { display: none !important; }
.show-sm { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- typography helpers ------------------------------------------------------------------------ */

.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.page-head { display: flex; align-items: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head .page-title { font-size: 22px; font-weight: 750; letter-spacing: -0.015em; }
.page-head .page-sub { color: var(--muted); margin-top: 2px; }
.page-head .page-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: var(--sp-2); font-size: 13px; font-weight: 700; color: var(--text-2);
  margin: var(--sp-6) 0 var(--sp-3); }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
code, .code {
  font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
pre.code { display: block; padding: 10px 12px; overflow-x: auto; white-space: pre; line-height: 1.5; margin: 0; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  font-family: var(--font); font-size: 11.5px; font-weight: 600; line-height: 1; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
}

/* ---- buttons ----------------------------------------------------------------------------------- */

.btn {
  --h: 40px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); min-height: var(--h); padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  text-decoration: none !important; box-shadow: var(--shadow-sm);
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: var(--surface); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary:active:not(:disabled) { background: var(--primary-press); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { background: var(--success-hover); border-color: var(--success-hover); }
.btn.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger-ink); }
.btn.danger:hover { border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.solid:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.link { background: none; border: 0; box-shadow: none; padding: 0 4px; color: var(--primary-ink); height: auto; min-height: 0; }
.btn.link:hover { text-decoration: underline !important; }
.btn.sm { --h: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.lg { --h: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn.lg svg { width: 20px; height: 20px; }
.btn.xl { --h: 60px; padding: 0 24px; font-size: 17px; font-weight: 700; border-radius: 14px; gap: 10px; }
.btn.xl svg { width: 22px; height: 22px; }
.btn.icon { width: var(--h); padding: 0; }
.btn.block { display: flex; width: 100%; }
.btn .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); font-size: 11.5px; line-height: 20px;
  background: rgba(0, 0, 0, .14); }
/* Busy: the label stays (so the width never changes) but is hidden under a spinner. */
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; border: 2.5px solid currentColor; border-color: var(--busy-ink, var(--text-2)); border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn.primary.busy, .btn.success.busy, .btn.danger.solid.busy { --busy-ink: #fff; }
.btn.accent.busy { --busy-ink: var(--on-accent); }
.btn.busy.with-text { color: inherit !important; }
.btn-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }

/* ---- forms ------------------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req::after, .label .req::after { content: " *"; color: var(--danger-ink); }
.hint { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; font-weight: 550; color: var(--danger-ink); }
.field .error-text:empty { display: none; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px;
  transition: border-color .12s, box-shadow .12s, background-color .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: var(--ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
.input[readonly] { background: var(--surface-2); }
.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.select {
  padding-right: 34px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input.lg, .select.lg { height: 48px; font-size: 16px; border-radius: 12px; }
.input.sm, .select.sm { height: 32px; font-size: 13px; border-radius: 8px; padding: 0 10px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea, .input.invalid, .select.invalid, .textarea.invalid {
  border-color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface));
}
.field.invalid > label { color: var(--danger-ink); }

/* input with an icon on the left, text/unit or a button on the right */
.input-group { position: relative; display: flex; align-items: center; min-width: 0; }
.input-group > .ig-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; display: grid; }
.input-group > .ig-icon svg { width: 18px; height: 18px; }
.input-group > .ig-icon + .input { padding-left: 40px; }
.input-group > .ig-text { position: absolute; left: 12px; color: var(--muted); font-weight: 600; pointer-events: none; }
.input-group > .ig-text + .input { padding-left: 30px; }
.input-group > .ig-suffix { position: absolute; right: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
.input-group > .input:has(+ .ig-suffix) { padding-right: 52px; }
.input-group > .ig-btn { position: absolute; right: 4px; height: 32px; min-height: 32px; width: 32px; padding: 0; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted); box-shadow: none; display: grid; place-items: center; }
.input-group > .ig-btn:hover { background: var(--surface-3); color: var(--text); }
.input-group > .input:has(+ .ig-btn), .input-group > .input:has(~ .ig-btn) { padding-right: 42px; }
.input-group > .btn.attach { margin-left: -1px; border-radius: 0 10px 10px 0; }
.input-group > .input:has(+ .btn.attach) { border-radius: 10px 0 0 10px; }

.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-5); }

/* switch: <label class="switch"><input type="checkbox"><span class="track"></span><span>Label</span></label> */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer;
  font-weight: 550; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; flex-shrink: 0; width: 42px; height: 24px; border-radius: var(--r-pill);
  background: var(--border-strong); transition: background-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s var(--ease); }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.switch.lg .track { width: 54px; height: 30px; }
.switch.lg .track::after { width: 24px; height: 24px; }
.switch.lg input:checked + .track::after { transform: translateX(24px); }

/* checkbox / radio with label */
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

/* radio chips: <div class="radio-chips"><label><input type="radio" name="t" value="a"><span>A</span></label>…</div> */
.radio-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.radio-chips label { position: relative; cursor: pointer; }
.radio-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-chips span {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border-radius: 10px;
  border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 600; color: var(--text-2);
  transition: border-color .12s, background-color .12s, color .12s;
}
.radio-chips span svg { width: 18px; height: 18px; }
.radio-chips label:hover span { border-color: var(--faint); }
.radio-chips input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.radio-chips input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.radio-chips input:disabled + span { opacity: .5; cursor: not-allowed; }
.radio-chips.lg span { min-height: 52px; padding: 0 20px; font-size: 15px; }

/* segmented control: <div class="segmented" role="group"><button aria-pressed="true">Day</button>…</div> */
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); }
.segmented > button, .segmented > label > span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer;
}
.segmented > button svg { width: 16px; height: 16px; }
.segmented > button:hover { color: var(--text); }
.segmented > button[aria-pressed="true"], .segmented > button.on, .segmented > label > input:checked + span {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.segmented > label { position: relative; display: inline-flex; }
.segmented > label > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented > label > input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.segmented.block { display: flex; }
.segmented.block > * { flex: 1; }

/* ---- cards and stat tiles ---------------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.pad { padding: var(--sp-5); }
.card-head { display: flex; align-items: center; gap: var(--sp-3); padding: 16px 20px 0; min-height: 52px; }
.card-head.bordered { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 4px 0 8px; }
.card-foot { display: flex; align-items: center; gap: var(--sp-2); padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.stat { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; min-height: 112px; overflow: hidden; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }
.stat-icon.success { background: var(--success-soft); color: var(--success-ink); }
.stat-icon.info { background: var(--info-soft); color: var(--info-ink); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger-ink); }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: auto; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; }
.delta.up { color: var(--success-ink); }
.delta.down { color: var(--danger-ink); }

/* ---- badges, pills, tags ---------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-2);
}
.badge.primary { background: var(--primary); color: var(--on-primary); }
.badge.accent { background: var(--accent); color: var(--on-accent); }
.badge.success { background: var(--success); color: #fff; }
.badge.dark { background: var(--text); color: var(--surface); }

.pill {
  --pill-bg: var(--surface-3); --pill-ink: var(--text-2); --pill-dot: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 650; line-height: 1; white-space: nowrap; background: var(--pill-bg); color: var(--pill-ink);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pill-dot); flex-shrink: 0; }
.pill.plain::before { display: none; }
.pill.lg { height: 30px; padding: 0 13px; font-size: 13.5px; }
.pill.lg::before { width: 8px; height: 8px; }
.pill.st-placed { --pill-bg: var(--st-placed-bg); --pill-ink: var(--st-placed-ink); --pill-dot: var(--st-placed-dot); }
.pill.st-placed::before { animation: pulse-dot 1.4s ease-in-out infinite; }
.pill.st-accepted { --pill-bg: var(--st-accepted-bg); --pill-ink: var(--st-accepted-ink); --pill-dot: var(--st-accepted-dot); }
.pill.st-ready { --pill-bg: var(--st-ready-bg); --pill-ink: var(--st-ready-ink); --pill-dot: var(--st-ready-dot); }
.pill.st-out_for_delivery { --pill-bg: var(--st-out-bg); --pill-ink: var(--st-out-ink); --pill-dot: var(--st-out-dot); }
.pill.st-delivered { --pill-bg: var(--st-delivered-bg); --pill-ink: var(--st-delivered-ink); --pill-dot: var(--st-delivered-dot); }
.pill.st-completed { --pill-bg: var(--st-completed-bg); --pill-ink: var(--st-completed-ink); --pill-dot: var(--st-completed-dot); }
.pill.st-rejected { --pill-bg: var(--st-rejected-bg); --pill-ink: var(--st-rejected-ink); --pill-dot: var(--st-rejected-dot); }
.pill.st-cancelled { --pill-bg: var(--st-cancelled-bg); --pill-ink: var(--st-cancelled-ink); --pill-dot: var(--st-cancelled-dot); text-decoration: line-through; }
.pill.pay-unpaid { --pill-bg: var(--pay-unpaid-bg); --pill-ink: var(--pay-unpaid-ink); --pill-dot: var(--pay-unpaid-dot); }
.pill.pay-partial { --pill-bg: var(--pay-partial-bg); --pill-ink: var(--pay-partial-ink); --pill-dot: var(--pay-partial-dot); }
.pill.pay-paid { --pill-bg: var(--pay-paid-bg); --pill-ink: var(--pay-paid-ink); --pill-dot: var(--pay-paid-dot); }
.pill.pay-refunded { --pill-bg: var(--pay-refunded-bg); --pill-ink: var(--pay-refunded-ink); --pill-dot: var(--pay-refunded-dot); }
.pill.k-queued { --pill-bg: var(--surface-3); --pill-ink: var(--text-2); --pill-dot: var(--faint); }
.pill.k-preparing { --pill-bg: var(--st-placed-bg); --pill-ink: var(--st-placed-ink); --pill-dot: var(--st-placed-dot); }
.pill.k-ready { --pill-bg: var(--st-ready-bg); --pill-ink: var(--st-ready-ink); --pill-dot: var(--st-ready-dot); }
.pill.k-void { --pill-bg: var(--st-cancelled-bg); --pill-ink: var(--st-cancelled-ink); --pill-dot: var(--st-cancelled-dot); text-decoration: line-through; }
.pill.info { --pill-bg: var(--info-soft); --pill-ink: var(--info-ink); --pill-dot: var(--info); }
.pill.success { --pill-bg: var(--success-soft); --pill-ink: var(--success-ink); --pill-dot: var(--success); }
.pill.warn { --pill-bg: var(--warn-soft); --pill-ink: var(--warn-ink); --pill-dot: var(--warn); }
.pill.danger { --pill-bg: var(--danger-soft); --pill-ink: var(--danger-ink); --pill-dot: var(--danger); }
.pill.brand { --pill-bg: var(--primary-soft); --pill-ink: var(--primary-ink); --pill-dot: var(--primary); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.tag svg { width: 13px; height: 13px; }
.tag.brand { background: var(--primary-soft); color: var(--primary-ink); }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag.success { background: var(--success-soft); color: var(--success-ink); }
.tag.warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag.danger { background: var(--danger-soft); color: var(--danger-ink); }
.tag.info { background: var(--info-soft); color: var(--info-ink); }
.tag.outline { background: transparent; border: 1px solid var(--border-strong); }
.demo-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  background: var(--accent); color: var(--on-accent);
}
.demo-chip svg { width: 12px; height: 12px; }

/* ---- tables ------------------------------------------------------------------------------------ */

.table-wrap { overflow: auto; min-width: 0; -webkit-overflow-scrolling: touch; }
.table-wrap.scroll { max-height: var(--table-max, 70vh); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); padding: 10px 14px; white-space: nowrap;
  background: var(--surface); border-bottom: 1px solid var(--border-strong);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.table th.center, .table td.center { text-align: center; }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table tbody tr.selected td { background: var(--primary-soft); }
.table tbody tr.is-cancelled td { color: var(--muted); }
.table tbody tr.is-cancelled .t-main { text-decoration: line-through; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: 0; }
.table .t-main { font-weight: 600; }
.table .t-sub { font-size: 12px; color: var(--muted); }
.table.compact th { padding: 7px 10px; }
.table.compact td { padding: 7px 10px; }
.table.striped tbody tr:nth-child(even) td { background: var(--surface-2); }

/* ---- tabs and chips ---------------------------------------------------------------------------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > .tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 0; background: none;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 600; white-space: nowrap;
  text-decoration: none !important; cursor: pointer;
}
.tabs > .tab svg { width: 17px; height: 17px; }
.tabs > .tab:hover { color: var(--text); }
.tabs > .tab.on, .tabs > .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.tabs > .tab .badge { height: 18px; min-width: 18px; font-size: 11px; }

.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-weight: 600; font-size: 13px; white-space: nowrap; cursor: pointer; text-decoration: none !important;
  transition: background-color .12s, border-color .12s, color .12s;
}
.chip svg { width: 16px; height: 16px; }
.chip:hover { border-color: var(--faint); color: var(--text); }
.chip.on, .chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .n { opacity: .65; font-variant-numeric: tabular-nums; }
.chip.brand.on, .chip.brand[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---- overlays: modal, drawer / bottom sheet ------------------------------------------------------ */

.overlay {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center;
  padding: max(6vh, 16px) 16px 16px; background: var(--overlay); animation: fade-in .14s ease-out;
  overscroll-behavior: contain;
}
.modal {
  position: relative; display: flex; flex-direction: column; width: min(520px, 100%); max-height: calc(100vh - max(12vh, 32px));
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: pop-in .16s var(--ease);
}
.modal.sm { width: min(420px, 100%); }
.modal.lg { width: min(760px, 100%); }
.modal.xl { width: min(1040px, 100%); }
.modal.full { width: 100%; height: 100%; max-height: none; }
.modal-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 18px 20px 6px; }
.modal-head h2 { font-size: 17px; font-weight: 700; padding-top: 6px; }
.modal-head .modal-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.modal-head .x { margin-left: auto; margin-right: -8px; margin-top: -2px; }
.modal-body { padding: 10px 20px 18px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal-foot .foot-left { margin-right: auto; }
.overlay.drawer-overlay { padding: 0; justify-content: flex-end; align-items: stretch; }
.drawer {
  display: flex; flex-direction: column; width: min(var(--drawer-w, 480px), 100%); height: 100%;
  background: var(--surface); color: var(--text); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: slide-in-right .2s var(--ease);
}
.drawer.wide { --drawer-w: 720px; }
.drawer .modal-foot { border-radius: 0; }
.sheet-grip { display: none; }

/* ---- popup menu ------------------------------------------------------------------------------ */

.menu {
  position: fixed; z-index: 95; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: calc(100vh - 16px);
  overflow-y: auto; padding: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--r); box-shadow: var(--shadow-lg); animation: pop-in .1s var(--ease);
}
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 10px; border: 0;
  border-radius: 8px; background: none; color: var(--text); font-weight: 500; font-size: 14px; text-align: left;
  text-decoration: none !important; cursor: pointer;
}
.menu button svg, .menu a svg { width: 17px; height: 17px; color: var(--muted); }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--surface-3); outline: none; }
.menu button:disabled { opacity: 1; color: var(--muted); cursor: default; background: none; }
.menu .m-hint { margin-left: auto; font-size: 12px; color: var(--muted); }
.menu .m-check { margin-left: auto; color: var(--success-ink); }
.menu .danger, .menu .danger svg { color: var(--danger-ink); }
.menu .sep { height: 1px; margin: 6px 4px; background: var(--border); }
.menu .m-head { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

/* ---- toasts ------------------------------------------------------------------------------------ */

#toasts {
  position: fixed; z-index: 120; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column;
  align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 460px; min-height: 46px; padding: 8px 8px 8px 14px;
  border-radius: 12px; background: #172033; color: #EEF2F7; box-shadow: var(--shadow-lg); font-weight: 500;
  pointer-events: auto; animation: pop-in .16s var(--ease);
}
.toast .t-icon { display: grid; }
.toast .t-icon svg { width: 18px; height: 18px; }
.toast .t-msg { flex: 1; min-width: 0; padding: 4px 0; }
.toast .t-btn { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .12);
  color: inherit; font-weight: 650; font-size: 13px; }
.toast .t-btn:hover { background: rgba(255, 255, 255, .2); }
.toast .t-x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: inherit; opacity: .7; display: grid; place-items: center; }
.toast .t-x:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.toast .t-x svg { width: 16px; height: 16px; }
.toast.ok .t-icon { color: #6EE79A; }
.toast.info .t-icon { color: #93C5FD; }
.toast.warn { background: #3A2A06; } .toast.warn .t-icon { color: #FFC761; }
.toast.err { background: #4A1512; } .toast.err .t-icon { color: #FF9A8F; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }

/* ---- alerts / banners ------------------------------------------------------------------------- */

.alert {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid transparent; background: var(--surface-3); color: var(--text-2); font-size: 13.5px;
}
.alert > .a-icon { display: grid; padding-top: 1px; }
.alert > .a-icon svg { width: 18px; height: 18px; }
.alert .a-body { flex: 1; min-width: 0; }
.alert .a-title { font-weight: 700; color: inherit; }
.alert .a-actions { display: flex; gap: var(--sp-2); align-items: center; align-self: center; flex-wrap: wrap; }
.alert.info { background: var(--info-soft); color: var(--info-ink); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.alert.danger { background: var(--danger-soft); color: var(--danger-ink); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.success { background: var(--success-soft); color: var(--success-ink); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert.solid.danger { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---- empty state, skeleton, spinner -------------------------------------------------------------- */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 20px; color: var(--muted); }
.empty .e-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--surface-3); color: var(--text-2); }
.empty .e-icon svg { width: 26px; height: 26px; }
.empty h3 { font-size: 16px; color: var(--text); }
.empty p { max-width: 440px; }
.empty .e-action { margin-top: 12px; display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.empty.compact { padding: 24px 16px; }
.empty.compact .e-icon { width: 44px; height: 44px; border-radius: 12px; }

.skeleton {
  display: block; height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--sunken) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
.skeleton + .skeleton { margin-top: 10px; }
.skeleton.title { height: 24px; width: 40%; }
.skeleton.block { height: 96px; border-radius: var(--r); }
.skeleton.round { border-radius: 50%; }
.skel-list { display: flex; flex-direction: column; gap: 10px; }
.skel-list .skeleton { margin: 0; }

.spinner {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
  animation: spin .7s linear infinite; vertical-align: middle;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.spinner.lg { width: 36px; height: 36px; border-width: 3.5px; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 16px; color: var(--muted); }

/* ---- Indian diet marks (veg, egg, non-veg) -------------------------------------------------------- */

.diet {
  --d: 14px; --diet: var(--veg);
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0; width: var(--d); height: var(--d);
  border: max(1.5px, calc(var(--d) * .11)) solid var(--diet); border-radius: calc(var(--d) * .18); background: var(--diet-paper);
  vertical-align: -2px;
}
.diet::after { content: ""; width: calc(var(--d) * .46); height: calc(var(--d) * .46); border-radius: 50%; background: var(--diet); }
.diet.veg { --diet: var(--veg); }
.diet.egg { --diet: var(--egg); }
.diet.nonveg { --diet: var(--nonveg); }
.diet.nonveg::after {
  width: 0; height: 0; border-radius: 0; background: none; margin-top: calc(var(--d) * -.06);
  border-left: calc(var(--d) * .27) solid transparent; border-right: calc(var(--d) * .27) solid transparent;
  border-bottom: calc(var(--d) * .44) solid var(--diet);
}
.diet.sm { --d: 12px; }
.diet.lg { --d: 18px; }
.diet.xl { --d: 24px; }

/* ---- quantity stepper ---------------------------------------------------------------------------- */

.qty {
  --qh: 36px;
  display: inline-flex; align-items: stretch; height: var(--qh); width: calc(var(--qh) * 3); border-radius: 10px;
  border: 1.5px solid var(--primary); background: var(--surface); overflow: hidden; flex-shrink: 0;
  font-variant-numeric: tabular-nums; user-select: none;
}
.qty .qty-btn {
  flex: 0 0 var(--qh); display: grid; place-items: center; border: 0; background: none; color: var(--primary-ink); padding: 0;
}
.qty .qty-btn svg { width: 17px; height: 17px; stroke-width: 2.8; }
.qty .qty-btn:hover { background: var(--primary-soft); }
.qty .qty-btn:disabled { color: var(--faint); background: none; }
.qty .qty-val { flex: 1; display: grid; place-items: center; font-weight: 750; color: var(--text); min-width: 0; }
.qty.is-empty { border-color: var(--primary); background: var(--surface); }
.qty .qty-add {
  flex: 1; border: 0; background: none; color: var(--primary-ink); font-weight: 750; font-size: 13.5px;
  letter-spacing: .04em; text-transform: uppercase; display: grid; place-items: center;
}
.qty .qty-add:hover { background: var(--primary-soft); }
.qty .qty-add:disabled { color: var(--faint); cursor: not-allowed; background: var(--surface-3); }
.qty.is-empty:has(.qty-add:disabled) { border-color: var(--border-strong); }
.qty.filled { background: var(--primary); border-color: var(--primary); }
.qty.filled .qty-btn, .qty.filled .qty-val { color: var(--on-primary); }
.qty.filled .qty-btn:hover { background: rgba(0, 0, 0, .12); }
.qty.sm { --qh: 30px; border-radius: 8px; }
.qty.lg { --qh: 48px; border-radius: 12px; }
.qty.lg .qty-val { font-size: 18px; }
.qty.lg .qty-btn svg { width: 20px; height: 20px; }

/* ---- avatar, live dot, status dot ------------------------------------------------------------------ */

.avatar {
  --av: 36px;
  display: inline-grid; place-items: center; flex-shrink: 0; width: var(--av); height: var(--av); border-radius: 50%;
  font-size: calc(var(--av) * .38); font-weight: 700; letter-spacing: .02em; color: var(--av-ink, var(--primary-ink));
  background: var(--av-bg, var(--primary-soft)); user-select: none; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { --av: 28px; }
.avatar.lg { --av: 48px; }
.avatar.xl { --av: 64px; }
.avatar[data-tone="1"] { --av-bg: var(--st-accepted-bg); --av-ink: var(--st-accepted-ink); }
.avatar[data-tone="2"] { --av-bg: var(--st-ready-bg); --av-ink: var(--st-ready-ink); }
.avatar[data-tone="3"] { --av-bg: var(--st-out-bg); --av-ink: var(--st-out-ink); }
.avatar[data-tone="4"] { --av-bg: var(--st-placed-bg); --av-ink: var(--st-placed-ink); }
.avatar[data-tone="5"] { --av-bg: var(--st-delivered-bg); --av-ink: var(--st-delivered-ink); }

/* <span class="live" data-state="live|connecting|offline"><span class="live-dot"></span><span class="live-label">Live</span></span> */
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; }
.live-dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.live[data-state="live"] .live-dot { background: #22A355; }
.live[data-state="live"] .live-dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #22A355; opacity: 0;
  animation: live-ring 2.4s ease-out infinite;
}
.live[data-state="connecting"] .live-dot { background: #E39B00; animation: pulse-dot 1s ease-in-out infinite; }
.live[data-state="offline"] .live-dot { background: #D7372B; }
.live[data-state="offline"] { color: var(--danger-ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ---- lists, key-value, timeline, meter ------------------------------------------------------------- */

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: 10px 20px; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-row.click { cursor: pointer; }
.list-row.click:hover { background: var(--surface-2); }
.list-row .l-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.list-row .l-icon svg { width: 17px; height: 17px; }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: 13.5px; }
.kv > .k { color: var(--muted); }
.kv > .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; }
.kv > .total { font-size: 16px; font-weight: 750; padding-top: 8px; border-top: 1px dashed var(--border-strong); }
.kv > .k.total { color: var(--text); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; display: flex; gap: 12px; padding: 0 0 18px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--border); }
.timeline > li:last-child::before { display: none; }
.timeline .tl-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  flex-shrink: 0; background: var(--surface-3); color: var(--faint); border: 2px solid var(--border-strong); }
.timeline .tl-dot svg { width: 13px; height: 13px; stroke-width: 3; }
.timeline > li.done .tl-dot { background: var(--success); border-color: var(--success); color: #fff; }
.timeline > li.done::before { background: var(--success); }
.timeline > li.now .tl-dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline > li.bad .tl-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.timeline .tl-title { font-weight: 650; line-height: 24px; }
.timeline .tl-time { font-size: 12.5px; color: var(--muted); }
.timeline > li:not(.done):not(.now):not(.bad) .tl-title { color: var(--muted); font-weight: 550; }

.meter { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.meter.success > i { background: var(--success); }
.meter.warn > i { background: var(--warn); }

.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; }
.divider.dashed { background: none; border-top: 1px dashed var(--border-strong); height: 0; }

/* age colours for kitchen tickets and order cards */
.age-ok { --age: var(--age-ok); }
.age-warn { --age: var(--age-warn); }
.age-late { --age: var(--age-late); }
.age-text { color: var(--age, var(--muted)); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Map containers (Leaflet) and the markers drawn by js/lib/map.js */
.map { position: relative; width: 100%; height: var(--map-h, 320px); border-radius: var(--r); overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border); z-index: 0; }
.map .leaflet-control-attribution { font-size: 10px; }
.map-pin { background: none !important; border: 0 !important; }
.map-pin svg { overflow: visible; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.pin-picker { display: flex; flex-direction: column; gap: var(--sp-2); }
.pin-picker .pp-bar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.pin-picker .pp-msg { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.pin-picker .pp-msg.warn { color: var(--warn-ink); }
.pin-picker .pp-msg.bad { color: var(--danger-ink); }

/* first paint placeholder (index.html files) */
.boot-splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.boot-splash img { width: 56px; height: 56px; border-radius: 14px; animation: breathe 1.6s ease-in-out infinite; }
.boot-error { max-width: 440px; margin: 12vh auto; padding: 0 16px; text-align: center; }

/* ---- motion ------------------------------------------------------------------------------------ */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes slide-in-right { from { transform: translateX(32px); opacity: 0; } }
@keyframes slide-in-up { from { transform: translateY(40px); opacity: .4; } }
@keyframes pulse-dot { 50% { opacity: .35; } }
@keyframes live-ring { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes breathe { 50% { transform: scale(.94); opacity: .8; } }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---- touch and small screens ------------------------------------------------------------------- */

@media (pointer: coarse) {
  .btn.sm { --h: 40px; }
  .chip { min-height: 40px; }
  .qty { --qh: 40px; }
  .qty.sm { --qh: 36px; }
  .segmented > button, .segmented > label > span { min-height: 38px; }
  .input.sm, .select.sm { height: 40px; }
}

@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .show-sm { display: revert !important; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .page-head .page-actions { margin-left: 0; width: 100%; }
  .input, .select, .textarea { font-size: 16px; }   /* stops iOS zooming into a focused field */
  .overlay { padding: 0; align-items: flex-end; }
  .overlay .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: slide-in-up .2s var(--ease); }
  .overlay .modal .modal-foot { border-radius: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* The drawer becomes a bottom sheet. */
  .overlay.drawer-overlay { align-items: flex-end; }
  .drawer {
    width: 100%; height: auto; max-height: 92vh; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0; animation: slide-in-up .22s var(--ease);
  }
  .drawer .modal-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 8px auto -4px; }
  #toasts { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  .toast { width: 100%; max-width: none; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 14px 16px 16px; }
  .list-row { padding: 10px 16px; }
}
