/* Alfano Cockpit – Gestaltung angelehnt an alfano.nkcompany.de */
@font-face { font-family: "Archivo"; src: url("/fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-italic.woff2") format("woff2"); font-style: italic; font-display: swap; }

:root {
  --nacht: #0b0b0c; --buehne: #121214; --flaeche: #1b1b1e; --linie-d: #2c2c31; --text-d: #cfcfd4; --leise-d: #8d8d95;
  --papier: #f4f4f2; --weiss: #fff; --tinte: #121214; --grau: #55555b; --hell: #8a8a90; --linie: rgba(18,18,20,.12); --linie-stark: rgba(18,18,20,.22);
  --rot: #ad0606; --rot-tief: #8c0505; --rot-hell: #ff5a4a; --rot-blass: #fbeceb;
  --gruen: #12804a; --gruen-blass: #e5f4ec; --gelb: #9a6700; --gelb-blass: #fdf3dc; --blau: #1f5fad; --blau-blass: #e8f0fa;
  --schrift: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif; --serif: "Instrument Serif", Georgia, serif;
  --feder: cubic-bezier(.32,.72,0,1); --schwung: cubic-bezier(.34,1.2,.64,1); --kurz: 160ms; --feder-zeit: 500ms; --r: 6px; --seite: 252px; --kopf: 60px;
  --schatten: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
}
/* Bewegung nach Apple: Federn statt fester Dauer. Kritisch gedämpft (Dämpfung 1, Ansprache 0,35 s) für alles,
   was nur erscheint; leicht federnd (Dämpfung 0,8) nur, wo eine Geste Schwung mitbringt. */
@supports (transition-timing-function: linear(0, 1)) {
  :root { --feder: linear(0, 0.057, 0.179, 0.319, 0.453, 0.571, 0.669, 0.748, 0.811, 0.859, 0.895, 0.923, 0.944, 0.959, 0.97, 0.979, 0.985, 0.989, 0.992, 0.994, 0.996, 0.997, 0.998, 0.999, 1); --schwung: linear(0, 0.035, 0.121, 0.233, 0.354, 0.473, 0.583, 0.68, 0.762, 0.829, 0.883, 0.925, 0.956, 0.979, 0.994, 1.005, 1.011, 1.014, 1.015, 1.015, 1.014, 1.012, 1.01, 1.008, 1.007, 1.005, 1.004, 1.003, 1.002, 1.001, 1); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--schrift); color: var(--tinte); background: var(--papier); -webkit-font-smoothing: antialiased; font-optical-sizing: auto; text-rendering: optimizeLegibility; -webkit-text-size-adjust: 100%; }
/* Sofortige Reaktion: kein 300-ms-Tippverzug, kein grauer Tipp-Blitz – Rückmeldung kommt beim Drücken (:active) */
a, button, .chip, .kal-tag, .kal-ev, label.haken, tr.klickbar { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--rot); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
[hidden] { display: none !important; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.muted { color: var(--grau); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }
:focus-visible { outline: 2px solid var(--rot); outline-offset: 2px; }

/* ---------- Grundgerüst ---------- */
.shell { display: grid; grid-template-columns: var(--seite) 1fr; min-height: 100vh; }
.side { background: var(--nacht); color: var(--text-d); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: var(--linie-d) transparent; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 16px; color: #fff; text-decoration: none !important; border-bottom: 1px solid var(--linie-d); }
.brand svg { width: 38px; height: 16px; fill: #fff; }
.brand svg .logo-a { fill: var(--rot-hell); }
.brand b { font-size: 13px; letter-spacing: .14em; font-weight: 800; }
.brand small { display: block; font-size: 10px; letter-spacing: .2em; color: var(--leise-d); font-weight: 600; }
.nav { padding: 10px 10px 24px; display: grid; gap: 2px; }
.nav-gruppe { font-size: 10px; letter-spacing: .18em; font-weight: 700; color: var(--leise-d); padding: 16px 12px 6px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r); color: var(--text-d); font-weight: 500; text-decoration: none; position: relative; transition: background var(--kurz), transform var(--feder-zeit) var(--feder); }
.nav a:active { background: var(--linie-d); transform: scale(.98); transition-duration: 80ms; }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .75; }
.nav a:hover { background: var(--flaeche); color: #fff; }
.nav a.aktiv { background: var(--flaeche); color: #fff; }
.nav a.aktiv::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--rot-hell); }
.nav a.aktiv svg { opacity: 1; color: var(--rot-hell); }
.nav .zahl { margin-left: auto; font-size: 11px; color: var(--leise-d); font-variant-numeric: tabular-nums; }
.side-fuss { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--linie-d); font-size: 11px; color: var(--leise-d); }

.haupt { min-width: 0; display: flex; flex-direction: column; }
.kopf { height: var(--kopf); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: rgba(244,244,242,.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-bottom: 1px solid rgba(18,18,20,.07); box-shadow: 0 1px 12px rgba(0,0,0,.03); }
.suche-knopf { display: flex; align-items: center; gap: 10px; flex: 0 1 420px; height: 38px; padding: 0 12px; border: 1px solid var(--linie); background: var(--weiss); border-radius: var(--r); color: var(--hell); cursor: pointer; text-align: left; }
.suche-knopf svg { width: 16px; height: 16px; flex: none; }
.suche-knopf span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suche-knopf kbd { margin-left: auto; }
kbd { font: 600 11px var(--schrift); padding: 2px 6px; border: 1px solid var(--linie-stark); border-radius: 4px; color: var(--grau); background: var(--papier); }
.menue-knopf { display: none; }
.suche-knopf { min-width: 0; }
.nutzer { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
@media (max-width: 1320px) { .nutzer .name, .nutzer .btn-text { display: none; } }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--tinte); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.inhalt { padding: 24px 28px 64px; min-width: 0; }

/* ---------- Seitenkopf ---------- */
.seitenkopf { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.seitenkopf h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.seitenkopf .ober { font-size: 11px; letter-spacing: .18em; font-weight: 700; color: var(--rot); text-transform: uppercase; margin-bottom: 4px; }
.seitenkopf .unter { color: var(--grau); margin-top: 4px; }
.seitenkopf .aktionen { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.zurueck { display: inline-flex; align-items: center; gap: 6px; color: var(--grau); font-weight: 600; font-size: 12px; margin-bottom: 8px; }
.zurueck svg { width: 14px; height: 14px; }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--linie-stark); background: var(--weiss); color: var(--tinte); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background var(--kurz), border-color var(--kurz), transform var(--feder-zeit) var(--feder); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:hover { border-color: var(--tinte); }
.btn:active:not(:disabled) { transform: scale(.97); transition-duration: 80ms; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primaer { background: var(--rot); border-color: var(--rot); color: #fff; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%); }
.btn.primaer:hover { background: var(--rot-tief); border-color: var(--rot-tief); }
.btn.dunkel { background: var(--tinte); border-color: var(--tinte); color: #fff; }
.btn.leise { border-color: transparent; background: transparent; }
.btn.leise:hover { background: rgba(0,0,0,.05); }
.btn.gefahr { color: var(--rot); }
.btn.gefahr:hover { border-color: var(--rot); background: var(--rot-blass); }
.btn.klein { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 36px; padding: 0; }
.btn.klein.icon { width: 28px; }
.dropdown { position: relative; display: inline-block; }
.dropdown-menue { position: absolute; right: 0; top: calc(100% + 4px); min-width: 230px; max-height: 60vh; overflow-y: auto; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r); box-shadow: 0 12px 40px rgba(0,0,0,.14); padding: 6px; z-index: 50;
  transform-origin: top right; animation: aufklappen var(--feder-zeit) var(--feder); } /* wächst aus dem Knopf, der es geöffnet hat */
@keyframes aufklappen { from { opacity: 0; transform: translateY(-4px) scale(.96); } }
.dropdown-menue button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; border-radius: 4px; text-align: left; cursor: pointer; }
.dropdown-menue button:hover { background: var(--papier); }
.dropdown-menue button:active { background: var(--linie); }
.dropdown-menue hr { border: 0; border-top: 1px solid var(--linie); margin: 4px 0; }

/* ---------- Karten ---------- */
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; box-shadow: var(--schatten); }
.karte-kopf { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--linie); }
.karte-kopf h3 { font-size: 14px; font-weight: 700; }
.karte-kopf .aktionen { margin-left: auto; display: flex; gap: 6px; }
.karte-inhalt { padding: 16px 18px; }
.karte-leer { padding: 28px 18px; text-align: center; color: var(--hell); }
.raster { display: grid; gap: 16px; }
.raster-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Kennzahlen */
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .etikett { font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--grau); text-transform: uppercase; }
.kpi .wert { font-size: clamp(20px, 2.2vw, 28px); white-space: nowrap; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .zusatz { font-size: 12px; color: var(--grau); margin-top: 2px; }
.kpi.akzent { background: var(--nacht); color: #fff; border-color: var(--nacht); }
.kpi.akzent .etikett, .kpi.akzent .zusatz { color: var(--leise-d); }
.kpi.klickbar { cursor: pointer; transition: transform var(--kurz) var(--feder), box-shadow var(--kurz); }
.kpi.klickbar:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.kpi.klickbar { transition: transform var(--feder-zeit) var(--feder), box-shadow var(--kurz); }
.kpi.klickbar:active { transform: scale(.985); transition-duration: 80ms; }
.live-hinweis { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px;
  background: var(--nacht); color: #fff; border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 600; max-width: calc(100vw - 32px);
  transform-origin: bottom right; animation: rein var(--feder-zeit) var(--feder); }
.live-hinweis svg { width: 18px; height: 18px; flex: none; color: var(--rot-hell); }
.einst-kachel { display: flex; gap: 12px; align-items: flex-start; color: inherit; text-decoration: none !important; }
.einst-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--rot-blass); color: var(--rot); }
.einst-icon svg { width: 18px; height: 18px; }

/* ---------- Abzeichen ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11px; font-weight: 700; background: var(--papier); color: var(--grau); white-space: nowrap; }
.badge.rot { background: var(--rot-blass); color: var(--rot); }
.badge.gruen { background: var(--gruen-blass); color: var(--gruen); }
.badge.gelb { background: var(--gelb-blass); color: var(--gelb); }
.badge.blau { background: var(--blau-blass); color: var(--blau); }
.badge.dunkel { background: var(--tinte); color: #fff; }
.punkt { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- Listen ---------- */
.werkzeug { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px; border-bottom: 1px solid var(--linie); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--linie); background: var(--weiss); cursor: pointer; font-weight: 600; font-size: 12px; color: var(--grau); display: inline-flex; align-items: center; gap: 6px; }
.chip { transition: background var(--kurz), color var(--kurz), border-color var(--kurz), transform var(--feder-zeit) var(--feder); }
.chip:hover { border-color: var(--tinte); color: var(--tinte); }
.chip:active { transform: scale(.96); transition-duration: 80ms; }
.chip.an { background: var(--tinte); color: #fff; border-color: var(--tinte); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .7; }
.suchfeld { position: relative; flex: 1 1 260px; max-width: 420px; }
.suchfeld svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--hell); pointer-events: none; }
.suchfeld input { padding-left: 34px !important; }
.filterflaeche { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; padding: 16px; border-bottom: 1px solid var(--linie); background: #fafaf8; }
.filterflaeche .feld label { font-size: 11px; }
.auswahlleiste { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--tinte); color: #fff; border-radius: 8px 8px 0 0; }
.auswahlleiste .btn { height: 30px; font-size: 12px; background: var(--flaeche); border-color: var(--linie-d); color: #fff; }
.auswahlleiste .btn:hover { border-color: #fff; }
.tabelle-huelle { overflow-x: auto; }
table.tab { width: 100%; border-collapse: collapse; font-size: 13px; }
.tab th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--grau); padding: 10px 12px; border-bottom: 1px solid var(--linie); white-space: nowrap; background: var(--weiss); position: sticky; top: 0; }
.tab th.sortierbar { cursor: pointer; user-select: none; }
.tab th.sortierbar:hover { color: var(--tinte); }
.tab th .pfeil { color: var(--rot); }
.tab td { padding: 10px 12px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tab tbody tr { transition: background var(--kurz); }
.tab tbody tr.klickbar { cursor: pointer; }
.tab tbody tr:hover { background: #fafaf8; }
.tab tbody tr.klickbar:active { background: var(--papier); transition-duration: 0ms; }
.tab tbody tr.markiert { background: var(--rot-blass); }
.tab td.zahl, .tab th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tab td.cb, .tab th.cb { width: 36px; padding-right: 0; }
.tab tfoot td { font-weight: 700; border-top: 2px solid var(--linie-stark); border-bottom: 0; }
.tab .haupt-text { font-weight: 700; }
.tab .neben-text { font-size: 12px; color: var(--grau); }
.tab .bild { width: 64px; height: 44px; border-radius: 4px; object-fit: cover; background: var(--papier); display: block; }
.tab .bild.leer { display: grid; place-items: center; color: var(--hell); }
.tab .bild.leer svg { width: 20px; height: 20px; }
.listenfuss { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--grau); font-size: 12px; }
.leer-zustand { padding: 56px 20px; text-align: center; color: var(--grau); }
.leer-zustand h3 { color: var(--tinte); margin-bottom: 6px; font-size: 16px; }

/* ---------- Formulare ---------- */
.feld { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; min-width: 0; }
.feld > label, .feld-titel { font-size: 12px; font-weight: 600; color: var(--grau); }
.feld .pflicht { color: var(--rot); }
.feld .hinweis { font-size: 11px; color: var(--hell); }
.feld.fehler input, .feld.fehler select, .feld.fehler textarea { border-color: var(--rot); background: var(--rot-blass); }
.feld.fehler .hinweis { color: var(--rot); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--linie-stark); border-radius: var(--r); background: var(--weiss); transition: border-color var(--kurz), box-shadow var(--kurz); }
textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--tinte); box-shadow: 0 0 0 3px rgba(173,6,6,.12); }
input[readonly], textarea[readonly] { background: var(--papier); color: var(--grau); }
input.zahl { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--rot); margin: 0; flex: none; }
.haken { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 36px; font-weight: 500; }
.haken-gruppe { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; }
.haken-gruppe .haken { min-height: 30px; }
.einheit { position: relative; }
.einheit input { padding-right: 34px !important; }
.einheit span { position: absolute; right: 10px; top: 50%; translate: 0 -50%; color: var(--hell); font-size: 12px; pointer-events: none; }
.formular { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.formular.ohne-seite { grid-template-columns: minmax(0, 1fr); }
.formular > *, .raster > * { min-width: 0; }
.reiter { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--linie); margin-bottom: 16px; scrollbar-width: none; }
.reiter button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--grau); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.reiter button:hover { color: var(--tinte); }
.reiter button { transition: color var(--kurz), border-color var(--kurz); }
.reiter button.an { color: var(--tinte); border-bottom-color: var(--rot); }
.reiter .zaehler { font-size: 11px; background: var(--papier); border-radius: 9px; padding: 0 6px; }
.abschnitt { margin-bottom: 16px; }
.abschnitt .karte-inhalt { display: grid; grid-template-columns: repeat(var(--spalten, 3), minmax(0, 1fr)); gap: 14px 16px; }
.abschnitt .voll { grid-column: 1 / -1; }
.abschnitt .doppel { grid-column: span 2; }
.seitenleiste { position: sticky; top: calc(var(--kopf) + 16px); display: grid; gap: 16px; }
.info-zeile { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--linie); font-size: 13px; }
.info-zeile:last-child { border-bottom: 0; }
.info-zeile span:first-child { color: var(--grau); }
.info-zeile b { font-variant-numeric: tabular-nums; text-align: right; }
.info-zeile.summe { border-top: 2px solid var(--tinte); border-bottom: 0; margin-top: 4px; padding-top: 10px; font-size: 15px; }
.gut { color: var(--gruen); }
.schlecht { color: var(--rot); }
.hinweisbox { padding: 12px 14px; border-radius: 8px; background: var(--gelb-blass); color: var(--gelb); font-weight: 500; display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.hinweisbox.rot { background: var(--rot-blass); color: var(--rot); }
.hinweisbox.blau { background: var(--blau-blass); color: var(--blau); }
.hinweisbox svg { width: 18px; height: 18px; flex: none; }
.speicherleiste { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-top: 16px; background: var(--tinte); color: #fff; border-radius: 10px; box-shadow: 0 -8px 30px rgba(0,0,0,.12); animation: hoch var(--feder-zeit) var(--feder); }
.speicherleiste .btn:not(.primaer) { background: transparent; color: #fff; border-color: var(--linie-d); }
@keyframes hoch { from { transform: translateY(12px); opacity: 0; } }

/* Verweis-Auswahl (Kunde, Fahrzeug …) */
.verweis { position: relative; }
.verweis-gewaehlt { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 6px 4px 10px; border: 1px solid var(--linie-stark); border-radius: var(--r); background: var(--weiss); }
.verweis-gewaehlt .t { flex: 1; min-width: 0; }
.verweis-gewaehlt .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verweis-gewaehlt .t small { color: var(--grau); }
.vorschlaege { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r); box-shadow: 0 12px 40px rgba(0,0,0,.14); z-index: 40; max-height: 300px; overflow-y: auto;
  transform-origin: top center; animation: aufklappen var(--feder-zeit) var(--feder); }
.vorschlaege button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--linie); }
.vorschlaege button:last-child { border-bottom: 0; }
.vorschlaege button:hover, .vorschlaege button.an { background: var(--papier); }
.vorschlaege small { display: block; color: var(--grau); }

/* Unter-Tabellen (Positionen) */
.positionen td { padding: 4px 6px; }
.positionen input, .positionen select { height: 32px; }
.positionen th { position: static; }

/* Kundenansicht: Einkaufspreise & Erträge ausblenden, wenn der Kunde mitschaut */
body.kundenansicht .geheim { display: none !important; }
.kundenansicht-an { background: var(--gelb-blass) !important; border-color: var(--gelb) !important; color: var(--gelb) !important; }

/* Unterschrift */
.unterschrift-feld { width: 100%; max-width: 640px; aspect-ratio: 900 / 260; border: 2px dashed var(--linie-stark); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.unterschrift-bild { display: grid; gap: 4px; justify-items: start; }
.unterschrift-bild img { max-width: 320px; max-height: 110px; border-bottom: 1px solid var(--tinte); }

/* Bilder */
.bilder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bild-kachel { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--papier); border: 1px solid var(--linie); }
.bild-kachel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bild-kachel .leiste { position: absolute; inset: auto 0 0 0; display: flex; gap: 4px; padding: 6px; background: linear-gradient(transparent, rgba(0,0,0,.6)); opacity: 0; transition: opacity var(--kurz); }
.bild-kachel:hover .leiste, .bild-kachel:focus-within .leiste { opacity: 1; }
.bild-kachel .leiste button { width: 28px; height: 28px; border-radius: 4px; border: 0; background: rgba(255,255,255,.92); cursor: pointer; display: grid; place-items: center; }
.bild-kachel .leiste svg { width: 14px; height: 14px; }
.bild-kachel .haupt-markierung { position: absolute; top: 6px; left: 6px; }
.ablage { display: grid; place-items: center; gap: 6px; aspect-ratio: 4/3; border: 2px dashed var(--linie-stark); border-radius: 8px; color: var(--grau); cursor: pointer; text-align: center; padding: 10px; font-weight: 600; font-size: 12px; transition: border-color var(--kurz), background var(--kurz); }
.ablage:hover, .ablage.drueber { border-color: var(--rot); background: var(--rot-blass); color: var(--rot); }
.ablage svg { width: 22px; height: 22px; }
.dateien { display: grid; gap: 6px; }
.datei-zeile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: var(--r); }
.datei-zeile svg { width: 18px; height: 18px; color: var(--grau); }

/* ---------- Dialoge ---------- */
.dialog-hg { position: fixed; inset: 0; background: rgba(11,11,12,.5); -webkit-backdrop-filter: blur(3px) saturate(120%); backdrop-filter: blur(3px) saturate(120%);
  z-index: 100; display: grid; place-items: start center; padding: 8vh 16px 16px; overflow-y: auto; animation: einblenden 200ms ease-out; }
.dialog { width: min(560px, 100%); background: var(--weiss); border-radius: 14px; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 30px 80px rgba(0,0,0,.35); animation: dialog-rein var(--feder-zeit) var(--feder); }
.dialog-hg.zu { animation: ausblenden 180ms ease-in forwards; pointer-events: none; }
.dialog-hg.zu .dialog { animation: dialog-raus 180ms cubic-bezier(.4, 0, 1, 1) forwards; }
@keyframes dialog-rein { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes dialog-raus { to { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes ausblenden { to { opacity: 0; } }
.dialog.breit { width: min(980px, 100%); }
.dialog-kopf { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--linie); }
.druckwahl { display: grid; gap: 18px; }
.druckwahl-titel { font-size: 11px; letter-spacing: .14em; font-weight: 700; color: var(--grau); text-transform: uppercase; margin-bottom: 8px; }
.druckwahl-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.druck-kachel { display: flex; align-items: flex-start; gap: 12px; padding: 14px; text-align: left; border: 1px solid var(--linie); border-radius: 10px; background: var(--weiss); cursor: pointer;
  transition: border-color var(--kurz), box-shadow var(--kurz), transform var(--feder-zeit) var(--feder); }
.druck-kachel:hover { border-color: var(--tinte); box-shadow: 0 6px 20px rgba(0,0,0,.07); }
.druck-kachel:active { transform: scale(.98); transition-duration: 80ms; }
.druck-kachel.haupt { border-color: var(--rot); background: var(--rot-blass); }
.druck-kachel-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--papier); color: var(--tinte); }
.druck-kachel.haupt .druck-kachel-icon { background: var(--rot); color: #fff; }
.druck-kachel-icon svg { width: 18px; height: 18px; }
.druck-kachel-text { display: grid; gap: 2px; min-width: 0; }
.druck-kachel-text b { font-size: 13.5px; }
.druck-kachel-text small { font-size: 12px; color: var(--grau); line-height: 1.35; }
.dialog-kopf h2 { font-size: 17px; font-weight: 800; letter-spacing: -.012em; }
.dialog-kopf .btn { margin-left: auto; }
.dialog-inhalt { padding: 20px; display: grid; gap: 14px; }
.dialog-fuss { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--linie); background: #fafaf8; border-radius: 0 0 12px 12px; }
@keyframes einblenden { from { opacity: 0; } }

/* Globale Suche */
.gsuche { padding: 0; }
.gsuche input { height: 54px !important; border: 0 !important; border-bottom: 1px solid var(--linie) !important; border-radius: 12px 12px 0 0 !important; font-size: 17px; padding: 0 20px !important; box-shadow: none !important; }
.gsuche-liste { max-height: 60vh; overflow-y: auto; padding: 6px; }
.gsuche-liste .gruppe { font-size: 10px; letter-spacing: .16em; font-weight: 700; color: var(--hell); padding: 10px 12px 4px; text-transform: uppercase; }
.gsuche-liste button { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 9px 12px; border-radius: 6px; cursor: pointer; }
.gsuche-liste button.an, .gsuche-liste button:hover { background: var(--papier); }
.gsuche-liste button svg { width: 18px; height: 18px; color: var(--grau); flex: none; }
.gsuche-liste small { color: var(--grau); display: block; }

/* Meldungen */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: 8px; background: var(--tinte); color: #fff; font-weight: 600; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: flex; gap: 10px; align-items: center; cursor: pointer; transform-origin: bottom right; animation: rein var(--feder-zeit) var(--feder); }
.toast.weg { animation: raus 200ms cubic-bezier(.4, 0, 1, 1) forwards; }
@keyframes rein { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes raus { to { opacity: 0; transform: translateY(16px) scale(.96); } }
.toast.fehler { background: var(--rot); }
.toast svg { width: 18px; height: 18px; flex: none; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-bild { background: var(--nacht) url("/login.jpg") center/cover; position: relative; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; overflow: hidden; }
.login-bild::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,11,12,.2), rgba(11,11,12,.92)); }
.login-bild > * { position: relative; }
.login-bild svg { width: 120px; fill: #fff; margin-bottom: 28px; }
.login-bild svg .logo-a { fill: var(--rot-hell); }
.login-bild h1 { font-size: clamp(36px, 5vw, 64px); font-weight: 900; letter-spacing: -.03em; line-height: .95; text-transform: uppercase; }
.login-bild h1 .serif { text-transform: none; color: var(--rot-hell); font-size: 1.05em; }
.login-bild p { color: var(--text-d); max-width: 440px; margin-top: 14px; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.login-form h2 { font-size: 28px; font-weight: 800; }
.login-form .btn { height: 44px; }

/* ---------- Kalender ---------- */
.kal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.kal-kopf { padding: 8px; font-size: 11px; letter-spacing: .1em; font-weight: 700; color: var(--grau); text-transform: uppercase; border-bottom: 1px solid var(--linie); }
.kal-tag { min-height: 112px; padding: 6px; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kal-tag:nth-child(7n) { border-right: 0; }
.kal-tag:hover { background: #fafaf8; }
.kal-tag:active, .kal-ev:active { filter: brightness(.96); }
.kal-tag.fremd { background: #fbfbfa; color: var(--hell); }
.kal-tag .nr { font-weight: 700; font-size: 12px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.kal-tag.heute .nr { background: var(--rot); color: #fff; }
.kal-ev { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--blau-blass); color: var(--blau); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; text-align: left; }
.kal-ev.probefahrt { background: var(--gelb-blass); color: var(--gelb); }
.kal-ev.auslieferung { background: var(--gruen-blass); color: var(--gruen); }
.kal-ev.admin { background: var(--rot-blass); color: var(--rot); }
.kal-ev.werkstatt { background: #eeeaf7; color: #5b3fa0; }

/* Diagramme */
.diagramm { width: 100%; height: auto; max-height: 340px; display: block; }
.diagramm text { font: 12px var(--schrift); fill: var(--grau); }
.diagramm .balken { fill: var(--tinte); transition: fill var(--kurz); }
.diagramm .balken:hover { fill: var(--rot); }
.diagramm .balken.akzent { fill: var(--rot); }
.diagramm .gitter { stroke: var(--linie); }
.verlauf { height: 8px; border-radius: 4px; background: var(--papier); overflow: hidden; }
.verlauf > div { height: 100%; background: var(--rot); border-radius: 4px; }

/* Standtage-Ampel */
.st { font-weight: 700; font-variant-numeric: tabular-nums; }
.st.ok { color: var(--gruen); }
.st.mittel { color: var(--gelb); }
.st.lang { color: var(--rot); }

/* ---------- Druck ---------- */
#print { display: none; }
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  body { background: #fff; }
  body.druckt #app, body.druckt #toasts { display: none !important; }
  body.druckt #print { display: block; }
}
.druck { font: 10.5pt/1.4 var(--schrift); color: #000; }
.druck .d-kopf { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 18px; }
.druck .d-kopf svg { width: 90px; fill: #000; }
.druck .d-kopf svg .logo-a { fill: var(--rot); }
.druck .d-firma { text-align: right; font-size: 9pt; line-height: 1.35; }
.druck .d-firma b { font-size: 11pt; letter-spacing: .08em; }
.druck .d-absender { font-size: 7.5pt; text-decoration: underline; color: #444; margin-bottom: 4px; }
.druck .d-adresse { min-height: 30mm; }
.druck h1 { font-size: 17pt; font-weight: 800; margin: 14px 0 4px; }
.druck h2 { font-size: 11pt; font-weight: 800; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.druck table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.druck th { text-align: left; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid #000; padding: 4px 6px; }
.druck td { padding: 4px 6px; border-bottom: 1px solid #ddd; vertical-align: top; }
.druck td.z, .druck th.z { text-align: right; white-space: nowrap; }
.druck .d-meta { display: grid; grid-template-columns: auto auto; gap: 2px 14px; justify-content: end; font-size: 9.5pt; }
.druck .d-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.druck .d-summe td { font-weight: 800; border-top: 2px solid #000; border-bottom: 0; }
.druck .d-unterschrift { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 46px; align-items: end; break-inside: avoid; }
.druck .d-unterschrift .d-linie { border-top: 1px solid #000; padding-top: 4px; font-size: 8.5pt; }
.druck .d-sig { display: block; max-height: 20mm; max-width: 70mm; margin-bottom: 1mm; }
.druck .d-fuss { margin-top: 26px; padding-top: 8px; border-top: 1px solid #999; font-size: 7.5pt; color: #444; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.druck .d-text { white-space: pre-wrap; }
.druck .d-liste { margin: 4px 0; padding-left: 18px; }
.druck .d-liste li { margin: 2px 0; }
.druck .d-hinweis { margin: 14px 0 0; padding: 8px 10px; border: 1px solid #000; font-size: 9pt; break-inside: avoid; }
.druck .d-seitenumbruch { break-after: page; }
.druck .d-seite { break-after: page; }
.druck .d-seite:last-child { break-after: auto; }
.druck .preisschild { border: 3px solid #000; padding: 18px; min-height: 250mm; display: flex; flex-direction: column; }
.druck .preisschild .preis { font-size: 54pt; font-weight: 900; color: var(--rot); letter-spacing: -.02em; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 1180px) { .formular { grid-template-columns: minmax(0, 1fr); } .seitenleiste { position: static; } .raster-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 90; transform: translateX(-100%); transition: transform var(--feder-zeit) var(--feder); touch-action: pan-y; }
  .shell.menue-offen .side { transform: none; box-shadow: 12px 0 40px rgba(0,0,0,.3); }
  .side.ziehen { transition: none; }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 89; background: rgba(11,11,12,.45); opacity: 0; pointer-events: none; transition: opacity 260ms ease; }
  .shell.menue-offen .side-scrim { opacity: 1; pointer-events: auto; }
  .menue-knopf { display: inline-flex; }
  .kopf, .inhalt { padding-left: 16px; padding-right: 16px; }
  .raster-2, .raster-3 { grid-template-columns: 1fr; }
  .abschnitt .karte-inhalt { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; } .login-bild { min-height: 260px; padding: 28px; }
  .suche-knopf kbd, .nutzer .name { display: none; }
}
@media (max-width: 560px) {
  .raster-4 { grid-template-columns: 1fr 1fr; }
  .kpi .wert { font-size: 18px; white-space: normal; overflow-wrap: anywhere; }
  .suche-knopf { flex: 0 0 38px; padding: 0; justify-content: center; }
  .suche-knopf span { display: none; }
  .kopf { gap: 8px; }
  .abschnitt .karte-inhalt { grid-template-columns: 1fr; }
  .abschnitt .doppel { grid-column: auto; }
  .seitenkopf h1 { font-size: 22px; }
  .kal-tag { min-height: 70px; } .kal-ev { font-size: 0; height: 6px; padding: 0; }
}
.side-scrim { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-property: opacity, background-color, border-color, color !important; transition-duration: 150ms !important; }
  .dialog, .toast, .dropdown-menue, .vorschlaege, .speicherleiste, .live-hinweis { animation: einblenden 150ms ease !important; }
  .dialog-hg.zu, .dialog-hg.zu .dialog, .toast.weg { animation: ausblenden 150ms ease forwards !important; }
  .btn:active, .chip:active, .nav a:active, .kpi.klickbar:hover, .kpi.klickbar:active { transform: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .kopf { background: var(--papier); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: var(--linie); }
  .dialog-hg { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(11,11,12,.6); }
}
@media (prefers-contrast: more) {
  :root { --linie: rgba(18,18,20,.35); --linie-stark: rgba(18,18,20,.6); --grau: #3a3a3f; --hell: #5a5a60; }
  .kopf { background: var(--papier); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 1px solid var(--linie-stark); }
}
