/* تطبيق المبيعات — تصميم أبيض نظيف */
:root {
  --bg: #ffffff; --surface: #f5f5f7; --surface-2: #ebebf0; --panel: #ffffff;
  --ink: #1d1d1f; --muted: #86868b; --line: #e8e8ed;
  --accent: #0071e3; --accent-2: #e8f1fc; --ok: #1a8f3c; --ok-bg: #e6f4ea;
  --warn: #b25e09; --warn-bg: #fdf1e3; --bad: #d70015; --bad-bg: #fde8ea; --quote: #6e3fc9; --quote-bg: #f1ebfb;
  --radius: 16px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
#app { height: 100%; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; -webkit-font-smoothing: antialiased; }
body { overflow: hidden; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
input, textarea, select { user-select: text; -webkit-user-select: text; font: inherit; color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
::-webkit-scrollbar { width: 0; height: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; background: var(--surface); font-weight: 600; white-space: nowrap; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.97); }
.btn.soft { background: var(--surface); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.quote { background: var(--quote); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 56px; font-size: 18px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.linkbtn { color: var(--accent); font-weight: 600; font-size: inherit; padding: 0; }
.icon { width: 22px; height: 22px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.input { min-height: 48px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface); font-size: 17px; width: 100%; }
.input:focus { outline: 2px solid var(--accent); background: #fff; }
textarea.input { padding: 12px 14px; min-height: 80px; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; }

/* ---------- login / activation ---------- */
.center-screen { height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--surface); overflow: auto; }
.login-card { width: min(900px, 100%); display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
.login-card h1 { margin: 0 0 4px; font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; }
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.user-tile { background: #fff; border: 2px solid transparent; border-radius: 20px; padding: 20px 10px; text-align: center; box-shadow: var(--shadow); font-weight: 600; }
.user-tile.sel { border-color: var(--accent); }
.avatar { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; font-size: 24px; font-weight: 700; color: #fff; }
.pinpad { background: #fff; border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 40px; align-items: center; margin-bottom: 14px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); }
.pin-dots span.on { background: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button { height: 64px; border-radius: 50%; aspect-ratio: 1; justify-self: center; width: 64px; background: var(--surface); font-size: 26px; font-weight: 500; }
.keys button:active { background: var(--surface-2); }
.keys button[data-k=ok] { border-radius: 999px; width: 100%; aspect-ratio: auto; background: var(--accent) !important; color: #fff; font-size: 17px; font-weight: 700; }
.err { color: var(--bad); min-height: 22px; text-align: center; margin-top: 10px; font-size: 14px; }
.activate-card { width: min(440px, 100%); background: #fff; border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.activate-card summary { color: var(--muted); }

/* ---------- shell ---------- */
.shell { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: -.3px; white-space: nowrap; }
.tabs { display: flex; gap: 2px; margin-inline-start: 18px; }
.tab { display: flex; align-items: center; gap: 7px; padding: 0 14px; min-height: 40px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 15px; }
.tab.on { background: var(--surface); color: var(--ink); }
.tab .icon { width: 20px; height: 20px; }
.me { position: relative; border-radius: 50%; }
.me .avatar { width: 38px; height: 38px; font-size: 16px; margin: 0; }
.sync-dot { position: absolute; bottom: 0; inset-inline-end: 0; width: 12px; height: 12px; border-radius: 6px; background: var(--ok); border: 2px solid #fff;
  font-size: 10px; font-weight: 800; color: #fff; display: grid; place-items: center; }
.sync-dot.off { background: var(--warn); }
.sync-dot.has { width: auto; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--warn); bottom: -4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.off { background: var(--warn); }
.main { min-height: 0; }

.modal:has(.menu-box) { align-items: flex-start; justify-content: flex-end; padding-top: 64px; background: rgba(0,0,0,.12); }
.modal-box.menu-box { width: 300px; border-radius: 18px; }
.menu-pop { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.menu-pop .avatar { width: 46px; height: 46px; margin: 0; font-size: 19px; }
.menu-pop > .row { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 10px; border-radius: 12px; text-align: start; font-size: 15px; color: var(--ink); }
button.menu-item:active { background: var(--surface); }
.menu-item.danger { color: var(--bad); }

/* ---------- order screen ---------- */
.order-screen { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 390px; min-height: 0; }
.order-screen.browse { grid-template-columns: minmax(0, 1fr); }
.products { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.searchbar { display: flex; gap: 10px; padding: 14px 18px 10px; align-items: center; }
.search { position: relative; flex: 1; min-width: 0; }
.search .input { padding-inline-start: 46px; padding-inline-end: 48px; border-radius: 999px; min-height: 48px; }
.search > .icon { position: absolute; inset-inline-start: 16px; top: 13px; color: var(--muted); }
.search .scan { position: absolute; inset-inline-end: 6px; top: 6px; height: 36px; width: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.searchbar .btn span { font-size: 15px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 18px 10px; align-items: center; flex: none; scroll-padding: 18px; }
.facet { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 38px; padding: 0 16px; border-radius: 999px; background: var(--surface); font-size: 15px; font-weight: 500; flex: none; }
.facet .cnt { font-size: 12px; color: var(--muted); }
.facet.on { background: var(--ink); color: #fff; }
.facet.on .cnt { color: rgba(255,255,255,.6); }
.facet.special { color: var(--quote); }
.facet.special.on { background: var(--quote); color: #fff; }
.facet.more { color: var(--accent); background: var(--accent-2); }
.facet .icon { width: 17px; height: 17px; }
.fmode-sel { flex: none; min-height: 38px; padding: 0 30px 0 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: #fff
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d1d1f' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat left 10px center/14px;
  font-weight: 700; font-size: 15px; appearance: none; -webkit-appearance: none; }
.chip-x { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; }
.crumbs { padding: 0 20px 6px; font-size: 13px; color: var(--muted); display: flex; gap: 4px; align-items: center; flex: none; }
.narrow-only, .cart-bar { display: none; }

.grid { flex: 1; overflow-y: auto; padding: 6px 18px 24px; display: grid; gap: 22px 16px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); grid-auto-rows: max-content; }
.grid.noimg { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.grid.list { grid-template-columns: 1fr; gap: 0; }
.card { position: relative; display: flex; flex-direction: column; text-align: start; transition: transform .08s; }
.card:active { transform: scale(.97); }
.card .img { aspect-ratio: 1; background: var(--surface) center/contain no-repeat; border-radius: var(--radius); transition: box-shadow .15s; }
.card.incart .img { box-shadow: inset 0 0 0 2.5px var(--accent); }
.card .body { padding: 10px 2px 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card .name { font-size: 15px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.card .meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-inline-end: 40px; }
.card .price { font-size: 17px; font-weight: 700; }
.card .code { font-size: 11.5px; color: var(--muted); }
.card .plus { position: absolute; bottom: 14px; inset-inline-end: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--ink); }
.card .plus .icon { width: 18px; height: 18px; }
.card.incart .plus { background: var(--accent); color: #fff; }
.badge { position: absolute; top: 10px; inset-inline-end: 10px; min-width: 30px; height: 30px; padding: 0 9px; border-radius: 15px; background: var(--accent); color: #fff;
  font-weight: 700; font-size: 15px; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,113,227,.35); }
.grid.noimg .card { background: var(--surface); border-radius: 14px; padding: 12px 14px; }
.grid.noimg .card.incart { box-shadow: inset 0 0 0 2px var(--accent); }
.grid.noimg .card .plus { bottom: 12px; inset-inline-end: 12px; background: #fff; }
.grid.noimg .card .body { padding: 0; }
.stock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock.ok { color: var(--ok); }
.stock .resv { font-weight: 500; color: var(--muted); font-size: 11px; margin-inline-start: 4px; }
.ic-res { font-size: 13px; color: var(--muted); margin-top: -4px; }
.stock.low { color: var(--warn); }
.stock.out { color: var(--bad); }
.card.out .img, .card.out .name { opacity: .5; }
.grid.list .card { flex-direction: row; align-items: center; min-height: 72px; padding: 8px 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.grid.list .card .img { width: 58px; height: 58px; aspect-ratio: auto; flex: none; border-radius: 12px; }
.grid.list .card .body { flex-direction: row; align-items: center; gap: 14px; padding: 0 12px; }
.grid.list .card .name { -webkit-line-clamp: 1; min-height: 0; flex: 1; }
.grid.list .card .meta { margin: 0; padding: 0; }
.grid.list .card .code { display: none; }
.grid.list .card .plus { position: static; flex: none; }
.grid.list .badge { position: static; margin-inline-end: 10px; box-shadow: none; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); }
.tbl-wrap { flex: 1; overflow: auto; padding: 0 18px 20px; }
.tbl th { position: sticky; top: 0; background: #fff; font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: start; padding: 10px; border-bottom: 1px solid var(--line); z-index: 1; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.tbl tr.incart td { background: var(--accent-2); }
.stepper { display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface); }
.stepper button { width: 38px; height: 38px; font-size: 22px; font-weight: 500; color: var(--ink); border-radius: 50%; }
.stepper button:active { background: var(--surface-2); }
.stepper .q { min-width: 36px; text-align: center; font-weight: 700; font-size: 16px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; grid-column: 1 / -1; }

/* group tiles */
.tiles { flex: 1; overflow-y: auto; padding: 6px 18px 24px; display: grid; gap: 20px 16px; align-content: start; grid-auto-rows: max-content;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tile { position: relative; text-align: center; display: flex; flex-direction: column; }
.tile:active { transform: scale(.97); }
.tile .timg { aspect-ratio: 4/3; background: var(--surface) center/cover no-repeat; border-radius: var(--radius); display: grid; place-items: center; }
.tile.picked .timg { box-shadow: inset 0 0 0 3px var(--accent); }
.tile .timg span { font-size: 40px; font-weight: 700; color: var(--muted); }
.tile .tname { font-weight: 600; padding: 10px 4px 0; font-size: 15px; line-height: 1.3; }
.tile .tcnt { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.tile .tck { position: absolute; top: 10px; inset-inline-start: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 1px 4px rgba(0,0,0,.15); display: grid; place-items: center; font-weight: 800; color: #fff; }
.tile.picked .tck { background: var(--accent); }
.tile-apply { display: flex; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); }

/* facet picker */
.az { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; align-self: start; }
.az button { width: 28px; height: 24px; border-radius: 7px; font-size: 12.5px; font-weight: 700; color: var(--accent); }
.az-sec { margin-bottom: 14px; scroll-margin-top: 4px; }
.az-h { font-weight: 700; color: var(--muted); padding: 4px 2px 8px; font-size: 14px; }
.az-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.opt-chk { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 12px; border-radius: 12px; background: var(--surface); text-align: start; }
.opt-chk .box { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #c7c7cc; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.opt-chk.on { background: var(--accent-2); font-weight: 600; }
.opt-chk.on .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt-chk.zero { opacity: .45; }
.opt-chk .cnt { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { min-height: 36px; min-width: 40px; padding: 0 12px; border-radius: 999px; display: grid; place-items: center; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* view menu */
.vlabel { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.vgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.vopt { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 999px; background: var(--surface); font-weight: 500; font-size: 15px; }
.vopt .icon { width: 18px; height: 18px; }
.vopt.on { background: var(--ink); color: #fff; }
.vswitch { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 14px; background: var(--surface); border-radius: 14px; font-weight: 500; }
.vswitch input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- cart ---------- */
.cart { background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.doc-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); padding: 3px; border-radius: 999px; }
.doc-switch button { min-height: 38px; border-radius: 999px; font-weight: 600; color: var(--muted); font-size: 15px; }
.doc-switch button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.doc-switch button.on.dt-quote { color: var(--quote); }
.cust { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: #fff; text-align: start; width: 100%; }
.cust > .icon { color: var(--muted); }
.cust .nm { font-weight: 600; }
.cust-info { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: #fff; font-weight: 500; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.btnchip { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.chip .icon { width: 16px; height: 16px; }
.lines { flex: 1; overflow-y: auto; padding: 0 16px; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 14px; margin-bottom: 8px; background: #fff; border-radius: 14px; align-items: center; }
.line .nm { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.line .sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.line .net { font-weight: 700; text-align: end; }
.line .stepper { justify-self: start; }
.line .stepper button { width: 34px; height: 34px; }
.line > .btn { justify-self: end; min-height: 34px; padding: 0 8px; }
.line .disc { color: var(--ok); font-weight: 600; }
.line.flash { animation: flash .6s; }
@keyframes flash { from { background: var(--accent-2); } to { background: #fff; } }
.lines .empty { padding: 50px 10px; }
.cart-foot { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); }
.cart-foot .btn.sm { background: #fff; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 14.5px; }
.totals .grand { font-size: 24px; font-weight: 700; padding-top: 6px; letter-spacing: -.3px; }
.cart-actions { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; }
.cart-actions .btn:not(.big) { background: #fff; width: 56px; padding: 0; min-height: 56px; }

.cust-info.brief .chip { background: transparent; padding: 2px 0; margin-inline-end: 8px; color: var(--muted); font-size: 12.5px; }
.cust-info.brief .chip.warn { color: var(--warn); background: transparent; }
.cart-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.cart-tools .chip[disabled] { opacity: .4; }
.sugg { margin: 4px 0 12px; }
.sugg-h { font-size: 13px; color: var(--muted); font-weight: 600; margin: 6px 2px 8px; }
.sugg-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.sugg-card { position: relative; flex: none; width: 112px; text-align: start; }
.sugg-card .simg { aspect-ratio: 1; border-radius: 12px; background: #fff center/contain no-repeat; }
.sugg-card .sname { font-size: 12.5px; line-height: 1.3; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sugg-card .sprice { font-size: 13px; font-weight: 700; margin-top: 2px; }
.sugg-card .splus { position: absolute; top: 6px; inset-inline-end: 6px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); display: grid; place-items: center; }
.sugg-card .splus .icon { width: 16px; height: 16px; }
.modal-body .sugg { padding: 0 20px; }
.modal-body .sugg-card .simg { background-color: var(--surface); }
.held-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.forgot-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.forgot-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.forgot-row .fimg { width: 48px; height: 48px; border-radius: 10px; background: var(--surface) center/contain no-repeat; flex: none; }
.confirm-sum { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border-radius: 16px; }
.sigpad { width: 100%; height: 150px; background: var(--surface); border-radius: 14px; touch-action: none; border: 1.5px dashed #c7c7cc; }
.favbtn.on { color: #e0245e; }
.favbtn.on .icon { fill: #e0245e; }

/* ---------- receipt ---------- */
.receipt { height: 100%; overflow-y: auto; padding: 20px; }
.receipt-wrap { max-width: 820px; margin: 0 auto; display: grid; gap: 14px; }
.panel { background: var(--surface); border-radius: 20px; padding: 18px; }
.panel h3 { margin: 0 0 14px; font-size: 18px; font-weight: 700; }
.panel .cust { background: #fff; }
.panel .input { background: #fff; }
.pay-methods { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-methods .btn { background: #fff; }
.pay-line { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: end; padding: 14px; background: #fff; border-radius: 14px; margin-top: 10px; }
.pay-line .input { background: var(--surface); }
.pay-line .extra { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.big-total { font-size: 34px; font-weight: 700; letter-spacing: -.5px; }

/* ---------- docs ---------- */
.docs { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px 8px; flex-wrap: wrap; }
.docs .list { flex: 1; overflow-y: auto; padding: 0 18px 20px; display: flex; flex-direction: column; }
.doc-row { padding: 14px 4px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; text-align: start; width: 100%; }
.doc-row:active { background: var(--surface); }
.doc-type { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.doc-type.dt-order { background: var(--accent-2); color: var(--accent); }
.doc-type.dt-quote { background: var(--quote-bg); color: var(--quote); }
.doc-type.dt-receipt { background: var(--ok-bg); color: var(--ok); }
.st { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.st.done { background: var(--ok-bg); color: var(--ok); }
.st.approval, .st.queued { background: var(--warn-bg); color: var(--warn); }
.st.rejected, .st.cancelled, .st.failed { background: var(--bad-bg); color: var(--bad); }
.st.sent { background: var(--accent-2); color: var(--accent); }

/* ---------- modal / sheet ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-box { background: #fff; border-radius: 24px; width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.modal-box.wide { width: min(980px, 100%); }
.modal-box.narrow { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 8px; }
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 700; flex: 1; letter-spacing: -.3px; }
.modal-head .btn.ghost { background: var(--surface); width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.modal-head .btn.ghost .icon { width: 18px; height: 18px; }
.modal-body { padding: 12px 20px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.cust-list { display: flex; flex-direction: column; }
.cust-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); text-align: start; width: 100%; }
.cust-row > .icon { color: var(--muted); }
.cust-row:active { background: var(--surface); }
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.3); }
.sheet-box { background: #fff; border-radius: 26px; width: min(440px, 94vw); padding: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.sheet-box .btn.ghost { background: var(--surface); width: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.numdisplay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.numdisplay button { text-align: start; padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 2px solid transparent; }
.numdisplay button.on { border-color: var(--accent); background: #fff; }
.numdisplay small { display: block; color: var(--muted); font-size: 12px; }
.numdisplay b { font-size: 24px; font-weight: 700; }
.numkeys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.numkeys button { height: 60px; border-radius: 16px; background: var(--surface); font-size: 25px; font-weight: 500; }
.numkeys button:active { background: var(--surface-2); }
.numkeys button.fn { font-size: 18px; color: var(--muted); }
.numkeys button.ok { background: var(--accent); color: #fff; font-size: 18px; font-weight: 700; grid-row: span 2; height: auto; }
.quick-qty { display: flex; gap: 6px; margin-bottom: 8px; }
.quick-qty button { flex: 1; min-height: 40px; border-radius: 999px; background: var(--accent-2); color: var(--accent); font-weight: 700; }
.item-detail { display: grid; grid-template-columns: 320px 1fr; gap: 22px; }
.item-detail .img { aspect-ratio: 1; background: var(--surface) center/contain no-repeat; border-radius: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.chk { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; color: var(--ink); }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: rgba(29,29,31,.94); color: #fff; padding: 12px 22px; border-radius: 999px; z-index: 80; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 90vw; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ink); }
video.scanner { width: 100%; border-radius: 16px; background: #000; max-height: 60vh; }


/* ---------- item card ---------- */
.modal-box.item-card { width: min(1080px, 100%); max-height: 94vh; overflow-y: auto; }
.ic { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding: 24px; }
.ic-close { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2; background: var(--surface) !important; width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%; }
.ic-gallery { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 10px; }
.ic-main { aspect-ratio: 1; border-radius: 22px; background: var(--surface) center/contain no-repeat; cursor: zoom-in; display: grid; place-items: center; color: #c7c7cc; }
.ic-main .icon { width: 64px; height: 64px; }
.ic-thumbs { display: flex; gap: 8px; overflow-x: auto; }
.ic-thumb { flex: none; width: 64px; height: 64px; border-radius: 12px; background: var(--surface) center/contain no-repeat; border: 2px solid transparent; }
.ic-thumb.on { border-color: var(--accent); }
.ic-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding-top: 8px; }
.ic-tags { font-size: 13px; color: var(--accent); font-weight: 600; }
.ic-name { margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: -.4px; padding-inline-end: 40px; }
.ic-price { font-size: 32px; font-weight: 700; letter-spacing: -.5px; }
.ic-price small { font-size: 18px; color: var(--muted); }
.ic-tax { display: block; font-size: 13px; font-weight: 400; letter-spacing: 0; }
.ic-stock { align-self: flex-start; font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 999px; }
.ic-stock.ok { background: var(--ok-bg); color: var(--ok); }
.ic-stock.low { background: var(--warn-bg); color: var(--warn); }
.ic-stock.out { background: var(--bad-bg); color: var(--bad); }
.ic-hist { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-2); color: var(--ink); padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.ic-hist .icon { color: var(--accent); flex: none; margin-top: 2px; }
.ic-buy { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface); border-radius: 18px; }
.ic-buy .quick-qty { margin: 0; }
.ic-buy .quick-qty button { background: #fff; color: var(--ink); }
.ic-buy .favbtn { background: #fff; width: 56px; padding: 0; }
.stepper.big { align-self: center; background: #fff; }
.stepper.big button { width: 56px; height: 56px; font-size: 28px; }
.stepper.big .q { min-width: 70px; font-size: 26px; }
.ic-kv { margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.ic-sec h4 { margin: 8px 0 4px; font-size: 15px; }
.ic-sec p { margin: 0; color: #3a3a3c; line-height: 1.6; font-size: 15px; }
.ic-sugg { grid-column: 1 / -1; }
.ic-sugg .sugg-card .simg { background-color: var(--surface); }
.ic-sugg .sugg-card { width: 130px; }
.zoom { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.92); display: grid; place-items: center; }
.zoom img { max-width: 100vw; max-height: 100vh; object-fit: contain; touch-action: pinch-zoom; }
.zoom .btn { position: absolute; top: 16px; inset-inline-end: 16px; background: rgba(255,255,255,.15); color: #fff; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.chip-x.back { background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); }


/* ---------- sections screen ---------- */
.sec-btn { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; }
.sec-btn .icon { width: 18px; height: 18px; }
.modal-box.sec-box { width: min(1100px, 100%); height: min(760px, 94vh); max-height: 94vh; }
.sec { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sec-head h2 { margin: 0; font-size: 21px; }
.sec-head .search { min-width: 180px; }
.sec-head .search .input { min-height: 42px; }
.sec-head .search > .icon { top: 10px; }
.sec-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.sec-groups { overflow-y: auto; background: var(--surface); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.sec-g { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; text-align: start; min-height: 60px; }
.sec-g.on { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.sec-g.on .sgn { font-weight: 700; color: var(--accent); }
.sgi { width: 44px; height: 44px; border-radius: 12px; background: #fff center/cover no-repeat; flex: none; display: grid; place-items: center; color: var(--muted); }
.sgi .icon { width: 22px; height: 22px; }
.sgn { flex: 1; font-size: 15px; font-weight: 500; line-height: 1.3; }
.sgc { font-size: 12px; color: var(--muted); }
.sec-main { overflow-y: auto; padding: 14px 18px 20px; }
.sec-all { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 16px; border-radius: 14px; background: var(--accent-2); color: var(--accent); font-weight: 700; font-size: 16px; margin-bottom: 16px; }
.sec-all .num { margin-inline-start: auto; font-weight: 500; font-size: 13px; }
.sec-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
.sec-t { position: relative; text-align: center; display: flex; flex-direction: column; align-items: stretch; }
.sec-t:active { transform: scale(.97); }
.sti { aspect-ratio: 1; border-radius: 18px; background: var(--surface) center/cover no-repeat; display: grid; place-items: center; }
.sti span { font-size: 38px; font-weight: 700; color: #c7c7cc; }
.sec-t.picked .sti { box-shadow: inset 0 0 0 3px var(--accent); }
.stn { font-size: 14.5px; font-weight: 600; line-height: 1.3; margin-top: 8px; }
.stc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sec-t .tck { position: absolute; top: 8px; inset-inline-start: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.15); display: grid; place-items: center; font-weight: 800; color: #fff; }
.sec-t.picked .tck { background: var(--accent); }
.sec-foot { display: flex; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }


/* ---------- home (يوم المندوب) ---------- */
.home { height: 100%; overflow-y: auto; }
.home-wrap { max-width: 1000px; margin: 0 auto; padding: 22px 20px 40px; display: flex; flex-direction: column; gap: 20px; }
.home-hi h1 { margin: 0; font-size: 28px; letter-spacing: -.5px; }
.home-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi-c { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi-c small { color: var(--muted); font-size: 13px; }
.kpi-c b { font-size: 26px; letter-spacing: -.5px; }
.kpi-c span { font-size: 12.5px; color: var(--muted); }
.kpi-c.warn { background: var(--warn-bg); }
.kpi-c.warn b { color: var(--warn); }
.home-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.home-act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; border-radius: 18px; background: var(--surface); font-weight: 700; font-size: 15px; }
.home-act .icon { width: 28px; height: 28px; }
.home-act:active { transform: scale(.97); }
.home-act.a-order { background: var(--accent); color: #fff; }
.home-act.a-quote { background: var(--quote-bg); color: var(--quote); }
.home-act.a-receipt { background: var(--ok-bg); color: var(--ok); }
.home-sec h3 { margin: 0 0 8px; font-size: 17px; }
.home-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; padding: 12px 14px; border-radius: 16px; background: var(--surface); margin-bottom: 8px; }
.home-row.warn { background: var(--warn-bg); }
.home-row .muted { font-size: 13px; }
.hr-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-2); color: var(--accent); flex: none; }
.hr-ic.quote { background: var(--quote-bg); color: var(--quote); }
.hr-ic.held { background: var(--warn-bg); color: var(--warn); }
.hr-ic .icon { width: 20px; height: 20px; }
.hr-go { color: var(--accent); font-weight: 600; font-size: 14px; white-space: nowrap; }
.home-custs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.home-cust { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); min-width: 0; }
.home-cust .muted { font-size: 12.5px; }

/* ---------- rep table ---------- */
.tbl.rep td { padding: 6px 8px; vertical-align: middle; }
.tbl.rep .tthumb { width: 52px; }
.tbl.rep .tthumb div { width: 42px; height: 42px; border-radius: 10px; background: var(--surface) center/contain no-repeat; }
.tbl.rep .tcode { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tbl.rep .tname { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.tbl.rep .tsub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tbl.rep .tprice { font-weight: 700; white-space: nowrap; }
.tbl.rep .tlast { color: var(--accent); font-weight: 600; white-space: nowrap; }
.tbl.rep .tlast small { color: var(--muted); font-weight: 400; }
.tbl.rep tr.out .tname, .tbl.rep tr.out .tthumb { opacity: .5; }
.tbl.rep .stepper .q { cursor: pointer; text-decoration: underline dotted #c7c7cc; text-underline-offset: 4px; }

/* sections: قائمة مضغوطة للموظف بدل المربعات الكبيرة */
.sec-tiles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important; gap: 8px !important; }
.sec-t { flex-direction: row; align-items: center; gap: 12px; text-align: start; padding: 8px 10px; border-radius: 14px; background: var(--surface); min-height: 60px; }
.sec-t .sti { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 10px; flex: none; background-color: #fff; background-size: contain; }
.sec-t .sti span { font-size: 18px; }
.sec-t .stn { margin: 0; flex: 1; font-size: 14.5px; }
.sec-t .stc { margin: 0; white-space: nowrap; }
.sec-t.picked { background: var(--accent-2); box-shadow: inset 0 0 0 2px var(--accent); }
.sec-t.picked .sti { box-shadow: none; }
.sec-t .tck { position: static; order: -1; width: 24px; height: 24px; flex: none; border: 1.5px solid #c7c7cc; box-shadow: none; }
.sgi { width: 36px; height: 36px; border-radius: 10px; background-size: contain; }
.sec-g { min-height: 52px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .order-screen { grid-template-columns: minmax(0, 1fr) 340px; }
  .tab span { display: none; }
  .tab { padding: 0 12px; }
}
@media (max-width: 920px) {
  .order-screen, .order-screen.browse { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); }
  .topbar .brand { font-size: 16px; }
  .tabs { margin-inline-start: 6px; }
  .tab { min-height: 38px; padding: 0 12px; }
  .me .avatar { width: 34px; height: 34px; font-size: 15px; }
  .searchbar { padding: 10px 12px 8px; gap: 8px; }
  .searchbar .btn { padding: 0 14px; min-height: 46px; }
  .searchbar .btn span { display: none; }
  .search .input { min-height: 46px; }
  .search > .icon { top: 12px; }
  .search .scan { top: 5px; }
  .chips { padding: 2px 12px 8px; gap: 6px; }
  .facet, .fmode-sel, .chip-x { min-height: 36px; font-size: 14px; }
  .facet { padding: 0 14px; }
  .crumbs { padding: 0 14px 4px; }
  .grid, .tiles { padding: 4px 12px 100px; gap: 18px 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .grid.list { gap: 0; }
  .tbl-wrap { padding: 0 12px 100px; }
  .tile-apply { position: fixed; bottom: 84px; left: 12px; right: 12px; border: 0; background: none; padding: 0; z-index: 30; }
  /* السلة: شريط عائم في الأسفل، وتفتح بملء الشاشة */
  .cart { position: fixed; inset: 0; z-index: 40; transform: translateY(105%); transition: transform .25s cubic-bezier(.2,.8,.2,1); }
  .cart.open { transform: none; }
  .narrow-only { display: inline-flex; }
  .cart-bar { display: flex; align-items: center; gap: 12px; position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; right: 12px; z-index: 30;
    padding: 10px 14px 10px 18px; background: var(--ink); color: #fff; text-align: start; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
  .cart-bar.quote { background: var(--quote); }
  .cart-bar .cnt { min-width: 38px; height: 38px; border-radius: 19px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-weight: 700; font-size: 16px; padding: 0 8px; }
  .cart-bar .tot { font-size: 19px; font-weight: 700; }
  .cart-head .close-cart { min-height: 38px; background: #fff; }
  .login-card { grid-template-columns: 1fr; }
  .item-detail { grid-template-columns: 1fr; }
  .modal:has(.item-card), .modal:has(.sec-box) { padding: 0; }
  .modal-box.sec-box { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
  .sec-head { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); gap: 8px; }
  .sec-head h2 { display: none; }
  .sec-head .search { order: 5; flex-basis: 100%; }
  .sec-body { grid-template-columns: 104px minmax(0, 1fr); }
  .sec-g { flex-direction: column; text-align: center; gap: 4px; padding: 8px 4px; min-height: 0; }
  .sgn { font-size: 12.5px; }
  .sgi { width: 48px; height: 48px; }
  .sec-main { padding: 10px 12px 20px; }
  .sec-tiles { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px 10px; }
  .stn { font-size: 13px; }
  .modal-box.item-card { max-height: 100vh; height: 100%; border-radius: 0; }
  .ic { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .ic-gallery { position: static; }
  .ic-main { aspect-ratio: 4/3; }
  .ic-name { font-size: 22px; }
  .ic-buy { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 -8px 24px rgba(0,0,0,.08); margin: 0 -4px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .ic-buy .quick-qty { display: none; }
  .pay-line { grid-template-columns: 1fr 1fr auto; }
  .pay-line .extra { grid-template-columns: 1fr 1fr; }
  .receipt { padding: 12px; }
  .home-wrap { padding: 16px 12px 40px; gap: 16px; }
  .home-kpis, .home-acts { grid-template-columns: repeat(2, 1fr); }
  .home-custs { grid-template-columns: 1fr; }
  .sec-tiles { grid-template-columns: 1fr !important; }
}
@media (max-width: 560px) {
  .topbar .brand { display: none; }
  .tabs { margin-inline-start: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.noimg { grid-template-columns: minmax(0, 1fr); }
  .doc-row { grid-template-columns: auto 1fr auto; }
  .doc-row > b { grid-column: 2 / -1; }
}
