/* UnDine POS — design system. No build step: plain CSS custom properties. */

/* Tokens mapped from the UnDine Design System (Claude Design export): red
   #ff3b30 brand, navy sidebar, Poppins app UI / JetBrains Mono numerics, with
   Plus Jakarta Sans for marketing & menu (set on those surfaces). oklch values
   are lifted verbatim from the system. Change a value here, the app follows. */
:root {
  --font: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Poppins', var(--font);
  --font-marketing: 'Plus Jakarta Sans', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: oklch(97.5% .004 250);        /* background */
  --surface: oklch(100% 0 0);         /* card */
  --surface-2: oklch(95.5% .006 250); /* secondary */
  --surface-3: oklch(93.5% .008 250);
  --border: oklch(90% .01 250);       /* border */
  --border-strong: oklch(87% .012 250); /* input */
  --text: oklch(20.5% .025 255);      /* foreground */
  --text-2: oklch(44% .022 255);
  --muted: oklch(52% .025 255);       /* muted-foreground */

  --primary: oklch(52% .205 21);         /* POS red */
  --primary-hover: oklch(46% .19 21);
  --primary-soft: oklch(93% .025 20);    /* accent */
  --primary-text: oklch(46% .19 21);     /* accent-foreground */
  --on-primary: oklch(99% .002 20);      /* primary-foreground */

  --success: oklch(49% .145 150);
  --success-soft: oklch(95% .04 150);
  --warning: oklch(57% .14 69);
  --warning-soft: oklch(96% .05 80);
  --danger: oklch(57.7% .245 27.325);    /* destructive */
  --danger-soft: oklch(95% .04 25);
  --info: oklch(54% .15 240);
  --info-soft: oklch(95% .035 240);
  --violet: #6d4ae0;
  --violet-soft: #ece7fd;

  --sidebar: oklch(19% .025 255);          /* dark navy rail */
  --sidebar-2: oklch(26% .03 255);         /* sidebar-accent */
  --sidebar-text: oklch(94% .008 250);     /* sidebar-foreground */
  --sidebar-muted: oklch(72% .02 255);
  --sidebar-border: oklch(31% .025 255);   /* sidebar-border */
  --sidebar-accent: oklch(62% .215 22);    /* sidebar-primary (red) */

  --radius-sm: 6px;   /* radius-md — controls */
  --radius: 8px;      /* radius-lg — cards */
  --radius-lg: 12px;  /* radius-xl — panels */
  --shadow-sm: 0 1px 2px color-mix(in oklab, var(--text) 6%, transparent);   /* shadow-pos-sm */
  --shadow: 0 8px 22px color-mix(in oklab, var(--text) 10%, transparent);    /* shadow-pos-md */
  --shadow-lg: 0 10px 30px color-mix(in oklab, var(--text) 14%, transparent); /* shadow-dropdown */
  --ring: 0 0 0 3px color-mix(in oklab, var(--primary) 30%, transparent);

  --veg: #10b981;
  --nonveg: #ef4444;
  color-scheme: light;
}

/* Dark theme — the system's near-black customer surface (.undine-dark), reused
   as the app's dark mode. Sidebar keeps its navy in both modes. */
:root[data-theme='dark'] {
  --bg: #090a0d;            /* background */
  --surface: #14171f;       /* card */
  --surface-2: #1c202b;     /* muted / elevated */
  --surface-3: #222734;
  --border: #262b38;        /* border */
  --border-strong: #333a49;
  --text: #f8fafc;          /* foreground */
  --text-2: #94a3b8;        /* muted-foreground */
  --muted: #64748b;         /* text-dim */
  --primary: #ff3b30;       /* brand red */
  --primary-hover: #e02e24;
  --primary-soft: rgba(255, 59, 48, 0.16);
  --primary-text: #ff5c54;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.15);
  --violet: #a48bf7;
  --violet-soft: rgba(164, 139, 247, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px rgba(255, 59, 48, 0.3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; font-family: var(--font-display); }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -0.22em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 15px; height: 15px; }
svg.icon.lg { width: 22px; height: 22px; }
/* Hand-drawn icon set: the offset flat fill behind the main shape (see tools/icons). */
svg.icon .ic-a { fill: var(--icon-accent, var(--primary)); stroke: none; opacity: .28; }
.btn-primary svg.icon .ic-a, .nav-link.active svg.icon .ic-a { fill: currentColor; opacity: .3; }
::selection { background: var(--primary-soft); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ layout */
.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { grid-template-columns: 72px minmax(0, 1fr); }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--sidebar-border);
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px; height: 64px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar-brand .brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--sidebar-2); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -0.02em; flex-shrink: 0; }
.sidebar-brand .text { min-width: 0; }
.sidebar-brand .name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sidebar-muted); padding: 0 10px 6px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  color: rgba(231, 235, 243, 0.78);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--sidebar-2); color: #fff; }
.nav-link.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sidebar-accent); }
.nav-link.active .icon { color: var(--sidebar-accent); }
.nav-link .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--sidebar-text); }
.nav-badge.nb-warn { background: #f59e0b; color: #1f1300; }
.nav-badge.nb-alert { background: var(--sidebar-accent); color: #fff; }
.sidebar-foot { border-top: 1px solid var(--sidebar-border); padding: 10px; }
.sidebar-foot button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--sidebar-muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.sidebar-foot button:hover { background: var(--sidebar-2); color: #fff; }
.app.collapsed .sidebar .label,
.app.collapsed .sidebar .nav-label,
.app.collapsed .sidebar .nav-badge,
.app.collapsed .sidebar-brand .text,
.app.collapsed .sidebar-foot .label { display: none; }
.app.collapsed .nav-link { justify-content: center; }
.app.collapsed .sidebar-foot button { justify-content: center; }

/* Faint centered brand mark behind the app content (not shown on login/signup
   or the customer-facing menu, since those don't call mountShell). Negative
   z-index keeps it below every normal-flow background (cards, topbar, body),
   since body's own background is promoted to the canvas and painted first. */
.brand-watermark {
  position: fixed;
  inset: 0;
  left: 244px;
  z-index: -1;
  margin: auto;
  width: clamp(160px, 18vw, 280px);
  height: clamp(160px, 18vw, 280px);
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  opacity: .5;
}
.app.collapsed .brand-watermark { left: 72px; }
@media (max-width: 860px) {
  .brand-watermark { left: 0; }
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .titles { min-width: 0; flex: 1; }
.topbar h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; }
.content { padding: 22px 24px 40px; flex: 1; min-width: 0; }
.content.flush { padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }

.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.conn.offline .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.conn.connecting .dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }

.offline-banner { background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); padding: 8px 24px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.demo-banner { background: var(--info-soft); color: var(--info); padding: 7px 24px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid color-mix(in srgb, var(--info) 25%, transparent); }
.sound-banner { background: var(--primary-soft); color: var(--primary-text); border-bottom: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); padding: 7px 24px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sound-banner > span { flex: 1; min-width: 200px; }

/* ----------------------------------------------------------------- profile */
.profile { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; cursor: pointer; }
.profile-btn:hover { border-color: var(--border-strong); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); font-weight: 700; font-size: 12px; flex-shrink: 0; }
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.profile-btn .who { text-align: left; line-height: 1.2; }
.profile-btn .who b { font-size: 12.5px; display: block; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-btn .who small { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 8px; z-index: 60; }
.dropdown .head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown .head .meta { min-width: 0; }
.dropdown .head b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown .head small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 13px; color: var(--text); }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item.danger { color: var(--danger); }
.menu-item .hint { margin-left: auto; font-size: 11px; color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
  user-select: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn.loading { opacity: 0.55; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin 0.7s linear infinite; }
.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.loading::after { border-color: #fff transparent #fff transparent; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.94); background: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); background: var(--danger); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-outline-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 31px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; font-weight: 600; }
.btn-xl { height: 56px; padding: 0 22px; font-size: 16px; font-weight: 600; border-radius: var(--radius); }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 31px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input-sm { height: 32px; font-size: 13px; }
.input-lg { height: 48px; font-size: 16px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b879b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; }
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted); font-size: 13px; white-space: nowrap; }
.input-group .addon:first-child { border-right: 0; }
.input-group .addon:last-child { border-left: 0; }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 36px; }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background 0.15s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); }

/* ------------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head p { font-size: 12px; color: var(--muted); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-primary { color: var(--primary-text); }

/* ------------------------------------------------------------------- stats */
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.stat .d { font-size: 12px; margin-top: 2px; color: var(--muted); }
.stat .d .up { color: var(--success); font-weight: 600; }
.stat .d .down { color: var(--danger); font-weight: 600; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.diet { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--veg); border-radius: 3px; flex-shrink: 0; }
.diet::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--veg); }
.diet.non { border-color: var(--nonveg); }
.diet.non::after { background: var(--nonveg); border-radius: 0; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid var(--nonveg); background: none; }

/* -------------------------------------------------------------- pills/tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 12px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.tab .count { margin-left: 6px; font-size: 11px; color: var(--muted); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.pill .count { font-size: 11px; opacity: 0.7; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented button { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: none; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }

/* ------------------------------------------------------------ empty/states */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon-wrap { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted); }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
.loading-block { display: grid; place-items: center; padding: 60px 0; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin 0.7s linear infinite; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; border: 1px solid; }
.alert.warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert b { color: inherit; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* ------------------------------------------------------------------- modal */
.overlay { position: fixed; inset: 0; background: rgba(9, 13, 24, 0.55); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.15s ease; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop 0.18s ease; border: 1px solid var(--border); }
.modal.sm { max-width: 400px; }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-foot .btn { flex-shrink: 0; }
.drawer-overlay { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer { width: min(480px, 100vw); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide 0.2s ease; }
.drawer .modal-foot { border-radius: 0; }

/* ------------------------------------------------------------------- toast */
/* --toast-top is set by the shell so toasts and order alerts sit below any banner. */
.toasts { position: fixed; top: var(--toast-top, 74px); right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 420px; padding: 11px 14px; border-radius: var(--radius); background: #111827; color: #f3f5f9; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; animation: pop 0.18s ease; border-left: 4px solid var(--info); }
.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #f43f5e; }
.toast.warning { border-left-color: #f59e0b; }
/* Incoming QR order: stays in the toast stack and rings until handled. */
.order-alert { pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; width: 400px; max-width: 100%; padding: 12px 12px 12px 14px; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lg); animation: pop 0.18s ease; }
.order-alert .oa-icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); }
.order-alert.ringing .oa-icon { animation: oa-ring 1.2s ease-in-out infinite; }
.order-alert .oa-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.order-alert .oa-body b { font-size: 14px; }
.order-alert .oa-where { white-space: nowrap; }
.order-alert .oa-body span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-alert .oa-body small { color: var(--muted); font-size: 12px; }
.order-alert .oa-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
@keyframes oa-ring { 0%, 55%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .order-alert.ringing .oa-icon { animation: none; } }

/* ---------------------------------------------------------------- utility */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.chip-input { display: flex; gap: 6px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.qr-box { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; line-height: 0; }
.qr-box svg { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes pulse-border { 50% { box-shadow: 0 0 0 4px var(--danger-soft); } }
@keyframes blink { 50% { opacity: 0.45; } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 35; }
  .app.collapsed .sidebar .label, .app.collapsed .sidebar .nav-label, .app.collapsed .sidebar .nav-badge, .app.collapsed .sidebar-brand .text { display: initial; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 14px; gap: 10px; }
  .content { padding: 16px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .profile-btn .who, .conn .label, .hide-sm { display: none !important; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat .v { font-size: 20px; }
  .toasts { left: 12px; right: 12px; top: var(--toast-top, 70px); align-items: stretch; }
  .toast { max-width: none; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
}
