/* WeFix Bandenvoorraad — mobiel-first, zelfde donkere/amber-tokens als de WeFix-site. */
:root {
  --bg: #0a0b0d;
  --surface: #111317;
  --surface-2: #171a1f;
  --text: #f6f3ea;
  --muted: #a9abb1;
  --line: rgb(255 255 255 / 0.1);
  --line-strong: rgb(255 255 255 / 0.2);
  --amber: #fcb017;
  --amber-bright: #ffc341;
  --amber-ink: #130d00;
  --danger: #ff9f8c;
  --ok: #8ee0a1;
  --warn: #ffd37a;
  --radius: 4px;
  --font: 'Archivo Variable', 'Archivo', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --tab-h: 64px;
  --touch: 44px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { margin: 0 0 8px; line-height: 1.15; }
h1 { font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; }
h2 { font-size: 20px; }
h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.hidden { display: none !important; }

header.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
header.top .brand { display: flex; align-items: center; gap: 10px; }
header.top .brand i { width: 10px; height: 10px; background: var(--amber); display: inline-block; }
header.top .actor { font-size: 12px; color: var(--muted); max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.banner {
  background: rgb(252 176 23 / 0.12); border-bottom: 1px solid rgb(252 176 23 / 0.35);
  color: var(--warn); font-size: 13px; padding: 8px 16px;
}

main { padding: 16px; max-width: 720px; margin: 0 auto; }
section.view { display: none; }
section.view.active { display: block; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.card.result { border-color: var(--line-strong); }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea, button {
  font: inherit; color: inherit;
}
input[type="text"], input[type="search"], input[type="number"], input[type="tel"], input[type="email"], select, textarea {
  width: 100%; min-height: var(--touch); padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  font-size: 16px; /* voorkomt iOS-zoom */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--amber); outline-offset: 0; border-color: transparent; }
textarea { min-height: 72px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row.two { grid-template-columns: 1fr 1fr; }
.row.four { grid-template-columns: repeat(4, 1fr); }
.row > div > label { margin-top: 0; }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.checks label { display: flex; align-items: center; gap: 8px; min-height: var(--touch); margin: 0; color: var(--text); font-size: 14px; }
.checks input { width: 20px; height: 20px; accent-color: var(--amber); }

button {
  min-height: var(--touch); padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; font-weight: 600;
}
button.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
button.primary:active { background: var(--amber-bright); }
button.ghost { background: transparent; }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.full { width: 100%; margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions button { flex: 1 1 auto; }

.photo-input { position: relative; display: block; }
.photo-input input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.photo-input .btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }

/* Status van de maatherkenning (OCR) onder de foto's: bezig / herkend / niet herkend / niet beschikbaar / handmatig. */
.scan-status {
  margin-top: 8px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface-2); border-left: 4px solid var(--line-strong); font-size: 14px; line-height: 1.4;
}
.scan-status.bezig { border-left-color: var(--amber); }
.scan-status.herkend { border-left-color: var(--ok); }
.scan-status.niet-herkend { border-left-color: var(--warn); }
.scan-status.nvt, .scan-status.handmatig { color: var(--muted); }
select.autofill { outline: 2px solid var(--ok); outline-offset: 0; border-color: transparent; }

.grade {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--radius);
  font-weight: 800; font-size: 18px; letter-spacing: 0.02em;
}
.grade.A { background: #2f7a45; color: #e9ffe9; }
.grade.B { background: #b4851a; color: #1b1300; }
.grade.C { background: #7a5a2f; color: #fff2dd; }
.grade.afkeur { background: #7a2f2f; color: #ffe1e1; font-size: 13px; }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); }
.badge.beschikbaar { color: var(--ok); border-color: var(--ok); }
.badge.gereserveerd { color: var(--warn); border-color: var(--warn); }
.badge.verkocht { color: var(--muted); }
.badge.afgekeurd { color: var(--danger); border-color: var(--danger); }

.preview { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); margin-top: 12px; }
.preview .txt { font-size: 13px; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 8px; }
.tyre { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.tyre .title { font-weight: 700; font-size: 17px; }
.tyre .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 12px; }

.label-wrap { background: #fff; border-radius: var(--radius); padding: 8px; margin-top: 10px; }
.label-wrap img, .label-wrap svg { width: 100%; height: auto; display: block; }

/* Intake: veld "Aantal banden" + batchresultaat (meerdere banden en labels na één intake). */
.aantal-row { align-items: end; }
.aantal-uitleg { font-size: 13px; padding-bottom: 10px; }
.aantal-uitleg.batch { color: var(--warn); }
.aantal-regel { font-size: 13px; margin-top: 6px; }
.aantal-regel b { color: var(--text); }
.labels-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.labels-grid a { display: block; background: #fff; border-radius: var(--radius); padding: 6px; }
.labels-grid img { width: 100%; height: auto; display: block; }
.labels-grid .label-code { display: block; text-align: center; font-size: 12px; color: #000; padding-top: 4px; font-weight: 700; }
@media print {
  .labels-grid { grid-template-columns: 1fr; gap: 0; }
  .labels-grid a { padding: 0; page-break-inside: avoid; break-inside: avoid; page-break-after: always; break-after: page; }
  .labels-grid a:last-child { page-break-after: auto; break-after: auto; }
  /* "Alle labels printen": tijdens het printen enkel de labels, niet het formulier of de rest van het resultaat. */
  body.print-labels #intake-form, body.print-labels #intake-result > :not(.labels-grid) { display: none !important; }
  body.print-labels #intake-result { border: 0; padding: 0; margin: 0; background: #fff; }
}

.quote-lines { border-top: 1px solid var(--line); margin-top: 8px; }
.quote-line { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.quote-line .oms { overflow: hidden; }
.quote-line .remove { min-height: var(--touch); min-width: var(--touch); padding: 4px 10px; }
.quote-line.sub { padding-left: 16px; }          /* montage per band, direct onder zijn bandregel */
.quote-line.ro { grid-template-columns: 1fr auto; } /* opgeslagen offerte: zonder verwijderknop */
button.link { min-height: 0; padding: 2px 4px; border: 0; background: none; color: var(--amber); font-size: 13px; text-decoration: underline; }

/* Offerte: identieke banden als één groep met een aantal; montage per band aan/uit. */
.check-inline { display: flex; align-items: center; gap: 8px; min-height: var(--touch); margin: 10px 0 0; color: var(--text); font-size: 14px; }
.check-inline input { width: 20px; height: 20px; accent-color: var(--amber); }
.groep-keuze { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.stepper { display: inline-flex; }
.stepper button { min-width: var(--touch); padding: 0 10px; font-size: 20px; line-height: 1; }
.stepper button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.stepper button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.stepper input[type="number"] { width: 64px; text-align: center; border-radius: 0; border-left: 0; border-right: 0; }

/* Intake: merk kiezen uit de catalogus (combobox), met "Handmatig toevoegen" altijd onderaan. */
.merk-keuze { position: relative; }
.merk-lijst {
  position: absolute; left: 0; right: 0; z-index: 6; margin: 4px 0 0; padding: 4px 0; list-style: none;
  max-height: min(50vh, 320px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}
.merk-lijst li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--touch); padding: 8px 12px; cursor: pointer; }
.merk-lijst li .klasse { font-size: 12px; color: var(--muted); }
.merk-lijst li.actief, .merk-lijst li:hover { background: rgb(252 176 23 / 0.12); }
.merk-lijst li.handmatig { color: var(--amber); font-weight: 600; border-top: 1px solid var(--line); }
.merk-lijst li.handmatig.ongeldig { color: var(--muted); font-weight: 400; }
.merk-hint { font-size: 13px; margin-top: 4px; }
.merk-hint:empty { display: none; }
.merk-hint.bekend { color: var(--ok); }
.merk-hint.nieuw { color: var(--warn); }
.merk-hint.fout { color: var(--danger); }
.totals { margin-top: 10px; font-size: 15px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line-strong); margin-top: 4px; padding-top: 8px; }
pre.quote-text { white-space: pre-wrap; background: var(--surface-2); padding: 12px; border-radius: var(--radius); font-size: 13px; }

.error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.field-error { border-color: var(--danger) !important; }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
nav.tabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; }
nav.tabs button span.ico { font-size: 20px; }
nav.tabs button.active { color: var(--amber); box-shadow: inset 0 3px 0 var(--amber); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); z-index: 9;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-left: 4px solid var(--amber);
  padding: 12px 14px; border-radius: var(--radius); font-size: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.5);
}
.toast.err { border-left-color: var(--danger); }

@media print {
  body { background: #fff; color: #000; padding: 0; }
  header.top, nav.tabs, .banner, .no-print { display: none !important; }
  .label-wrap { padding: 0; }
}

/* ---------- login, rollen, beheer, contact ---------- */
body.uitgelogd main, body.uitgelogd nav.tabs, body.uitgelogd .banner, body.uitgelogd footer.contact:not(.op-login) { display: none; }
section.login { padding: 24px 16px; max-width: 480px; margin: 0 auto; }
.kleine-knop { padding: 4px 10px; min-height: 0; font-size: 12px; }
header.top .actor { display: flex; gap: 8px; align-items: center; }
nav.tabs { grid-template-columns: repeat(var(--tabs, 3), 1fr); }
footer.contact { padding: 12px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
footer.contact.op-login { padding-bottom: 24px; justify-content: center; }
footer.contact a { color: var(--amber); text-decoration: none; border: 1px solid var(--line-strong); padding: 6px 10px; border-radius: var(--radius); }
.beheer-rij { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.beheer-rij .acties { display: flex; gap: 8px; flex-wrap: wrap; }
.beheer-rij input { max-width: 260px; }
table.rapport { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rapport td, table.rapport th { text-align: left; padding: 4px 8px 4px 0; border-top: 1px solid var(--line); }
