/* ================= Design tokens ================= */
:root {
  --bg: #090a18;
  --bg2: #0f1126;
  --panel: rgba(255, 255, 255, .055);
  --panel-2: rgba(255, 255, 255, .085);
  --panel-solid: #15172f;
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .18);
  --text: #eef0ff;
  --muted: #9aa0c3;
  --faint: #6b7099;
  --accent: #7c5cff;
  --accent-2: #22d3c5;
  --accent-3: #ff5c9a;
  --gold: #ffc35c;
  --ok: #34e3a4;
  --warn: #ffb547;
  --bad: #ff5d7a;
  --grad: linear-gradient(120deg, #7c5cff 0%, #5a7bff 45%, #22d3c5 100%);
  --grad-hot: linear-gradient(120deg, #ff5c9a, #ff9a5c);
  --glow: 0 0 0 1px rgba(124, 92, 255, .35), 0 10px 40px -10px rgba(124, 92, 255, .55);
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, .65);
  --r: 18px;
  --r-sm: 12px;
  --blur: blur(22px) saturate(140%);
  --font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  color-scheme: dark;
}
:root[data-theme="pearl"] {
  --bg: #eef0fb;
  --bg2: #ffffff;
  --panel: rgba(255, 255, 255, .72);
  --panel-2: rgba(255, 255, 255, .95);
  --panel-solid: #ffffff;
  --line: rgba(30, 30, 80, .10);
  --line-2: rgba(30, 30, 80, .18);
  --text: #1b1d3a;
  --muted: #5d6290;
  --faint: #9497b8;
  --shadow: 0 20px 50px -24px rgba(40, 40, 120, .35);
  --glow: 0 0 0 1px rgba(124, 92, 255, .25), 0 10px 30px -12px rgba(124, 92, 255, .45);
  color-scheme: light;
}
:root[data-theme="sunset"] {
  --bg: #160a14;
  --bg2: #22101d;
  --accent: #ff5c9a;
  --accent-2: #ffb347;
  --grad: linear-gradient(120deg, #ff5c9a 0%, #ff7a6b 50%, #ffc35c 100%);
  --glow: 0 0 0 1px rgba(255, 92, 154, .35), 0 10px 40px -10px rgba(255, 92, 154, .5);
}
:root[data-theme="emerald"] {
  --bg: #04130f;
  --bg2: #082019;
  --accent: #10c98f;
  --accent-2: #4fd1ff;
  --grad: linear-gradient(120deg, #10c98f 0%, #22b5c9 60%, #4f8bff 100%);
  --glow: 0 0 0 1px rgba(16, 201, 143, .35), 0 10px 40px -10px rgba(16, 201, 143, .5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
svg:not([width]) { width: 20px; height: 20px; flex: none; }
.modal-h svg { width: 24px; height: 24px; color: var(--accent); }
.chip svg { width: 14px; height: 14px; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  font-size: 15px;
  user-select: none;
}
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea { user-select: text; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* Animated aurora background */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 700px at 100% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%), radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 60%), var(--bg); }
.aurora i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); opacity: .22; animation: float 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: var(--accent); top: -18vmax; inset-inline-start: -10vmax; }
.aurora i:nth-child(2) { background: var(--accent-2); bottom: -20vmax; inset-inline-end: -8vmax; animation-delay: -7s; }
.aurora i:nth-child(3) { background: var(--accent-3); top: 30%; left: 40%; width: 26vmax; height: 26vmax; opacity: .12; animation-delay: -12s; }
:root[data-theme="pearl"] .aurora i { opacity: .16; }
@keyframes float { to { transform: translate(6vmax, 4vmax) scale(1.15); } }

/* ================= Generic components ================= */
.glass { background: var(--panel); border: 1px solid var(--line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: var(--r); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-sm); padding: 10px 16px; font-weight: 700; transition: transform .12s, background .2s, border-color .2s, box-shadow .2s; white-space: nowrap; min-height: 44px; }
.btn:hover { border-color: var(--line-2); }
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: var(--glow); }
.btn.hot { background: var(--grad-hot); border: 0; color: #fff; }
.btn.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.btn.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 58px; font-size: 18px; border-radius: 16px; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.sm svg { width: 16px; height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.chip.acc { color: #fff; background: var(--grad); border: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 700; }
.input, select.input, textarea.input { width: 100%; padding: 11px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 55%, transparent); outline: none; transition: border-color .2s, box-shadow .2s; min-height: 44px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea.input { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: color-mix(in srgb, var(--bg) 50%, transparent); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 700; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; min-height: 38px; }
.seg button svg { width: 18px; height: 18px; }
.seg button.on { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: .2s; }
.switch i::after { content: ''; position: absolute; width: 22px; height: 22px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(-20px); }
[dir="ltr"] .switch input:checked + i::after { transform: translateX(20px); }
.empty { display: grid; place-items: center; text-align: center; color: var(--faint); padding: 40px 20px; gap: 10px; }
.empty svg { width: 54px; height: 54px; opacity: .5; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; color: var(--muted); font-weight: 700; position: sticky; top: 0; background: var(--panel-solid); }
.table tr:hover td { background: var(--panel); }

/* ================= App shell ================= */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 10px 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; font-weight: 800; color: #fff; box-shadow: var(--glow); overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.brand b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav { display: flex; gap: 6px; }
.nav a { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); border: 1px solid transparent; position: relative; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on { color: #fff; background: var(--grad); box-shadow: var(--glow); }
.nav a svg { width: 22px; height: 22px; }
.nav a[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: 50px; background: var(--panel-solid); border: 1px solid var(--line); padding: 4px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; color: var(--text); z-index: 50; }
.nav .badge { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--bad); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 800; }
.net { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 12px var(--ok); flex: none; }
.net.off { background: var(--bad); box-shadow: 0 0 12px var(--bad); animation: blink 1s infinite; }
.net.demo { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
@keyframes blink { 50% { opacity: .3; } }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.view { flex: 1; min-height: 0; padding: 10px; display: flex; gap: 10px; }
.page { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.page h2 { margin: 0 0 14px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.page h2 svg { width: 26px; height: 26px; }

/* ================= POS screen ================= */
.pos { flex: 1; display: grid; grid-template-columns: 92px 1fr 420px; gap: 10px; min-height: 0; }
.cats { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.cat { border: 1px solid transparent; background: transparent; border-radius: 16px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; transition: .2s; }
.cat .ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); font-size: 20px; overflow: hidden; color: var(--text); }
.cat .ic img { width: 100%; height: 100%; object-fit: cover; }
.cat:hover .ic { border-color: var(--line-2); }
.cat.on { color: var(--text); }
.cat.on .ic { background: var(--grad); color: #fff; border: 0; box-shadow: var(--glow); }
.center { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 10px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; width: 20px; height: 20px; color: var(--muted); }
.search input { padding-inline-start: 44px; }
.subcats { display: flex; gap: 8px; overflow-x: auto; padding: 0 2px 2px; }
.subcats button { flex: none; }
.products { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); grid-auto-rows: max-content; gap: 12px; align-content: start; padding: 4px 4px 20px; }
.prod { position: relative; border: 1px solid var(--line); background: var(--panel); border-radius: 18px; overflow: hidden; text-align: start; padding: 0; display: flex; flex-direction: column; transition: transform .15s, border-color .2s, box-shadow .2s; animation: pop .35s both; }
.prod:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.prod:active { transform: scale(.96); }
.prod .pic { flex: none; width: 100%; aspect-ratio: 4/3; background: linear-gradient(135deg, color-mix(in srgb, var(--h) 70%, #000) , color-mix(in srgb, var(--h) 35%, #000)); display: grid; place-items: center; font-size: 30px; font-weight: 800; color: rgba(255, 255, 255, .9); overflow: hidden; }
.prod .pic img { width: 100%; height: 100%; object-fit: cover; }
.prod .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.prod .nm { font-weight: 700; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.prod .pr { font-weight: 800; font-size: 16px; }
.prod .pr s { color: var(--faint); font-weight: 500; font-size: 12px; margin-inline-start: 6px; }
.prod .stock { position: absolute; top: 8px; inset-inline-start: 8px; }
.prod .ribbon { position: absolute; top: 8px; inset-inline-end: 8px; background: var(--grad-hot); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 8px; }
.prod .incart { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--grad); color: #fff; min-width: 28px; height: 28px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 13px; box-shadow: var(--glow); padding: 0 6px; }
.products.list { grid-template-columns: 1fr; gap: 6px; }
.products.list .prod { flex-direction: row; align-items: center; }
.products.list .prod .pic { width: 64px; aspect-ratio: 1; font-size: 18px; }
.products.list .prod .info { flex-direction: row; flex: 1; align-items: center; }
.products.list .prod .nm { min-height: 0; flex: 1; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Cart */
.cart { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cart-head { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.cart-head .t { display: flex; align-items: center; gap: 8px; }
.cart-head .t b { font-size: 18px; }
.cart-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.cart-meta .btn { min-height: 36px; font-size: 13px; padding: 6px 10px; }
.lines { flex: 1; overflow-y: auto; padding: 8px; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid transparent; animation: slide .25s both; position: relative; }
.line:hover { background: var(--panel); }
.line.sel { background: var(--panel-2); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.line .nm { font-weight: 700; }
.line .sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.line .tot { font-weight: 800; text-align: end; }
.line .sent { color: var(--ok); }
.qty { display: inline-flex; align-items: center; gap: 2px; background: color-mix(in srgb, var(--bg) 50%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 2px; }
.qty button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; font-size: 20px; font-weight: 700; display: grid; place-items: center; }
.qty button:hover { background: var(--panel-2); }
.qty span { min-width: 42px; text-align: center; font-weight: 800; }
@keyframes slide { from { opacity: 0; transform: translateX(-14px); } }
[dir="ltr"] .line { animation-name: slide-ltr; }
@keyframes slide-ltr { from { opacity: 0; transform: translateX(14px); } }
.totals { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--bg) 30%, transparent); }
.totals .r { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.totals .r b { color: var(--text); }
.totals .grand { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.totals .grand span { font-weight: 700; }
.totals .grand b { font-size: 30px; font-weight: 800; }
.cart-actions { padding: 10px 12px 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cart-actions .btn { flex-direction: column; gap: 3px; font-size: 12px; padding: 8px 4px; min-height: 58px; }
.cart-actions .pay { grid-column: 1 / -1; font-size: 20px; min-height: 64px; flex-direction: row; justify-content: space-between; padding: 0 22px; border-radius: 18px; }
.cart-actions .pay b { font-size: 22px; }
.fab-cart { display: none; }
.only-m { display: none !important; }
@media (max-width: 980px) { .only-m { display: inline-flex !important; } }

/* ================= Modals ================= */
.overlay { position: fixed; inset: 0; background: rgba(5, 6, 20, .55); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; animation: fade .2s both; padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .7); animation: rise .28s cubic-bezier(.2, .9, .3, 1.2) both; overflow: hidden; }
.modal.wide { width: min(920px, 100%); }
.modal.xl { width: min(1180px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.modal-h { padding: 18px 22px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.modal-h b { font-size: 18px; flex: 1; }
.modal-b { padding: 18px 22px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 14px 22px; display: flex; gap: 10px; border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; }

/* Payment */
.pay-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.pay-total { padding: 18px; border-radius: 20px; background: var(--grad); color: #fff; box-shadow: var(--glow); position: relative; overflow: hidden; }
.pay-total::after { content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .12); top: -80px; inset-inline-end: -60px; }
.pay-total small { opacity: .85; font-weight: 700; }
.pay-total b { display: block; font-size: 42px; font-weight: 800; margin-top: 4px; }
.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.methods button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.methods button svg { width: 26px; height: 26px; }
.methods button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: var(--glow); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { min-height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); font-size: 22px; font-weight: 800; }
.keypad button:active { transform: scale(.95); background: var(--panel); }
.keypad .k-ok { background: var(--grad); color: #fff; border: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button { flex: 1 0 auto; }
.amount-box { font-size: 34px; font-weight: 800; text-align: center; padding: 10px; border-radius: 16px; border: 2px dashed var(--line-2); }
.splits { display: flex; flex-direction: column; gap: 6px; }
.splits .s { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); }
.change { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.change b { font-size: 26px; color: var(--ok); }
.change.due { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.change.due b { color: var(--warn); }

/* Success burst */
.success { text-align: center; padding: 26px 10px 10px; }
.success .ring { width: 110px; height: 110px; margin: 0 auto 14px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; box-shadow: var(--glow); animation: burst .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.success .ring svg { width: 56px; height: 56px; color: #fff; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .3s forwards; }
@keyframes burst { from { transform: scale(.2); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Toast */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 18px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 700; display: flex; gap: 10px; align-items: center; animation: rise .3s both; max-width: 90vw; }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.toast.ok i { background: var(--ok); }
.toast.bad i { background: var(--bad); }

/* ================= Login ================= */
.login { flex: 1; display: grid; place-items: center; padding: 20px; overflow: auto; }
.login-card { width: min(980px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; }
.login-hero { padding: 40px; background: var(--grad); color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 520px; }
.login-hero h1 { font-size: 40px; margin: 0; line-height: 1.2; }
.login-hero p { opacity: .9; font-size: 16px; line-height: 1.8; }
.login-hero .orb { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.login-side { padding: 30px; display: flex; flex-direction: column; gap: 16px; }
.users { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.users button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 16px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.users button.on { border-color: var(--accent); box-shadow: var(--glow); }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 4px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); transition: .15s; }
.pin-dots i.f { background: var(--grad); border-color: transparent; box-shadow: var(--glow); transform: scale(1.1); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ================= Tables map ================= */
.rooms { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tbl { border-radius: 22px; border: 1px solid var(--line); background: var(--panel); padding: 16px; min-height: 140px; display: flex; flex-direction: column; gap: 6px; text-align: start; position: relative; overflow: hidden; transition: .2s; }
.tbl:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tbl .tn { font-size: 22px; font-weight: 800; }
.tbl .seats { display: flex; gap: 4px; }
.tbl .seats i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.tbl.busy { background: linear-gradient(140deg, color-mix(in srgb, var(--accent-3) 30%, transparent), color-mix(in srgb, var(--accent) 22%, transparent)); border-color: color-mix(in srgb, var(--accent-3) 50%, transparent); }
.tbl.busy .seats i { background: var(--accent-3); }
.tbl .amt { margin-top: auto; font-size: 18px; font-weight: 800; }
.tbl .timer { font-size: 12px; color: var(--muted); }

/* ================= Kitchen ================= */
.kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.ticket { border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); animation: pop .3s both; }
.ticket .th { padding: 12px 16px; display: flex; align-items: center; gap: 8px; background: var(--panel-2); }
.ticket .th b { font-size: 26px; }
.ticket.new .th { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.ticket.preparing .th { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.ticket.ready .th { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.ticket.late { box-shadow: 0 0 0 2px var(--bad), 0 0 30px -5px var(--bad); }
.ticket ul { list-style: none; margin: 0; padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.ticket li { display: flex; gap: 10px; font-size: 16px; }
.ticket li b { min-width: 34px; color: var(--accent-2); font-size: 18px; }
.ticket li small { display: block; color: var(--warn); }
.ticket li.done { opacity: .45; text-decoration: line-through; }
.ticket .tf { padding: 10px 12px 12px; display: flex; gap: 8px; }
.ticket .tf .btn { flex: 1; }

/* ================= Customer display & status board ================= */
.cdisplay { flex: 1; display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; padding: 16px; min-height: 0; }
.cd-brand { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 30px; gap: 14px; position: relative; overflow: hidden; }
.cd-brand .logo { width: 140px; height: 140px; border-radius: 36px; background: var(--grad); display: grid; place-items: center; font-size: 60px; font-weight: 800; color: #fff; box-shadow: var(--glow); overflow: hidden; }
.cd-brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.cd-brand h1 { font-size: 44px; margin: 0; }
.cd-cart { display: flex; flex-direction: column; min-height: 0; }
.cd-cart .lines { font-size: 18px; }
.cd-total { padding: 24px; text-align: center; }
.cd-total b { display: block; font-size: 64px; font-weight: 800; }
.board { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; min-height: 0; }
.board section { display: flex; flex-direction: column; min-height: 0; }
.board h1 { margin: 0; padding: 20px 24px; font-size: 34px; display: flex; align-items: center; gap: 12px; }
.board .nums { flex: 1; overflow: hidden; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 0 20px 20px; align-content: start; }
.board .n { border-radius: 22px; padding: 18px; text-align: center; font-size: 54px; font-weight: 800; background: var(--panel-2); border: 1px solid var(--line); animation: pop .4s both; }
.board .ready .n { background: color-mix(in srgb, var(--ok) 20%, transparent); border-color: color-mix(in srgb, var(--ok) 50%, transparent); color: var(--ok); animation: pop .4s both, glowp 2s infinite; }
@keyframes glowp { 50% { box-shadow: 0 0 40px -6px var(--ok); } }

/* ================= Dashboard / reports ================= */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); position: relative; overflow: hidden; }
.kpi small { color: var(--muted); font-weight: 700; }
.kpi b { display: block; font-size: 26px; margin-top: 6px; }
.kpi::before { content: ''; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--grad); opacity: .18; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 10px 4px 0; }
.bars div { flex: 1; background: var(--grad); border-radius: 8px 8px 3px 3px; min-height: 3px; position: relative; transition: height .6s; }
.bars div span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.bars div:hover::after { content: attr(data-v); position: absolute; top: -26px; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.hbar { display: flex; flex-direction: column; gap: 10px; }
.hbar .r { display: grid; grid-template-columns: 140px 1fr 90px; gap: 10px; align-items: center; font-size: 14px; }
.hbar .r i { height: 10px; border-radius: 6px; background: var(--grad); display: block; }
.box { padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); }
.box h3 { margin: 0 0 12px; font-size: 16px; }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Settings */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.toggle-row div { flex: 1; }
.toggle-row small { display: block; color: var(--muted); font-size: 12px; }

/* ================= Responsive ================= */
@media (max-width: 1280px) { .pos { grid-template-columns: 84px 1fr 370px; } }
@media (max-width: 980px) {
  .pos { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .cats { flex-direction: row; overflow-x: auto; padding: 6px; }
  .cat { flex: none; width: 76px; }
  .cart { position: fixed; inset: auto 0 0 0; height: 86vh; z-index: 60; border-radius: 26px 26px 0 0; transform: translateY(105%); transition: transform .35s cubic-bezier(.2, .9, .3, 1); background: var(--panel-solid); }
  .cart.open { transform: none; }
  .fab-cart { display: flex; position: fixed; bottom: 16px; inset-inline: 16px; z-index: 55; justify-content: space-between; }
  .pay-wrap { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-hero { min-height: 0; padding: 26px; }
  .login-hero h1 { font-size: 28px; }
  .cdisplay, .board, .split2 { grid-template-columns: 1fr; }
  .topbar .nav { overflow-x: auto; max-width: 52vw; }
  .brand small { display: none; }
}
@media (max-width: 600px) {
  .topbar { margin: 6px 6px 0; padding: 8px; gap: 6px; }
  .view { padding: 6px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .methods { grid-template-columns: repeat(2, 1fr); }
  .brand b { display: none; }
  .topbar .spacer { display: none; }
  .topbar .nav { flex: 1; max-width: none; min-width: 0; scrollbar-width: none; }
  .topbar .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; width: 40px; height: 40px; }
  .page { padding: 10px; }
  .hbar .r { grid-template-columns: 90px 1fr 70px; }
}

/* Hidden print frame */
#printFrame { position: fixed; width: 0; height: 0; border: 0; inset-inline-start: -9999px; }
