/* Teilelager – Werkstatt-Stil: verzinktes Regal, Lagerplatz-Etiketten in Zinkgelb */
:root {
  --steel: #E6EAEE;
  --surface: #FFFFFF;
  --ink: #1B242C;
  --ink-soft: #56626D;
  --line: #CDD4DA;
  --label: #FFCF1A;
  --label-ink: #1B242C;
  --low: #C2362B;
  --low-bg: #FBE9E7;
  --ok: #2F7D4F;
  --focus: #1E63C6;
  --scan: #1B242C;
  --scan-ink: #FFFFFF;
  --radius-s: 4px;
  --radius-m: 10px;
  --tap: 52px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --steel: #161D23;
    --surface: #1F2830;
    --ink: #E8EDF1;
    --ink-soft: #9AA7B2;
    --line: #34414C;
    --low: #FF7A6B;
    --low-bg: #3A2522;
    --ok: #6BCB8F;
    --focus: #7FB0FF;
    --scan: #FFCF1A;
    --scan-ink: #1B242C;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font: 400 16px/1.45 var(--font);
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code { font-size: .9em; background: var(--surface); padding: 1px 4px; border-radius: 3px; }

.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--ink-soft); }
.view { max-width: 720px; margin: 0 auto; min-height: 100dvh; }
.view-center { display: grid; place-items: center; padding: 24px 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  border: 0; border-radius: var(--radius-m);
  font-weight: 600; font-size: 17px; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--steel); }
.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-wide { width: 100%; }
.btn-danger-text { background: none; color: var(--low); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: none; cursor: pointer; color: var(--ink);
}
.icon-btn-dark { background: rgba(0,0,0,.55); color: #fff; }
.icon-btn-dark[aria-pressed="true"] { background: var(--label); color: var(--label-ink); }
.link-btn { font-weight: 600; text-decoration: none; padding: 10px 4px; color: var(--focus); }

/* Login */
.login { max-width: 380px; text-align: center; }
.login h1 { font: 700 34px/1.1 var(--font-cond); margin: 16px 0 8px; }
.login p { color: var(--ink-soft); margin: 0 0 24px; }
.login img { border-radius: 16px; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--steel);
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
}
.topbar-row { display: flex; align-items: center; gap: 8px; }
.brand { font: 700 26px/1 var(--font-cond); flex: 1; }
.sync { font-size: 13px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sync[data-state="pending"]::before { background: var(--label); }
.sync[data-state="offline"]::before { background: var(--ink-soft); }
.search {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  background: var(--surface); border-radius: var(--radius-m); padding: 0 14px;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.search:focus-within { box-shadow: inset 0 0 0 2px var(--focus); }
.search svg { color: var(--ink-soft); }
.search input { flex: 1; border: 0; background: none; min-height: 48px; outline: none; min-width: 0; }
.filters { display: flex; gap: 8px; margin-top: 10px; }
.chip {
  border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer;
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 500; font-size: 15px;
}
.chip span { font-variant-numeric: tabular-nums; color: var(--ink-soft); margin-left: 2px; }
.chip[aria-selected="true"] { background: var(--ink); color: var(--steel); box-shadow: none; }
.chip[aria-selected="true"] span { color: inherit; opacity: .75; }
.chip-low span { color: var(--low); font-weight: 700; }

.menu {
  position: fixed; top: 60px; right: 12px; z-index: 20; width: min(300px, calc(100vw - 24px));
  background: var(--surface); border-radius: var(--radius-m); padding: 14px;
  box-shadow: 0 8px 30px rgba(15, 25, 35, .22), inset 0 0 0 1px var(--line);
}
.menu p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; word-break: break-all; }

/* Teileliste */
.part-list { list-style: none; margin: 0; padding: 0 0 calc(110px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.part-list li + li { border-top: 1px solid var(--line); }
.part {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px;
  padding: 12px 16px; text-decoration: none; position: relative;
}
.part:active { background: var(--steel); }
.part[data-low="true"]::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 3px 3px 0; background: var(--low);
}
.part-name { font-weight: 600; font-size: 17px; line-height: 1.25; }
.part-meta { font-size: 14px; color: var(--ink-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-main { min-width: 0; }
.qty { text-align: right; min-width: 52px; }
.qty b { display: block; font: 700 28px/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.qty small { font-size: 12px; color: var(--ink-soft); }
.part[data-low="true"] .qty b { color: var(--low); }

/* Lagerplatz-Etikett: das wiedererkennbare Element */
.bin {
  display: inline-flex; align-items: center;
  background: var(--label); color: var(--label-ink);
  font: 700 16px/1 var(--font-cond); letter-spacing: .02em; font-variant-numeric: tabular-nums;
  padding: 6px 8px 5px; border-radius: var(--radius-s);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
  white-space: nowrap;
}
.bin-none { background: transparent; color: var(--ink-soft); box-shadow: none; border: 1.5px dashed var(--line); padding: 4px 7px 3px; font-weight: 500; }
.bin-large { font-size: 24px; padding: 8px 12px 7px; }

.empty { padding: 48px 24px 140px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

/* Aktionsleiste */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  max-width: 720px; margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--steel) 70%, transparent);
}
.btn-scan { background: var(--scan); color: var(--scan-ink); min-height: 60px; font-size: 19px; }
.btn-scan svg { width: 26px; height: 26px; }
.actionbar .btn-secondary { min-height: 60px; }

/* Subbar */
.subbar {
  position: sticky; top: 0; z-index: 5; background: var(--steel);
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
}
.subbar-title { font: 600 18px/1 var(--font-cond); color: var(--ink-soft); }

/* Detail */
.detail { padding: 4px 16px calc(32px + env(safe-area-inset-bottom)); }
.detail-head h2 { font: 700 30px/1.1 var(--font-cond); margin: 8px 0 6px; }
.detail-head .part-meta { white-space: normal; font-size: 15px; }
.detail-head .bin { margin-top: 12px; }
.stock {
  margin: 20px 0 0; padding: 18px 16px; background: var(--surface); border-radius: var(--radius-m);
  box-shadow: inset 0 0 0 1px var(--line);
}
.stock-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stock-num { font: 700 72px/0.9 var(--font-cond); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stock-unit { font-size: 18px; color: var(--ink-soft); }
.stock-min { margin-top: 8px; color: var(--ink-soft); }
.stock[data-low="true"] .stock-num { color: var(--low); }
.stock[data-low="true"] .stock-min { color: var(--low); font-weight: 600; }

.booking { margin-top: 14px; display: grid; gap: 10px; }
.stepper { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); gap: 8px; }
.stepper button { min-height: var(--tap); border: 0; border-radius: var(--radius-m); background: var(--steel); font-size: 28px; font-weight: 600; cursor: pointer; }
.stepper input {
  text-align: center; min-height: var(--tap); border: 0; border-radius: var(--radius-m);
  background: var(--steel); font: 700 28px/1 var(--font-cond); font-variant-numeric: tabular-nums; width: 100%;
}
.booking-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-in { background: var(--ok); color: #fff; }
.btn-out { background: var(--ink); color: var(--steel); }
.note-input { min-height: 46px; border: 0; border-radius: var(--radius-m); background: var(--steel); padding: 0 12px; width: 100%; }

.inventory-count { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.inventory-count p { margin: 0 0 8px; font-size: 14px; color: var(--ink-soft); }
.inventory-count .field-row input {
  min-width: 0; width: 100%; min-height: var(--tap); border: 0; border-radius: var(--radius-m); background: var(--steel);
  font: 700 22px/1 var(--font-cond); text-align: center; font-variant-numeric: tabular-nums;
}
.field-row > input { min-width: 0; }

.facts { margin: 22px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.history { margin-top: 28px; }
.history h3 { font: 700 20px/1 var(--font-cond); margin-bottom: 8px; }
.history ol { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-m); box-shadow: inset 0 0 0 1px var(--line); }
.history li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 14px; }
.history li + li { border-top: 1px solid var(--line); }
.history .h-type { font-weight: 600; }
.history .h-meta { grid-column: 1; font-size: 13px; color: var(--ink-soft); }
.history .h-delta { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 700 22px/1 var(--font-cond); font-variant-numeric: tabular-nums; }
.history .h-delta.plus { color: var(--ok); }
.history .h-empty { color: var(--ink-soft); padding: 14px; }

/* Formular */
.form { padding: 4px 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > label { font-weight: 600; font-size: 15px; }
.field input {
  min-height: 50px; border: 0; border-radius: var(--radius-m); padding: 0 14px; width: 100%;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
}
.field input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.field input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--low); }
.field-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { margin: 0; font-size: 14px; color: var(--ink-soft); }
.form-error { margin: 0; color: var(--low); font-weight: 600; }
.form-actions { display: grid; gap: 8px; margin-top: 6px; }

/* Scanner */
.scanner { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: min(78vw, 340px); aspect-ratio: 1.6;
  border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45);
  outline: 3px solid var(--label);
}
.scanner-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 12px 12px; }
.scanner-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); text-align: center; }
.scanner-bottom p { margin: 0 0 14px; font-size: 17px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.manual-code { display: grid; grid-template-columns: 1fr auto; gap: 8px; max-width: 420px; margin: 0 auto; }
.manual-code input { min-height: 50px; border: 0; border-radius: var(--radius-m); padding: 0 14px; background: rgba(255,255,255,.95); color: #1B242C; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--steel); padding: 12px 16px; border-radius: var(--radius-m);
  font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast[data-show] { animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (min-width: 720px) {
  .part-list { border: 1px solid var(--line); border-radius: var(--radius-m); margin: 0 16px; overflow: hidden; }
  .part-list { padding-bottom: 0; margin-bottom: 120px; }
}
@media (max-width: 360px) {
  .field-pair { grid-template-columns: 1fr; }
  .stock-num { font-size: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- KI-Erkennung ---------- */
:root { --ai: #3B4FD8; --ai-ink: #FFFFFF; --ai-bg: #ECEFFE; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ai: #8C9BFF; --ai-ink: #10163A; --ai-bg: #222A52; }
}
.btn-ai { background: var(--ai); color: var(--ai-ink); }
.btn-ai svg { width: 22px; height: 22px; }

.field textarea {
  min-height: 84px; border: 0; border-radius: var(--radius-m); padding: 12px 14px; width: 100%; resize: vertical;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font: inherit; color: inherit;
}
.field textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
/* Von der KI befüllte Felder: kleiner Hinweis am Label, Rahmen in KI-Farbe */
.field.ai-filled > span::after, .field.ai-filled > label::after {
  content: "KI"; margin-left: 8px; padding: 1px 6px; border-radius: 4px;
  background: var(--ai-bg); color: var(--ai); font-size: 12px; font-weight: 700; vertical-align: 1px;
}
.field.ai-filled input, .field.ai-filled textarea { box-shadow: inset 0 0 0 1.5px var(--ai); }

.ai-result {
  background: var(--ai-bg); border-radius: var(--radius-m); padding: 14px; display: grid; gap: 8px;
  border-left: 4px solid var(--ai);
}
.ai-result[data-level="niedrig"] { border-left-color: var(--low); }
.ai-head { display: flex; align-items: center; gap: 12px; }
.ai-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.ai-head strong { display: block; }
.ai-conf { font-size: 14px; color: var(--ink-soft); }
.ai-result p { margin: 0; font-size: 15px; }
.ai-result summary { cursor: pointer; font-size: 14px; color: var(--ink-soft); }
.read-texts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px !important; }
.read-texts code { background: var(--surface); }

.part-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius-m); margin: 6px 0 4px; display: block; }
.pre { white-space: pre-line; }

/* Aufnahme-Ansicht */
.capture { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; }
.capture video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.capture-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.capture-flash[data-on] { animation: flash .25s ease-out; }
@keyframes flash { from { opacity: .55; } to { opacity: 0; } }
.capture-code {
  align-self: center; background: rgba(0,0,0,.55); padding: 6px 12px; border-radius: 999px;
  font: 600 15px/1 var(--font-cond); font-variant-numeric: tabular-nums;
}
.capture-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 12px;
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.85) 60%, rgba(0,0,0,0));
}
.capture-bottom > p { margin: 0; text-align: center; font-size: 16px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.thumbs { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; min-height: 64px; }
.thumbs button { padding: 0; border: 2px solid rgba(255,255,255,.8); border-radius: 8px; background: none; cursor: pointer; display: block; }
.thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; display: block; }
.capture-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; }
.round-btn {
  display: grid; justify-items: center; gap: 4px; background: none; border: 0; color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 12px;
}
.round-btn svg { width: 28px; height: 28px; }
.round-btn[aria-pressed="true"] { background: var(--label); color: var(--label-ink); }
.shutter {
  width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25);
  cursor: pointer; padding: 0;
}
.shutter:active { background: #fff; }
.link-btn-light { color: #fff; opacity: .85; justify-self: center; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.capture .btn-ai[disabled] { opacity: .45; }
.capture-busy {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: rgba(0,0,0,.72); font-size: 18px; font-weight: 600;
}
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 5px solid rgba(255,255,255,.25); border-top-color: var(--label); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin 3s linear infinite !important; } }

/* Vorschaubild in der Teileliste */
.part-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; display: block; background: var(--steel); }
.part-thumb-empty { box-shadow: inset 0 0 0 1.5px var(--line); }
.part[data-low="true"]::before { z-index: 1; }
.photo-credit { font-size: 12px; color: var(--ink-soft); margin: 0 0 6px; }
@media (max-width: 360px) { .part-thumb { width: 44px; height: 44px; } }

/* ---------- Filter und Sortierung ---------- */
.chip-filter { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.chip-filter svg { width: 18px; height: 18px; }
.chip-filter span { background: var(--ink); color: var(--steel); border-radius: 999px; padding: 0 7px; font-size: 13px; font-weight: 700; margin: 0; }
.chip-filter.chip-active { box-shadow: inset 0 0 0 2px var(--ink); }
.filter-panel {
  margin-top: 10px; padding: 12px; background: var(--surface); border-radius: var(--radius-m);
  box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 8px;
}
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ffield { display: grid; gap: 4px; min-width: 0; }
.ffield span { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.ffield select, .ffield input {
  min-height: 44px; border: 0; border-radius: 8px; padding: 0 10px; width: 100%; min-width: 0;
  background: var(--steel); font: inherit; color: inherit;
}
.ffield-pair { grid-template-columns: 1fr 1fr; gap: 8px; }
.ffield-pair label { display: grid; gap: 4px; min-width: 0; }
.filter-panel .link-btn { justify-self: start; background: none; border: 0; cursor: pointer; padding: 4px 0; font: inherit; font-weight: 600; }

/* ---------- Fahrzeugzuordnung im Formular ---------- */
.fitment { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }
.fitment legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 4px; }
.fitment.ai-filled legend::after {
  content: "KI"; margin-left: 8px; padding: 1px 6px; border-radius: 4px;
  background: var(--ai-bg); color: var(--ai); font-size: 12px; font-weight: 700;
}
.vehicle-rows { display: grid; gap: 10px; }
.vehicle-row {
  position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  padding: 12px 44px 12px 12px; background: var(--surface); border-radius: var(--radius-m); box-shadow: inset 0 0 0 1.5px var(--line);
}
.vfield { display: grid; gap: 4px; min-width: 0; }
.vfield span { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.vfield input { min-height: 42px; border: 0; border-radius: 8px; padding: 0 10px; width: 100%; min-width: 0; background: var(--steel); font: inherit; color: inherit; }
.vfield-make, .vfield-model, .vfield-generation { grid-column: span 2; }
.vfield-yearFrom, .vfield-yearTo, .vfield-hsn { grid-column: span 2; }
.vfield-tsn { grid-column: span 2; }
.vehicle-remove { position: absolute; top: 6px; right: 4px; }
@media (max-width: 520px) {
  .vehicle-row { grid-template-columns: repeat(2, 1fr); }
  .vfield-make, .vfield-model, .vfield-generation, .vfield-yearFrom, .vfield-yearTo, .vfield-hsn, .vfield-tsn { grid-column: span 1; }
  .vfield-generation { grid-column: span 2; }
}

.vehicle-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.vehicle-list .hsn { display: block; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Katalog-Treffer zu HSN/TSN */
.hsn-hit { grid-column: 1 / -1; margin: -2px 0 0; font-size: 13px; color: var(--ink-soft); }
.hsn-hit[data-state="ok"] { color: var(--ok); font-weight: 600; }
.vehicle-type { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--ok); font-weight: 600; }
.vehicle-type:empty { display: none; }

/* ---------- Fahrzeugbestand ---------- */
/* Bereichsumschalter Teile / Fahrzeuge */
.sections {
  display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px;
  background: var(--surface); border-radius: var(--radius-m); padding: 3px;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.sections a {
  display: grid; place-items: center; min-height: 40px; border-radius: 8px;
  text-decoration: none; font: 600 18px/1 var(--font-cond); color: var(--ink-soft);
}
.sections a[aria-current="page"] { background: var(--ink); color: var(--steel); }
.sections a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Kennzeichen: das wiedererkennbare Element der Fahrzeuge, bewusst wie das echte Schild (auch im Dunkelmodus) */
.plate {
  display: inline-flex; align-items: stretch; flex: none;
  height: 30px; border-radius: 4px; overflow: hidden;
  background: #FFFFFF; color: #111111; box-shadow: inset 0 0 0 2px #111111;
  font: 600 19px/1 var(--font-cond); letter-spacing: .04em; white-space: nowrap;
}
.plate::before {
  content: "D"; display: flex; align-items: flex-end; justify-content: center;
  width: 15px; padding-bottom: 4px; background: #1D4BA5; color: #FFFFFF;
  font: 700 10px/1 var(--font); letter-spacing: 0;
  border-radius: 3px 0 0 3px; margin: 2px 0 2px 2px;
}
.plate > span { display: flex; align-items: center; padding: 1px 8px 0; }
.plate-large { height: 46px; font-size: 30px; border-radius: 6px; box-shadow: inset 0 0 0 3px #111111; }
.plate-large::before { width: 22px; font-size: 13px; padding-bottom: 6px; margin: 3px 0 3px 3px; }
.plate-large > span { padding: 2px 12px 0; }
.plate-none { background: transparent; color: var(--ink-soft); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 14px; font-weight: 500; letter-spacing: 0; }
.plate-none::before { display: none; }
.plate-none.plate-large { font-size: 18px; }

.fleet-row { grid-template-columns: auto 1fr auto; }
.fleet-head .plate { margin-bottom: 6px; }
.fleet-assign-btn { margin-top: 18px; }
.fleet-notes { margin: 14px 0 0; white-space: pre-wrap; color: var(--ink-soft); }
.facts .hsn { display: block; font-size: 13px; color: var(--ink-soft); }

.fleet-parts { margin-top: 28px; display: grid; gap: 8px; }
.fleet-parts h3 { font: 700 20px/1 var(--font-cond); margin: 0; }
.fleet-parts h3 span { color: var(--ink-soft); font-weight: 600; margin-left: 4px; }
.mini-list { padding: 0; border-radius: var(--radius-m); box-shadow: inset 0 0 0 1px var(--line); border-top: 0; overflow: hidden; }
.mini-row { display: grid; grid-template-columns: 1fr auto; align-items: center; padding-right: 10px; }
.mini-row .part { grid-template-columns: auto 1fr auto; padding-right: 6px; }
.btn-small { min-height: 40px; padding: 0 12px; font-size: 15px; }
button.link-btn { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; }

.fleet-links a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; padding: 2px 0; }
.fleet-checks { display: grid; gap: 6px; }
.fleet-check {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 12px; border-radius: var(--radius-m);
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer;
}
.fleet-check:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }
.fleet-check input { width: 20px; height: 20px; accent-color: var(--ink); }
.fleet-check > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-warn { color: var(--low); font-weight: 600; }
.hsn-hit[data-state="info"] { color: var(--ink-soft); }
#fleet-form > .hint { margin-top: -6px; }
@media (max-width: 360px) {
  .plate { font-size: 16px; height: 28px; }
  .fleet-check { grid-template-columns: auto 1fr; }
  .fleet-check > span:last-child { grid-column: 2; }
}
