/* IRONWORKS Scrap Metal Manager — colours taken from the IRONWORKS logo:
   roll-off dumpster navy, rust orange, chrome silver. Square corners, green/red status. */

@font-face {
  font-family: "Russo One";
  src: url("fonts/russo-one.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  /* palette sampled from the IRONWORKS badge (ring navy, copper ring, cream lettering) */
  --bg:        #1c1a18;
  --surface:   #292623;
  --surface-2: #383430;
  --border:    #4e4945;
  --text:      #eceae2;   /* badge cream */
  --muted:     #b3b1b0;
  --primary:   #c07a3c;   /* badge copper ring */
  --primary-h: #d68e4f;
  --primary-d: #8c5326;
  --primary-rgb: 192, 122, 60;
  --navy:      #312d29;   /* badge ring navy */
  --cream:     #dbdbd7;
  --gear:      #636160;
  --chrome-1:  #f4f2ea;
  --chrome-2:  #dbdbd7;
  --chrome-3:  #a9aba6;
  --success:   #10b981;
  --danger:    #ef4444;
  --info:      #3b82f6;
  --radius:    2px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Russo One", "Arial Black", Impact, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(49, 45, 41, .9), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(var(--primary-rgb), .10), transparent 60%),
    linear-gradient(160deg, #1c1a18 0%, #2b2825 100%) fixed;
  color: var(--text);
  font: 16px/1.5 var(--font);
  letter-spacing: 0.01em;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; font-family: var(--display); font-weight: 400; letter-spacing: .02em; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons & inputs ---------- */
.btn {
  font: 600 15px var(--font);
  padding: .6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  min-height: 44px;
}
.btn:hover { border-color: var(--primary); }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #24211e; }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: 14px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); }
input, select, textarea {
  font: 16px var(--font);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .7rem;
  min-height: 44px;
}
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: .8rem; }
/* chrome lettering like the logo */
.chrome {
  font-family: var(--display); letter-spacing: .06em; text-transform: uppercase;
  background: linear-gradient(180deg, var(--chrome-1) 0%, var(--chrome-2) 48%, var(--chrome-3) 52%, #eeeded 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: .5px rgba(0, 0, 0, .45);
}
/* badge image (the owners' logo file) and the text fallback shown until it is installed */
.badge-img { display: block; height: auto; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .55)); }
.topbar .badge-img { width: 46px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
.brand-name { font-size: 21px; line-height: 1; }
.brand-tag { display: block; font: 600 11px/1.2 var(--font); letter-spacing: .22em; text-transform: uppercase; color: var(--primary); margin-top: 3px; }

/* TEST environment must be impossible to miss */
.env-badge {
  font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: .3rem .7rem; border: 2px solid var(--primary); color: var(--primary);
  background: rgba(var(--primary-rgb), .12);
}
.env-badge.env-production { border-color: var(--success); color: var(--success); background: rgba(16, 185, 129, .1); }

/* ---------- Lock screen: the IRONWORKS badge is the background ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lock-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem;
  background:
    url("brand/badge.webp") center / min(92vh, 94vw) auto no-repeat,
    radial-gradient(ellipse at 50% 45%, #3c3834 0%, transparent 65%),
    url("brand/gears.svg") right -120px bottom -120px / 520px no-repeat,
    url("brand/gears.svg") left -160px top -160px / 440px no-repeat,
    var(--bg);
}
/* wide screens: badge on the left at full strength, PIN pad on the right */
@media (min-width: 1100px) {
  .lock-screen {
    align-items: flex-end; padding-right: max(6vw, calc(50vw - 640px));
    background-position: left max(4vw, calc(50vw - 660px)) center, 30% 50%, right -120px bottom -120px, left -160px top -160px, 0 0;
    background-size: min(88vh, 46vw) auto, auto, 520px, 440px, auto;
  }
}
.lock-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, rgba(55, 51, 47, .96) 0%, rgba(41, 38, 35, .96) 100%);
  border: 1px solid var(--border); border-top: 3px solid var(--primary); padding: 1.6rem 2rem 2rem;
  display: flex; flex-direction: column; gap: 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.lock-card .brand-tag { text-align: center; }
.lock-foot { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-align: center; text-shadow: 0 1px 3px #000000; }
.lock-screen .lock-card, .lock-screen .lock-foot { width: 400px; max-width: 100%; }
/* narrower screens: badge behind the PIN pad; the pad itself stays solid enough to read */
@media (max-width: 1099px) {
  /* badge on top, PIN pad below it (the page scrolls a little on phones) */
  .lock-screen {
    justify-content: flex-start;
    padding-top: calc(min(40vh, 78vw) + 1.5rem) !important;
    background-position: center 1rem, 50% 30%, right -120px bottom -120px, left -160px top -160px, 0 0;
    background-size: auto min(40vh, 78vw), auto, 520px, 440px, auto;
  }
}
@media (max-height: 920px) {
  .lock-screen { gap: .75rem; padding-top: 1rem; padding-bottom: 1rem; }
  .lock-card { padding: 1.1rem 1.5rem 1.3rem; gap: .6rem; }
  .keypad button { min-height: 54px; }
  .lock-hint { display: none; }
}
.pin-label { margin: .5rem 0 0; text-align: center; font-size: 18px; font-weight: 600; }
.pin-dots { display: flex; justify-content: center; gap: .8rem; min-height: 28px; }
.pin-dots span { width: 22px; height: 22px; border: 2px solid var(--primary); }
.pin-dots span.on { background: var(--primary); }
.pin-error { min-height: 1.5em; margin: 0; text-align: center; color: var(--danger); font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.keypad button {
  font: 700 26px var(--font); min-height: 68px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); border-radius: var(--radius); cursor: pointer;
}
.keypad button:active { transform: scale(.97); }
.keypad .key-muted { font-size: 17px; color: var(--muted); }
.keypad .key-go { font-size: 18px; background: var(--primary); color: #24211e; border-color: var(--primary); }
.lock-hint { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }

/* ---------- App shell ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem;
  /* brushed steel */
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #37332f 0%, var(--navy) 100%);
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.who { font-weight: 700; }
.lock-timer { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.tabs { display: flex; gap: 2px; padding: 0 1rem; background: rgba(32, 30, 29, .92); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  font: 600 15px var(--font); color: var(--muted); background: none; border: 0;
  border-bottom: 3px solid transparent; padding: .8rem 1rem; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); background: linear-gradient(180deg, transparent 0%, rgba(var(--primary-rgb), .12) 100%); }
.content { flex: 1; padding: 1.25rem; max-width: 1200px; width: 100%; margin: 0 auto; }

.card {
  background: linear-gradient(180deg, rgba(48, 45, 43, .55) 0%, var(--surface) 90px);
  border: 1px solid var(--border); border-top-color: #5a5653; padding: 1.25rem; margin-bottom: 1rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.card-head h2 { font-size: 1.35rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.placeholder { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.placeholder strong { color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
tr.inactive td { opacity: .5; }
.pill { display: inline-block; padding: .1rem .5rem; font-size: 13px; font-weight: 700; border: 1px solid var(--border); }
.pill-ok { color: var(--success); border-color: var(--success); }
.pill-bad { color: var(--danger); border-color: var(--danger); }
.pill-warn { color: var(--primary); border-color: var(--primary); }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--surface-2); }
.checks .mark { width: 1.5rem; font-weight: 800; }
.checks .ok { color: var(--success); }
.checks .bad { color: var(--danger); }

/* ---------- Dialogs & toasts ---------- */
.dialog {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 1.5rem; width: min(440px, 92vw); border-radius: var(--radius);
}
.dialog::backdrop { background: rgba(0, 0, 0, .65); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast {
  min-width: 260px; max-width: 420px; padding: .8rem 1rem; background: var(--surface-2);
  border-left: 5px solid var(--info); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-weight: 600;
}
.toast-ok { border-left-color: var(--success); }
.toast-bad { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--primary); }

/* ---------- Setup page ---------- */
.setup-page { display: grid; place-items: center; min-height: 100%; padding: 1.5rem; }
.setup-card { width: min(720px, 100%); }
.setup-card .check-h { font-size: 1rem; color: var(--primary); margin: 1rem 0 .25rem; }
.notice { padding: .8rem 1rem; border-left: 5px solid var(--info); background: var(--surface-2); }
.notice-ok { border-left-color: var(--success); }
.notice-bad { border-left-color: var(--danger); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .lock-timer { display: none; }
  .content { padding: .75rem; }
}

/* =================== Working screens (screens.js) =================== */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: .8rem 1rem; margin-top: 1rem; }
.f { min-width: 0; }
.f input, .f select { width: 100%; }
.w1 { grid-column: span 1; } .w2 { grid-column: span 2; } .w3 { grid-column: span 3; } .w4 { grid-column: span 4; }
.w6 { grid-column: span 6; } .w12 { grid-column: span 12; }
.ferr { color: var(--danger); font-weight: 600; min-height: 0; }
.has-err input, .has-err select { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(239, 68, 68, .35); }
.small { font-size: 13px; }

.step {
  display: inline-grid; place-items: center; width: 32px; height: 32px; margin-right: .6rem;
  background: var(--primary); color: #24211e; font-weight: 800; font-size: 18px; vertical-align: middle;
}
.step-locked { opacity: .45; }
.step-locked .step { background: var(--border); color: var(--text); }
.btn-big { min-height: 56px; font-size: 18px; padding: .7rem 1.6rem; }

.scanbox {
  width: 100%; font: 15px ui-monospace, Consolas, monospace; color: var(--muted);
  border: 2px dashed var(--primary); background: rgba(var(--primary-rgb), .06); resize: none; min-height: 64px;
}
.scanbox:focus { color: var(--text); background: rgba(var(--primary-rgb), .12); }
.scan-status { margin-top: .5rem; font-weight: 600; color: var(--muted); }
.scan-status.ok { color: var(--success); }
.scan-status.warn { color: var(--primary); }
.scan-status.bad { color: var(--danger); }
.returning { margin-top: .6rem; padding: .6rem .8rem; border-left: 5px solid var(--info); background: var(--surface-2); }
.returning.flagged { border-left-color: var(--danger); color: #fecaca; }
.physical { margin-top: 1rem; }
.physical summary { cursor: pointer; color: var(--muted); font-weight: 600; }

.dnb-result { margin-top: 1rem; padding: 1rem 1.2rem; border: 3px solid var(--border); }
.dnb-result .big { font-size: 26px; font-weight: 800; margin-bottom: .3rem; }
.dnb-result.clear { border-color: var(--success); background: rgba(16, 185, 129, .1); }
.dnb-result.clear .big { color: var(--success); }
.dnb-result.match { border-color: var(--danger); background: rgba(239, 68, 68, .15); }
.dnb-result.match .big { color: var(--danger); font-size: 34px; }
.dnb-result.error { border-color: var(--primary); background: rgba(var(--primary-rgb), .08); }
.dnb-result.error .big { color: var(--primary); }
.dnb-result .btn { margin-top: .7rem; }
.override { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .7rem; }
.override h3 { margin: 0; color: var(--danger); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.tile { border: 1px solid var(--border); padding: 1rem; display: flex; flex-direction: column; gap: .6rem; background: var(--bg); }
.tile-label { font-weight: 700; }
.thumb { width: 100%; max-height: 220px; object-fit: contain; background: #000000; border: 1px solid var(--border); }
.cam-dialog { width: min(900px, 96vw); }
.cam { width: 100%; background: #000000; margin: .5rem 0 1rem; }

.done { text-align: center; padding: 2.5rem 1rem; }
.done .row { justify-content: center; }
.ticket-no { font: 800 64px ui-monospace, Consolas, monospace; color: var(--primary); letter-spacing: .05em; }
.done .big { font-size: 22px; font-weight: 700; }

@media (max-width: 900px) {
  .w1, .w2, .w3 { grid-column: span 6; }
  .w4, .w6 { grid-column: span 12; }
}
.f input[type=checkbox] { width: 22px; height: 22px; flex: none; }
label.check.f { align-self: end; min-height: 44px; }
body { min-height: 100vh; }

/* ---------- Ticket workspace (Day 3) ---------- */
.row.space { justify-content: space-between; align-items: flex-start; }
.ticket-head .big { font-size: 24px; font-weight: 800; margin: .2rem 0; }
.small-no { font-size: 40px; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: .7rem; }
.big-pill { font-size: 16px; padding: .3rem .8rem; }
.totals { display: flex; gap: 1.5rem; font-size: 18px; color: var(--muted); }
.totals strong { color: var(--text); font-size: 22px; }
.totals .payout { color: var(--success); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
img.mini { width: 56px; height: 42px; object-fit: cover; border: 1px solid var(--border); cursor: zoom-in; display: block; }
table.clickable tbody tr { cursor: pointer; }
table.clickable tbody tr:hover td { background: rgba(var(--primary-rgb), .06); }
.problems, .notices { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .4rem; }
.problems li { padding: .6rem .8rem; border-left: 5px solid var(--danger); background: rgba(239, 68, 68, .08); }
.notices li { padding: .6rem .8rem; border-left: 5px solid var(--info); background: var(--surface-2); }
.rule { display: inline-block; min-width: 9rem; margin-right: .6rem; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ok-line { color: var(--success); font-weight: 700; font-size: 18px; }
.calc { min-height: 44px; display: flex; align-items: center; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.calc.bad { color: var(--danger); }
.lbl { font-weight: 600; font-size: 14px; color: var(--muted); }
.line-form .tiles { margin-top: 1rem; }
.form-actions { margin-top: 1rem; }
.photo-dialog { width: min(1000px, 96vw); }
.photo-dialog img { width: 100%; height: auto; display: block; }
table.prices input, table.prices select { min-height: 38px; padding: .3rem .5rem; width: 100%; }
table.prices .price-in { width: 7rem; text-align: right; }
tr.unmapped td { background: rgba(239, 68, 68, .1); }
table.prices input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
.calc { white-space: nowrap; }

/* ---- Day 4: scale toggle, special purchase, vehicle ---- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg button { min-height: 44px; padding: 0 1.1rem; background: var(--surface-2); color: var(--text); border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary); color: #111111; }
.sp-box { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid var(--primary); border-radius: var(--radius); background: rgba(var(--primary-rgb), .08); display: flex; flex-direction: column; gap: .4rem; }
.sp-box label.check { min-height: 36px; }
.okc { color: var(--success); } .badc { color: var(--danger); } .warnc { color: var(--primary); }
.small { font-size: .85rem; }
.endalign { align-self: end; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.car-card .tiles { grid-template-columns: minmax(260px, 420px); margin-top: 1rem; }
.car-card .thumb { max-height: 240px; object-fit: contain; }
.group-in { width: 7rem; }
table.prices input[type=text]:not(.price-in):not(.group-in) { min-width: 13rem; }
table.prices select { min-width: 6.5rem; }
table.prices td:nth-child(5) select { min-width: 13rem; }
table.prices .group-in { min-width: 7.5rem; }
table.prices td:nth-child(7) select, table.prices td:nth-child(8) select { min-width: 5rem; width: 5rem; }

/* ---- Day 5: payout, daily report, landfill, receipts ---- */
.scan-row { margin: .5rem 0 1rem; }
.scan-in { flex: 1 1 320px; min-height: 52px; font-size: 1.1rem; border: 2px dashed var(--primary); background: var(--bg); color: var(--text); padding: 0 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.filters { gap: .6rem; margin-bottom: 1rem; align-items: end; }
.filters select, .filters input[type=text], .filters input[type=date] { min-height: 44px; }
label.inline { display: flex; flex-direction: row; align-items: center; gap: .4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: .5rem 0; }
.stat { border: 1px solid var(--border); background: var(--surface-2); padding: .6rem .8rem; display: flex; flex-direction: column; gap: .2rem; }
.stat span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { font-size: 1.4rem; }
.stat.bad { border-color: var(--danger); }
.stat.bad strong { color: var(--danger); }
.payout-table tr.sel td { background: rgba(var(--primary-rgb), .08); }
.pay-card { border-color: var(--primary); position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -8px 24px rgba(0, 0, 0, .45); }
.deadline { border: 1px solid var(--border); padding: .8rem 1rem; margin: .5rem 0 1rem; background: var(--surface-2); }
.deadline.ok { border-color: var(--success); color: var(--success); }
.deadline.warn { border-color: var(--primary); color: var(--primary); }
.deadline.bad { border-color: var(--danger); color: var(--danger); background: rgba(239, 68, 68, .08); }
.deadline .small { color: var(--muted); margin-top: .25rem; }
.behind { border: 1px solid var(--danger); padding: .6rem 1rem; margin: 1rem 0; }
.behind h3 { margin: 0 0 .5rem; color: var(--danger); }
.behind ul { list-style: none; margin: 0; padding: 0; }
.behind li { padding: .35rem 0; border-bottom: 1px solid var(--surface-2); }
.sigpad { display: block; width: 100%; max-width: 900px; aspect-ratio: 900 / 240; background: #ffffff; border: 2px solid var(--border); touch-action: none; cursor: crosshair; margin: .4rem 0; }
.sig-img { max-height: 90px; background: #ffffff; border: 1px solid var(--border); }
.decl-card label.check { min-height: 44px; font-size: 1.05rem; }
.settings { display: flex; flex-direction: column; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--surface-2); }
.setting input[type=checkbox] { width: 26px; height: 26px; flex: none; }
.codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .2rem .8rem; }
.codes label.check { font-size: .9rem; }
.qr svg { width: 150px; height: 150px; display: block; margin: .6rem auto; }
#printArea { display: none; }

@media print {
  body > *:not(#printArea) { display: none !important; }
  body { background: #ffffff !important; }
  #printArea { display: block; color: #000000; }
  .receipt { width: 72mm; margin: 0 auto; font: 12px/1.35 Arial, Helvetica, sans-serif; color: #000000; }
  .receipt .r-head { text-align: center; border-bottom: 1px dashed #000000; padding-bottom: 4px; margin-bottom: 4px; }
  .receipt .r-head strong { font-size: 14px; letter-spacing: .05em; text-transform: uppercase; display: block; margin-top: 2px; }
  .receipt .r-logo { display: block; width: 30mm; height: auto; margin: 0 auto 2px; filter: grayscale(1) contrast(1.2); }
  .receipt .r-name { font: 400 20px var(--display); letter-spacing: .06em; }
  .receipt .r-no { font: 700 26px/1.1 ui-monospace, Menlo, Consolas, monospace; text-align: center; margin: 6px 0; }
  .receipt table { width: 100%; border-collapse: collapse; margin: 6px 0; }
  .receipt th, .receipt td { padding: 2px 0; border-bottom: 1px dotted #999999; text-align: left; font-size: 11px; color: #000000; background: #ffffff; }
  .receipt .num { text-align: right; }
  .receipt th + th, .receipt td + td { padding-left: 5px; }
  .receipt th { font-size: 10px; white-space: nowrap; }
  .receipt td.num { white-space: nowrap; }
  .receipt .r-total { font-size: 16px; text-align: right; border-top: 2px solid #000000; padding-top: 4px; }
  .receipt .r-paid { font-weight: 700; text-align: center; margin: 6px 0; }
  .receipt .r-sig img { max-width: 100%; max-height: 60px; display: block; margin: 0 auto; }
  .receipt .small { font-size: 10px; text-align: center; }
  .receipt .r-staff { font-size: 11px; margin: 2px 0 4px; }
  .receipt .r-t { margin: 1px 0; }
  .receipt .r-sm { font-size: 10px; } .receipt .r-md { font-size: 12px; } .receipt .r-lg { font-size: 14px; } .receipt .r-xl { font-size: 26px; line-height: 1.1; margin: 4px 0; }
  .receipt .r-center { text-align: center; } .receipt .r-right { text-align: right; } .receipt .r-b { font-weight: 700; }
  .receipt .r-mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; }
  .receipt .r-box { border: 2px dashed #000000; padding: 2px; }
  .receipt .r-rule { border-top: 2px solid #000000; margin: 4px 0; } .receipt .r-rule.dashed { border-top: 1px dashed #000000; }
  /* @page size is set per print (receipt roll or letter) by printNode() */

  /* ---- Full page on a regular printer (HP / Epson, letter paper) ---- */
  #printArea.paper-letter .receipt { width: auto; max-width: 7.5in; margin: 0 auto; font: 12pt/1.4 Arial, Helvetica, sans-serif; }
  #printArea.paper-letter .receipt .r-logo { width: 1.5in; }
  #printArea.paper-letter .receipt .r-sm { font-size: 10pt; } #printArea.paper-letter .receipt .r-md { font-size: 12pt; }
  #printArea.paper-letter .receipt .r-lg { font-size: 15pt; } #printArea.paper-letter .receipt .r-xl { font-size: 30pt; }
  #printArea.paper-letter .receipt th { font-size: 10pt; } #printArea.paper-letter .receipt td { font-size: 11.5pt; padding: 4px 0; }
  #printArea.paper-letter .receipt .r-total { font-size: 18pt; }
  #printArea.paper-letter .qr svg { width: 1.5in; height: 1.5in; }
  #printArea.paper-letter .receipt .r-sig img { max-height: 1in; }
  #printArea.paper-letter .receipt .r-box { padding: 4px; }

}
.pay-card .tiles, .load-tiles { grid-template-columns: repeat(auto-fit, minmax(240px, 380px)); }
.pay-card .thumb { max-height: 200px; object-fit: contain; }

/* ---- phone / narrow tablet ---- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .5rem .75rem; padding: .5rem .75rem; }
    .brand-name { font-size: 16px; }
  .topbar .badge-img { width: 36px; }
  .topbar .brand-tag { display: none; }
  .topbar .env-badge { font-size: 11px; padding: .2rem .5rem; order: 3; }
  .lock-timer { display: none; }
  .who { font-size: 14px; }
  .content { padding: .75rem; }
  .card { padding: 1rem; }
  .card-head { flex-wrap: wrap; }
  .card-head h2 { font-size: 1.1rem; }
  .ticket-no { font-size: 44px; }
}

.ll-box { border: 2px solid var(--primary); background: rgba(var(--primary-rgb), .08); padding: .8rem 1rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.ll-pin { width: 11rem; font-size: 1.2rem; letter-spacing: .3em; }

.check-group h3 { font-size: 1rem; color: var(--primary); margin: 1rem 0 .25rem; }
.checks .warnc { color: var(--primary); }

/* ---- weigh in → dump → reweigh ---- */
.weigh-card { border-left: 4px solid var(--primary); }
.weigh-card .big-lbs { font-family: 'Russo One', system-ui, sans-serif; font-size: 1.6rem; color: var(--primary); }
input.locked, input[readonly].locked { background: var(--surface-2); color: var(--text); border-style: dashed; cursor: not-allowed; }
.status-dumping { background: rgba(192, 122, 60, .18); color: #f0c08f; }

/* ---- payout QR verdict ---- */
.verdict { margin: 10px 0; padding: 12px 14px; border-radius: 10px; border: 2px solid; }
.verdict .v-head { display: flex; gap: 10px; align-items: center; font-size: 1.05rem; }
.verdict .v-icon { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.verdict .v-warn { margin-top: 6px; font-weight: 600; }
.verdict.ok { border-color: #3fae6a; background: rgba(63, 174, 106, .14); }
.verdict.warn { border-color: #e0a63a; background: rgba(224, 166, 58, .14); }
.verdict.bad { border-color: #e0524a; background: rgba(224, 82, 74, .18); }
.verdict.typed { border-color: var(--border); background: var(--surface-2); }

/* ---- receipt QR / verify ---- */
.receipt .r-copy { text-align: center; font-weight: 700; border: 2px dashed #000000; padding: 2px; margin: 4px 0; }
.receipt .r-verify { text-align: center; margin: 4px 0; }
.receipt .r-verify strong { font-family: monospace; font-size: 15pt; letter-spacing: 2px; }
.receipt .r-warn { font-size: 8pt; border-top: 1px solid #000000; margin-top: 6px; padding-top: 4px; }

/* ---- checklist on every open ticket ---- */
.checklist .check-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.checklist .check-steps li { display: flex; margin: 0; padding: 0; min-height: 0; align-items: baseline; gap: .7rem; font-size: 1.1rem; }
.checklist .mark { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; }
.checklist li.cl-done .mark { background: rgba(63, 174, 106, .2); color: #6fd39a; }
.checklist li.cl-todo .mark { background: rgba(224, 82, 74, .2); color: #ff8a82; }
.checklist li.cl-done strong { color: var(--muted); font-weight: 600; }
.checklist .hint { color: var(--muted); font-size: .95rem; }

/* ---- nonferrous page ---- */
.nf-top h2 { font-size: 1.6rem; margin: 0; }
.nf-new { font-size: 1.3rem; padding: 1rem 1.6rem; }
.nf-list td, .nf-list th { font-size: 1.1rem; padding: .7rem .6rem; }
.nf-list tr.clickable { cursor: pointer; }
.nf-finish { gap: 1rem; flex-wrap: wrap; }

/* ---- add-material form: one straight row, labels on one line ---- */
.line-form .lf-row { display: grid; grid-template-columns: minmax(220px, 2.2fr) repeat(2, minmax(110px, 1fr)) repeat(2, minmax(100px, .9fr)); gap: .8rem 1rem; align-items: end; margin-top: .6rem; }
.line-form .lf-row label, .line-form .lf-out { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.line-form .lf-row label > span:first-child, .line-form .lf-l { font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-form .lf-row input, .line-form .lf-row select { width: 100%; }
.line-form .lf-row input { font-size: 1.25rem; font-variant-numeric: tabular-nums; text-align: right; }
.line-form .lf-out .calc { min-height: 48px; }
.line-form .ferr:empty { display: none; }
.line-form .lf-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.5rem; margin-top: .5rem; min-height: 1.4rem; }
.line-form .lf-scale { display: flex; align-items: center; gap: .7rem; }
.line-form .lf-desc { margin-top: .8rem; }
.line-form .lf-desc input { width: 100%; }
.line-form .tiles { grid-template-columns: repeat(auto-fill, minmax(260px, 380px)); }
.nf-sent { margin-top: .8rem; }
@media (max-width: 760px) {
  .line-form .lf-row { grid-template-columns: 1fr 1fr; }
  .line-form .lf-mat { grid-column: 1 / -1; }
}
.weigh-card .tiles { grid-template-columns: repeat(auto-fill, minmax(260px, 380px)); }

/* ---- easy-to-follow rows: every other line shaded ---- */
.lines-table tbody tr:nth-child(odd) td, .nf-list tbody tr:nth-child(odd) td { background: rgba(236, 234, 226, .07); }
.lines-table tbody tr:nth-child(even) td, .nf-list tbody tr:nth-child(even) td { background: rgba(0, 0, 0, .22); }
.lines-table tbody tr:hover td, .nf-list tbody tr:hover td { background: rgba(var(--primary-rgb), .16); }
.lines-table td { font-size: 1.05rem; padding-top: .75rem; padding-bottom: .75rem; }
.lines-table tbody td:first-child, .nf-list tbody td:first-child { border-left: 4px solid transparent; }
.lines-table tbody tr:nth-child(odd) td:first-child, .nf-list tbody tr:nth-child(odd) td:first-child { border-left-color: var(--primary); }

/* ---- capitals + returning customers ---- */
input.caps { text-transform: uppercase; }
input.caps::placeholder { text-transform: none; }
.nf-search { margin-top: 1rem; }
.cust-search { position: relative; margin: .4rem 0 .8rem; }
.cust-q { width: 100%; font-size: 1.3rem; padding: .85rem 1rem; border: 2px solid var(--primary); }
.cust-results { margin-top: .4rem; border: 1px solid var(--border); background: var(--surface); max-height: 26rem; overflow-y: auto; }
.cust-hit { display: flex; width: 100%; align-items: center; gap: .9rem; padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 64px; }
.cust-hit:nth-child(odd) { background: rgba(236, 234, 226, .05); }
.cust-hit:hover, .cust-hit:focus-visible { background: rgba(var(--primary-rgb), .18); outline: none; }
.cust-hit.flagged strong { color: #ff8a82; }
.cust-face { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; flex: none; background: var(--surface-2); display: inline-grid; place-items: center; font-size: 1.4rem; }
.cust-main { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.cust-main strong { font-size: 1.15rem; letter-spacing: .02em; }
.cust-sub { color: var(--muted); font-size: .95rem; }
.cust-none { padding: .8rem 1rem; margin: 0; }
.returning { display: flex; gap: 1rem; align-items: flex-start; }
.ret-face { margin: 0; flex: none; text-align: center; }
.ret-face img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; }
.ret-face figcaption { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.ret-warn { color: #ffb86b; font-weight: 700; margin-top: .3rem; }
/* the line just added flashes so they can see it took */
.lines-table tr.flash td { animation: lineflash 1.8s ease-out; }
@keyframes lineflash { 0%, 30% { background: rgba(var(--primary-rgb), .45); } 100% { } }
@media (prefers-reduced-motion: reduce) { .lines-table tr.flash td { animation: none; background: rgba(var(--primary-rgb), .3); } }

/* ---- nonferrous: still working vs. waiting at the payout booth ---- */
.nf-sec { display: flex; align-items: center; gap: .6rem; font-size: 1.15rem; margin: 1.2rem 0 .4rem; color: var(--text); }
.nf-sec:first-child { margin-top: .2rem; }
.nf-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.nf-dot.work { background: var(--primary); }
.nf-dot.booth { background: #3fae6a; }
.nf-booth tbody td:first-child { border-left-color: #3fae6a !important; }
.nf-paid { margin-top: 1rem; }
.nf-paid summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: .4rem 0; }

/* ---- payout register: cash in ---- */
.cash-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.cash-row h2 { margin: 0; flex: none; }
.cash-figs { display: flex; flex-wrap: wrap; gap: .8rem; flex: 1; }
.cash-figs .stat { min-width: 150px; }
.cash-expected { color: #6fd39a; }
.cash-expected.neg { color: #ff8a82; }
.cash-in-btn { font-size: 1.2rem; }
.cash-log { margin-top: .8rem; }
.cash-log summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.cash-table td { padding: .45rem .6rem; }
.cash-table tr.undone td { text-decoration: line-through; color: var(--muted); }
.numpad { width: min(420px, 94vw); }
.numpad h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
.np-amount { font: 700 2.6rem/1.2 ui-monospace, Consolas, monospace; text-align: right; padding: .5rem .8rem; background: var(--bg); border: 2px solid var(--primary); margin-bottom: .7rem; font-variant-numeric: tabular-nums; }
.np-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-bottom: .6rem; }
.np-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.np-key { min-height: 64px; font: 700 1.6rem system-ui, sans-serif; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.np-key:active { background: rgba(var(--primary-rgb), .35); }
.np-back { color: #ffb86b; }
.np-clear { grid-column: 1 / -1; min-height: 48px; font-size: 1.1rem; }
.np-note { width: 100%; margin-top: .7rem; }

.amt-row { display: flex; gap: .4rem; }
.amt-row input { flex: 1; min-width: 0; font-size: 1.2rem; text-align: right; }
.np-open { flex: none; font-size: 1.3rem; padding: 0 .8rem; }

/* ---- printer picker ---- */
.printer-btn { white-space: nowrap; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; }
.printer-pick { width: min(480px, 94vw); }
.pp-list { display: flex; flex-direction: column; gap: .5rem; margin: .6rem 0; }
.pp-opt { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); }
.pp-opt.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pp-main { display: flex; flex-direction: column; gap: .15rem; }
.pp-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pp-dot.on { background: #3fae6a; } .pp-dot.off { background: #e0524a; } .pp-dot.neutral { background: var(--muted); }
.pr-url { font-size: .8rem; word-break: break-all; }
.pr-add { align-items: flex-end; flex-wrap: wrap; gap: .8rem; }
@media (max-width: 640px) { .printer-btn { max-width: 8rem; } }

.btn-park { border-color: var(--primary); color: var(--text); font-weight: 700; }
.dialog.wide { width: min(760px, 96vw); }
.dialog .checks li { flex-wrap: wrap; align-items: center; }
.dialog .checks li > .small { flex-basis: 100%; order: 9; }
.dialog .checks li > .btn { margin-left: auto; }
/* Payout on tablets: whole row is tappable, big boxes, obvious Pay */
.payout-table tr.tap { cursor: pointer; }
.payout-table tr.tap:hover td { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.payout-table tr.sel td { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.big-check { width: 1.6rem; height: 1.6rem; accent-color: var(--primary); }
.pay-row { margin-top: .35rem; min-height: 2.4rem; min-width: 4.5rem; }
.tap-hint { margin: 0 0 .6rem; }
.pay-card { scroll-margin-top: 1rem; border-width: 2px; }

/* ---- Tab bar grouped by building: FERROUS [① DNB Gate ② Parking Lot] | Nonferrous | OFFICE [...] ---- */
.tabs { gap: 0; align-items: stretch; }
.tab-group { display: flex; align-items: stretch; position: relative; padding-top: 1.05rem; }
.tab-group + .tab-group { margin-left: .5rem; padding-left: .5rem; border-left: 1px solid var(--border); }
.tab-group-name {
  position: absolute; top: .3rem; left: 1rem; font: 800 10.5px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.tab-group + .tab-group .tab-group-name { left: 1.5rem; }
.tab-group.g-ferrous .tab-group-name { color: var(--primary); }
.tab-group button { padding-top: .35rem; }

/* ---- Building banner: which building + where you are in the flow ---- */
.building-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-bottom: 1rem;
  padding: .85rem 1.1rem; border-radius: var(--radius); border: 2px solid var(--primary);
  background: linear-gradient(90deg, rgba(var(--primary-rgb), .22), rgba(var(--primary-rgb), .05));
}
.bb-name { display: flex; align-items: center; gap: .7rem; }
.bb-icon { font-size: 2rem; line-height: 1; }
.bb-title { font: 800 1.45rem var(--font-display, var(--font)); letter-spacing: .12em; color: var(--text); }
.bb-sub { color: var(--muted); font-size: 13px; }
.bb-steps { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 0; padding: 0; flex: 1; }
.bb-step { display: flex; align-items: center; gap: .55rem; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); flex: 1 1 180px; }
.bb-step strong { font-size: 15px; }
.bb-s { color: var(--muted); font-size: 12px; }
.bb-n { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--surface-2); font-weight: 800; flex: none; }
.bb-step.on { border-color: var(--primary); background: rgba(var(--primary-rgb), .18); }
.bb-step.on .bb-n { background: var(--primary); color: #111111; }
.bb-step.past .bb-n { background: var(--success); color: #111111; }
.bb-step.link { cursor: pointer; }
.bb-step.link:hover { border-color: var(--primary); }

/* Line form photos: breathing room between "scale display" and "materials accepted" */
.line-form .tiles { gap: 1.5rem 2rem; }
.line-form .tiles > * { margin: 0; }
.line-form .lf-mat { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: 14px; color: var(--muted); }
.lf-mat-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.seg.seg-sm button { min-height: 34px; padding: 0 .8rem; font-size: 13px; }
.seg button.on { background: var(--primary); color: #111111; }

/* Records Box */
.chips { flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.rb-form { margin-bottom: .4rem; }
.w5 { grid-column: span 5; }
@media (max-width: 900px) { .w5 { grid-column: span 12; } }

/* ---- Full-page reports (Daily Report, Records Box): print + on-screen preview ---- */
.print-page { color: #000000; font: 10pt/1.35 Arial, Helvetica, sans-serif; }
.print-page h1 { font-size: 16pt; margin: 0 0 2pt; }
.print-page .pp-sub { font-size: 10pt; margin: 0 0 8pt; }
.print-page .pp-meta { display: grid; grid-template-columns: repeat(4, auto); gap: 2pt 14pt; justify-content: start; font-size: 9.5pt; margin: 0 0 8pt; padding: 6pt 0; border-top: 1.5pt solid #000000; border-bottom: 1pt solid #000000; }
.print-page table { width: 100%; border-collapse: collapse; }
.print-page th { text-align: left; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1.2pt solid #000000; padding: 3pt 4pt; background: #ffffff; color: #000000; }
.print-page td { font-size: 9pt; padding: 3pt 4pt; border-bottom: .5pt solid #999999; vertical-align: top; color: #000000; background: #ffffff; }
.print-page td.num, .print-page th.num { text-align: right; white-space: nowrap; }
.print-page tr { break-inside: avoid; }
.print-page .pp-lines td { border-bottom: 0; padding-top: 0; font-size: 8.5pt; }
.print-page .pp-foot { margin-top: 10pt; font-size: 8.5pt; }
.print-page .pp-void td { color: #555555; text-decoration: line-through; }

/* Nonferrous: driver's license first */
.nf-lic { margin: .9rem 0 .7rem; padding: .8rem 1rem 1rem; border: 2px dashed var(--primary); border-radius: var(--radius); background: rgba(var(--primary-rgb), .07); }
.nf-lic-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .5rem; font-size: 17px; }
.lic-in { width: 100%; min-height: 64px; font: 16px ui-monospace, Menlo, Consolas, monospace; resize: none; }
.lic-row { justify-content: space-between; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; }

/* Gate step 4: plate details | plate photo — lined up with the step 3 photo boxes */
.plate-row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.plate-in { width: 9.5ch; min-width: 9.5ch; font: 700 1.25rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.plate-st { width: 6.5rem; }
.plate-box .check { margin-top: auto; }
.tile-off { opacity: .4; pointer-events: none; }
.plate-row .f { flex: none; }
.plate-row .f input.plate-in { width: 10ch; }
.plate-row .f select.plate-st { width: 6.5rem; }

.plate-in.from-photo { border-color: var(--warn, #f59e0b); box-shadow: 0 0 0 2px rgba(245, 158, 11, .3); }
.plate-read:empty { display: none; }
.plate-read .btn { margin-left: .4rem; }

/* Payout: photos to check before paying */
.pay-photos-wrap { margin: .4rem 0 1rem; border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; background: var(--bg); }
.pay-photos-wrap > summary { cursor: pointer; font-weight: 700; }
.pp-ticket { margin-top: .7rem; }
.pp-ticket + .pp-ticket { border-top: 1px solid var(--border); padding-top: .7rem; }
.pp-head { margin-bottom: .4rem; }
.pp-group { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: .4rem 1rem; align-items: start; padding: .35rem 0; border-top: 1px dashed var(--surface-2); }
.pp-gtitle { font-size: 13px; font-weight: 600; color: var(--muted); padding-top: .3rem; }
.pp-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.pp-thumb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px; width: 96px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; cursor: zoom-in; color: var(--muted); font: 11px var(--font); }
.pp-thumb:hover, .pp-thumb:focus-visible { border-color: var(--primary); color: var(--text); }
.pp-thumb img { width: 88px; height: 66px; object-fit: cover; display: block; background: #000000; }
.pp-thumb span { max-width: 88px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .pp-group { grid-template-columns: 1fr; } }
.pv .pv-cap { margin-bottom: .5rem; }
.pv .pv-stage { display: flex; align-items: center; gap: .5rem; }
.pv .pv-stage img { flex: 1; min-width: 0; max-height: 72vh; object-fit: contain; background: #000000; }
.pv .pv-nav { font-size: 2rem; line-height: 1; min-width: 48px; min-height: 64px; }

/* Special purchase (kegs, utility cable, burnt wire): what Ohio needs, spelled out */
.sp-clear { border: 2px solid var(--primary); background: rgba(var(--primary-rgb), .1); padding: .8rem 1rem; }
.sp-title { font-weight: 800; font-size: 16px; margin-bottom: .4rem; }
.sp-steps { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .35rem; }
.sp-steps li { display: flex; gap: .6rem; align-items: center; font-size: 15px; }
.sp-mark { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--surface-2); flex: none; font-weight: 800; }
.sp-steps li.sp-done { color: var(--success); }
.sp-steps li.sp-done .sp-mark { background: var(--success); color: #111111; }
.sp-proof-row { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: .6rem 1rem; }
.sp-proof-row select, .sp-proof-row input { width: 100%; }
@media (max-width: 700px) { .sp-proof-row { grid-template-columns: 1fr; } }
.proof-need { font-weight: 700; animation: proof-pulse 2s ease-in-out 3; }
@keyframes proof-pulse { 50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, .35); } }
@media (prefers-reduced-motion: reduce) { .proof-need { animation: none; } }

.ohio-live { margin: .6rem 0 1rem; padding: .8rem 1rem; border: 2px solid var(--border); border-radius: var(--radius); }
.ohio-live.ok { border-color: var(--success); } .ohio-live.bad { border-color: var(--danger); }

/* ---- camera: switch / rotate ---- */
.cam-wrap { position: relative; height: min(60vh, 540px); background: #000000; margin: .5rem 0 1rem; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cam-wrap .cam { width: 100%; height: 100%; object-fit: contain; margin: 0; background: transparent; transition: transform .2s; }
.cam-dialog .dialog-actions { flex-wrap: wrap; }

/* ---- ferrous: Park button always on screen, bottom right ---- */
.park-fab { position: fixed; right: 18px; bottom: 18px; z-index: 50; min-height: 56px; padding: .7rem 1.3rem; border-radius: 999px;
  border: 2px solid var(--primary); background: var(--surface, #2c2825); color: var(--text); font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45); cursor: pointer; }
.park-fab:hover, .park-fab:focus-visible { background: var(--primary); color: #111111; }
@media print { .park-fab { display: none !important; } }

/* ---- ticket page: vehicle plate card + Parking Lot "needs" tags ---- */
.plate-card .card-head .pill { font-size: .85rem; }
.plate-card.plate-done { border-color: rgba(34, 197, 94, .35); }
.lot-needs { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.lot-needs .pill { font-size: .75rem; }

/* leave room so the floating Park button never covers the last buttons */
#app:has(.park-fab), main:has(.park-fab) { padding-bottom: 96px; }

/* ---- truck flow: whose turn (ferrous) ---- */
.turn { border-width: 2px; }
.turn-head h2 { margin: 0 0 .2rem; font-size: 1.35rem; }
.turn-sub { margin: 0 0 .8rem; color: var(--muted); }
.turn-yard   { border-color: #f59e0b; background: linear-gradient(0deg, rgba(245, 158, 11, .06), rgba(245, 158, 11, .06)), var(--surface); }
.turn-scale  { border-color: #3b82f6; background: linear-gradient(0deg, rgba(59, 130, 246, .07), rgba(59, 130, 246, .07)), var(--surface); }
.turn-finish { border-color: #22c55e; background: linear-gradient(0deg, rgba(34, 197, 94, .06), rgba(34, 197, 94, .06)), var(--surface); }
.turn select.turn-mat { width: 100%; min-height: 52px; font-size: 1.05rem; }
.turn .row { margin-top: .8rem; gap: .8rem; flex-wrap: wrap; }
.turn-weigh .thumb { max-height: 120px; width: auto; display: block; margin: .3rem 0 .6rem; border-radius: 6px; }
.turn-before { display: flex; justify-content: space-between; align-items: baseline; padding: .5rem .7rem; border-radius: 8px; background: var(--surface-2); margin-bottom: .6rem; }
.turn-before strong { font-size: 1.3rem; }
.turn input.after-in, .gate-loaded input, input.loaded-in { font-size: 1.4rem; font-weight: 700; text-align: right; max-width: 14ch; }
.turn-net { display: flex; gap: 1.4rem; margin-top: .6rem; font-size: 1.05rem; }
.turn-pill { font-weight: 700; }
.turn-pill-yard   { background: rgba(245, 158, 11, .18); color: #fbbf24; border-color: rgba(245, 158, 11, .5); }
.turn-pill-scale  { background: rgba(59, 130, 246, .18); color: #93c5fd; border-color: rgba(59, 130, 246, .5); }
.turn-pill-finish { background: rgba(34, 197, 94, .18); color: #86efac; border-color: rgba(34, 197, 94, .5); }
details.hand-line > summary, details.gate-plate > summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: .3rem 0; }
details.gate-plate { margin: .8rem 0; }

/* ---- details read from a photo (license front, plate): yellow until checked ---- */
input.from-photo, select.from-photo { border-color: var(--warn, #f59e0b) !important; background: rgba(245, 158, 11, .14) !important; box-shadow: 0 0 0 2px rgba(245, 158, 11, .3); }
.btn-front { border-color: var(--warn, #f59e0b); }

/* ---- ferrous start: Start ticket is the main button; Start & Park is the backup ---- */
.btn.btn-start { background: linear-gradient(90deg, #d9822b 0%, #8fae2f 55%, #3fa34d 100%); border-color: #8fae2f; color: #0d1a10; font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25); }
.btn.btn-start:hover:not(:disabled), .btn.btn-start:focus-visible { filter: brightness(1.08); }
.btn.btn-start:disabled { filter: grayscale(.6) brightness(.7); }
.start-row { align-items: center; gap: 1rem; }
.btn.btn-backup { opacity: .85; font-weight: 600; }

/* ---- Cash out (landfill / payout drawer) ---- */
.cash-btns { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.cash-out-btn { background: #7a2e2e; color: #ffffff; border-color: #a33d3d; }
.cash-out-btn:hover { background: #8f3535; }
.stat-out strong, .cash-out-row strong { color: var(--danger); }
.cash-out-dialog { max-width: 30rem; width: calc(100vw - 2rem); }
.cash-out-dialog .f { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .8rem; }
.cash-out-dialog .co-amount { font-size: 1.6rem; font-weight: 700; }
.cash-out-dialog .co-code { font-size: 1.4rem; letter-spacing: .3em; max-width: 12rem; }
.cash-out-dialog .ferr:empty { display: none; }
.pp-drawer-line { display: flex; gap: .5rem; align-items: flex-start; padding: .4rem .6rem; font-size: .9rem; }
.drawer-code-card .dc-code, .drawer-code-card .dc-code2 { letter-spacing: .3em; max-width: 10rem; }

/* ---- Needs a price (Admin → Price list) ---- */
.need-price { border: 1px solid var(--warn, #d9822b); border-radius: 10px; padding: .8rem 1rem; margin: .6rem 0 1rem; background: rgba(217, 130, 43, .08); }
.need-price h3 { margin: 0 0 .2rem; }
.need-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .5rem; }
.need-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.need-name { flex: 1 1 16rem; }
.need-in { display: inline-flex; align-items: center; gap: .3rem; }
.need-in .price-in { width: 7rem; }
table.prices tr.unpriced td { background: rgba(217, 130, 43, .12); }
.email-in { min-width: 16rem; }
.btn-smbc { white-space: nowrap; }

/* ---- NMVTIS (Records Box) ---- */
.nmvtis-table td { vertical-align: middle; }
.nmvtis-table tr.done td { opacity: .75; }
.nmvtis-table select { min-width: 7rem; }
.nmvtis-table input[type=text] { margin-top: .3rem; min-width: 9rem; }

/* ---- Manual Do Not Buy check (SMBC website) ---- */
.manual-dnb ol { margin: .3rem 0 .6rem 1.2rem; padding: 0; }
.dnb-help { background: var(--surface-2, rgba(127, 127, 127, .08)); border: 1px solid var(--border); border-radius: 10px; padding: .1rem .9rem; }
.dnb-help summary { cursor: pointer; font-weight: 700; padding: .7rem 0; min-height: 44px; display: flex; align-items: center; gap: .4rem; list-style: none; }
.dnb-help summary::-webkit-details-marker { display: none; }
.dnb-help summary::after { content: '▾'; margin-left: auto; transition: transform .15s; }
.dnb-help[open] summary::after { transform: rotate(180deg); }
.dnb-help[open] { padding-bottom: .8rem; }
.dnb-help p { margin: 0 0 .4rem; }
.dnb-help ol { margin: 0 0 0 1.3rem; padding: 0; display: grid; gap: .45rem; }
.dnb-help ul { margin: .35rem 0 0 1.1rem; padding: 0; display: grid; gap: .35rem; }
.copy-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .8rem; }
.copy-chip { display: inline-flex; gap: .3rem; align-items: baseline; }

/* ---- Photo tiles: one clear "Take photo" button ---- */
.tile .take-btn { width: 100%; font-size: 1.15rem; padding: .85rem 1rem; }
.tile .saved-btn { align-self: center; }
.tile-status { font-size: .9rem; color: var(--muted, #a8a6a4); }
.tile.tile-done { border-color: #3fa34d; box-shadow: inset 0 0 0 1px #3fa34d; }
.tile.tile-done .tile-status { color: #3fa34d; font-weight: 600; }
.tile.tile-done .tile-label::before { content: '✓ '; color: #3fa34d; }

.net-diag { white-space: pre-wrap; word-break: break-word; font: .8rem/1.45 ui-monospace, Consolas, monospace; background: #151311; color: #e4e2e0; padding: .8rem; border-radius: 8px; max-height: 60vh; overflow: auto; margin: .5rem 0 0; }

/* Page size for printNode(): named pages (the app's security policy blocks inline <style>). */
@page receiptroll { margin: 5mm; }
@page letterpage { size: letter portrait; margin: 0.5in; }
@media print {
  #printArea.paper-receipt { page: receiptroll; }
  #printArea.paper-letter { page: letterpage; }
}
.pr-kinds { margin: .2rem 0 1rem 1.1rem; padding: 0; display: grid; gap: .35rem; }
.pr-hint { margin: .4rem 0 0; }
