:root {
  --navy: #212856;
  --navy-2: #2f3877;
  --red: #b0242b;
  --grey: #828284;
  --ink: #14172b;
  --muted: #5d6070;
  --line: #d9dbe4;
  --bg: #ffffff;
  --soft: #f3f4f8;
  --ok: #1d7a3e;
  --warn-bg: #fff4d6;
  --warn-ink: #7a5300;
  --err-bg: #fde7e8;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 4px solid var(--red);
}
.top img { height: 50px; display: block; }
.brand { display: block; }
.appname { display: flex; align-items: center; gap: 8px; color: var(--navy); font-weight: 500; font-size: 20px; letter-spacing: -0.2px; }
.appname b { font-weight: 800; }
.appname span { color: var(--red); }
.appname span b { color: var(--navy); }
.top .appname img.mark { height: 30px; width: 30px; }
.wordmark { text-decoration: none; font-size: 22px; color: var(--navy); letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px; }
.wordmark b { font-weight: 800; }
.wordmark i { font-style: normal; font-weight: 400; }
.wordmark .sq { width: 14px; height: 14px; border: 3px solid var(--red); border-radius: 2px; display: inline-block;
  background: linear-gradient(var(--red), var(--red)) 2px 2px / 4px 4px no-repeat; }

main { max-width: 480px; margin: 0 auto; padding: 16px; }

.asset { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px 18px; }
.asset .code { font-size: 40px; font-weight: 800; letter-spacing: 0.5px; line-height: 1.1; }
.asset .meta { color: #cfd3ea; font-size: 16px; margin-top: 2px; }
.asset .site { margin-top: 10px; display: inline-block; background: rgba(255,255,255,0.14); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 15px; }

.field { margin-top: 18px; }
.field label { display: block; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
.num {
  width: 100%; font-size: 34px; font-weight: 700; padding: 12px 14px; min-height: 64px;
  border: 2px solid var(--line); border-radius: var(--radius); color: var(--ink); background: #fff;
  font-variant-numeric: tabular-nums;
}
.num:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(33,40,86,0.15); }
.num::placeholder { font-size: 20px; font-weight: 500; color: #a3a6b4; }
.num[readonly] { background: var(--soft); color: var(--muted); }
.unit { font-size: 15px; font-weight: 600; color: var(--muted); }
.row { display: flex; align-items: baseline; justify-content: space-between; }
.edit { background: none; border: 0; color: var(--navy-2); font: inherit; font-size: 15px; text-decoration: underline; padding: 4px; }

textarea.note {
  width: 100%; font: inherit; padding: 12px 14px; min-height: 56px; border: 2px solid var(--line);
  border-radius: var(--radius); resize: vertical;
}
textarea.note:focus { outline: none; border-color: var(--navy); }

.worked { margin-top: 16px; text-align: center; background: var(--soft); border-radius: var(--radius); padding: 12px; }
.worked .v { font-size: 38px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.worked .l { color: var(--muted); font-size: 15px; }

.btn {
  display: block; width: 100%; margin-top: 20px; min-height: 64px; border: 0; border-radius: var(--radius);
  background: var(--red); color: #fff; font: inherit; font-size: 22px; font-weight: 800; letter-spacing: 0.3px;
}
.btn:active { transform: translateY(1px); filter: brightness(0.95); }
.btn[disabled] { opacity: 0.5; }
.btn.secondary { background: var(--navy); }
.btn.ghost { background: none; color: var(--navy); border: 2px solid var(--line); font-size: 18px; min-height: 56px; }

.msg { margin-top: 14px; border-radius: 10px; padding: 10px 14px; font-size: 16px; }
.msg.warn { background: var(--warn-bg); color: var(--warn-ink); }
.msg.err { background: var(--err-bg); color: var(--red); font-weight: 600; }
.msg.info { background: var(--soft); color: var(--muted); }

.done { text-align: center; padding-top: 24px; }
.done .tick { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; background: var(--ok); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 56px; font-weight: 800; }
.done h1 { color: var(--navy); margin: 16px 0 4px; font-size: 30px; }
.done p { color: var(--muted); margin: 4px 0; font-size: 18px; }
.done .big { color: var(--ink); font-size: 26px; font-weight: 800; }

.home h1 { color: var(--navy); font-size: 26px; margin: 8px 0 4px; }
.home p { color: var(--muted); margin: 0 0 8px; }
.code-input { letter-spacing: 12px; text-align: center; font-size: 44px; }
.code-input::placeholder { font-size: 44px; }

.queue { position: sticky; top: 0; z-index: 2; background: var(--warn-bg); color: var(--warn-ink); text-align: center;
  font-weight: 600; padding: 8px 12px; font-size: 15px; }
.queue.failed { position: static; background: var(--err-bg); color: var(--red); }

.today { margin-top: 18px; font-size: 15px; color: var(--muted); }
.today li { margin: 2px 0; }

footer { text-align: center; color: var(--grey); font-size: 13px; padding: 24px 0 32px; }

/* ---------- paper-form layout (mirrors CAN-FR-63 and the truck report) ---------- */
.paper { border: 2px solid var(--navy); border-radius: var(--radius); overflow: hidden; background: #fff; }
.paper-head { background: var(--navy); color: #fff; padding: 12px 14px; }
.paper-title { font-weight: 800; font-size: 18px; letter-spacing: 0.3px; line-height: 1.2; }
.paper-sub { display: flex; justify-content: space-between; color: #cfd3ea; font-size: 14px; margin-top: 4px; }
.paper-sub b, .paper-site b { color: #fff; }
.paper-site { color: #cfd3ea; font-size: 14px; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.cell { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 0; }
.grid2 .cell:nth-child(2n) { border-right: 0; }
.cell.wide { border-right: 0; }
.cell .k { font-size: 14px; font-weight: 800; color: var(--navy); letter-spacing: 0.3px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.cell .v { font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.15; overflow-wrap: anywhere; }
.cell .v.small { font-size: 17px; }
.cell .s { font-size: 14px; color: var(--muted); min-height: 0; }
.cell.fixed { background: var(--soft); }
.cell.main { background: #fff7f7; }
.in { width: 100%; font: inherit; font-size: 19px; padding: 8px 10px; border: 2px solid #b9bccb; border-radius: 10px; background: #fff; color: var(--ink); min-height: 56px; }
.in:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(33,40,86,0.15); }
.in.big { font-size: 28px; font-weight: 800; min-height: 60px; font-variant-numeric: tabular-nums; }
.in.big::placeholder { font-size: 18px; font-weight: 500; color: #a3a6b4; }
.cell.fixed .in[readonly] { background: transparent; border-color: transparent; padding-left: 0; color: var(--ink); }
.cell.main .in { border-color: var(--red); }
.in.note { min-height: 48px; resize: vertical; }
.cell .edit { align-self: flex-start; margin-top: 4px; min-height: 44px; padding: 6px 14px; font-size: 16px; font-weight: 700; text-decoration: none; color: var(--navy); background: #fff; border: 2px solid var(--line); border-radius: 10px; }
.paper .worked { margin: 10px; }
.paper #check { padding: 0 10px; }
.btn.small { min-height: 44px; font-size: 16px; margin: 8px 10px; width: calc(100% - 20px); }

/* ---------- easier field use: big targets, one-tap choices, send always in reach ---------- */
.msg.big-msg { font-size: 18px; margin: 0 0 12px; }
.names { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.chip { min-height: 48px; padding: 8px 16px; border: 2px solid var(--line); border-radius: 999px; background: #fff; color: var(--navy); font: inherit; font-size: 17px; font-weight: 700; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
details.more { border-bottom: 1px solid var(--line); }
details.more > summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 14px; font-size: 20px; font-weight: 800; color: var(--navy); cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; margin-left: auto; font-size: 28px; font-weight: 700; color: var(--grey); }
details.more[open] > summary::after { content: "−"; }
details.more[open] > summary { background: var(--soft); border-bottom: 1px solid var(--line); }
details.more .ico { font-size: 28px; width: 36px; text-align: center; }
#lines .line { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 10px; border-bottom: 1px dashed var(--line); }
#lines .line label, #lines .line .pv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#lines .line span { font-size: 14px; font-weight: 800; color: var(--navy); }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 4px; }
.stepper .in { text-align: center; padding: 6px 2px; font-weight: 800; }
.step { min-height: 56px; border: 2px solid var(--navy); border-radius: 10px; background: #fff; color: var(--navy); font: inherit; font-size: 28px; font-weight: 800; padding: 0; }
.tick-btn { min-height: 56px; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: #c3c5d0; font: inherit; font-size: 28px; font-weight: 800; }
.tick-btn[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.guess { margin-top: 10px; min-height: 56px; font-size: 20px; background: var(--navy); }
.sendbar { position: sticky; bottom: 0; z-index: 3; margin: 12px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -6px 16px rgba(20,23,43,0.08); }
.sendbar .btn { margin-top: 0; }
.sendbar .btn + .btn { margin-top: 8px; }
.why { text-align: center; font-size: 17px; font-weight: 700; color: var(--red); margin-bottom: 8px; }
.home h2 { color: var(--navy); font-size: 20px; margin: 4px 0 8px; }
.recent { display: grid; gap: 10px; margin-bottom: 24px; }
.recent-btn { display: flex; align-items: center; justify-content: center; margin-top: 0; text-decoration: none; font-size: 20px; }
