:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #14253b;
  background: #edf2f7;
  --ink: #14253b;
  --muted: #506278;
  --line: #d7e0eb;
  --blue: #084ba1;
}
* { box-sizing: border-box; }
body { margin: 0; }
header { background: #11243e; color: white; padding: 1.2rem max(1.25rem, calc((100% - 1120px)/2)); display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.brand { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.brand strong { letter-spacing: .12em; }
.brand span, .station { color: #bcd0e9; }
.station { font-size: .85rem; letter-spacing: .12em; white-space: nowrap; }
main { max-width: 1160px; margin: auto; padding: 0 1.25rem 3rem; }
nav { display: flex; flex-wrap: wrap; gap: .45rem; border-bottom: 1px solid var(--line); padding: 1rem 0; }
nav button { background: transparent; border-color: transparent; }
nav button[aria-current] { background: #dce9fb; color: #063a81; }
h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0; letter-spacing: -.045em; }
h2 { font-size: 1.28rem; margin: 0 0 1rem; }
p { line-height: 1.55; }
.intro { padding: 1.8rem 0 1rem; }
.intro p { color: var(--muted); margin: .5rem 0 0; }
.card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: clamp(1rem, 3vw, 1.6rem); margin-bottom: 1rem; box-shadow: 0 3px 10px #1829430a; }
.scan-box, .section-head, .filters, .pager { display: flex; gap: .8rem; flex-wrap: wrap; align-items: end; }
.scan-box label, .filters label { flex: 1 1 220px; margin: 0; }
.section-head { justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; }
.quantity { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
label { display: block; font-size: .9rem; font-weight: 650; margin-bottom: .9rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea { color: var(--ink); background: white; width: 100%; margin-top: .4rem; min-height: 44px; padding: .6rem .7rem; border: 1px solid #aab9cb; border-radius: 6px; }
textarea { min-height: 80px; }
button { border: 1px solid #b6c5d7; padding: .65rem .9rem; min-height: 44px; border-radius: 6px; color: var(--ink); background: white; cursor: pointer; font-weight: 650; }
button:hover { filter: brightness(.96); }
button:disabled { opacity: .48; cursor: default; }
.primary { background: var(--blue); border-color: var(--blue); color: white; }
:focus-visible { outline: 3px solid #4b8ce0; outline-offset: 2px; }
.totals { display: flex; gap: 2rem; padding: .85rem 1rem; border-radius: 7px; background: #eef4fc; margin: .3rem 0 1rem; }
.totals strong { display: block; font-size: 1.45rem; }
.muted { color: var(--muted); }
.scroll { overflow-x: auto; margin: .85rem 0; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .65rem .55rem; border-bottom: 1px solid var(--line); }
th { font-size: .88rem; color: var(--muted); background: #f4f7fb; }
.code { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.table-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
dialog { width: min(560px, calc(100% - 2rem)); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; color: var(--ink); }
dialog::backdrop { background: #11243eaa; }
#webcam-video, #photo-camera-video { display: block; width: 100%; max-height: 55vh; background: #14253b; border-radius: 7px; object-fit: contain; }
#take-photo { margin-top: .75rem; }
.qr-label { display: flex; align-items: center; gap: .75rem; border: 1px solid #aab9cb; padding: .35rem; min-width: 0; }
.qr-label img { width: min(32%, 148px); height: auto; image-rendering: pixelated; }
.qr-label p { margin: .25rem 0; }
.qr-label div { min-width: 0; }
.stage { padding: .9rem 0; border-top: 1px solid var(--line); }
.stage h3 { margin: .1rem 0 .5rem; font-size: 1rem; }
.stage p { margin: .3rem 0; overflow-wrap: anywhere; }
.done { color: #176149; font-weight: 650; }
.ready { color: #084ba1; font-weight: 650; }
.pager { align-items: center; justify-content: flex-end; }
#message { padding: .8rem 1rem; background: #e0f3e9; border: 1px solid #afd4c2; border-radius: 7px; }
#message.error { background: #ffeded; border-color: #e4b3b3; color: #8b2525; }
.photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos img { width: 110px; height: 80px; object-fit: cover; border-radius: 5px; }
pre { white-space: pre-wrap; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; gap: 0; }
  .station { display: none; }
}
#batch-labels .section-head label { flex: 1 1 12rem; margin: 0; }
#waiting-filters button[aria-pressed="true"] { background: var(--accent, #124e90); color: white; }
