/* ==========================================================================
   Digital Menu design system
   Tokens -> base -> layout -> components -> pages -> utilities
   Spacing follows a 4px grid (--s-1 = 4px). Brand colour is injected at
   runtime via <html style="--brand:#hex"> from the owner's settings.
   ========================================================================== */
:root {
  /* Brand */
  --brand: #0F766E;
  --brand-600: color-mix(in srgb, var(--brand) 85%, #000);
  --brand-700: color-mix(in srgb, var(--brand) 70%, #000);
  --brand-50: color-mix(in srgb, var(--brand) 8%, #fff);
  --brand-100: color-mix(in srgb, var(--brand) 16%, #fff);
  --brand-ring: color-mix(in srgb, var(--brand) 35%, transparent);
  --accent: #16A34A;      /* fresh leaf green */
  --accent-50: #ECFDF3;
  --berry: #DB2777;

  /* Neutrals */
  --bg: #FFFBF5;
  --surface: #FFFFFF;
  --surface-2: #FFF7ED;
  --border: #F1E6D8;
  --border-strong: #E5D3BE;
  --text: #1F1A17;
  --text-2: #5B504A;
  --text-3: #8C7F77;

  /* Semantic */
  --success: #16A34A; --success-bg: #DCFCE7;
  --warning: #D97706; --warning-bg: #FEF3C7;
  --danger:  #DC2626; --danger-bg:  #FEE2E2;
  --info:    #2563EB; --info-bg:    #DBEAFE;

  /* Status colours */
  --st-new: #2563EB; --st-new-bg: #DBEAFE;
  --st-preparing: #D97706; --st-preparing-bg: #FEF3C7;
  --st-ready: #16A34A; --st-ready-bg: #DCFCE7;
  --st-served: #6B7280; --st-served-bg: #F3F4F6;
  --st-cancelled: #DC2626; --st-cancelled-bg: #FEE2E2;

  /* Spacing (4px grid) */
  --s-0: 0; --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-full: 999px;

  /* Type */
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 32px; --fs-4xl: 40px;
  --lh: 1.5;

  /* Elevation */
  --sh-1: 0 1px 2px rgba(31, 26, 23, .06), 0 1px 3px rgba(31, 26, 23, .04);
  --sh-2: 0 4px 12px rgba(31, 26, 23, .08);
  --sh-3: 0 12px 32px rgba(31, 26, 23, .16);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 120ms; --t-med: 200ms;
  --header-h: 60px;
  --maxw: 1200px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: var(--lh);
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--s-3); }
small, .small { font-size: var(--fs-sm); }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-4) 0; }
:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s-4); }
.container-sm { max-width: 640px; }
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.page { padding: var(--s-6) 0 var(--s-16); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--s-1) 0 0; color: var(--text-3); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong); --btn-bg-h: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-md);
  border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font: 600 var(--fs-sm)/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), border-color var(--t-fast);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: var(--btn-bg-h); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; pointer-events: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand); --btn-bg-h: var(--brand-600); box-shadow: 0 2px 8px var(--brand-ring); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: #fff; --btn-bd: var(--accent); --btn-bg-h: #15803D; }
.btn-danger { --btn-bg: #fff; --btn-fg: var(--danger); --btn-bd: #FECACA; --btn-bg-h: var(--danger-bg); }
.btn-danger-solid { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); --btn-bg-h: #B91C1C; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-bg-h: var(--brand-50); --btn-fg: var(--text-2); }
.btn-soft { --btn-bg: var(--brand-50); --btn-bd: var(--brand-100); --btn-fg: var(--brand-700); --btn-bg-h: var(--brand-100); }
.btn-sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg { min-height: 52px; padding: 0 var(--s-6); font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-xl { min-height: 64px; padding: 0 var(--s-8); font-size: var(--fs-xl); border-radius: var(--r-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
.btn-secondary.is-loading::after, .btn:not(.btn-primary):not(.btn-accent).is-loading::after { border-color: var(--text-2) var(--text-2) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s-1); margin-bottom: var(--s-4); }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface);
  font: 400 var(--fs-md)/1.4 var(--font); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { min-height: 80px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: #F7F3EE; color: var(--text-3); cursor: not-allowed; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-color { padding: var(--s-1); height: 44px; width: 72px; }
.check { display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-2); }
.inline-form { display: inline; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: var(--s-5); }
.card-head { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: var(--s-5); }
.card-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }
.card-link { transition: box-shadow var(--t-med) var(--ease), transform var(--t-med) var(--ease); }
.card-link:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: var(--s-1); height: 24px; padding: 0 var(--s-2); border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge-new { background: var(--st-new-bg); color: var(--st-new); }
.badge-preparing { background: var(--st-preparing-bg); color: var(--st-preparing); }
.badge-ready { background: var(--st-ready-bg); color: var(--st-ready); }
.badge-served { background: var(--st-served-bg); color: var(--st-served); }
.badge-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-brand { background: var(--brand-100); color: var(--brand-700); }
.chip { display: inline-flex; align-items: center; gap: var(--s-1); height: 40px; padding: 0 var(--s-4); border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; cursor: pointer; transition: all var(--t-fast); }
.chip:hover { border-color: var(--brand); color: var(--brand-700); text-decoration: none; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Alerts / flashes / toasts ---------- */
.alert { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-sm); margin-bottom: var(--s-3); display: flex; gap: var(--s-2); align-items: flex-start; }
.alert-success { background: var(--success-bg); border-color: #BBF7D0; color: #14532D; }
.alert-error { background: var(--danger-bg); border-color: #FECACA; color: #7F1D1D; }
.alert-info { background: var(--info-bg); border-color: #BFDBFE; color: #1E3A8A; }
.alert-warning { background: var(--warning-bg); border-color: #FDE68A; color: #78350F; }
.toast-wrap { position: fixed; left: 50%; top: calc(var(--s-4) + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: var(--s-2); width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--text); color: #fff; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); box-shadow: var(--sh-3); font-size: var(--fs-sm); animation: toast-in .25s var(--ease); pointer-events: none; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FFFDF9; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb { width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); }

/* ---------- Staff top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: var(--s-4); height: var(--header-h); }
.brand { display: flex; align-items: center; gap: var(--s-2); font-weight: 800; color: var(--text); font-size: var(--fs-lg); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: var(--r-sm); object-fit: contain; }
.nav { display: flex; gap: var(--s-1); overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; height: 36px; padding: 0 var(--s-3); border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.nav a:hover { background: var(--brand-50); color: var(--brand-700); text-decoration: none; }
.nav a.is-active { background: var(--brand-100); color: var(--brand-700); }
.userbox { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .topbar-inner { flex-wrap: wrap; height: auto; min-height: var(--header-h); padding: var(--s-2) 0; }
  .nav, .userbox { display: none; width: 100%; }
  .topbar.is-open .nav { display: flex; flex-direction: column; padding-bottom: var(--s-2); }
  .topbar.is-open .userbox { display: flex; padding-bottom: var(--s-3); }
  .nav a { height: 44px; }
}

/* ---------- Stats ---------- */
.stat { padding: var(--s-5); }
.stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }
.stat-value { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.02em; margin-top: var(--s-1); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-sm); color: var(--text-3); }
.bars { display: flex; align-items: flex-end; gap: var(--s-2); height: 160px; padding-top: var(--s-4); }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--s-1); height: 100%; justify-content: flex-end; font-size: var(--fs-xs); color: var(--text-3); }
.bar-fill { width: 100%; max-width: 48px; border-radius: var(--r-sm) var(--r-sm) 4px 4px; background: linear-gradient(180deg, var(--brand), var(--brand-600)); min-height: 4px; }
.meter { height: 8px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--s-12) var(--s-4); color: var(--text-3); }
.empty-icon { font-size: 48px; margin-bottom: var(--s-2); }

/* ==========================================================================
   Customer ordering (mobile-first)
   ========================================================================== */
.c-header { position: relative; background: radial-gradient(120% 140% at 0% 0%, var(--brand) 0%, var(--brand-600) 55%, var(--berry) 140%); color: #fff; padding: var(--s-6) 0 var(--s-10); overflow: hidden; }
.c-header::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.c-header .container { position: relative; z-index: 1; }
.c-brand { display: flex; align-items: center; gap: var(--s-3); }
.c-logo { width: 56px; height: 56px; border-radius: var(--r-lg); background: #fff; padding: var(--s-1); object-fit: contain; box-shadow: var(--sh-2); }
.c-title { font-size: var(--fs-2xl); font-weight: 800; margin: 0; letter-spacing: -.02em; }
.c-tagline { margin: 0; opacity: .9; font-size: var(--fs-sm); }
.c-table-pill { display: inline-flex; align-items: center; gap: var(--s-2); margin-top: var(--s-4); background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .35); padding: var(--s-1) var(--s-3); border-radius: var(--r-full); font-weight: 700; font-size: var(--fs-sm); }
.c-main { margin-top: calc(var(--s-6) * -1); position: relative; padding-bottom: 120px; } /* no z-index: sheets inside must stack above the cart bar */
.cat-bar { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: var(--s-3) 0; margin: 0 calc(var(--s-4) * -1); padding-left: var(--s-4); padding-right: var(--s-4); display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0; }
.cat-bar::-webkit-scrollbar { display: none; }
.cat-section { scroll-margin-top: 72px; padding-top: var(--s-4); }
.cat-title { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xl); font-weight: 800; margin: 0 0 var(--s-3); }
.products { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .products { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .products { grid-template-columns: repeat(3, 1fr); } }
.product { display: flex; gap: var(--s-3); padding: var(--s-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); transition: box-shadow var(--t-med), transform var(--t-med); position: relative; }
.product:hover { box-shadow: var(--sh-2); }
.product-media { width: 96px; height: 96px; flex: none; border-radius: var(--r-md); overflow: hidden; background: linear-gradient(135deg, var(--brand-100), #FDE68A 60%, #BBF7D0); display: grid; place-items: center; font-size: 40px; }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.product-name { font-weight: 700; font-size: var(--fs-md); margin: 0; }
.product-desc { font-size: var(--fs-sm); color: var(--text-3); margin: var(--s-1) 0 var(--s-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.price { font-weight: 800; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.product.is-soldout { opacity: .6; }
.product.is-soldout .product-media { filter: grayscale(1); }
.product .in-cart { position: absolute; top: var(--s-2); left: var(--s-2); min-width: 24px; height: 24px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: var(--fs-xs); font-weight: 800; display: none; align-items: center; justify-content: center; box-shadow: var(--sh-1); }
.product.has-qty .in-cart { display: inline-flex; }

/* Cart bar */
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom)); background: linear-gradient(0deg, var(--bg) 70%, transparent); transform: translateY(120%); transition: transform var(--t-med) var(--ease); }
.cart-bar.is-visible { transform: none; }
.cart-bar .btn { max-width: 640px; margin: 0 auto; justify-content: space-between; box-shadow: var(--sh-3); }
.cart-count { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: var(--r-full); background: rgba(255, 255, 255, .25); font-size: var(--fs-sm); }

/* Bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 14, 10, .45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity var(--t-med); }
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; display: flex; flex-direction: column; transform: translateY(105%); transition: transform var(--t-med) var(--ease); box-shadow: var(--sh-3); max-width: 640px; margin: 0 auto; }
.sheet.is-open { transform: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: var(--s-2) auto 0; }
.sheet-head { padding: var(--s-3) var(--s-5); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); border-bottom: 1px solid var(--border); }
.sheet-head h2 { margin: 0; font-size: var(--fs-lg); }
.sheet-body { padding: var(--s-4) var(--s-5); overflow-y: auto; flex: 1; }
.sheet-foot { padding: var(--s-3) var(--s-5) calc(var(--s-4) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
@media (min-width: 700px) { .sheet { bottom: auto; top: 50%; border-radius: var(--r-xl); transform: translateY(-40%) scale(.98); opacity: 0; pointer-events: none; max-height: 86vh; transition: all var(--t-med) var(--ease); } .sheet.is-open { transform: translateY(-50%); opacity: 1; pointer-events: auto; } .sheet-handle { display: none; } }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-full); overflow: hidden; background: var(--surface); }
.qty button { width: 40px; height: 40px; border: 0; background: transparent; font-size: var(--fs-xl); font-weight: 700; color: var(--brand-700); cursor: pointer; }
.qty button:hover { background: var(--brand-50); }
.qty button:disabled { color: var(--text-3); cursor: not-allowed; background: transparent; }
.qty output { min-width: 32px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.qty-lg button { width: 52px; height: 52px; }
.qty-lg output { min-width: 48px; font-size: var(--fs-xl); }
.cart-line { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: 0; }
.cart-line-main { flex: 1; min-width: 0; }
.cart-line-name { font-weight: 700; }
.cart-line-note { font-size: var(--fs-xs); color: var(--text-3); }
.totals { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-lg); font-weight: 800; padding: var(--s-3) 0; }
.pay-note { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-3); border-radius: var(--r-md); background: var(--accent-50); color: #166534; font-size: var(--fs-sm); font-weight: 600; }

/* Order status */
.status-hero { text-align: center; padding: var(--s-8) var(--s-5) var(--s-6); }
.status-emoji { font-size: 64px; line-height: 1; margin-bottom: var(--s-3); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); margin: var(--s-6) 0 var(--s-2); position: relative; }
.step { text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); position: relative; }
.step-dot { width: 36px; height: 36px; margin: 0 auto var(--s-2); border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 16px; position: relative; z-index: 1; transition: all var(--t-med); }
.step::before { content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 3px; background: var(--border); }
.step:first-child::before { display: none; }
.step.is-done .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.is-done::before { background: var(--accent); }
.step.is-current .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 6px var(--brand-ring); animation: pulse 1.6s infinite; }
.step.is-current::before { background: var(--accent); }
.step.is-current { color: var(--text); }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px transparent; } }

/* Landing / auth */
.hero-center { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); background: radial-gradient(80% 60% at 50% 0%, var(--brand-100), var(--bg)); }
.auth-card { width: min(100%, 400px); }
.auth-logo { width: 72px; height: 72px; margin: 0 auto var(--s-3); border-radius: var(--r-lg); object-fit: contain; }

/* ==========================================================================
   Waiter
   ========================================================================== */
.tabs { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s-4); }
.ready-banner { position: sticky; top: var(--header-h); z-index: 35; display: none; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); border-radius: var(--r-md); background: var(--success); color: #fff; font-weight: 700; box-shadow: var(--sh-2); animation: flash 1s 3; }
.ready-banner.is-visible { display: flex; }
@keyframes flash { 50% { filter: brightness(1.25); } }
.order-card { padding: var(--s-4); border-left: 6px solid var(--border-strong); }
.order-card.st-new { border-left-color: var(--st-new); }
.order-card.st-preparing { border-left-color: var(--st-preparing); }
.order-card.st-ready { border-left-color: var(--st-ready); background: #F7FFF9; }
.order-card.st-served { border-left-color: var(--st-served); }
.order-card.is-mine { box-shadow: 0 0 0 2px var(--brand-100), var(--sh-1); }
.order-items { list-style: none; margin: var(--s-2) 0; padding: 0; font-size: var(--fs-sm); }
.order-items li { padding: 2px 0; }
.order-items .q { font-weight: 800; margin-right: var(--s-1); }
.item-note { display: block; font-size: var(--fs-xs); color: var(--warning); font-weight: 600; }
.table-no { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; }
.order-layout { display: grid; gap: var(--s-5); }
.order-layout > * { min-width: 0; }
.staff .cat-bar { top: var(--header-h); margin: 0; padding-left: 0; padding-right: 0; border-radius: 0; }
@media (min-width: 1000px) { .order-layout { grid-template-columns: 1fr 380px; align-items: start; } .order-layout .side { position: sticky; top: calc(var(--header-h) + var(--s-4)); } }

/* ==========================================================================
   Kitchen display (dark, large type)
   ========================================================================== */
body.kds { background: #0F0D0C; color: #F5EFE9; font-size: 18px; }
.kds-top { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) var(--s-5); background: #1A1614; border-bottom: 1px solid #2B2522; position: sticky; top: 0; z-index: 10; }
.kds-top .brand { color: #fff; }
.kds-clock { font-size: var(--fs-2xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.kds-conn { width: 12px; height: 12px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22, 163, 74, .25); }
.kds-conn.is-off { background: var(--danger); box-shadow: 0 0 0 4px rgba(220, 38, 38, .3); }
.kds-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); padding: var(--s-4); min-height: calc(100vh - 72px); }
@media (max-width: 1100px) { .kds-board { grid-template-columns: 1fr; } }
.kds-col { background: #171311; border: 1px solid #2B2522; border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 0; }
.kds-col-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-4); font-size: var(--fs-xl); font-weight: 800; border-bottom: 1px solid #2B2522; text-transform: uppercase; letter-spacing: .04em; }
.kds-col-head .count { min-width: 40px; height: 40px; border-radius: var(--r-full); display: grid; place-items: center; font-size: var(--fs-lg); background: #2B2522; }
.kds-col[data-col="new"] .kds-col-head { color: #93C5FD; }
.kds-col[data-col="preparing"] .kds-col-head { color: #FCD34D; }
.kds-col[data-col="ready"] .kds-col-head { color: #86EFAC; }
.kds-list { padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-3); overflow-y: auto; }
.ticket { background: #FFFBF5; color: #1F1A17; border-radius: var(--r-md); overflow: hidden; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.ticket.is-new { animation: toast-in .3s var(--ease), ticket-flash 1.2s 2; }
@keyframes ticket-flash { 50% { box-shadow: 0 0 0 6px rgba(147, 197, 253, .7); } }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-4); background: #2563EB; color: #fff; }
.ticket.st-preparing .ticket-head { background: #D97706; }
.ticket.st-ready .ticket-head { background: #16A34A; }
.ticket.is-late .ticket-head { background: #DC2626; }
.ticket-table { font-size: var(--fs-3xl); font-weight: 900; line-height: 1; }
.ticket-meta { text-align: right; font-size: var(--fs-sm); opacity: .95; }
.ticket-elapsed { font-size: var(--fs-xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket-body { padding: var(--s-3) var(--s-4); }
.ticket-items { list-style: none; margin: 0; padding: 0; }
.ticket-items li { font-size: var(--fs-xl); font-weight: 700; padding: var(--s-1) 0; border-bottom: 1px dashed #E5D3BE; }
.ticket-items li:last-child { border-bottom: 0; }
.ticket-items .q { display: inline-block; min-width: 44px; color: var(--brand-700); font-weight: 900; }
.ticket-note { display: block; margin: 2px 0 0 44px; font-size: var(--fs-md); font-weight: 700; color: #B45309; background: #FEF3C7; padding: 2px var(--s-2); border-radius: 6px; }
.ticket-order-note { margin-top: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: #FEE2E2; color: #7F1D1D; font-weight: 700; }
.ticket-foot { padding: 0 var(--s-4) var(--s-4); display: flex; gap: var(--s-2); }
.ticket-foot .btn { flex: 1; min-height: 60px; font-size: var(--fs-lg); }
.kds-empty { color: #6B5F57; text-align: center; padding: var(--s-10) var(--s-4); font-size: var(--fs-lg); }
.kds-overlay { position: fixed; inset: 0; background: rgba(15, 13, 12, .92); z-index: 100; display: grid; place-items: center; text-align: center; }
.kds-overlay[hidden] { display: none; }

/* ==========================================================================
   Print: bills + QR cards
   ========================================================================== */
body.print-page { background: #EFE7DE; }
.print-toolbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--s-3) 0; }
.receipt { width: 100%; max-width: 380px; margin: var(--s-6) auto; background: #fff; padding: var(--s-6); border-radius: var(--r-md); box-shadow: var(--sh-2); font-size: var(--fs-sm); }
.receipt-head { text-align: center; border-bottom: 2px dashed #ccc; padding-bottom: var(--s-3); margin-bottom: var(--s-3); }
.receipt-head img { width: 64px; height: 64px; object-fit: contain; margin: 0 auto var(--s-2); }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: var(--s-1) 0; vertical-align: top; }
.receipt .total-row td { border-top: 2px dashed #ccc; padding-top: var(--s-2); font-size: var(--fs-lg); font-weight: 800; }
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s-6); padding: var(--s-6) 0; }
.qr-card-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.qr-card { width: 320px; border-radius: 28px; background: var(--brand); padding: var(--s-5); color: #fff; text-align: center; box-shadow: var(--sh-3); position: relative; overflow: hidden; break-inside: avoid; page-break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.qr-card::before { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .12); top: -110px; right: -90px; }
.qr-card::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(0, 0, 0, .08); bottom: -90px; left: -70px; }
.qr-card > * { position: relative; z-index: 1; }
.qr-shop { font-size: 22px; font-weight: 900; letter-spacing: -.01em; margin: 0; }
.qr-tagline { font-size: 12px; opacity: .9; margin: 2px 0 var(--s-4); }
.qr-box { background: #fff; border-radius: 20px; padding: 14px; width: 252px; height: 252px; margin: 0 auto; display: grid; place-items: center; }
.qr-box canvas, .qr-box svg, .qr-box img { width: 224px !important; height: 224px !important; }
.qr-cta { margin: var(--s-4) 0 0; font-size: 18px; font-weight: 800; letter-spacing: .02em; }
.qr-table { display: inline-block; margin-top: var(--s-2); background: #fff; color: var(--brand-700); font-weight: 900; font-size: 26px; padding: 4px 22px; border-radius: 999px; }
.qr-foot { font-size: 11px; opacity: .85; margin-top: var(--s-3); }

@media print {
  @page { margin: 10mm; }
  body, body.print-page { background: #fff !important; }
  .no-print, .print-toolbar, .topbar, .toast-wrap { display: none !important; }
  .receipt { box-shadow: none; margin: 0 auto; padding: 0; max-width: 80mm; }
  .qr-sheet { grid-template-columns: repeat(2, 1fr); gap: 10mm; padding: 0; }
  .qr-card { box-shadow: none; }
  .qr-card-wrap .btn { display: none; }
}

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.p-0 { padding: 0 !important; }
.gap-2 { gap: var(--s-2); } .gap-4 { gap: var(--s-4); }
.text-center { text-align: center; } .text-right { text-align: right; }
.fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.hidden, [hidden] { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-xs); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Late overrides ---------- */
.container.page { padding-left: var(--s-4); padding-right: var(--s-4); }
@media (min-width: 861px) and (max-width: 1280px) {
  .topbar-inner { gap: var(--s-2); }
  .nav a { padding: 0 var(--s-2); font-size: 13px; }
  .userbox .role-label { display: none; }
}
