/* ============ Bakery POS — design system ============ */
:root {
  --bg: #faf5ec;
  --surface: #ffffff;
  --ink: #2a2119;
  --ink-soft: #6f6255;
  --line: #eadfce;
  --accent: #c2540a;
  --accent-dark: #9c4308;
  --accent-soft: #fdeadb;
  --sidebar: #2b1d12;
  --sidebar-ink: #d8c9b6;
  --green: #2e7d4f;
  --red: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(60, 35, 10, 0.08), 0 4px 16px rgba(60, 35, 10, 0.06);
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
/* Disable Chrome Android pull-to-refresh: an accidental reload drops the Bluetooth printer link */
html, body { overscroll-behavior-y: none; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0; font-weight: 700; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-mark { font-size: 24px; }
.brand-name { font-weight: 750; color: #f7ecdd; letter-spacing: 0.2px; font-size: 15px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; margin: 2px 0; border-radius: 9px;
  color: var(--sidebar-ink); text-decoration: none; font-weight: 550; font-size: 15px;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-link.active { background: var(--accent); color: #fff; }
.nav-icon { width: 22px; text-align: center; }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.whoami-name { font-weight: 650; color: #f7ecdd; font-size: 13.5px; }
.whoami-sub { font-size: 12px; opacity: 0.75; }
.main { flex: 1; padding: 22px 26px 48px; min-width: 0; }

/* ---------- page furniture ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head .sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 2px; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { min-width: 140px; margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card h3 { font-size: 16px; margin-bottom: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .stat-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 650; text-transform: uppercase; letter-spacing: 0.4px; }
.stat .stat-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-toggle-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  line-height: 1;
  transition: all 0.15s ease;
}
.stat-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}
.stat-toggle-btn.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: rgba(194, 84, 10, 0.35);
}
.stat .stat-value { font-size: 24px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .stat-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-soft); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fbf6ec; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted { color: var(--ink-soft); font-size: 13px; }
.empty { padding: 28px; text-align: center; color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 9px 15px; font-size: 14.5px; font-weight: 650;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: #f8f1e4; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { background: #fff; border-color: #e5b6b0; color: var(--red); }
.btn-danger:hover { background: #fdf1ef; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,0.25); color: inherit; }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 14px 22px; font-size: 17px; border-radius: 11px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); }
.field { min-width: 0; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--ink); outline: none;
  width: 100%; min-width: 0; /* never overflow the grid/flex cell */
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid > * { min-width: 0; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #f0e7d6; color: var(--ink-soft); }
.badge-green { background: #e0f0e6; color: var(--green); }
.badge-red { background: #fbe5e1; color: var(--red); }
.badge-amber { background: var(--accent-soft); color: var(--accent-dark); }

.alert { border-radius: 9px; padding: 11px 13px; font-size: 14px; margin-bottom: 12px; }
.alert-error { background: #fbe5e1; color: #8f2418; }
.alert-ok { background: #e0f0e6; color: #1d5c38; }
.pos-search { position: relative; }
.pos-search input { padding-right: 40px; }
.pos-search input::-webkit-search-cancel-button { display: none; }
.pos-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: none; border-radius: 50%; background: #eee7dd; color: #57534e; font-size: 13px; cursor: pointer; }
.printer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: #fdf0d5; color: #7a4a06; border: 1px solid #f0d39a; border-radius: 9px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.printer-bar-err { color: #8f2418; font-weight: 500; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(40, 25, 10, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 460px; box-shadow: 0 12px 48px rgba(0,0,0,0.25); }
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-x { border: none; background: none; font-size: 22px; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.modal-x:hover { background: var(--bg); }
.modal-body { padding: 16px 18px 18px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 20% -10%, #4a3520, var(--sidebar)); padding: 20px; }
.login-card { background: var(--surface); border-radius: 16px; padding: 32px 30px 28px; width: 100%; max-width: 380px; box-shadow: 0 24px 80px rgba(0,0,0,0.4); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-mark { font-size: 44px; }
.login-brand h1 { font-size: 22px; margin-top: 6px; }
.login-brand p { color: var(--ink-soft); margin: 4px 0 0; font-size: 13.5px; }
.loading-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); }

/* ---------- POS ---------- */
.pos-layout { display: grid; grid-template-columns: 1fr minmax(380px, 440px); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .pos-layout { grid-template-columns: 1fr; } }
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-tab { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 18px; font-size: 14px; font-weight: 650; cursor: pointer; color: var(--ink-soft); transition: all 0.15s ease; }
.cat-tab:hover { border-color: var(--accent); color: var(--accent-dark); }
.cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(180,83,9,0.25); }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 12px; }
.item-tile {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 12px 10px 12px; cursor: pointer; text-align: center; font-family: inherit;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.item-tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(60,35,10,0.08); }
.item-tile:active { transform: scale(0.96); }
.item-tile .it-img-wrap {
  width: 100%; height: 74px; border-radius: 10px; overflow: hidden;
  background: #fbf7ee; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(0,0,0,0.05); margin-bottom: 2px;
}
.item-tile .it-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.2s ease;
}
.item-tile:hover .it-img { transform: scale(1.06); }
.item-tile .it-emoji { font-size: 32px; line-height: 1; padding: 12px 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08)); }
.item-tile .it-name { font-weight: 700; font-size: 13.5px; line-height: 1.25; color: var(--ink); word-break: break-word; }
.item-tile .it-price { color: var(--accent-dark); font-weight: 800; font-size: 14px; background: rgba(180,83,9,0.07); padding: 2px 8px; border-radius: 6px; }

.quick-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; color: var(--ink-soft); cursor: pointer; user-select: none; }
.quick-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Cart Card */
.order-card {
  position: sticky; top: 16px; border-radius: 16px;
  padding: 16px 18px 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  border: 1px solid var(--line); background: var(--surface);
  box-sizing: border-box; width: 100%; min-width: 0;
}
.order-card * { box-sizing: border-box; }

.cart-tabs-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin;
}
.cart-tab-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px;
  border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  transition: all 0.15s ease; white-space: nowrap; user-select: none;
}
.cart-tab-btn:hover { border-color: var(--accent); color: var(--ink); }
.cart-tab-btn.active {
  background: linear-gradient(135deg, #b45309, #92400e);
  border-color: #92400e; color: #fff; box-shadow: 0 3px 10px rgba(180,83,9,0.25);
}
.cart-tab-count {
  background: rgba(0,0,0,0.08); padding: 1px 6px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800;
}
.cart-tab-btn.active .cart-tab-count { background: rgba(255,255,255,0.25); }

/* Customer Box */
.cust-box {
  background: #faf8f5; border: 1.5px solid #eee7db; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px; position: relative; width: 100%;
}
.cust-box-title {
  font-size: 11.5px; font-weight: 750; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.cust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.cust-grid input {
  width: 100%; min-width: 0; padding: 7px 10px; font-size: 13.5px;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
}
.cust-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: #fff; border: 1.5px solid var(--accent); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15); max-height: 180px; overflow-y: auto;
}
.cust-dropdown-item {
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f5f5f4;
  font-size: 13px; display: flex; justify-content: space-between; align-items: center;
}
.cust-dropdown-item:hover { background: #fdf6ec; }
.cust-dropdown-item:last-child { border-bottom: none; }

/* Order Lines */
.order-lines {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
  max-height: 38vh; overflow-y: auto; padding-right: 2px;
}
.order-line {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff;
  transition: background 0.1s;
}
.order-line:hover { background: #faf8f5; }
.ol-name { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.ol-price { font-size: 12px; color: var(--ink-soft); }
.ol-total { font-weight: 750; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; font-size: 14px; }
.ol-remove {
  background: none; border: none; color: #dc2626; cursor: pointer;
  padding: 4px; font-size: 14px; opacity: 0.6; line-height: 1; border-radius: 4px;
}
.ol-remove:hover { opacity: 1; background: #fee2e2; }

.qty-stepper { display: inline-flex; align-items: center; gap: 2px; }
.qty-stepper button {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: #fdfaf4;
  font-size: 16px; font-weight: 700; cursor: pointer; color: var(--ink); line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.qty-stepper button:hover { border-color: var(--accent); color: var(--accent-dark); background: #fff; }
.qty-stepper .qty-val { min-width: 24px; text-align: center; font-weight: 750; font-size: 14px; }

/* Discounts & Totals */
.discount-box {
  background: #faf8f5; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; margin: 10px 0;
}
.split-box {
  background: #fdf6ec; border: 1.5px solid #fbd38d; border-radius: 12px;
  padding: 12px; margin: 10px 0;
}
.split-row { display: grid; grid-template-columns: 105px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.split-row:last-child { margin-bottom: 0; }
.split-row select, .split-row input {
  width: 100%; padding: 7px 9px; font-size: 13.5px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff;
}

.order-total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 2px solid var(--line); padding-top: 10px; margin-top: 8px;
}
.order-total-row .t-label { font-size: 14px; font-weight: 750; color: var(--ink-soft); letter-spacing: 0.5px; }
.order-total-row .t-value { font-size: 28px; font-weight: 850; font-variant-numeric: tabular-nums; color: var(--ink); }

.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.pay-methods .btn { padding: 8px 4px; font-size: 12.5px; font-weight: 700; }
.pay-methods .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 6px rgba(180,83,9,0.25); }

.token-flash {
  background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-radius: 10px;
  text-align: center; padding: 8px 10px; margin-bottom: 12px; box-shadow: 0 3px 10px rgba(16,185,129,0.25);
}
.token-flash .tf-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.9; }
.token-flash .tf-no { font-size: 20px; font-weight: 800; line-height: 1.2; margin-top: 2px; }

/* ---------- printer page ---------- */
.mode-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; cursor: pointer; }
.mode-row input { margin-top: 4px; }
.mode-row.mode-active { border-color: var(--accent); background: #fdf6ec; }
.mode-title { font-weight: 700; }
.mode-desc { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.printer-status { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: #0ca30c; box-shadow: 0 0 0 4px rgba(12,163,12,0.15); }
.dot-red { background: #d03b3b; box-shadow: 0 0 0 4px rgba(208,59,59,0.12); }
.dot-amber { background: #eda100; box-shadow: 0 0 0 4px rgba(237,161,0,0.15); }
.printer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.printer-help { font-size: 13px; color: var(--ink-soft); background: #fbf6ec; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; line-height: 1.5; }
.printer-tips { margin: 0; padding-left: 18px; }
.printer-tips li { margin-bottom: 8px; font-size: 13.5px; }

/* ---------- print: 80mm tokens + bill ---------- */
#print-root { display: none; }
@media print {
  body.printing-receipt * { visibility: hidden; }
  body.printing-receipt #app { display: none !important; }
  body.printing-receipt #print-root, body.printing-receipt #print-root * { visibility: visible; }
  body.printing-receipt #print-root { display: block !important; position: absolute; left: 0; top: 0; width: 80mm; }
}
.receipt {
  position: relative;
  width: 80mm; padding: 3mm 4mm 6mm;
  font-family: 'Courier New', ui-monospace, Menlo, monospace;
  font-size: 12px; color: #000; background: #fff;
  overflow: hidden;
}
.receipt .r-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.receipt > *:not(.r-watermark) {
  position: relative;
  z-index: 1;
}
.receipt.cut-after { page-break-after: always; }
.receipt .r-center { text-align: center; }
.receipt .r-shop { font-size: 16px; font-weight: 700; }
.receipt .r-sub { font-size: 11px; }
.receipt .r-hr { border-top: 1px dashed #000; margin: 4px 0; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 6px; }
.receipt .r-item-name { flex: 1; }
.receipt .r-total { font-size: 15px; font-weight: 700; }
.receipt .r-token-no { font-size: 19px; font-weight: 800; letter-spacing: 0.5px; margin: 1px 0; }
.receipt.r-token { padding: 2mm 3mm 3mm; }
.receipt .r-token-row { display: flex; align-items: baseline; gap: 2.5mm; }
.receipt .r-token-num { font-size: 36px; font-weight: 900; line-height: 1; letter-spacing: -1px; }
.receipt .r-token-name { font-size: 19px; font-weight: 800; line-height: 1.15; flex: 1; }
.receipt .r-token-meta { font-size: 11.5px; margin-top: 1.5mm; border-top: 1px dashed #000; padding-top: 1mm; }

/* ---------- responsive (tablet / phone) ---------- */
.mobile-print-bar { display: none; }
@media (max-width: 1050px) {
  .order-card { position: static; }
  .order-lines { max-height: none; }
  .main { padding-bottom: 96px; }
  .mobile-print-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(60, 35, 10, 0.12);
  }
  .mobile-print-bar .mpb-total { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .mobile-print-bar .mpb-count { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
}
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 40;
    display: grid; grid-template-columns: 1fr auto; align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  }
  .brand { border-bottom: none; padding: 10px 14px; grid-row: 1; grid-column: 1; }
  .brand-name { font-size: 14px; }
  .sidebar-foot { border-top: none; padding: 8px 12px; gap: 10px; grid-row: 1; grid-column: 2; }
  .whoami-sub { display: none; }
  .sidebar nav {
    grid-row: 2; grid-column: 1 / -1;
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 0 8px 8px; gap: 4px;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 8px 13px; white-space: nowrap; flex-shrink: 0; font-size: 14px; }
  .main { padding: 14px 14px 96px; }
  .page-head { margin-bottom: 12px; }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  /* 16px inputs prevent iOS Safari auto-zoom on focus */
  .field input, .field select, .field textarea { font-size: 16px; }
  .page-head h2 { font-size: 19px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 8px; }
  .item-tile { min-height: 90px; padding: 10px 6px 9px; border-radius: 12px; }
  .item-tile .it-emoji { font-size: 22px; }
  .item-tile .it-name { font-size: 13px; }
  .item-tile .it-price { font-size: 13px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .order-total-row .t-value { font-size: 26px; }
  .filters .field { min-width: 120px; flex: 1; }
  .modal { border-radius: 12px; }
  .modal-backdrop { padding: 3vh 10px 10px; }
}

/* ---------- demo additions ---------- */
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.demo-banner { background: #eef6ff; color: #1e3a5f; border: 1px solid #c9def5; border-radius: 9px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.demo-creds { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.demo-creds-title { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.5px; text-align: center; }
.demo-cred { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px dashed var(--line); background: #fdfaf4; border-radius: 9px; padding: 9px 12px; cursor: pointer; font-family: inherit; font-size: 13.5px; color: var(--ink); }
.demo-cred:hover { border-color: var(--accent); background: var(--accent-soft); }
.demo-cred span { color: var(--ink-soft); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
#toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 28px rgba(0,0,0,0.25); transition: opacity 0.35s, transform 0.35s; max-width: min(420px, calc(100vw - 32px)); }
.toast-ok { background: #1d5c38; }
.toast-error { background: #8f2418; }
.toast-out { opacity: 0; transform: translateY(8px); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.text-right { text-align: right; }
.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }
