/* Omni Move — built for phones held in one gloved hand, in a bright dock or a dim aisle.
   One job per screen: a step strip shows where you are, one big orange button says what to do next.
   Big targets (min 48px), high contrast, numbers before words. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #15171a;
  --muted: #5d6470;
  --line: #dde1e6;
  --brand: #f57c00;
  --brand-ink: #ffffff;
  --brand-dark: #c45f00;
  --brand-soft: #fff4ea;
  --ok: #1b7a3a;
  --ok-bg: #e6f4ea;
  --warn: #9a5b00;
  --warn-bg: #fff3dc;
  --bad: #b3261e;
  --bad-bg: #fde7e6;
  --info: #1859b5;
  --info-bg: #e8f0fd;
  --radius: 16px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
/* nothing may push the page sideways: on a phone that zooms the whole app out */
html, body { overflow-x: hidden; }
main, #modal .box, #scanner .sc-msg { overflow-wrap: anywhere; }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--info); }
[hidden] { display: none !important; }

.boot { padding: 48px 16px; text-align: center; color: var(--muted); }

/* header: who is signed in, connection, uploads waiting, language */
#top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: var(--card); border-bottom: 1px solid var(--line);
}
#top .who { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teamchip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 15px; color: #fff; background: var(--brand); white-space: nowrap; }
.teamchip.t-new { background: var(--info); }
.teamchip.t-admin { background: #3d4552; }
.topchip { border: 0; border-radius: 999px; padding: 5px 10px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.topchip.warn { background: var(--warn-bg); color: var(--warn); }
.topchip.bad { background: var(--bad); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(179, 38, 30, .25); } }
.net { flex: none; width: 12px; height: 12px; border-radius: 999px; background: var(--ok); }
.net.bad { width: auto; height: auto; padding: 5px 10px; background: var(--bad); color: #fff; font-weight: 800; font-size: 13px; white-space: nowrap; }
.iconbtn { min-width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 800; padding: 0 10px; }

#banner .bar { margin: 8px 12px 0; padding: 12px 14px; border-radius: 12px; font-weight: 700; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
#banner .bar.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d49a; }
#banner .bar button { background: #fff; color: inherit; border: 1px solid #e2b766; border-radius: 8px; padding: 8px 12px; font-weight: 800; }

main { padding: 12px; max-width: 760px; margin: 0 auto; }
h1 { font-size: 24px; margin: 4px 0 12px; }
h3 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.bad-t { color: var(--bad); font-weight: 700; }
.warn-t { color: var(--warn); font-weight: 800; }

.titlebar { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.titlebar h1 { margin: 0; flex: 1; min-width: 0; }
.back { flex: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 30px; line-height: 1; font-weight: 700; padding: 0 0 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 12px 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  font-weight: 800; font-size: 18px; cursor: pointer; text-decoration: none; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:active { background: var(--brand-dark); }
.btn.big { min-height: 72px; font-size: 21px; border-radius: 18px; }
.btn.xl { min-height: 96px; font-size: 24px; border-radius: 20px; font-weight: 900; }
.btn.cam { flex-direction: column; gap: 6px; min-height: 168px; }
.btn.cam .icon { font-size: 52px; line-height: 1; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--card); border-color: #f1b5b1; color: var(--bad); }
.btn.outline { background: var(--card); border: 2px solid var(--ink); }
.btn.slim { min-height: 44px; font-size: 16px; padding: 8px 14px; width: auto; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btns { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.btns.three { grid-template-columns: 1fr 1fr 1fr; }
main > .btn { margin-bottom: 12px; }
.linkbtn { display: block; margin: 0 auto; background: none; border: 0; color: var(--muted); font-weight: 700; text-decoration: underline; padding: 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 800; line-height: 1.6; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.mute { background: #eceef1; color: var(--muted); }

.code { font-weight: 900; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.code.huge { font-size: 72px; line-height: 1; }
.code.big { font-size: 38px; line-height: 1.05; }

/* step strip: where the person is in the job */
.steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 8px; border-radius: 12px; background: #e9ecf0; color: var(--muted); font-weight: 800; font-size: 15px; }
.steps .n { flex: none; width: 26px; height: 26px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: #fff; font-size: 14px; }
.steps .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps li.on { background: var(--brand); color: #fff; }
.steps li.on .n { color: var(--brand-dark); }
.steps li.done { background: var(--ok-bg); color: var(--ok); }
.steps li.done .n { background: var(--ok); color: #fff; }

/* the current step, one big card */
.stage { background: var(--card); border: 2px solid var(--brand); border-radius: 22px; padding: 18px 16px; margin-bottom: 14px; text-align: center; }
.stage > * + * { margin-top: 12px; }
.stage.bad { border-color: var(--bad); background: #fff8f7; }
.stage .icon { font-size: 60px; line-height: 1; }
.stage-msg { font-size: 19px; font-weight: 800; color: var(--muted); }
.stage-msg.ok { color: var(--ok); }
.stage-msg.bad { color: var(--bad); }
.spinner { width: 44px; height: 44px; border-radius: 999px; border: 5px solid #f3d3b5; border-top-color: var(--brand); margin: 6px auto; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the truck being loaded */
.truckbar { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.truckbar .tb-t { font-size: 24px; font-weight: 900; }
.truckbar .tb-n { text-align: center; }
.truckbar .tb-n b { display: block; font-size: 32px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.truckbar .tb-n span { font-size: 13px; color: var(--muted); font-weight: 700; }

/* a truck the new warehouse is waiting for */
.tcard { background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 14px; margin-bottom: 14px; }
.tcard > * + * { margin-top: 10px; }
.tcard.s-in_transit { border-color: #f0d49a; }
.tcard.s-arrived { border-color: #9fd3ad; }
.tc-head { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.tc-t { flex: 1; min-width: 0; font-size: 26px; font-weight: 900; }
.tc-go { font-size: 32px; line-height: 1; color: var(--muted); }
.tc-n { font-variant-numeric: tabular-nums; }
.tc-n b { font-size: 60px; font-weight: 900; line-height: 1; }
.tc-n span { font-size: 28px; font-weight: 800; color: var(--muted); margin-left: 6px; }
.tc-time { font-size: 14px; color: var(--muted); }

/* numbers */
.kpi4, .nums2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.kpi4 > div, .nums2 > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi4 b, .nums2 b { display: block; font-size: 38px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi4 span, .nums2 span { font-size: 15px; color: var(--muted); font-weight: 700; }
.kpi4 .ok b, .nums2 .ok b { color: var(--ok); }
.kpi4 .warn b, .nums2 .warn b { color: var(--warn); }

/* lists: a title with a count, then one line per pallet */
.sec { margin: 16px 0 12px; }
.sh { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px 6px; font-weight: 800; font-size: 18px; list-style: none; }
summary.sh { cursor: pointer; }
summary.sh::-webkit-details-marker { display: none; }
details.sec > summary.sh::after { content: '▾'; margin-left: auto; color: var(--muted); font-size: 20px; }
details.sec[open] > summary.sh::after { content: '▴'; }
.sh-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-n { flex: none; background: #e3e6ea; border-radius: 999px; padding: 0 10px; font-size: 15px; line-height: 1.7; }
.sh .btn.slim { flex: none; margin-left: auto; white-space: nowrap; }
details.sec > summary.sh .btn.slim { margin-left: auto; margin-right: 4px; }
.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.r { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 6px 12px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.r:first-child { border-top: 0; }
.r .rt { flex: none; width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #e9ecef; }
.r .rc { flex: none; font-weight: 900; font-variant-numeric: tabular-nums; }
.r .rs { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 15px; }
.r .rs.strong { color: var(--ink); font-weight: 800; font-size: 17px; }
.r .rs.wrap { white-space: normal; }
.r .rside { flex: none; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); text-align: right; }
.r .ri { flex: none; width: 30px; font-size: 22px; text-align: center; }
.r.solo { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.bign { font-size: 26px; font-weight: 900; color: var(--ink); }
.dot { flex: none; width: 10px; height: 10px; border-radius: 999px; }
.dot.bad { background: var(--bad); }
.empty-state { text-align: center; color: var(--muted); padding: 32px 12px; font-size: 18px; font-weight: 700; }
.empty-state .icon { font-size: 52px; line-height: 1.2; }

.progress { height: 14px; background: #e8ebef; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }

/* chips: problems on the board, places on a pallet, recent locations */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #c7cdd4; background: #fff; border-radius: 999px; padding: 9px 13px; font-weight: 800; font-size: 15px; text-decoration: none; color: inherit; }
.chip.bad { border-color: #f1b5b1; color: var(--bad); background: var(--bad-bg); }
.chip.warn { border-color: #f0d49a; color: var(--warn); background: var(--warn-bg); }
.chip.info { border-color: #bcd0f5; color: var(--info); background: var(--info-bg); }
.chip.okc { border-color: #b7dfc3; color: var(--ok); background: var(--ok-bg); }
.chip.on { box-shadow: 0 0 0 3px currentColor; }

/* forms */
input.field, select.field, textarea.field {
  width: 100%; min-height: 54px; padding: 10px 12px; border: 1px solid #c7cdd4; border-radius: 12px; background: #fff; font-size: 18px;
}
input.field.big { min-height: 62px; font-size: 21px; text-align: center; }
textarea.field { min-height: 120px; }
input.field:focus, textarea.field:focus { outline: 3px solid rgba(245, 124, 0, .25); border-color: var(--brand); }
label.lbl { display: block; font-size: 14px; font-weight: 800; color: var(--muted); margin: 10px 0 4px; }
#bd-q { margin-bottom: 12px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 16px; }
.seg button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* sign in */
.login { max-width: 460px; margin: 0 auto; padding-top: 4px; }
.login > * + * { margin-top: 12px; }
.login h1 { font-size: 30px; margin: 18px 0 6px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.teamcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 8px; border-radius: 20px; border: 3px solid var(--line); background: #fff; }
.teamcard .ti { font-size: 44px; line-height: 1; }
.teamcard .tn { font-size: 21px; font-weight: 900; }
.teamcard .ts { font-size: 14px; color: var(--muted); }
.teamcard.on { border-color: var(--brand); background: var(--brand-soft); }
.err { color: var(--bad); font-weight: 800; text-align: center; min-height: 1.4em; margin: 8px 0 0; }

/* pallet page */
.phead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.phead .code { flex: 1; min-width: 0; }
.photo { width: 100%; border-radius: 12px; background: #e9ecef; display: block; }
a.photo-wrap { display: block; margin-bottom: 12px; }
.ctitle { margin-bottom: 4px; }
.acts { margin: 0 0 12px; }
main > .btn.primary.big { margin-bottom: 12px; }
details.fold summary { font-size: 14px; color: var(--muted); font-weight: 800; padding: 8px 0 0; cursor: pointer; }

table.lines { width: 100%; border-collapse: collapse; font-size: 15px; }
table.lines th { text-align: left; font-size: 13px; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.lines td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.lines tr.unc td { background: var(--warn-bg); }
.tl { font-size: 14px; }
.tl .ev { padding: 6px 0; border-top: 1px dashed var(--line); display: flex; gap: 8px; }
.tl .ev:first-child { border-top: 0; }
.tl .ev .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl .ev .grow { min-width: 0; }
.tl .res { margin-top: 3px; padding: 4px 8px; border-radius: 8px; font-weight: 700; }
.tl .res.warn { background: var(--warn-bg); color: var(--warn); }
.tl .res.bad { background: var(--bad-bg); color: var(--bad); }

.editor .ln { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: #fff; }
.editor .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.editor .grid .wide { grid-column: 1 / -1; }
.editor input { min-height: 46px; font-size: 17px; }

/* location labels */
.gen .row input.field { text-align: center; }
#lb-row, #lb-list { text-transform: uppercase; }
.preview { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; color: var(--muted); min-height: 1.4em; }
.preview.bad { color: var(--bad); font-weight: 700; }

/* print station */
.station-status { font-size: 24px; font-weight: 900; color: var(--ok); }
.station-status.warn { color: var(--warn); }
.station-status.bad { color: var(--bad); }
pre.hint { white-space: pre-wrap; background: #f6f7f9; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; font-size: 14px; }

/* bottom navigation */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--card); border-top: 1px solid var(--line);
}
#nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 800; }
#nav a .i { font-size: 22px; line-height: 1; }
#nav a.on { color: var(--brand-dark); box-shadow: inset 0 3px 0 var(--brand); }

#toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast .t { max-width: 560px; width: 100%; padding: 14px 16px; border-radius: 12px; font-weight: 800; font-size: 17px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); color: #fff; background: #23272e; }
#toast .t.ok { background: var(--ok); }
#toast .t.warn { background: #b86e00; }
#toast .t.bad { background: var(--bad); }

#modal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 15, .55); display: flex; align-items: flex-end; justify-content: center; padding: 12px; }
#modal .box { background: #fff; border-radius: 20px; padding: 18px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
#modal .box h3 { font-size: 21px; margin: 0 0 10px; }
#modal .box .btns { margin-top: 14px; }
@media (min-width: 600px) { #modal { align-items: center; } }

/* scanner */
#scanner { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; display: flex; flex-direction: column; }
#scanner .sc-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: rgba(0, 0, 0, .6); }
#scanner .sc-title { flex: 1; min-width: 0; font-weight: 900; font-size: 20px; }
#scanner .sc-close { background: #fff; color: #000; border: 0; border-radius: 12px; min-height: 48px; padding: 0 18px; font-weight: 900; font-size: 17px; }
#scanner .sc-view { position: relative; flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; }
#scanner video { width: 100%; height: 100%; object-fit: cover; }
#scanner .sc-frame { position: absolute; width: min(70vw, 340px); height: min(70vw, 340px); border: 4px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
#scanner .sc-hint { position: absolute; top: 12px; left: 12px; right: 12px; text-align: center; font-weight: 900; font-size: 22px; text-shadow: 0 1px 4px #000; }
#scanner .sc-count { position: absolute; bottom: 12px; left: 12px; right: 12px; text-align: center; font-weight: 900; font-size: 40px; text-shadow: 0 1px 6px #000; }
#scanner .sc-view::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
#scanner .sc-view.fl-ok::after { animation: flash-ok .7s ease-out; }
#scanner .sc-view.fl-warn::after { animation: flash-warn .7s ease-out; }
#scanner .sc-view.fl-bad::after { animation: flash-bad .9s ease-out; }
@keyframes flash-ok { from { box-shadow: inset 0 0 0 18px #2fb35a; background: rgba(47, 179, 90, .35); } to { box-shadow: inset 0 0 0 0 transparent; background: transparent; } }
@keyframes flash-warn { from { box-shadow: inset 0 0 0 18px #e08a00; background: rgba(224, 138, 0, .35); } to { box-shadow: inset 0 0 0 0 transparent; background: transparent; } }
@keyframes flash-bad { from { box-shadow: inset 0 0 0 18px #d33a30; background: rgba(211, 58, 48, .4); } to { box-shadow: inset 0 0 0 0 transparent; background: transparent; } }
#scanner .sc-msg { margin: 0; padding: 14px 16px; font-weight: 900; font-size: 20px; min-height: 58px; }
#scanner .sc-msg.ok { background: var(--ok); }
#scanner .sc-msg.warn { background: #b86e00; }
#scanner .sc-msg.bad { background: var(--bad); }
#scanner .sc-msg.idle { background: #1c1f24; color: #cfd3d8; }
#scanner .sc-msg.idle:empty { min-height: 0; padding: 0; }
#scanner .sc-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px 0; background: #111; }
#scanner .sc-chips:empty { display: none; }
#scanner .sc-chips button { border: 0; border-radius: 999px; padding: 10px 14px; background: #2b3038; color: #fff; font-weight: 800; font-size: 16px; }
#scanner .sc-manual { display: flex; gap: 8px; padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); background: #111; }
#scanner .sc-manual input { flex: 1; min-width: 0; min-height: 52px; border-radius: 12px; border: 0; padding: 0 12px; font-size: 19px; color: #000; }
#scanner .sc-manual button { min-height: 52px; border-radius: 12px; border: 0; background: var(--brand); color: #fff; font-weight: 900; padding: 0 18px; font-size: 17px; }
#scanner .sc-err { padding: 24px 16px; text-align: center; font-size: 18px; }
