/* Design tokens, taken over from mockup/index.html. Dark mode follows the system setting. */
:root {
  --bg: #f3f5f8; --surface: #fff; --text: #13202c; --muted: #5a6b7b; --line: #e2e8ef;
  --accent: #1b63d6; --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b; --surface: #16202a; --text: #e8eef4; --muted: #93a3b3; --line: #27343f;
    --accent: #5b9bff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
h1 { margin: 0 0 8px; font-size: 1.5rem; letter-spacing: -.01em; }
.page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; max-width: 420px; width: 100%;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
p { margin: 0 0 8px; }

/* --- Layout, forms, buttons (M1). Tap targets are at least 44px high. --- */
:root { --danger: #c4281c; --on-danger: #fff; --ok: #1a7f4b; --on-accent: #fff; }
@media (prefers-color-scheme: dark) { :root { --danger: #ff8a80; --on-danger: #2a0a07; --ok: #5fd39a; --on-accent: #06182e; } }
a { color: var(--accent); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.top nav { display: flex; gap: 6px; flex-wrap: wrap; }
.top nav a { padding: 10px 12px; border-radius: 10px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.top nav a:hover { background: var(--bg); }
.wrap { max-width: 860px; margin: 0 auto; padding: 16px; }
.wrap.narrow { max-width: 460px; }
.wrap .card { max-width: none; margin-bottom: 14px; }
.card.flat { padding: 0; overflow-x: auto; }
h2 { margin: 0 0 10px; font-size: 1.1rem; }
.crumb { margin: 0 0 4px; font-size: .9rem; }
.field { margin: 0 0 14px; }
label { display: block; font-weight: 600; margin: 0 0 4px; }
input[type=text], input[type=email], input[type=search], input:not([type]) {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
input:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input.code { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.err { color: var(--danger); margin: 4px 0 0; font-size: .9rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px;
  font: inherit; font-weight: 600; color: var(--text); background: var(--surface); text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
a.btn { color: var(--text); }
.btn.primary, a.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 40px; padding: 6px 12px; font-weight: 500; }
form.again { margin-top: 10px; }
form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline input { flex: 1 1 200px; width: auto; }
form.search { display: flex; gap: 8px; margin: 0 0 14px; }
form.search input { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.check input { width: 22px; height: 22px; flex: none; }
.checks { margin-bottom: 8px; }
.msgs { margin-bottom: 12px; }
.msg { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.msg-error { border-color: var(--danger); }
.msg-success { border-color: var(--ok); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); }
.tag.on { color: var(--ok); border-color: var(--ok); }
.tag.off { color: var(--danger); border-color: var(--danger); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile {
  display: flex; align-items: center; min-height: 72px; padding: 16px; text-decoration: none; color: var(--text); font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; overflow-wrap: anywhere; }
.bigcode { font-size: 2rem; font-weight: 700; letter-spacing: .12em; text-align: center; margin: 12px 0; }
ul.plain { list-style: none; margin: 0 0 14px; padding: 0; }
ul.plain li { padding: 4px 0; }
.off { color: var(--muted); text-decoration: line-through; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- Fahrzeuge (M2): status colours are pairs of surface and text, contrast >= 4.5:1 --- */
:root {
  --s-gruen-bg: #e3f4ea; --s-gruen-fg: #0f5a31; --s-gelb-bg: #fdf1cf; --s-gelb-fg: #6b4a00;
  --s-grau-bg: #e7eaee; --s-grau-fg: #3d4853; --s-rot-bg: #fbe3e0; --s-rot-fg: #8f1d14;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s-gruen-bg: #123a26; --s-gruen-fg: #9be2bd; --s-gelb-bg: #3d3210; --s-gelb-fg: #f3d886;
    --s-grau-bg: #2a323a; --s-grau-fg: #c3ccd5; --s-rot-bg: #4a1c18; --s-rot-fg: #ffb4ab;
  }
}
select { width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
input[type=date], input[type=datetime-local], input[type=number] { width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.lbl { display: block; font-weight: 600; margin: 0 0 4px; }
.mono { font-family: ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; }
.fchip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); }
.fchip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.vcard { background: var(--surface); border: 1px solid var(--line); border-left-width: 6px; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.vcard.s-rot { border-left-color: var(--s-rot-fg); } .vcard.s-gelb { border-left-color: var(--s-gelb-fg); }
.vcard.s-grau { border-left-color: var(--s-grau-fg); } .vcard.s-gruen { border-left-color: var(--s-gruen-fg); }
.vlink { display: block; text-decoration: none; color: var(--text); min-height: 44px; }
.vname { display: block; font-weight: 700; font-size: 1.1rem; } .vsub { color: var(--muted); font-size: .9rem; }
.vchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.chip.s-gruen { background: var(--s-gruen-bg); color: var(--s-gruen-fg); } .chip.s-gelb { background: var(--s-gelb-bg); color: var(--s-gelb-fg); }
.chip.s-grau { background: var(--s-grau-bg); color: var(--s-grau-fg); } .chip.s-rot { background: var(--s-rot-bg); color: var(--s-rot-fg); }
.vgrund { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.empty { grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
details > summary { list-style: none; cursor: pointer; display: inline-flex; margin: 8px 0; }
details[open] > summary { margin-bottom: 12px; }
.qr { max-width: 220px; background: #fff; padding: 8px; border-radius: 10px; } .qr svg { width: 100%; height: auto; display: block; }
a.tilebox { display: flex; flex-direction: column; gap: 2px; padding: 14px; margin: 0 0 10px; text-decoration: none; color: var(--text); background: var(--s-gelb-bg); border-radius: 10px; min-height: 44px; }
a.tilebox strong { color: var(--s-gelb-fg); }

.card h2:not(:first-child) { margin-top: 18px; }
.vgrund { margin-bottom: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.facts { margin-top: 12px; }

.filters { display: block; }
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.top { flex-wrap: wrap; }
.top .kt { display: none; }
@media (max-width: 560px) {
  .top { padding: 6px 12px; }
  .top nav { gap: 0; }
  .top nav a { padding: 10px 10px; }
  .top .nm { display: none; }
  .top .kt { display: inline; }
}

:root { color-scheme: light dark; }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); }
.tag.off { text-decoration: none; }

/* --- Mängel (M3) --- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
textarea { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.stepper { display: flex; gap: 6px; list-style: none; margin: 10px 0; padding: 0; flex-wrap: wrap; }
.stepper li { flex: 1 1 90px; text-align: center; padding: 6px 8px; font-size: .85rem; border-radius: 8px; background: var(--s-grau-bg); color: var(--s-grau-fg); }
.stepper li.done { background: var(--s-gruen-bg); color: var(--s-gruen-fg); font-weight: 600; }
.stepper li.now { background: var(--s-gelb-bg); color: var(--s-gelb-fg); font-weight: 600; }
.aktionen .field { margin-bottom: 8px; }
.aktionen .actions { margin-top: 0; }

.check + .btn.block, .check + button.btn { margin-top: 12px; }
.card p.small a { display: inline-block; padding: 10px 0; }
