:root {
  /* CCM Logistics brand */
  --navy: #03358a;
  --navy-dark: #022360;
  --navy-deep: #011637;
  --orange: #e8912a;
  --orange-soft: #f5a93f;
  --ink: #f4f7ff;
  --muted: #a8b8d8;
  --panel: #0b2352;
  --panel-2: #102d63;
  --line: #1d4390;
  --danger: #e2574c;
  --ok: #3fb680;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--navy-deep) 0%, #02184a 45%, #01102f 100%);
  color: var(--ink);
  font-family: "Leelawadee UI", "Segoe UI", Tahoma, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: rgba(232, 145, 42, 0.28);
}
body {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}
button, a, summary, .chip, .card, .area-card, .loc-drop {
  touch-action: manipulation;
}
img, svg, video { max-width: 100%; }

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ---------- Brand header ---------- */

.brandbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  margin-bottom: 14px;
}
.brandbar img {
  height: 42px;
  width: auto;
}
.brand-text { line-height: 1.25; min-width: 0; }
.brand-text .company {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}
.brand-text .system {
  margin: 0;
  font-size: 12px;
  color: #5a6b8c;
}
.brandbar .clock {
  margin-left: auto;
  text-align: right;
  font-size: 12px;
  color: var(--navy);
  font-weight: 600;
}
.brandbar .clock span {
  display: block;
  font-weight: 400;
  color: #6c7d9e;
}

.sound-gate {
  background: rgba(232, 145, 42, 0.14);
  border: 1px solid var(--orange);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
}
.sound-gate p {
  margin: 8px 2px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.sound-gate .en { display: block; margin-top: 2px; font-size: 11px; }
.sound-state {
  margin: 8px 2px 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.sound-state.off { color: var(--muted); }
.sound-state.busy { color: #f1c40f; }
.sound-state.on { color: #2ecc71; }
.sound-state.bad { color: #ff6b6b; }

.whoami {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}
.whoami strong { color: var(--ink); }
.whoami .badge {
  margin-left: auto;
  background: var(--orange);
  color: #1c1000;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Layout blocks ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

h1, h2, h3 { margin: 0 0 10px; font-weight: 700; }
h2 { font-size: 20px; }
h3 { font-size: 15px; color: var(--muted); }

.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.steps {
  margin: 0 0 14px;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

form, #admin-panel { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input, select, textarea {
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink);
  background: #071c45;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 12px;
  width: 100%;
}
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path fill='%23e8912a' d='M5 7l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 40px;
}
select option {
  background: #071c45;
  color: #f4f7ff;
}
input:focus, select:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}
input[readonly] { color: var(--muted); background: #06163a; }

button, .ghost {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--ink);
}
.primary {
  background: linear-gradient(180deg, var(--orange-soft), var(--orange));
  color: #1b1000;
  border: 0;
  font-weight: 800;
  width: 100%;
  font-size: 16px;
  min-height: 48px;
}
.primary.big { padding: 20px 16px; font-size: 18px; }
.secondary {
  background: var(--panel-2);
  border: 1px solid var(--line);
  width: 100%;
  font-weight: 600;
}
.back, .ghost {
  background: transparent;
  border: 1px solid var(--line);
  text-decoration: none;
  display: inline-block;
}
.back { margin-bottom: 12px; min-height: 44px; padding: 10px 16px; font-size: 15px; }
.loc-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-nav .back { flex: 1 1 auto; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.row-actions .ghost, .row-actions button { flex: 1 1 auto; text-align: center; }

/* ---------- Dashboard ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.stats b { display: block; font-size: 22px; color: var(--orange); }
.stats span { font-size: 11px; color: var(--muted); }

.grid-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-nav .nav-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "icon text go";
  align-items: center;
  column-gap: 14px;
  min-height: 92px;
  padding: 16px 14px 16px 16px;
  text-align: left;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
  background: linear-gradient(135deg, #17407f 0%, var(--panel-2) 60%, #0c2657 100%);
  border: 1px solid rgba(93, 140, 230, 0.35);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, border-color 0.12s ease;
}
.grid-nav .nav-card::before {
  content: "";
  position: absolute;
  right: -36px;
  top: -48px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}
.grid-nav .nav-card:hover { filter: brightness(1.08); border-color: rgba(245, 169, 63, 0.6); }
.grid-nav .nav-card:active { transform: scale(0.98); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25); }
.grid-nav .nav-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.grid-nav .nav-card span { display: block; margin: 0; color: inherit; font-size: inherit; font-weight: inherit; }

.grid-nav .nav-card .nav-icon {
  grid-area: icon;
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: rgba(232, 145, 42, 0.14);
  border: 1px solid rgba(245, 169, 63, 0.35);
  color: var(--orange-soft);
}
.grid-nav .nav-card .nav-icon svg { width: 32px; height: 32px; }
.grid-nav .nav-card .nav-text { grid-area: text; position: relative; min-width: 0; }
.grid-nav .nav-card .nav-title {
  font-size: clamp(18px, 5vw, 21px);
  font-weight: 800;
  line-height: 1.2;
}
.grid-nav .nav-card .nav-en {
  display: inline;
  font-size: 0.62em;
  font-weight: 700;
  opacity: 0.7;
  margin-left: 4px;
}
.grid-nav .nav-card .nav-sub {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}
.grid-nav .nav-card .nav-go {
  grid-area: go;
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--orange-soft);
}
.grid-nav .nav-card .nav-go svg { width: 20px; height: 20px; }

.grid-nav .nav-hero,
.grid-nav .nav-wide { grid-column: 1 / -1; }
.grid-nav .nav-card.nav-hero {
  color: #1b1000;
  background: linear-gradient(135deg, #f8b957 0%, var(--orange) 55%, #d4760f 100%);
  border: 0;
  box-shadow: 0 10px 26px rgba(232, 145, 42, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.grid-nav .nav-card.nav-hero::before { background: rgba(255, 255, 255, 0.16); }
.grid-nav .nav-card.nav-hero:hover { filter: brightness(1.05); }
.grid-nav .nav-card.nav-hero .nav-icon {
  background: var(--navy-deep);
  border: 0;
  box-shadow: 0 6px 14px rgba(1, 22, 55, 0.35);
}
.grid-nav .nav-card.nav-hero .nav-icon svg { width: 34px; height: 34px; }
.grid-nav .nav-card.nav-hero .nav-title { font-size: clamp(19px, 5.2vw, 22px); }
.grid-nav .nav-card.nav-hero .nav-sub { color: rgba(27, 16, 0, 0.75); }
.grid-nav .nav-card.nav-hero .nav-go { background: rgba(27, 16, 0, 0.12); color: inherit; }

.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon go" "text text";
  align-items: start;
  row-gap: 12px;
  column-gap: 8px;
  min-height: 124px;
  padding: 14px;
}
.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-icon { width: 44px; height: 44px; border-radius: 13px; }
.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-icon svg { width: 24px; height: 24px; }
.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-go { justify-self: end; width: 28px; height: 28px; }
.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-go svg { width: 16px; height: 16px; }
.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-title { font-size: 16px; }
.grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-sub { font-size: 12px; }

.nav-scan-line {
  stroke: #5dffb0;
  stroke-width: 1.6;
  animation: nav-scan-sweep 1.8s ease-in-out infinite alternate;
}
@keyframes nav-scan-sweep {
  from { transform: translateY(-6px); }
  to { transform: translateY(6px); }
}
@media (max-width: 360px) {
  .grid-nav .nav-card { column-gap: 10px; padding: 14px 10px 14px 12px; }
  .grid-nav .nav-card .nav-icon { width: 48px; height: 48px; border-radius: 14px; }
  .grid-nav .nav-card .nav-icon svg { width: 28px; height: 28px; }
  .grid-nav .nav-card .nav-go { width: 30px; height: 30px; }
  .grid-nav .nav-card:not(.nav-hero):not(.nav-wide) { padding: 12px; }
  .grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-icon { width: 40px; height: 40px; }
  .grid-nav .nav-card:not(.nav-hero):not(.nav-wide) .nav-title { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-scan-line { animation: none; }
  .grid-nav .nav-card { transition: none; }
}

/* ---------- Scan result / fields ---------- */

.scanbox {
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.kv { display: grid; gap: 8px; }
.kv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-row span {
  color: var(--muted);
  flex: 0 1 auto;
  min-width: 0;
}
.kv-row b .pill { color: inherit; }
.kv-row b .pill.ok { color: var(--ok); }
.kv-row b .pill.warn { color: var(--danger); }
.kv-row b .pill.info { color: var(--orange-soft); }
.kv-row b {
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-weight: 600;
  min-width: 0;
  flex: 1 1 auto;
}
.kv-row.big b { font-size: 18px; color: var(--orange); }
.kv-row.name b { font-size: 17px; color: var(--orange); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.pill.ok { background: rgba(63, 182, 128, 0.18); color: var(--ok); }
.pill.warn { background: rgba(226, 87, 76, 0.18); color: var(--danger); }
.pill.info { background: rgba(245, 169, 63, 0.18); color: var(--orange-soft); }

.compare-item.save-here {
  border: 1px solid rgba(245, 169, 63, 0.55);
  background: rgba(245, 169, 63, 0.08);
}
.save-here-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
}
.save-here-icon { font-size: 22px; line-height: 1; flex: none; }
.save-here-cap { font-size: 12px; color: var(--ink); line-height: 1.35; }
.save-here-cap .en { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.save-here-loc {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
  color: var(--orange-soft);
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.save-here-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.save-here-note .en { display: block; margin-top: 2px; }
.compare-item.from-file {
  border-color: rgba(245, 169, 63, 0.35);
}
.compare-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--orange-soft);
  line-height: 1.4;
}
.compare-note .en { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

/* ---------- Duplicate alert ---------- */

.dup-alert {
  border: 1px solid var(--danger);
  background: rgba(226, 87, 76, 0.12);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.dup-alert h3 { color: var(--danger); margin-bottom: 8px; overflow-wrap: anywhere; }
.dup-alert h3.dup-info { color: var(--orange); }
.dup-item {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.dup-item div, .dup-item .meta, .dup-item b {
  overflow-wrap: anywhere;
  word-break: break-all;
  max-width: 100%;
}
.dup-item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.dup-diff {
  margin-top: 6px;
  font-weight: 600;
}
.dup-diff b { font-size: 15px; }
.compare-list { display: grid; gap: 8px; margin-top: 12px; }
.compare-item {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 8px 10px;
}
.compare-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-bottom: 6px;
}
.compare-label {
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}
.compare-pair {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 10px;
  font-size: 12px;
}
.compare-pair > div { display: contents; }
.compare-pair span {
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.35;
}
.compare-pair b {
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
#scan-material {
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.35;
  min-height: 48px;
}
#scan-material,
#man-part,
#man-material,
#man-lot,
#man-case {
  text-transform: uppercase;
}

.qty-input {
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.03em;
  min-height: 44px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
}
.qty-dock {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin: 6px -16px -16px;
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 35, 82, 0) 0%, var(--panel) 14%, var(--panel) 100%);
}
.qty-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 6px;
  align-items: stretch;
}
.qty-stock,
.qty-actual {
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 6px 6px;
  text-align: center;
  display: grid;
  gap: 1px;
  align-content: start;
}
.qty-stock {
  border-color: var(--orange);
  background: rgba(232, 145, 42, 0.12);
}
.qty-stock span,
.qty-actual > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
}
.qty-stock .en,
.qty-actual .en {
  display: block;
  font-size: 10px;
  font-weight: 400;
  margin-top: 0;
}
.qty-stock b {
  display: block;
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 800;
  color: var(--orange);
  line-height: 1.1;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  padding: 2px 0 0;
}
.qty-stock b.empty { color: var(--muted); font-size: 18px; }
.qty-stock small {
  display: block;
  font-size: 10px;
  color: var(--ink);
  font-weight: 600;
}
.qty-actual .qty-input {
  margin-top: 2px;
  border-color: var(--orange-soft);
}
.qty-need {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(226, 87, 76, 0.16);
  border: 1px solid rgba(226, 87, 76, 0.55);
  color: #ffd0cb;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}
.qty-need .en {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
#btn-save-manual:disabled:not(.saving) {
  opacity: 0.45;
  filter: grayscale(0.35);
  cursor: not-allowed;
}
.part-search .search-btn {
  flex: 0 0 auto;
  min-height: 48px;
  min-width: 88px;
  padding: 0 12px;
  font-weight: 800;
  font-size: 15px;
  background: linear-gradient(180deg, var(--orange-soft), var(--orange));
  color: #1b1000;
  border: 0;
  border-radius: 12px;
  white-space: nowrap;
}
.sticky-save {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin: 4px -16px -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 35, 82, 0) 0%, var(--panel) 28%);
}
.sticky-save .primary { min-height: 52px; }
.primary.big.compact {
  padding: 12px 14px;
  font-size: 15px;
  min-height: 48px;
}

/* ---------- Lists ---------- */

.list { display: grid; gap: 8px; }
.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: left;
  width: 100%;
  color: var(--ink);
}
.card .part {
  font-size: 16px;
  font-weight: 800;
  color: var(--orange);
  word-break: break-all;
}
.card .mat {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  margin-top: 2px;
}
.card .qtyline { margin-top: 6px; font-size: 14px; }
.card .meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.card .time { color: var(--orange-soft); font-size: 12px; font-weight: 600; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
}
.chip.active { background: var(--orange); color: #1b1000; border-color: var(--orange); font-weight: 700; }
.chip.sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Admin collapsible sections ---------- */

.adm-sec {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 10px;
}
.adm-sec > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.adm-sec > summary::-webkit-details-marker { display: none; }
.adm-sec > summary::before {
  content: "▸";
  color: var(--orange);
  font-size: 14px;
  transition: transform 0.15s;
}
.adm-sec[open] > summary::before { transform: rotate(90deg); }
.adm-sec[open] > summary { border-bottom: 1px solid var(--line); }
.adm-sec-title { font-weight: 700; font-size: 15px; flex: 1 1 auto; min-width: 0; }
.adm-sec-meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.adm-sec-body { padding: 10px 12px 12px; }
.adm-sec-body > .progress-row:first-child,
.adm-sec-body > .hint + .progress-row { margin-top: 0; }
.adm-sec-body .chip-list { margin: 6px 0 0; }
.adm-sec-body .rec-filters { margin: 0 0 10px; }

/* ---------- Admin day records ---------- */

.rec-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.rec { background: var(--panel-2); }
.rec + .rec { border-top: 1px solid var(--line); }
.rec summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}
.rec summary::-webkit-details-marker { display: none; }
.rec[open] summary { background: rgba(232, 145, 42, 0.1); }
.rec-main { display: grid; gap: 2px; min-width: 0; }
.rec-main b {
  color: var(--orange);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-main span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.rec-side b { font-size: 16px; }
.rec-side .pill { padding: 2px 8px; font-size: 11px; }
.rec-edited { color: var(--orange-soft); font-size: 13px; }
.rec-body {
  display: grid;
  gap: 4px;
  padding: 4px 12px 12px;
  font-size: 12px;
}
.rec-kv {
  display: grid;
  grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
  gap: 8px;
}
.rec-kv span { color: var(--muted); }
.rec-kv b { font-weight: 600; overflow-wrap: anywhere; word-break: break-word; }
.rec-body .row-actions { margin-top: 8px; flex-wrap: nowrap; }
.rec-body .row-actions button {
  flex: 1 1 0;
  width: auto;
  min-height: 0;
  padding: 9px 10px;
  font-size: 14px;
}
.rec-more { width: 100%; margin-top: 10px; }

.warn { color: var(--danger); margin: 0 0 6px; font-size: 13px; }
.hidden { display: none !important; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 10px;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
}
table.data th { color: var(--muted); font-weight: 600; }
.loc-table-wrap {
  overflow: auto;
  max-height: min(40vh, 320px);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 8px;
}
.loc-table-wrap table.data { margin-top: 0; }
.loc-table-wrap table.data th {
  position: sticky;
  top: 0;
  background: #071c45;
  z-index: 1;
}

/* ---------- Camera ---------- */

.camera-modal {
  position: fixed;
  inset: 0;
  height: 100%;
  height: 100dvh;
  background: #000;
  z-index: 40;
}
.camera-modal video { width: 100%; height: 100%; object-fit: cover; }
.camera-ui {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
}
.camera-ui p { color: #fff; margin: 0 0 10px; font-size: 16px; }
.camera-close { min-height: 52px; }
.scan-frame {
  position: absolute;
  top: 46%; left: 50%;
  transform: translate(-50%, -50%);
  width: 72vw; height: 72vw;
  max-width: 300px; max-height: 300px;
  border: 3px solid var(--orange);
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--navy-dark);
  border: 1px solid var(--orange);
  padding: 12px 18px;
  border-radius: 999px;
  z-index: 50;
  max-width: 92vw;
  text-align: center;
  font-size: 14px;
}
.toast.bad { border-color: var(--danger); }

.combo-wrap { position: relative; }
.combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: min(52dvh, 360px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #071c45;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
.combo-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  padding: 14px 14px;
  min-height: 48px;
  font-size: 16px;
}
.combo-list button:last-child { border-bottom: 0; }
.combo-list button:hover,
.combo-list button:focus { background: var(--panel-2); }
.combo-empty {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
}
.loc-combo .loc-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.loc-combo .loc-field input {
  flex: 1;
  min-width: 0;
}
.loc-drop {
  flex: 0 0 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--orange);
}
.loc-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.combo-list.loc-open {
  max-height: min(52vh, 360px);
}

.admin-tools {
  display: grid;
  gap: 8px;
}
.admin-tools label {
  margin: 0;
  font-size: 12px;
}
.admin-search {
  width: 100%;
  margin: 0;
  border-color: rgba(232, 145, 42, 0.45);
}
.admin-search-wrap .loc-field { display: flex; gap: 8px; }
.admin-search-wrap .loc-field input { flex: 1; min-width: 0; }
#admin-q-suggest.loc-open { max-height: min(44vh, 300px); }
.combo-list .pick-head {
  position: sticky;
  top: 0;
  padding: 6px 14px;
  font-size: 11px;
  color: var(--muted);
  background: #071c45;
  border-bottom: 1px solid var(--line);
}
.combo-list .pick-item {
  display: grid;
  gap: 1px;
  padding: 8px 14px;
}
.combo-list .pick-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.combo-list .pick-top b {
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combo-list .pick-top em {
  flex: none;
  font-style: normal;
  font-size: 12px;
  color: var(--orange);
}
.combo-list mark {
  background: rgba(232, 145, 42, 0.35);
  color: var(--orange-soft);
  font-weight: 800;
  border-radius: 3px;
  padding: 0 1px;
}
.combo-list .pick-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 720px) {
  .admin-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }
  .admin-search {
    grid-column: auto;
  }
}
@media (max-width: 719px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .admin-search {
    order: 3;
  }
}

.admin-corner {
  display: flex;
  justify-content: flex-end;
  margin-top: 36px;
  padding-bottom: 8px;
}
.admin-quiet {
  background: transparent !important;
  border: 0 !important;
  border-left: 0 !important;
  color: #2c3f63;
  font-size: 11px;
  font-weight: 400;
  min-height: 0;
  padding: 6px 8px;
  opacity: 0.32;
  text-align: right;
}
.admin-quiet:hover,
.admin-quiet:focus {
  opacity: 0.55;
  outline: none;
}

.progress-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
}
.pie-wrap {
  position: relative;
  width: 150px;
  height: 150px;
}
.pie-wrap svg { width: 100%; height: 100%; }
.pie-bg {
  fill: none;
  stroke: #1d4390;
  stroke-width: 3.2;
}
.pie-fg {
  fill: none;
  stroke: var(--orange);
  stroke-width: 3.2;
  stroke-linecap: round;
}
.pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pie-center b {
  font-size: 22px;
  color: var(--orange);
  line-height: 1.1;
}
.pie-center span {
  font-size: 11px;
  color: var(--muted);
}
.pie-stats {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.pie-stats div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}
.pie-stats span { min-width: 0; }
.pie-stats b { color: var(--orange-soft); margin-left: auto; text-align: right; }
.area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: min(60vh, 520px);
  overflow: auto;
}
.area-card {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: #071c45;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  min-width: 0;
}
.area-card:hover { border-color: var(--orange-soft); }
.area-card.active { border-color: var(--orange); background: rgba(232, 145, 42, 0.14); }
.pie-center b.muted { color: var(--muted); }
.pie-center b.has-qty { color: var(--orange); }
.pie-center b.ok { color: var(--ok); }
.num { font-weight: 800; font-variant-numeric: tabular-nums; }
.num.has-qty { color: var(--orange); }
.num.ok { color: var(--ok); }
.num.extra { color: #f87171; }
.pie-stats .num { margin-left: 0; }
.area-card .pie-center b.ok { color: var(--ok); }
.area-card.done .pie-fg { stroke: var(--ok); }
.area-card.done .pie-center b { color: var(--ok); }
.pie-wrap.sm { width: 84px; height: 84px; margin-bottom: 4px; }
.pie-wrap.sm .pie-center b { font-size: 15px; }
.area-card .area-name {
  font-size: 13px;
  color: var(--ink);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.area-card span { font-size: 11px; color: var(--muted); max-width: 100%; overflow-wrap: anywhere; }
.area-card .num.has-qty { color: var(--orange); }
.area-card .num.ok { color: var(--ok); }
.area-card .num.extra { color: #f87171; }
.area-card .area-extra { margin-top: 2px; }
.area-card .area-extra.has-extra { color: #f87171; font-weight: 700; }
.area-card:disabled { cursor: default; opacity: 0.85; }
.area-card:disabled:hover { border-color: var(--line); }
@media (max-width: 400px) {
  .area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pie-wrap.sm { width: 72px; height: 72px; }
}
.pie-in { fill: none; stroke: #22c55e; stroke-width: 3.2; }
.pie-extra { fill: none; stroke: #ef4444; stroke-width: 3.2; }
.extra-text { color: #f87171 !important; }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.legend.in { background: #22c55e; }
.legend.extra { background: #ef4444; }
table.data th.extra-col { color: #fca5a5; white-space: nowrap; }
table.data td.extra-col { color: var(--muted); }
table.data td.extra-col.has-extra { color: #f87171; font-weight: 700; background: rgba(239, 68, 68, 0.08); }
table.data tr.loc-row { cursor: pointer; }
table.data tr.loc-row.active { background: rgba(232, 145, 42, 0.16); }
table.data td.pct { font-weight: 700; color: var(--orange); }

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-nav { grid-template-columns: 1fr 1fr; }
  .grid-nav button { min-height: 84px; font-size: 16px; padding: 12px; }
  .progress-row { grid-template-columns: 1fr; justify-items: center; }
  .pie-stats { width: 100%; }
  .row-actions { flex-direction: column; }
  .row-actions .ghost, .row-actions button { width: 100%; min-height: 48px; }
}
@media (max-width: 400px) {
  #app { padding: 10px 10px calc(20px + env(safe-area-inset-bottom)); }
  .panel { padding: 12px; border-radius: 14px; }
  .sticky-save { margin-left: -12px; margin-right: -12px; margin-bottom: -12px; }
  .qty-dock { margin-left: -12px; margin-right: -12px; margin-bottom: -12px; padding-left: 10px; padding-right: 10px; }
  .qty-pair { gap: 6px; }
  .qty-stock b, .qty-input { font-size: clamp(16px, 5vw, 22px); }
  .scanbox { padding: 10px; }
  .compare-item { padding: 8px; }
  .compare-pair { column-gap: 8px; }
  h2 { font-size: 18px; }
  .brandbar { padding: 10px; gap: 8px; }
  .brandbar img { height: 34px; }
  .brand-text .company { font-size: 13px; }
  .stats b { font-size: 18px; }
  .rec-kv { grid-template-columns: 1fr; gap: 0; }
  .rec-kv + .rec-kv { margin-top: 4px; }
  .qty-input { font-size: clamp(16px, 5vw, 22px); }
}
@media (min-width: 1100px) {
  #app { max-width: 880px; }
  .admin-tools {
    grid-template-columns: 150px minmax(0, 0.8fr) minmax(0, 1.2fr) minmax(0, 1fr);
  }
}

.primary.saving {
  opacity: 0.85;
  pointer-events: none;
}
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}
.btn-spinner.lg {
  width: 56px;
  height: 56px;
  border-width: 5px;
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #5dffb0;
  margin: 0 auto 12px;
  display: block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.focus-modal,
.save-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.88);
}
@media (min-width: 560px) {
  .focus-modal,
  .save-overlay { align-items: center; }
}
.save-overlay { z-index: 80; align-items: center; }
.focus-modal.hidden,
.save-overlay.hidden { display: none; }
.focus-card {
  width: min(400px, 100%);
  max-height: min(78dvh, 78vh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #1c0d14;
  border: 2px solid #ff6b61;
  border-radius: 14px;
  padding: 14px 14px 12px;
  font-size: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  animation: focus-pop 0.18s ease-out;
}
@keyframes focus-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.focus-card.ok {
  background: #0d1c14;
  border-color: #3fb680;
}
.focus-card.ok h3 { color: #b7f0d0; }
.focus-card h3 {
  color: #ffd2cd;
  font-size: 16px;
  margin: 0 0 8px;
  line-height: 1.35;
}
.focus-card p { margin: 6px 0; }
.focus-card .compare-list { gap: 6px; margin-top: 8px; }
.focus-card .compare-item,
.focus-card .dup-item { padding: 8px; }
.focus-card .kv-row.big b { font-size: 16px; }
.focus-card #focus-ok {
  min-height: 48px;
  font-size: 17px;
  font-weight: 800;
}
.focus-card #focus-ok.danger {
  background: linear-gradient(180deg, #ff5a52, #c62828);
  color: #fff;
}
.focus-card #focus-ok:disabled { opacity: 0.6; cursor: wait; }
.focus-card label { display: block; margin-top: 10px; }
.focus-card .name-entry {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid rgba(245, 169, 63, 0.55);
  border-radius: 12px;
  background: rgba(232, 145, 42, 0.1);
}
.focus-card .name-known {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(245, 169, 63, 0.55);
  border-radius: 12px;
  background: rgba(232, 145, 42, 0.1);
}
.name-known span { font-size: 13px; color: var(--muted); }
.name-known b { font-size: 16px; color: var(--orange-soft); overflow-wrap: anywhere; }
.name-entry-cap { color: #ffe3bf; font-weight: 700; font-size: 14px; }
.name-entry .req { color: #ff8a80; }
.name-entry input { text-transform: uppercase; }
.name-entry input::placeholder { text-transform: none; }
.name-entry input.invalid { outline: 2px solid var(--danger); outline-offset: 1px; }
.name-entry-hint { font-size: 12px; color: var(--muted); line-height: 1.35; }
.name-entry-err { font-size: 12.5px; font-weight: 700; color: #ff8a80; }
.focus-card .clear-list { margin: 6px 0 4px; padding-left: 20px; color: #ffd6d2; }
.focus-card .clear-err { color: #ff8a80; font-weight: 700; margin: 8px 0 0; }

.admin-danger-corner {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.danger-btn {
  background: #3a1014;
  border: 1px solid var(--danger);
  color: #ffd6d2;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
  text-align: center;
  max-width: 100%;
}
.danger-btn:hover,
.danger-btn:focus-visible { background: #5a141b; }
.save-card {
  min-width: 240px;
  text-align: center;
  background: #062a18;
  border: 3px solid #3ee08a;
  border-radius: 24px;
  padding: 28px 26px 22px;
  box-shadow: 0 0 32px rgba(62, 224, 138, 0.35);
}
.save-card.loading {
  background: #0b2352;
  border-color: #8ab4ff;
  box-shadow: none;
}
.save-card.ok {
  background: #00c853;
  border-color: #d7ffe8;
  box-shadow: 0 0 0 10px rgba(0, 200, 83, 0.28), 0 0 56px rgba(90, 255, 160, 0.95);
}
.save-check {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #fff;
  color: #00a33a;
  font-size: 42px;
  line-height: 72px;
  font-weight: 800;
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.55);
}
.save-card p {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 800;
  color: #b8ffd4;
}
.save-card.ok p {
  color: #fff;
  font-size: 28px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(0, 80, 30, 0.35);
}
.save-card.loading p {
  color: #dce7ff;
  font-size: 18px;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--navy-dark);
  border: 1px solid var(--orange);
  padding: 12px 18px;
  border-radius: 16px;
  z-index: 50;
  max-width: 92vw;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}
.toast.bad {
  border-color: var(--danger);
  background: #3a1014;
  color: #ffd6d2;
}
.toast.ok {
  background: #00c853;
  border: 3px solid #d7ffe8;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  padding: 18px 32px;
  box-shadow: 0 0 0 8px rgba(0, 200, 83, 0.28), 0 0 40px rgba(90, 255, 160, 0.9);
}

.export-help { margin: 4px 0 10px; font-size: 13px; color: #475569; }
.export-help summary { cursor: pointer; color: #03358A; font-weight: 600; }
.export-help p { margin: 6px 0 4px; }
.export-help ul { margin: 0; padding-left: 18px; }
.export-help li { margin: 2px 0; }

.en {
  font-size: 0.82em;
  font-weight: 400;
  opacity: 0.75;
}
h2 .en, h3 .en { font-size: 0.6em; margin-left: 4px; }
button .en { display: block; margin-top: 2px; }
.scanbox .en, .hint .en { display: block; margin-top: 2px; }
label .en { margin-left: 2px; }

.link-btn {
  justify-self: stretch;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 0;
  min-height: 44px;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}
.link-btn:hover { color: var(--ink); }

.dot-on, .dot-off { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-on { background: #16a34a; }
.dot-off { background: #cbd5e1; }

button[type="submit"].primary {
  display: block;
  justify-self: center;
  width: min(100%, 320px);
  margin-left: auto;
  margin-right: auto;
  min-height: 42px;
  padding: 9px 16px;
  font-size: clamp(14px, 3.6vw, 15px);
  line-height: 1.25;
  border-radius: 10px;
}
button[type="submit"].primary .en { display: inline; margin: 0 0 0 4px; }
@media (max-width: 400px) {
  button[type="submit"].primary { min-height: 40px; padding: 8px 12px; }
}
@media (min-width: 1100px) {
  button[type="submit"].primary { width: 280px; }
}

.primary.big {
  display: block;
  width: min(100%, 340px);
  margin-left: auto;
  margin-right: auto;
  min-height: 46px;
  padding: 10px 16px;
  font-size: clamp(15px, 4vw, 16px);
  line-height: 1.25;
  border-radius: 10px;
}
.primary.big .en { display: inline; margin: 0 0 0 4px; }
.primary.big.compact {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 14px;
}
#btn-scan-job.scan-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  margin-bottom: 10px;
  padding: 5px 6px 5px 5px;
  text-align: left;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.2;
  color: #1b1000;
  background: linear-gradient(135deg, #f8b957 0%, var(--orange) 60%, #d4760f 100%);
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(232, 145, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, min-height 0.15s ease;
}
#btn-scan-job.scan-cta:hover { filter: brightness(1.05); }
#btn-scan-job.scan-cta:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(232, 145, 42, 0.25);
}
#btn-scan-job.scan-cta:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.scan-cta .scan-cta-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--navy-deep);
  color: var(--orange-soft);
}
.scan-cta .scan-cta-icon svg { width: 22px; height: 22px; }
.scan-cta .scan-cta-label { flex: 1 1 auto; min-width: 0; }
.scan-cta .en { display: inline; margin-left: 4px; font-size: 0.78em; font-weight: 600; opacity: 0.7; }
.scan-cta .scan-cta-again { display: none; }
.scan-cta .scan-cta-go {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(27, 16, 0, 0.12);
}
.scan-cta .scan-cta-go svg { width: 18px; height: 18px; }
#btn-scan-job.scan-cta.compact {
  min-height: 40px;
  padding: 4px 5px 4px 4px;
  gap: 10px;
  font-size: 14px;
}
.scan-cta.compact .scan-cta-icon { width: 30px; height: 30px; border-radius: 8px; }
.scan-cta.compact .scan-cta-icon svg { width: 18px; height: 18px; }
.scan-cta.compact .scan-cta-go { width: 26px; height: 26px; }
.scan-cta.compact .scan-cta-go svg { width: 15px; height: 15px; }
.scan-cta.compact .scan-cta-idle { display: none; }
.scan-cta.compact .scan-cta-again { display: inline; }
@media (prefers-reduced-motion: reduce) {
  #btn-scan-job.scan-cta { transition: none; }
}
.camera-close {
  display: block;
  width: min(100%, 280px);
  margin: 0 auto;
  min-height: 42px;
  padding: 9px 16px;
  font-size: 15px;
}
.focus-card .row-actions { flex-direction: row; margin-top: 10px; }
.focus-card .row-actions button,
.focus-card #focus-ok {
  flex: 1 1 140px;
  width: auto;
  min-height: 40px;
  padding: 7px 10px;
  font-size: 14px;
  line-height: 1.2;
  border-radius: 10px;
}

/* ---------- Safeguards: location banner, PART summary, LOT pick, qty check ---------- */

.loc-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 2px solid var(--orange);
  border-radius: 12px;
  background: rgba(232, 145, 42, 0.12);
}
.loc-banner-cap { font-size: 12px; color: var(--muted); font-weight: 700; }
.loc-banner-cap .en { margin-left: 2px; font-weight: 400; }
.loc-banner-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(17px, 4.8vw, 21px);
  font-weight: 800;
  color: var(--orange-soft);
  overflow-wrap: anywhere;
}
.loc-banner-change {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.part-here {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
.part-here.over { border-color: var(--danger); background: rgba(226, 87, 76, 0.1); }
.part-here-head { font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.part-here-head .en { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.part-here-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}
.part-here-grid > div {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.part-here-grid span { font-size: 11px; color: var(--muted); }
.part-here-grid span .en { display: block; font-size: 10px; }
.part-here-grid b { font-size: 14px; overflow-wrap: anywhere; }
.part-here-note { margin: 6px 0 0; font-size: 12px; color: var(--orange-soft); }
.part-here-note .en { display: block; font-size: 11px; color: var(--muted); }

.lot-pick {
  padding: 8px 10px;
  border: 1px dashed var(--orange);
  border-radius: 12px;
  background: rgba(232, 145, 42, 0.08);
}
.lot-pick-cap { font-size: 12px; font-weight: 700; color: var(--orange-soft); }
.lot-pick-cap .en { display: block; margin: 2px 0 0; font-weight: 400; color: var(--muted); }
.lot-pick select { padding-top: 10px; padding-bottom: 10px; font-size: 15px; }

.save-loc { margin: 4px 0 0; font-size: 15px; font-weight: 800; color: var(--orange-soft); }

.qty-check-list {
  margin: 10px 0 6px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--orange-soft);
}
.qty-check-list li + li { margin-top: 4px; }

body.blind-count .qty-stock b { font-size: 16px; color: var(--muted); }

/* ---------- Admin safeguards panel ---------- */

.safety-alert {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(226, 87, 76, 0.16);
  color: #fca5a5;
  font-size: 13px;
}
.safety-alert .en { display: block; font-size: 11px; }
.safety-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
}
.safety-toggle input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--orange); }
.safety-toggle .en { display: block; margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.safety-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.safety-row > div { flex: 1 1 220px; min-width: 0; }
.safety-row button { flex: 0 0 auto; padding: 8px 12px; font-size: 13px; }
.safety-report {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(63, 182, 128, 0.1);
  font-size: 13px;
}
.safety-report.warn { background: rgba(226, 87, 76, 0.12); }
.safety-report ul { margin: 6px 0 0; padding-left: 18px; }
.safety-report li + li { margin-top: 3px; }
.safety-report .en { display: block; font-size: 11px; color: var(--muted); }

/* ---------- Admin recent errors panel ---------- */

.err-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 70px;
  margin-bottom: 8px;
  padding: 6px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.err-bar {
  position: relative;
  flex: 1 1 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
}
.err-bar span {
  display: block;
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: var(--orange);
}
.err-bar em {
  position: absolute;
  bottom: -14px;
  left: 0;
  right: 0;
  font-size: 10px;
  font-style: normal;
  text-align: center;
  color: var(--muted);
}
.err-list { margin: 0; padding: 0; list-style: none; }
.err-item {
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.err-item.err-bad { border-color: rgba(226, 87, 76, 0.55); }
.err-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.err-time { font-size: 12px; color: var(--muted); }
.err-msg { margin-top: 4px; }
.err-meta { margin-top: 3px; font-size: 11px; color: var(--muted); }

