/* 沙特版前端：配色/字号照 Pen 稿 20261022-沙特线下销售APP.pen
   方向属性一律用 logical（inline-start/end），以后切阿语 RTL 只改 <html dir> */
/* 字体自托管（OFL）：Google Fonts 在国内网络会被重置，别依赖外链 */
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/ibm-plex-sans-400.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-style: normal; font-display: swap; src: url(/fonts/ibm-plex-sans-500.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/ibm-plex-sans-600.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/ibm-plex-sans-700.woff2) format('woff2'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 400 500; font-display: swap; src: url(/fonts/roboto-mono-400.woff2) format('woff2'); }
@font-face { font-family: 'Roboto Mono'; font-weight: 600 700; font-display: swap; src: url(/fonts/roboto-mono-700.woff2) format('woff2'); }
:root {
  --brand: #0E9F8F; --brand-dark: #0B7F73; --brand-bg: #E5F5F3;
  --bg: #F4F6F6; --card: #FFFFFF; --ink: #17322F; --muted: #6B7F7C; --line: #E3EAE9;
  --amber: #B87A00; --amber-bg: #FFF4DC; --amber-line: #E9C77A;
  --green: #1F9254; --green-bg: #E3F5EB; --red: #C2402A; --red-bg: #FDEAE5;
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--brand-dark); text-decoration: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.amber { color: var(--amber); }
.red { color: var(--red); }
.green { color: var(--green); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- 通用件 ---------- */
.card { background: var(--card); border-radius: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; font-weight: 600; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.input { height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); outline: none; width: 100%; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
textarea.input { height: auto; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--bg); color: var(--muted); }
.chip.brand { background: var(--brand-bg); color: var(--brand-dark); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.indigo { background: #EEF0FF; color: #4B4FB8; }
.chip.ink { background: var(--ink); color: #fff; }
.ibox { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.ibox.ok { background: var(--green-bg); color: var(--green); }
.ibox.warn { background: var(--amber-bg); color: var(--amber); }
.ibox.void { background: var(--bg); color: var(--muted); }
.note { display: flex; gap: 8px; padding: 10px 12px; border-radius: 12px; font-size: 12px; line-height: 1.4; }
.note.amber { background: var(--amber-bg); color: var(--amber); }
.note.green { background: var(--green-bg); color: var(--green); }
.note.red { background: var(--red-bg); color: var(--red); }
.note svg.i { width: 16px; height: 16px; margin-top: 1px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.seg { display: flex; height: 40px; padding: 4px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); }
.seg button { flex: 1; border-radius: 16px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }
#toast { position: fixed; inset-inline: 16px; bottom: 96px; margin: 0 auto; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; text-align: center; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; z-index: 50; }
#toast.on { opacity: 1; transform: none; }
.sheet-bg { position: fixed; inset: 0; background: #17322F66; display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet { background: var(--card); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }
.sheet h3 { margin: 0; font-size: 17px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 13px; }
.opts button.on { border-color: var(--brand); background: var(--brand-bg); color: var(--brand-dark); font-weight: 600; }

/* ---------- 登录 / 改密 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; padding: 28px 24px; }
.brandmark { display: flex; align-items: center; gap: 10px; }
.brandmark .mk { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.brandmark b { display: block; font-size: 16px; }
.brandmark small { color: var(--muted); font-size: 12px; }
.auth h1 { margin: 8px 0 0; font-size: 22px; }
.auth p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- 店员端（手机） ---------- */
.m { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.m-body { flex: 1; padding: calc(12px + env(safe-area-inset-top)) 16px 16px; display: flex; flex-direction: column; gap: 20px; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.m-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--brand-bg); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-h { display: flex; justify-content: space-between; align-items: center; }
.sec-h b { font-size: 15px; font-weight: 600; }
.sec-h a, .sec-h button.link { font-size: 13px; font-weight: 500; color: var(--brand-dark); }
.tiles { display: flex; gap: 10px; }
.tile { flex: 1; background: var(--card); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.tile span { font-size: 12px; color: var(--muted); }
.tile b { font-size: 26px; font-weight: 700; }
.tile.hero { background: var(--brand); color: #fff; }
.tile.hero span { color: #ffffffcc; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card); border-radius: 14px; }
.row.warn { box-shadow: inset 0 0 0 1px var(--amber-line); }
.row .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .tx b { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.row .tx small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .tx small.amber { color: var(--amber); }
.row .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--muted); }
.stockrow { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; }
.stockrow + .stockrow { border-top: 1px solid var(--line); }
.stockrow b { font-weight: 600; }
.cta { height: 64px; border-radius: 20px; background: var(--brand); color: #fff; font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 10px 24px #0B7F7340; width: 100%; }
.cta svg.i { width: 24px; height: 24px; }
.cta:disabled { opacity: .5; box-shadow: none; }
.tabbar-wrap { position: sticky; bottom: 0; padding: 4px 16px calc(12px + env(safe-area-inset-bottom)); }
.tabbar { display: flex; height: 60px; padding: 6px; border-radius: 30px; background: #FFFFFFB3; border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 8px 20px #0B7F7326; }
.tabbar a { flex: 1; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--muted); }
.tabbar a svg.i { width: 22px; height: 22px; }
.tabbar a.on { background: var(--brand-bg); color: var(--brand-dark); font-weight: 600; }
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .back { width: 40px; height: 40px; border-radius: 20px; background: var(--card); display: grid; place-items: center; flex: none; }
.topbar b { font-size: 18px; display: block; }
.topbar small { color: var(--muted); font-size: 12px; }
.scanner { position: relative; height: 230px; border-radius: 20px; background: #0F1F1D; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 14px; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.scanner > * { position: relative; }
.scanner .hint { color: #ffffffcc; font-size: 13px; font-weight: 500; text-shadow: 0 1px 2px #0006; }
.scanner .win { width: 260px; max-width: 80%; height: 96px; border: 2px solid #fff; border-radius: 12px; display: grid; align-items: center; padding: 0 12px; }
.scanner .win i { display: block; height: 2px; background: var(--brand); animation: scanl 1.6s ease-in-out infinite alternate; }
@keyframes scanl { from { transform: translateY(-36px); } to { transform: translateY(36px); } }
.scanner .tools { width: 100%; display: flex; justify-content: space-between; }
.scanner .pill { height: 34px; padding: 0 12px; border-radius: 17px; background: #FFFFFF26; color: #fff; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; backdrop-filter: blur(8px); }
.scanner .pill svg.i { width: 16px; height: 16px; }
.scanner .off { color: #ffffffcc; text-align: center; font-size: 13px; line-height: 1.5; padding: 0 12px; }
.typerow { display: flex; gap: 8px; }
.details .drow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; }
.details .drow + .drow { border-top: 1px solid var(--line); }
.details .drow > svg.i { color: var(--brand-dark); }
.details .drow label { flex: 1; font-weight: 500; }
.details .drow select, .details .drow input[type=number] { border: 0; background: none; text-align: end; font-weight: 500; outline: none; max-width: 150px; }
.details .drow input[type=number]::placeholder { color: var(--muted); font-weight: 400; }
.details .thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.m-foot { position: sticky; bottom: 0; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.m-foot .cta { height: 56px; border-radius: 18px; }
.daygrp { display: flex; flex-direction: column; gap: 8px; }
.daygrp > .h { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.daygrp > .h b { font-weight: 600; }
.daygrp .card { padding: 0 12px; }
.hrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.hrow + .hrow { border-top: 1px solid var(--line); }
.hrow .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hrow .tx b { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.hrow .tx b.voided { color: var(--muted); text-decoration: line-through; }
.hrow .tx small { font-size: 12px; color: var(--muted); }
.hrow .tx small.amber { color: var(--amber); }
.hrow .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; color: var(--muted); }
.voidbtn { padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line); color: var(--red); font-size: 11px; font-weight: 600; }
.total { text-align: end; }
.total b { display: block; font-size: 24px; font-weight: 700; color: var(--brand-dark); line-height: 1.1; }
.total small { font-size: 11px; color: var(--muted); }
.kv { padding: 4px 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; }
.kv > div + div { border-top: 1px solid var(--line); }
.kv > div span { color: var(--muted); }
.kv > div b { font-weight: 500; text-align: end; }

/* ---------- 后台（宽屏） ---------- */
.a { display: flex; min-height: 100vh; }
.side { width: 236px; flex: none; background: var(--card); border-inline-end: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brandmark { padding: 0 8px 20px; }
.side .brandmark .mk { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--ink); font-weight: 500; }
.side nav a svg.i { color: var(--muted); }
.side nav a.on { background: var(--brand-bg); color: var(--brand-dark); font-weight: 600; }
.side nav a.on svg.i { color: var(--brand-dark); }
.side .who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.side .who .avatar { width: 32px; height: 32px; font-size: 12px; }
.side .who > div:not(.avatar) { flex: 1; min-width: 0; }
.side .who b { display: block; font-size: 13px; }
.side .who small { color: var(--muted); font-size: 11px; }
.side .who button { color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 24px; }
.ptop { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.ptop h1 { margin: 0; font-size: 26px; font-weight: 700; }
.ptop .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.ptop .acts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ptop select.btn { appearance: none; padding-inline-end: 14px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: var(--card); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi b { font-size: 32px; font-weight: 700; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi.amber { box-shadow: inset 0 0 0 1px var(--amber-line); }
.kpi.amber b, .kpi.amber small { color: var(--amber); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.panel { background: var(--card); border-radius: 16px; padding: 18px 20px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.panel-h b { font-size: 16px; font-weight: 600; }
.panel-h small { color: var(--muted); font-size: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: start; font-weight: 600; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
table.t tr:last-child td { border-bottom: 0; }
table.t .n { text-align: end; font-variant-numeric: tabular-nums; }
table.t td.strong { font-weight: 600; }
.tscroll { overflow-x: auto; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar > span:first-child { width: 96px; font-weight: 500; flex: none; }
.bar .track { flex: 1; height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; }
.bar .track i { display: block; height: 100%; border-radius: 5px; background: var(--brand); }
.bar > span:last-child { width: 70px; text-align: end; font-weight: 600; flex: none; }
.flag { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.flag .w { color: var(--amber); font-weight: 500; flex: 1; min-width: 160px; }
.matrix td.c, .matrix th.c { text-align: center; width: 74px; }
.matrix td.c span { display: inline-block; min-width: 40px; padding: 4px 0; border-radius: 6px; }
.matrix td.c span.low { background: var(--amber-bg); color: var(--amber); font-weight: 700; }
.matrix td.c span.out { background: var(--red-bg); color: var(--red); font-weight: 700; }
.matrix tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
.matrix tr.wh td { color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-inline-end: 6px; }
.timeline { display: flex; gap: 0; overflow-x: auto; padding-top: 4px; }
.timeline .st { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 6px; }
.timeline .rail { display: flex; align-items: center; }
.timeline .dot { width: 32px; height: 32px; border-radius: 16px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.timeline .dot svg.i { width: 16px; height: 16px; }
.timeline .dot.sale { background: var(--green); }
.timeline .dot.void { background: var(--muted); }
.timeline .rail i { flex: 1; height: 2px; background: var(--line); }
.timeline b { font-size: 14px; }
.timeline small { font-size: 12px; color: var(--muted); line-height: 1.4; padding-inline-end: 12px; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); }
.search:focus-within { border-color: var(--brand); }
.search input { border: 0; outline: none; background: none; flex: 1; min-width: 0; }
.search svg.i { color: var(--muted); width: 16px; height: 16px; }
.pv { background: var(--bg); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.pv .ln { display: flex; gap: 8px; align-items: center; }
.pv .ln svg.i { width: 16px; height: 16px; }
.pv .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pv .chips span { background: var(--card); padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.pv .chips span em { font-style: normal; color: var(--brand-dark); font-weight: 700; margin-inline-start: 6px; }
.move { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.move .l1 { display: flex; justify-content: space-between; }
.move .l1 b { font-size: 14px; }
.move .l1 span, .move small { font-size: 12px; color: var(--muted); }
.move .route { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.move .route b { color: var(--brand-dark); font-weight: 500; }
.move .route svg.i { width: 12px; height: 12px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-bottom: 12px; }
.filters .f { height: 32px; padding: 0 12px; border-radius: 16px; background: var(--bg); font-size: 12px; font-weight: 600; }
.filters .f.on { background: var(--ink); color: #fff; }
.cred { border: 1.5px solid var(--brand); border-radius: 16px; background: var(--card); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.cred .box { background: var(--bg); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cred .box span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.cred .box b { font-family: var(--mono); font-size: 15px; word-break: break-all; }
.rowacts { display: flex; gap: 6px; justify-content: flex-end; }
.rowacts button { color: var(--muted); padding: 4px; border-radius: 6px; }
.rowacts button:hover { background: var(--bg); color: var(--ink); }
tr.off td { opacity: .55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1180px) { .grid2 { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 899px) {
  .a { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 12px; border-inline-end: 0; border-bottom: 1px solid var(--line); gap: 8px; overflow-x: auto; }
  .side .brandmark { padding: 0 8px 0 0; }
  .side .brandmark div { display: none; }
  .side nav { flex-direction: row; }
  .side nav a { height: 36px; padding: 0 10px; white-space: nowrap; }
  .side .who { margin: 0 0 0 auto; border: 0; padding: 0; }
  .side .who > div { display: none; }
  .main { padding: 20px 16px 32px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media print {
  body * { visibility: hidden; }
  .printable, .printable * { visibility: visible; }
  .printable { position: absolute; inset: 0 auto auto 0; width: 360px; }
  .printable .btns { display: none; }
}
