/* ================================================================
   Restaurant Operations — Operations Platform
   Design System & Layout
================================================================ */

:root {
  --brand-50:  #fff7ed;
  --brand-100: #ffedd5;
  --brand-200: #fed7aa;
  --brand-300: #fdba74;
  --brand-400: #fb923c;
  --brand-500: #f97316;
  --brand-600: #ea580c;
  --brand-700: #c2410c;

  --ink-900: #1c1917;
  --ink-800: #292524;
  --ink-700: #44403c;
  --ink-600: #57534e;
  --ink-500: #78716c;
  --ink-400: #a8a29e;
  --ink-300: #d6d3d1;
  --ink-200: #e7e5e4;
  --ink-100: #f5f5f4;
  --ink-50:  #fafaf9;

  --green-600: #16a34a;
  --green-100: #dcfce7;
  --green-700: #15803d;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --amber-700: #b45309;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --red-700: #b91c1c;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --blue-700: #1d4ed8;
  --violet-600: #7c3aed;
  --violet-100: #ede9fe;

  --surface: #ffffff;
  --bg: #f7f5f2;
  --border: var(--ink-200);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(28,25,23,0.06);
  --shadow-md: 0 4px 12px rgba(28,25,23,0.08);
  --shadow-lg: 0 12px 32px rgba(28,25,23,0.14);
  --sidebar-w: 250px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: -3px; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-800);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5 { margin: 0; font-weight: 700; color: var(--ink-900); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
input, select, textarea { font-family: inherit; font-size: 13px; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--brand-200); }

/* ---------------- Layout shell ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink-900);
  color: var(--ink-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: white;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.brand-text strong { color: #fff; font-size: 13.5px; white-space: nowrap; }
.brand-text span { color: var(--ink-400); font-size: 11px; }
.sidebar-close { display: none; margin-left: auto; background: none; border: none; color: var(--ink-400); font-size: 20px; cursor: pointer; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-group { margin-bottom: 18px; }
.nav-group-title {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  padding: 0 10px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-300);
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-link .nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active {
  background: var(--brand-600);
  color: #fff;
}
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.plan-badge {
  background: rgba(249,115,22,0.12);
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.plan-badge span { color: var(--brand-300); font-weight: 700; font-size: 12px; }
.plan-badge small { color: var(--ink-400); font-size: 10.5px; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 35;
}

.main-col {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------------- Topbar ---------------- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--ink-700);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--ink-100); }
.icon-btn .nav-icon { width: 17px; height: 17px; }
.only-mobile { display: none; }

.store-switch {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 10px;
  height: 36px;
  background: var(--ink-50);
  flex-shrink: 0;
}
.store-switch .nav-icon { width: 15px; height: 15px; color: var(--brand-600); }
.store-switch select {
  border: none; background: transparent; font-weight: 600; font-size: 13px;
  color: var(--ink-800); cursor: pointer; outline: none; max-width: 160px;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 12px;
  height: 36px;
  background: var(--ink-50);
}
.topbar-search .nav-icon { width: 15px; height: 15px; color: var(--ink-400); }
.topbar-search input { border: none; background: transparent; outline: none; flex: 1; font-size: 13px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.offline-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px;
  background: var(--green-100); color: var(--green-700);
  white-space: nowrap;
}
.offline-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); }
.offline-pill.offline { background: var(--red-100); color: var(--red-700); }
.offline-pill.offline .dot { background: var(--red-600); }

.badge-dot {
  position: absolute; top: -4px; right: -4px;
  background: var(--red-600); color: #fff;
  font-size: 9.5px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 6px;
  border: none; border-left: 1px solid var(--border); border-radius: 8px;
  background: none; font: inherit; cursor: pointer;
}
.user-chip:hover { background: var(--ink-100); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-400), var(--violet-600));
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.user-chip-text { display: none; flex-direction: column; line-height: 1.25; }
.user-chip-text strong { font-size: 12.5px; }
.user-chip-text span { font-size: 11px; color: var(--ink-500); }
@media (min-width: 900px) { .user-chip-text { display: flex; } }

/* ---------------- Page head ---------------- */
.page-head {
  padding: 22px 28px 4px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--ink-500); font-size: 13px; margin-top: 4px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.content { padding: 18px 28px 48px; flex: 1; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-700);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.btn .nav-icon { width: 14px; height: 14px; }
.btn:hover { background: var(--ink-100); }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-dark { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.btn-dark:hover { background: var(--ink-800); }
.btn-danger { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--ink-100); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.perm-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------- Cards / Grid ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
  gap: 10px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; }
.card-head p { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-12 { grid-template-columns: repeat(12, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } .grid-12 { grid-template-columns: 1fr; } }

.section { margin-bottom: 22px; }
.section-title { font-size: 13.5px; font-weight: 700; color: var(--ink-800); margin-bottom: 10px; display:flex; align-items:center; gap:8px; }

/* ---------------- KPI stat card ---------------- */
.stat-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .stat-label { font-size: 12px; color: var(--ink-500); font-weight: 600; }
.stat-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon .nav-icon { width: 15px; height: 15px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--ink-900); letter-spacing: -0.02em; }
.stat-delta { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.stat-delta.up { color: var(--green-700); }
.stat-delta.down { color: var(--red-700); }

.icon-bg-brand { background: var(--brand-100); color: var(--brand-700); }
.icon-bg-green { background: var(--green-100); color: var(--green-700); }
.icon-bg-blue { background: var(--blue-100); color: var(--blue-700); }
.icon-bg-amber { background: var(--amber-100); color: var(--amber-700); }
.icon-bg-red { background: var(--red-100); color: var(--red-700); }
.icon-bg-violet { background: var(--violet-100); color: var(--violet-600); }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-500); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--ink-50);
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
.table tbody tr:hover { background: var(--ink-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 700; color: var(--ink-900); }
.cell-sub { font-size: 11.5px; color: var(--ink-500); }

/* ---------------- Badges / Pills ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.pill-green { background: var(--green-100); color: var(--green-700); }
.pill-amber { background: var(--amber-100); color: var(--amber-700); }
.pill-red { background: var(--red-100); color: var(--red-700); }
.pill-blue { background: var(--blue-100); color: var(--blue-700); }
.pill-gray { background: var(--ink-100); color: var(--ink-600); }
.pill-violet { background: var(--violet-100); color: var(--violet-600); }
.pill-brand { background: var(--brand-100); color: var(--brand-700); }

.moscow-must { background: var(--ink-900); color: #fff; }

/* ---------------- Forms ---------------- */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block; font-size: 12px; font-weight: 700; color: var(--ink-700); margin-bottom: 6px;
}
.form-row .hint { font-size: 11px; color: var(--ink-500); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
  color: var(--ink-800);
}
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
/* Phone number: country-code list, then the number. */
.phone-field { display: flex; gap: 8px; align-items: stretch; }
.phone-field-country { flex: 0 0 auto; width: 188px; max-width: 48%; }
.phone-field-number { flex: 1 1 auto; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab-btn {
  padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--ink-500);
  border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink-800); }
.tab-btn.active { color: var(--brand-600); border-bottom-color: var(--brand-600); }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(28,25,23,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
/* Nested dialogs (#overlayRoot) stack above the primary modal (#modalRoot) they were opened from */
.overlay-backdrop { z-index: 110; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal.modal-lg { max-width: 760px; }

/* Viewport-relative sizing for content-heavy modals (POS order entry): as tall as the window, from its top edge to its bottom edge,
   whatever the device, and about three quarters of its width on a wide screen (all of it on a narrow one). Size never shifts with how
   many items are shown; the inner panels scroll instead. dvh follows the visible height on a phone whose address bar comes and goes. */
.modal-backdrop:has(> .modal-order) { padding-block: 0; }
.modal.modal-order {
  width: 76vw;
  max-width: 100vw;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (max-width: 1100px) { .modal-backdrop:has(> .modal-order) { padding: 0; } .modal.modal-order { width: 100vw; } }
.modal.modal-order .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
}
.order-entry-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; width: 100%; min-height: 0; }
@media (max-width: 820px) {
  .modal.modal-order .modal-body { overflow-y: auto; }
  .order-entry-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; align-content: start; }
  .order-entry-grid > .order-entry-col { min-height: 0; }
  .order-entry-grid > .order-entry-col:first-child .order-entry-scroll { max-height: 56vh; }
  .order-entry-grid > .order-entry-col + .order-entry-col { border-left: 0 !important; padding-left: 0 !important; border-top: 1px solid var(--border); padding-top: 12px; }
}
/* min-width: 0 overrides the browser's default "never shrink below content" rule for grid/flex
   items — without it, the header row inside (search + scan + tier select) refuses to shrink on
   a narrower window and pushes this column wider than its actual grid track, overlapping the
   cart panel next to it instead of wrapping or truncating. */
.order-entry-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.order-entry-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
/* Only the list of dishes may shrink in a short window; the seat picker and the category chips keep their height. */
.order-entry-col > :not(.order-entry-scroll) { flex-shrink: 0; }
.menu-cat-chips { flex-shrink: 0; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.modal-header h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 22px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface);
}
/* Footers are written as one wrapper div around the buttons: lay the buttons out in a row (wrapping on a narrow dialog), all on one line and one height. */
.modal-footer > div:only-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; max-width: 100%; }
.modal-footer > div:only-child > .btn { margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--ink-500); cursor: pointer; line-height: 1; }

/* ---------------- Toast ---------------- */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink-900); color: #fff; padding: 11px 16px;
  border-radius: 9px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toast-in .2s ease;
}
.toast.success { background: var(--green-700); }
.toast.error { background: var(--red-700); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Empty state ---------------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-500); }
.empty-state .nav-icon { width: 36px; height: 36px; margin-bottom: 10px; opacity: 0.4; }

/* ---------------- Misc utility ---------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; }
.mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-18 { margin-top: 18px; }
.mb-8 { margin-bottom: 8px; } .mb-14 { margin-bottom: 14px; }
.text-sub { color: var(--ink-500); font-size: 12px; }
.text-xs { font-size: 11px; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.scroll-x { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.link-btn { background:none;border:none;color:var(--brand-600);font-weight:700;font-size:12.5px;cursor:pointer;padding:0; }
.link-btn:hover { text-decoration: underline; }

/* ---------------- Progress bar ---------------- */
.progress { height: 7px; border-radius: 999px; background: var(--ink-100); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-500); }

/* ---------------- Bar chart (css) ---------------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars .bar { width: 100%; max-width: 30px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); position: relative; }
.bars .bar-label { font-size: 10.5px; color: var(--ink-500); font-weight: 600; }

/* ---------------- Simple donut via conic-gradient ---------------- */
.donut {
  width: 130px; height: 130px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.donut::before {
  content: ""; position: absolute; inset: 18px; background: var(--surface); border-radius: 50%;
}
.donut-center { position: relative; z-index: 1; text-align: center; }
.donut-center strong { display: block; font-size: 17px; color: var(--ink-900); }
.donut-center span { font-size: 10px; color: var(--ink-500); }
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ---------------- Floor plan tables (POS) ---------------- */
/* Tiles fill their grid column edge-to-edge (no max-width + centering) so the only space
   between tiles is ever this one `gap` value — a per-tile size cap centered in a wider 1fr
   column just re-creates the "too much space" problem as dead margin instead of solving it.
   Column count (set inline from JS per screen size) is what keeps tiles from getting too big. */
.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; }
.table-tile {
  width: 100%; aspect-ratio: 1 / 1;
  border-radius: var(--radius-md); border: 2px solid var(--border); background: var(--surface);
  padding: 8px 6px; cursor: pointer; text-align: center; transition: transform .12s ease;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.table-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.table-tile .t-num { font-size: 14px; font-weight: 800; color: var(--ink-900); }
.table-tile .t-meta { font-size: 9.5px; color: var(--ink-500); line-height: 1.2; }
.table-tile .pill { font-size: 8.5px; padding: 2px 6px; }
.table-tile.free { border-color: var(--green-600); background: var(--green-100); }
.table-tile.occupied { border-color: var(--brand-600); background: var(--brand-100); }
.table-tile.reserved { border-color: var(--blue-600); background: var(--blue-100); }
.table-tile.bill { border-color: var(--violet-600); background: var(--violet-100); }
.table-tile.ordering { border-color: var(--amber-600); background: var(--amber-100); border-style: dashed; }
.table-tile.no-order { border-color: var(--ink-400); background: var(--ink-100); border-style: dashed; }
.table-tile.turn-warn { border-color: var(--amber-600); background: var(--amber-100); }
.table-tile.turn-late { border-color: var(--red-600); background: var(--red-100); }
.table-tile .t-seated { font-weight: 700; }

/* ---------------- Kanban (KDS) ---------------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px) { .kanban { grid-template-columns: 1fr; } }
.kanban-col { background: var(--ink-100); border-radius: var(--radius-lg); padding: 12px; min-height: 200px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.kanban-col-head h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-600); }
.kanban-count { background: var(--surface); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.order-card {
  background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--border);
  padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
}
.order-card .oc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order-card .oc-id { font-weight: 800; font-size: 13.5px; }
.order-card ul.items { margin: 8px 0; }
.order-card ul.items li { font-size: 12.5px; padding: 2px 0; display: flex; justify-content: space-between; }
.order-card .oc-note { font-size: 11.5px; color: var(--amber-700); background: var(--amber-100); border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.order-card .oc-foot { display: flex; gap: 6px; margin-top: 10px; }
.order-card .oc-timer { font-size: 11px; color: var(--ink-500); }
.order-card.ticket-warn { border-color: var(--amber-600); background: var(--amber-100); }
.order-card.ticket-late { border-color: var(--red-600); background: var(--red-100); }
.order-card ul.items li.bumped { text-decoration: line-through; color: var(--ink-500); }
.order-card ul.items li { gap: 8px; align-items: center; }
.ticket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }

/* ---------------- Storefront preview ---------------- */
.phone-frame {
  width: 300px; border-radius: 34px; border: 8px solid var(--ink-900);
  background: var(--ink-900); box-shadow: var(--shadow-lg); overflow: hidden; flex-shrink: 0;
}
.phone-screen { background: var(--surface); border-radius: 26px; overflow: hidden; height: 560px; overflow-y: auto; }
.menu-hero { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; padding: 18px; }
.menu-hero h3 { color: #fff; font-size: 17px; }
.menu-hero p { font-size: 11.5px; opacity: 0.9; margin-top: 3px; }
.menu-cat-chips { display: flex; gap: 6px; padding: 12px 14px; overflow-x: auto; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--ink-100); font-size: 11.5px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.chip.active { background: var(--brand-600); color: #fff; }
.menu-item-row { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--ink-100); align-items: center; }
.menu-item-thumb { width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0; display:flex;align-items:center;justify-content:center;font-size:20px; }
.menu-item-row .mi-info { flex: 1; min-width: 0; }
.menu-item-row .mi-info strong { font-size: 12.5px; display: block; }
.menu-item-row .mi-info span { font-size: 11px; color: var(--ink-500); }
.mi-price { font-size: 12.5px; font-weight: 700; }
.add-round {
  width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--brand-600); color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer; flex-shrink: 0; display:flex;align-items:center;justify-content:center;
}
.qr-box {
  width: 120px; height: 120px; border-radius: 10px; border: 1px solid var(--border); flex-shrink: 0;
  display: grid; grid-template-columns: repeat(8,1fr); grid-template-rows: repeat(8,1fr); padding: 8px; gap: 2px;
}
.qr-box i { background: var(--ink-900); border-radius: 1px; }
.qr-box i.off { background: transparent; }

/* ---------------- Toggle switch (active/inactive entries) ---------------- */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .switch-track {
  position: absolute; inset: 0; background: var(--ink-300); border-radius: 999px; cursor: pointer; transition: background .15s;
}
.switch .switch-track::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff;
  border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + .switch-track { background: var(--brand-600); }
.switch input:checked + .switch-track::before { transform: translateX(16px); }
.switch-row { display: flex; align-items: center; gap: 10px; }

/* ---------------- Pagination ---------------- */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 10px 0 2px; }
.pager span { font-size: 12px; color: var(--ink-500); }

/* ---------------- Priority tag (MoSCoW-ish for module scope hints) ---------------- */
.scope-note {
  background: var(--brand-50); border: 1px dashed var(--brand-300); border-radius: var(--radius-md);
  padding: 10px 14px; font-size: 12px; color: var(--brand-700); margin-bottom: 16px; display:flex; gap:8px; align-items:flex-start;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-backdrop.show { display: block; }
  .main-col { margin-left: 0; }
  .only-mobile { display: flex; }
  .store-switch select { max-width: 110px; }
  .topbar-search { display: none; }
}
@media (max-width: 560px) {
  .page-head, .content { padding-left: 16px; padding-right: 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
}

/* Print only the front-most open dialog's content (e.g. a receipt) — everything else is hidden.
   A receipt/docket is usually a nested overlay on top of Order Entry; when one is open it's the
   thing to print and the modal underneath must stay suppressed, not print alongside it. */
@media print {
  body * { visibility: hidden; }
  body:not(:has(#overlayRoot .modal-backdrop)) #modalRoot .modal-backdrop,
  body:not(:has(#overlayRoot .modal-backdrop)) #modalRoot .modal-backdrop *,
  #overlayRoot .modal-backdrop, #overlayRoot .modal-backdrop * { visibility: visible; }
  #modalRoot .modal-backdrop, #overlayRoot .modal-backdrop { position: absolute; inset: 0; background: #fff; display: block; }
  .modal { box-shadow: none; max-width: 100%; }
  .modal-header, .modal-footer { display: none; }
}

/* ---------- Floor map (POS view + Settings editor) ----------
   The canvas keeps the uploaded image's exact aspect ratio (--ar = width/height) and is capped so the
   whole map always fits on screen: it never exceeds the container width, nor the viewport height minus
   the page chrome. Tables are positioned/sized in % of the image, so overlays scale with it. */
.fm-stage { display: flex; justify-content: center; width: 100%; }
.fm-canvas {
  position: relative; width: 100%; aspect-ratio: var(--ar);
  max-width: calc(max(240px, 100dvh - var(--fm-reserve, 330px)) * var(--ar));
  container-type: inline-size; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; user-select: none; -webkit-user-select: none;
}
.fm-canvas > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.fm-marker {
  --fm-c: var(--brand-600);
  position: absolute; transform: translate(-50%, -50%); box-sizing: border-box; padding: 0; margin: 0;
  border: 2px solid var(--fm-c); border-radius: 50%; cursor: pointer;
  background: color-mix(in srgb, var(--fm-c) 30%, transparent);
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow .12s ease, background .12s ease;
}
.fm-marker.sq { border-radius: 22%; }
.fm-marker.free { --fm-c: var(--green-600); }
.fm-marker.occupied { --fm-c: var(--brand-600); }
.fm-marker.reserved { --fm-c: var(--blue-600); }
.fm-marker.bill { --fm-c: var(--violet-600); }
.fm-marker.ordering { --fm-c: var(--amber-600); }
.fm-marker.no-order { --fm-c: var(--ink-500); }
.fm-marker.turn-warn { --fm-c: var(--amber-600); }
.fm-marker.turn-late { --fm-c: var(--red-600); }
.fm-marker:hover, .fm-marker:focus-visible { background: color-mix(in srgb, var(--fm-c) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fm-c) 35%, transparent); outline: none; }
.fm-label { display: none; font-weight: 800; font-size: clamp(8px, 1.6cqw, 15px); line-height: 1; color: var(--ink-900); pointer-events: none; }

.fm-editing .fm-marker { cursor: grab; touch-action: none; }
.fm-editing .fm-marker:active { cursor: grabbing; }
.fm-editing .fm-marker.selected { box-shadow: 0 0 0 3px color-mix(in srgb, var(--fm-c) 45%, transparent); background: color-mix(in srgb, var(--fm-c) 45%, transparent); }
.fm-editing .fm-label { display: block; }
.fm-canvas.fm-drop-target { outline: 3px dashed var(--brand-500); outline-offset: -3px; }

.fm-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .fm-editor { grid-template-columns: minmax(0, 1fr); } }
.fm-palette { display: flex; flex-wrap: wrap; gap: 8px; max-height: 240px; overflow-y: auto; }
.fm-chip {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--ink-200);
  border-radius: 10px; background: #fff; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; font-size: 12px;
}
.fm-chip:hover { border-color: var(--brand-500); }
.fm-ghost {
  position: fixed; z-index: 9999; transform: translate(-50%, -50%); pointer-events: none;
  padding: 6px 12px; border-radius: 999px; background: var(--brand-600); color: #fff; font-weight: 800; font-size: 12px; box-shadow: var(--shadow-md);
}

/* .chip was written for <span>s; as a <button> (POS Tables | Floor map toggle) it needs the browser's border/font reset. */
button.chip { border: 0; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
button.chip:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* Floor name under the table number when a store has several floors (labels restart at T1 per floor). */
.table-tile .t-floor { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* Table names on the POS map, for floor plans whose pictures have no numbers on their tables. */
.fm-marker { overflow: visible; }
.fm-canvas.fm-names .fm-label {
  display: block; white-space: nowrap; font-weight: 800; font-size: clamp(8px, 1.8cqw, 16px);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff;
}
