/* MQDAR POS — design system. Tokens only; logical properties only (RTL/LTR safe). */
:root {
  --brand: #0B4A7F; --brand-2: #0A365E; --accent: #158F84; --accent-2: #0F766D;
  --bg: #F3F6F9; --surface: #FFFFFF; --raised: #F8FAFC; --line: #E2E8EF; --line-2: #C9D5E1;
  --ink: #0F2A44; --ink-2: #33495F; --muted: #61748A; --sel: #E7F0F8;
  --ok: #1E7F4F; --ok-soft: #E2F3EA; --warn: #B45309; --warn-soft: #FDF0DC; --bad: #C0392B; --bad-soft: #FBE9E7; --info: #1B6FB0; --info-soft: #E4F0FA;
  --shadow: 0 1px 2px rgba(15,42,68,.06), 0 4px 14px rgba(15,42,68,.06);
  --shadow-lg: 0 12px 40px rgba(15,42,68,.18);
  --r: 14px; --r-sm: 10px; --top-h: 60px; --nav-w: 84px;
  --font: 'Almarai', 'Noto Naskh Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num: 'Almarai', system-ui, sans-serif;
  --lh: 1.5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #5FAEEA; --brand-2: #0A365E; --accent: #2FD1C0; --accent-2: #22B3A4;
    --bg: #0B1622; --surface: #101E30; --raised: #14263B; --line: #1E3350; --line-2: #2B4867;
    --ink: #EAF2FB; --ink-2: #C4D3E3; --muted: #9BB0C7; --sel: #173A57;
    --ok: #3ECB86; --ok-soft: #123322; --warn: #E8A94A; --warn-soft: #3A2B12; --bad: #FF7A6B; --bad-soft: #3A1613; --info: #5FAEEA; --info-soft: #122C42;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #5FAEEA; --brand-2: #0A365E; --accent: #2FD1C0; --accent-2: #22B3A4;
  --bg: #0B1622; --surface: #101E30; --raised: #14263B; --line: #1E3350; --line-2: #2B4867;
  --ink: #EAF2FB; --ink-2: #C4D3E3; --muted: #9BB0C7; --sel: #173A57;
  --ok: #3ECB86; --ok-soft: #123322; --warn: #E8A94A; --warn-soft: #3A2B12; --bad: #FF7A6B; --bad-soft: #3A1613; --info: #5FAEEA; --info-soft: #122C42;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
/* Urdu: Nastaliq needs more vertical room; numbers stay in the UI font for legibility. */
:root[lang="ur"] { --font: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', 'Almarai', system-ui, sans-serif; --lh: 2.05; }
:root[lang="en"] { --font: 'Almarai', system-ui, -apple-system, 'Segoe UI', sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: var(--lh);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .money, input[inputmode="decimal"], input[inputmode="numeric"] { font-family: var(--num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
:root[lang="ur"] .num, :root[lang="ur"] .money { line-height: 1.4; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; user-select: none; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.go { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.go:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.lg { min-height: 56px; font-size: 17px; padding: 0 22px; border-radius: var(--r); }
.btn.xl { min-height: 64px; font-size: 20px; border-radius: var(--r); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; }
.ic { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[dir="rtl"] .ic.flip { transform: scaleX(-1); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 700; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input.err { border-color: var(--bad); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 13px; }
.err-text { color: var(--bad); font-size: 13px; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--raised); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.notice { padding: 12px 14px; border-radius: var(--r-sm); background: var(--info-soft); color: var(--ink-2); font-size: 14px; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: 12px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
:root[lang="ur"] h1, :root[lang="ur"] h2, :root[lang="ur"] h3 { line-height: 1.9; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table.dt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dt th, table.dt td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dt th { background: var(--raised); color: var(--muted); font-size: 12px; font-weight: 800; position: sticky; top: 0; }
table.dt td.wrap { white-space: normal; min-width: 180px; }
table.dt tr:last-child td { border-bottom: 0; }
table.dt tr.click { cursor: pointer; }
table.dt tr.click:hover td { background: var(--sel); }
td.end, th.end { text-align: end; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; grid-template-rows: var(--top-h) 1fr; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--brand); }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: grid; place-items: center; color: #fff; font-weight: 800; }
.top-info { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; }
.top-info b { color: var(--ink); }
.sidenav { background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; overflow-y: auto; }
.nav-i { text-decoration: none; display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; color: var(--muted); font-size: 11.5px; font-weight: 700; cursor: pointer; border: 0; background: none; text-align: center; }
:root[lang="ur"] .nav-i { font-size: 11px; line-height: 1.6; }
.nav-i:hover { background: var(--raised); color: var(--ink); }
.nav-i.on { background: var(--sel); color: var(--brand); }
.nav-i .ic { width: 24px; height: 24px; }
.main { overflow: auto; min-width: 0; }
.view { height: 100%; }
.page { padding: 18px; display: grid; gap: 16px; max-width: 1400px; margin-inline: auto; }
.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 32vw, 440px); height: 100%; min-height: 0; }
.pos-left { display: grid; grid-template-rows: auto auto 1fr; min-height: 0; padding: 14px; gap: 12px; }
.pos-search { position: relative; display: flex; gap: 8px; }
.pos-search .input { min-height: 56px; font-size: 18px; padding-inline-start: 48px; border-radius: var(--r); }
.pos-search .s-ic { position: absolute; inset-inline-start: 14px; top: 17px; color: var(--muted); pointer-events: none; }
.pos-search .btn { min-height: 56px; }
.pos-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pos-chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.results { overflow-y: auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; align-content: start; padding: 2px; }
.p-card { display: grid; grid-template-rows: 1fr auto; gap: 8px; min-height: 112px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); text-align: start; cursor: pointer; box-shadow: var(--shadow); transition: border-color .12s, transform .06s; }
.p-card:hover { border-color: var(--accent); }
.p-card:active { transform: scale(.985); }
.p-card .nm { font-weight: 700; font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:root[lang="ur"] .p-card .nm { line-height: 1.9; font-size: 14px; }
.p-card .ft { display: flex; align-items: end; justify-content: space-between; gap: 6px; }
.p-card .pr { font-weight: 800; font-size: 17px; color: var(--brand); }
.p-card .st { font-size: 12px; color: var(--muted); }
.p-card .st.out { color: var(--bad); font-weight: 700; }
.p-card.disabled { opacity: .55; }

.cart { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: var(--surface); border-inline-start: 1px solid var(--line); }
.cart-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cart-h .cust { flex: 1; min-width: 0; justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; }
.lines { overflow-y: auto; min-height: 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.line.sel { background: var(--sel); }
.line .nm { font-weight: 700; font-size: 14.5px; }
.line .sub { font-size: 12px; color: var(--muted); }
.line .tot { font-weight: 800; text-align: end; }
.line .ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.qty button { width: 42px; height: 40px; border: 0; background: var(--raised); font-size: 20px; font-weight: 700; cursor: pointer; }
.qty input { width: 64px; height: 40px; border: 0; text-align: center; background: var(--surface); font-weight: 800; outline: none; }
.cart-f { padding: 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; background: var(--raised); }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.sum .k { color: var(--muted); }
.sum .grand { font-size: 24px; font-weight: 800; color: var(--ink); }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pay-btn { min-height: 64px; font-size: 20px; }
.mob-cartbar { display: none; }

/* ---------- modal / sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,20,34,.45); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .12s ease-out; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(900px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-b { padding: 18px; display: grid; gap: 14px; }
.modal-f { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

/* ---------- payment ---------- */
.pay-total { text-align: center; padding: 6px 0 2px; }
.pay-total .v { font-size: 40px; font-weight: 800; color: var(--brand); }
.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.method { min-height: 72px; display: grid; place-items: center; gap: 4px; border-radius: var(--r); border: 2px solid var(--line-2); background: var(--surface); font-weight: 800; cursor: pointer; }
.method.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent-2); }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.pay-input { font-size: 26px !important; text-align: center; min-height: 60px !important; font-weight: 800; }
.paid-list { display: grid; gap: 6px; }
.paid-i { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--raised); }
.change { text-align: center; padding: 10px; border-radius: var(--r); background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 20px; }
.remain { text-align: center; padding: 10px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-weight: 800; font-size: 18px; }

/* ---------- toast ---------- */
.toasts { position: fixed; inset-block-end: 18px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 80; pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--surface); font-weight: 700; box-shadow: var(--shadow-lg); animation: up .18s ease-out; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent), var(--bg); }
.auth-card { width: min(440px, 100%); padding: 26px; display: grid; gap: 16px; }
.auth-card .brand { justify-content: center; font-size: 22px; }
.auth-card .brand .logo { width: 48px; height: 48px; font-size: 22px; }
.langs { display: flex; gap: 6px; justify-content: center; }
.langs button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 700; }
.langs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- gate (register / shift) ---------- */
.gate { display: grid; place-items: center; min-height: 100%; padding: 20px; }
.gate .card { width: min(520px, 100%); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile { padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); text-align: start; cursor: pointer; display: grid; gap: 4px; }
.tile:hover { border-color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi { padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 22px; font-weight: 800; }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
  .results { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 767px) {
  :root { --top-h: 56px; }
  body { font-size: 16px; }
  .app { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr auto; }
  .sidenav { grid-row: 3; flex-direction: row; justify-content: space-around; border-inline-end: 0; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto; }
  .nav-i { padding: 6px 8px; min-width: 64px; }
  .hide-m { display: none !important; }
  .top-info { flex: 1; }
  .top-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.6; }
  .topbar { gap: 8px; padding: 0 10px; }
  #lang { max-width: 92px; }
  .brand .txt { display: none; }
  .page { padding: 12px; }
  .pos { grid-template-columns: 1fr; }
  .pos-left { padding: 10px; padding-bottom: 84px; }
  .results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .p-card { min-height: 104px; }
  .cart { position: fixed; inset: 0; z-index: 40; border: 0; animation: up .18s ease-out; padding-bottom: env(safe-area-inset-bottom); }
  .cart:not(.open) { display: none; }
  .mob-cartbar { display: flex; position: fixed; inset-inline: 10px; inset-block-end: calc(70px + env(safe-area-inset-bottom)); z-index: 30;
    min-height: 60px; border-radius: 16px; background: var(--brand); color: #fff; align-items: center; gap: 12px; padding: 0 18px; font-weight: 800; font-size: 17px; border: 0; box-shadow: var(--shadow-lg); cursor: pointer; }
  .mob-cartbar .cnt { background: rgba(255,255,255,.2); border-radius: 999px; padding: 2px 10px; }
  .overlay { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; animation: up .18s ease-out; }
  .methods { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .input { font-size: 16px; } /* prevents iOS focus zoom */
}
@media (min-width: 768px) { .only-m { display: none !important; } }
@media (max-width: 767px) { .only-d { display: none !important; } }

/* ---------- print ---------- */
#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  body { background: #fff; color: #000; }
}
.rcpt { color: #000; background: #fff; font-family: 'Almarai', 'Noto Naskh Arabic', sans-serif; font-size: 12px; line-height: 1.45; }
.rcpt.w58 { width: 48mm; } .rcpt.w80 { width: 72mm; } .rcpt.wA4 { width: 190mm; font-size: 12.5px; } .rcpt.wA5 { width: 130mm; }
.rcpt .c { text-align: center; } .rcpt .b { font-weight: 800; } .rcpt .lg { font-size: 15px; } .rcpt .xl { font-size: 18px; }
.rcpt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.rcpt table { width: 100%; border-collapse: collapse; }
.rcpt td, .rcpt th { padding: 2px 0; vertical-align: top; text-align: start; }
.rcpt .e { text-align: end; white-space: nowrap; }
.rcpt .ln-nm { word-break: break-word; }
.rcpt .ur { font-family: 'Noto Nastaliq Urdu', 'Noto Naskh Arabic', sans-serif; line-height: 2; }
.rcpt.wA4 th { border-bottom: 1px solid #000; } .rcpt.wA4 td { border-bottom: 1px solid #ddd; padding: 5px 4px; } .rcpt.wA4 th { padding: 5px 4px; }
.rcpt-preview { background: #fff; border-radius: 10px; padding: 12px; display: flex; justify-content: center; border: 1px solid var(--line); overflow: auto; }

/* ---------- back-office: sub-tabs, segmented control, compact inputs, statements ---------- */
.subtabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 0; border-bottom: 1px solid var(--line); background: var(--surface); scrollbar-width: none; position: sticky; top: 0; z-index: 5; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex: none; padding: 10px 14px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 800; font-size: 14px; text-decoration: none; white-space: nowrap; }
.subtabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; cursor: pointer; color: inherit; font: inherit; }
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.input.sm { min-height: 38px; padding: 6px 10px; font-size: 14px; }
textarea.input.sm { min-width: 160px; }
table.dt tr.foot td { background: var(--raised); border-top: 2px solid var(--line-2); }
.stmt-line { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.stmt-line.b { font-weight: 800; } .stmt-line.lg { font-size: 18px; }
details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.rcpt img.qr { width: 34mm; height: 34mm; margin: 4px auto; display: block; image-rendering: pixelated; }
.rcpt.wA4 img.qr, .rcpt.wA5 img.qr { width: 36mm; height: 36mm; }
.rcpt .sandbox { border: 1px dashed #000; padding: 3px; margin: 4px 0; }
.page-h { flex-wrap: wrap; }

/* phones: data tables become stacked cards (label from data-label) */
@media (max-width: 767px) {
  .subtabs { padding: 6px 8px 0; }
  table.dt.rt thead { display: none; }
  table.dt.rt, table.dt.rt tbody, table.dt.rt tr, table.dt.rt td { display: block; width: 100%; }
  table.dt.rt tr { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; padding: 6px 4px; background: var(--surface); }
  table.dt.rt td { border: 0; padding: 6px 10px; white-space: normal; display: flex; gap: 10px; justify-content: space-between; align-items: center; text-align: end; min-width: 0; }
  table.dt.rt td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-align: start; flex: none; max-width: 45%; }
  table.dt.rt td[data-label=""]::before { content: none; }
  table.dt.rt td.wrap { min-width: 0; }
  table.dt.rt td .input.sm { max-width: 60%; }
  .tbl-wrap:has(table.dt.rt) { border: 0; background: transparent; overflow: visible; }
}

/* ---------- printing: editor layout, labels ---------- */
.split2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1023px) { .split2 { grid-template-columns: 1fr; } }
pre.code { background: var(--raised); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; max-width: 100%; white-space: pre-wrap; word-break: break-all; }
.labels { color: #000; background: #fff; font-family: 'Almarai', 'Noto Naskh Arabic', sans-serif; }
.labels.roll { display: grid; gap: 6px; }
.labels.sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2mm; width: 198mm; }
.labels .label { border: 1px dashed #bbb; padding: 1.5mm; display: grid; justify-items: center; gap: .5mm; overflow: hidden; break-inside: avoid; page-break-inside: avoid; }
.labels.pL50x30 .label { width: 50mm; height: 30mm; } .labels.pL40x25 .label { width: 40mm; height: 25mm; } .labels.pL38x25 .label { width: 38mm; height: 25mm; }
.labels.sheet .label { height: 33.9mm; }
.labels .ln { font-size: 9pt; font-weight: 700; line-height: 1.2; text-align: center; max-height: 2.4em; overflow: hidden; }
.labels .ln.en { font-size: 7pt; font-weight: 400; }
.labels svg.bc { max-width: 100%; height: auto; max-height: 14mm; }
.labels .lf { display: flex; gap: 3mm; justify-content: center; font-size: 8pt; }
@media print { .labels .label { border: 0; } .labels.roll { gap: 0; } .labels.roll .label { page-break-after: always; } }

/* ---------- offline mode + notifications (phases 18/19) ---------- */
.net { min-height: 40px; padding: 0 10px; gap: 6px; font-size: 12.5px; font-weight: 700; white-space: nowrap; flex: none; }
.net .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.net.ok .dot { background: var(--ok); } .net.warn .dot { background: var(--warn); } .net.bad .dot { background: var(--bad); } .net.info .dot { background: var(--info); }
.net.bad { color: var(--bad); } .net.warn { color: var(--warn); }
.bell { position: relative; flex: none; }
.bell .cnt { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.bell .cnt[hidden] { display: none; }
.tile.unread { border-inline-start: 4px solid var(--info); }
.rcpt.provisional .doc-title { border: 2px dashed var(--warn); padding: 6px; text-align: center; font-weight: 800; }
@media (max-width: 767px) {
  .net .txt { display: none; } .net { padding: 0 8px; min-height: 40px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 6px; } .topbar > .spacer { display: none; } .topbar .icon-btn { width: 40px; min-width: 40px; padding: 0; } #lang { max-width: 80px; }
}
