/* Rioship (Dispatch Entry) — styles. Mobile-first; tokens on :root, dark mode on html.dark */
:root {
  /* RIO house theme (rio-color-theme): lavender paper, deep-purple ink, purple for actions, Geist type.
     Light is the default; html.dark = "Aubergine". Amber is the logo tile only. */
  --accent: #5B3E8E; --on-accent: #FFFFFF; --brand-bg: #E8A73B; --brand-ink: #2B2537;
  --bg: #F7F5FA; --card: #FFFFFF; --field: #FFFFFF;
  --ink: #2B2537; --ink2: #5E586B; --muted: #6E6878;
  --line: #D6D1DF; --line2: #E7E4EC;
  --soft: #EFEAF8;
  --accent-ink: #5B3E8E;
  --danger: #B83A2B; --ok: #1F7A57; --ok-bg: #E3F3EC; --warn: #B45309; --warn-bg: #FDF0E1;
  --scrim: rgba(43, 37, 55, .5);
  --shadow: 0 1px 2px rgba(43,37,55,.04), 0 1px 3px rgba(43,37,55,.06);
  --font: 'Geist', 'Inter', 'IBM Plex Sans Devanagari', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  color-scheme: light;
}
html.dark {
  --bg: #15111C; --card: #1E1828; --field: #241D30;
  --ink: #ECE8F3; --ink2: #A39BB2; --muted: #8F87A0;
  --line: #3D3352; --line2: #2F2740;
  --accent: #B9A3E8; --on-accent: #1E1828;
  --soft: rgba(185, 163, 232, .16);
  --accent-ink: #CDBDF0;
  --danger: #F07A6B; --ok: #4FC9A0; --ok-bg: rgba(79, 201, 160, .14); --warn: #F2B260; --warn-bg: rgba(242, 178, 96, .14);
  --scrim: rgba(0, 0, 0, .6); --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
input { font: inherit; color: var(--ink); }
input::placeholder { color: var(--muted); opacity: 1; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.ic { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 18px; height: 18px; }
.ic.lg { width: 28px; height: 28px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.scroll { scrollbar-width: none; } .scroll::-webkit-scrollbar { display: none; }
.req { color: var(--danger); }
html.dark .only-light, html:not(.dark) .only-dark { display: none; }

/* App shell: full-height column; centred card on wide screens */
.app { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; background: var(--bg); overflow: hidden; }
@media (min-width: 560px) { .app { border-left: 1px solid var(--line2); border-right: 1px solid var(--line2); } }

.top { position: relative; z-index: 6; display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line2); }
.mark { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-bg); color: var(--brand-ink); border: 0; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.mark .ic { width: 24px; height: 24px; }
.ttl { flex: 1; min-width: 0; }
.ttl h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttl .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink2); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn.ghost { border: 0; background: transparent; }
.icon-btn.danger { color: var(--danger); }
.lang-btn { height: 44px; min-width: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; flex: 0 0 auto; }
.net-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; }
.menu { position: absolute; top: calc(100% - 4px); right: 16px; width: 220px; padding: 8px; border-radius: 16px; background: var(--card); border: 1px solid var(--line2); box-shadow: 0 12px 32px rgba(16,24,40,.18); display: flex; flex-direction: column; gap: 2px; animation: up .2s ease-out; }
.menu-h { padding: 6px 10px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.opt { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.opt.sel { background: var(--soft); }
.opt .ok { color: var(--accent-ink); }
.opt-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.opt-t b { font-size: 16px; font-weight: 600; line-height: 1.3; }
.opt-t span { font-size: 13px; color: var(--muted); }

.main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 16px 28px; -webkit-overflow-scrolling: touch; }
.view { display: flex; flex-direction: column; gap: 16px; animation: fade .18s ease-out; }
.banner { padding: 10px 14px; border-radius: 12px; background: var(--soft); color: var(--ink); font-size: 14px; border: 1px solid var(--line2); }
.strip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--soft); color: var(--ink2); font-size: 14px; }
.strip b { color: var(--ink); }
.badge { padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; }
.badge.warn { background: var(--warn); color: #fff; }

.card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line2); display: flex; flex-direction: column; gap: 14px; }
.card-h { display: flex; align-items: center; gap: 10px; }
.card-h h2 { font-size: 18px; font-weight: 700; flex: 1; }
.card h3 { font-size: 16px; font-weight: 700; }
.num { width: 28px; height: 28px; border-radius: 8px; background: var(--soft); color: var(--accent-ink); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

.rows { display: flex; flex-direction: column; gap: 14px; }
.row { border: 1px solid var(--line2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.row-h { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.row-h .icon-btn { margin: -8px -6px -8px 0; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.row-main { display: flex; gap: 12px; align-items: flex-start; }
.thumb { position: relative; width: 80px; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.thumb img, .tile { width: 80px; height: 80px; border-radius: 12px; }
.thumb img { object-fit: contain; padding: 4px; background: var(--bg); border: 1px solid var(--line2); }
.tile { color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; letter-spacing: .06em; }
.tile .ic { width: 26px; height: 26px; stroke-width: 1.7; }
.tile.empty { border: 1.5px dashed var(--line); background: var(--bg); color: var(--muted); }
.cap { font-size: 12px; font-weight: 600; color: var(--accent-ink); }
.pick:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 14px; font-weight: 600; color: var(--ink2); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; }
.fld { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--field); transition: border-color .15s, box-shadow .15s; }
.fld:focus-within, .fld:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
.fld.err { border-color: var(--danger); }
.fld input { flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; background: transparent; font-size: 17px; }
.fld input[type=search]::-webkit-search-cancel-button { display: none; }
.prefix { font-size: 17px; color: var(--muted); padding-right: 8px; border-right: 1px solid var(--line2); }
.counter { font-size: 13px; color: var(--muted); }
.plate-in { font-weight: 600; letter-spacing: .06em; }
.err-msg { font-size: 13px; color: var(--danger); font-weight: 500; }
.err-msg:empty { display: none; }
.pick-btn { width: 100%; padding: 8px 12px 8px 14px; text-align: left; }
.pv { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl { font-size: 16px; font-weight: 600; line-height: 1.25; }
.pl.ph { color: var(--muted); font-weight: 400; }
.ps { font-size: 13px; color: var(--muted); }
.ps:empty { display: none; }

.stepper { display: flex; gap: 8px; }
.stepper .fld { flex: 1; min-width: 0; padding: 0 12px; }
.num-in { text-align: center; font-size: 20px !important; font-weight: 700; }
.step { width: 56px; height: 56px; flex: 0 0 auto; border-radius: 12px; border: 1.5px solid var(--line); background: var(--field); display: flex; align-items: center; justify-content: center; padding: 0; }
.step .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.step.primary { border: 0; background: var(--accent); color: var(--on-accent); }

.add-btn { height: 54px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: var(--soft); color: var(--accent-ink); font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }

.photo-empty { position: relative; height: 140px; border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: var(--soft); color: var(--accent-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-align: center; padding: 0 16px; }
.photo-empty .circle { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.photo-empty b { font-size: 16px; }
.photo-empty small { font-size: 13px; color: var(--muted); }
.photo-loading { height: 140px; border-radius: 14px; border: 1.5px dashed var(--line); background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--accent-ink); }
.photo-prev { width: 100%; height: 190px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line2); background: var(--bg); display: block; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn-sm { position: relative; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--field); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-sm.danger { color: var(--danger); }

.bar { flex: 0 0 auto; display: flex; gap: 10px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line2); }
.btn { height: 54px; padding: 0 18px; border-radius: 14px; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.secondary { border: 1.5px solid var(--line); background: var(--card); color: var(--ink2); }
.btn.primary { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 66px; padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line2); }
.tab { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 600; padding: 6px 0; }
.tab .pill { width: 56px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.tab.on { color: var(--accent-ink); }
.tab.on .pill { background: var(--soft); }

.toast { position: absolute; left: 16px; right: 16px; bottom: 156px; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; background: #1B2430; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 15px; font-weight: 500; animation: up .2s ease-out; }
.toast.low { bottom: 82px; }
.toast .dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; background: #2FB36B; }
.toast.error .dot { background: #E5484D; }
.toast.warn .dot { background: #D9822B; }
.toast .dot .ic { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; }

.overlay { position: absolute; inset: 0; z-index: 20; }
.overlay.center { z-index: 30; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .18s ease-out; }
.scrim { position: absolute; inset: 0; border: 0; background: var(--scrim); padding: 0; animation: fade .18s ease-out; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 80%; display: flex; flex-direction: column; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.18); padding-bottom: env(safe-area-inset-bottom); animation: up .22s ease-out; }
.grip { display: flex; justify-content: center; padding: 8px 0 2px; }
.grip span { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 6px 12px 10px 20px; }
.sheet-h h2 { flex: 1; font-size: 18px; font-weight: 700; }
.sheet-search { padding: 0 16px 10px; }
.sheet-search .fld { min-height: 52px; }
.sheet-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 20px; }
.opt.new { color: var(--accent-ink); font-weight: 700; border-bottom: 1px solid var(--line2); border-radius: 12px 12px 0 0; }
.opt-ic { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; background: var(--bg); color: var(--ink2); }
.opt-ic.accent { background: var(--accent); color: var(--on-accent); }
.opt-ic img { width: 40px; height: 40px; object-fit: contain; }
.empty-line { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 15px; }
.modal { width: 100%; max-width: 360px; background: var(--card); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); animation: up .22s ease-out; }
.modal h2 { font-size: 19px; font-weight: 700; }
.modal .fld { min-height: 52px; }
#mDistFields { display: flex; flex-direction: column; gap: 14px; }

/* Selected SKU block */
.row-top { display: flex; align-items: center; gap: 12px; }
.row-top .icon-btn { margin-right: -6px; }

/* Batch lines inside a SKU row */
.bline { display: flex; flex-direction: column; gap: 12px; }
.bline.multi { padding: 12px; border-radius: 12px; background: var(--bg); }
.bline-h { display: flex; align-items: center; justify-content: space-between; min-height: 28px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.bline-h .icon-btn { margin: -8px -6px -8px 0; }
.add-batch { align-self: flex-start; height: 44px; padding: 0 14px; border-radius: 10px; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: transparent; color: var(--accent-ink); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.sku-total { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--soft); font-size: 14px; color: var(--ink2); }
.sku-total b { color: var(--ink); }

/* SKU filter tabs */
.sku-filter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: 14px; background: var(--line2); }
.sku-filter .chip { position: relative; justify-content: center; height: 40px; padding: 0 6px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; gap: 4px; }
.sku-filter .chip.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); border: 0; }
.sku-filter .cnt { font-size: 12px; font-weight: 600; color: var(--muted); }
.sku-filter .dotp { position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* SKU tap grid */
.sku-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-radius: 14px; }
@media (min-width: 440px) { .sku-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sku-grid.err { outline: 2px solid var(--danger); outline-offset: 3px; }
.sku-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 124px; padding: 10px 6px 8px; border: 1.5px solid var(--line2); border-radius: 14px; background: var(--field); text-align: center; }
.sku-tile:active { transform: scale(.97); }
.sku-tile.on { border-color: var(--accent); background: var(--soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sku-img { height: 66px; display: flex; align-items: center; justify-content: center; }
.sku-img img { height: 66px; width: 40px; object-fit: contain; }
.sku-img .tile { width: 48px; height: 48px; font-size: 11px; border-radius: 10px; }
.sku-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sku-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.sku-check .ic { width: 14px; height: 14px; stroke-width: 3; }
.sku-sel { gap: 12px; padding: 8px; min-height: 72px; }
.thumb-sm { position: relative; width: 56px; height: 56px; flex: 0 0 auto; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.thumb-sm img { width: 56px; height: 56px; object-fit: contain; padding: 3px; border-radius: 10px; }
.thumb-sm .tile { width: 56px; height: 56px; font-size: 11px; border-radius: 10px; }
.thumb-sm .cam { position: absolute; right: -5px; bottom: -5px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); border: 2px solid var(--field); display: flex; align-items: center; justify-content: center; }
.thumb-sm .cam .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.btn-sm.accent { height: 44px; padding: 0 12px; flex: 0 0 auto; color: var(--accent-ink); font-size: 14px; }

/* Staff lock / PIN */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; justify-content: center; overflow-y: auto; }
.lock-in { width: 100%; max-width: 420px; padding: max(32px, env(safe-area-inset-top)) 20px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lock-in .mark { width: 56px; height: 56px; border-radius: 16px; }
.lock-in .mark .ic { width: 30px; height: 30px; }
.lock-in h1 { font-size: 22px; font-weight: 700; }
.lock-body { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.lock-q { text-align: center; font-size: 16px; color: var(--ink2); }
.staff-list { display: flex; flex-direction: column; gap: 8px; }
.staff-btn { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 14px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--card); text-align: left; font-size: 17px; font-weight: 600; }
.ini { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex: 0 0 auto; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 6px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.pin-dots i.f { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.key { height: 64px; border-radius: 16px; border: 1px solid var(--line2); background: var(--card); font-size: 24px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.key.ghost { background: transparent; border: 0; font-size: 15px; color: var(--accent-ink); }
.lock-err { text-align: center; color: var(--danger); font-size: 14px; font-weight: 600; min-height: 20px; }
.lock-note { text-align: center; color: var(--muted); font-size: 13px; }
.avatar { width: 44px; border-radius: 50%; background: var(--soft); color: var(--accent-ink); font-weight: 700; font-size: 15px; border-color: transparent; }
.user-name { padding: 0 10px 8px; font-size: 16px; font-weight: 600; }
#userMenu { width: 200px; }
.hint-ok { font-size: 13px; color: var(--ok); font-weight: 600; }
.repeat { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--soft); }
.repeat .grow b { display: block; font-size: 14px; }
.repeat .grow span { font-size: 13px; color: var(--ink2); }
.repeat .btn-sm { height: 44px; padding: 0 12px; flex: 0 0 auto; color: var(--accent-ink); font-size: 14px; }

/* Stock check */
.stock-msg { font-size: 13px; font-weight: 600; }
.stock-msg:empty { display: none; }
.stock-msg .ok { color: var(--ok); }
.stock-msg .warn { color: var(--warn); }
html.dark .stock-msg .warn { color: #F5A35C; }
.bchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bchips:empty { display: none; }
.bchips-l { font-size: 12px; color: var(--muted); width: 100%; }
.bchip { height: 36px; padding: 0 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; letter-spacing: .03em; }
.bchip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.confirm-body { font-size: 15px; color: var(--ink2); }
.confirm-body p { margin: 0 0 8px; }
.confirm-body ul { margin: 0; padding-left: 18px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.btn.warnbtn { border: 0; background: var(--warn); color: #fff; font-weight: 700; }

/* FIFO / expiry */
.stock-msg { display: flex; flex-direction: column; gap: 2px; }
.stock-msg .bad { color: var(--danger); }
.bchip { height: auto; min-height: 36px; padding: 4px 10px; display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; border-radius: 12px; }
.bchip small { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.bchip em { font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ok); }
.bchip.first { border-color: var(--ok); background: var(--ok-bg); }

/* Delivery + dashboard additions */
.badge.okb { background: var(--ok-bg); color: var(--ok); }
.dok { color: var(--ok); font-weight: 600; }
.ic.xs { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; stroke-width: 2.4; }
.avg-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 14px; color: var(--ink2); }
.avg-row b { font-size: 18px; color: var(--ink); }
.mix { display: flex; height: 18px; border-radius: 9px; overflow: hidden; background: var(--line2); }
.mix-can { background: var(--accent); }
.mix-pet { background: #D9822B; }
.lg i.mix-can, .lg i.mix-pet { display: inline-block; }
.ns-seg { align-self: flex-start; }
.ns-list { display: flex; flex-direction: column; }
.ns-item { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line2); font-size: 14px; }
.ns-item:last-child { border-bottom: 0; }
.ns-item span { color: var(--ink2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-item b { white-space: nowrap; font-size: 13px; }
.warn { color: var(--warn); } .bad { color: var(--danger); }
html.dark .warn { color: #F5A35C; }
.rank { margin: 0; padding: 0; list-style: none; counter-reset: r; display: flex; flex-direction: column; }
.rank li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: 14px; }
.rank li:last-child { border-bottom: 0; }
.rank li::before { content: counter(r); width: 24px; height: 24px; border-radius: 50%; background: var(--soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.rank li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.rank li b { font-size: 13px; }
html.confirm-mode .nav, html.confirm-mode .bar, html.confirm-mode #btnUser, html.confirm-mode #lock { display: none !important; }

/* Email login */
.lock-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.lock-form .fld { min-height: 54px; }
.link-btn { border: 0; background: transparent; color: var(--accent-ink); font-size: 14px; font-weight: 600; padding: 8px 4px; min-height: 44px; }
.link-btn.center { align-self: center; }

/* Empty SKU hint */
.rows-empty { padding: 14px; border-radius: 12px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 14px; text-align: center; }

/* Home dashboard */
.dash-controls { display: flex; align-items: center; gap: 8px; }
.date-chip { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); display: flex; align-items: center; gap: 6px; color: var(--ink2); }
.date-chip { position: relative; overflow: hidden; cursor: pointer; }
.date-chip span { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.date-chip input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.date-chip input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding: 0; cursor: pointer; }
.date-chip:focus-within { border-color: var(--accent); }
.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--line2); flex: 0 0 auto; }
.seg-b { height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink2); }
.seg-b.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.dash { display: flex; flex-direction: column; gap: 16px; }
.d-card { background: var(--card); border: 1px solid var(--line2); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.d-head { display: flex; align-items: center; gap: 8px; }
.d-head h2 { flex: 1; font-size: 17px; font-weight: 700; }
.d-pill { padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; text-align: center; gap: 8px; }
.vs small { display: block; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.vs b { display: block; font-size: 32px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.vs .x { font-size: 15px; color: var(--muted); padding-bottom: 8px; }
.delta { align-self: center; display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger); }
.delta .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.d-sub { text-align: center; font-size: 13px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { padding: 12px; border-radius: 12px; background: var(--bg); }
.kpi b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--ink2); }
.donut-wrap { display: flex; justify-content: center; }
.donut { position: relative; width: 180px; height: 180px; }
.donut svg { width: 180px; height: 180px; transform: rotate(-90deg); }
.donut .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .c span { font-size: 13px; color: var(--muted); }
.donut .c b { font-size: 22px; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-direction: column; gap: 8px; }
.lg { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.lg i { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.lg span { flex: 1; min-width: 0; color: var(--ink2); }
.lg b { font-variant-numeric: tabular-nums; }
.lg em { font-style: normal; color: var(--muted); font-size: 12px; width: 42px; text-align: right; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hb-l { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.hb-l span { color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-l b { font-variant-numeric: tabular-nums; }
.hb-t { height: 12px; border-radius: 6px; background: var(--line2); overflow: hidden; }
.hb-f { height: 100%; border-radius: 6px; background: var(--accent); }
.vbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; }
.vb { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vb b { font-size: 11px; font-weight: 600; color: var(--ink2); font-variant-numeric: tabular-nums; }
.vb-t { height: 132px; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.vbar { width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--accent) 45%, var(--card)); min-height: 2px; }
.vbar.cur { background: var(--accent); }
.vb span { font-size: 11px; color: var(--muted); }
.d-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* Summary */
.back { align-self: flex-start; height: 44px; padding: 0 14px 0 8px; margin: -4px 0 -4px -8px; border: 0; border-radius: 10px; background: transparent; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; }
.hero { align-items: center; text-align: center; gap: 6px; padding: 20px 16px; }
.hero h2 { font-size: 20px; font-weight: 700; }
.ok-circle { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.ok-circle .ic { width: 30px; height: 30px; stroke-width: 2.4; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 10px; }
.stat { padding: 12px; border-radius: 12px; background: var(--soft); }
.stat b { display: block; font-size: 26px; color: var(--accent-ink); line-height: 1.1; }
.stat span { font-size: 13px; color: var(--ink2); }
.line-item { display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line2); }
.line-item img, .line-item .tile { width: 52px; height: 52px; border-radius: 10px; flex: 0 0 auto; }
.line-item img { object-fit: contain; padding: 3px; background: var(--bg); }
.line-item .tile .ic { display: none; }
.qty { text-align: right; }
.qty b { display: block; font-size: 20px; }
.qty span { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kv small { display: block; font-size: 12px; color: var(--muted); }
.kv b { font-size: 15px; font-weight: 600; word-break: break-word; }
.plate { display: inline-block; margin-top: 2px; padding: 2px 8px; border-radius: 6px; border: 1.5px solid var(--ink); font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.sum-photo { width: 100%; height: 180px; object-fit: cover; border-radius: 12px; display: block; background: var(--bg); }
.no-photo { height: 64px; border-radius: 12px; background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }
.share-h { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wa { height: 52px; border-radius: 14px; background: #1A7F45; color: #fff; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600; }
.pdf { height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600; }

/* History */
.hist-h { display: flex; align-items: center; gap: 10px; }
.hist-h h2 { font-size: 22px; font-weight: 700; flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; }
.chips-in { display: flex; gap: 8px; }
.chip { flex: 0 0 auto; height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink2); font-size: 15px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
label.chip { padding: 0 12px; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.h-list { display: flex; flex-direction: column; gap: 10px; }
.h-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line2); box-shadow: var(--shadow); text-align: left; }
.h-date { width: 54px; height: 58px; border-radius: 12px; background: var(--soft); color: var(--accent-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; flex: 0 0 auto; }
.h-date b { font-size: 20px; } .h-date span { font-size: 12px; font-weight: 600; }
.h-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.h-mid b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-mid span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend { color: var(--warn); font-weight: 600; }
html.dark .pend { color: #F5A35C; }
.empty { padding: 36px 20px; border-radius: 18px; background: var(--card); border: 1px dashed var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.empty .circle { width: 60px; height: 60px; border-radius: 50%; background: var(--soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.empty b { font-size: 17px; } .empty span { font-size: 14px; color: var(--muted); }
.empty .btn { height: 48px; margin-top: 8px; }
.skel-card { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line2); }
.skel { animation: shimmer 1.2s ease-in-out infinite; background: var(--line2); border-radius: 8px; }

.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Print / PDF: only the summary */
@media print {
  body { background: #fff; }
  .app { height: auto; overflow: visible; max-width: none; border: 0; }
  .top, .nav, .bar, .toast, .overlay, #formView, #historyView, .share, .back { display: none !important; }
  .main { overflow: visible; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---- SKU list: one line per SKU with cases stepper + batch no. ---- */
.sku-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; border-radius: 14px; }
.sku-list.err { outline: 2px solid var(--danger); outline-offset: 3px; }
.srow { padding: 10px; gap: 8px; border-radius: 14px; border: 1.5px solid var(--line2); background: var(--card); transition: border-color .15s, background .15s; }
.srow.on { border-color: var(--accent); background: var(--soft); }
.sline { gap: 6px; }
.sline.extra { padding-top: 8px; border-top: 1px dashed var(--line); }
.sline-top { display: flex; align-items: center; gap: 10px; }
.sinfo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.sthumb { position: relative; width: 38px; height: 50px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sthumb img { width: 38px; height: 50px; object-fit: contain; }
.sthumb .tile { width: 38px; height: 38px; font-size: 10px; border-radius: 9px; }
.sname { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sname b { font-size: 14px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.sname small { font-size: 12px; color: var(--muted); line-height: 1.2; }
.sname small:empty { display: none; }
.sname.sub b { font-size: 13px; color: var(--ink2); }
.sinfo .icon-btn { width: 36px; height: 36px; margin-left: -6px; }
.sctl { flex: 0 0 136px; width: 136px; display: flex; flex-direction: column; gap: 6px; }
.stepper.sm { gap: 4px; }
.stepper.sm .step { width: 40px; height: 40px; border-radius: 10px; }
.stepper.sm .step .ic { width: 18px; height: 18px; }
.stepper.sm .fld { min-height: 40px; padding: 0 2px; border-radius: 10px; }
.stepper.sm .fld input { height: 36px; font-size: 17px !important; }
.bfld { min-height: 40px; padding: 0 10px; border-radius: 10px; }
.bfld input { height: 36px; font-size: 16px; font-weight: 600; letter-spacing: .02em; }
.bfld input::placeholder { font-weight: 400; letter-spacing: 0; }
.srow .err-msg:empty, .srow .stock-msg:empty, .srow .bchips:empty { display: none; }
.srow-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.add-batch.sm { height: 36px; padding: 0 10px; font-size: 13px; }
.sku-sub { font-size: 13px; color: var(--ink2); }
.sku-sub b { color: var(--ink); }

@media (max-width: 330px) { .sline-top { flex-wrap: wrap; } .sctl { flex-basis: 100%; width: 100%; } }

.add-b { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; min-height: 30px; padding: 0 10px; border-radius: 999px; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: transparent; color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.add-b .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.srow.on .add-b { background: var(--card); }
.dl-btn { flex: 0 0 auto; }
.dl-btn { height: 44px; padding: 0 12px; font-size: 14px; color: var(--accent-ink); }

/* History date chip: the real date input sits invisibly over the whole chip, and its calendar button is stretched
   across it, so a tap anywhere opens the picker (phones, desktop, and embedded previews alike). */
.date-chip-h { position: relative; overflow: hidden; flex: 0 0 auto; cursor: pointer; }
.date-chip-h input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.date-chip-h input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding: 0; cursor: pointer; }

/* Brand: rio wordmark on the amber logo tile + "Rioship" title */
.rio-logo { width: 30px; height: auto; fill: currentColor; display: block; }
.lock-in .mark .rio-logo { width: 38px; }
.brand-name .hl { color: var(--accent-ink); }
.toast .dot .ic { stroke: var(--on-accent); }

/* email-code login */
.lock-mail { color: var(--ink); font-weight: 700; word-break: break-all; }
.otp-in { font-size: 24px !important; font-weight: 700; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.lock-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lock-links .link-btn:disabled { color: var(--muted); opacity: 1; }

body, input, button { font-variant-numeric: tabular-nums; }
.brand-name .hl { color: var(--accent-ink); }
