/* Crew scan app — phone-first, two or three giant buttons and a camera. */
:root {
  --bg: #f6f7f9; --card: #fff; --border: #e3e6ec; --text: #10151d; --muted: #5a6473;
  --accent: #1d4ed8; --good: #16a34a; --bad: #dc2626; --warn: #d97706;
  --fill: #7c3aed; --load: #1d4ed8; --deliver: #16a34a; --empty: #0891b2; --seen: #d97706; --retire: #6b7280;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 Inter, system-ui, sans-serif; overscroll-behavior: none; }
.hd { background: #10151d; color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; display: flex; align-items: center; gap: 10px; }
.hd-logo { height: 32px; width: 32px; border-radius: 8px; display: block; }
.hd-sub { color: #cdd5e0; font-size: 14px; font-weight: 700; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang { display: flex; gap: 4px; }
.lang-btn { font: 700 12px Inter, sans-serif; color: #9aa4b2; background: transparent; border: 1px solid #2c3d55; border-radius: 999px; padding: 5px 9px; cursor: pointer; }
.lang-btn.active { color: #10151d; background: #fff; border-color: #fff; }
.pill { font: 700 12.5px Inter, sans-serif; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; white-space: nowrap; cursor: pointer; }
.pill.dark { background: #10151d; color: #fff; border-color: #10151d; }
.wrap { max-width: 520px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }

/* login */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { margin: 0; font-size: 22px; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.hint.dim { font-size: 13px; } .hint.center { text-align: center; }
#emp-id { font: 600 24px "JetBrains Mono", monospace; letter-spacing: 1.5px; text-transform: uppercase; text-align: center; padding: 14px; border: 2px solid #cfd6e0; border-radius: 12px; width: 100%; }
#emp-id:focus { border-color: var(--accent); outline: none; }
.go { font: 800 18px Inter, sans-serif; color: #fff; background: var(--accent); border: none; border-radius: 12px; padding: 16px; cursor: pointer; }
.go:disabled { opacity: .6; }
.err { margin: 0; color: var(--bad); font-size: 14px; font-weight: 600; }

/* modes: the whole UI */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.mode { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 108px; border: 3px solid transparent; border-radius: 18px; color: #fff; cursor: pointer; user-select: none; font: 800 19px/1.1 Inter, sans-serif; text-transform: uppercase; letter-spacing: .03em; box-shadow: 0 6px 18px rgba(16,21,29,.18), inset 0 -5px 0 rgba(0,0,0,.14); opacity: .55; transition: transform .08s, opacity .15s; }
.mode .em { font-size: 40px; line-height: 1; }
.mode .sm { font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .9; }
.mode:active { transform: scale(.97); }
.mode.active { opacity: 1; border-color: #10151d; }
.mode.label { background: #111827; } .mode.fill { background: var(--fill); } .mode.load { background: var(--load); } .mode.deliver { background: var(--deliver); }
.mode.empty { background: var(--empty); } .mode.seen { background: var(--seen); } .mode.retire { background: var(--retire); }

/* sub-choice: commodity tiles / trip list */
.sub { margin-top: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 10px; }
.sub .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; margin: 0 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tile { font: 800 17px Inter, sans-serif; padding: 16px 8px; border-radius: 14px; border: 3px solid var(--border); background: #fff; color: var(--text); cursor: pointer; text-align: center; }
.tile.active { border-color: #10151d; background: #10151d; color: #fff; }
.tile.add { border-style: dashed; color: var(--muted); font-weight: 600; }
.tile .sm { display: block; font-size: 12px; font-weight: 600; opacity: .75; }
.sub .none { text-align: center; color: var(--muted); font-size: 14px; padding: 6px 0 10px; }

/* pending container (opened from a label URL) */
.pending { margin-top: 10px; background: #fff8e1; border: 2px solid #f6c445; border-radius: 16px; padding: 12px 14px; }
.pending .code { font: 800 22px "JetBrains Mono", monospace; }
.pending .st { color: var(--muted); font-size: 14px; margin: 2px 0 8px; }
.pending .hint { font-weight: 600; color: var(--text); }
.pending .x { float: right; }

/* camera */
.cam { position: relative; margin-top: 10px; background: #10151d; border-radius: 18px; overflow: hidden; min-height: 150px; }
.cam video { display: block; width: 100%; max-height: 54vh; object-fit: cover; }
.cam-off { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 16px; }
.cam-off .hint { color: #cdd5e0; }
.cam-off .go { width: 100%; max-width: 320px; }
.flash { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; color: #fff; font: 800 22px/1.2 Inter, sans-serif; animation: fade 1.6s forwards; pointer-events: none; }
.flash.ok { background: rgba(22,163,74,.92); } .flash.bad { background: rgba(220,38,38,.94); }
.flash .code { font: 800 30px "JetBrains Mono", monospace; margin-bottom: 6px; }
.flash .sm { font-size: 15px; font-weight: 600; opacity: .95; margin-top: 6px; }
@keyframes fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.count { text-align: center; margin: 10px 0 4px; color: var(--muted); font-size: 14px; }
.count #today { font: 800 20px Inter, sans-serif; color: var(--text); }
.manual { margin: 4px 0 8px; }
.manual summary { color: var(--muted); font-size: 13px; cursor: pointer; text-align: center; list-style: none; }
.manual .row { display: flex; gap: 6px; margin-top: 8px; }
.manual input { flex: 1; font: 600 18px "JetBrains Mono", monospace; text-transform: uppercase; padding: 10px; border: 2px solid #cfd6e0; border-radius: 12px; }
.recent { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.recent div { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 7px 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.recent .c { font: 800 13px "JetBrains Mono", monospace; }
.recent .e { flex: 1; } .recent .t { color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.foot a { color: var(--muted); }

/* install */
.install-card { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; text-align: left; font: 15px Inter, sans-serif; color: var(--text); background: #fff; border: 2px dashed #b9c3d3; border-radius: 16px; padding: 14px 16px; cursor: pointer; }
.install-card .em { font-size: 30px; } .install-card .sm { color: var(--muted); font-size: 13px; }
.sheet { position: fixed; inset: 0; background: rgba(16,21,29,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet-in { background: #fff; border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); width: 100%; max-width: 520px; text-align: center; }
.sheet-icon { width: 72px; height: 72px; border-radius: 18px; }
.sheet h2 { margin: 10px 0 12px; font-size: 20px; }
.sheet ol { text-align: left; margin: 0 0 16px; padding-left: 22px; font-size: 16px; line-height: 1.6; }
.sheet .go { width: 100%; }

/* label stepper */
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.stepper button { font: 800 30px Inter, sans-serif; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--border); background: #fff; color: var(--text); cursor: pointer; }
.stepper span { font: 800 36px "JetBrains Mono", monospace; min-width: 60px; text-align: center; }
