:root {
  --bg: #f6f5f1; --card: #ffffff; --sub: #eceae3; --line: #d9d6cc; --line-strong: #8c9185;
  --ink: #1f2937; --muted: #4b5563;
  --brand: #1f6b43; --brand-strong: #17553a; --brand-soft: #e3f1e8; --on-brand: #ffffff;
  --accent: #e8a317; --accent-soft: #fbefd2; --on-accent: #1b1f1a;
  --warning: #8a5a00; --warning-soft: #fdf1d8;
  --danger: #b3261e; --danger-soft: #fbe9e7; --focus: #1f5fd6;
  --shadow-card: 0 1px 2px rgba(27,31,26,.08); --shadow-pop: 0 12px 32px rgba(27,31,26,.18);
  --sans: "Cairo", "Inter", system-ui, -apple-system, "Noto Sans Arabic", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --receipt-width: 80mm;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #141613; --card: #1d201c; --sub: #262a25; --line: #353a33; --line-strong: #6d7468;
  --ink: #eef0ea; --muted: #a3ab9e;
  --brand: #4fb37f; --brand-strong: #6fc697; --brand-soft: #1c3325; --on-brand: #0d1a12;
  --accent: #f0b43a; --accent-soft: #33290f; --on-accent: #141613;
  --warning: #f0b43a; --warning-soft: #3a2e14;
  --danger: #ff8a80; --danger-soft: #3a1e1c; --focus: #7fb0ff;
  --shadow-card: 0 1px 2px rgba(0,0,0,.5); --shadow-pop: 0 12px 32px rgba(0,0,0,.6);
  color-scheme: dark; } }

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.6; font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
bdi { unicode-bidi: isolate; }
.code { font-family: var(--mono); font-size: 13px; direction: ltr; unicode-bidi: isolate; color: var(--muted); }
.muted { color: var(--muted); }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
h1, h2, h3 { margin: 0; line-height: 1.35; text-wrap: balance; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, transform .06s; touch-action: manipulation; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); filter: brightness(.94); }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: 'جارٍ…'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font-size: 15px; }
.btn-primary.is-busy::after { color: var(--on-brand); }
.btn:hover { background: var(--sub); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { min-height: 56px; font-size: 18px; padding: 0 24px; }
.btn-sm { min-height: 44px; min-width: 44px; padding: 0 12px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.input, select.input, textarea.input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); }
textarea.input { padding: 8px 12px; min-height: 72px; }
.input-code { font-family: var(--mono); direction: ltr; text-align: right; letter-spacing: .03em; }
/* a barcode or an item name: Arabic types right to left, a number keeps its digits in order */
.input-find { text-align: right; unicode-bidi: plaintext; }
.input-code::placeholder { font-family: var(--sans); letter-spacing: 0; }
label.f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; min-width: 0; }
.chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 6px; font-size: 12px; line-height: 22px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--brand-soft); color: var(--brand); }
.badge-type { background: var(--accent-soft); color: var(--ink); } .badge-type::before { display: none; }
.badge-low { background: var(--warning-soft); color: var(--warning); }
.badge-out, .badge-returned { background: var(--danger-soft); color: var(--danger); }
.money { white-space: nowrap; font-weight: 600; }
.money small { font-weight: 500; font-size: .8em; color: var(--muted); }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top .brand { font-size: 20px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tab { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }
.who { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.net { display: inline-flex; align-items: center; gap: 6px; }
.net i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.net.off i { background: var(--warning); }
.net.off { color: var(--warning); font-weight: 600; }
.main { padding: 16px; max-width: 1440px; margin: 0 auto; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-card); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.panel-head h2 { font-size: 17px; }
.stack { display: grid; gap: 12px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- sale ---------- */
.sale { display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-areas: "scan cart" "catalog cart"; grid-template-rows: auto 1fr; gap: 12px 16px; align-items: start; }
.sale-scan { grid-area: scan; } .sale-catalog { grid-area: catalog; } .cart-panel { grid-area: cart; }
@media (max-width: 960px) { .sale { grid-template-columns: 1fr; grid-template-areas: "scan" "cart" "catalog"; grid-template-rows: auto; } .keys, .sale .btn .kbd { display: none; } }
.scan { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 12px; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--card); transition: background .2s, border-color .2s; }
.scan:focus-within { border-color: var(--focus); }
.scan input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-family: var(--mono); font-size: 18px; letter-spacing: .04em; }
.scan input::placeholder { font-family: var(--sans); font-size: 15px; letter-spacing: 0; color: var(--muted); }
.scan.hit { background: var(--brand-soft); border-color: var(--brand); }
.scan.miss { background: var(--danger-soft); border-color: var(--danger); }
.scan.warn { background: var(--warning-soft); border-color: var(--warning); }
.scan svg { width: 24px; height: 24px; color: var(--muted); flex: none; }
.msg { min-height: 22px; font-size: 13px; font-weight: 600; color: var(--muted); }
.msg.hit { color: var(--brand); } .msg.miss { color: var(--danger); } .msg.warn { color: var(--warning); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; min-height: 108px; padding: 12px; text-align: start; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow-card); cursor: pointer; }
.tile:hover { border-color: var(--brand); }
.tile:active { background: var(--brand-soft); }
.tile .cat { font-size: 12px; color: var(--muted); }
.tile .nm { flex: 1; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.tile .ft { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile.out { opacity: .55; cursor: not-allowed; }
.tiles-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 8px 2px 2px; border-bottom: 2px solid var(--brand-soft); }
.tiles-head:not(:first-child) { margin-top: 10px; }
.tiles-head b { font-size: 16px; color: var(--brand); }
.tiles-head .muted { font-size: 13px; }
.tiles-head .btn { margin-inline-start: auto; }
.chip small { opacity: .7; font-weight: 400; }
.cart-panel { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 960px) { .cart-panel { position: static; } }
.cart { max-height: 44vh; overflow: auto; margin: 0 -4px; padding: 0 4px; }
.cart-empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 44px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line.expired { background: var(--danger-soft); box-shadow: inset 4px 0 0 var(--danger); padding-inline: 8px; border-radius: 8px; }
.line .exp-tag { color: var(--danger); font-weight: 700; font-size: 13px; }
.line .nm { font-weight: 600; overflow-wrap: anywhere; }
.line .meta { font-size: 12px; color: var(--muted); }
.line .tot { min-width: 84px; text-align: end; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.qty button { width: 44px; height: 44px; border: 0; background: var(--sub); font-size: 18px; font-weight: 700; cursor: pointer; }
.qty input { width: 56px; height: 44px; font-size: 17px; border: 0; text-align: center; font-weight: 700; background: var(--card); }
.x { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.x:hover { background: var(--danger-soft); color: var(--danger); }
.totals { display: grid; gap: 4px; }
.totals .r { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); }
.totals .r .money { color: var(--ink); }
.due { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.due .money { font-size: 30px; line-height: 1.2; }
.due .money small { color: inherit; }
.change { color: var(--brand) !important; font-weight: 700; }
.change .money { color: var(--brand) !important; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink); }
.btn-primary .kbd { color: var(--on-brand); border-color: currentColor; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); max-height: 62vh; }
table.t { width: 100%; border-collapse: collapse; }
.t th { position: sticky; top: 0; background: var(--sub); font-size: 13px; font-weight: 600; text-align: start; padding: 8px 12px; white-space: nowrap; z-index: 1; }
.t td { padding: 8px 12px; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.t td.wrap { white-space: normal; min-width: 160px; }
.t .num { text-align: end; }
.t tr.out td { background: var(--danger-soft); }
.t tr.returned td { color: var(--muted); text-decoration: line-through; }
.t tr.returned td:last-child, .t tr.returned td .badge { text-decoration: none; }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.stat .l { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat .v { font-size: 24px; line-height: 1.35; font-weight: 700; }
.stat .h { font-size: 12px; color: var(--muted); }
.stat.brand .v { color: var(--brand); } .stat.warn .v { color: var(--warning); }
.bar { height: 8px; border-radius: 4px; background: var(--brand); min-width: 2px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 20; background: rgba(20,22,19,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 480px; max-width: 100%; max-height: 100%; overflow: auto; padding: 20px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-pop); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.modal.wide { width: 640px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-head h3 { font-size: 20px; }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg .btn { padding: 0 6px; font-size: 14px; }
.big-input { min-height: 52px !important; font-size: 22px; font-weight: 700; }
.err { color: var(--danger); font-weight: 600; font-size: 13px; min-height: 20px; }

/* camera sheet */
.cam { position: relative; aspect-ratio: 4 / 3; max-width: 100%; border-radius: 12px; overflow: hidden; background: #0d0f0c; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.guide { position: absolute; inset: 22% 10%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; transition: border-color .15s; }
.laser { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff5a4e; box-shadow: 0 0 8px #ff5a4e; }
.cam.hit .guide { border-color: #4fe08f; }
.cam .date-guide { inset: 34% 7%; }
.exp-in { display: inline-flex; gap: 4px; align-items: center; width: 100%; }
.exp-in .input { flex: 1; min-width: 92px; direction: ltr; text-align: center; }
.exp-in .btn { padding: 0 8px; flex: none; }
.exp-prev { display: block; font-size: 12px; margin-top: 2px; color: var(--muted); }
.exp-prev.bad { color: var(--danger); }
.cam-status { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- auth / setup ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate .card { width: 440px; max-width: 100%; display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-card); }
.gate .logo { font-size: 30px; font-weight: 700; color: var(--brand); }
.gate ol { margin: 0; padding-inline-start: 20px; font-size: 14px; display: grid; gap: 4px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

#toast { position: fixed; inset-inline: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); z-index: 30; display: flex; justify-content: center; pointer-events: none; }
#toast div { max-width: 560px; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--card); font-weight: 600; box-shadow: var(--shadow-pop); }
#toast div.bad { background: var(--danger); color: #fff; }

/* ---------- receipt (thermal) ---------- */
.receipt { width: var(--receipt-width); max-width: 100%; margin: 0 auto; padding: 4mm 3mm; background: #fff; color: #000; font-family: var(--sans); font-size: 12px; line-height: 1.45; direction: rtl; }
.modal .receipt { box-shadow: 0 0 0 1px var(--line); }
.receipt h2 { font-size: 17px; text-align: center; }
.receipt .c { text-align: center; }
.receipt .bc { width: 86%; margin: 6px auto 0; }
.receipt .bc svg { display: block; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 5px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt th { text-align: start; border-bottom: 1px solid #000; padding: 1px 0; font-weight: 700; }
.receipt td { padding: 1px 0; vertical-align: top; }
.receipt .n { text-align: end; white-space: nowrap; }
.receipt .kv { display: flex; justify-content: space-between; gap: 8px; }
.receipt .grand { font-size: 16px; font-weight: 700; }
.receipt .code { color: #000; font-size: 11px; }
.receipt .stamp { text-align: center; font-weight: 700; border: 2px solid #000; margin: 4px 0; }
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; }
  #print .receipt { width: 100%; padding: 2mm 3mm; }
  html, body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 520px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .main { padding: 12px; }
  .top { padding-inline: 12px; }
  .who .name { display: none; }
}

/* ---------- subscription ---------- */
.sub-banner { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 10px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
.sub-banner.info { background: var(--brand-soft); color: var(--ink); }
.sub-banner.warn { background: var(--warning-soft); color: var(--ink); }
.sub-banner.lock { background: var(--danger-soft); color: var(--ink); }
.sub-banner.lock b { color: var(--danger); }
.sub-banner a { color: var(--brand); font-weight: 600; }
.kvl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
.kvl span { color: var(--muted); }

/* Long links and code on the sign-in cards must wrap on phones instead of widening the page. */
.gate { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.gate .card { min-width: 0; width: min(440px, 100%); }
.gate .card, .gate ol, .gate p { overflow-wrap: anywhere; }
.gate textarea { max-width: 100%; }
.gate .btn { white-space: normal; text-align: center; line-height: 1.4; padding-block: 8px; }

/* Room at the bottom so the host's floating badge never covers the last buttons. */
.main, .gate { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 88px); }

/* QR codes stay black on white in both themes so every camera reads them. */
.qr-box { background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--line); line-height: 0; max-width: 100%; }
.qr-box svg { max-width: 100%; height: auto; }

/* Platform ad at the foot of each receipt: small QR + one line, black on white for thermal paper. */
.receipt .promo { display: flex; align-items: center; justify-content: center; gap: 2mm; margin-top: 2mm; padding-top: 2mm; border-top: 1px dashed #000; font-size: 9px; line-height: 1.35; text-align: start; color: #000; }
.receipt .promo svg { width: 16mm; height: 16mm; flex: none; }

/* a "+ new item" button always at hand (owner and stock keeper); room for it under the content */
details.more { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 14px; }

/* quick sale: big category and item buttons beside a number pad */
#quickBtn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.qs { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 12px; align-items: start; }
@media (max-width: 1200px) and (min-width: 961px) { .qs { grid-template-columns: 1fr; } }
@media (max-width: 960px) { .qs { grid-template-columns: 1fr; } }
.qs-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.qs-head { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 17px; }
.qs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
.qs-btn { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; min-height: 84px; padding: 8px; border: 0; border-radius: 12px; font: inherit; font-weight: 700; font-size: 16px; line-height: 1.3; text-align: center; cursor: pointer; overflow-wrap: anywhere; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.qs-btn small, .qs-btn small * { font-weight: 600; font-size: 13px; color: inherit; opacity: .9; }
.qs-btn:active { transform: translateY(1px); box-shadow: none; }
.qs-btn.item { min-height: 76px; font-size: 15px; }
.qs-btn.out { opacity: .45; }
.qc0 { background: #e8513d; color: #fff; } .qc1 { background: #2f80d1; color: #fff; } .qc2 { background: #2fa84f; color: #fff; }
.qc3 { background: #f2c230; color: #2b2200; } .qc4 { background: #8e5bd0; color: #fff; } .qc5 { background: #f08a24; color: #2b1600; }
.qc6 { background: #1fb5b0; color: #002b2a; } .qc7 { background: #d94c8a; color: #fff; } .qc8 { background: #6b7d8f; color: #fff; }
.qc9 { background: #9bc53d; color: #1d2a00; }
[class*="qc-t"] { padding: 2px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.qs-pad { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 76px; }
@media (max-width: 960px) { .qs-pad { position: static; } }
.qs-num { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); }
.qs-num b { font-size: 26px; direction: ltr; }
.qs-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.qs-keys .btn { min-height: 52px; font-size: 21px; font-weight: 700; padding: 0; }
.qs-keys [data-qa="code"] { font-size: 15px; }
.qs-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qs-acts .btn { min-height: 44px; font-size: 14px; padding: 0 6px; }
.qs-paybar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.qs-paybar .btn { min-height: 60px; font-size: 18px; padding: 0 4px; }
.qs-paybar .qs-card { background: #2f6fb3; border-color: #2f6fb3; color: #fff; }
.qs-paybar .qs-credit { background: #b7791f; border-color: #b7791f; color: #fff; }

/* the quick sale page covers the app; dialogs still open above it */
body.qs-open { overflow: hidden; }
.qs-overlay { position: fixed; inset: 0; z-index: 15; background: var(--bg); display: flex; flex-direction: column; }
.qs-top { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 16px 8px; background: var(--card); border-bottom: 1px solid var(--line); font-size: 18px; }
.qs-top .btn svg { width: 20px; height: 20px; }
.qs-body { flex: 1; overflow: auto; padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 12px 16px; align-items: start; }
.qs-body .cart-panel { position: sticky; top: 0; }
@media (max-width: 960px) { .qs-body { grid-template-columns: 1fr; } .qs-body .cart-panel { position: static; } }

/* customers for credit sales */
.cu-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.cu { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font: inherit; text-align: start; cursor: pointer; }
.cu:hover { border-color: var(--brand); }
.qs-body .cart-panel, .qs-body .qs { grid-area: auto; }

/* held bills */
.hold-row .btn { min-height: 42px; font-size: 14px; padding: 0 8px; }
.btn-attn { border-color: var(--warn, #b7791f); background: #fdf3e1; color: #7a4d00; }
.held { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.held .grow { min-width: 160px; }
.held-name { min-height: 38px; font-weight: 700; }

/* purchases: wider bill dialog, supplier actions */
.modal.xwide { width: 980px; }
td.acts { white-space: nowrap; }
td.acts .btn { min-width: 34px; padding: 0 6px; margin-inline-end: 2px; }

/* selling a whole carton */
.pk-tg { min-height: 26px; padding: 0 8px; font-size: 12px; margin-inline-start: 6px; vertical-align: middle; }
.pk-box { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 8px 12px 12px; margin: 0; }
.pk-box legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
#qsPackBtn[aria-pressed="true"] { background: #b7791f; border-color: #b7791f; color: #fff; }
#packBtn[aria-pressed="true"] { background: #b7791f; border-color: #b7791f; color: #fff; }
.tile .pk-hint { font-size: 12px; color: #8a5a00; font-weight: 600; }

/* product form laid out across a wide screen */
.pf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pf-grid .span2 { grid-column: span 2; } .pf-grid .span3 { grid-column: 1 / -1; }
.qty-row { flex-wrap: nowrap; gap: 6px; } .qty-row > .input { min-width: 0; } .qty-row select { width: auto; flex: none; }
/* how it is bought, right to left: purchase price · pieces per unit · quantity in that unit · total pieces · selling price */
.pf-buy { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--sub, transparent); }
.pf-buy .hint { font-size: 12px; min-height: 1em; }
.pf-buy > * { align-self: start; } .pf-buy div.f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pf-buy .input { min-height: 46px; height: 46px; }
#qTotal { background: transparent; font-weight: 700; }
@media (max-width: 760px) { .pf-buy { grid-template-columns: 1fr 1fr; } }
.pk-box .pk-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .pf-grid, .pk-box .pk-row { grid-template-columns: 1fr; } .pf-grid .span2 { grid-column: auto; } }

/* a full page over the app (purchase bill details) */
.page-ov { z-index: 16; }
.page-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; max-width: 1200px; width: 100%; margin: 0 auto; }
.doc { display: flex; flex-direction: column; gap: 14px; }
.doc-head, .doc-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc .kvl { min-width: 260px; }
.page-acts { flex-wrap: wrap; }
@media print {
  #print .doc { font-size: 12px; color: #000; }
  #print .doc .table-wrap { max-height: none; overflow: visible; border: 0; }
  #print .doc .t th { position: static; }
}

/* ---------- POS buttons: clear order, one tap, and the sale screen fits the window ---------- */
.pay-btn { min-height: 60px; font-size: 21px; font-weight: 700; width: 100%; }
.cart-acts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.cart-acts .btn { padding: 0 8px; font-size: 15px; }
.cart-acts .btn-danger { margin-inline-start: 6px; }
.hold-row { display: none; }
.pk-tg { min-height: 34px; font-size: 13px; }
.qs-acts .btn { min-height: 48px; font-size: 15px; }
.qs-keys .btn { min-height: clamp(48px, 6.4vh, 60px); }
.qs-paybar .btn { min-height: clamp(56px, 7vh, 64px); }
.qs-btn { min-height: clamp(72px, 10vh, 92px); }
@media (min-width: 961px) {
  body.fit #app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.fit .main { flex: 1; min-height: 0; width: 100%; padding-bottom: 12px; }
  body.fit .sale { height: 100%; grid-template-rows: auto minmax(0, 1fr); align-items: stretch; }
  body.fit .sale-catalog { overflow: auto; min-height: 0; align-content: start; padding-inline-end: 4px; }
  body.fit .cart-panel { position: static; height: 100%; min-height: 0; overflow: hidden; }
  body.fit .cart, .qs-body .cart { flex: 1; max-height: none; min-height: 72px; }
  .qs-body { overflow: hidden; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .qs-body .cart-panel { position: static; height: 100%; min-height: 0; overflow: hidden; }
  .qs-body .qs { height: 100%; min-height: 0; align-items: stretch; }
  .qs-body .qs-main { overflow: auto; min-height: 0; padding-inline-end: 4px; }
  .qs-body .qs-pad { position: static; overflow: auto; min-height: 0; gap: 6px; }
}
@media (max-height: 860px) and (min-width: 961px) { .keys, .qs-pad .hint { display: none; } }
@media (max-height: 760px) { .due { padding: 8px 14px; } .due .money { font-size: 24px; } .qs-num b { font-size: 22px; } .qs-num { padding: 4px 12px; } }
@media (min-width: 961px) and (max-width: 1200px) {
  .qs-body { grid-template-columns: 320px minmax(0, 1fr); }
  .qs-body .qs { grid-template-columns: minmax(0, 1fr) 250px; }
  .sale { grid-template-columns: minmax(0, 1fr) 360px; }
}
/* a narrow bill (quick page, or a mid-size screen): the name gets its own row, the controls go under it */
.qs-body .line { grid-template-columns: auto minmax(0, 1fr) 44px; gap: 6px 10px; }
.qs-body .line > :first-child { grid-column: 1 / -1; }
.qs-body .line .tot { text-align: end; }
@media (min-width: 961px) and (max-width: 1500px) {
  .sale .line { grid-template-columns: auto minmax(0, 1fr) 44px; gap: 6px 10px; }
  .sale .line > :first-child { grid-column: 1 / -1; }
  .sale .line .tot { text-align: end; }
}
@media (max-width: 1200px) { .qs-paybar .btn { font-size: 16px; gap: 4px; padding: 0 2px; } }
@media (max-width: 960px) {
  .sale .line { grid-template-columns: auto minmax(0, 1fr) 44px; gap: 6px 10px; }
  .sale .line > :first-child { grid-column: 1 / -1; }
  .sale .line .tot { text-align: end; }
}

/* ---------- quick sale on a touch till: any landscape screen from 800×600 to 1920×1080, no scrolling ---------- */
.qs-overlay { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: contain; }
.qs-overlay input { -webkit-user-select: text; user-select: text; }
.qs-overlay button { touch-action: manipulation; }
.qs-top .qs-clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
@media (orientation: landscape) and (min-width: 761px) {
  .qs-top { padding-block: 6px; min-height: 52px; font-size: clamp(16px, 1.6vw, 20px); }
  .qs-top .btn { min-height: 44px; }
  .qs-body { display: grid; grid-template-columns: clamp(270px, 29vw, 420px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 10px; padding: 10px; overflow: hidden; align-items: stretch; }
  .qs-body .cart-panel { position: static; height: 100%; min-height: 0; overflow: hidden; padding: 12px; gap: 8px; }
  .qs-body .cart { flex: 1; min-height: 0; max-height: none; }
  .qs-body .cart-panel label.row { display: none; }          /* the discount is given from the pad's «خصم» key */
  .qs-body .cart-panel .keys { display: none; }
  .qs-body .qs { display: grid; grid-template-columns: minmax(0, 1fr) clamp(220px, 24vw, 330px); grid-template-rows: minmax(0, 1fr); gap: 10px; height: 100%; min-height: 0; }
  .qs-body .qs-main { overflow: auto; min-height: 0; overscroll-behavior: contain; }
  .qs-body .qs-grid { grid-template-columns: repeat(auto-fill, minmax(clamp(104px, 11vw, 170px), 1fr)); gap: clamp(6px, .7vw, 10px); }
  .qs-body .qs-btn { min-height: clamp(62px, 11.5vh, 110px); font-size: clamp(14px, 1.25vw, 19px); }
  /* the pad fills its column exactly: number, keys, actions and the three payment buttons share the height */
  .qs-body .qs-pad { position: static; display: grid; grid-template-rows: auto 5fr 3fr 1.25fr; gap: clamp(4px, .8vh, 8px); height: 100%; min-height: 0; overflow: hidden; }
  .qs-body .qs-pad > .hint { display: none; }
  .qs-body .qs-num { padding: 2px 12px; }
  .qs-body .qs-num b { font-size: clamp(20px, 3.2vh, 30px); }
  .qs-body .qs-keys, .qs-body .qs-acts { grid-auto-rows: 1fr; min-height: 0; gap: clamp(4px, .8vh, 8px); }
  .qs-body .qs-keys .btn, .qs-body .qs-acts .btn, .qs-body .qs-paybar .btn { min-height: 0; height: 100%; }
  .qs-body .qs-keys .btn { font-size: clamp(18px, 3vh, 28px); }
  .qs-body .qs-acts .btn { font-size: clamp(13px, 1.9vh, 17px); padding: 0 4px; white-space: normal; line-height: 1.2; }
  .qs-body .qs-paybar { min-height: 0; gap: clamp(4px, .8vh, 8px); }
  .qs-body .qs-paybar .btn { font-size: clamp(15px, 2.4vh, 22px); }
  .qs-body .pay-btn { min-height: clamp(48px, 8vh, 64px); }
  .qs-body .cart-acts .btn { min-height: clamp(44px, 6.5vh, 52px); }
  .qs-body .due { padding: clamp(6px, 1vh, 12px) 14px; }
  .qs-body .due .money { font-size: clamp(22px, 4vh, 34px); }
  .qs-body .line { padding: 6px 0; }
}
@media (orientation: landscape) and (min-width: 761px) and (max-height: 640px) {
  .qs-body .cart-panel .panel-head { margin-bottom: 0; }
  .qs-body .totals .r { display: none; }                   /* on 800×600 the total due is enough */
  .qs-body .qs-head { min-height: 32px; }
}
@media (orientation: landscape) and (min-width: 761px) {
  /* compact bill lines on the till: name and total on top, quantity and remove under them */
  .qs-body .line { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 8px; padding: 6px 0; }
  .qs-body .line > :first-child { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
  .qs-body .line > :first-child .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .qs-body .line .meta { display: none; }
  .qs-body .line .tot { grid-column: 3; grid-row: 1; font-weight: 700; }
  .qs-body .line .qty { grid-column: 1; grid-row: 2; }
  .qs-body .line .x { grid-column: 3; grid-row: 2; justify-self: end; }
  .qs-body .line .qty button { width: 40px; height: 40px; }
  .qs-body .line .qty input { height: 40px; width: 48px; }
  .qs-body .cart-panel .panel-head h2 { font-size: 16px; white-space: nowrap; }
  .qs-body .cart-panel .panel-head { flex-wrap: nowrap; align-items: center; }
  .qs-body .qs-main { display: flex; flex-direction: column; }
  .qs-body .qs-head { flex: none; }
}

/* ---------- analysis page charts: one hue per chart, thin marks, 4px rounded tops, 2px gaps ---------- */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-bar: var(--brand); }
@media (prefers-color-scheme: dark) { :root { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; } }
.an-bar { flex-wrap: wrap; }
.an-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.an-net { border-color: var(--brand); }
.delta { display: block; font-size: 13px; color: var(--muted); }
.delta.up { color: var(--brand); } .delta.down { color: var(--danger); }
.an-ins { margin: 10px 0 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: 15px; }
/* big totals (e.g. 1,234,567.000) must fit the KPI box instead of being cut off */
#anBody .stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
#anBody .stat { container-type: inline-size; }
#anBody .stat .v { font-size: clamp(15px, 11.5cqi, 24px); white-space: nowrap; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 12px; }
.viz-cols { display: flex; align-items: flex-end; gap: 2px; height: 190px; padding: 22px 0 22px; border-bottom: 1px solid var(--line-strong); position: relative; }
.viz-col { flex: 1; height: 100%; position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; cursor: default; }
.viz-bar { width: min(100%, 34px); background: var(--viz-bar); border-radius: 4px 4px 0 0; min-height: 1px; }
.viz-bar.neg { background: transparent; border-top: 2px dashed var(--danger); }
.viz-col:hover .viz-bar { filter: brightness(1.15); }
.viz-x { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.viz-v { font-size: 11px; font-weight: 700; color: var(--ink); white-space: nowrap; margin-bottom: 2px; }
.viz-h { display: grid; gap: 6px; }
.viz-hr { display: grid; grid-template-columns: minmax(80px, 34%) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 14px; }
.viz-hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-ht { height: 14px; background: var(--sub); border-radius: 4px; overflow: hidden; }
.viz-hb { display: block; height: 100%; background: var(--viz-bar); border-radius: 0; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.viz-hv { font-variant-numeric: tabular-nums; }
.viz-stack { display: flex; gap: 2px; height: 26px; border-radius: 6px; overflow: hidden; background: var(--card); }
.viz-seg { display: block; min-width: 4px; }
.s-cash { background: var(--viz-1); } .s-card { background: var(--viz-2); } .s-credit { background: var(--viz-3); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 14px; color: var(--ink); }
.viz-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.viz-tip { position: fixed; z-index: 40; pointer-events: none; background: var(--ink); color: var(--card); font-size: 13px; padding: 6px 10px; border-radius: 8px; max-width: 280px; box-shadow: var(--shadow-pop); }
@media print { #print .an-print { font-size: 11px; } #print .an-grid { display: block; } #print .panel { break-inside: avoid; border: 1px solid #999; margin-bottom: 8px; } }
.page-body > *, .an-grid > *, .an-grid .panel { min-width: 0; }
html:has(body.qs-open) { overflow: hidden; }

/* the Settings tab as a gear */
.tab-ico { position: relative; padding: 0 8px; display: inline-flex; align-items: center; }
.gear-ico { width: 34px; height: 34px; display: block; transition: transform .4s; }
.tab-ico:hover .gear-ico, .tab-ico[aria-selected="true"] .gear-ico { transform: rotate(45deg); }
.tab-badge { position: absolute; top: 2px; inset-inline-start: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* the shop's name has the top line to itself (long names fit); the tabs run below it */
.top { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand who" "tabs tabs"; gap: 6px 12px; align-items: center; padding-bottom: 6px; }
.top .brand { grid-area: brand; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: clamp(18px, 2.2vw, 24px); }
.top .tabs { grid-area: tabs; }
.top .who { grid-area: who; margin-inline-start: 0; justify-self: end; }
.top { grid-template-areas: "brand brand" "tabs who"; }
.top .brand { -webkit-line-clamp: 3; }
@media (max-width: 600px) { .top { grid-template-columns: 1fr; grid-template-areas: "brand" "who" "tabs"; } .top .who { justify-self: stretch; justify-content: space-between; } }
.top .brand { text-align: center; justify-self: center; max-width: 100%; }
.danger-zone { margin-top: 8px; padding: 12px; border: 1px dashed var(--danger); border-radius: 12px; display: grid; gap: 6px; justify-items: start; }

/* ================= quick sale, touch-till design: dark bar, photo categories, product cards, bill with payment ================= */
.qs-overlay { background: #eef1f4; }
.qs-overlay .qs-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 8px 14px; min-height: 58px; background: #16212c; color: #e9eef3; border: 0; }
.qs-top .qs-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qs-top .qs-side.end { justify-content: flex-end; }
.qs-overlay .qs-top .btn { background: #1f2d39; border-color: #33424f; color: #e9eef3; min-height: 44px; }
.qs-shop { font-size: clamp(17px, 1.8vw, 22px); font-weight: 800; text-align: center; line-height: 1.2; }
.qs-shop small { display: block; font-size: 12px; font-weight: 500; opacity: .65; }
.qs-overlay .qs-who { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #c9d3dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-dot { width: 9px; height: 9px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61,220,132,.2); flex: none; }
.qs-overlay .qs-top .qs-clock { color: #e9eef3; font-size: 18px; }

.qs-overlay .qs-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 31vw, 430px); grid-template-rows: minmax(0, 1fr); gap: 12px; padding: 12px; overflow: hidden; }
.qs-overlay .qs { display: block; height: 100%; min-height: 0; }
.qs-overlay .qs-main { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; overflow: visible; padding: 0; }
.qs-cats { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 3px; }
.qs-cat { flex: none; display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 6px 8px 6px 14px; border: 0; border-radius: 14px; color: #fff; font: inherit; font-weight: 800; font-size: 15px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); cursor: pointer; touch-action: manipulation; }
.qs-cat img, .qs-ini { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #fff; display: grid; place-items: center; color: #16212c; font-size: 20px; flex: none; }
.qs-cat[aria-pressed="true"] { outline: 3px solid #16212c; outline-offset: 2px; }
.qcall { background: #16212c; }
.qs-tools { display: flex; gap: 8px; flex: none; align-items: center; }
.qs-search { flex: 1; display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: #6a7480; }
.qs-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: #17202a; }
.qs-overlay .qs-tool { min-height: 50px; background: #fff; color: #17202a; }
#qsPadBtn[aria-pressed="true"], #qsPackBtn[aria-pressed="true"] { background: #16212c; border-color: #16212c; color: #fff; }
.qs-msg { flex: none; min-height: 20px; margin: -4px 4px 0; }
.qs-overlay .qs-grid { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(118px, 11.5vw, 165px), 1fr)); gap: 10px; align-content: start; padding: 2px; overscroll-behavior: contain; }
.qs-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 1px solid #dfe3e8; border-radius: 16px; background: #fff; color: #17202a; font: inherit; text-align: center; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); touch-action: manipulation; }
.qs-tile:active { transform: scale(.97); }
.qs-tile.out { opacity: .5; }
.qs-pic { width: 100%; aspect-ratio: 1.35; border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.qs-pic img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.qs-pic.noimg::after, .qs-pic:not(:has(img))::after { content: attr(data-ini); font-size: 34px; font-weight: 800; color: #fff; }
.qs-tile .nm { font-weight: 700; font-size: 14px; line-height: 1.35; min-height: 2.7em; display: grid; place-items: center; overflow-wrap: anywhere; }
.qs-tile .pr { font-weight: 800; color: #1f6b43; font-size: 16px; }
.qs-tile .pr small { color: #6a7480; font-weight: 500; font-size: 11px; }
.qs-stock { position: absolute; top: 12px; inset-inline-start: 12px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #e3f1e8; color: #1f6b43; }
.qs-stock.low { background: #fdf1d8; color: #8a5a00; } .qs-stock.out { background: #fbe9e7; color: #b3261e; }
.qs-pk { position: absolute; top: 12px; inset-inline-end: 12px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: #fff3e0; color: #8a4b00; }
.qs-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; flex: none; }
.qs-overlay .qs-bar .btn { min-height: 58px; flex-direction: column; gap: 2px; padding: 0 4px; font-size: 14px; background: #fff; color: #17202a; white-space: normal; line-height: 1.2; }
.qs-bar .btn i { font-style: normal; font-size: 19px; line-height: 1; }
.qs-overlay .qs-bar .qs-void { color: #c0392b; border-color: #f0c7c2; }
/* the number pad opens over the products */
.qs-overlay .qs-pad { position: fixed; z-index: 18; bottom: 92px; inset-inline-start: 24px; width: min(340px, 92vw); height: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #fff; border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.3); overflow: visible; }
.qs-overlay .qs-pad[hidden] { display: none; }
.qs-overlay .qs-pad > .hint { display: block; margin: 0; }
.qs-overlay .qs-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.qs-overlay .qs-keys .btn { min-height: 56px; height: auto; font-size: 22px; }
.qs-overlay .qs-acts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.qs-overlay .qs-acts .btn { min-height: 48px; height: auto; font-size: 15px; }
/* the bill: payment buttons under the total; hold, cancel and debts live in the bar */
.qs-overlay .cart-panel { position: static; height: 100%; min-height: 0; overflow: hidden; border-radius: 18px; }
.qs-overlay .cart-acts, .qs-overlay #payBtn, .qs-overlay #debtsBtn, .qs-overlay .cart-panel .keys, .qs-overlay .cart-panel label.row { display: none !important; }
.qs-overlay .qs-paybar { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; flex: none; }
.qs-overlay .qs-paybar .btn { min-height: clamp(58px, 8.5vh, 70px); height: auto; border: 0; color: #fff; font-weight: 800; font-size: clamp(16px, 2.3vh, 21px); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.qs-overlay .qs-cash { background: #1f6b43; font-size: clamp(18px, 2.6vh, 23px); } .qs-overlay .qs-card { background: #2f6fb3; } .qs-overlay .qs-credit { background: #b7791f; }
@media (orientation: portrait), (max-width: 760px) {
  .qs-overlay .qs-top { grid-template-columns: auto 1fr auto; }
  .qs-overlay .qs-who, .qs-overlay .qs-top .qs-clock { display: none; }
  .qs-overlay .qs-body { grid-template-columns: 1fr; grid-template-rows: auto; overflow: auto; }
  .qs-overlay .qs, .qs-overlay .qs-main, .qs-overlay .cart-panel { height: auto; }
  .qs-overlay .qs-grid { overflow: visible; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .qs-overlay .qs-bar { grid-template-columns: repeat(3, 1fr); }
}

/* ================= the same look across the app: dark top bar, photos on tiles and category chips ================= */
.top { background: #16212c; border-bottom-color: #16212c; color: #e9eef3; }
.top .brand { color: #ffffff; }
.top .tab { color: #b8c4cf; }
.top .tab:hover { color: #ffffff; }
.top .tab[aria-selected="true"] { background: rgba(255,255,255,.14); color: #ffffff; }
.top .who, .top .who .name { color: #b8c4cf; }
.top .who .btn { background: #1f2d39; border-color: #33424f; color: #e9eef3; }
.top .net span { color: #b8c4cf; }
.tile { padding-top: 8px; }
.tile .t-pic { display: grid; place-items: center; height: 72px; margin: 0 0 4px; border-radius: 10px; overflow: hidden; }
.tile .t-pic img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.tile .t-pic.noimg::after, .tile .t-pic:not(:has(img))::after { content: attr(data-ini); color: #fff; font-size: 26px; font-weight: 800; }
.chip-pic { display: inline-flex; align-items: center; gap: 6px; padding-inline-start: 4px; }
.chip-pic img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #fff; }
.alt-box { display: grid; gap: 4px; } .alt-box > span:first-child { font-size: 13px; font-weight: 600; color: var(--muted); }
.alt-box .chips { display: flex; flex-wrap: wrap; gap: 6px; } .alt-box .chips:empty { display: none; }
.alt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; } .alt-chip button { border: 0; background: none; cursor: pointer; color: var(--danger); font-size: 14px; padding: 0 4px; }
/* sign-in page: what is new, beside the form (below it on a phone) */
.gate-news { gap: 16px; align-content: center; }
@media (min-width: 900px) { .gate-news { grid-template-columns: minmax(0, 440px) minmax(0, 420px); justify-content: center; align-items: start; } }
.news-card { gap: 10px !important; }
.news-head { display: flex; align-items: center; gap: 8px; } .news-head h2 { margin: 0; font-size: 20px; }
.new-tag { display: inline-block; background: #e8a317; color: #1b1f1a; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.news-list li { display: grid; gap: 2px; padding-inline-start: 14px; border-inline-start: 3px solid var(--brand); }
.news-list b { font-size: 15px; } .news-list span { font-size: 13px; color: var(--muted); }
/* barcode labels (printed on a label roll or an A4 sheet of 3×8) */
.lbl-sheet { --lw: 40mm; --lh: 30mm; }
.lbl { width: var(--lw); height: var(--lh); box-sizing: border-box; padding: 1.2mm 2mm; background: #fff; color: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3mm; overflow: hidden; font-family: var(--sans); direction: rtl; text-align: center; break-inside: avoid; }
.lbl-shop { font-size: 6.5pt; line-height: 1.1; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-name { font-size: 8pt; line-height: 1.15; font-weight: 700; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl-bc { width: 100%; flex: 1 1 auto; min-height: 7mm; max-height: 14mm; }
.lbl-bc svg { display: block; width: 100%; height: 100%; }
.lbl-num { font-family: var(--mono); font-size: 7pt; line-height: 1; letter-spacing: .08em; direction: ltr; }
.lbl-price { font-size: 10pt; line-height: 1.1; font-weight: 800; } .lbl-price small { font-size: 6.5pt; font-weight: 600; }
.lbl-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; background: var(--sub); border-radius: 12px; }
.lbl-preview .lbl { box-shadow: 0 1px 4px rgba(0,0,0,.25); border-radius: 2mm; }
@media print {
  #print .lbl-sheet:not(.lbl-a4) .lbl { break-after: page; page-break-after: always; }
  #print .lbl-sheet:not(.lbl-a4) .lbl:last-child { break-after: auto; page-break-after: auto; }
  #print .lbl-a4 { display: grid; grid-template-columns: repeat(3, 70mm); grid-auto-rows: 37mm; width: 210mm; }
  #print .lbl-a4 .lbl:nth-child(24n) { break-after: page; page-break-after: always; }
}
/* live weight from a counter scale */
.w-live { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border: 2px dashed var(--line-strong); border-radius: 12px; }
.w-live span { font-weight: 600; color: var(--muted); } .w-live b { font-size: 26px; font-variant-numeric: tabular-nums; } .w-live small { color: var(--muted); }
.w-live.ok { border-style: solid; border-color: var(--brand); background: var(--brand-soft); } .w-live.ok b { color: var(--brand); }
.scale-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.w-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; } .w-quick .btn { padding: 0 4px; min-height: 48px; font-size: 16px; }
