/* CLH Scanning: portrait 6" TC22, gloves. Black and white, large bold text, big black buttons (Figma).
   Touch targets are at least 56px. */
:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #555555;
  --line: #d0d0d0;
  --good: #1d9660;
  --bad: #d4111b;
  --warn: #f2a900;
  --accent-orange: #f26b1d;
  --accent-orange-light: #fff1e8;
  --font: Arial, Roboto, "Helvetica Neue", system-ui, sans-serif;
  --touch: 56px;
  --topbar-bg: #000000;
  --topbar-fg: #ffffff;
  --topbar-muted: #c8c8c8;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.3 var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

main { padding: 8px 16px 112px; }

/* ---------- buttons ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 20px;
  border-radius: 0;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:active { transform: translateY(1px); }
.btn-black { background: #000; color: #fff; }
.btn-black:active { background: #333; }
.btn-outline { background: #fff; color: #000; }
.btn-outline:active { background: #eee; }
.btn-big { min-height: 64px; font-size: 24px; flex: 1; }
.btn-square { width: var(--touch); padding: 0; font-size: 22px; }
.btn-small { min-height: 48px; min-width: 48px; padding: 4px 12px; font-size: 16px; border-color: #fff; background: #000; color: #fff; }
.btn:disabled { opacity: 0.35; }
.wide { width: 100%; }

.back-link {
  min-height: var(--touch);
  padding: 0 4px;
  border: none;
  background: none;
  font-weight: 700;
  font-size: 20px;
}

/* ---------- header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  padding: 4px 12px;
}
.topnav[hidden], .topbar-refresh[hidden] { display: none; }
.topbar-row { display: flex; align-items: center; gap: 10px; min-height: 48px; }
/* TC22: the buttons on top (Switch Role, Log out, Settings, right-aligned; the row goes when none is shown), then
   unsynced and ONLINE / OFFLINE. The desktop top menu re-orders them (admin.css). */
.topbar-actions { justify-content: flex-end; }
.topbar-actions:not(:has(> :not([hidden]))) { display: none; }
/* The name isn't in the TC22 header: it's under the title on the chooser and the homes. (The desktop top menu shows it.) */
body:not([data-topmenu]) #user-name { display: none; }
.topbar-status { justify-content: flex-end; }
.user-name { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unsynced { flex: none; font-size: 16px; white-space: nowrap; }
.unsynced.has-unsynced { color: var(--warn); font-weight: 700; }
.btn-gear { font-size: 24px; }
/* TEST / LIVE (the X-Scanning-Environment header, api.js). The text comes from <html data-env>, so screens never
   repaint it. Greyed out until an /api answer confirms the cached value. Never takes space until the value is known. */
.env-badge { display: none; flex: none; font: 700 12px/1 system-ui, sans-serif; letter-spacing: 0.06em; padding: 4px 6px; border-radius: 3px; color: #fff; pointer-events: none; }
html[data-env] .env-badge { display: inline-block; }
html[data-env="Test"] .env-badge { background: #6b6b6b; }
html[data-env="Test"] .env-badge::after { content: "TEST"; }
html[data-env="Live"] .env-badge { background: #d00000; }
html[data-env="Live"] .env-badge::after { content: "LIVE"; }
html[data-env]:not([data-env-confirmed]) .env-badge { opacity: 0.4; }
/* Scanning:RefreshEnabled = false (api.js: data-refresh-off). Left of TEST / LIVE: on the TC22 only the name shrinks. */
.refresh-off-badge { display: none; flex: none; font: 700 12px/1 system-ui, sans-serif; letter-spacing: 0.06em; padding: 4px 6px; border-radius: 3px; background: var(--warn); color: #000; white-space: nowrap; pointer-events: none; }
html[data-refresh-off] .refresh-off-badge { display: inline-block; }
.net { font-weight: 700; padding: 4px 8px; font-size: 14px; }
.net-online { background: var(--good); color: #fff; }
.net-offline { background: var(--bad); color: #fff; }
.net-warn { background: var(--warn); color: #000; }

.msg {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 18px;
  border-bottom: 2px solid #000;
  overflow-wrap: anywhere;
}
/* A second, smaller line under the message ("You scanned 603004-C Selden Oven Cleaner"), cut to one line. */
.msg-detail { display: block; font-size: 15px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-info { background: #f0f0f0; }
.msg-good { background: #dff3e5; }
.msg-bad { background: var(--bad); color: #fff; }
.msg-warn { background: var(--warn); color: #000; }
.msg-notice { background: #ffe600; color: #000; } /* "No barcode — enter quantity": bright yellow so it stands out */
.msg-bar { display: flex; align-items: stretch; }

/* Drivers: Load order (their van's load order, #/driver/order). */
.load-order-links:empty { display: none; }
.load-order-btn { display: flex; align-items: center; justify-content: center; margin: 0 0 10px; text-decoration: none; }
.load-order-btn[hidden] { display: none; }
/* #/driver/order on a handheld. */
.laptop-only { margin: 24px 12px; display: grid; gap: 16px; }
.laptop-only p { font-size: 22px; font-weight: 700; margin: 0; }
.laptop-only .btn { min-height: 56px; font-size: 20px; }

/* Loaders: "Next to load" on the van's current order (Drivers and Show all orders). */
.row-next { border-left: 8px solid #000; }
.row-next-badge { display: inline-block; align-self: flex-start; margin-top: 4px; background: #000; color: #fff; padding: 1px 8px; font-size: 15px; font-weight: 700; }
.row-open-badge, .row-mine-badge, .row-view-badge { display: inline-block; align-self: flex-start; margin-top: 4px; padding: 1px 8px; font-size: 15px; font-weight: 700; }
.row-open-badge { border: 2px solid #000; }
.row-mine-badge { background: #e3f2fd; border: 2px solid #1565c0; }
.row-view-badge { color: var(--muted); border: 2px solid #bbb; font-weight: 400; }
.row.row-view { border-color: #bbb; color: #666; }
.row-new-badge { display: inline-block; align-self: flex-start; margin-top: 4px; background: #fff8e1; border: 2px solid var(--warn); padding: 0 6px; font-size: 13px; font-weight: 700; }
/* "From 25 Nov": a picking note carried over from an earlier day (grey). */
.row-from-badge { display: inline-block; align-self: flex-start; margin-top: 4px; background: #f2f2f2; border: 2px solid #bbb; color: var(--muted); padding: 0 6px; font-size: 13px; font-weight: 700; }
/* One order at a time: the current order as one large card. */
.current-card { margin: 12px; padding: 16px; border: 3px solid #000; background: #fff; }
.current-card p { margin: 0 0 4px; }
.current-pos { font-size: 18px; font-weight: 700; }
.current-route { font-size: 34px; font-weight: 700; line-height: 1.1; }
.current-order { font-size: 22px; }
.current-name { font-size: 20px; }
.current-progress { font-size: 18px; color: var(--muted); }
.current-skipped { font-size: 17px; font-weight: 700; background: var(--warn); color: #000; padding: 4px 8px; }
.current-open { width: 100%; min-height: 64px; margin-top: 12px; font-size: 24px; }
.list-van { font-size: 15px; }
.list-van[hidden] { display: none; }
/* Picking note that isn't the caller's current order: view-only. */
.view-only { margin: 0 0 8px; padding: 6px 12px; background: #eee; color: #444; font-size: 16px; font-weight: 700; text-align: center; }
.view-only[hidden], .select-all[hidden], #pick-items[hidden] { display: none; }

/* Loaders: the current van, "Nothing left to pick on Van 2" and "Your vans today". */
.van-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 2px solid #000; font-size: 18px; }
.van-bar[hidden], .van-done[hidden], .van-bar-btn[hidden] { display: none; }
.van-bar-name { flex: 1; min-width: 0; }
.van-bar-btn { min-height: 44px; padding: 0 12px; font-size: 16px; }
.van-done { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--good); color: #fff; font-weight: 700; font-size: 20px; }
.van-done span { flex: 1; }
.van-done-wait { background: var(--muted); }
.van-waiting { margin-top: 0; font-size: 18px; }
.van-tiles-head { display: flex; align-items: center; justify-content: space-between; margin-right: 12px; }
.van-tile-place, .van-tile-state { font-size: 18px; }
.van-tile-current { border-width: 5px; }
.van-tiles-title { font-size: 20px; margin: 12px 12px 4px; }
.van-tile { display: grid; gap: 2px; width: calc(100% - 24px); margin: 8px 12px; padding: 14px; text-align: left; font: inherit; background: #fff; border: 3px solid #000; }
.van-tile-name { font-size: 26px; font-weight: 700; }
.van-tile-reg, .van-tile-driver { color: var(--muted); }
.van-tile-done-count { font-size: 20px; font-weight: 700; }
.van-tile-done { border-color: var(--good); }
.van-tile-done .van-tile-name { color: var(--good); }
.msg-bar .msg { flex: 1; min-width: 0; }
.msg-actions { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 0; border-bottom: 2px solid #000; }
.msg-actions[hidden] { display: none; }
/* Large enough for gloves. */
.msg-action { min-height: 48px; min-width: 96px; padding: 0 16px; font-size: 18px; font-weight: 700; background: #000; color: #fff; border: 2px solid #000; }

/* Item screen: confirm a barcode before it's added to the product. */
.capture { margin: 12px 0; padding: 12px; border: 3px solid #000; }
.capture[hidden] { display: none; }
.capture-q { margin: 0 0 8px; font-size: 18px; }
.capture-code { display: block; font-size: 30px; letter-spacing: 1px; overflow-wrap: anywhere; margin: 4px 0; }
.capture-note { margin: 0 0 8px; padding: 8px; background: var(--warn); color: #000; font-weight: 700; }
.capture-note[hidden] { display: none; }
.capture-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.capture-buttons .btn { min-height: 56px; }
.picked[hidden] { display: none; }

/* Indicator only: fixed and click-through, so it disappearing on the first tap never shifts the layout
   between pointerdown and pointerup (which would make that tap miss its button). Any tap unlocks sound. */
.sound-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 88px;
  z-index: 40;
  pointer-events: none;
  padding: 6px 16px;
  background: var(--warn);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
}

/* ---------- shared pieces ---------- */
.title-box {
  border: 4px dashed #000;
  margin: 12px auto;
  padding: 10px 12px;
  max-width: 280px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
}
.title-text { margin: 0; font: inherit; }
/* The user's name, under the title on the first screens only (the chooser and the two homes). */
.title-user { margin-top: 4px; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.title-user:empty { display: none; }
.title-label { display: block; font-size: 20px; }
.title-main { display: block; font-size: 32px; letter-spacing: 0.5px; }
.empty { color: var(--muted); text-align: center; font-size: 18px; padding: 24px 0; }

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}

/* ---------- login ---------- */
.login { text-align: center; }
.login-title { font-size: 32px; margin: 20px 0 4px; }
.login-hint { margin: 0 0 16px; color: var(--muted); }
.link-button { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; padding: 12px; margin-top: 8px; cursor: pointer; }
.field-hint { display: block; color: var(--muted); font-size: 0.9em; margin-top: 4px; }
.pin-dots { display: flex; justify-content: center; gap: 22px; margin-bottom: 24px; }
.pin-dot { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #000; }
.pin-dot.filled { background: #000; }

/* ---------- keypad ---------- */
/* width: 100% matters in the overlay: .pad-panel is a grid, where auto margins alone shrink the pad to its keys (about
   half the screen). On handsets the pad fills its parent (16px padding each side, about 92% of a 360px screen). */
.keypad { width: 100%; max-width: 400px; margin: 0 auto; }
@media (max-width: 600px) { .keypad { max-width: none; } }
.keypad-digits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad-letters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 10px; }
.key {
  min-height: 64px;
  font-size: 30px;
  font-weight: 700;
  background: #000;
  color: #fff;
  border: none;
}
.keypad-letters .key { min-height: 56px; font-size: 22px; }
.key:active { background: #444; }
.key-back { background: #fff; color: #000; border: 2px solid #000; }
.key-ok { background: var(--good); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
}
.overlay[hidden] { display: none; }
.pad-panel { background: #fff; width: 100%; padding: 16px; display: grid; gap: 12px; }
.pad-title { font-weight: 700; font-size: 20px; }
.pad-error { color: var(--bad); font-weight: 700; font-size: 22px; text-align: center; }
.pad-error[hidden] { display: none; }
.key:disabled { opacity: 0.35; }
.pad-display {
  border: 3px solid #000;
  min-height: 64px;
  font-size: 40px;
  font-weight: 700;
  text-align: center;
  line-height: 58px;
  overflow-wrap: anywhere;
}

/* ---------- home ---------- */
.search-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.date-text { text-align: center; font-weight: 700; font-size: 20px; margin-bottom: 12px; }
.refresh-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.refresh-status { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 16px; }
.refresh-text { font-weight: 700; }
.refresh-sub { color: var(--muted); font-size: 15px; }
.refresh-status[data-kind="bad"] .refresh-text { color: var(--bad); }
.refresh-status[data-kind="good"] .refresh-text { color: var(--good); }
#btn-refresh { flex: none; padding: 0 14px; }
.search-input {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  padding: 8px 10px;
  font: 700 20px var(--font);
  border: 2px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  -webkit-user-select: text;
  user-select: text;
}
.search-input::placeholder { color: var(--muted); font-weight: 400; font-size: 17px; }
.search-input::-webkit-search-cancel-button { display: none; } /* the ✕ button does this */
.rows { display: grid; gap: 10px; }
.row {
  min-height: 72px;
  text-align: left;
  border: 2px solid #000;
  background: #fff;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}
.row:active { background: #eee; }
.row-main { font-weight: 700; font-size: 20px; }
.row-sub { color: var(--muted); font-size: 16px; }
.row.row-done { background: var(--good); border-color: var(--good); color: #fff; }
.row.row-done .row-sub { color: #fff; }
.row.row-done .row-main::before { content: "✓ "; }
/* TC22 Picking Notes: between the orders still to do and the completed ones */
.rows-divider { margin: 12px 0 4px; padding: 2px 0; border-top: 2px solid #bbb; color: var(--muted); font-size: 15px; font-weight: 700; }

/* ---------- list ---------- */
.list-sub { text-align: center; font-weight: 700; font-size: 20px; margin-bottom: 12px; }
/* Batch Pick order: a segmented control big enough for a gloved thumb (48 px), and a slim note when not walk route. */
.sort-bar { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid #000; margin-bottom: 8px; }
.sort-opt { min-height: 48px; padding: 4px 2px; border: 0; border-left: 2px solid #000; background: #fff; color: #000; font: inherit; font-weight: 700; font-size: 16px; }
.sort-opt:first-child { border-left: 0; }
.sort-opt[aria-pressed="true"] { background: #000; color: #fff; }
.sort-note { background: #fff3c4; border-left: 4px solid #000; padding: 4px 8px; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.sort-note[hidden] { display: none; }
.cols, .line { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: center; }
.cols { font-weight: 700; padding: 6px 0; border-bottom: 2px solid #000; }
.cols span:first-child { grid-column: 2; }
.line {
  width: 100%;
  min-height: var(--touch);
  border: none;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  padding: 4px 0;
  font-size: 17px;
}
.line:active { background: #eee; }
.line .desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line .loc { font-weight: 700; }
.line .mark { font-weight: 700; text-align: center; }
.line-done .mark { color: var(--good); }
.line-short .mark { color: var(--bad); }
.line-over .mark { color: var(--warn); }
.line-skip { color: #999; }
.line-part .mark { color: var(--warn); }
/* Kits: the KIT header (never picked, a mark from its parts) and its parts indented beneath it. */
.kit-head { background: #f3f3f3; font-weight: 700; cursor: default; }
.kit-badge { display: inline-block; background: #000; color: #fff; font-size: 12px; font-weight: 700; padding: 1px 5px; margin-right: 6px; vertical-align: 2px; }
.kit-code { font-weight: 700; }
.kit-head .kit-parts { font-weight: 400; color: #555; font-size: 15px; }
.line-comp { padding-left: 22px; grid-template-columns: 24px 1fr auto; background: #fff; }
.line-comp .desc { font-style: italic; }
.line-comp .comp-code { font-style: normal; font-weight: 700; margin-right: 4px; }
.kit-bar { display: flex; padding: 4px 12px; font-weight: 700; font-size: 15px; background: #000; color: #fff; white-space: nowrap; }
.kit-bar-desc { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kit-bar-part { flex: none; }
.kit-bar[hidden] { display: none; }

/* ---------- item ---------- */
.item { text-align: center; }
.item .back-link { display: block; text-align: left; }
.item-customer { font-weight: 700; font-size: 20px; margin: 4px 0 8px; }
.item-loc { font-weight: 700; font-size: 44px; line-height: 1.1; margin: 8px 0 0; overflow-wrap: anywhere; }
.item-loc[data-len="medium"] { font-size: 36px; }   /* 9-10 characters, e.g. MWD-COMMS, MWD-STAIRS */
.item-loc[data-len="long"]   { font-size: 30px; }   /* 11+ characters, e.g. MWD-BACKWALL, MWUP-CABINET */
.item-code { line-height: 1.2; }   /* Batch Pick: (variant code) under the Stock Loc, normal weight */
.item-code:empty { display: none; }
.item-loc-sub { color: var(--muted); font-size: 16px; min-height: 1.2em; }
.item-desc, .item-code { font-size: 20px; }   /* the stock code is the description's size */
.item-desc { font-weight: 700; margin: 10px 0; text-align: left; overflow-wrap: anywhere; }
.item-qty { display: flex; justify-content: center; gap: 32px; font-weight: 700; font-size: 32px; margin: 8px 0 0; }
.item-pack { color: var(--muted); font-size: 16px; }
.item-pack:empty { display: none; }   /* no pack line: QTY Picked sits close under QTY */
/* QTY Picked: label above, then  [ - ]  [ qty box ]  [ + ]  centred */
.picked { margin-top: 14px; text-align: center; }
.picked-label { display: block; font-weight: 700; font-size: 20px; margin-bottom: 8px; }
.picked-controls {
  display: grid;
  grid-template-columns: 69px minmax(0, 150px) 69px;   /* minus | box | plus */
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.picked-controls .btn { min-height: 54px; font-size: 27px; padding: 0; }
.qty-box {
  min-height: 64px;
  border: 2px solid #000;
  background: #fff;
  font-size: 32px;
  font-weight: 700;
}
.qty-box.over { background: var(--warn); }
.qty-box[data-status="done"] { background: #05e949; }

.qty-box[data-status="short"] { background: var(--warn); }
/* Item bar (Figma ItemScreenNoStockV2), fixed to the bottom:  [ ] No Stock  |  [ Done ]  on one row, vertically centred.
   item.js sets the page's bottom padding to this bar's measured height, so it never covers the page. */
.item-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;   /* No Stock | Done: Done is half the width */
  align-items: center;
  gap: 16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}
/* No Stock: enabled only while QTY Picked is below QTY. The whole label is the tap target. Hidden on lines not to
   pick; Done stays in the right-hand column. */
.no-stock-cell { grid-column: 1; min-width: 0; }
.no-stock { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 20px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.no-stock input { width: 32px; height: 32px; margin: 0; flex: none; accent-color: #000; cursor: pointer; }
.no-stock.disabled { opacity: 0.45; cursor: default; }
.no-stock[hidden] { display: none; }
/* Batch Pick: the "Not Picked" reason under the box ("— Collection"); tap to change it. */
.not-picked-reason { display: block; width: 100%; min-height: 40px; margin: 0; padding: 0 0 0 44px; border: 0; background: none;
  color: #000; font: inherit; font-size: 18px; font-weight: 700; text-align: left; text-decoration: underline; cursor: pointer; }
.not-picked-reason[hidden] { display: none; }
.not-picked-reason:disabled { opacity: 0.45; cursor: default; }
/* "Why wasn't it picked?": radio rows big enough for a gloved tap. */
.dialog.radio-dialog { max-width: 520px; }
.radio-dialog .dialog-title { font-size: 22px; }
.radio-choices { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.radio-choice { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 0 14px; border: 2px solid #000;
  font-size: 22px; font-weight: 700; cursor: pointer; }
.radio-choice:has(input:checked) { background: #000; color: #fff; }
.radio-choice input { width: 30px; height: 30px; margin: 0; flex: none; accent-color: #fff; }
.dialog.radio-dialog .dialog-buttons .btn { min-height: 60px; font-size: 22px; flex: 1; }
#item-done { grid-column: 2; min-height: 56px; min-width: 0; font-size: 22px; white-space: nowrap; }

/* Serial numbers (picking notes): the list under QTY Picked, and the full-width "Scan the serial number" dialog. */
.serials { margin: 14px 0 0; text-align: left; }
.serials-head { margin: 0 0 6px; font-weight: 700; font-size: 18px; }
.serials-list { list-style: none; margin: 0; padding: 0; }
.sn-row { display: flex; align-items: center; gap: 8px; min-height: 48px; border-bottom: 1px solid var(--line); font-size: 18px; }
.sn-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sn-rejected .sn-label { color: var(--bad); font-weight: 700; }
.sn-x { flex: none; width: 48px; height: 48px; border: 2px solid #000; background: #fff; font-size: 26px; line-height: 1; padding: 0; }
.sn-backdrop { position: fixed; inset: 0; z-index: 50; background: #fff; overflow-y: auto; }
.sn-dialog {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  min-height: 100%; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); text-align: center;
}
.sn-title { margin: 8px 0 0; font-size: 28px; }
.sn-desc { margin: 0; font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.sn-unit { margin: 0; font-size: 24px; font-weight: 700; }
.sn-icon { margin: 8px auto; }
.sn-error { margin: 0; padding: 10px; border: 3px solid var(--bad); color: var(--bad); font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.sn-type-link { align-self: center; min-height: 48px; border: none; background: none; font-size: 18px; text-decoration: underline; }
.sn-type { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sn-type input { min-height: 56px; min-width: 0; padding: 0 10px; border: 2px solid #000; font: inherit; font-size: 22px; }
.sn-type .btn { min-height: 56px; padding: 0 20px; font-size: 20px; }
.sn-cancel { margin-top: auto; flex: none; }
.sn-choose { display: flex; flex-direction: column; gap: 8px; }
.sn-choose .btn { min-height: 56px; }
#item-done:disabled { background: #999; border-color: #999; }

/* ---------- picking note rows: double height, tick box, claims ---------- */
.select-bar { display: flex; justify-content: flex-end; border-bottom: 2px solid #000; }
.select-bar .select-all { margin: 0; padding: 8px 4px; color: #000; font-weight: 700; }
.select-bar .select-all:disabled { color: #aaa; text-decoration: none; }
.nrow {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 76px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.nrow:active { background: #eee; }
.tick-cell { display: flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; }
.tick-cell .tick { width: 40px; height: 40px; margin: 0; accent-color: #000; }
.tick-cell .mark { font-size: 28px; font-weight: 700; }
.nrow-main { display: flex; flex-direction: column; min-width: 0; }
.nrow-desc {
  font-size: 17px; font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.nrow-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.nrow-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; padding-right: 4px; }
.nrow-loc { font-size: 24px; font-weight: 700; line-height: 1.1; }
.nrow-bin { font-size: 13px; color: var(--muted); }
.claim-badge { font-size: 13px; font-weight: 700; padding: 1px 6px; border: 2px solid #000; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claim-mine { background: #000; color: #fff; }
.claim-theirs { background: #fff; color: #555; border-color: #999; }
.nrow-theirs, .nrow-nonpick { color: #999; background: #f4f4f4; }
.nrow-theirs .nrow-sub, .nrow-nonpick .nrow-sub, .nrow-theirs .nrow-loc { color: #999; }
.nrow-kit { background: #f3f3f3; }
.nrow-part { padding-left: 22px; min-height: 64px; }
.nrow-part .nrow-desc { font-style: italic; font-weight: 400; }
.nrow.line-done .mark, .nrow.line-over .mark { color: var(--good); }
.nrow.line-short .mark { color: var(--warn); }
.nrow .short-text { color: #a36f00; font-weight: 700; }


/* ---------- settings ---------- */
.field { display: block; margin-bottom: 16px; font-weight: 700; }
.field input {
  display: block;
  width: 100%;
  min-height: var(--touch);
  margin-top: 4px;
  font: 20px monospace;
  padding: 8px;
  border: 2px solid #000;
  -webkit-user-select: text;
  user-select: text;
}
.field .btn { margin-top: 4px; }
.key-row { display: flex; gap: 8px; align-items: stretch; }
.key-row input { flex: 1; min-width: 0; }
.key-row .btn { margin-top: 0; flex: none; padding: 0 14px; }
.device-info { font-size: 14px; color: var(--muted); }
.device-info dd { margin: 0; overflow-wrap: anywhere; font-family: monospace; }

/* ---------- feedback ---------- */
.flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 100; }
.flash-good { background: var(--good); animation: flash 350ms ease-out forwards; }
.flash-bad { background: var(--bad); animation: flash 900ms ease-out forwards; }
.flash-warn { background: var(--warn); animation: flash 700ms ease-out forwards; }
@keyframes flash { 0%, 30% { opacity: 0.85; } 100% { opacity: 0; } }

.diag { background: #000; color: #0f0; margin: 0 16px 120px; padding: 4px 8px; }
.diag-note { font: 13px monospace; color: #ff0; margin: 4px 0; }
.diag-list { font: 12px monospace; max-height: 30vh; overflow: auto; margin: 0; padding: 0; list-style: none; }

/* ---------- list and item screens: no top menu, home icon top right ---------- */
body[data-screen="list"] .topbar,
body[data-screen="item"] .topbar { display: none; }

.screen-bar { display: flex; align-items: center; gap: 8px; min-height: 56px; }
.screen-bar .back-link { display: inline-block; }
.btn-home {
  margin-left: auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  padding: 0;
}
.btn-home:active { background: #eee; }
/* On the house icon's top edge, out of the flow: the screen bar doesn't move. */
.btn-home { position: relative; }
.env-badge-corner { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-size: 9px; padding: 2px 3px; }

/* The top menu is hidden here, so only show a warning when something needs attention. */
.mini-status { font-weight: 700; font-size: 14px; }
body[data-net="net-offline"] .mini-status::before { content: "OFFLINE"; background: var(--bad); color: #fff; padding: 4px 8px; }
body[data-net="net-warn"] .mini-status::before { content: "KEY?"; background: var(--warn); padding: 4px 8px; }
body[data-unsynced="yes"] .mini-status::after { content: "UNSYNCED"; background: var(--warn); padding: 4px 8px; margin-left: 6px; }

/* ---------- special instructions (special-instructions.js) ---------- */
/* The ⓘ in a handset screen bar: a 32px icon in a 48px target, just left of the house. */
.btn-info {
  margin-left: auto;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #fff;
  color: var(--accent-orange);
  padding: 0;
}
.btn-info:active { background: var(--accent-orange-light); }
.btn-info:not([hidden]) + .btn-home { margin-left: 0; }
/* The pop-up: full screen on the TC22 (si-full), a centred modal on the admin's screens (si-modal). */
.si-backdrop { position: fixed; inset: 0; z-index: 60; display: flex; }
.si-full { background: #fff; }
.si-modal { background: rgba(0, 0, 0, 0.5); align-items: center; justify-content: center; padding: 16px; }
.si-box { display: flex; flex-direction: column; background: #fff; color: var(--text); outline: none; }
.si-full .si-box { width: 100%; height: 100%; }
.si-modal .si-box { width: min(560px, 100%); max-height: min(80vh, 640px); border: 2px solid var(--accent-orange); }
.si-head { position: relative; padding: 16px 64px 12px 16px; border-bottom: 4px solid var(--accent-orange); }
.si-title { margin: 0; font-size: 26px; font-weight: 700; color: var(--accent-orange); }
.si-sub { margin: 4px 0 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.si-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  padding: 0;
}
.si-x:active { background: #eee; }
.si-text { flex: 1; overflow-y: auto; padding: 16px; font-size: 24px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.si-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.si-close { width: 100%; min-height: 64px; font-size: 24px; }
.si-modal .si-text { font-size: 16px; }
.si-modal .si-title { font-size: 20px; }
.si-modal .si-sub { font-size: 14px; }
.si-modal .si-x { width: 40px; height: 40px; top: 10px; right: 10px; }
.si-modal .si-close { min-height: 40px; font-size: 16px; }

/* Settings: automatic refresh (Admin edits; others see one line) */
.auto-refresh { margin: 8px 0 16px; padding-top: 12px; border-top: 2px solid #000; }
.auto-refresh-title { font-size: 18px; margin: 0 0 8px; }
.auto-refresh .field-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 700; }
.auto-refresh .field-check input { width: 22px; height: 22px; flex: none; }
.auto-refresh .field { margin-bottom: 4px; }
.auto-refresh .field-error { color: var(--bad); font-weight: 700; font-size: 14px; margin: 0 0 8px; }
.auto-refresh .field-error:empty { display: none; }
.auto-refresh-line { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- "What are you doing?" (#/mode) and the header's Switch button ---------- */
.mode-chooser { padding: 0 12px 24px; }
.mode-buttons { display: flex; flex-direction: column; gap: 16px; max-width: 520px; margin: 0 auto; }
.mode-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 120px; padding: 16px 18px; text-align: left;
  border: 3px solid #000; background: #fff; color: #000; border-radius: 0;
}
.mode-btn:active { background: #eee; transform: translateY(1px); }
.mode-btn:disabled { opacity: 0.5; }
.mode-btn.mode-preselected, .mode-btn:focus-visible { outline: 4px solid #000; outline-offset: 3px; }
.mode-name { font-size: 28px; font-weight: 800; }
.mode-desc { font-size: 18px; }
.mode-van { font-size: 17px; font-weight: 700; color: var(--muted); }
.mode-van[hidden] { display: none; }
.btn-switch { flex: none; white-space: nowrap; }
.btn-switch[hidden] { display: none; }

/* ---------- Buckets (buckets.js): the Yes / No dialog, the item screen's badge, the list's chip ---------- */
.dialog.bucket-dialog { max-width: 520px; }
.bucket-dialog .dialog-title { font-size: 22px; }
.bucket-lines { margin: 0 0 12px; padding-left: 22px; font-size: 18px; }
.bucket-lines li { margin: 2px 0; }
.bucket-note { margin: 0 0 12px; font-size: 18px; }
.bucket-buttons { display: flex; flex-direction: column; gap: 10px; }
.dialog.bucket-dialog .btn { min-height: 64px; font-size: 24px; width: 100%; }
.bucket-qty { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 12px; }
.dialog.bucket-dialog .bucket-step { width: 72px; min-height: 64px; font-size: 32px; }
.bucket-qty-value { min-width: 120px; min-height: 64px; font-size: 36px; font-weight: 700; }
.overlay.over-dialog { z-index: 70; }
.item-bucket { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 8px 0; }
.bucket-takeouts { display: flex; flex-wrap: wrap; gap: 8px; }
.bucket-takeout { min-height: 56px; padding: 0 14px; font-size: 18px; }
.bucket-panel { margin: 8px 0; padding: 8px 10px; border: 2px solid #000; background: #fff8d6; }
.bucket-panel-head { margin: 0 0 4px; font-weight: 700; font-size: 16px; }
.bucket-panel ul { margin: 0; padding: 0; list-style: none; }
.bucket-panel li { font-size: 16px; margin: 2px 0; }
.bucket-panel .bucket-from { color: #8a5a00; font-weight: 700; }
.bucket-badge { display: inline-block; padding: 2px 10px; border: 2px solid #000; background: #ffe680; font-weight: 700; font-size: 18px; }
.bucket-chip { display: inline-block; padding: 0 6px; border: 1px solid #000; background: #ffe680; font-size: 14px; font-weight: 700; white-space: nowrap; }
