:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --text: #15181c;
  --muted: #5b6470;
  --border: #e0e3e8;
  --border-strong: #c7ccd4;
  --accent: #d9480f;
  --accent-hover: #bf3f0c;
  --accent-ink: #ffffff;
  --accent-soft: #fff0e8;
  --ok: #2b7a2f;
  --ok-soft: #e7f4e8;
  --warn: #875200;
  --warn-soft: #fff3d4;
  --info: #1d5bb8;
  --info-soft: #e7effc;
  --danger: #c22a2a;
  --danger-soft: #fdeaea;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --surface: #1a1d22;
    --surface-2: #23272d;
    --text: #e8ebee;
    --muted: #9aa3ad;
    --border: #2e333a;
    --border-strong: #434a53;
    --accent: #ff7a3d;
    --accent-hover: #ff8f5c;
    --accent-ink: #1a0d05;
    --accent-soft: #3a2014;
    --ok: #6fd27a;
    --ok-soft: #16301b;
    --warn: #ffc547;
    --warn-soft: #382c10;
    --info: #7aaaff;
    --info-soft: #172843;
    --danger: #ff8a8a;
    --danger-soft: #3b1a1a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: .25rem 0 1rem; }
h2 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf und Navigation */
.chrome { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px 6px; max-width: 960px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 800; letter-spacing: .5px; flex: none; }
.who { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 4px 16px 8px; overflow-x: auto; scrollbar-width: none; max-width: 960px; margin: 0 auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; border: 0; background: transparent; padding: 8px 12px; border-radius: 999px; font: inherit; font-size: 15px; color: var(--muted); cursor: pointer; min-height: 40px; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.count { margin-left: 6px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 700; line-height: 20px; }
.main { max-width: 960px; margin: 0 auto; padding: 16px 16px 40px; }
.proto { text-align: center; font-size: 12px; color: var(--muted); padding: 0 16px 28px; }

/* Karten und Layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-ok { border-color: var(--ok); }
.card-warn { border-color: var(--warn); }
.card-danger { border-color: var(--danger); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 12px; }
.grid-hsn { grid-template-columns: 1fr 1fr; max-width: 380px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline select { flex: 1 1 220px; width: auto; }
.vehicle-card h1 { margin: 0 0 4px; font-size: 1.3rem; }
.vehicle-card p:last-child { margin: 0; }

/* Formulare */
.field { display: block; margin: 0 0 12px; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; font-weight: 500; padding: 0; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); margin: 2px 0 0; flex: none; }
.upper { text-transform: uppercase; }
.upper::placeholder { text-transform: none; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; margin-bottom: 12px; cursor: pointer; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; flex: 1 1 160px; min-height: 44px; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 8px; }
.error:empty { display: none; }
.error-inline { color: var(--danger); }
.hint { font-size: 14px; color: var(--muted); margin: -4px 0 12px; }
.hint-top { margin: 10px 0 0; }
.hint:empty { display: none; }
.ok { color: var(--ok); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; font-size: 17px; min-height: 52px; margin-bottom: 12px; }

/* Ergebnis */
.label { font-size: 14px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.sublabel { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.quote { font-size: 15px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.code-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-weight: 600; margin-bottom: 4px; }
.code-en { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.block { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.block-head .label { margin: 0; }
.bar-row { margin-bottom: 10px; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-block; font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip-btn { font: inherit; font-size: 14px; color: var(--text); cursor: pointer; min-height: 36px; padding: 6px 14px; }
.chip-btn:hover { border-color: var(--accent); }
.chip-aktiv { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.motor-auswahl:empty { display: none; }
.code-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.code-preview:empty { display: none; }
.code-neu { flex: 1 1 100%; display: block; font-size: 14px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.code-neu > span { display: block; color: var(--muted); margin-bottom: 6px; }
.code-neu > span b { color: var(--text); }
.checklist { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: schritt; }
.checklist li { counter-increment: schritt; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.checklist label span::before { content: counter(schritt) ". "; font-weight: 700; color: var(--muted); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.empty-inline { color: var(--muted); background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); font-size: 15px; margin-top: 12px; }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; }
ul.plain li { padding: 8px 0; border-bottom: 1px solid var(--border); }
ul.plain li:last-child { border-bottom: 0; }

/* KI */
.ki-box { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.ki-card { border: 1px solid var(--info); background: var(--info-soft); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.ki-card h2 { margin: 0; }
.ki-card .chip { background: var(--surface); }
.ki-card .banner { background: var(--surface); }
.steps { margin: 0 0 12px; padding-left: 22px; }
.steps li { padding: 3px 0; }
.btn:disabled { opacity: .6; cursor: progress; }

/* Status */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill-open { background: var(--info-soft); color: var(--info); }
.pill-done { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-info { background: var(--accent-soft); color: var(--accent); }
.banner { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 15px; }
.banner p { margin: 6px 0 0; }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.banner-info { background: var(--info-soft); color: var(--info); }
.banner-danger { background: var(--danger-soft); color: var(--danger); }

/* Listen */
.list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card .list { border-radius: var(--radius-sm); }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--border); background: transparent; color: inherit; font: inherit;
  text-align: left; cursor: pointer; min-height: 56px;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row-static { cursor: default; }
.row-static:hover { background: transparent; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main > * { overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.segmented { display: inline-flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 10px; margin-bottom: 12px; max-width: 100%; overflow-x: auto; }
.seg-btn { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; min-height: 36px; }
.seg-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.kv:last-child { border-bottom: 0; }

/* Übersicht */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); cursor: pointer; font: inherit; color: inherit; text-align: left; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--border-strong); }
.tile-n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tile-l { font-size: 14px; color: var(--muted); }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 540px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.brand-lg { font-size: 1.3rem; margin-bottom: 12px; }
.brand-lg .logo { width: 40px; height: 40px; font-size: 15px; }
.login h2 { font-size: 14px; color: var(--muted); margin: 20px 0 8px; font-weight: 600; }
.login .hint { margin: 20px 0 0; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm); font: inherit; color: inherit; cursor: pointer; min-height: 52px; text-align: left; }
.user-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }

/* Hinweise */
#toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: 15px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Rechtstexte */
.recht { max-width: 760px; line-height: 1.6; }
.recht h1 { margin-top: 1.5rem; }
.recht h2 { margin-top: 1.25rem; }
.recht ul { padding-left: 20px; }
.recht li { margin-bottom: 6px; }
.recht hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Online-Version */
a { color: var(--accent); }
.proto a { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
textarea.mono { font-size: 13px; }
.laden { min-height: 60vh; display: grid; place-items: center; }
.laden .logo { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }
.foto-knopf { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.filterzeile { display: flex; flex-wrap: wrap; gap: 8px; }
.login-card .page-head { margin-bottom: 4px; }
.login-card h1 { font-size: 1.2rem; }
.check span a { white-space: nowrap; }
.nutzer-row { align-items: flex-start; }
.nutzer-aktionen { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 55%; }
.nutzer-aktionen select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }
.ki-card ol.steps { margin-bottom: 8px; }

@media (max-width: 560px) {
  .nutzer-row { flex-direction: column; }
  .nutzer-aktionen { max-width: 100%; justify-content: flex-start; }
  .who > span { display: none; }
  h1 { font-size: 1.3rem; }
  .card { padding: 14px; }
}
