/* JML demo — Arabic RTL, mobile-first, light/dark tokens. */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #e2e7ee;
  --border-2: #cfd7e2;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #74818f;
  --primary: #0f3b66;
  --primary-2: #164f86;
  --primary-ink: #ffffff;
  --primary-soft: #e7eff8;
  --accent: #c2410c;
  --good: #15803d;
  --good-soft: #e6f5eb;
  --warn: #9a5507;
  --warn-soft: #fdf2df;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --info: #1d5fae;
  --info-soft: #e7f0fb;
  --wa: #1d9e50;
  --s1: #2a78d6;
  --s2: #eb6834;
  --grid: #e8ecf1;
  --axis: #c3cbd6;
  --wa-wall: #ece5dc;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
  --radius: 14px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1015; --surface: #171b22; --surface-2: #1d222b; --border: #2a313c; --border-2: #3a4351;
    --text: #eef2f7; --text-2: #b8c2cf; --muted: #8b96a6;
    --primary: #3a7bd5; --primary-2: #4b8be0; --primary-ink: #ffffff; --primary-soft: #1a2a3f; --accent: #f07a3a;
    --good: #3fb56b; --good-soft: #14281c; --warn: #e3a336; --warn-soft: #2c2312; --bad: #f06a6a; --bad-soft: #331b1c;
    --info: #6aa5ef; --info-soft: #172840; --wa: #22b45e; --s1: #3987e5; --s2: #d95926; --grid: #252b35; --axis: #3a4351;
    --wa-wall: #0b141a; --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1015; --surface: #171b22; --surface-2: #1d222b; --border: #2a313c; --border-2: #3a4351;
  --text: #eef2f7; --text-2: #b8c2cf; --muted: #8b96a6;
  --primary: #3a7bd5; --primary-2: #4b8be0; --primary-ink: #ffffff; --primary-soft: #1a2a3f; --accent: #f07a3a;
  --good: #3fb56b; --good-soft: #14281c; --warn: #e3a336; --warn-soft: #2c2312; --bad: #f06a6a; --bad-soft: #331b1c;
  --info: #6aa5ef; --info-soft: #172840; --wa: #22b45e; --s1: #3987e5; --s2: #d95926; --grid: #252b35; --axis: #3a4351;
  --wa-wall: #0b141a; --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: #74818f; }
.amt { direction: ltr; unicode-bidi: isolate; display: inline-block; font-variant-numeric: tabular-nums; }
.mono { direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bad { color: var(--bad); }
.good-txt { color: var(--good); }
.ic { flex: none; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .5px; direction: ltr; flex: none; }
.logo.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt small { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.loc-chip { display: none; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 10px; border-radius: 99px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); cursor: pointer; color: var(--text-2); }
.uc-txt { display: none; flex-direction: column; line-height: 1.2; text-align: start; }
.uc-txt b { color: var(--text); font-size: 13px; }
.uc-txt small { font-size: 11px; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 13px; }
.sidebar { display: none; }
.main { padding: 16px 16px 100px; max-width: 1180px; margin: 0 auto; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); padding: 4px 0; background: none; border: 0; cursor: pointer; }
.bn-item.on { color: var(--primary); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; margin-bottom: 2px; text-align: start; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.as-btn { background: none; border: 0; cursor: pointer; font: inherit; }
.soon { margin-inline-start: auto; font-style: normal; font-size: 11px; color: var(--accent); border: 1px solid currentColor; padding: 0 7px; border-radius: 99px; }
.side-foot { font-size: 12px; color: var(--muted); padding: 8px 12px; }
.side-foot a { color: var(--primary); text-decoration: underline; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8, 12, 20, .45); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); max-height: 82vh; overflow: auto; }
.sheet-grip { width: 40px; height: 4px; background: var(--border-2); border-radius: 4px; margin: 0 auto 10px; }

@media (min-width: 720px) {
  .loc-chip { display: inline-flex; }
  .uc-txt { display: flex; }
}
@media (min-width: 1000px) {
  .app.authed { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
  .topbar { grid-column: 1 / -1; }
  .sidebar { display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 61px; height: calc(100vh - 61px); padding: 14px 12px; border-inline-end: 1px solid var(--border); background: var(--surface); }
  .bottomnav { display: none; }
  .main { padding: 24px 28px 48px; width: 100%; }
}

/* ---------- page parts ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.3; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.ph-with-back { display: flex; align-items: center; gap: 10px; }
.page.narrow { max-width: 560px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-title { margin: 0 0 10px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; background: var(--primary-soft); color: var(--primary); border-radius: 99px; padding: 0 8px; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 18px; }
.empty.small { padding: 10px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.lbl { font-size: 12.5px; color: var(--muted); margin: 2px 0 6px; font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.grid3, .two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.grid3 > .card, .two-col > .card { margin: 0; }
@media (min-width: 900px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (min-width: 1100px) { .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: 14px; border-radius: 10px; }
.btn.xl { min-height: 54px; font-size: 17px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.input { width: 100%; min-width: 0; max-width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface); }
.input:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--text-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.check input { width: 20px; height: 20px; }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; padding: 4px; padding-inline-start: 12px; margin-bottom: 12px; }
.search-bar:focus-within { border-color: var(--primary); }
.search-bar input { flex: 1; min-width: 0; border: 0; min-height: 44px; padding: 0; background: transparent; outline: none; }
.search-bar > .ic { color: var(--muted); }
.search-bar.big input { font-size: 17px; }
select.mini { min-height: 32px; padding: 2px 8px; font-size: 13px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); }
.mini-in { width: 84px; min-height: 36px; padding: 4px 8px; text-align: center; direction: ltr; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); }

/* ---------- chips, badges, segments ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { min-height: 36px; padding: 4px 14px; border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 14px; }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip.outline { border-style: dashed; }
.chip.static { cursor: default; min-height: 30px; font-size: 13px; background: var(--surface-2); }
.chip-sep { width: 1px; background: var(--border); margin: 4px 2px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.used, .badge.warn, .badge.st-preparing { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.good, .badge.st-delivered { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.info, .badge.st-ready { background: var(--info-soft); color: var(--info); border-color: transparent; }
.stock-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.sc { font-size: 12px; padding: 1px 8px; border-radius: 8px; background: var(--good-soft); color: var(--good); white-space: nowrap; }
.sc.zero { background: var(--bad-soft); color: var(--bad); }
.sc.plain { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; color: var(--text-2); padding: 4px 6px; }
.seg button.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .14); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg.tabs { max-width: 480px; margin-bottom: 14px; }
.status-bad { color: var(--bad); }

/* ---------- dashboard ---------- */
.hero { display: flex; flex-direction: column; gap: 4px; }
.hero-label { color: var(--text-2); font-weight: 600; }
.hero-value { font-size: 48px; font-weight: 700; line-height: 1.15; }
.hero-value .amt { font-variant-numeric: normal; }
.hero-split { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); font-size: 14px; }
.hero-split b { color: var(--text); margin-inline-start: 4px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.sw.s1 { background: var(--s1); }
.sw.s2 { background: var(--s2); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpis > .card { margin: 0; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 14px; }
.kpi-label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.kpi-value { font-size: 22px; font-weight: 700; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }
.kpis.three .kpi-value { font-size: 19px; }
.kpi-sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 4px; }
.kpi.link:hover { border-color: var(--primary); }
@media (min-width: 900px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-value, .kpis.three .kpi-value { font-size: 24px; }
}

.guide { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.guide-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.guide-list { margin: 0 0 6px; padding-inline-start: 22px; display: grid; gap: 6px; }
.guide-list a { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- chart ---------- */
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chart-head .card-title { margin-bottom: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); }
.chart-box { position: relative; width: 100%; }
.chart-svg { display: block; direction: ltr; overflow: visible; }
.chart-svg .grid line { stroke: var(--grid); stroke-width: 1; }
.chart-svg .baseline { stroke: var(--axis); stroke-width: 1; }
.chart-svg text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-svg .xlabel { text-anchor: middle; }
.chart-svg path.s1 { fill: var(--s1); }
.chart-svg path.s2 { fill: var(--s2); }
.chart-svg .hover-band { fill: var(--surface-2); }
.chart-svg .hit { fill: transparent; cursor: pointer; }
.tip { position: absolute; top: 0; z-index: 5; width: 190px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .15); font-size: 13px; pointer-events: none; }
.tip > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tip .tip-total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.tbl .e { text-align: end; white-space: nowrap; }

/* ---------- lists ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row.link:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small, .row-side small { color: var(--muted); font-size: 12.5px; }
.row-main a { color: var(--primary); }
.row-side { display: flex; flex-direction: column; align-items: flex-end; text-align: end; gap: 2px; flex: none; }
.row-side small.bad { color: var(--bad); }
.card.list { padding: 4px 12px; }
.check-row { cursor: pointer; }
.check-row input { width: 20px; height: 20px; flex: none; }
.thumb { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.thumb.used { background: var(--warn-soft); color: var(--warn); }
.thumb.good { background: var(--good-soft); color: var(--good); }
.thumb.sm { width: 36px; height: 36px; border-radius: 10px; }

/* ---------- search results ---------- */
.result { padding: 0; overflow: hidden; }
.result-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rh-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rh-txt small { color: var(--muted); font-size: 12.5px; }
.go { color: var(--muted); }
.vrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.vrow:last-child { border-bottom: 0; }
.vrow-main { flex: 1 1 240px; min-width: 0; }
.vlabel { font-weight: 600; }
.vmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--text-2); }
.vrow-side { display: flex; align-items: center; gap: 12px; }
.price { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.price > .amt { font-weight: 700; font-size: 17px; }
.price small { color: var(--muted); font-size: 12px; }
.vrow-actions { display: flex; gap: 6px; }
.cart-fab { position: fixed; inset-inline-start: 16px; bottom: 86px; z-index: 15; display: inline-flex; align-items: center; gap: 8px; background: var(--primary); color: #fff; padding: 12px 18px; border-radius: 99px; font-weight: 600; box-shadow: 0 8px 24px rgba(15, 59, 102, .35); }
@media (min-width: 1000px) { .cart-fab { bottom: 24px; } }

/* ---------- product ---------- */
.prod-head { display: flex; gap: 16px; }
.ph-img { width: 116px; min-height: 104px; border-radius: 12px; border: 1px dashed var(--border-2); background: repeating-linear-gradient(45deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; flex: none; }
.ph-info { flex: 1; min-width: 0; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.vcard { text-align: start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.vcard.on { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.vc-bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vc-bot > .amt { font-weight: 700; }
.vd-grid { display: grid; gap: 14px; }
@media (min-width: 800px) { .vd-grid { grid-template-columns: 1.3fr 1fr; } }
.dl { margin: 0; display: grid; gap: 6px; }
.dl > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: end; }
.dl.compact > div { padding-bottom: 4px; font-size: 14px; }
.vd-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.pbox { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.pbox small { color: var(--muted); }
.pbox b { font-size: 20px; }
.stock-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.stock-box { border-radius: 12px; padding: 10px 12px; background: var(--good-soft); color: var(--good); display: flex; flex-direction: column; }
.stock-box small { color: inherit; font-size: 12px; }
.stock-box b { font-size: 24px; line-height: 1.3; }
.stock-box.zero { background: var(--bad-soft); color: var(--bad); }
.stock-box.total { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.barcode-row { display: flex; align-items: center; gap: 14px; padding: 12px; background: #fff; border-radius: 12px; border: 1px solid var(--border); color: #111; }
.barcode { width: 190px; height: 52px; fill: #111; flex: none; }
.bc-txt { display: flex; flex-direction: column; }
.bc-txt small { color: #555; }

/* ---------- movements ---------- */
.moves { display: flex; flex-direction: column; margin-bottom: 8px; }
.move { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.move:last-child { border-bottom: 0; }
.mv-qty { min-width: 58px; text-align: center; font-weight: 700; padding: 4px 8px; border-radius: 10px; flex: none; }
.move.in .mv-qty { background: var(--good-soft); color: var(--good); }
.move.out .mv-qty { background: var(--bad-soft); color: var(--bad); }
.mv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv-main small { color: var(--muted); font-size: 12.5px; }
.mv-main a { color: var(--primary); }
.mv-time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ---------- POS ---------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; }
@media (min-width: 1000px) { .pos-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; } }
.picks { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.pick:hover { border-color: var(--primary); }
.pick:disabled { opacity: .5; cursor: not-allowed; }
.pick-main { display: flex; flex-direction: column; min-width: 0; }
.pick-main small { color: var(--muted); font-size: 12.5px; }
.pick-side { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.pick-side small { color: var(--muted); font-size: 12px; }
.pick-side small.bad { color: var(--bad); }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main main x" "qty price price"; align-items: center; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: 0; }
.cl-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.cl-main small { color: var(--muted); font-size: 12.5px; }
.cl-meta { margin-top: 4px; }
.cl-qty { grid-area: qty; display: flex; align-items: center; gap: 6px; }
.cl-qty button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-2); font-size: 18px; cursor: pointer; }
.cl-qty span { min-width: 24px; text-align: center; font-weight: 700; }
.cl-price { grid-area: price; display: flex; flex-direction: column; align-items: flex-end; justify-self: end; }
.cl-price > .amt { font-weight: 700; }
.cl-price small { color: var(--muted); font-size: 12px; }
.cl-x { grid-area: x; }
.cl-warn { grid-column: 1 / -1; color: var(--bad); font-size: 13px; display: flex; align-items: center; gap: 6px; background: var(--bad-soft); padding: 6px 10px; border-radius: 8px; }
@media (min-width: 560px) { .cart-line { grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "main qty price x"; } }
.totals { margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.totals > div { display: flex; justify-content: space-between; }
.totals dt { color: var(--text-2); }
.totals dd { margin: 0; font-weight: 600; }
.totals .grand { font-size: 20px; border-top: 1px solid var(--border); padding-top: 8px; }
.totals .grand dd { font-weight: 700; }
.problems { margin: 0 0 10px; padding: 10px 14px; padding-inline-start: 30px; background: var(--warn-soft); color: var(--warn); border-radius: 10px; font-size: 13.5px; }
.rcv-line { padding: 10px 0; border-bottom: 1px solid var(--border); }
.rcv-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 8px; }
.rcv-fields .field { margin: 0; flex: 1 1 90px; }
.success { display: flex; gap: 12px; align-items: flex-start; border-color: var(--good); background: var(--good-soft); }
.success > .ic { color: var(--good); }
.success ul { margin: 6px 0 10px; padding-inline-start: 18px; }

/* ---------- invoice (receipt) ---------- */
.receipt { background: #fff; color: #111; border-radius: 8px; padding: 18px 16px; margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); font-size: 14px; }
.r-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px dashed #bbb; }
.r-head small { display: block; color: #666; }
.r-head .logo { background: #111; }
.r-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 0; border-bottom: 1px dashed #bbb; font-size: 13px; }
.r-meta span { display: block; color: #666; font-size: 11.5px; }
.r-lines { width: 100%; border-collapse: collapse; margin: 6px 0; }
.r-lines th { font-size: 11.5px; color: #666; font-weight: 600; text-align: start; padding: 6px 0; border-bottom: 1px solid #ddd; }
.r-lines td { padding: 7px 0; border-bottom: 1px dotted #ddd; vertical-align: top; }
.r-lines small { display: block; color: #666; font-size: 11.5px; }
.r-lines .c { text-align: center; white-space: nowrap; padding-inline: 6px; }
.r-lines .e { text-align: end; white-space: nowrap; }
.r-tot { margin: 8px 0 0; }
.r-tot > div { display: flex; justify-content: space-between; padding: 3px 0; }
.r-tot dt small { color: #666; font-size: 11.5px; margin-inline-start: 4px; }
.r-tot dd { margin: 0; font-weight: 600; }
.r-tot .grand { font-size: 18px; font-weight: 700; border-top: 1px dashed #bbb; padding-top: 8px; margin-top: 4px; }
.r-tot .due { color: #b42318; }
.r-foot { text-align: center; color: #666; font-size: 12.5px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #bbb; }

/* ---------- customers, used, handover ---------- */
.alloc { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.alloc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.ucards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 14px; }
.ucard { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ucard.sold { opacity: .55; }
.uc-head { display: flex; align-items: center; gap: 10px; }
.uc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; color: #111; border-radius: 10px; padding: 8px 10px; border: 1px solid var(--border); margin-top: auto; }
.uc-code { display: flex; flex-direction: column; gap: 2px; }
.uc-foot .barcode { width: 140px; height: 34px; }
.order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-head a { color: var(--primary); font-size: 17px; }
.order-cust { color: var(--text-2); margin: 4px 0 8px; }
.order-lines { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.order-lines li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.order-lines small { color: var(--muted); }

/* ---------- previews ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--info-soft); color: var(--info); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.banner b { display: block; }
.wa-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.wa-card { margin: 0; }
.wa-phone { background: var(--wa-wall); border-radius: 12px; padding: 14px; }
.wa-bubble { background: #fff; color: #111; border-radius: 10px; border-start-start-radius: 2px; padding: 8px 10px 6px; font-size: 13.5px; line-height: 1.6; max-width: 94%; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.wa-text { white-space: pre-line; }
.wa-pdf { display: flex; align-items: center; gap: 8px; background: #f0f2f5; border-radius: 8px; padding: 8px; margin-bottom: 6px; font-size: 12.5px; color: #333; }
.wa-meta { font-size: 11px; color: #667781; text-align: end; margin-top: 2px; direction: ltr; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1000px 420px at 50% -10%, var(--primary-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 24px; box-shadow: 0 20px 60px rgba(15, 23, 42, .10); }
.brand-lg { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.brand-lg b { display: block; font-size: 20px; }
.brand-lg small { color: var(--muted); }
.user-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 16px; }
.user-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: start; }
.user-pick:hover { border-color: var(--primary); background: var(--primary-soft); }
.up-txt { flex: 1; display: flex; flex-direction: column; }
.up-txt small { color: var(--muted); }
.fine { font-size: 12.5px; color: var(--muted); margin: 0; }

/* ---------- overlays ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 20, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 18px 18px 0 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } .modal { border-radius: 18px; } }
.scanner-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 16px; }
.scanner { text-align: center; color: #fff; }
.scanner small { color: #bbb; }
.frame { width: 260px; height: 170px; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; position: relative; overflow: hidden; margin: 0 auto 14px; background: linear-gradient(135deg, #2b2f36, #14171c); }
.laser { position: absolute; left: 10px; right: 10px; height: 2px; background: #ff3b30; box-shadow: 0 0 12px #ff3b30; top: 10%; animation: scan 1.1s ease-in-out infinite alternate; }
@keyframes scan { to { top: 88%; } }
.toasts { position: fixed; z-index: 70; bottom: 92px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 520px; }
.toast.good { background: #14532d; }
.toast.bad { background: #7f1d1d; }
@media (min-width: 1000px) { .toasts { bottom: 24px; } }

@media (max-width: 420px) {
  .hero-value { font-size: 40px; }
  .page-head h1 { font-size: 20px; }
  .prod-head { flex-direction: column; }
  .ph-img { width: 100%; min-height: 80px; }
  .stock-box b { font-size: 20px; }
}
@media print {
  body { background: #fff; }
  .topbar, .sidebar, .bottomnav, .no-print, .toasts, .cart-fab { display: none !important; }
  .app.authed { display: block; }
  .main { padding: 0; }
  .receipt { box-shadow: none; border: 0; width: 80mm; margin: 0; padding: 0; font-size: 12px; }
}
