/* WHL FedEx Loading Verification — industrial, glove-friendly, high contrast */
:root {
  --navy: #0B1F3A;
  --navy-deep: #07152A;
  --panel: #12284A;
  --panel-2: #183258;
  --line: #24436F;
  --muted: #A9BCD6;
  --text: #FFFFFF;
  --ok: #15803D;
  --ok-bright: #22C55E;
  --ok-ink: #6EE7A0;
  --bad: #B91C1C;
  --bad-bright: #EF4444;
  --warn: #FACC15;
  --warn-ink: #0B1F3A;
  --info: #2563EB;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--text); font-family: var(--sans); }
body { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
#app { min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, input, select, textarea { font: inherit; }
a { color: #8CC2FF; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.boot { margin: auto; text-align: center; padding: 24px; }

/* ---------- brand header ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: var(--navy-deep); border-bottom: 1px solid var(--line); }
.topbar .back { min-width: 56px; height: 56px; border-radius: 12px; border: 2px solid var(--line); background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.topbar .titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.brand-top { font-weight: 800; font-size: 13px; letter-spacing: .18em; color: var(--muted); }
.brand-title { font-weight: 800; font-size: 22px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { text-align: right; font-size: 14px; color: var(--muted); line-height: 1.3; }
.topbar .who strong { color: var(--text); display: block; font-size: 16px; }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.pill .dot { width: 11px; height: 11px; border-radius: 50%; background: currentColor; }
.pill.ok { background: #0E2E22; color: var(--ok-ink); }
.pill.wait { background: #3A3208; color: var(--warn); }
.pill.off { background: #3A1010; color: #FCA5A5; }

/* ---------- layout ---------- */
.page { flex: 1; padding: 22px 20px 28px; display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 1100px; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2, .section-title { margin: 0 0 12px; font-size: 15px; letter-spacing: .14em; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 40px; line-height: 1; }
.stat span { color: var(--muted); font-size: 15px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn { min-height: 64px; padding: 14px 22px; border-radius: var(--radius); border: 2px solid transparent; font-weight: 800; font-size: 20px; letter-spacing: .03em; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; text-align: center; color: var(--text); background: var(--panel-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 24px; height: 24px; flex: none; }
.btn-xl { min-height: 92px; font-size: 26px; }
.btn-primary { background: #FFFFFF; color: var(--navy); }
.btn-go { background: var(--ok); color: #FFFFFF; }
.btn-danger { background: var(--bad); color: #FFFFFF; }
.btn-warn { background: var(--warn); color: var(--warn-ink); }
.btn-ghost { background: transparent; border-color: #3B5E8F; color: var(--text); }
.btn-sm { min-height: 48px; font-size: 16px; padding: 8px 16px; }
.btn-block { width: 100%; }
.tile { min-height: 130px; flex-direction: column; align-items: flex-start; justify-content: space-between; text-align: left; padding: 20px; }
.tile small { font-size: 15px; font-weight: 600; opacity: .8; letter-spacing: 0; }
.tile svg { width: 34px; height: 34px; }

/* ---------- forms ---------- */
label.field { display: flex; flex-direction: column; gap: 8px; font-weight: 700; font-size: 16px; }
label.field .hint { font-weight: 500; color: var(--muted); font-size: 14px; }
.input, select.input, textarea.input { width: 100%; min-height: 60px; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--line); background: #FFFFFF; color: var(--navy); font-size: 21px; font-weight: 600; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: 4px solid #60A5FA; outline-offset: 1px; }
.input[readonly] { background: #D9E2EE; color: #22324A; }
.readonly-row { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 18px; }
.readonly-row span { color: var(--muted); }
.stepper { display: grid; grid-template-columns: 76px 1fr 76px; gap: 10px; }
.stepper .input { text-align: center; font-size: 34px; font-weight: 800; }
.stepper button { min-height: 72px; font-size: 34px; }
.check { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--panel-2); font-size: 20px; font-weight: 700; cursor: pointer; }
.check input { width: 36px; height: 36px; accent-color: var(--ok-bright); flex: none; }
.error { background: #3A1010; border: 2px solid var(--bad-bright); color: #FECACA; padding: 14px 16px; border-radius: 12px; font-weight: 700; font-size: 17px; }
.note { background: #2C2709; border: 2px solid #8A7410; color: #FDE68A; padding: 12px 16px; border-radius: 12px; font-size: 15px; }

/* ---------- PIN pad ---------- */
.pin-dots { display: flex; gap: 18px; justify-content: center; margin: 6px 0 4px; }
.pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--muted); }
.pin-dots i.on { background: #FFFFFF; border-color: #FFFFFF; }
.pinpad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pinpad button { min-height: 74px; font-size: 32px; font-weight: 800; border-radius: var(--radius); border: 2px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.pinpad button:active { background: #24436F; }
.login-box { width: 100%; max-width: 460px; margin: auto; display: flex; flex-direction: column; gap: 18px; padding: 24px 20px; }

/* ---------- scanning station ---------- */
.scan { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.scan-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 20px; font-size: 16px; color: var(--muted); border-bottom: 1px solid var(--line); grid-area: meta; }
.scan .counter { grid-area: count; }
.scan .progress { grid-area: prog; }
.scan .cam-wrap { grid-area: cam; flex: 1 1 380px; }
.scan .lastscans { grid-area: last; }
.scan .scan-actions { grid-area: act; }
.scan-meta strong { color: var(--text); }
.counter { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 14px 20px 8px; }
.counter .big { font-weight: 900; font-size: clamp(76px, 15vw, 128px); line-height: .85; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.counter .of { font-weight: 800; font-size: clamp(34px, 6vw, 54px); color: var(--muted); }
.counter .label { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-bottom: 6px; }
.counter .label b { font-size: 24px; letter-spacing: .08em; }
.counter .label span { font-size: 20px; font-weight: 700; color: var(--warn); }
.counter .label span.done { color: var(--ok-ink); }
.progress { margin: 0 20px 14px; height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; background: var(--ok-bright); border-radius: 7px; transition: width .25s; }
.progress.over div { background: var(--warn); }
.cam-wrap { position: relative; margin: 0 20px; border-radius: 16px; overflow: hidden; background: #0A0E14; min-height: 300px; }
.cam-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-wrap .aim { position: absolute; left: 4%; right: 4%; top: 25%; height: 50%; border: 4px solid #7DB4FF; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); transition: border-color .15s; }
.cam-wrap .aim::after { content: ""; position: absolute; left: 3%; right: 3%; top: 50%; height: 3px; background: currentColor; color: #7DB4FF; opacity: .9; }
.cam-wrap.s-ok .aim { border-color: var(--ok-bright); }
.cam-wrap.s-dup .aim { border-color: var(--bad-bright); }
.cam-wrap.s-bad .aim { border-color: var(--warn); }
.cam-hint { position: absolute; top: 12px; left: 0; right: 0; text-align: center; font-size: 17px; font-weight: 600; color: #DCE6F2; text-shadow: 0 1px 3px #000; }
.cam-start { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7, 21, 42, .92); padding: 20px; text-align: center; }
.banner { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: rgba(7, 21, 42, .88); }
.banner .t { font-weight: 900; font-size: 30px; letter-spacing: .03em; }
.banner .s { font-size: 18px; font-weight: 600; }
.banner .n { font-family: var(--mono); font-weight: 800; font-size: 22px; }
.banner.ok { background: var(--ok); }
.banner.dup { background: var(--bad); }
.banner.bad { background: var(--warn); color: var(--warn-ink); }
.flash-dup { animation: flash .25s 3; }
@keyframes flash { 50% { filter: brightness(1.6); } }
.lastscans { margin: 14px 20px 0; }
.lastscans .row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 17px; }
.lastscans .row .mono { font-size: 18px; }
.sync-ico { font-size: 14px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.sync-ico.ok { background: #0E2E22; color: var(--ok-ink); }
.sync-ico.wait { background: #3A3208; color: var(--warn); }
.sync-ico.man { background: #3A2A08; color: #FCD34D; }
.scan-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; padding: 16px 20px 20px; }
/* landscape iPad: camera left, numbers right */
@media (orientation: landscape) and (min-width: 900px) {
  .scan { display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: auto auto auto 1fr auto;
          grid-template-areas: "meta meta" "cam count" "cam prog" "cam last" "cam act"; }
  .scan .cam-wrap { margin: 16px 0 20px 20px; }
  .scan .lastscans { overflow: auto; }
  .scan .scan-actions { grid-template-columns: 1fr; }
}

/* ---------- result panels ---------- */
.result { border-radius: 18px; padding: 28px 22px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.result.ok { background: var(--ok); }
.result.bad { background: var(--bad); }
.result.warn { background: var(--warn); color: var(--warn-ink); }
.result h1 { margin: 0; font-size: clamp(32px, 6vw, 46px); font-weight: 900; letter-spacing: .03em; }
.result .big { font-size: clamp(26px, 5vw, 36px); font-weight: 900; }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compare div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.compare b { display: block; font-size: 56px; line-height: 1.05; }
.compare span { color: var(--muted); font-weight: 700; letter-spacing: .1em; font-size: 14px; }

/* ---------- lists / tables ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 64px; }
.list-row:first-child { border-top: none; }
.list-row .main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.list-row .main b { font-size: 18px; }
.list-row .main span { color: var(--muted); font-size: 15px; }
.badge { display: inline-block; padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 800; letter-spacing: .06em; white-space: nowrap; }
.badge.VERIFIED { background: #0E2E22; color: var(--ok-ink); }
.badge.CLOSED_DISCREPANCY { background: #3A1010; color: #FCA5A5; }
.badge.ACTIVE { background: #3A3208; color: var(--warn); }
.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--navy-deep); color: var(--muted); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; position: sticky; top: 0; }
.kv { display: grid; grid-template-columns: minmax(150px, 34%) 1fr; }
.kv > div { padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: 17px; }
.kv > div:nth-child(odd) { color: var(--muted); font-weight: 600; }
.evidence { display: flex; flex-direction: column; gap: 10px; }
.evidence .e { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); font-size: 16px; }
.evidence .e b { display: block; font-size: 17px; }
.evidence .y { color: var(--ok-ink); font-weight: 900; }
.evidence .n { color: #FCA5A5; font-weight: 900; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2, 8, 18, .78); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 620px; max-height: 92dvh; overflow: auto; background: var(--navy); border: 2px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { margin: 0; font-size: 26px; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(150%); background: #FFFFFF; color: var(--navy); padding: 14px 22px; border-radius: 12px; font-weight: 800; font-size: 17px; transition: transform .25s, opacity .25s; opacity: 0; pointer-events: none; z-index: 60; max-width: 92vw; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.bad { background: var(--bad); color: #FFFFFF; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.filters .input { min-height: 52px; font-size: 18px; }
.testlog { font-family: var(--mono); font-size: 15px; max-height: 260px; overflow: auto; background: var(--navy-deep); border-radius: 12px; padding: 10px; }
.testlog div { padding: 6px 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; word-break: break-all; }

/* ---------- pallet photos ---------- */
.photo-intro { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.photo-intro > div:first-child { flex: none; }
.shotlist { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; font-size: 17px; }
.shotlist b { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--warn); color: var(--warn-ink); font-size: 14px; margin-right: 6px; }
.photo-progress { display: flex; align-items: center; gap: 16px; font-size: 18px; color: var(--muted); }
.photo-progress b { color: var(--text); font-size: 26px; }
.guide { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; border: 3px solid var(--warn); }
.guide-pic { flex: none; display: grid; place-items: center; }
.guide-text { flex: 1 1 280px; display: flex; flex-direction: column; gap: 12px; }
.guide-step { font-weight: 800; letter-spacing: .14em; color: var(--warn); font-size: 15px; }
.card .guide-title { margin: 0; font-size: 30px; color: var(--text); letter-spacing: 0; text-transform: none; display: flex; align-items: center; gap: 12px; }
.guide-title .num { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--warn); color: var(--warn-ink); font-size: 24px; flex: none; }
.guide-how { margin: 0; font-size: 19px; line-height: 1.4; }
.guide-done { display: flex; gap: 16px; align-items: center; }
.pallet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.pallet-head h2 { margin: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.shot { position: relative; aspect-ratio: 1; border-radius: 12px; border: 2px dashed var(--line); background: var(--panel-2); color: var(--text); padding: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font: inherit; }
.shot.opt { opacity: .8; }
.shot.has { border: 2px solid var(--ok-bright); }
.shot.cur { border: 3px solid var(--warn); }
.shot.dmg { border: 2px solid #F59E0B; cursor: default; }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot .n { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--muted); font-weight: 800; font-size: 19px; }
.shot .lbl { position: relative; font-size: 13px; font-weight: 700; text-align: center; padding: 0 6px; }
.shot.has .lbl, .shot.dmg .lbl { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(7, 21, 42, .82); padding: 5px 6px; }
.shot .st { position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 800; padding: 3px 7px; border-radius: 6px; }
.shot .st.up { background: var(--ok); color: #fff; }
.shot .st.wait { background: var(--warn); color: var(--warn-ink); }
.review-img { width: 100%; max-height: 58dvh; object-fit: contain; background: #000; border-radius: 12px; }
.missing-list { display: flex; flex-direction: column; gap: 14px; max-height: 46dvh; overflow: auto; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pfig { margin: 0; background: var(--panel-2); border-radius: 12px; overflow: hidden; }
.pfig img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #000; }
.pfig figcaption { padding: 8px 10px; font-size: 14px; }
.player { width: 100%; }
.linkbox { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.linkbox .input { font-size: 15px; min-height: 52px; }
