:root {
  --bg: #f4f2f4; --card: #fff; --ink: #1f1a1e; --muted: #6d6570; --line: #e6e0e5;
  --brand: #714b67; --brand-dark: #5a3b52; --brand-soft: #f3ecf1; --brand-ink: #fff;
  --new: #6b7280; --prep: #c2410c; --ready: #1d63c9; --done: #15803d; --cancel: #b91c1c; --warn: #b45309;
  --wa: #128c4a; --radius: 14px; --shadow: 0 1px 2px rgba(40, 20, 35, .06), 0 2px 10px rgba(40, 20, 35, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
body.noscroll { overflow: hidden; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .4rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.good { color: var(--done); }
.bad { color: var(--cancel); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.ic.big { width: 44px; height: 44px; opacity: .35; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem;
  padding: calc(.55rem + env(safe-area-inset-top)) .75rem .55rem; background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.bar h1 { flex: 1; font-size: 1.1rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { display: flex; gap: .25rem; }
.bar .icon-btn { color: inherit; }
.bar-logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .16); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  color: var(--ink); cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:active { background: rgba(0, 0, 0, .08); }
.icon-btn.soft { background: var(--brand-soft); color: var(--brand); width: 38px; height: 38px; }
.icon-btn.wa-ic { background: #e5f5ec; color: var(--wa); }
[dir=rtl] .back .ic { transform: scaleX(-1); }

/* ---------- page ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: .85rem; }
.cards { display: grid; gap: .6rem; }
.cards .card { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty.small { padding: 1rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 1rem .25rem; }
.notice { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; border-radius: 12px; background: var(--brand-soft); color: var(--ink); text-decoration: none; margin: .5rem 0; }
.notice.warn { background: #fff4e5; color: #8a4b0b; }
.loading { width: 34px; height: 34px; margin: 2rem auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.loading.sm { width: 22px; height: 22px; margin: .5rem 0; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { min-height: 100vh; display: grid; place-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1rem;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .05s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.danger { background: var(--cancel); border-color: var(--cancel); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost.danger { color: var(--cancel); background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.sm { min-height: 36px; padding: .35rem .75rem; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn:not(.primary):not(.wa):not(.danger).busy::after { border-color: var(--line); border-top-color: var(--brand); }
.link { background: none; border: 0; padding: .25rem 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btns { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }

/* ---------- forms ---------- */
label { display: block; font-size: .88rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem; min-height: 46px;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font: inherit; font-weight: 400;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
.stack > * + * { margin-top: .85rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid2 > * { margin: 0 !important; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: .55rem; color: var(--ink); font-weight: 500; font-size: .95rem; padding: .3rem 0; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--brand); flex: none; }
.toggles { display: flex; flex-direction: column; justify-content: flex-end; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin: .85rem 0 0; background: #fff; }
legend { font-size: .88rem; font-weight: 600; color: var(--muted); padding: 0 .3rem; }
.item-row { display: grid; grid-template-columns: 1fr 70px 76px 40px; gap: .4rem; align-items: center; margin-bottom: .45rem; }
.item-row input { margin: 0; }
.item-row .qty { text-align: center; }
@media (max-width: 520px) {
  .item-row { grid-template-columns: 1fr 1fr 40px; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
  .item-row input[data-k=name] { grid-column: 1 / -1; }
}
.seg { display: flex; gap: .4rem; flex-wrap: wrap; }
.seg label { position: relative; flex: 1; min-width: 90px; margin: 0; }
.seg input { position: absolute; inset: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: .6rem; border-radius: 11px; border: 1px solid var(--line); color: var(--ink); font-weight: 600; cursor: pointer; }
.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.typeahead { position: relative; }
.sugg { position: absolute; inset-inline: 0; top: 100%; z-index: 5; background: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .14); overflow: hidden; }
.sugg button { display: flex; justify-content: space-between; gap: .5rem; width: 100%; padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; color: var(--ink); text-align: start; cursor: pointer; }
.sugg button span { color: var(--muted); }
.scanbox { display: flex; align-items: center; gap: .75rem; justify-content: space-between; padding: .9rem 1rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--brand-soft); border: 1px dashed color-mix(in srgb, var(--brand) 40%, transparent); }
.scanbox label { color: #fff; margin: 0; flex: none; white-space: nowrap; }

/* ---------- search ---------- */
.search { position: relative; display: block; margin: 0 0 .85rem; }
.search .ic { position: absolute; inset-inline-start: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { margin: 0; padding-inline-start: 2.5rem; border-radius: 12px; background: #fff; }
.search.big input { min-height: 52px; font-size: 1.02rem; box-shadow: var(--shadow); border-color: transparent; }

/* ---------- home ---------- */
.home {
  min-height: 100vh; padding: calc(1.25rem + env(safe-area-inset-top)) 1rem 3rem;
  background: radial-gradient(1200px 500px at 85% -10%, #e7d6e2 0%, transparent 60%), linear-gradient(180deg, #f6eff4 0%, var(--bg) 55%);
}
.home > * { max-width: 760px; margin-inline: auto; }
.home-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.hello { font-size: 1.45rem; font-weight: 700; }
.role-chip { display: inline-block; padding: .2rem .65rem; border-radius: 999px; background: #fff; color: var(--brand); font-size: .8rem; font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; }
.role-chip.r-admin { color: var(--brand); } .role-chip.r-sales { color: var(--ready); } .role-chip.r-warehouse { color: var(--prep); }
#found { margin-bottom: .5rem; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem .6rem; margin-top: 1.4rem !important; }
@media (max-width: 420px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { display: flex; flex-direction: column; align-items: center; gap: .45rem; text-decoration: none; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.tile-ic {
  position: relative; display: grid; place-items: center; width: 68px; height: 68px; border-radius: 18px; color: #fff;
  box-shadow: 0 3px 10px rgba(40, 20, 35, .16), inset 0 -3px 0 rgba(0, 0, 0, .12); transition: transform .1s;
}
.tile:active .tile-ic { transform: scale(.94); }
.tile-ic .ic { width: 32px; height: 32px; stroke-width: 1.9; }
.tile-label { font-size: .84rem; font-weight: 600; text-align: center; line-height: 1.2; }
.badge { position: absolute; top: -7px; inset-inline-end: -7px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: #e11d48; color: #fff; font-size: .8rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.c-purple { background: linear-gradient(145deg, #8a5c7e, #714b67); } .c-orange { background: linear-gradient(145deg, #f59e0b, #e0761a); }
.c-blue { background: linear-gradient(145deg, #3b8cf0, #1d63c9); } .c-green { background: linear-gradient(145deg, #34b36a, #15803d); }
.c-slate { background: linear-gradient(145deg, #64748b, #475569); } .c-teal { background: linear-gradient(145deg, #1fb5a8, #0f8a80); }
.c-pink { background: linear-gradient(145deg, #ec5f8b, #d23a6a); } .c-indigo { background: linear-gradient(145deg, #6f74e8, #4f46e5); }
.c-gray { background: linear-gradient(145deg, #9aa0a8, #6b7280); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .4rem; overflow-x: auto; margin: 0 -1rem .85rem; padding: 0 1rem .1rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.wrap { flex-wrap: wrap; overflow: visible; }
.tabs a, .tabs button { flex: none; padding: .45rem .9rem; border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; font: inherit; font-size: .92rem; font-weight: 600; border: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.tabs .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs b { display: inline-block; min-width: 22px; padding: 0 6px; margin-inline-start: .2rem; border-radius: 10px; background: rgba(0, 0, 0, .08); font-size: .8rem; text-align: center; }
.tabs .on b { background: rgba(255, 255, 255, .25); }

/* ---------- order cards ---------- */
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: #eef0f2; color: var(--new); }
.chip .ic { width: 14px; height: 14px; vertical-align: 0; }
.st-new { background: #eef0f2; color: var(--new); } .st-prep { background: #fff1e6; color: var(--prep); } .st-ready { background: #e7f0fd; color: var(--ready); }
.st-done { background: #e6f5ec; color: var(--done); } .st-cancel { background: #fde8e8; color: var(--cancel); } .st-warn { background: #fff4e0; color: var(--warn); }
.order { cursor: pointer; border-inline-start: 4px solid transparent; }
.order.urgent { border-inline-start-color: #f59e0b; }
.order .row1 { display: flex; align-items: center; gap: .45rem; }
.order .row1 .chip:last-child { margin-inline-start: auto; }
.ref { font-weight: 750; font-size: 1.02rem; letter-spacing: .01em; }
.bolt { color: #f59e0b; } .bolt .ic { width: 18px; height: 18px; fill: #f59e0b; }
.cust { font-weight: 550; margin: .15rem 0; }
.row2 { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .86rem; }
.when { display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; }
.when .ic { width: 15px; height: 15px; }
.when.late { color: var(--cancel); font-weight: 700; }
.row3 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.row3 .btn { margin-inline-start: auto; }
.sent { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; color: var(--warn); font-weight: 600; }
.sent.ok { color: var(--wa); }
.sent .ic { width: 15px; height: 15px; }

/* ---------- order detail ---------- */
.detail .head .row1 { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .45rem; }
.detail .head h2 { font-size: 1.35rem; }
.contact { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; font-weight: 600; }
.contact span { margin-inline-end: auto; }
.link-row { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; font-weight: 600; text-decoration: none; }
.code-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: linear-gradient(135deg, #fff, var(--brand-soft)); }
.code { font-size: 2.1rem; font-weight: 800; letter-spacing: .3em; font-variant-numeric: tabular-nums; color: var(--brand); }
.actions { display: grid; gap: .55rem; margin-bottom: .85rem; }
.actions:empty { display: none; }
.shelf { display: inline-block; margin-top: .3rem; padding: .15rem .6rem; border-radius: 8px; background: #fff4e0; color: #7a4507; font-weight: 700; font-size: .9rem; }
.shelf.big { font-size: 1.1rem; padding: .35rem .8rem; }
.items { width: 100%; border-collapse: collapse; }
.items td { padding: .5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.items tr:last-child td { border-bottom: 0; }
.items .qty { text-align: end; unicode-bidi: isolate; white-space: nowrap; font-weight: 700; padding-inline-start: .75rem; }
.items tr.short td:first-child { color: var(--cancel); }
.due-row { display: flex; justify-content: space-between; align-items: center; margin: .6rem 0; padding: .6rem .8rem; border-radius: 10px; background: #fff7e8; }
.bad-card { border-inline-start: 4px solid var(--cancel); }
.proof dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem .9rem; margin: 0 0 .75rem; }
.proof dt { color: var(--muted); font-size: .88rem; }
.proof dd { margin: 0; font-weight: 600; }
.thumbs { display: flex; gap: .6rem; flex-wrap: wrap; }
.thumbs img { height: 120px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; background: #fff; }
.thumbs .sig img { object-fit: contain; width: 200px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: .7rem; padding-bottom: .9rem; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); background: #fff; z-index: 1; }
.timeline li.done { color: var(--ink); }
.timeline li.done .dot { background: var(--done); border-color: var(--done); }
.timeline li.done.bad .dot { background: var(--cancel); border-color: var(--cancel); }
.more { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; margin-top: 1rem; }

/* ---------- hand over ---------- */
.otp { font-size: 2rem; text-align: center; letter-spacing: .6em; font-weight: 800; padding-inline-start: .6em; font-variant-numeric: tabular-nums; }
.give-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.give-row .nm { font-weight: 550; }
.give-row .of { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.stepper button { width: 38px; height: 42px; border: 0; background: var(--brand-soft); color: var(--brand); font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.stepper input { width: 56px; min-height: 42px; margin: 0; border: 0; border-radius: 0; text-align: center; font-weight: 700; padding: 0; }
.photo-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; min-height: 150px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer; overflow: hidden; text-align: center; padding: .5rem; }
.photo-drop img { max-width: 100%; max-height: 260px; border-radius: 10px; }
.sigpad { position: relative; }
.sigpad canvas { display: block; width: 100%; height: 190px; border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; touch-action: none; }
.sigpad .link { position: absolute; top: .4rem; inset-inline-end: .7rem; }
.big-ok { display: grid; place-items: center; width: 74px; height: 74px; margin: .5rem auto 1rem; border-radius: 50%; background: #e6f5ec; color: var(--done); }
.big-ok .ic { width: 40px; height: 40px; }
.sheet h2 + p.muted { margin-bottom: 1rem; }
.sheet .big-ok + h2 { text-align: center; }
.sheet .big-ok ~ p { text-align: center; }

/* ---------- lists: customers, team ---------- */
.cust-row, .user-row { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; border: 0; font: inherit; text-align: start; color: var(--ink); cursor: pointer; }
.user-row { flex-direction: row; align-items: center; gap: .75rem; }
.user-row .grow { display: flex; flex-direction: column; }
.user-row.off { opacity: .55; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; flex: none; }

/* ---------- reports ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: .6rem; }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: #fff; border-radius: 12px; padding: .8rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat.good b { color: var(--done); } .stat.bad b { color: var(--cancel); } .stat.blue b { color: var(--ready); }
.rep-head { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0 .5rem; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.rep { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rep th, .rep td { padding: .55rem .7rem; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep th { color: var(--muted); font-weight: 600; background: #faf8fa; }
.range { margin-bottom: .85rem; }

/* ---------- settings ---------- */
.settings .me { display: flex; align-items: center; gap: .75rem; }
.linkbox { padding: .6rem .8rem; border-radius: 10px; background: #f6f3f6; font-family: ui-monospace, Menlo, monospace; font-size: .82rem; word-break: break-all; }
.preview summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.preview pre { white-space: pre-wrap; font: inherit; font-size: .9rem; background: #e7f6ec; border-radius: 12px; padding: .8rem; margin: .5rem 0 0; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(900px 500px at 80% -10%, #e7d6e2 0%, transparent 60%), linear-gradient(180deg, #f6eff4, var(--bg)); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 22px; padding: 2rem 1.5rem 1.25rem; box-shadow: 0 10px 40px rgba(60, 30, 50, .12); text-align: center; }
.auth-card form { text-align: start; margin-top: 1.25rem; }
.auth-logo { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 18px; background: linear-gradient(145deg, #8a5c7e, #714b67); color: #fff; }
.auth-logo .ic { width: 34px; height: 34px; }
.lang-switch { margin-top: 1rem; }

/* ---------- sheets (dialogs) and toast ---------- */
#modal { position: fixed; inset: 0; z-index: 50; display: none; }
#modal.open { display: block; }
.sheet-back { position: absolute; inset: 0; background: rgba(20, 10, 18, .45); animation: fade .15s; }
.sheet {
  position: absolute; inset-inline: 0; bottom: 0; max-height: 90vh; overflow: auto; background: #fff; border-radius: 22px 22px 0 0;
  padding: 1.4rem 1.2rem calc(1.2rem + env(safe-area-inset-bottom)); animation: up .2s ease-out;
}
@media (min-width: 640px) { .sheet { inset-inline: auto; left: 50%; bottom: auto; top: 12vh; width: 480px; transform: translateX(-50%); border-radius: 22px; animation: fade .15s; } }
.sheet h2 { margin-bottom: .35rem; }
.sheet form.ask input { margin: .75rem 0; }
.pick { display: grid; gap: .45rem; margin: 1rem 0; }
.pick-row { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; text-align: start; cursor: pointer; color: var(--ink); }
.scanning { text-align: center; padding: 1rem 0; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
#toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); z-index: 80; transform: translate(-50%, 20px); opacity: 0;
  max-width: calc(100% - 2rem); padding: .75rem 1.1rem; border-radius: 12px; background: #2a2128; color: #fff; font-weight: 600; font-size: .95rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); pointer-events: none; transition: .2s; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { background: var(--done); } #toast.bad { background: var(--cancel); }

/* ---------- customer page ---------- */
.track { min-height: 100vh; background: linear-gradient(180deg, #f6eff4, var(--bg) 40%); }
.track-head { display: flex; align-items: center; gap: .6rem; padding: calc(.8rem + env(safe-area-inset-top)) 1rem .8rem; background: var(--brand); color: #fff; font-weight: 700; }
.track-head .link { color: #fff; }
.hero { text-align: center; padding: 1.5rem 1rem; }
.hero h1 { font-size: 1.6rem; margin: .35rem 0; }
.hero.ready h1 { color: var(--ready); } .hero.collected h1 { color: var(--done); } .hero.cancelled h1 { color: var(--cancel); }
.bigcode { margin: 1rem auto .5rem; padding: 1rem; border-radius: 16px; background: var(--brand-soft); max-width: 300px; }
.bigcode .code { font-size: 2.8rem; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; margin: 0 0 1rem; text-align: center; font-size: .82rem; font-weight: 600; color: var(--muted); }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.steps li::before { content: ""; position: absolute; top: 9px; inset-inline-end: 50%; width: 100%; height: 3px; background: var(--line); }
.steps li:first-child::before { display: none; }
.steps .dot { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--line); }
.steps li.done { color: var(--ink); }
.steps li.done .dot, .steps li.done::before { background: var(--done); border-color: var(--done); }
.steps li.now .dot { box-shadow: 0 0 0 5px color-mix(in srgb, var(--done) 25%, transparent); }

bdi { white-space: nowrap; }

/* ---------- inventory ---------- */
.c-cyan { background: linear-gradient(145deg, #22b8cf, #0b7fa0); }
.d-block { display: block; }
.warn-text { color: var(--warn); font-weight: 600; }
.stock-chip { display: inline-flex; align-items: center; gap: .35rem; margin-top: .4rem; padding: .25rem .65rem; border-radius: 999px; background: #e3f6fa; color: #0b6a85; font-size: .85rem; font-weight: 600; text-decoration: none; }
.stock-chip .ic { width: 16px; height: 16px; }
.notice .ic { flex: none; }
.lowb { background: #e11d48 !important; color: #fff; }
.search-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.search-row .search { flex: 1; margin: 0; }
.search-row .icon-btn.soft { width: 46px; height: 46px; border-radius: 12px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 .1rem .5rem; }
.list-head .check { padding: 0; font-size: .88rem; }
.list-head .check input { width: 18px; height: 18px; }
.inv-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-bottom: .85rem; }
.inv-actions .act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 72px; padding: .6rem .4rem; border-radius: var(--radius);
  border: 0; background: var(--card); box-shadow: var(--shadow); color: var(--ink); font: inherit; font-weight: 650; font-size: .9rem; text-decoration: none; cursor: pointer; }
.inv-actions .act .ic { width: 26px; height: 26px; color: #0b7fa0; }
.inv-actions .act:active { transform: scale(.98); }
.stock-row, .prod-row { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); width: 100%; border: 0; font: inherit; text-align: start; cursor: pointer; }
.stock-row.low { border-inline-start: 4px solid var(--cancel); }
.prod-row.off { opacity: .55; }
.stock-row .res { color: var(--ready); font-weight: 600; margin-top: .1rem; }
.qtybox { display: flex; flex-direction: column; align-items: flex-end; min-width: 64px; text-align: end; }
.qtybox b { font-size: 1.35rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.qtybox span { font-size: .78rem; color: var(--muted); }
.qtybox em { font-style: normal; font-size: .72rem; font-weight: 800; color: #fff; background: var(--cancel); border-radius: 6px; padding: 0 .4rem; margin-top: .15rem; }
.stock-row.low .qtybox b { color: var(--cancel); }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.inv-item .head h2 { margin: .35rem 0 .2rem; }
.inv-item .head .btn { margin-top: .5rem; padding-inline: 0; }
.intro { text-align: center; padding: 2rem 1.25rem; }
.intro h2 { margin: .5rem 0; }
.intro .btn { margin-top: .75rem; }
.menu-list { display: grid; gap: .2rem; margin: .75rem 0 1rem; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: .75rem; padding: .85rem .5rem; border: 0; border-bottom: 1px solid var(--line); background: none;
  color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; text-align: start; cursor: pointer; }
.menu-list .ic { color: var(--brand); }
.picker { position: relative; margin-bottom: .5rem; }
.sugg.static { position: static; box-shadow: none; border: 1px solid var(--line); margin-top: -.3rem; }
.sugg.static:empty { display: none; }
.sugg button.new { justify-content: flex-start; gap: .4rem; color: var(--brand); }
.line-row, .count-row { display: flex; align-items: center; gap: .5rem; padding: .7rem .8rem; }
.line-row input, .count-row input { width: 84px; min-height: 44px; margin: 0; text-align: center; font-weight: 700; font-size: 1.05rem; }
.line-row .unit, .count-row .unit { width: 38px; font-size: .8rem; color: var(--muted); }
.count-row .cb { min-width: 44px; text-align: center; }
.count-row.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 40% { background: #e3f6fa; } }
.inv-count { padding-bottom: 6rem; }
.count-foot { position: fixed; inset-inline: 0; bottom: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); box-shadow: 0 -2px 14px rgba(40, 20, 35, .1); font-weight: 600; font-size: .92rem; }
.diff-list { max-height: 45vh; overflow: auto; margin: .75rem 0; border: 1px solid var(--line); border-radius: 12px; }
.diff-list div { display: flex; justify-content: space-between; gap: .75rem; padding: .5rem .75rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
.moves { display: grid; }
.move-row { display: flex; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.move-row:last-child { border-bottom: 0; }
.mv-qty { display: flex; flex-direction: column; align-items: flex-end; text-align: end; }
.mv-qty b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mv-qty.pos b { color: var(--done); } .mv-qty.neg b { color: var(--cancel); }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .85rem; }
.filters select { margin: 0; min-height: 42px; padding: .4rem .5rem; font-size: .88rem; }
@media (max-width: 520px) { .filters { grid-template-columns: 1fr 1fr; } .filters select:first-child { grid-column: 1 / -1; } }
.row-form { display: flex; gap: .5rem; align-items: center; margin-top: .3rem; }
.row-form input { margin: 0; flex: 1; }
.scanview { width: 100%; min-height: 220px; border-radius: 14px; overflow: hidden; background: #111; margin: .75rem 0 .5rem; display: grid; place-items: center; }
.scanview video { width: 100% !important; height: auto !important; object-fit: cover; }
.scanview .loading { border-color: #444; border-top-color: #fff; }
#scanlog { min-height: 1.2em; margin-bottom: .5rem; font-weight: 600; color: var(--done); }
.sheet form#typed { margin-bottom: .5rem; }
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.imp-map label { margin: 0; }
.done-card { text-align: center; }
.btns.center { justify-content: center; }
.item-row .item-stock { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; }
.item-row .item-stock:empty { display: none; }
.item-stock select { margin: 0; min-height: 38px; padding: .3rem .5rem; font-size: .88rem; flex: 1; background: #f3fbfd; border-color: #bfe6ef; }
.item-stock select.none { background: #fff7e8; border-color: #f2d9a6; }
.item-stock span { white-space: nowrap; }
.link-row .grow { flex: 1; }
.inv-move > label, .inv-move > .btn.big { display: block; margin-top: .9rem; }
.inv-move .seg { margin-bottom: .85rem; }

/* production dates */
.lots { color: #0b6a85; font-weight: 600; margin-top: .1rem; }
.lots-list { display: grid; }
.lot-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.lot-row:last-child { border-bottom: 0; }
.lot-row small { color: var(--muted); font-weight: 500; }
.line-row { flex-wrap: wrap; }
.line-extra { flex-basis: 100%; display: flex; align-items: center; gap: .5rem; margin: .1rem 0 0; font-size: .85rem; }
.line-extra input, .line-extra select { margin: 0; min-height: 40px; flex: 1; font-size: .92rem; }
.give { color: #0b6a85; font-weight: 600; margin-top: .15rem; }
