:root {
  --akzent: #58b5e1;
  --akzent-dunkel: #3fa3d4;
  --text: #555555;
  --text-kraeftig: #4a4b4c;
  --grau-hell: #f6f6f6;
  --linie: #ededed;
  --rahmen: #dddddd;
  --flaeche: #ffffff;
  --kopf: #58b5e1;
  --text-titel: #6b6c6d;
  --text-leise: #9a9a9a;
  --icon: #7d7e7f;
  --zeile-hover: #fbfbfb;
  --fehler-flaeche: #fdf6f5;
  --fehler-rand: #e8c4c0;
  --fehler-dunkel: #a5443c;
  --gut-flaeche: #f2f8f2;
  --gut-rand: #cfe3ce;
  --warn-flaeche: #fdfaf3;
  --warn-rand: #ecdcb8;
  --akzent-flaeche: #f2f9fc;
  --akzent-rand: #cfe6f4;
  --fehler: #c0564d;
  --warnung: #d99a2b;
  --gut: #5c9e5a;
  --leiste: 52px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--flaeche);
}

/* Kopfleiste */
.kopfleiste {
  position: sticky; top: 0; z-index: 20;
  height: var(--leiste);
  background: var(--kopf);
  display: flex; align-items: center; gap: 20px;
  padding: 0 18px;
  color: #fff;
}
.kopfleiste svg { width: 21px; height: 21px; }
.kopfleiste .logo { width: 26px; height: 26px; margin-right: 6px; }
.kopfleiste .name { font-size: 16px; margin-left: auto; opacity: .95; }

/* Icon-Leiste */
.rumpf { display: flex; min-height: calc(100vh - var(--leiste)); }
.iconleiste {
  width: var(--leiste); flex: 0 0 var(--leiste);
  background: var(--grau-hell);
  border-right: 1px solid var(--linie);
  padding: 14px 0 18px;
  display: flex; flex-direction: column;
}
.iconleiste a.unten { margin-top: auto; }
.iconleiste a {
  display: flex; align-items: center; justify-content: center;
  height: 52px; color: var(--icon); border-left: 3px solid transparent;
}
.iconleiste a:hover { color: var(--akzent); }
.iconleiste a.aktiv { color: var(--akzent); border-left-color: var(--text-kraeftig); }
.iconleiste svg { width: 21px; height: 21px; }

.inhalt { flex: 1; min-width: 0; background: var(--flaeche); }

/* Seitenkopf */
.seitenkopf {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 30px 18px;
  border-bottom: 1px solid var(--linie);
}
.seitenkopf h1 { margin: 0; font-size: 29px; font-weight: 300; color: var(--text-titel); }
.seitenkopf svg { width: 27px; height: 27px; color: var(--text-titel); stroke: currentColor; }

.bereich { padding: 26px 30px 70px; }

/* Formulare */
.block { margin-bottom: 30px; }
.block > h2 { margin: 0 0 16px; font-size: 18px; font-weight: 300; color: var(--text-kraeftig); }

.raster { display: flex; flex-wrap: wrap; gap: 18px 22px; }
.feld { flex: 1 1 230px; min-width: 190px; }
.feld.breit { flex: 1 1 100%; }
.feld label { display: block; margin-bottom: 5px; }

input[type="text"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], input[type="email"],
input[type="file"], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--rahmen); border-radius: 3px;
  background: var(--flaeche); font: inherit; color: var(--text);
}
input[type="file"] { padding: 7px 9px; }
textarea { min-height: 300px; resize: vertical; line-height: 1.65; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--akzent);
  box-shadow: 0 0 0 2px rgba(88, 181, 225, .25);
}

.knopfreihe { display: flex; gap: 12px; margin-top: 20px; align-items: center; }
button, .knopf {
  padding: 9px 22px; border: 1px solid transparent; border-radius: 3px;
  background: var(--akzent); color: #fff;
  font: inherit; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .knopf:hover { background: var(--akzent-dunkel); }
button.still, .knopf.still {
  background: var(--grau-hell); color: var(--text); border-color: var(--rahmen);
}
button.still:hover, .knopf.still:hover { background: var(--linie); }
.rueckmeldung { color: var(--gut); font-size: 14px; }

/* Tabellen */
.tabellenkopf { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 10px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-weight: 400; color: var(--text-kraeftig);
  background: var(--grau-hell);
  border-top: 1px solid var(--linie); border-bottom: 1px solid var(--rahmen);
  padding: 11px 12px; white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--linie); vertical-align: top; }
tbody tr:hover td { background: var(--zeile-hover); }
td.knapp { white-space: nowrap; color: var(--text-kraeftig); }
.leer { padding: 16px 12px; font-style: italic; color: var(--text-leise); }

/* Bilanz und Urteil */
.bilanz { display: flex; gap: 34px; padding: 0 0 12px; }
.bilanz > div { margin-right: 30px; }   /* Rückfall, falls gap nicht greift */
.bilanz > div:last-child { margin-right: 0; }
.bilanz .wert.bereit, .bilanz .marke.bereit { color: var(--akzent); }
.bilanz .wert { font-size: 26px; color: var(--text-kraeftig); line-height: 1.2; }
.bilanz .wert.fehler { color: var(--fehler); }
.bilanz .wert.warnung { color: var(--warnung); }
.bilanz .marke { font-size: 13px; color: var(--text-leise); }

.urteil { padding: 12px 16px; border: 1px solid; border-radius: 3px; margin-bottom: 24px; }
.urteil.nein { color: var(--fehler); border-color: var(--fehler-rand); background: var(--fehler-flaeche); }
.urteil.ja { color: var(--gut); border-color: var(--gut-rand); background: var(--gut-flaeche); }
.urteil.hinweis { color: var(--warnung); border-color: var(--warn-rand); background: var(--warn-flaeche); }

.stufe-FEHLER { color: var(--fehler); }
.stufe-WARNUNG { color: var(--warnung); }
.regel { color: var(--text-leise); font-size: 13px; white-space: nowrap; }
.herkunft { font-size: 13px; color: var(--text-leise); }
.stufe-unsicher { color: var(--warnung); }
.stufe-fehlt { color: var(--fehler); }
.stufe-abgeleitet { color: var(--akzent); }
.stufe-sicher { color: var(--gut); }

/* Ausstattung */
.gruppen { display: flex; flex-wrap: wrap; gap: 24px 30px; }
.gruppe { flex: 1 1 200px; }
.gruppe h3 {
  margin: 0 0 8px; font-size: 15px; font-weight: 400; color: var(--text-kraeftig);
  border-bottom: 1px solid var(--linie); padding-bottom: 6px;
}
.gruppe label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.gruppe input { accent-color: var(--akzent); }



/* ---------- Galerie ---------- */
.galerie { display: flex; gap: 24px; flex-wrap: wrap; }
.buehne { flex: 1 1 520px; min-width: 320px; }
.buehne img {
  width: 100%; border: 1px solid var(--rahmen); border-radius: 3px;
  background: var(--grau-hell);
}
.buehne .bildmarke {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 8px; font-size: 14px; color: var(--text-leise);
}

.mini { flex: 1 1 380px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.kachel {
  position: relative; width: 104px; height: 78px;
  border: 1px solid var(--rahmen); border-radius: 3px; overflow: hidden;
  cursor: grab; background: var(--grau-hell);
}
.kachel.aktiv { border-color: var(--akzent); box-shadow: 0 0 0 2px rgba(88,181,225,.35); }
.kachel.zieht { opacity: .4; }
.kachel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kachel .nummer {
  position: absolute; left: 0; top: 0;
  background: rgba(74,75,76,.78); color: #fff;
  font-size: 12px; padding: 1px 6px; border-bottom-right-radius: 3px;
}
.kachel .weg {
  position: absolute; right: 2px; top: 2px; z-index: 2;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border: none; border-radius: 50%; padding: 0;
  background: rgba(192,86,77,.9); color: #fff; font-size: 14px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.kachel:hover .weg { opacity: 1; }
.kachel .weg:hover { background: var(--fehler); }
.kachel.detail .nummer { background: rgba(217,154,43,.85); }

/* ---------- Dashboard ---------- */
.kacheln-kpi {
  display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 26px;
}
.kpi {
  flex: 1 1 170px; min-width: 155px;
  border: 1px solid var(--linie); border-radius: 3px;
  padding: 16px 18px; background: var(--flaeche);
}
.kpi-wert { font-size: 30px; color: var(--text-kraeftig); line-height: 1.1; }
.kpi-wert.warn { color: var(--warnung); }
.kpi-wert.gefahr { color: var(--fehler); }
.kpi.gefahr { border-color: var(--fehler-rand); background: var(--fehler-flaeche); }
.stufe-gefahr { color: var(--fehler); }
.kpi-neben { font-size: 16px; color: var(--text-leise); margin-left: 4px; }
.kpi-marke { font-size: 12.5px; color: var(--text-leise); margin-top: 6px; }

.legende { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.legende > span { margin-right: 14px; }   /* Rückfall, falls gap nicht greift */
.legende i { display: inline-block; width: 13px; height: 13px; border-radius: 2px;
             margin-right: 6px; vertical-align: -2px; }

.balken { background: var(--grau-hell); border-radius: 2px; height: 9px; }
.balken span { display: block; height: 9px; background: var(--akzent); border-radius: 2px; }

.wochen { display: flex; align-items: flex-end; gap: 8px; }
.saeulenfeld { height: 78px; display: flex; align-items: flex-end; }
.woche { flex: 1; text-align: center; display: flex; flex-direction: column;
         justify-content: flex-end; }
.saeule { background: var(--akzent); border-radius: 2px 2px 0 0; min-height: 2px;
          width: 100%; align-self: flex-end; }
.wochenmarke { font-size: 10.5px; color: var(--text-leise); margin-top: 5px; }
.wochenwert { font-size: 12px; color: var(--text-kraeftig); }

.marke-fehlt {
  display: inline-block; margin: 0 5px 4px 0; padding: 2px 9px;
  border: 1px solid var(--fehler-rand); border-radius: 11px;
  background: var(--fehler-flaeche); color: var(--fehler); font-size: 12.5px;
}
.marke-fehlt.klein { font-size: 12px; }

.marke-gefahr { color: var(--fehler); text-decoration: none; border-bottom: 1px dotted; }
.marke-gefahr:hover { color: var(--fehler-dunkel); }
td.fehlt { color: var(--fehler); }

/* Der Plan skaliert auf die verfügbare Höhe, damit das Dashboard
   ohne Scrollen auskommt. */
.plan { display: flex; justify-content: center; }
/* Der Plan ist quadratisch. Begrenzt wird der Rahmen, nicht die Grafik -
   das versteht auch älteres Rendering zuverlässig. */
/* Der Plan ist 1240 zu 1000 breit; die Höhe des Fensters begrenzt ihn,
   die Breite folgt dem Seitenverhältnis (Faktor 1,24). */
.plan { max-width: calc((100vh - 258px) * 1.24); margin: 0 auto; width: 100%; }
.plan svg { display: block; width: 100%; height: auto; }

/* ---------- Dashboard: kompakt, ohne Scrollen ---------- */
.dash .kpi { padding: 9px 13px; flex: 1 1 140px; min-width: 130px; }
.dash .kpi-wert { font-size: 21px; }
.dash .kpi-marke { font-size: 11.5px; margin-top: 3px; }
.dash .kacheln-kpi { gap: 9px; margin-bottom: 12px; }
.dash-bereich { padding-top: 14px; }

.dash-raster { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.dash-plan { flex: 3 1 700px; max-width: 1240px; }
.dash-spalte { flex: 1 1 250px; display: flex; flex-direction: column; gap: 13px; }
.legende { flex-wrap: wrap; }
.dash .bilanz { display: none; }

.dash .block { margin-bottom: 0; }
.dash .block > h2 { font-size: 15.5px; margin-bottom: 9px; }
.dash .block td { padding: 5px 8px; font-size: 13px; }
.dash .saeulenfeld { height: 62px; }
.dash .urteil { padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.dash .legende { margin-bottom: 8px; font-size: 12.5px; }
.dash .marke-fehlt { padding: 1px 7px; font-size: 11.5px; }

/* Versteigert-Knopf mit Bieterhammer */
button.hammer {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--akzent); font-size: 15.5px; padding: 11px 24px;
}
button.hammer svg { width: 19px; height: 19px; }
button.hammer:hover { background: var(--akzent-dunkel); }

/* Platzvergabe direkt nach der Aufnahme */
.platzschritt { border: 1px solid var(--akzent); border-radius: 3px;
                padding: 16px 18px; background: var(--akzent-flaeche); }
.platzform { display: flex; gap: 10px; margin-top: 12px; }
.platzform input { width: 130px; font-size: 17px; text-align: center; }
button.gross { font-size: 17px; padding: 13px 30px; }

.fotoform { width: 100%; margin-bottom: 8px; }
.fotoform .knopf { display: inline-block; cursor: pointer; font-size: 14px;
                   padding: 8px 16px; }

/* Fotos bearbeiten: Kreuz und Ziehen erst nach dem Umschalten */
.kachel .weg { display: none; }
.bearbeitung .kachel .weg { display: block; opacity: 0; }
.bearbeitung .kachel:hover .weg { opacity: 1; }
.bearbeitung .kachel { cursor: grab; }
.bearbeitung .kachel::after {
  content: ""; position: absolute; inset: 0;
  border: 2px dashed rgba(88, 181, 225, .55); border-radius: 3px;
  pointer-events: none;   /* sonst fängt der Rahmen die Klicks ab */
}

/* Vollständigkeit in der Bestandsliste */
.stand { display: inline-block; padding: 2px 10px; border-radius: 11px;
         font-size: 12.5px; white-space: nowrap; }
.stand.vollstaendig { color: var(--gut); background: var(--gut-flaeche); border: 1px solid var(--gut-rand); }
.stand.unvollstaendig { color: var(--fehler); background: var(--fehler-flaeche); border: 1px solid var(--fehler-rand); }

/* Fehlende Angaben in den Fahrzeugdetails */
/* Dezent: nur ein farbiger Streifen links, keine rote Fläche */
input.fehlend, textarea.fehlend, select.fehlend {
  box-shadow: inset 3px 0 0 var(--warnung);
}
.fehlend-rahmen { border: 1px dashed var(--rahmen); border-radius: 3px; color: var(--text-leise); }

/* Hinweisleiste oben auf der Fahrzeugseite */
.hinweisleiste { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 9px 14px; margin: 0 0 18px; background: var(--grau-hell);
  border: 1px solid var(--linie); border-radius: 6px; font-size: 13.5px; }
.hl-titel { color: var(--text-leise); margin-right: 4px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 11px; font-size: 12.5px;
  border: 1px solid var(--rahmen); background: var(--flaeche); color: var(--text);
  text-decoration: none; line-height: 1.5; }
.chip:hover { border-color: var(--akzent); color: var(--akzent); }
.chip.warn { border-color: var(--warn-rand); color: var(--warnung); }
.chip.rot { border-color: var(--fehler-rand); color: var(--fehler); background: var(--fehler-flaeche); }
.hinweisleiste details { flex-basis: 100%; }
.hinweisleiste summary { cursor: pointer; color: var(--text-leise); font-size: 12.5px;
  list-style: none; display: inline; }
.hinweisleiste summary::-webkit-details-marker { display: none; }
.hinweisleiste summary::after { content: " ▸"; }
.hinweisleiste details[open] summary::after { content: " ▾"; }
.hl-details { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--linie); }
.hl-details p { margin: 0 0 8px; }
.hl-details ul { margin: 0 0 4px 18px; padding: 0; }
.urteil.verblassen { transition: opacity .6s, max-height .6s, margin .6s, padding .6s;
  max-height: 80px; overflow: hidden; }
.urteil.verblassen.weg { opacity: 0; max-height: 0; margin: 0; padding-top: 0;
  padding-bottom: 0; border-width: 0; }

/* ---------- Fahrzeugansicht: links Daten, rechts Bilder ---------- */
.detail { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.detail-links { flex: 3 1 520px; min-width: 0; }
.detail-rechts { flex: 2 1 360px; min-width: 0; max-width: 560px; }
.detail .block { border: 1px solid var(--linie); border-radius: 3px;
                 padding: 18px 20px; margin-bottom: 18px; }
.detail textarea { min-height: 190px; }

.grossbild { width: 100%; display: block; border: 1px solid var(--linie);
             border-radius: 3px; background: var(--grau-hell); }
.detail .bildmarke { margin-top: 6px; font-size: 13px; color: var(--text-leise); }
.detail .mini { display: flex; flex-wrap: wrap; gap: 7px; }
.detail .kachel { width: 82px; height: 60px; }
.qr { width: 128px; border: 1px solid var(--linie); padding: 5px; background: #fff; }
button.loeschen { color: var(--fehler); }
button.loeschen:hover { background: var(--fehler-flaeche); border-color: var(--fehler-rand); }

/* ---------- Anmeldung ---------- */
.anmeldeseite { background: var(--grau-hell); display: flex;
                align-items: center; justify-content: center; min-height: 100vh; }
.anmeldekarte { width: 360px; background: var(--flaeche);
                border: 1px solid var(--linie); border-radius: 4px; overflow: hidden; }
.anmeldekopf { background: var(--kopf); color: #fff; padding: 18px 22px;
               display: flex; align-items: center; gap: 10px; font-size: 17px; }
.anmeldekopf svg { width: 22px; height: 22px; }
.anmeldeform { padding: 22px; }
.anmeldeform .feld { margin-bottom: 14px; }
.anmeldeform button { width: 100%; }

.kopfleiste .name { margin-left: auto; }
.benutzerleiste { display: flex; align-items: center; gap: 14px;
                  margin-left: 22px; font-size: 14px; }
.benutzerleiste .rolle { opacity: .8; font-size: 12.5px;
                         border: 1px solid rgba(255,255,255,.5);
                         border-radius: 10px; padding: 1px 9px; }
.benutzerleiste a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.6); }

.haken { display: flex; align-items: center; gap: 7px; padding: 3px 0;
         font-size: 14px; }
.haken input { accent-color: var(--akzent); }

/* Stand der Fahrzeugpapiere */
.papiere { display: inline-block; padding: 2px 9px; border-radius: 11px;
           font-size: 12px; white-space: nowrap; border: 1px solid; }
.papiere.p-vollstaendig { color: var(--gut); background: var(--gut-flaeche); border-color: var(--gut-rand); }
.papiere.p-unvollstaendig { color: var(--warnung); background: var(--warn-flaeche); border-color: var(--warn-rand); }
.papiere.p-fehlen { color: var(--fehler); background: var(--fehler-flaeche); border-color: var(--fehler-rand); }
.papiere.p-unbekannt { color: var(--text-leise); background: var(--grau-hell); border-color: var(--rahmen); }

.dokumente td { padding: 7px 0; }
.dokumente a { color: var(--akzent); text-decoration: none; }
.dokumente a:hover { text-decoration: underline; }

/* Suchfeld in der Kopfleiste */
.kopfsuche { margin-left: 26px; flex: 0 1 340px; }
.kopfsuche input {
  width: 100%; padding: 6px 12px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.16);
  color: #fff; font: inherit; font-size: 14px;
}
.kopfsuche input::placeholder { color: rgba(255,255,255,.8); }
.kopfsuche input:focus { outline: none; background: var(--flaeche); color: var(--text); }

/* Mehrfachauswahl */
.wahlspalte { width: 34px; }
.wahlspalte input { accent-color: var(--akzent); }
.sammelleiste {
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 10px; border-radius: 3px;
  background: var(--akzent-flaeche); border: 1px solid var(--akzent-rand);
}
.sammelleiste.aktiv { display: flex; }
.sammelleiste select, .sammelleiste input { width: auto; min-width: 150px; }

/* ================= Handy und Tablet ================= */
@media (max-width: 820px) {
  /* Kopfleiste umbrechen, Suche in eigener Zeile */
  .kopfleiste { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 12px; }
  .kopfleiste .name { font-size: 13px; margin-left: auto; }
  .kopfsuche { order: 3; flex: 1 1 100%; margin: 0; }
  .kopfsuche input { border-radius: 4px; padding: 10px 12px; font-size: 16px; }
  .benutzerleiste { margin-left: auto; font-size: 12.5px; gap: 12px; }
  .benutzerleiste .rolle { display: none; }

  /* Navigation als Leiste am unteren Rand, mit dem Daumen erreichbar */
  .rumpf { display: block; }
  .iconleiste {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    width: auto; flex-direction: row; justify-content: space-around;
    padding: 0; border-right: none; border-top: 1px solid var(--rahmen);
    background: var(--flaeche);
  }
  .iconleiste a { flex: 1; height: 54px; border-left: none;
                  border-top: 3px solid transparent; }
  .iconleiste a.aktiv { border-left: none; border-top-color: var(--akzent); }
  .iconleiste a.unten { margin-top: 0; }
  .inhalt { padding-bottom: 64px; }

  .seitenkopf { padding: 16px 16px 12px; }
  .seitenkopf h1 { font-size: 21px; }
  .bereich { padding: 16px 16px 40px; }

  /* Formulare einspaltig, größere Ziele */
  .feld, .feld.breit { flex: 1 1 100%; min-width: 0; }
  input[type="text"], input[type="date"], input[type="number"],
  input[type="search"], input[type="password"], select, textarea {
    font-size: 16px;            /* verhindert das Zoomen auf iPhones */
    padding: 11px 12px;
  }
  button, .knopf { padding: 12px 18px; min-height: 44px; }
  .knopfreihe { flex-wrap: wrap; }

  /* Tabellen: seitlich schiebbar, Nebensächliches ausblenden */
  .block { overflow-x: auto; }
  table { min-width: 0; }
  th, td { padding: 9px 8px; }
  .nur-breit { display: none; }

  /* Fahrzeugansicht: Bilder zuerst, dann die Daten */
  .detail { flex-direction: column; }
  .detail-rechts { order: -1; max-width: none; }
  .detail .kachel { width: 72px; height: 54px; }
  .detail textarea { min-height: 150px; }

  /* Übersicht */
  .dash .kpi { flex: 1 1 44%; min-width: 0; }
  .plan { max-width: none; }
  .dash-plan, .dash-spalte { flex: 1 1 100%; max-width: none; }
  .bilanz { gap: 22px; flex-wrap: wrap; }
  .galerie { flex-direction: column; }

  /* Sammelauswahl untereinander */
  .sammelleiste { gap: 8px; }
  .sammelleiste select, .sammelleiste input { flex: 1 1 100%; min-width: 0; }

  .anmeldekarte { width: 92%; }
}

@media (max-width: 520px) {
  .kopfleiste .name { display: none; }
  .dash .kpi { flex: 1 1 100%; }
}

/* Aufgaben */
.aufgabe { display: flex; align-items: flex-start; gap: 10px;
           padding: 8px 0; border-bottom: 1px solid var(--linie); }
.aufgabe.erledigt .aufgabentext { color: var(--text-leise); text-decoration: line-through; }
.aufgabentext { flex: 1; font-size: 14px; }
.haken-knopf { width: 22px; height: 22px; padding: 0; min-height: 0;
               border: 1px solid var(--rahmen); border-radius: 4px;
               background: var(--flaeche); color: var(--gut); font-size: 14px;
               line-height: 1; cursor: pointer; }
.haken-knopf:hover { background: var(--gut-flaeche); border-color: var(--gut); }

.verlauf td { padding: 6px 8px; font-size: 13px; vertical-align: top; }
.verlauf tr:hover td { background: var(--zeile-hover); }

/* Blase für neue Aufgaben */
.iconleiste a { position: relative; }
.blase {
  position: absolute; top: 6px; right: 6px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--fehler); color: #fff;
  font-size: 11px; line-height: 17px; text-align: center;
}
.glocke { position: relative; color: #fff; display: flex; align-items: center;
          margin-left: 18px; }
.glocke svg { width: 20px; height: 20px; }
.glocke .blase { top: -5px; right: -8px; }

/* Drehknöpfe erscheinen nur beim Bearbeiten */
.kachel .drehen { display: none; position: absolute; left: 0; right: 0; bottom: 0;
                  z-index: 2;
                  justify-content: center; gap: 3px; padding: 2px 0;
                  background: rgba(255,255,255,.85); }
.bearbeitung .kachel:hover .drehen { display: flex; }
.kachel .drehen button { padding: 0 6px; min-height: 0; font-size: 13px;
                         line-height: 17px; background: transparent;
                         color: var(--text-kraeftig); border: none; cursor: pointer; }
.kachel .drehen button:hover { color: var(--akzent); background: transparent; }

/* Haken auf aufbereiteten Fotos */
.kachel .fertig {
  position: absolute; right: 2px; bottom: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gut); color: #fff;
  font-size: 8px; line-height: 12px; text-align: center;
}
.kachel.bearbeitet { border-color: var(--gut); }

/* Auktionsbereit als Zustand in der Liste */
.stand.bereit { color: var(--akzent); background: var(--akzent-flaeche); border: 1px solid var(--akzent-rand); }

/* Ablauf über Lightroom */
.lightroom { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--linie); }
.lightroom h3 { font-size: 14px; font-weight: 400; margin: 0 0 8px;
                color: var(--text-kraeftig); }
.ablauf { margin: 0 0 10px 18px; padding: 0; font-size: 13px; color: var(--text-leise); }
.ablauf li { margin-bottom: 4px; }
.ablauf code { background: var(--grau-hell); padding: 1px 5px; border-radius: 3px;
               font-size: 12px; }

/* Ablagefläche der Aufnahme */
.ablage {
  border: 2px dashed var(--rahmen); border-radius: 6px;
  padding: 40px 24px 28px; text-align: center; background: var(--akzent-flaeche);
  transition: border-color .15s, background .15s;
}
.ablage.darueber { border-color: var(--akzent); background: var(--akzent-flaeche); }
.ablage svg { width: 42px; height: 42px; color: var(--akzent); }
.ablagetext { font-size: 17px; color: var(--text-kraeftig); margin: 10px 0 4px; }
.ablageliste { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
               margin-top: 16px; }
.marke-datei { padding: 3px 10px; border-radius: 12px; font-size: 12.5px;
               background: var(--grau-hell); color: var(--text-titel);
               border: 1px solid var(--rahmen); }
.marke-datei.pdf { background: var(--akzent-flaeche); color: var(--akzent); border-color: var(--akzent-rand); }
details.block > summary { cursor: pointer; list-style: none; }
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::before { content: "▸ "; color: var(--text-leise); }
details.block[open] > summary::before { content: "▾ "; }

/* Wortmarke MobWare */
.marke { display: flex; align-items: center; gap: 10px; color: #fff;
         text-decoration: none; }
.marke .logo { width: 34px; height: 27px; }
.markenname { font-size: 17px; letter-spacing: .2px; }
.markenname strong { font-weight: 700; }
.anmeldekopf svg { width: 38px; height: 30px; }
.anmeldekopf strong { font-weight: 700; }

/* Bestandsliste: Filter und Kennzahlen enger setzen */
.bestandsfilter { padding-bottom: 12px; margin-bottom: 12px; }
.bestandsfilter .raster { gap: 12px 18px; }
.bestandsfilter .feld { margin-bottom: 0; }
.bestandsfilter .knopfreihe { margin-top: 12px; }

/* Drehen unter dem grossen Bild */
.bildleiste { display: flex; align-items: center; justify-content: space-between;
              gap: 12px; margin-top: 8px; }
.bildleiste form { display: flex; gap: 6px; }
button.drehknopf { min-height: 0; padding: 4px 12px; font-size: 15px; line-height: 1.2; }

/* Eintrag aus dem Papiere-Modul */
.lagerkasten { border: 1px solid var(--akzent-rand); background: var(--akzent-flaeche); border-radius: 3px;
               padding: 12px 14px; }
.lagerkopf { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.lagerkasten td { padding: 4px 8px 4px 0; font-size: 13.5px; }

.netzhinweis { background: var(--warn-flaeche); border: 1px solid var(--warn-rand); border-radius: 8px;
  padding: 9px 14px; margin: 0 0 16px; font-size: 13.5px; display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap; }
.netzhinweis button { padding: 3px 10px; font-size: 12.5px; }


/* ------------------------------------------------------------ Dunkelmodus
   Aktiv, wenn am <html> data-dunkel="1" gesetzt ist (Wahl über die Kopfleiste,
   gespeichert je Gerät; "System" folgt der Einstellung des Betriebssystems). */
:root[data-dunkel="1"] {
  color-scheme: dark;
  --akzent: #5bb8e3;
  --akzent-dunkel: #7cc6ea;
  --kopf: #215a76;
  --text: #c8ccd0;
  --text-kraeftig: #e4e7e9;
  --text-titel: #b4babf;
  --text-leise: #858c92;
  --icon: #8e959b;
  --grau-hell: #23272b;
  --linie: #30353a;
  --rahmen: #41474d;
  --flaeche: #1a1d20;
  --zeile-hover: #22262a;
  --fehler: #e2847b;
  --fehler-flaeche: #35221f;
  --fehler-rand: #66372f;
  --fehler-dunkel: #f0a39b;
  --warnung: #e3b25a;
  --warn-flaeche: #332b1b;
  --warn-rand: #64532d;
  --gut: #7fc47d;
  --gut-flaeche: #1d2f1f;
  --gut-rand: #355535;
  --akzent-flaeche: #1a2f3a;
  --akzent-rand: #2d566b;
}
:root[data-dunkel="1"] img { filter: brightness(.92); }
:root[data-dunkel="1"] .qr { filter: none; }       /* QR-Codes bleiben weiß hinterlegt */
:root[data-dunkel="1"] ::placeholder { color: #6f767c; }

/* Hallenplan: das SVG bringt feste Farben mit, CSS geht vor */
:root[data-dunkel="1"] .plan rect[fill="#ffffff"] { fill: var(--flaeche); stroke: var(--rahmen); }
:root[data-dunkel="1"] .plan [fill="#eef1f2"] { fill: #2a2f33; }
:root[data-dunkel="1"] .plan [fill="#d9dcde"] { fill: #353b40; }
:root[data-dunkel="1"] .plan [fill="#e8f2e8"] { fill: #1f3321; }
:root[data-dunkel="1"] .plan [stroke="#c9d0d4"] { stroke: #4a5157; }
:root[data-dunkel="1"] .plan [stroke="#9aa4aa"] { stroke: #555c62; }
:root[data-dunkel="1"] .plan text[fill="#555555"] { fill: #c8ccd0; }
:root[data-dunkel="1"] .plan text[fill="#8d8e8f"] { fill: #858c92; }

/* Umschalter in der Kopfleiste */
.darstellung { position: relative; margin-left: 14px; }
.darstellung > summary { list-style: none; cursor: pointer; display: flex; align-items: center;
  color: #fff; opacity: .9; }
.darstellung > summary::-webkit-details-marker { display: none; }
.darstellung > summary:hover { opacity: 1; }
.darstellung > summary svg { width: 20px; height: 20px; }
.darstellung .auswahl { position: absolute; right: 0; top: 34px; z-index: 40; min-width: 150px;
  background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); padding: 5px 0; }
.darstellung .auswahl a { display: block; padding: 7px 14px; color: var(--text);
  text-decoration: none; font-size: 14px; }
.darstellung .auswahl a:hover { background: var(--grau-hell); }
.darstellung .auswahl a.gewaehlt { color: var(--akzent); font-weight: 400; }
/* Einfache Links; :where hält die Regel schwach, damit Knöpfe ihre Farbe behalten */
:where(:root[data-dunkel="1"]) a { color: var(--akzent); }

/* Verlauf auf der Fahrzeugseite: ein Vorgang je Zeile, Details auf Klick */
.vorgaenge { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.vorgaenge > li { border-bottom: 1px solid var(--linie); }
.vorgaenge > li:last-child { border-bottom: 0; }
.vorgaenge summary, .vorgang-kopf { display: flex; gap: 10px; align-items: baseline;
  padding: 6px 4px; list-style: none; }
.vorgaenge summary { cursor: pointer; }
.vorgaenge summary::-webkit-details-marker { display: none; }
.vorgaenge summary:hover { background: var(--zeile-hover); }
.vorgaenge summary::after { content: "▸"; color: var(--text-leise); margin-left: auto; }
.vorgaenge details[open] > summary::after { content: "▾"; }
.vorgang-zeit { color: var(--text-leise); white-space: nowrap; min-width: 92px; }
.vorgang-wer { white-space: nowrap; min-width: 70px; }
.vorgang-was { flex: 1; min-width: 0; }
.vorgang-details { margin: 0 0 8px 106px; padding: 0; list-style: none;
  color: var(--text); font-size: 12.5px; }
.vorgang-details li { padding: 2px 0; word-break: break-word; }
.vorgang-details del { color: var(--text-leise); }
.vorgang-details ins { text-decoration: none; background: var(--gut-flaeche); padding: 0 2px; }
details.aeltere > summary { cursor: pointer; color: var(--text-leise); font-size: 12.5px;
  padding: 8px 4px 2px; }
@media (max-width: 700px) {
  .vorgang-details { margin-left: 8px; }
  .vorgang-zeit { min-width: 0; }
}

/* ---------- Anmeldung und Benutzer (12.0) ---------- */
.passkeyknopf { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.passkeyknopf svg { width: 22px; height: 22px; }
.oder { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px;
  color: var(--text-leise); font-size: 13px; }
.oder::before, .oder::after { content: ""; flex: 1; border-top: 1px solid var(--linie); }
.passwortzeile { position: relative; }
.passwortzeile input { padding-right: 88px; }
.augeknopf { position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  padding: 4px 10px; font-size: 12.5px; background: transparent; color: var(--akzent);
  border: 0; width: auto !important; }
.augeknopf:hover { background: var(--akzent-flaeche); }
.feststell { margin: 6px 0 0; font-size: 13px; color: var(--warnung); }
.bleiben { margin: 2px 0 14px; font-size: 14px; }
.schmal { max-width: 560px; }
.pwregeln { list-style: none; margin: -4px 0 14px; padding: 0; font-size: 13.5px; color: var(--text-leise); }
.pwregeln li { padding: 1px 0 1px 22px; position: relative; }
.pwregeln li::before { content: "○"; position: absolute; left: 2px; }
.pwregeln li.erfuellt { color: var(--gut); }
.pwregeln li.erfuellt::before { content: "✓"; }
.einmalbox { border: 2px solid var(--akzent); background: var(--akzent-flaeche); border-radius: 8px;
  padding: 16px 20px; margin: 0 0 20px; }
.einmalbox h2 { margin: 0 0 6px; font-size: 18px; }
.einmalbox p { margin: 0 0 10px; }
.einmalwert { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.einmalwert code { font-size: 22px; letter-spacing: .06em; background: var(--flaeche);
  padding: 6px 14px; border-radius: 6px; border: 1px solid var(--akzent-rand); user-select: all; }
.benutzerliste tr.inaktiv td { opacity: .55; }
.benutzerliste select { width: auto; padding: 4px 8px; }
details.aktionen { position: relative; }
details.aktionen summary { cursor: pointer; color: var(--akzent); font-size: 13.5px; list-style: none; }
details.aktionen summary::-webkit-details-marker { display: none; }
.aktionsliste { position: absolute; right: 0; top: 24px; z-index: 30; background: var(--flaeche);
  border: 1px solid var(--rahmen); border-radius: 6px; padding: 6px; min-width: 230px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 4px; }
.aktionsliste button { width: 100%; text-align: left; font-size: 13.5px; padding: 6px 10px; }
table.kompakt td, table.kompakt th { padding: 6px 8px; font-size: 13.5px; }
button.klein { font-size: 12.5px; padding: 4px 12px; }
.knopf.aktiv { border-color: var(--akzent); color: var(--akzent); }
.benutzerleiste a[href="/konto"] { border-bottom: 0; }

/* ---------- Scanner (12.1) ---------- */
.scanknopf { display: flex; align-items: center; gap: 6px; color: #fff; text-decoration: none;
  font-size: 14px; padding: 5px 10px; border: 1px solid rgba(255,255,255,.55); border-radius: 4px; }
.scanknopf:hover { background: rgba(255,255,255,.16); }
.scanknopf svg { width: 20px; height: 20px; }
.scanfenster { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.scanfenster[hidden] { display: none; }
.scankarte { background: var(--flaeche); border-radius: 10px; width: 100%; max-width: 460px;
  padding: 14px 16px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.scankopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.scankopf button { padding: 4px 12px; font-size: 13px; }
.scanbild { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.scanbild video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanrahmen { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9);
  border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); }
.scanmeldung { min-height: 20px; margin: 10px 0; font-size: 14px; color: var(--text-leise); }
body.scan-offen { overflow: hidden; }
.qrcode-text { font: 500 13px ui-monospace, Menlo, monospace; letter-spacing: .05em;
  color: var(--text-leise); margin-top: 4px; }

/* ======================================================= Dashboard (12.2) */
body:has(.db) .seitenkopf { display: none; }
body:has(.db) .bereich { background: var(--db-grund); padding-top: 16px; padding-bottom: 16px; min-height: calc(100vh - var(--leiste)); }
:root { --db-grund: #f3f5f7; --db-schatten: 0 1px 2px rgba(20, 40, 60, .05), 0 4px 14px rgba(20, 40, 60, .04); }
:root[data-dunkel="1"] { --db-grund: #15181b; --db-schatten: none; }
.db { max-width: 1480px; margin: 0 auto; }
.db-kopf { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; margin: 0 0 14px; }
.db-gruss { font-size: 23px; font-weight: 300; margin: 0; color: var(--text-kraeftig); }
.db-datum { margin: 2px 0 0; color: var(--text-leise); font-size: 14px; }
.db-schnell { display: flex; gap: 10px; }
.db-schnell .knopf { padding: 8px 16px; font-size: 14px; }

.db-kennzahlen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 14px; }
.db-kz, .db-karte { background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 12px; box-shadow: var(--db-schatten); }
.db-kz { display: flex; flex-direction: column; gap: 5px; padding: 13px 18px 13px;
  text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.db-kz:hover { border-color: var(--akzent-rand); transform: translateY(-1px); }
.db-kz-titel { font-size: 13px; color: var(--text-leise); letter-spacing: .01em; }
.db-kz-wert { font-size: 31px; line-height: 1.05; color: var(--text-kraeftig); font-weight: 300;
  font-variant-numeric: tabular-nums; }
.db-kz-wert small { font-size: 14px; color: var(--text-leise); margin-left: 7px; }
.db-kz-zusatz { font-size: 13px; color: var(--text); }
.db-kz-zusatz b { font-weight: 700; }
.db-kz-zusatz b.plus { color: var(--akzent-dunkel); }
.db-kz-zusatz b.warn, .db-mini b.warn { color: var(--warnung); }
.db .leise { color: var(--text-leise); }
.db-balken { display: block; height: 6px; border-radius: 3px; background: var(--akzent-flaeche);
  overflow: hidden; margin: 2px 0 1px; }
.db-balken i { display: block; height: 100%; border-radius: 3px; background: var(--akzent); }

.db-raster { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 14px;
  align-items: start; }
.db-karte { padding: 14px 18px; }
.db-karte-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 0 0 8px; flex-wrap: wrap; }
.db-karte-kopf h2 { font-size: 16px; font-weight: 400; margin: 0; color: var(--text-kraeftig); }
.db-karte-kopf .leise { font-size: 12.5px; }
.db-zahl { font-size: 12px; font-weight: 700; color: #fff; background: var(--fehler);
  border-radius: 10px; padding: 1px 8px; }
.db-bereiche { display: flex; gap: 6px; flex-wrap: wrap; }
.db-bereiche a { font-size: 12.5px; color: var(--text); text-decoration: none; padding: 3px 10px;
  border: 1px solid var(--linie); border-radius: 14px; background: var(--grau-hell); }
.db-bereiche a:hover { border-color: var(--akzent); color: var(--akzent-dunkel); }
.db-bereiche b { font-weight: 700; color: var(--text-kraeftig); }
.db-plan .plan { display: flex; justify-content: center; }
.db-plan .plan svg { width: 100%; height: auto; max-height: calc(100vh - 398px); min-height: 280px; }
.db-legende { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text);
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--linie); }
.db-legende i { display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px; }
.db-legende i.belegt { background: #58b5e1; }
.db-legende i.frei { background: #eef2f5; border: 1px solid var(--rahmen); }

.db-seite { display: flex; flex-direction: column; gap: 14px; }
.db-liste { list-style: none; margin: 0 -8px; padding: 0; }
.db-liste a { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 14px; }
.db-liste a:hover { background: var(--grau-hell); }
.db-liste .punkt { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--akzent); }
.db-liste .stufe-gefahr .punkt { background: var(--fehler); }
.db-liste .stufe-warn .punkt { background: var(--warnung); }
.db-liste .text { flex: 1; min-width: 0; }
.db-liste b { font-weight: 700; color: var(--text-kraeftig); font-variant-numeric: tabular-nums; }
.db-liste .stufe-gefahr b { color: var(--fehler); }
.db-liste .pfeil { color: var(--text-leise); font-size: 18px; line-height: 1; }
.db-alles { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--gut-flaeche);
  color: var(--gut); font-size: 14px; }

.db-saeulen { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; height: 96px;
  align-items: end; }
.db-saeulen > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%; gap: 4px; }
.db-saeulen i { display: block; width: 100%; max-width: 30px; min-height: 3px; border-radius: 5px 5px 2px 2px;
  background: var(--akzent-rand); }
.db-saeulen .jetzt i { background: var(--akzent); }
.db-saeulen .wert { font-size: 11.5px; color: var(--text-leise); font-variant-numeric: tabular-nums; }
.db-saeulen .jetzt .wert { color: var(--akzent-dunkel); font-weight: 700; }
.db-saeulen .kw { font-size: 11px; color: var(--text-leise); }
.db-kategorien { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--linie); font-size: 13px; color: var(--text); }
.db-kategorien b { font-weight: 700; color: var(--text-kraeftig); }

.db-kategorien a { color: var(--text); text-decoration: none; }
.db-kategorien a:hover { color: var(--akzent-dunkel); }
.db-mini { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 12.5px; }
.db-mini a { color: var(--text-leise); text-decoration: none; }
.db-mini a:hover { color: var(--akzent-dunkel); }
.db-mini b { font-weight: 700; color: var(--text-kraeftig); }
.db-mehr summary { cursor: pointer; font-size: 13px; color: var(--akzent-dunkel); padding: 4px 0 0;
  list-style: none; }
.db-mehr summary::-webkit-details-marker { display: none; }
.db-mehr summary::before { content: "+ "; }
.db-mehr[open] summary { display: none; }

@media (max-width: 1100px) {
  .db-kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-raster { grid-template-columns: 1fr; }
  .db-plan .plan svg { max-height: none; }
}
@media (max-width: 560px) {
  .db-kz-wert { font-size: 28px; }
  .db-kennzahlen { gap: 10px; }
  .db-schnell { width: 100%; } .db-schnell .knopf { flex: 1; text-align: center; }
}
/* Hallenplan im Dunkelmodus: blauer Zwischenlager-Bereich */
:root[data-dunkel="1"] .plan [fill="#e6f4fb"] { fill: #1a2f3a; }
:root[data-dunkel="1"] .plan [fill="#eef2f5"] { fill: #2a2f33; }
:root[data-dunkel="1"] .db-legende i.frei { background: #2a2f33; }
