:root {
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --line: #e4e7ec;
  --text: #0e1726;
  --muted: #667085;
  --ink: #344054;
  --ink-soft: #98a2b3;
  --body: #eceff3;
  --body-2: #dfe3e9;
  --seat: #c9cfd8;
  --tyre: #d5dae1;
  --glass: rgba(120, 160, 210, .28);
  --light: #fff6d6;
  --accent: #2f6fdf;
  --ok: #12a150;
  --warn: #e08a00;
  --bad: #e0372f;
  --unknown: #98a2b3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .05);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0c0f;
    --surface: #13161b;
    --surface-2: #1a1e25;
    --line: #252a33;
    --text: #e9edf3;
    --muted: #8b95a5;
    --ink: #c7d0dc;
    --ink-soft: #566070;
    --body: #1a1f27;
    --body-2: #222833;
    --seat: #0c0e12;
    --tyre: #2a3038;
    --glass: rgba(120, 170, 230, .16);
    --light: #3b3622;
    --ok: #2fd27a;
    --warn: #ffad33;
    --bad: #ff5a4f;
    --unknown: #5f6a7a;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(84px + var(--safe-b)); }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
}
.brandrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.appname { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 99px; }
.sync svg { width: 16px; height: 16px; }
.sync[data-s="idle"] { color: var(--ok); }
.sync[data-s="error"] { color: var(--bad); }
.sync[data-s="syncing"] svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.switcher { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.switcher button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 8px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.switcher button small { font-weight: 500; opacity: .7; }
.switcher button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.switcher .dot { width: 8px; height: 8px; }

/* ---------- layout ---------- */
main { padding: 6px 16px 80px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.sec { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 10px 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.sec span { text-transform: none; letter-spacing: 0; font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

/* ---------- hero ---------- */
.hero { display: flex; gap: 18px; align-items: center; padding: 18px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring .val { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .num b { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.ring .num span { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .06em; }
.hero-meta { min-width: 0; flex: 1; }
.eyebrow { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.hero h1 { font-size: 22px; letter-spacing: -.02em; margin: 1px 0 6px; }
.odo { display: flex; align-items: baseline; gap: 5px; }
.odo b { font-size: 26px; letter-spacing: -.02em; }
.odo span { color: var(--muted); font-size: 14px; }
.status-label { font-weight: 600; font-size: 13px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; margin-top: 10px; }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.fab {
  position: fixed; right: max(16px, calc(50vw - 264px)); bottom: calc(86px + var(--safe-b)); z-index: 15;
  width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent);
}
.fab svg { width: 26px; height: 26px; }

/* ---------- motorfoto met aanklikbare onderdelen ---------- */
.bike-card { padding: 0; overflow: hidden; position: relative; }
.photo { position: relative; line-height: 0; }
.photo svg { display: block; width: 100%; height: auto; }
@media (prefers-color-scheme: dark) { .photo { margin: 8px 8px 0; border-radius: 14px; overflow: hidden; } }

[data-st] { --c: var(--unknown); }
[data-st="ok"] { --c: var(--ok); }
[data-st="warn"] { --c: var(--warn); }
[data-st="bad"] { --c: var(--bad); }

.pin { cursor: pointer; }
.pin-hit { fill: transparent; }
.pin-dot { fill: var(--c); stroke: #fff; stroke-width: 7; filter: drop-shadow(0 3px 6px rgba(0,0,0,.55)); transition: r .2s; }
.pin[data-st="unknown"] .pin-dot { fill: #8d96a2; }
.pin-pulse { fill: var(--c); transform-box: fill-box; transform-origin: center; animation: pinp 2s ease-out infinite; }
@keyframes pinp { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
.pin.sel .pin-dot { stroke-width: 9; }
.photo.has-sel .pin:not(.sel) { opacity: .35; }

.dim { fill: rgba(255, 255, 255, .62); animation: fadein .25s ease; }
.hl > * { fill: none; stroke: var(--c); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linejoin: round; filter: drop-shadow(0 0 4px var(--c)); animation: fadein .25s ease; }
.hl[data-st="unknown"] > * { stroke: var(--accent); filter: drop-shadow(0 0 4px var(--accent)); }
.hl.hidden > * { stroke-dasharray: 7 5; }
@keyframes fadein { from { opacity: 0; } }

.credit { display: block; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 7px 14px 0; }
.bike-foot { padding: 8px 12px 12px; }
.hint { position: absolute; z-index: 2; top: 10px; left: 10px; font-size: 12px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 6px;
  background: rgba(10, 12, 16, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 5px 10px; border-radius: 99px; line-height: 1.2; pointer-events: none; }
.hint svg { width: 14px; height: 14px; }
.legend { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
/* ---------- status bits ---------- */
.dot { width: 10px; height: 10px; border-radius: 99px; background: var(--unknown); flex: none; }
.st-ok { background: var(--ok); } .st-warn { background: var(--warn); } .st-bad { background: var(--bad); } .st-unknown { background: var(--unknown); }
.tx-ok { color: var(--ok); } .tx-warn { color: var(--warn); } .tx-bad { color: var(--bad); } .tx-unknown { color: var(--muted); }
.bar { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---------- list rows ---------- */
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; text-align: left; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; font-size: 15px; }
.row-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { width: 104px; flex: none; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.row-val { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.row-end .bar { width: 100%; }
.chev { width: 16px; height: 16px; color: var(--ink-soft); flex: none; }

.notice { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.notice svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.notice .btn { margin-left: auto; flex: none; }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.backdrop { position: absolute; inset: 0; background: rgba(5, 8, 12, .45); animation: fade .2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + var(--safe-b));
  animation: up .28s cubic-bezier(.2,.9,.25,1);
}
.sheet-wrap.compact .backdrop { background: rgba(5, 8, 12, .12); }
.sheet-wrap.compact .sheet { box-shadow: 0 -10px 30px rgba(0, 0, 0, .18); }
.grab { width: 38px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet h2 { font-size: 21px; letter-spacing: -.02em; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head p { margin-top: 2px; }
.x { width: 32px; height: 32px; border-radius: 99px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.x svg { width: 16px; height: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.stat { padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-label { font-weight: 600; }
.stat-big { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 8px 0 2px; }
.stat-big small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat .bar { margin: 10px 0 12px; height: 8px; background: var(--surface); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, currentColor 12%, transparent); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; min-height: 46px;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qs-row { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.qs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.qs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qs-grid.three { grid-template-columns: 1fr 1.15fr 1fr; }
.qs-grid .field > span { font-size: 11.5px; }
.qs-grid .field input { background: var(--surface); padding: 10px; min-height: 42px; font-size: 16px; }
a.btn { text-decoration: none; color: inherit; }
.seg { display: flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.checks { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.checks h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px 6px; background: var(--surface-2); }
.check { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.check span { flex: 1; }
.check small { color: var(--muted); }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.err { color: var(--bad); font-size: 13px; }
details.help { font-size: 13.5px; color: var(--muted); }
details.help summary { cursor: pointer; font-weight: 600; color: var(--text); }
details.help ol { padding-left: 18px; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- logbook ---------- */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats3 > div { padding: 14px 12px; text-align: center; border-left: 1px solid var(--line); }
.stats3 > div:first-child { border-left: 0; }
.stats3 b { display: block; font-size: 19px; letter-spacing: -.02em; }
.stats3 span { font-size: 11.5px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; }
.toolbar .seg { flex: 1; }
.year { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; letter-spacing: -.02em; margin: 14px 4px 8px; }
.year span { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.tl { position: relative; display: flex; flex-direction: column; gap: 10px; }
.tl-item { display: flex; gap: 12px; text-align: left; width: 100%; padding: 14px; }
.tl-date { width: 44px; flex: none; text-align: center; padding-top: 1px; }
.tl-date b { display: block; font-size: 20px; line-height: 1; letter-spacing: -.02em; }
.tl-date span { font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.tl-body { flex: 1; min-width: 0; border-left: 2px solid var(--line); padding-left: 12px; }
.tl-item.k-service .tl-body { border-left-color: var(--accent); }
.tl-item.k-inspect .tl-body { border-left-color: var(--warn); }
.tl-title { font-weight: 600; }
.tl-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.tl-notes { font-size: 13.5px; margin-top: 6px; white-space: pre-wrap; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.tl-km { padding: 8px 14px; font-size: 13px; color: var(--muted); display: flex; gap: 12px; }
.tl-km .tl-date { font-size: 12px; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

/* ---------- RDW ---------- */
.plate-big {
  display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden; border: 2px solid #111; background: #f5c400; color: #111;
  font: 700 26px/1 "Kenteken", "DIN Alternate", "Arial Narrow", Arial, sans-serif; letter-spacing: .06em; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.plate-big .eu { background: #003399; color: #fff; font-size: 11px; width: 26px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 5px; letter-spacing: 0; }
.plate-big .eu i { font-style: normal; color: #ffcc00; font-size: 9px; margin-bottom: auto; margin-top: 5px; letter-spacing: 1px; }
.plate-big .txt { padding: 10px 14px; }
.rdw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rdw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.rdw-grid div { background: var(--surface); padding: 10px 12px; }
.rdw-grid dt { font-size: 11.5px; color: var(--muted); }
.rdw-grid dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); max-width: 560px; margin: 0 auto;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: fade .2s; max-width: calc(100% - 32px);
}

.source { font-size: 12px; color: var(--muted); text-align: center; padding: 0 12px; }

/* ---------- print ---------- */
.print { display: none; }
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff !important; color: #000 !important; font-size: 10.5pt; }
  #app, #sheet, #toast { display: none !important; }
  .print { display: block; color: #000; }
  .p-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
  .p-head h1 { font-size: 20pt; letter-spacing: -.01em; }
  .p-head .sub { font-size: 10pt; color: #333; }
  .p-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 16px; margin-bottom: 16px; font-size: 9.5pt; }
  .p-meta dt { color: #555; font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; }
  .p-meta dd { margin: 0; font-weight: 600; }
  .print h2 { font-size: 12pt; margin: 18px 0 6px; }
  .print table { width: 100%; border-collapse: collapse; }
  .print th { text-align: left; font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #444; border-bottom: 1.5px solid #000; padding: 5px 6px; }
  .print td { border-bottom: .5pt solid #bbb; padding: 6px; vertical-align: top; }
  .print tr { break-inside: avoid; }
  .print .num { text-align: right; white-space: nowrap; }
  .print .stamp { width: 26mm; }
  .print .note { color: #444; font-size: 9pt; }
  .p-foot { margin-top: 14px; font-size: 8.5pt; color: #555; display: flex; justify-content: space-between; }
}
