/* ================= 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;
  --on-accent: #fff;
  --fx: 1;
  --fs: 15px;
  color-scheme: dark;
}
/* ---- Light themes share these surfaces ---- */
:root[data-theme="classic"], :root[data-theme="ocean"], :root[data-theme="sand"], :root[data-theme="rose"] {
  --bg: #f1f3f8;
  --bg2: #ffffff;
  --panel: rgba(255, 255, 255, .82);
  --panel-2: #ffffff;
  --panel-solid: #ffffff;
  --line: rgba(20, 30, 60, .10);
  --line-2: rgba(20, 30, 60, .20);
  --text: #18203a;
  --muted: #5a6382;
  --faint: #959cb5;
  --ok: #0f9d6b;
  --warn: #c77700;
  --bad: #d63a55;
  --shadow: 0 14px 40px -22px rgba(20, 30, 70, .35);
  color-scheme: light;
}
/* كلاسيكي: flat, white and blue */
:root[data-theme="classic"] {
  --accent: #2563eb; --accent-2: #0ea5e9; --accent-3: #e11d48;
  --grad: #2563eb;
  --grad-hot: #e11d48;
  --glow: 0 6px 18px -8px rgba(37, 99, 235, .55);
  --blur: none; --fx: 0; --r: 12px; --r-sm: 9px;
}
/* محيطي: light teal */
:root[data-theme="ocean"] {
  --bg: #eef6f7;
  --accent: #0e9aa7; --accent-2: #3b82f6; --accent-3: #f97316;
  --grad: linear-gradient(120deg, #0e9aa7, #3b82f6);
  --glow: 0 8px 22px -10px rgba(14, 154, 167, .6);
}
/* رملي: warm beige, terracotta */
:root[data-theme="sand"] {
  --bg: #f5efe6; --panel-2: #fffaf3; --panel-solid: #fffaf3;
  --text: #3a2a1c; --muted: #7b6652; --faint: #b29d87;
  --line: rgba(80, 50, 20, .12); --line-2: rgba(80, 50, 20, .22);
  --accent: #c2410c; --accent-2: #a16207; --accent-3: #9f1239;
  --grad: #c2410c; --grad-hot: #9f1239;
  --glow: 0 6px 18px -8px rgba(194, 65, 12, .5);
  --blur: none; --fx: 0; --r: 14px;
}
/* وردي: soft pink and violet */
:root[data-theme="rose"] {
  --bg: #fbf1f5;
  --accent: #db2777; --accent-2: #8b5cf6; --accent-3: #f59e0b;
  --grad: linear-gradient(120deg, #db2777, #8b5cf6);
  --glow: 0 8px 22px -10px rgba(219, 39, 119, .55);
}
/* جرافيت: neutral dark grey, orange, flat */
:root[data-theme="graphite"] {
  --bg: #17181b; --bg2: #1e2024;
  --panel: #212328; --panel-2: #2a2d33; --panel-solid: #23262b;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --text: #f1f2f4; --muted: #a2a7b0; --faint: #6f747d;
  --accent: #f97316; --accent-2: #facc15; --accent-3: #ef4444;
  --grad: #f97316; --grad-hot: #ef4444;
  --glow: 0 6px 18px -8px rgba(249, 115, 22, .55);
  --blur: none; --fx: 0; --r: 10px; --r-sm: 8px;
}
/* ملكي: black and gold */
:root[data-theme="royal"] {
  --bg: #0b0a08; --bg2: #14120e;
  --panel: rgba(255, 245, 220, .045); --panel-2: rgba(255, 245, 220, .08); --panel-solid: #17150f;
  --line: rgba(230, 190, 110, .14); --line-2: rgba(230, 190, 110, .28);
  --text: #f6efe0; --muted: #b9ab8c; --faint: #7d7258;
  --accent: #d4a64a; --accent-2: #f3d58a; --accent-3: #c0573e; --gold: #f3d58a;
  --grad: linear-gradient(120deg, #a87a2a, #e8c470 55%, #b88a36);
  --grad-hot: linear-gradient(120deg, #c0573e, #d4a64a);
  --glow: 0 0 0 1px rgba(212, 166, 74, .35), 0 10px 34px -12px rgba(212, 166, 74, .5);
  --on-accent: #1a1408;
}
/* غروب */
: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);
}
/* تباين عالي: easy to read in bright places */
:root[data-theme="contrast"] {
  --bg: #000; --bg2: #000;
  --panel: #0c0c0c; --panel-2: #161616; --panel-solid: #0c0c0c;
  --line: #5a5a5a; --line-2: #9a9a9a;
  --text: #fff; --muted: #e0e0e0; --faint: #b0b0b0;
  --accent: #ffd400; --accent-2: #00e5ff; --accent-3: #ff4d6d;
  --ok: #3dff8b; --warn: #ffb000; --bad: #ff4d6d;
  --grad: #ffd400; --grad-hot: #ff4d6d;
  --glow: 0 0 0 2px #ffd400;
  --on-accent: #000;
  --blur: none; --fx: 0; --r: 10px; --r-sm: 8px;
}

/* Per-device display preferences */
:root[data-density="compact"] { --fs: 14px; }
:root[data-density="large"] { --fs: 17px; }

* { 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: var(--fs);
  user-select: none;
  overscroll-behavior: none;
}
/* Mobile browsers: real visible height (address bar aware) */
@supports (height: 100dvh) { html, body { height: 100dvh; } }
/* Prevent iOS zoom when focusing inputs */
@media (pointer: coarse) { .input, select.input, textarea.input { font-size: 16px; } }
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; }

/* Background glow */
.bg-fx { 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); }
.bg-fx i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); opacity: .22; animation: float 22s ease-in-out infinite alternate; }
.bg-fx i:nth-child(1) { background: var(--accent); top: -18vmax; inset-inline-start: -10vmax; }
.bg-fx i:nth-child(2) { background: var(--accent-2); bottom: -20vmax; inset-inline-end: -8vmax; animation-delay: -7s; }
.bg-fx i:nth-child(3) { background: var(--accent-3); top: 30%; left: 40%; width: 26vmax; height: 26vmax; opacity: .12; animation-delay: -12s; }
:root[data-theme="ocean"] .bg-fx i, :root[data-theme="rose"] .bg-fx i { opacity: .13; }
:root[data-theme="royal"] .bg-fx i { opacity: .12; }
:root[data-theme="classic"] .bg-fx, :root[data-theme="sand"] .bg-fx, :root[data-theme="graphite"] .bg-fx, :root[data-theme="contrast"] .bg-fx { background: var(--bg); }
:root[data-theme="classic"] .bg-fx i, :root[data-theme="sand"] .bg-fx i, :root[data-theme="graphite"] .bg-fx i, :root[data-theme="contrast"] .bg-fx i, :root[data-motion="off"] .bg-fx i { display: none; }
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
@media (prefers-reduced-motion: reduce) { .bg-fx i { animation: none; } }
@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: var(--on-accent); box-shadow: var(--glow); }
.btn.hot { background: var(--grad-hot); border: 0; color: var(--on-accent); }
.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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: color-mix(in srgb, var(--accent) 9%, 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; } }

/* ---- Cashier additions ---- */
.toolbar .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .sort { width: auto; min-width: 150px; padding-block: 8px; }
.search [data-t="clearq"] { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 6px; }
.search [data-t="clearq"] svg { position: static; transform: none; width: 16px; height: 16px; }
.cat .ic .ini { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--h) 75%, #000), color-mix(in srgb, var(--h) 40%, #000)); }
.cat.on .ic .ini { background: transparent; color: var(--on-accent); }
.cat .ic svg { width: 24px; height: 24px; }
.cat-sep { display: block; height: 1px; background: var(--line); margin: 2px 8px; flex: none; }
.prod .fav { position: absolute; top: 8px; inset-inline-end: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: var(--gold); }
.prod .fav svg { width: 15px; height: 15px; fill: currentColor; }
.prod { touch-action: manipulation; -webkit-touch-callout: none; }
:root[data-card="s"] .products { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
:root[data-card="s"] .prod .pic { aspect-ratio: 16/10; font-size: 22px; }
:root[data-card="s"] .prod .info { padding: 7px 9px 9px; }
:root[data-card="s"] .prod .nm { font-size: 13px; min-height: 34px; }
:root[data-card="s"] .prod .pr { font-size: 14px; }
:root[data-card="l"] .products { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
:root[data-card="l"] .prod .nm { font-size: 16px; min-height: 44px; }
:root[data-card="l"] .prod .pr { font-size: 19px; }
:root[data-imgs="0"] .products:not(.list) .prod .pic { aspect-ratio: auto; height: 8px; font-size: 0; }
:root[data-imgs="0"] .products:not(.list) .prod .info { padding-top: 12px; }
:root[data-imgs="0"] .products:not(.list) .prod .incart, :root[data-imgs="0"] .products:not(.list) .prod .stock { top: auto; bottom: 8px; }
:root[data-imgs="0"] .products:not(.list) .prod .ribbon, :root[data-imgs="0"] .products:not(.list) .prod .fav { top: 14px; }
.line-ctl { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.line-acts { display: flex; gap: 4px; animation: fade .2s both; }
.line-acts .btn.sm.icon { width: 34px; min-height: 34px; }
.later-row { grid-column: 1 / -1; display: flex; gap: 8px; }
.later-row > * { flex: 1; }
.cart-actions .later-row .btn { flex-direction: row; min-height: 50px; font-size: 14px; gap: 8px; }
.cart-actions .send-later { flex: 2; background: color-mix(in srgb, var(--accent-2) 18%, var(--panel-2)); border-color: color-mix(in srgb, var(--accent-2) 55%, transparent); font-size: 16px; }
.send-later span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.send-later small { font-size: 11px; opacity: .75; font-weight: 600; }
.unpaid-note { flex: 2; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--r-sm); border: 1px dashed var(--warn); color: var(--warn); font-size: 13px; }
.unpaid-note svg { width: 18px; height: 18px; flex: none; }
.pay-ask { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-ask .btn { min-height: 64px; font-size: 16px; }
.held-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qpay { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cart-actions .qpay .btn { flex-direction: row; min-height: 46px; font-size: 14px; gap: 8px; }
.qpay .btn:first-child { background: color-mix(in srgb, var(--ok) 16%, var(--panel-2)); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
kbd { font-family: inherit; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); direction: ltr; }
@media (pointer: coarse) { .qpay kbd, .cart-actions .pay small { display: none; } }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.keys div { display: flex; align-items: center; gap: 10px; }
.keys kbd { min-width: 64px; text-align: center; font-size: 13px; padding: 4px 8px; color: var(--text); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.more-grid .btn { flex-direction: column; min-height: 84px; gap: 8px; white-space: normal; text-align: center; font-size: 13px; }
.more-grid .btn svg { width: 24px; height: 24px; color: var(--accent); }
.pc { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.pc img { width: 140px; height: 140px; object-fit: cover; border-radius: 18px; }
.pc h2 { margin: 0; }
.pc-row { width: 100%; display: flex; justify-content: space-between; padding: 12px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.pc-row b { font-size: 24px; color: var(--accent); }
.cam { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-line { position: absolute; inset-inline: 10%; top: 50%; height: 2px; background: var(--bad); box-shadow: 0 0 12px var(--bad); animation: blink 1.2s infinite; }
/* Theme picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.theme-card { border: 2px solid var(--line); border-radius: 16px; padding: 8px; background: var(--panel-2); display: flex; flex-direction: column; gap: 8px; text-align: start; }
.theme-card.on { border-color: var(--accent); box-shadow: var(--glow); }
.tc-prev { height: 70px; border-radius: 10px; background: var(--bg); position: relative; overflow: hidden; display: block; border: 1px solid rgba(128, 128, 128, .25); }
.tc-prev i { position: absolute; border-radius: 5px; background: var(--sf); }
.tc-prev i:nth-child(1) { inset-block: 8px; inset-inline-start: 8px; width: 14px; }
.tc-prev i:nth-child(2) { top: 8px; inset-inline-start: 28px; width: 34%; height: 24px; }
.tc-prev i:nth-child(3) { top: 8px; bottom: 8px; inset-inline-end: 8px; width: 30%; }
.tc-prev b { position: absolute; bottom: 12px; inset-inline-end: 12px; width: 24%; height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--a), var(--b)); }
.tc-name { font-weight: 700; font-size: 13px; }
[data-pref] button { flex: 1; justify-content: center; }
/* Calmer item placeholders in light / flat themes */
:root:is([data-theme="classic"], [data-theme="ocean"], [data-theme="sand"], [data-theme="rose"]) .prod .pic { background: color-mix(in srgb, var(--h) 22%, var(--panel-2)); color: color-mix(in srgb, var(--h) 70%, #000); }
:root:is([data-theme="royal"], [data-theme="graphite"]) .prod .pic { background: color-mix(in srgb, var(--h) 22%, var(--bg2)); color: color-mix(in srgb, var(--h) 45%, #fff); }
:root[data-theme="royal"] .prod .pic { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--bg2)), var(--bg2)); color: var(--accent-2); }
:root[data-theme="contrast"] .prod .pic { background: #1c1c1c; color: #fff; }
:root:is([data-theme="classic"], [data-theme="ocean"], [data-theme="sand"], [data-theme="rose"]) .cat:not(.on) .ic .ini { background: color-mix(in srgb, var(--h) 22%, var(--panel-2)); color: color-mix(in srgb, var(--h) 70%, #000); }
:root:is([data-theme="royal"], [data-theme="graphite"], [data-theme="contrast"]) .cat:not(.on) .ic .ini { background: transparent; color: var(--accent); }
:root[data-theme="contrast"] .prod { border-width: 2px; }
/* Cart on the other side */
:root[data-cart="start"] .pos { grid-template-columns: 420px 92px 1fr; }
:root[data-cart="start"] .cart { order: -1; }

/* ---- Tables: merge mode, merged groups ---- */
.tbl { cursor: pointer; color: inherit; font: inherit; }
.tbl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tbl.self { opacity: .45; cursor: not-allowed; }
.tbl.grouped { border: 2px solid var(--grp); box-shadow: 0 0 0 4px color-mix(in srgb, var(--grp) 18%, transparent); }
.tlink { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--grp, var(--accent)); }
.tlink svg { width: 14px; height: 14px; }
.tbl .timer svg { width: 13px; height: 13px; vertical-align: -2px; margin-inline-end: 3px; }
.tbl-acts { display: flex; gap: 6px; margin-top: 6px; }
.tbl-acts .btn { min-height: 32px; background: var(--panel-solid); }
.tmap.picking .tbl { transition: transform .15s; }
.tbl.picked { border: 2px solid var(--accent); box-shadow: var(--glow); transform: translateY(-3px); }
.pick-n { position: absolute; bottom: 10px; inset-inline-end: 10px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: var(--on-accent); font-weight: 800; font-size: 14px; }
.merge-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 14px; border-radius: 18px; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: var(--blur); }
.merge-bar b svg { width: 18px; height: 18px; vertical-align: -3px; }
.merge-sel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.mv-row.on { border-color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* ---- QR orders ---- */
.qr-btn { position: relative; }
.qr-btn .badge { position: absolute; top: -2px; inset-inline-end: -2px; background: var(--bad); color: #fff; font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; font-weight: 800; }
.qr-btn.ring svg { color: var(--warn); animation: ring 1.4s infinite; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }
.qr-inbox { display: flex; flex-direction: column; gap: 10px; }
.qr-card { padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.qr-card.pending { border-color: color-mix(in srgb, var(--warn) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 12%, transparent); }
.qr-where { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; }
.qr-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.qr-items li { display: flex; gap: 8px; align-items: baseline; }
.qr-items li > div { flex: 1; min-width: 0; }
.qr-items li > span { color: var(--muted); }
.qr-note { display: block; width: 100%; color: var(--warn); font-size: 13px; }
.qr-done summary { cursor: pointer; color: var(--muted); padding: 8px 0; font-weight: 700; }
.qr-done .qr-card { opacity: .8; margin-top: 8px; }
.qr-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.qr-mode { text-align: start; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; }
.qr-mode small { color: var(--muted); line-height: 1.6; }
.qr-mode.on { border-color: var(--accent); box-shadow: var(--glow); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 14px; }
.qr-tile { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.qr-tile.main { grid-column: 1 / -1; max-width: 560px; }
.qr-svg { background: #fff; padding: 6px; border-radius: 10px; flex: none; }
.qr-svg svg { width: 100%; height: 100%; display: block; }
.qr-tn { font-size: 18px; }
.qr-tile p { margin: 4px 0 8px; }

/* ---- Image editor & images screen ---- */
.ie { display: flex; flex-direction: column; gap: 12px; }
.ie-stage { position: relative; width: min(100%, 520px, calc((100vh - 360px) * 4 / 3)); min-width: min(100%, 260px); margin: 0 auto; aspect-ratio: 4/3; border-radius: 16px; overflow: hidden; background: repeating-conic-gradient(#d9dbe3 0 25%, #f3f4f8 0 50%) 0 0 / 22px 22px; touch-action: none; cursor: grab; outline: none; }
.ie-stage:active { cursor: grabbing; }
.ie-stage canvas { width: 100%; height: 100%; display: block; }
.ie-stage.drop { box-shadow: inset 0 0 0 3px var(--accent); }
.ie-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; color: #5a6382; background: rgba(255, 255, 255, .85); pointer-events: none; }
.ie-empty svg { width: 46px; height: 46px; opacity: .6; }
.ie-stage.has .ie-empty { display: none; }
.ie-grid { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(255, 255, 255, .45) 33.33%, transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .45) 66.66%, transparent calc(66.66% + .5px)), linear-gradient(transparent calc(33.33% - .5px), rgba(255, 255, 255, .45) 33.33%, transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255, 255, 255, .45) 66.66%, transparent calc(66.66% + .5px)); opacity: 0; transition: opacity .2s; }
.ie-stage.has:active .ie-grid { opacity: 1; }
.ie-src, .ie-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ie-src .btn { flex: 1; }
.ie-tools.off { opacity: .4; pointer-events: none; }
.ie-zoom { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; }
.ie-zoom input { flex: 1; accent-color: var(--accent); }
.ie-bg input { width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: transparent; cursor: pointer; }
.img-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.img-stats { margin-bottom: 12px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.img-tile { display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; text-align: center; transition: transform .15s, border-color .2s; }
.img-tile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.img-tile.none { border-style: dashed; }
.img-tile.drop { border: 2px solid var(--accent); box-shadow: var(--glow); }
.img-pic { position: relative; aspect-ratio: 4/3; display: grid; place-items: center; background: color-mix(in srgb, var(--h) 25%, var(--panel-2)); overflow: hidden; }
.img-pic img { width: 100%; height: 100%; object-fit: cover; }
.img-pic i { font-style: normal; font-weight: 800; font-size: 24px; color: color-mix(in srgb, var(--h) 60%, var(--text)); }
.img-hover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; background: rgba(0, 0, 0, .5); color: #fff; font-weight: 700; opacity: 0; transition: opacity .2s; }
.img-tile:hover .img-hover, .img-tile:focus-visible .img-hover { opacity: 1; }
@media (pointer: coarse) { .img-tile.none .img-hover { opacity: .85; background: rgba(0, 0, 0, .35); } }
.img-badge { position: absolute; top: 6px; inset-inline-start: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, .6); color: #fff; }
.img-badge svg { width: 12px; height: 12px; }
.img-badge.web { background: color-mix(in srgb, var(--accent) 85%, #000); color: var(--on-accent); }
.img-stats .chip svg { width: 13px; height: 13px; }
.img-locked { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.img-locked img { width: 100%; max-width: 420px; aspect-ratio: 4/3; object-fit: cover; border-radius: 14px; }
.img-locked p { margin: 0; line-height: 1.8; }
.img-locked svg { width: 16px; height: 16px; vertical-align: -3px; }
.img-name { font-weight: 700; font-size: 13px; padding: 0 8px; line-height: 1.4; }
.img-tile small { padding: 0 8px; font-size: 11px; }

/* ---- LED / VFD customer display preview ---- */
.pole-setup { display: flex; flex-direction: column; gap: 14px; }
.vfd { --w: 20; align-self: center; width: min(100%, calc(var(--w) * 1.25ch + 44px)); padding: 16px 22px; border-radius: 12px; background: #050806; border: 6px solid #1f2326; box-shadow: inset 0 0 22px rgba(0, 0, 0, .9), 0 10px 30px -10px rgba(0, 0, 0, .6); font-family: 'Consolas', 'Courier New', monospace; font-size: clamp(14px, 3.6vw, 22px); letter-spacing: .12ch; color: #3dffb2; text-shadow: 0 0 6px rgba(61, 255, 178, .75); direction: ltr; overflow: hidden; }
.vfd div { white-space: pre; line-height: 1.5; }
.pole-status { flex-wrap: wrap; }

/* ---- Permissions editor ---- */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.perm-group { border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; background: var(--panel); }
.perm-head { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; cursor: pointer; }
.perm-head b { flex: 1; }
.perm { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; font-size: 14px; }
.perm-groups input { width: 18px; height: 18px; flex: none; }
.perm-custom { color: var(--accent); font-style: normal; font-weight: 800; }

/* ---- Printers ---- */
.hero-chip { background: rgba(255, 255, 255, .18); border: 0; color: inherit; }
.hero-chip svg { width: 14px; height: 14px; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.agent { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.agent small { display: block; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.bad { background: var(--bad); }
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.pcard { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.pcard.off { opacity: .55; }
.pc-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); }
.pcard.role-receipt .pc-ic { color: var(--accent-2); }
.pcard.role-collect .pc-ic { color: var(--gold); }
.pc-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pc-b small { display: block; line-height: 1.5; }
.pc-a { display: flex; flex-direction: column; gap: 6px; }
.routes { display: flex; flex-direction: column; gap: 8px; }
.rt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rt > span:first-child { min-width: 130px; font-weight: 700; }
.rt-arrow { color: var(--faint); }
.gtree { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px 0; background: color-mix(in srgb, var(--bg) 40%, transparent); }
.gchk { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.gchk:hover { background: var(--panel-2); }
.gchk input { width: 18px; height: 18px; }
.pe { display: flex; flex-direction: column; gap: 14px; }
.pe .seg { width: 100%; }
.pe .seg button { flex: 1; justify-content: center; white-space: normal; }
.pe-hint { font-size: 13px; margin-top: -4px; }
.steps { line-height: 2; padding-inline-start: 22px; margin: 0; }
.pv { display: grid; place-items: center; background: #e9e9e9; border-radius: 12px; padding: 14px; max-height: 70vh; overflow: auto; }
.pv img { width: 100%; max-width: 360px; background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.plog { overflow: auto; }
@media (max-width: 600px) { .plist { grid-template-columns: 1fr; } .rt > span:first-child { min-width: 90px; } .plog .table th:nth-child(3), .plog .table td:nth-child(3) { display: none; } }

/* ================= 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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: var(--on-accent); 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; }
  :root[data-cart="start"] .pos { grid-template-columns: 370px 84px 1fr; }
  .cart-head .seg button { padding: 6px 4px; font-size: 13px; min-width: 0; gap: 4px; }
  .cart-head .seg button svg { display: none; }
}
/* Tablets in landscape / small laptops */
@media (max-width: 1100px) and (min-width: 981px) {
  .pos, :root[data-cart="start"] .pos { grid-template-columns: 76px 1fr 330px; }
  :root[data-cart="start"] .pos { grid-template-columns: 330px 76px 1fr; }
  .toolbar .sort { display: none; }
  .cat .ic { width: 46px; height: 46px; }
}
@media (max-width: 980px) {
  .pos, :root[data-cart="start"] .pos { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .cats { flex-direction: row; overflow-x: auto; padding: 6px; }
  .cat-sep { width: 1px; height: auto; margin: 8px 2px; }
  .toolbar .sort { display: none; }
  .products { padding-bottom: 90px; }
  .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, :root[data-card="m"] .products { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  :root[data-card="l"] .products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  :root[data-card="s"] .products { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .prod .pic { aspect-ratio: 16/10; font-size: 24px; }
  .prod .info { padding: 8px 10px 10px; }
  .prod .nm { font-size: 13px; min-height: 34px; }
  .cats { gap: 4px; padding: 4px; }
  .cat { width: 66px; padding: 4px 2px; font-size: 11px; gap: 4px; }
  .cat .ic { width: 42px; height: 42px; border-radius: 13px; }
  .toolbar { gap: 6px; padding: 8px; }
  .toolbar .search { min-width: 100%; }
  .toolbar .tools { width: 100%; justify-content: space-between; }
  .toolbar .tools .btn { min-height: 40px; }
  .toolbar .tools .btn.icon { width: 40px; }
  .keys { grid-template-columns: 1fr; }
  .line-acts .btn.sm.icon { width: 38px; min-height: 38px; }
  .cart-head { padding: 10px 12px 8px; gap: 8px; }
  .cart-head .seg button { padding: 6px 4px; font-size: 13px; min-width: 0; gap: 4px; }
  .cart-head .seg button svg { display: none; }
  .totals { padding: 8px 14px; gap: 3px; }
  .totals .grand b { font-size: 24px; }
  .cart-actions { padding: 8px; gap: 6px; }
  .cart-actions .btn { min-height: 46px; }
  .cart-actions .qpay .btn { min-height: 42px; }
  .cart-actions .pay { min-height: 54px; }
  .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; }
}

/* ================= delivery ================= */
.dlv-hint { font-size: 12.5px; color: var(--muted); }
.dlv-hint span { display: inline-flex; align-items: center; gap: 4px; }
.dlv-hint svg { width: 14px; height: 14px; }
.dlv-hint.ok { color: var(--ok); }
.dlv-hint.warn { color: var(--warn); }
.dlv-hint.bad { color: var(--bad); }
.btn.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.btn.warn-b { background: color-mix(in srgb, var(--warn) 18%, transparent); border-color: color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); font-weight: 800; }
.dlv-pick { display: flex; flex-direction: column; gap: 14px; }
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 38vh; overflow: auto; padding: 2px; }
.zone-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); text-align: start; color: inherit; }
.zone-card b { font-size: 14px; }
.zone-card span { color: var(--accent-2); font-weight: 800; }
.zone-card small { font-size: 11px; }
.zone-card.on { border-color: var(--accent); box-shadow: var(--glow); background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); }

/* customers: saved addresses + editor */
.addr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.addr-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; min-width: 0; }
.addr-card:hover { border-color: var(--line-2); }
.addr-card.on { border-color: var(--accent); box-shadow: var(--glow); background: color-mix(in srgb, var(--accent) 14%, var(--panel-2)); }
.addr-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.addr-h svg { width: 16px; height: 16px; color: var(--accent-2); }
.addr-t { font-size: 13px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.addr-act { display: flex; gap: 4px; flex-wrap: wrap; }
.addr-act .btn { min-height: 34px; padding: 6px 10px; }
a.btn { text-decoration: none; color: inherit; }
.cust-row { display: flex; gap: 6px; align-items: stretch; }
.cust-row.on > .btn:first-child { border-color: var(--accent); }
.found-cust { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.found-cust span { flex: 1; min-width: 160px; }
.cust-ed { display: flex; flex-direction: column; gap: 14px; }
.cust-ed .seg { align-self: flex-start; flex-wrap: wrap; }
.cust-ed .seg button { display: inline-flex; align-items: center; gap: 6px; }
.cust-ed [data-p] { display: flex; flex-direction: column; gap: 10px; }
.cust-ed [data-p][hidden] { display: none; }
.cust-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cust-stats .card { padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; }
.cust-stats .card b { font-size: 18px; }
.cust-t tr[data-c] { cursor: pointer; }
.cust-t tr[data-c]:hover td { background: var(--panel-2); }
@media (max-width: 640px) { .cust-t th:nth-child(4), .cust-t td:nth-child(4) { display: none; } .cust-stats { grid-template-columns: 1fr; } }

.dlv-top { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 12px; align-items: stretch; }
.dlv-drivers { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.drv { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); flex: none; min-width: 190px; }
.drv .avatar { width: 38px; height: 38px; font-size: 14px; }
.drv-i { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drv-i small { font-size: 11.5px; }
.drv-i a { color: var(--accent-2); display: inline-flex; align-items: center; gap: 2px; }
.drv-i a svg { width: 12px; height: 12px; }
.dlv-stats { display: flex; gap: 8px; }
.dlv-stats > div { display: flex; flex-direction: column; justify-content: center; padding: 8px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); min-width: 92px; }
.dlv-stats b { font-size: 20px; }
.dlv-stats small { font-size: 11.5px; }
.dlv-selbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.dlv-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dcol { border-radius: 18px; background: var(--panel); border: 1px solid var(--line); min-height: 160px; }
.dcol header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dcol.waiting header { box-shadow: inset 0 3px 0 var(--warn); }
.dcol.assigned header { box-shadow: inset 0 3px 0 var(--accent-2); }
.dcol.out header { box-shadow: inset 0 3px 0 var(--accent); }
.dcol.done header { box-shadow: inset 0 3px 0 var(--ok); }
.dcol-b { padding: 10px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 300px); overflow: auto; }
.dcard { border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); animation: pop .3s both; }
.dcard.late { box-shadow: 0 0 0 2px var(--bad); }
.dcard.failed { opacity: .85; border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.dcard.delivered { opacity: .8; }
.dc-h { display: flex; align-items: center; gap: 6px; padding: 9px 12px 0; flex-wrap: wrap; }
.dc-h b { font-size: 20px; }
.dc-h input { width: 18px; height: 18px; accent-color: var(--accent); }
.dc-b { padding: 6px 12px 8px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.dc-who { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dc-who a { color: var(--accent-2); font-size: 13px; }
.dc-addr { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.dc-drv { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.dc-drv svg, .dc-b .chip svg { width: 14px; height: 14px; }
.dc-f { display: flex; align-items: center; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.dc-f > b { font-size: 16px; }
.dc-sum { display: flex; flex-direction: column; gap: 3px; }
.drv-pick { display: flex; flex-direction: column; gap: 8px; }
.drv-pick .btn { justify-content: flex-start; gap: 12px; }
.settle-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; }
.settle-list > div { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--panel); }
.zones-wrap { display: flex; flex-direction: column; gap: 14px; }
.zones-t td { padding: 6px; }
.zones-t .switch { display: inline-block; vertical-align: middle; }
.zones-t .input { min-width: 70px; }
.zones-t td:first-child .input { min-width: 150px; }

.driver { max-width: 640px; margin: 0 auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.drv-tabs { width: 100%; }
.drv-tabs button { flex: 1; justify-content: center; }
.drv-gps:empty { display: none; }
.drv-gps .chip svg { width: 14px; height: 14px; }
.dcard.big .dc-h b { font-size: 26px; }
.dcard.big .dc-who b { font-size: 18px; }
.dcard.big .dc-addr { font-size: 15px; color: var(--text); }
.drv-collect { display: flex; justify-content: space-between; align-items: center; margin: 0 12px 10px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.drv-collect.cod { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.drv-collect b { font-size: 22px; }
.drv-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; padding: 0 12px 10px; }
.drv-links .btn { justify-content: center; color: inherit; text-decoration: none; }
.drv-acts { display: flex; gap: 8px; padding: 0 12px 12px; }
.drv-acts .btn { flex: 1; justify-content: center; min-height: 56px; font-size: 16px; }
.drv-acts .btn.bad { flex: 0 0 30%; }
.drv-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drv-sum > div { padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; }
.drv-sum b { font-size: 24px; }

@media (max-width: 1100px) { .dlv-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dlv-top { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .dlv-cols { grid-template-columns: 1fr; } .dcol-b { max-height: none; } .dlv-stats { overflow-x: auto; } }

/* Hidden print frame */
#printFrame { position: fixed; width: 0; height: 0; border: 0; inset-inline-start: -9999px; }

/* ---------- barcode sales screen ---------- */
.scan { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 10px; min-height: 0; }
.sc-main { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.sc-bar { display: flex; gap: 8px; padding: 10px; align-items: center; position: relative; z-index: 5; }
.sc-in { flex: 1; position: relative; display: flex; align-items: center; min-width: 0; }
.sc-in > svg { position: absolute; inset-inline-start: 14px; width: 24px; height: 24px; color: var(--accent); pointer-events: none; }
.sc-in .input { height: 56px; font-size: 20px; font-weight: 700; padding-inline-start: 50px; width: 100%; }
.sc-in .input.miss { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 30%, transparent); animation: scShake .3s; }
@keyframes scShake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.sc-drop { position: absolute; top: calc(100% + 6px); inset-inline: 0; max-height: 50vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sc-drop button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--text); padding: 10px 12px; border-radius: 12px; text-align: start; font: inherit; cursor: pointer; }
.sc-drop button b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-drop button:hover, .sc-drop button.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.sc-drop button > .num:last-child { font-weight: 800; }
.sc-drop > div { padding: 8px 12px; font-size: 13px; }
.sc-bar > .btn { min-height: 56px; }
.sc-last { padding: 12px 18px; display: flex; align-items: center; gap: 16px; min-height: 76px; border-inline-start: 4px solid var(--accent); }
.sl-nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sl-nm b { font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-nm small, .sr-nm small { color: var(--muted); font-size: 12px; }
.sl-calc { display: flex; flex-direction: column; align-items: flex-end; }
.sl-calc span { color: var(--muted); font-size: 15px; }
.sl-calc b { font-size: 28px; font-weight: 800; }
.sl-empty { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 17px; }
.sl-empty svg { width: 30px; height: 30px; }
.sc-lines { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.sc-lines > .empty { flex: 1; }
.sr-body { flex: 1; overflow: auto; }
.sr { display: grid; grid-template-columns: 38px minmax(0, 1fr) 128px 90px 80px 100px 40px; gap: 8px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sr-h { font-size: 12px; color: var(--muted); font-weight: 700; cursor: default; padding-block: 10px; background: color-mix(in srgb, var(--bg) 30%, transparent); }
.sr-body .sr:hover { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.sr.sel { background: color-mix(in srgb, var(--accent) 14%, transparent) !important; box-shadow: inset 4px 0 0 var(--accent); }
.sr-nm { display: flex; flex-direction: column; min-width: 0; }
.sr-nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr > b.num { font-size: 16px; }
.sr .qty button { width: 30px; height: 30px; }
.sr .qty span { min-width: 38px; cursor: pointer; }
.sr-ed { border-bottom: 1px dashed var(--line-2); justify-self: start; cursor: pointer; }
.sr-d { color: var(--accent-3); }
.sc-keys { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.sc-keys kbd { margin-inline-end: 4px; }
.sc-side { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.sc-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.sc-head b { font-size: 18px; }
.sc-cust { margin: 0 16px; justify-content: flex-start; }
.sc-cust span { flex: 1; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px; }
.sc-stats > div { border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; }
.sc-stats small { color: var(--muted); font-size: 12px; }
.sc-stats b { font-size: 22px; }
.sc-side .totals { border-bottom: 1px solid var(--line); }
.sc-total { padding: 14px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.sc-total small { color: var(--muted); }
.sc-total b { font-size: 46px; font-weight: 900; line-height: 1.15; }
.sc-acts { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.sc-qp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sc-qp .btn { min-height: 56px; gap: 8px; font-size: 16px; }
.sc-acts .pay { font-size: 20px; min-height: 64px; justify-content: space-between; padding: 0 22px; border-radius: 18px; }
.sc-acts .pay b { font-size: 22px; }
.sc-more { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sc-more .btn { flex-direction: column; gap: 3px; font-size: 12px; padding: 8px 4px; min-height: 56px; }
.sc-acts .later-row { display: flex; gap: 8px; }
.sc-acts .later-row .btn { min-height: 50px; gap: 8px; }
.sc-home { display: flex; align-items: center; gap: 8px; padding: 0 16px 14px; font-size: 12px; color: var(--muted); cursor: pointer; }
.sc-home input { width: 18px; height: 18px; }
.sc-fab { display: none; }
.sc-bar, .sc-last, .sc-keys { flex-shrink: 0; }
.sr-h .sr-d { color: inherit; }
@media (max-width: 1100px) { .scan { grid-template-columns: minmax(0, 1fr) 320px; } .sr { grid-template-columns: 30px minmax(0, 1fr) 118px 80px 90px 36px; } .sr-d { display: none; } .sc-total b { font-size: 38px; } }
@media (max-width: 980px) {
  .scan { grid-template-columns: 1fr; grid-template-rows: auto; overflow: auto; }
  .sc-main { min-height: 0; }
  .sc-lines { min-height: 150px; max-height: 46vh; }
  .scan { padding-bottom: 80px; }
  .sc-fab { display: flex; position: fixed; bottom: 16px; inset-inline: 16px; z-index: 55; justify-content: space-between; }
  .sc-keys { display: none; }
  .sc-side { overflow: visible; }
}
@media (max-width: 600px) {
  .sc-bar { flex-wrap: wrap; }
  .sc-in { flex-basis: 100%; }
  .sc-in .input { height: 50px; font-size: 17px; }
  .sr { grid-template-columns: minmax(0, 1fr) auto 76px; grid-template-areas: "n n del" "q p t"; row-gap: 4px; padding: 8px 10px; }
  .sr > span:first-child, .sr-h { display: none; }
  .sr-nm { grid-area: n; } .sr .qty { grid-area: q; justify-self: start; } .sr [data-f="price"] { grid-area: p; } .sr > b.num { grid-area: t; text-align: end; } .sr [data-del] { grid-area: del; }
  .sl-nm b { font-size: 17px; } .sl-calc b { font-size: 22px; }
  .sc-last { min-height: 0; padding: 10px 12px; }
}
