/* =========================================================================
 * Dine Boosters Pos — design system v2 (premium overhaul, 2026-09-24)
 * Self-hosted Inter (assets/fonts/inter-var.woff2) — offline-first intact.
 * Tokens per SPEC §2 · Mobile rules per SPEC §3 (360–400px first-class)
 * ========================================================================= */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0a1526;
  --bg2: #0d1f36;
  --accent: #0da271;
  --accent-d: #0b8560;
  --accent-soft: #e3f6ee;
  --paper: #f3f5f9;
  --card: #ffffff;
  --card-border: #e6ebf3;
  --ink: #0e1a2e;
  --ink2: #33415c;
  --muted: #64748f;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #f59e0b;
  --warn-soft: #fef6e4;
  --info: #3b82f6;
  --info-soft: #e9f1fe;
  --radius: 16px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(14, 26, 46, .05), 0 8px 24px -12px rgba(14, 26, 46, .18);
  --shadow-lg: 0 2px 4px rgba(14, 26, 46, .06), 0 20px 44px -16px rgba(14, 26, 46, .25);
  --sidebar-w: 248px;
  --rail-w: 76px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden; /* SPEC §3: no horizontal page scroll, ever */
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(13, 162, 113, .22); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.22; letter-spacing: -0.015em; font-weight: 750; }
p { margin: 0 0 .75em; }
a { color: var(--accent-d); }
img { max-width: 100%; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* slim scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c4cddc; border-radius: 8px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- layout ---------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: linear-gradient(178deg, #0b1729 0%, #0a1424 55%, #0c1c33 100%);
  color: #dbe4f0;
  display: flex; flex-direction: column;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 200px at 50% -60px, rgba(13, 162, 113, .16), transparent 70%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; position: relative; z-index: 1; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, #17c384, #0b8560);
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 6px 16px rgba(13, 162, 113, .4), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-name { font-size: 15.5px; font-weight: 700; letter-spacing: .1px; color: #fff; line-height: 1.25; }
.brand-name b { color: #34d399; font-weight: 800; }
.brand-name small { display: block; font-size: 10.5px; font-weight: 500; color: #8fa0b8; letter-spacing: 1.4px; }
.nav-group { padding: 6px 12px 0; overflow-y: auto; position: relative; z-index: 1; }
.nav-group::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border: 2px solid transparent; }
.nav-group-title { font-size: 10.5px; font-weight: 700; letter-spacing: 1.8px; color: #7d8da6; padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: #aebdd2; text-decoration: none; font-size: 14.5px; font-weight: 550; min-height: 46px;
  transition: background .18s, color .18s, transform .18s;
  position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(120deg, rgba(23, 195, 132, .22), rgba(23, 195, 132, .08));
  color: #fff; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .35);
}
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 4px; background: linear-gradient(180deg, #34d399, #0b8560);
  box-shadow: 0 0 12px rgba(52, 211, 153, .8);
}
.nav-ico {
  font-size: 17px; width: 34px; height: 34px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: rgba(255, 255, 255, .06); text-align: center;
  transition: background .18s;
}
.nav-link.active .nav-ico { background: linear-gradient(135deg, #17c384, #0b8560); box-shadow: 0 4px 12px rgba(13,162,113,.45); }
.nav-foot {
  margin-top: auto; padding: 14px; position: relative; z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255, 255, 255, .03);
}
.nav-user { font-size: 14px; font-weight: 700; color: #fff; }
.nav-user span { display: block; font-size: 11.5px; font-weight: 500; color: #8fa0b8; text-transform: capitalize; margin-top: 2px; }

.content { margin-left: var(--sidebar-w); padding: 28px 28px 40px; max-width: 1320px; }
/* Root-cause fix (2026-09-23): App.nav() renders a FIXED aside.sidebar on every
   authenticated page, but only .content carried the left offset — pages using
   <main class="page"> or <main class="mc-main"> slid under the sidebar.
   Derive the offset from the sidebar's presence instead of the page's class. */
body:has(> aside.sidebar) > main { margin-left: var(--sidebar-w); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; margin: 0; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ---------------- cards / grids ---------------- */
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.card h2 { font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 18px; }
/* Tables that reuse the .grid class must stay real tables */
table.grid { display: table; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); border-radius: 4px; }
.stat-warn::after { background: var(--warn); }
.stat-danger::after { background: var(--danger); }
.stat-info::after { background: var(--info); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-label { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.stat-ico {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 19px;
  background: var(--accent-soft); flex: none;
}
.stat-warn .stat-ico { background: var(--warn-soft); }
.stat-danger .stat-ico { background: var(--danger-soft); }
.stat-info .stat-ico { background: var(--info-soft); }
.stat-val { font-size: 29px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 20px;
  border: 1px solid transparent; border-radius: var(--radius-s);
  font-size: 14.5px; font-weight: 650; cursor: pointer;
  background: #e8edf4; color: var(--ink); text-decoration: none;
  transition: transform .08s, box-shadow .18s, background .18s, border-color .18s;
  touch-action: manipulation; user-select: none; letter-spacing: .1px;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, #12b981, #0b8560); color: #fff;
  box-shadow: 0 6px 18px -4px rgba(13, 162, 113, .55), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { background: linear-gradient(135deg, #0da271, #0a7554); box-shadow: 0 8px 22px -4px rgba(13,162,113,.6); }
.btn-danger { background: linear-gradient(135deg, #f0565b, #d63a40); color: #fff; box-shadow: 0 6px 16px -6px rgba(229,72,77,.6); }
.btn-warn { background: linear-gradient(135deg, #fbbf24, #e8930c); color: #3d2b00; }
.btn-ghost { background: #fff; border-color: #d5dce7; color: var(--ink2); box-shadow: 0 1px 2px rgba(14,26,46,.05); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-d); }
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- forms ---------------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; color: var(--ink2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1.5px solid #d3dae6; border-radius: var(--radius-s);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
.field input::placeholder, .field textarea::placeholder { color: #9aa7bc; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(13, 162, 113, .14);
}
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------------- tables ---------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-s); border: 1px solid var(--card-border); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; background: #fff; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #eef1f6; white-space: nowrap; }
table.data th {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); background: #f7f9fc;
  position: sticky; top: 0;
}
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover td { background: #f4faf7; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.b-new { background: var(--info-soft); color: #1d4fd7; border-color: #c9dcfa; }
.b-preparing { background: var(--warn-soft); color: #b45309; border-color: #f5dfae; }
.b-ready { background: #e8eaf6; color: #4338ca; border-color: #cfd4f0; }
.b-billed { background: #f3e8ff; color: #7e22ce; border-color: #e2cbfb; }
.b-paid { background: var(--accent-soft); color: #067a54; border-color: #b9e8d2; }
.b-cancelled { background: var(--danger-soft); color: #c0362c; border-color: #f6c9c7; }
.b-parked { background: #eef1f6; color: #55637a; border-color: #dde3ec; }
.b-free { background: var(--accent-soft); color: #067a54; border-color: #b9e8d2; }
.b-occupied { background: var(--danger-soft); color: #c0362c; border-color: #f6c9c7; }
.b-reserved { background: var(--warn-soft); color: #b45309; border-color: #f5dfae; }
.b-cleaning { background: var(--info-soft); color: #1d4fd7; border-color: #c9dcfa; }
.b-admin { background: #101c30; color: #fff; border-color: #101c30; }
.b-admin::before { background: #34d399; }
.b-cashier { background: var(--info-soft); color: #1d4fd7; border-color: #c9dcfa; }
.b-waiter { background: var(--warn-soft); color: #b45309; border-color: #f5dfae; }
.b-kitchen { background: #fff1e2; color: #9a3412; border-color: #f3d9b8; }
.b-manager { background: #ede9fe; color: #5b21b6; border-color: #d3c9f8; }
.b-order_taker { background: #e0f2f1; color: #0f766e; border-color: #bfe3e0; }

/* ---------------- POS ---------------- */
.pos-layout { display: grid; grid-template-columns: 1fr 350px; gap: 18px; align-items: start; }
.pos-cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 14px; scrollbar-width: thin; }
.pos-cat {
  flex: none; min-height: 44px; padding: 9px 18px; border-radius: 999px;
  border: 1.5px solid #d3dae6; background: #fff; font-size: 14px; font-weight: 650; cursor: pointer;
  transition: all .18s; color: var(--ink2);
}
.pos-cat:hover { border-color: var(--accent); color: var(--accent-d); }
.pos-cat.active {
  background: var(--ink); color: #fff; border-color: var(--ink);
  box-shadow: 0 6px 14px -6px rgba(14, 26, 46, .5);
}
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; }
.pos-item {
  background: #fff; border: 1.5px solid var(--card-border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; min-height: 104px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  box-shadow: var(--shadow); touch-action: manipulation;
  transition: transform .15s, box-shadow .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.pos-item::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(13,162,113,.08), transparent 55%); opacity: 0; transition: opacity .2s; }
.pos-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #b9e8d2; }
.pos-item:hover::after { opacity: 1; }
.pos-item:active { transform: scale(.97); }
.pos-item .pi-name { font-weight: 650; font-size: 14px; letter-spacing: -.01em; }
.pos-item .pi-price { color: var(--accent-d); font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.pos-item.unavailable { opacity: .45; filter: grayscale(.4); }
.cart { position: sticky; top: 18px; }
.cart-line { display: flex; justify-content: space-between; gap: 8px; padding: 11px 0; border-bottom: 1px dashed #e2e8f0; font-size: 14px; }
.cart-line .cl-info { flex: 1; }
.cart-line .cl-name { font-weight: 650; }
.cart-line .cl-meta { font-size: 12.5px; color: var(--muted); }
.qty-ctl { display: inline-flex; align-items: center; gap: 8px; }
.qty-ctl button {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid #d3dae6; background: #fff;
  font-size: 18px; font-weight: 700; cursor: pointer; color: var(--ink2); transition: all .15s;
  display: grid; place-items: center; line-height: 1;
}
.qty-ctl button:hover { border-color: var(--accent); color: var(--accent-d); background: var(--accent-soft); }
.cart-totals { margin-top: 14px; font-size: 14.5px; }
.cart-totals .tot-row { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ink2); }
.cart-totals .grand {
  font-size: 21px; font-weight: 800; letter-spacing: -0.02em;
  border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 10px;
  font-variant-numeric: tabular-nums;
}

/* ---------------- tables map ---------------- */
.tables-map { display: flex; flex-wrap: wrap; gap: 14px; }
.table-card {
  flex: 1 1 128px; max-width: 180px; min-height: 104px;
  border-radius: var(--radius); border: 2px solid var(--card-border); background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; font-weight: 750; font-size: 18px; box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .2s, border-color .2s;
}
.table-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.table-card small { font-weight: 500; font-size: 12px; color: var(--muted); }
.table-card.st-free { border-color: var(--accent); }
.table-card.st-free small { color: var(--accent-d); font-weight: 700; }
.table-card.st-occupied { border-color: #f1b0b3; background: #fff7f7; }
.table-card.st-reserved { border-color: #f5d48a; background: #fffdf4; }
.table-card.st-cleaning { border-color: #bcd4fa; background: #f7faff; }

/* ---------------- kitchen KOT ---------------- */
.kot-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.kot-card { background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border-top: 6px solid var(--info); transition: transform .18s, box-shadow .2s; }
.kot-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kot-card.st-new { border-top-color: var(--info); }
.kot-card.st-preparing { border-top-color: var(--warn); }
.kot-card.st-ready { border-top-color: var(--accent); }
.kot-head { padding: 13px 16px; border-bottom: 1px solid #eef1f6; display: flex; justify-content: space-between; align-items: center; background: #fafbfd; }
.kot-head .kot-no { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.kot-head .kot-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kot-body { padding: 12px 16px; }
.kot-line { padding: 9px 0; border-bottom: 1px dashed #e8ecf3; font-size: 14.5px; }
.kot-line:last-child { border-bottom: none; }
.kot-line .kqty { font-weight: 800; margin-right: 8px; color: var(--accent-d); }
.kot-line .kmod { font-size: 13px; color: var(--muted); margin-left: 28px; }
.kot-line .knote { font-size: 13px; color: var(--danger); font-weight: 650; margin-left: 28px; }
.kot-foot { padding: 12px 16px; display: flex; gap: 8px; background: #fafbfd; border-top: 1px solid #eef1f6; }
.kot-foot .btn { flex: 1; }

/* ---------------- lists ---------------- */
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 6px; border-bottom: 1px solid #eef1f6; font-size: 14.5px;
  border-radius: 10px; transition: background .15s;
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { font-weight: 650; letter-spacing: -.01em; }
.list-row .lr-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-row .lr-right { text-align: right; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
a.list-row:hover, .list-row.clickable:hover { background: #f4faf7; }

/* ---------------- modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 12, 24, .55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .22s; z-index: 100;
}
.modal-overlay.open { opacity: 1; }
.modal {
  background: #fff; border-radius: 20px; width: 100%; max-width: 580px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.2,.9,.3,1.2);
  border: 1px solid var(--card-border);
}
.modal-overlay.open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid #eef1f6; }
.modal-head h3 { margin: 0; font-size: 17.5px; }
.modal-x {
  border: none; background: #f1f4f9; width: 38px; height: 38px; border-radius: 11px;
  font-size: 16px; cursor: pointer; color: var(--muted); transition: all .15s;
  display: grid; place-items: center;
}
.modal-x:hover { background: var(--danger-soft); color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 16px 20px; border-top: 1px solid #eef1f6; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: #fafbfd; border-radius: 0 0 20px 20px; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.more-cell {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 8px; border-radius: var(--radius); border: 1.5px solid var(--card-border);
  text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 650; min-height: 96px; justify-content: center;
  transition: all .18s; background: #fff;
}
.more-cell:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #b9e8d2; }
.more-cell.active { border-color: var(--accent); background: var(--accent-soft); }
.more-ico { font-size: 28px; }

/* ---------------- toast ---------------- */
#toast-root { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: #101c30; color: #fff; padding: 13px 22px; border-radius: 14px;
  font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px) scale(.97); transition: all .3s cubic-bezier(.2,.9,.3,1.15); max-width: 100%;
  border: 1px solid rgba(255,255,255,.1);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-success { background: #067a54; border-color: rgba(255,255,255,.15); }
.toast-error { background: #c0362c; border-color: rgba(255,255,255,.15); }
.toast-warn { background: #b45309; border-color: rgba(255,255,255,.15); }

/* ---------------- bottom nav (mobile) ---------------- */
.bottomnav { display: none; }

/* ---------------- login ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
.login-side {
  background: linear-gradient(160deg, #0b1729 0%, #0a1424 55%, #0d2b22 130%);
  color: #dbe4f0; padding: 56px; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.login-side::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(500px 320px at 20% 10%, rgba(23, 195, 132, .18), transparent 65%),
    radial-gradient(420px 420px at 90% 90%, rgba(59, 130, 246, .12), transparent 65%);
}
.login-side > * { position: relative; }
.login-side .brand-mark { width: 56px; height: 56px; font-size: 30px; border-radius: 17px; margin-bottom: 26px; }
.login-side h1 { color: #fff; font-size: 40px; letter-spacing: -0.03em; margin-bottom: 12px; }
.login-side h1 b { color: #34d399; }
.login-side p.tag { color: #9fb0c8; font-size: 16.5px; max-width: 420px; margin-bottom: 34px; }
.login-feat { display: grid; gap: 16px; max-width: 420px; }
.login-feat div { display: flex; gap: 13px; align-items: flex-start; font-size: 14.5px; color: #c4d0e2; }
.login-feat .fi { width: 36px; height: 36px; border-radius: 11px; background: rgba(255,255,255,.07); display: grid; place-items: center; font-size: 17px; flex: none; border: 1px solid rgba(255,255,255,.09); }
.login-feat b { color: #fff; display: block; font-size: 14.5px; }
.login-feat span { color: #8fa0b8; font-size: 13px; }
.login-side .foot { margin-top: 44px; color: #66788f; font-size: 12.5px; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-card { background: #fff; border: 1px solid var(--card-border); border-radius: 24px; padding: 34px 30px; width: 100%; max-width: 430px; box-shadow: var(--shadow-lg); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .brand-mark { font-size: 40px; width: 64px; height: 64px; border-radius: 19px; margin: 0 auto; }
.login-brand h1 { font-size: 21px; margin: 12px 0 2px; }
.login-brand p { color: var(--muted); font-size: 13.5px; margin: 0; }
.mode-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 750; letter-spacing: .8px; padding: 6px 14px; border-radius: 999px; background: var(--warn-soft); color: #92400e; margin-top: 10px; border: 1px solid #f5dfae; }
.mode-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mode-badge.live { background: var(--accent-soft); color: #067a54; border-color: #b9e8d2; }
.staff-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 6px; }
.staff-card {
  border: 2px solid #e2e8f0; border-radius: 14px; padding: 13px 10px; cursor: pointer; text-align: center;
  min-height: 82px; display: flex; flex-direction: column; justify-content: center; gap: 6px;
  transition: all .18s; background: #fbfcfe;
}
.staff-card:hover { border-color: #b9e8d2; transform: translateY(-2px); box-shadow: var(--shadow); }
.staff-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(13,162,113,.12); }
.staff-card .sc-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.pin-display { display: flex; justify-content: center; gap: 14px; margin: 20px 0 14px; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #cbd5e1; transition: all .18s; background: #fff; }
.pin-dot.filled { background: var(--ink); border-color: var(--ink); transform: scale(1.15); box-shadow: 0 2px 8px rgba(14,26,46,.3); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-key {
  min-height: 62px; border-radius: 14px; border: 1.5px solid #e2e8f0; background: #f8fafc;
  font-size: 22px; font-weight: 700; cursor: pointer; touch-action: manipulation; color: var(--ink);
  transition: all .12s;
}
.pin-key:hover { border-color: #b9e8d2; background: #fff; }
.pin-key:active { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(.95); }
.pin-key.fn { font-size: 15px; color: var(--muted); background: #fff; }
.login-error { color: var(--danger); font-size: 13.5px; font-weight: 600; text-align: center; min-height: 22px; margin-top: 12px; }
.login-note { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.6; }

/* ---------------- print (80mm) ---------------- */
#print-area { display: none; }
.kot, .receipt { font-family: "Courier New", Courier, monospace; color: #000; }
.pr-head { text-align: center; margin-bottom: 8px; }
.pr-brand { font-weight: 800; font-size: 15px; }
.pr-title { font-weight: 700; font-size: 13px; margin: 4px 0; letter-spacing: 1px; }
.pr-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 1px 0; }
.pr-bold { font-weight: 800; font-size: 14px; }
.pr-sep { border-top: 1px dashed #000; margin: 8px 0; }
.pr-items { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
.pr-items td { padding: 3px 2px; vertical-align: top; }
.pr-qty { font-weight: 800; width: 34px; }
.pr-amt { text-align: right; white-space: nowrap; }
.pr-dim { font-size: 11px; }
.pr-note { font-size: 11px; font-style: italic; }
.pr-note-box { border: 1px solid #000; padding: 4px; font-size: 12px; font-weight: 700; margin: 6px 0; }
.pr-foot { text-align: center; font-size: 11.5px; margin-top: 10px; }
.pr-qr { text-align: center; margin: 6px 0; }
.pr-qr img { width: 110px; height: 110px; }

/* ---------------- chat (whatsapp) ---------------- */
.chat-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #fff; min-height: 60vh; border: 1px solid var(--card-border); }
.chat-list { border-right: 1px solid #eef1f6; overflow-y: auto; max-height: 70vh; }
.chat-thread { padding: 15px; border-bottom: 1px solid #eef1f6; cursor: pointer; transition: background .15s; }
.chat-thread.active, .chat-thread:hover { background: var(--accent-soft); }
.chat-main { display: flex; flex-direction: column; }
.chat-msgs { flex: 1; padding: 18px; overflow-y: auto; max-height: 55vh; display: flex; flex-direction: column; gap: 10px; background: #f4f6fa; }
.msg { max-width: 75%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px; box-shadow: 0 1px 2px rgba(14,26,46,.06); }
.msg-customer { background: #fff; border: 1px solid var(--card-border); align-self: flex-start; border-bottom-left-radius: 5px; }
.msg-staff { background: #d9f4e7; align-self: flex-end; border-bottom-right-radius: 5px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #eef1f6; background: #fff; }
.chat-input input { flex: 1; min-height: 46px; border: 1.5px solid #d3dae6; border-radius: 12px; padding: 8px 14px; font-size: 15px; font-family: inherit; }
.chat-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(13,162,113,.14); }

/* ---------------- misc ---------------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 12px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 14px; }
.empty::before { content: "📭"; display: block; font-size: 30px; margin-bottom: 8px; opacity: .6; }
.alert { border-radius: 12px; padding: 13px 15px; font-size: 14px; margin-bottom: 12px; border: 1px solid transparent; }
.alert-warn { background: var(--warn-soft); border-color: #f5dfae; color: #92400e; }
.alert-danger { background: var(--danger-soft); border-color: #f6c9c7; color: #b91c1c; }
.alert-ok { background: var(--accent-soft); border-color: #b9e8d2; color: #067a54; }
canvas.chart { width: 100%; height: 200px; display: block; }

/* section eyebrow for page-heads (optional, progressive enhancement) */
.eyebrow { font-size: 11.5px; font-weight: 750; letter-spacing: 1.6px; text-transform: uppercase; color: var(--accent-d); margin-bottom: 6px; }

/* =========================================================================
 * RESPONSIVE — SPEC §3
 * ========================================================================= */
/* tablet: slim icon rail */
@media (max-width: 1023px) and (min-width: 768px) {
  .sidebar { width: var(--rail-w); }
  .sidebar .brand { justify-content: center; padding: 18px 8px 14px; }
  .sidebar .brand-name, .sidebar .nav-group-title, .sidebar .nav-label, .sidebar .nav-foot { display: none; }
  .sidebar .nav-link { justify-content: center; padding: 8px 0; }
  .sidebar .nav-link.active::before { display: none; }
  .content { margin-left: var(--rail-w); }
  body:has(> aside.sidebar) > main { margin-left: var(--rail-w); }
  .pos-layout { grid-template-columns: 1fr 300px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
}
/* phone: bottom nav replaces sidebar; content full width */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 18px 14px 96px; }
  body:has(> aside.sidebar) > main { margin-left: 0; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-main { padding: 20px 14px; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--card-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(14, 26, 46, .1);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-height: 58px; justify-content: center; border: none; background: none;
    color: var(--muted); font-size: 11px; font-weight: 650; cursor: pointer; text-decoration: none;
    border-radius: 12px; transition: all .15s;
  }
  .bn-item.active { color: var(--accent-d); background: var(--accent-soft); }
  .bn-ico { font-size: 22px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
  .cart { position: static; }
  .kot-board { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .chat-wrap { grid-template-columns: 1fr; }
  .chat-list { max-height: 30vh; border-right: none; border-bottom: 1px solid #eef1f6; }
  /* modal becomes full-screen sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 20px 20px 0 0; max-height: 94vh; }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100vw - 28px); }
  .toast { width: 100%; text-align: center; }
  .tables-map .table-card { flex: 1 1 44%; max-width: none; }
}
/* small phones: POS grid exactly 2 columns, no squeeze */
@media (max-width: 480px) {
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 21px; }
  .stat-card .stat-val { font-size: 24px; }
  .content { padding: 14px 12px 96px; }
}

/* =========================================================================
 * PRINT — only #print-area survives
 * ========================================================================= */
@media print {
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .kot, .receipt { width: 80mm; max-width: 80mm; margin: 0 auto; padding: 4mm 2mm; }
}

/* staff access editor: page permission checkboxes */
.perm-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px 20px;margin:10px 0 6px}
.checkline{display:flex;align-items:center;gap:10px;margin:0;font-size:14px;font-weight:500;color:var(--ink2);cursor:pointer;line-height:1.35}
.checkline input[type="checkbox"]{width:17px;height:17px;flex:none;margin:0;accent-color:var(--accent);cursor:pointer}
@media(max-width:560px){.perm-grid{grid-template-columns:1fr}}
