@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }

:root {
  --concrete: #eef0f2; --asphalt: #1d232a; --muted: #5e6873; --rule: #c9ced4;
  --signal: #f2b705; --ok: #2e7d4f; --warn: #b4531a; --surface: #fff;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif; --body: "Barlow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--concrete); color: var(--asphalt); font: 400 16px/1.5 var(--body); }
a { color: inherit; text-underline-offset: 2px; }
[hidden] { display: none !important; }

.top { border-bottom: 1px solid var(--rule); background: var(--surface); }
.top__inner { max-width: 1280px; margin: 0 auto; padding: 20px 24px 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; }
.brand { margin: 0; font: 700 30px/1 var(--cond); }
.tagline { margin: 0; color: var(--muted); max-width: 72ch; }
.layout { max-width: 1280px; margin: 0 auto; padding: 22px 24px 40px; }

/* ------------------------------------------------------------------ steps */
.steps { display: flex; flex-wrap: wrap; border-bottom: 2px solid var(--asphalt); margin-bottom: 22px; }
.step {
  appearance: none; border: 0; background: none; cursor: pointer; text-align: left; color: var(--muted);
  padding: 8px 26px 10px 0; margin-right: 18px; margin-bottom: -2px; border-bottom: 5px solid transparent;
  font: 600 22px/1.1 var(--cond);
}
.step b {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 6px;
  border-radius: 50%; border: 2px solid currentColor; font: 700 15px/1 var(--cond); vertical-align: 2px;
}
.step span { display: block; font: 400 14px/1.3 var(--body); margin-top: 3px; }
.step.is-active { color: var(--asphalt); border-bottom-color: var(--signal); }
.step.is-done b { background: var(--asphalt); color: #fff; border-color: var(--asphalt); }
.step:focus-visible { outline: 3px solid var(--asphalt); outline-offset: 2px; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px 40px; }
.stage, .side { min-width: 0; }
.stage__frame {
  position: relative; aspect-ratio: 16 / 10; background: #dfe3e7; border: 1px solid var(--rule); border-radius: 4px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.stage__frame.is-dragging { outline: 3px solid var(--signal); outline-offset: -3px; }
.stage__canvas { max-width: 100%; max-height: 100%; display: block; touch-action: none; }
.stage__canvas.mode-calib, .stage__canvas.mode-box, .stage__canvas.mode-add, .stage__canvas.mode-remove { cursor: crosshair; }
.empty { text-align: center; padding: 24px; max-width: 50ch; }
.empty__title { margin: 0 0 6px; font: 600 26px/1.15 var(--cond); }
.empty__hint { margin: 0; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.status { color: var(--muted); font-size: 15px; margin: 14px 0 0; min-height: 1.5em; }
.status.is-error { color: var(--warn); }
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px;
  border-radius: 4px; cursor: pointer; border: 1px solid var(--asphalt); background: var(--surface); color: var(--asphalt);
  font: 600 16px/1 var(--body);
}
.btn:hover { background: #f6f7f8; }
.btn--primary { background: var(--signal); border-color: #c99600; }
.btn--primary:hover { background: #ffc61a; }
.btn--quiet { border-color: var(--rule); min-height: 36px; padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible, label.btn:focus-within { outline: 3px solid var(--asphalt); outline-offset: 2px; box-shadow: 0 0 0 6px var(--signal); }

.tools { display: flex; flex-wrap: wrap; margin-top: 12px; border: 1px solid var(--asphalt); border-radius: 4px; width: fit-content; max-width: 100%; overflow: hidden; }
.tool { appearance: none; border: 0; border-right: 1px solid var(--rule); background: var(--surface); cursor: pointer; padding: 9px 14px; font: 500 15px/1.2 var(--body); color: var(--asphalt); }
.tool:last-child { border-right: 0; }
.tool[aria-pressed="true"] { background: var(--asphalt); color: #fff; }
.tool:disabled { color: #9aa3ac; cursor: default; }
.tool:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; }
.guide { margin: 10px 0 0; min-height: 1.5em; max-width: 70ch; }

/* ------------------------------------------------------------------ plate */
.plate {
  --bg: #15191c; --fg: #f3f4ef; position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 460 / 135; width: 100%; background: var(--bg); color: var(--fg); border-radius: 10px; padding: 0 6%;
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 8px var(--fg);
}
.plate--white { --bg: #f7f7f3; --fg: #15191c; box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 8px var(--fg), 0 0 0 1px var(--rule); }
.plate--yellow { --bg: #f2c200; --fg: #15191c; }
.plate--red { --bg: #c8252c; --fg: #fbfbf7; }
.plate--green { --bg: #1f7a45; --fg: #fbfbf7; }
.plate--empty { --bg: #d4d9de; --fg: #aab2ba; box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 8px #bcc3ca; }
.plate__text { font: 700 clamp(36px, 5.4vw, 80px)/1 var(--cond); letter-spacing: 0.04em; white-space: pre; font-variant-numeric: tabular-nums; }
.plate.is-reading .plate__text { opacity: 0.35; }
.chars { position: relative; height: 6px; margin: 10px 0 20px; }
.chars span { position: absolute; top: 0; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.chars span i { position: absolute; inset: 0 auto 0 0; background: var(--ok); }
.chars span.is-unsure i { background: var(--warn); }
.facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 4px 28px; margin: 0 0 12px; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font: 600 20px/1.2 var(--cond); }
.note { margin: 0 0 14px; color: var(--muted); max-width: 52ch; }
.note.is-warn { color: var(--warn); }
.crop { margin: 0 0 16px; }
.crop canvas { display: block; max-width: 100%; height: auto; border-radius: 3px; border: 1px solid var(--rule); background: var(--surface); }
.crop figcaption { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ------------------------------------------------------------------ measuring */
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-bottom: 10px; }
.readout div { display: flex; flex-direction: column; }
.readout__label { color: var(--muted); font-size: 15px; }
.readout__value { font: 700 clamp(44px, 5.4vw, 74px)/1 var(--cond); font-variant-numeric: tabular-nums; }
.warnings { list-style: none; margin: 0 0 14px; padding: 0; }
.warnings li { color: var(--warn); padding: 6px 0 6px 12px; border-left: 3px solid var(--warn); margin-bottom: 6px; }
.calib { border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 18px; }
.h2 { margin: 0; font: 600 21px/1.2 var(--cond); }
.small { margin: 4px 0 10px; color: var(--muted); font-size: 15px; }
.fields { display: grid; gap: 10px; margin-bottom: 12px; }
.fields--wide { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 820px; }
.fields label, .label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.fields input, .calibtext, .plate-input {
  font: 500 17px/1.2 var(--body); color: var(--asphalt); padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); width: 100%;
}
.fields input:focus-visible, .calibtext:focus-visible, .plate-input:focus-visible { outline: 3px solid var(--signal); outline-offset: 0; border-color: var(--asphalt); }
.calibtext { font: 400 13px/1.4 ui-monospace, monospace; margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------------ this truck */
.truck { border-top: 2px solid var(--asphalt); padding-top: 14px; margin-top: 26px; }
.truck__head, .log__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.summary { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px 44px; align-items: start; margin-bottom: 14px; }
.plate-input { font: 700 30px/1.1 var(--cond); letter-spacing: 0.05em; text-transform: uppercase; background: #15191c; color: #f3f4ef; border: 0; padding: 10px 14px; border-radius: 6px; }
.plate-input[data-colour="white"] { background: #f7f7f3; color: #15191c; box-shadow: inset 0 0 0 2px #15191c; }
.plate-input[data-colour="yellow"] { background: #f2c200; color: #15191c; }
.plate-input[data-colour="red"] { background: #c8252c; color: #fbfbf7; }
.plate-input[data-colour="green"] { background: #1f7a45; color: #fbfbf7; }
.plate-input::placeholder { color: #7d858d; letter-spacing: 0.02em; text-transform: none; font-weight: 600; font-size: 22px; }
.dims { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 4px 44px; margin: 0; }
.dims dt { color: var(--muted); font-size: 14px; }
.dims dd { margin: 0; font: 700 34px/1.1 var(--cond); font-variant-numeric: tabular-nums; }
.dims dd small { display: block; font: 400 14px/1.3 var(--body); color: var(--muted); }
.verdict { margin: 0 0 12px; font: 600 20px/1.3 var(--cond); min-height: 1.3em; }
.verdict.is-ok { color: var(--ok); } .verdict.is-flag { color: var(--warn); }
.specs { margin-top: 26px; }
.log { margin-top: 26px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); }
.table td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.table td:nth-child(2) { font: 700 18px/1 var(--cond); letter-spacing: 0.03em; white-space: nowrap; }
.table__empty td { color: var(--muted); font: inherit !important; }
.foot { max-width: 1280px; margin: 0 auto; padding: 0 24px 36px; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .panel-grid { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr; }
  .dims { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step { padding-right: 12px; margin-right: 10px; font-size: 19px; }
  .tool { padding: 9px 10px; font-size: 14px; }
  .table th:nth-child(6), .table td:nth-child(6) { display: none; }
}
