/* Forklift pre-shift check.
   Visual source: forklift safety yellow on black (ANSI Z535 caution yellow, the truck's own paint).
   Phone first: one column, 20px body, 64px tap targets. Red only for a real problem. */

:root {
  --yellow: #F5C400;
  --yellow-tint: #FFF6CC;
  --black: #1A1A1A;
  --ink: #1C1F22;
  --muted: #545B61;
  --paper: #F3F3F0;
  --white: #FFFFFF;
  --line: #B7BCBF;
  --green: #12703A;
  --green-tint: #E2F2E7;
  --red: #B3261E;
  --red-tint: #FBE9E7;
  --focus: #0B57D0;

  --font: "Atkinson Hyperlegible", "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", Arial, sans-serif;
  --step-0: 1.0625rem; /* 17px hints */
  --step-1: 1.25rem;   /* 20px body */
  --step-2: 1.5rem;    /* 24px */
  --step-3: 1.875rem;  /* 30px */
  --tap: 4rem;         /* 64px */
  --radius: 8px;
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); }
body { margin: 0; font-family: var(--font); font-size: var(--step-1); line-height: 1.45; color: var(--ink); background: var(--paper); overflow-wrap: break-word; }
h1, h2 { text-wrap: balance; }
img { max-inline-size: 100%; block-size: auto; display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; white-space: nowrap; }

/* ---------- header band: black with a yellow/black hazard edge */

.band { background: var(--black); color: var(--white); padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 0.5rem solid; border-image: repeating-linear-gradient(-45deg, var(--yellow) 0 14px, var(--black) 14px 28px) 8; }
.band-in { max-width: 36rem; margin: 0 auto; padding: 0.875rem 1rem 1rem; display: flex; gap: 0.75rem; align-items: flex-start; justify-content: space-between; }
.band-kicker { margin: 0; font-size: var(--step-0); color: var(--yellow); font-weight: 700; letter-spacing: 0.02em; }
.band h1 { margin: 0.125rem 0 0; font-size: var(--step-3); line-height: 1.15; }

.langs { display: flex; flex-shrink: 0; border: 2px solid var(--yellow); border-radius: var(--radius); overflow: hidden; }
.lang { font: inherit; font-size: var(--step-0); font-weight: 700; min-block-size: 2.75rem; min-inline-size: 2.75rem; padding: 0 0.625rem;
  border: 0; background: transparent; color: var(--yellow); cursor: pointer; }
.lang + .lang { border-inline-start: 2px solid var(--yellow); }
.lang[aria-pressed="true"] { background: var(--yellow); color: var(--black); }

/* ---------- layout */

.wrap { max-width: 36rem; margin: 0 auto; padding: 1rem 1rem calc(7rem + env(safe-area-inset-bottom, 0px)); }
.model { margin: 0 0 0.25rem; color: var(--muted); font-size: var(--step-0); }
.last { margin: 0 0 1rem; padding: 0.75rem 1rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); font-size: var(--step-0); }
.last-label { font-weight: 700; }
.res-ok { color: var(--green); font-weight: 700; }
.res-fail { color: var(--red); }
.hint { margin: 0.25rem 0 0.5rem; color: var(--muted); font-size: var(--step-0); text-wrap: pretty; }
.warn { margin: 0.5rem 0 0; color: var(--red); font-size: var(--step-0); font-weight: 700; }
.error { padding: 1rem; background: var(--red-tint); border-inline-start: 6px solid var(--red); border-radius: var(--radius); }

fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
legend { padding: 0; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.card > legend { float: left; width: 100%; font-weight: 700; font-size: var(--step-2); margin-bottom: 0.5rem; }
.card > legend + * { clear: both; }
.big-label { display: block; font-weight: 700; font-size: var(--step-2); }

/* ---------- operator picker */

.ops { display: grid; gap: 0.5rem; }
.op { display: flex; align-items: center; gap: 0.75rem; min-block-size: var(--tap); padding: 0 1rem; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 700; }
.op input { inline-size: 1.5rem; block-size: 1.5rem; accent-color: var(--black); margin: 0; flex-shrink: 0; }
.op:has(input:checked) { border-color: var(--black); background: var(--yellow-tint); }
.other { display: none; margin-top: 0.75rem; }
.card:has(input[value="__other"]:checked) .other { display: block; }

input:not([type]), input[inputmode], textarea {
  font: inherit; font-size: max(1rem, 1em); inline-size: 100%; min-block-size: 3.5rem; padding: 0.625rem 0.875rem;
  border: 2px solid #767676; border-radius: var(--radius); background: var(--white); color: var(--ink); }
#hours { font-size: var(--step-3); font-weight: 700; letter-spacing: 0.04em; }
textarea { min-block-size: 4.5rem; resize: vertical; }

/* ---------- checklist */

.group { margin: 1.5rem 0 0; }
.group > h2 { font-size: var(--step-2); margin: 0 0 0.5rem; padding-bottom: 0.25rem; border-bottom: 3px solid var(--black); }
.group-l2 { padding: 1rem; background: var(--yellow-tint); border: 2px solid var(--black); border-radius: var(--radius); }
.group-l2 > h2 { border-bottom: 0; padding: 0; }

.item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.875rem 1rem 1rem; margin: 0 0 0.625rem; }
.item > legend { float: left; width: 100%; font-weight: 700; text-wrap: pretty; }
.item > legend + * { clear: both; }
/* pictogram: inside the legend, left of the title; the hint lines up under the title */
.item.has-icon > legend { display: flex; gap: 0.875rem; align-items: center; }
.item .icon { inline-size: 6rem; block-size: 6rem; flex-shrink: 0; border-radius: 6px; }
.item.has-icon > .hint { padding-inline-start: 6.875rem; }
.item:has(input[value="ok"]:checked) { border-color: var(--green); }
.item:has(input[value="fail"]:checked) { border: 2px solid var(--red); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.625rem; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; min-block-size: var(--tap);
  border: 2px solid var(--line); border-radius: var(--radius); font-weight: 700; cursor: pointer; text-align: center; padding: 0 0.5rem; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg-ok:has(input:checked) { background: var(--green); border-color: var(--green); color: var(--white); }
.seg-ok:has(input:checked) span::before { content: "✓ "; }
.seg-fail:has(input:checked) { background: var(--red-tint); border-color: var(--red); color: var(--red); }
.seg-fail:has(input:checked) span::before { content: "✕ "; }

.failbox { display: none; margin-top: 0.75rem; }
.item:has(input[value="fail"]:checked) .failbox { display: block; }
.need { margin: 0.5rem 0; color: var(--red); font-weight: 700; font-size: var(--step-0); }
.preview { margin: 0.5rem 0; border-radius: var(--radius); max-block-size: 14rem; object-fit: cover; }
.note-label { display: block; margin: 0.5rem 0 0.25rem; font-size: var(--step-0); font-weight: 700; }

/* ---------- buttons */

.btn { font: inherit; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 0.5rem; text-decoration: none;
  min-block-size: var(--tap); inline-size: 100%; padding: 0 1rem; border-radius: var(--radius); cursor: pointer; border: 2px solid var(--black); }
.btn-primary { background: var(--black); color: var(--yellow); font-size: var(--step-2); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-secondary { background: var(--white); color: var(--black); }
.btn-photo { background: var(--white); color: var(--ink); position: relative; }
.btn-photo::before { content: ""; inline-size: 1.4rem; block-size: 1.1rem; border: 2px solid currentColor; border-radius: 4px;
  background: radial-gradient(circle, currentColor 0 3px, transparent 4px); }

.missing:not(:empty) { margin: 1.25rem 0 0; padding: 0.75rem 1rem; background: var(--red-tint); border-inline-start: 6px solid var(--red); border-radius: var(--radius); font-size: var(--step-0); }
.submit-bar { position: sticky; bottom: 0; margin: 1rem -1rem 0; padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent, var(--paper) 30%); }

/* ---------- truck picker */

.picker { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.btn-truck { flex-direction: column; align-items: flex-start; padding: 0.75rem 1rem; background: var(--white); color: var(--ink); min-block-size: 5rem; }
.truck-name { font-size: var(--step-2); }
.truck-model { font-weight: 400; color: var(--muted); font-size: var(--step-0); }

/* ---------- done */

.done { padding: 1.5rem 1rem; background: var(--green-tint); border-inline-start: 6px solid var(--green); border-radius: var(--radius); }
.done h2 { margin: 0 0 0.5rem; font-size: var(--step-3); }
.done p { margin: 0 0 1.25rem; }

/* ---------- stop dialog (only after a problem is reported) */

dialog { border: 4px solid var(--red); border-radius: var(--radius); padding: 1.5rem; max-inline-size: min(32rem, calc(100vw - 2rem)); color: var(--ink); }
dialog h2 { margin: 0 0 0.75rem; font-size: var(--step-3); color: var(--red); }
dialog p { margin: 0 0 1.25rem; font-size: var(--step-2); line-height: 1.4; }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgb(0 0 0 / 0.6); overflow: hidden; overscroll-behavior: contain; }

/* ---------- enrolled owner / not enrolled */
.me-card { display: flex; flex-direction: column; gap: 0.125rem; }
.me-label { margin: 0; color: var(--muted); font-size: var(--step-0); }
.me-name { margin: 0; font-size: var(--step-3); font-weight: 700; line-height: 1.2; }
.nf-title { margin: 0 0 0.5rem; font-size: var(--step-2); }
.card > p:last-child { margin-bottom: 0; }
