/* =============================================================
   SafePlan – Gestaltung

   Leitgedanke: ein Prüfinstrument, kein Dashboard.
   Hohe Informationsdichte, ruhige Flächen, Zahlen die stehen.

   Schrift: Fira Sans / Fira Mono (Erik Spiekermann) – auf
   Lesbarkeit unter schlechten Bedingungen ausgelegt.
   ============================================================= */

:root {
  --papier:        #f4f6f4;
  --karte:         #ffffff;
  --tinte:         #14211b;
  --tinte-schwach: #5d6b63;
  --tinte-zart:    #8b978f;
  --linie:         #dce1dc;
  --linie-zart:    #eceeec;

  --gruen:         #009842;
  --gruen-hell:    #e4f4ea;
  --rot:           #c0362c;
  --rot-hell:      #fbeae8;
  --bernstein:     #a86b00;
  --gelb:          #ffc82a;
  --gelb-hell:     #fff6dd;

  --radius:        3px;
  --spalte:        1.5rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: 'Fira Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: 'tnum' 1;
}

a { color: var(--gruen); }

:focus-visible {
  outline: 2px solid var(--gruen);
  outline-offset: 2px;
}

/* ---------- Kopfzeile ---------- */

.kopfzeile {
  display: flex;
  align-items: center;
  gap: var(--spalte);
  padding: 0 1.25rem;
  height: 54px;
  background: var(--tinte);
  color: #fff;
}

.marke {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: #fff;
}

.marke-plakette {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--gruen);
  background:
    repeating-conic-gradient(var(--gruen) 0 4deg, transparent 4deg 15deg);
}

.marke-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.015em;
}

.hauptnavigation {
  display: flex;
  gap: 1.25rem;
  margin-left: 1rem;
  flex: 1;
}

.hauptnavigation a {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: .35rem 0;
  border-bottom: 2px solid transparent;
}

.hauptnavigation a:hover { color: #fff; }

.hauptnavigation a.ist-aktiv {
  color: #fff;
  border-bottom-color: var(--gruen);
}

.benutzerleiste {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .8125rem;
}

.benutzername { color: rgba(255,255,255,.9); }

.rollenschild {
  font-family: 'Fira Mono', monospace;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .1rem .4rem;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--radius);
  color: rgba(255,255,255,.75);
}

.abmelden {
  color: rgba(255,255,255,.72);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.3);
}

.abmelden:hover { color: #fff; }

/* ---------- Inhalt ---------- */

.inhalt {
  width: 100%;
  padding: 1.5rem 1.25rem 3rem;
}

.seitenkopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.seitentitel {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.seitenhinweis {
  margin: .15rem 0 0;
  color: var(--tinte-schwach);
  font-size: .875rem;
}

/* ---------- Kennzahlen ---------- */

.kennzahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--linie);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.kennzahl {
  background: var(--karte);
  padding: .85rem 1rem;
}

.kennzahl-wert {
  font-family: 'Fira Mono', monospace;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.kennzahl-titel {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  margin-top: .2rem;
}

.kennzahl--warnung .kennzahl-wert { color: var(--rot); }
.kennzahl--achtung .kennzahl-wert { color: var(--bernstein); }

/* ---------- Filter ---------- */

.filterleiste {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  align-items: flex-end;
}

.feld {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.feld-titel {
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  font-weight: 500;
}

.feld input,
.feld select {
  font-family: inherit;
  font-size: .875rem;
  color: var(--tinte);
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .4rem .55rem;
  min-width: 150px;
}

.feld input:focus,
.feld select:focus { border-color: var(--gruen); outline: none; }

.knopf {
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--tinte);
  background: var(--tinte);
  color: #fff;
  cursor: pointer;
}

.knopf:hover { background: #000; }

.knopf--leise {
  background: transparent;
  color: var(--tinte-schwach);
  border-color: var(--linie);
  text-decoration: none;
  display: inline-block;
}

.knopf--leise:hover { border-color: var(--tinte-zart); color: var(--tinte); }

/* ---------- Tabelle ---------- */

.tabellenrahmen {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow-x: auto;
}

.liste {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.liste thead th {
  text-align: left;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  font-weight: 600;
  padding: .6rem .7rem;
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
  background: var(--karte);
  position: sticky;
  top: 0;
}

.liste tbody td {
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--linie-zart);
  vertical-align: middle;
}

.liste tbody tr:last-child td { border-bottom: none; }
.liste tbody tr:hover td { background: #fafbfa; }

.zahl {
  font-family: 'Fira Mono', monospace;
  text-align: right;
  white-space: nowrap;
}

.stark  { font-weight: 600; }
.leise  { color: var(--tinte-schwach); }
.knapp  { white-space: nowrap; }

.tage--ueberfaellig { color: var(--rot); font-weight: 600; }
.tage--bald         { color: var(--bernstein); font-weight: 600; }

/* ---------- Die Prüfplakette ----------
   Das Erkennungszeichen: dieselbe Bildsprache wie die Marke,
   die der Techniker auf das geprüfte Gerät klebt.           */

.plakette {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid currentColor;
  font-family: 'Fira Mono', monospace;
  line-height: 1;
  position: relative;
}

.plakette::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    currentColor 0 2.5deg, transparent 2.5deg 30deg);
  opacity: .35;
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
          mask: radial-gradient(circle, transparent 62%, #000 63%);
}

.plakette-monat {
  font-size: .875rem;
  font-weight: 700;
  position: relative;
}

.plakette-jahr {
  font-size: .5625rem;
  opacity: .75;
  margin-top: 1px;
  position: relative;
}

.plakette--ueberfaellig { color: var(--rot);       background: var(--rot-hell); }
.plakette--bald         { color: var(--bernstein); background: var(--gelb-hell); }
.plakette--zukunft      { color: var(--gruen);     background: var(--gruen-hell); }

.plakette--keine {
  color: var(--tinte-zart);
  background: transparent;
  border-style: dashed;
  font-size: .875rem;
}

.plakette--keine::before { display: none; }

/* ---------- Leerer Zustand ---------- */

.leer {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--tinte-schwach);
}

.leer-titel {
  font-weight: 600;
  color: var(--tinte);
  margin-bottom: .3rem;
}

/* ---------- Anmeldeseite ---------- */

.anmeldung {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    linear-gradient(var(--papier), var(--papier)) padding-box,
    var(--papier);
}

.anmeldekarte {
  width: 100%;
  max-width: 380px;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 2rem;
}

.anmeldekopf {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: .35rem;
}

.anmeldekopf .marke-plakette {
  width: 26px;
  height: 26px;
  border-width: 3px;
}

.anmeldetitel {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.anmeldehinweis {
  color: var(--tinte-schwach);
  font-size: .875rem;
  margin: 0 0 1.5rem;
}

.anmeldefeld { margin-bottom: 1rem; }

.anmeldefeld label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  font-weight: 500;
  margin-bottom: .3rem;
}

.anmeldefeld input {
  width: 100%;
  font-family: inherit;
  font-size: .9375rem;
  padding: .55rem .7rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte);
}

.anmeldefeld input:focus { border-color: var(--gruen); outline: none; }

.knopf--breit { width: 100%; padding: .6rem; font-size: .9375rem; }

.meldung {
  padding: .65rem .8rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid;
}

.meldung--fehler  { background: var(--rot-hell);   border-color: #f0c9c5; color: var(--rot); }
.meldung--erfolg  { background: var(--gruen-hell); border-color: #bfe4cd; color: #04713a; }
.meldung--hinweis { background: var(--gelb-hell);  border-color: #f2dfa8; color: var(--bernstein); }

/* ---------- Fußzeile ---------- */

.fusszeile {
  text-align: center;
  padding: 1.5rem;
  color: var(--tinte-zart);
  font-size: .75rem;
}

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 960px) {
  .spalte-optional { display: none; }
  .kopfzeile { gap: .75rem; padding: 0 .75rem; }
  .benutzername { display: none; }
  .inhalt { padding: 1.25rem .75rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* =============================================================
   Ergänzungen: Benutzerverwaltung und Formulare
   ============================================================= */

.mono {
  font-family: 'Fira Mono', monospace;
  font-size: .8125rem;
}

.abschnittstitel {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 2rem 0 .75rem;
}

.abschnittstitel--erste { margin-top: 0; }

/* ---------- Schilder ---------- */

.schild {
  display: inline-block;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .15rem .45rem;
  border-radius: var(--radius);
  border: 1px solid;
  white-space: nowrap;
}

.schild--admin   { background: #eceafb; border-color: #d3cef4; color: #4b3fa8; }
.schild--planer  { background: var(--gruen-hell); border-color: #bfe4cd; color: #04713a; }
.schild--ablesen { background: #eef1ef; border-color: var(--linie); color: var(--tinte-schwach); }
.schild--ok      { background: var(--gruen-hell); border-color: #bfe4cd; color: #04713a; }
.schild--warnung { background: var(--gelb-hell);  border-color: #f2dfa8; color: var(--bernstein); }
.schild--aus     { background: #eef1ef; border-color: var(--linie); color: var(--tinte-zart); }

.hinweisschild {
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 0 .3rem;
  margin-left: .35rem;
  vertical-align: 1px;
}

/* ---------- Formularkarten ---------- */

.formularkarte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.formularkarte--gefahr { border-color: #f0c9c5; }

.formularraster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.formularraster .feld input,
.formularraster .feld select { width: 100%; min-width: 0; }

.feld--knopf { justify-content: flex-end; }

.formularhinweis {
  font-size: .8125rem;
  color: var(--tinte-schwach);
  margin: 0;
  max-width: 62ch;
}

.inline-formular { display: inline-block; margin-left: .5rem; }

.schalter {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .875rem;
  padding-bottom: .45rem;
  cursor: pointer;
}

.schalter input { width: 16px; height: 16px; accent-color: var(--gruen); }

/* ---------- Knöpfe: Varianten ---------- */

.knopf--klein {
  font-size: .75rem;
  padding: .25rem .6rem;
  text-decoration: none;
  display: inline-block;
  background: transparent;
  color: var(--tinte);
  border-color: var(--linie);
}

.knopf--klein:hover { border-color: var(--tinte-zart); background: #fafbfa; }

.knopf--gefahr {
  background: var(--rot);
  border-color: var(--rot);
  color: #fff;
}

.knopf--gefahr:hover { background: #a32c23; border-color: #a32c23; }

/* ---------- Datenliste ---------- */

.datenliste { margin: 0 0 1rem; }

.datenzeile {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--linie-zart);
}

.datenzeile:last-child { border-bottom: none; }

.datenzeile dt {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  font-weight: 500;
  padding-top: .12rem;
}

.datenzeile dd { margin: 0; font-size: .9375rem; }

/* ---------- Rollenübersicht ---------- */

.rollenuebersicht { margin-top: 2rem; }

.rollenliste {
  margin: 0;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
}

.rolleneintrag {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 1rem;
  padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--linie-zart);
  align-items: baseline;
}

.rolleneintrag:last-child { border-bottom: none; }
.rolleneintrag dt { margin: 0; }
.rolleneintrag dd { margin: 0; font-size: .875rem; color: var(--tinte-schwach); }

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 700px) {
  .datenzeile,
  .rolleneintrag { grid-template-columns: 1fr; gap: .2rem; }
  .formularraster { grid-template-columns: 1fr; }
}

/* =============================================================
   Ergänzungen: Spaltenfilter, Sortierung, Tabellenfuß
   ============================================================= */

.filterhinweis {
  flex-basis: 100%;
  margin: .35rem 0 0;
  font-size: .75rem;
  color: var(--tinte-zart);
}

/* ---------- Filterzeile im Tabellenkopf ---------- */

.kopfzeile-filter th {
  padding: .35rem .4rem .5rem;
  background: #fbfcfb;
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 33px;
  z-index: 2;
}

.kopfzeile-filter input,
.kopfzeile-filter select {
  width: 100%;
  min-width: 90px;
  font-family: inherit;
  font-size: .75rem;
  color: var(--tinte);
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .22rem .35rem;
}

.kopfzeile-filter input:focus,
.kopfzeile-filter select:focus {
  border-color: var(--gruen);
  outline: none;
}

.kopfzeile-filter input::placeholder { color: var(--tinte-zart); }

/* Kopfzeile bleibt beim Scrollen stehen */
.liste--filterbar thead th { z-index: 2; }
.liste--filterbar .kopfzeile-titel th { top: 0; }

/* ---------- Sortierbare Spaltenköpfe ---------- */

.sortierbar {
  cursor: pointer;
  user-select: none;
  padding-right: 1.1rem !important;
  position: relative;
}

.sortierbar:hover { color: var(--tinte); }

.sortierbar::after {
  content: '';
  position: absolute;
  right: .45rem;
  top: 50%;
  transform: translateY(-50%);
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid var(--linie);
}

.sortierbar.sortiert-auf::after {
  border-top: none;
  border-bottom: 4px solid var(--gruen);
}

.sortierbar.sortiert-ab::after {
  border-top: 4px solid var(--gruen);
}

.spalte-plakette { width: 54px; }

/* ---------- Tabellenfuß ---------- */

.tabellenfuss {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .2rem 0;
  font-size: .8125rem;
  color: var(--tinte-schwach);
}

.tabellenfuss #trefferzahl {
  font-family: 'Fira Mono', monospace;
  margin-right: auto;
}

@media (max-width: 700px) {
  .tabellenfuss { flex-wrap: wrap; }
}

/* =============================================================
   Ergänzungen: Prüfart-Tags und Ansichtswahl
   ============================================================= */

/* ---------- Kürzel-Tags ---------- */

.art-tag {
  display: inline-block;
  font-family: 'Fira Mono', monospace;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.5;
  padding: .05rem .35rem;
  border: 1px solid;
  border-radius: var(--radius);
  white-space: nowrap;
  cursor: default;
}

.art-tag--ueberfaellig { background: var(--rot-hell);   border-color: #e8b5b0; color: var(--rot); }
.art-tag--bald         { background: var(--gelb-hell);  border-color: #eed69a; color: var(--bernstein); }
.art-tag--zukunft      { background: var(--gruen-hell); border-color: #b3ddc4; color: #04713a; }
.art-tag--neutral      { background: #eef1ef;           border-color: var(--linie); color: var(--tinte-schwach); }

.art-tag--gross {
  font-size: .8125rem;
  padding: .1rem .45rem;
  vertical-align: 2px;
  margin-right: .3rem;
}

.spalte-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  max-width: 320px;
}

/* ---------- Umschalter der Ansicht ---------- */

.ansichtswahl {
  display: inline-flex;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--karte);
}

.ansichtswahl a {
  padding: .4rem .85rem;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--tinte-schwach);
  text-decoration: none;
  border-right: 1px solid var(--linie);
}

.ansichtswahl a:last-child { border-right: none; }
.ansichtswahl a:hover      { background: #fafbfa; color: var(--tinte); }

.ansichtswahl a.ist-aktiv {
  background: var(--tinte);
  color: #fff;
}

/* ---------- Schalterreihe in Formularen ---------- */

.schalterreihe {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: .5rem 0 1rem;
  border-top: 1px solid var(--linie-zart);
  margin-top: .25rem;
}

.schalterreihe .schalter { padding-bottom: 0; }

/* ---------- Inaktive Zeilen ---------- */

.zeile--inaktiv td { opacity: .55; }

/* =============================================================
   Ergänzungen: Tourenplaner
   ============================================================= */

.sr-nur {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.zeitraumleiste {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
}

/* ---------- Zweispaltiger Aufbau ---------- */

.planer {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 1px;
  background: var(--linie);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.planer-karte {
  background: var(--karte);
  position: relative;
  min-height: 520px;
}

#karte {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.planer-spalte {
  background: var(--karte);
  padding: 1rem;
  max-height: 640px;
  overflow-y: auto;
}

.planer-block { margin-bottom: 1rem; }

.vollbreit {
  width: 100%;
  font-family: inherit;
  font-size: .875rem;
  padding: .4rem .55rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte);
  margin-top: .25rem;
}

/* ---------- Kartenlegende ---------- */

.kartenlegende {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 400;
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .35rem .6rem;
  font-size: .6875rem;
  color: var(--tinte-schwach);
}

.legendenpunkt {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: .25rem;
  vertical-align: -1px;
}

.legendenpunkt--ueberfaellig { background: var(--rot); }
.legendenpunkt--bald         { background: var(--gelb); }
.legendenpunkt--zukunft      { background: var(--gruen); }
.legendenpunkt--start        { background: var(--tinte); }

/* ---------- Kartenpunkte ---------- */

.kartenpunkt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  font-weight: 700;
  color: #fff;
}

.kartenpunkt--ueberfaellig { background: var(--rot); }
.kartenpunkt--bald         { background: #d99b00; }
.kartenpunkt--zukunft      { background: var(--gruen); }
.kartenpunkt--start        { background: var(--tinte); font-size: .8125rem; }

.kartenpunkt.ist-gewaehlt {
  width: 26px; height: 26px;
  border-width: 3px;
  font-size: .75rem;
  box-shadow: 0 0 0 3px rgba(20,33,27,.18), 0 2px 5px rgba(0,0,0,.35);
}

.popup-kunde  { color: #5d6b63; font-size: .75rem; }
.popup-zahlen { font-family: 'Fira Mono', monospace; font-size: .75rem; color: #5d6b63; }

/* ---------- Tourbilanz ---------- */

.tourbilanz {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  margin-bottom: .85rem;
}

.bilanzzeile {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .4rem .7rem;
  border-bottom: 1px solid var(--linie-zart);
  font-size: .8125rem;
  color: var(--tinte-schwach);
}

.bilanzzeile:last-child { border-bottom: none; }

.bilanzzeile strong {
  font-family: 'Fira Mono', monospace;
  font-size: .9375rem;
  color: var(--tinte);
  font-weight: 500;
}

.bilanzzeile--gesamt { background: #fafbfa; }
.bilanzzeile--gesamt strong { color: var(--gruen); font-weight: 700; }

.planer-knoepfe {
  display: flex;
  gap: .5rem;
  margin-bottom: .6rem;
}

.planer-knoepfe .knopf { flex: 1; }

.genauigkeitshinweis {
  font-size: .6875rem;
  color: var(--tinte-zart);
  line-height: 1.45;
  margin: 0 0 .5rem;
}

/* ---------- Tourliste ---------- */

.tourliste {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.tourliste-leer {
  padding: .9rem .7rem;
  font-size: .8125rem;
  color: var(--tinte-zart);
  line-height: 1.45;
}

.toureintrag {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .55rem;
  border-bottom: 1px solid var(--linie-zart);
}

.toureintrag:last-child { border-bottom: none; }
.toureintrag:hover { background: #fafbfa; }

.tournummer {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--tinte);
  color: #fff;
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tourtext { flex: 1; min-width: 0; }

.tourname {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tourort {
  display: block;
  font-size: .6875rem;
  color: var(--tinte-zart);
}

.tourknoepfe { display: flex; gap: .1rem; }

.tourknoepfe button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--tinte-zart);
  cursor: pointer;
  width: 20px; height: 20px;
  border-radius: var(--radius);
  font-size: .8125rem;
  line-height: 1;
  padding: 0;
}

.tourknoepfe button:hover {
  border-color: var(--linie);
  color: var(--tinte);
  background: var(--karte);
}

/* ---------- Auswahl in der Liste ---------- */

.spalte-auswahl { width: 34px; text-align: center; }
.spalte-auswahl input { width: 15px; height: 15px; accent-color: var(--gruen); cursor: pointer; }

#standortliste tbody tr { cursor: pointer; }

.zeile--gewaehlt td { background: var(--gruen-hell) !important; }
.zeile--gewaehlt .stark { color: #04713a; }

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 1100px) {
  .planer { grid-template-columns: 1fr; }
  .planer-karte { min-height: 380px; }
  .planer-spalte { max-height: none; }
}

.quelle {
  display: block;
  margin-top: .2rem;
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  letter-spacing: .04em;
  color: var(--tinte-zart);
}

/* =============================================================
   Ergänzungen: Stammdatenpflege
   ============================================================= */

.kopfknoepfe { display: flex; gap: .5rem; }

textarea.vollbreit {
  font-family: inherit;
  font-size: .875rem;
  line-height: 1.45;
  resize: vertical;
}

/* Eingabefelder direkt in Tabellenzellen */
.zellenfeld {
  width: 80px;
  font-family: 'Fira Mono', monospace;
  font-size: .8125rem;
  text-align: right;
  padding: .2rem .35rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte);
}

.zellenfeld--breit { width: 135px; text-align: left; }

.zellenfeld:focus { border-color: var(--gruen); outline: none; }
.zellenfeld[readonly] { background: #f6f7f6; color: var(--tinte-schwach); }

/* Zeilen mit nicht zugeordneten Prüfarten treten zurück,
   bleiben aber bedienbar */
.zeile--inaktiv .zellenfeld { opacity: 1; }

.meldung form,
form.meldung {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

/* =============================================================
   Ergänzung: Navigation mit Klappmenü

   Die Kopfzeile trägt nur so viele Punkte, wie sicher passen.
   Alles zur Einrichtung liegt unter "Verwaltung".
   ============================================================= */

.hauptnavigation {
  align-items: center;
  min-width: 0;
  overflow: visible;
}

.hauptnavigation > a { white-space: nowrap; flex: 0 0 auto; }

.menuklappe { position: relative; flex: 0 0 auto; }

.menuklappe > summary {
  list-style: none;
  cursor: pointer;
  color: rgba(255,255,255,.72);
  font-size: .875rem;
  font-weight: 500;
  padding: .35rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.menuklappe > summary::-webkit-details-marker { display: none; }

.menuklappe > summary::after {
  content: '';
  display: inline-block;
  margin-left: .35rem;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor;
  vertical-align: 2px;
}

.menuklappe > summary:hover { color: #fff; }

.menuklappe.ist-aktiv > summary {
  color: #fff;
  border-bottom-color: var(--gruen);
}

.menuklappe[open] > summary { color: #fff; }

.menuklappe-inhalt {
  position: absolute;
  top: calc(100% + .55rem);
  left: -.6rem;
  z-index: 900;
  min-width: 190px;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
  padding: .3rem;
  display: flex;
  flex-direction: column;
}

.menuklappe-inhalt a {
  padding: .45rem .6rem;
  font-size: .875rem;
  color: var(--tinte);
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
}

.menuklappe-inhalt a:hover { background: #f2f4f2; }

.menuklappe-inhalt a.ist-aktiv {
  background: var(--gruen-hell);
  color: #04713a;
  font-weight: 600;
}

@media (max-width: 820px) {
  .hauptnavigation { gap: .85rem; margin-left: .5rem; }
  .hauptnavigation > a,
  .menuklappe > summary { font-size: .8125rem; }
  .rollenschild { display: none; }
}

/* Klappmenü schließt sich beim Klick daneben – geregelt in menue.js */

/* =============================================================
   Arbeitsfläche: Liste ist die Hauptsache, Karte begleitet

   Bei hunderten Standorten ist die Liste das Werkzeug und die
   Karte die Orientierung – nicht umgekehrt.
   ============================================================= */

.seitenkopf--schmal { margin-bottom: .9rem; }

.kw-marke {
  font-family: 'Fira Mono', monospace;
  font-size: .8125rem;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .05rem .35rem;
}

.schnellwahl {
  display: flex;
  gap: .3rem;
  margin-right: .5rem;
}

.schnellwahl a {
  font-size: .75rem;
  padding: .3rem .55rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte-schwach);
  text-decoration: none;
  white-space: nowrap;
}

.schnellwahl a:hover { border-color: var(--gruen); color: var(--gruen); }

.arbeitsflaeche {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 480px;
  gap: 1.25rem;
  align-items: start;
}

.arbeitsflaeche-seite {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.kartenfeld {
  position: relative;
  height: 300px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--karte);
}

#karte { position: absolute; inset: 0; z-index: 1; }

.kartenlegende {
  font-size: .625rem;
  gap: .5rem;
  padding: .25rem .45rem;
}

/* ---------- Prüfart-Matrix ----------
   Feste Positionen: gleiche Spalte heißt immer gleiche Prüfart.
   Dadurch lässt sich die Liste senkrecht scannen.               */

/* Die Kürzel stehen dicht nebeneinander. Die Reihenfolge folgt
   dem Katalog, damit die Zeile trotzdem lesbar bleibt. */
.matrix {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.matrix--leer { color: var(--tinte-zart); }

.mz {
  font-family: 'Fira Mono', monospace;
  font-size: .5625rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 14px;
  height: 14px;
  padding: 0 3px;
  min-width: 20px;
  text-align: center;
  border-radius: 2px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: default;
}

/* Trennt Fälliges von bloß Zugeordnetem */
.mz-trenner {
  display: inline-block;
  width: 1px;
  height: 12px;
  background: var(--linie);
  margin: 0 3px;
}

.mz--ueberfaellig { background: var(--rot);       color: #fff; }
.mz--bald         { background: var(--gelb);      color: #4a3400; }
.mz--zukunft      { background: var(--gruen);     color: #fff; }
.mz--ruhend       { background: #eef1ef; color: var(--tinte-zart); border-color: #e2e6e3; }

.spalte-matrix { width: 230px; }

.matrixlegende {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .6875rem;
  color: var(--tinte-zart);
  margin-right: auto;
  flex-wrap: wrap;
}

.matrixlegende .mz { width: 26px; margin-left: .5rem; }
.matrixlegende .mz:first-child { margin-left: 0; }

/* ---------- Dichtere Tabelle ---------- */

.liste--dicht tbody td { padding: .3rem .55rem; }
.liste--dicht thead th { padding: .45rem .55rem; }
.liste--dicht .kopfzeile-filter th { top: 30px; }

/* ---------- Summenzeile ---------- */

.summenzeile td {
  position: sticky;
  bottom: 0;
  background: #f4f6f4;
  border-top: 2px solid var(--linie);
  padding: .5rem .55rem;
  font-size: .8125rem;
}

.summenzeile #trefferzahl {
  font-family: 'Fira Mono', monospace;
  color: var(--tinte-schwach);
}

.summenzeile-auswahl {
  font-family: 'Fira Mono', monospace;
  color: var(--gruen);
  font-weight: 700;
  margin-left: .5rem;
}

/* ---------- Karten-Cluster ---------- */

.kartencluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  position: relative;
}

.kartencluster--ueberfaellig { background: var(--rot); }
.kartencluster--bald         { background: #d99b00; }
.kartencluster--zukunft      { background: var(--gruen); }

.kartencluster.hat-auswahl { box-shadow: 0 0 0 3px rgba(20,33,27,.3), 0 1px 4px rgba(0,0,0,.35); }

.kartencluster em {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--tinte);
  color: #fff;
  font-style: normal;
  font-size: .5625rem;
  line-height: 15px;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  padding: 0 3px;
  border: 2px solid #fff;
}

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 1200px) {
  .arbeitsflaeche { grid-template-columns: 1fr; }
  .arbeitsflaeche-seite { position: static; }
  .kartenfeld { height: 340px; }
  .spalte-matrix { width: auto; }
}

/* =============================================================
   Wochensteuerung und Tourenanlage
   ============================================================= */

.wochenleiste {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  margin-bottom: 1rem;
}

.wochenwahl { display: flex; align-items: center; gap: .5rem; }

.wochenpfeil {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  color: var(--tinte);
  text-decoration: none;
  font-size: 1.05rem;
  line-height: 1;
}

.wochenpfeil:hover { border-color: var(--gruen); color: var(--gruen); }

.wochenform { display: flex; align-items: center; gap: .35rem; }

.wochentitel {
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
}

.wocheneingabe {
  width: 58px;
  font-family: 'Fira Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  padding: .2rem .3rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  color: var(--tinte);
  background: var(--karte);
}

.wocheneingabe--jahr { width: 68px; font-size: .8125rem; font-weight: 400; }

.wochenspanne {
  font-family: 'Fira Mono', monospace;
  font-size: .8125rem;
  color: var(--tinte-schwach);
}

.horizontwahl { display: flex; align-items: center; gap: .45rem; }

.horizontwahl select {
  font-family: inherit;
  font-size: .8125rem;
  padding: .25rem .4rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte);
}

.wochentouren {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.tourchip {
  display: flex;
  flex-direction: column;
  padding: .2rem .5rem;
  border: 1px solid var(--linie);
  border-left-width: 3px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--tinte);
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  line-height: 1.3;
}

.tourchip span { font-size: .625rem; color: var(--tinte-zart); font-family: 'Fira Sans', sans-serif; }
.tourchip:hover { background: #fafbfa; }

.tourchip--entwurf       { border-left-color: var(--tinte-zart); }
.tourchip--geplant       { border-left-color: var(--gruen); }
.tourchip--versendet     { border-left-color: var(--bernstein); }
.tourchip--abgeschlossen { border-left-color: var(--linie); opacity: .65; }

/* ---------- Breitere Karte, schmalere Tabelle ----------
   Breite und Höhe der Karte stehen weiter oben bei
   .arbeitsflaeche und .kartenfeld. Hier standen sie ein
   zweites Mal und haben den dortigen Wert überschrieben. */

.spalte-tage  { width: 52px; }
.spalte-ort   { width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spalte-kunde { width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spalte-wert  { width: 62px; }
.spalte-standort { min-width: 180px; }

.objektnr {
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  color: var(--tinte-zart);
  margin-left: .35rem;
  font-weight: 400;
}

.hinweisschild--tour {
  color: var(--bernstein);
  border-color: #eed69a;
  background: var(--gelb-hell);
  text-decoration: none;
}

.zeile--verplant .spalte-standort { opacity: .75; }

/* ---------- Tour speichern ---------- */

.knopf--tour {
  background: var(--gruen);
  border-color: var(--gruen);
  margin-top: .6rem;
}

.knopf--tour:hover:not(:disabled) { background: #04713a; border-color: #04713a; }

.knopf:disabled {
  opacity: .45;
  cursor: not-allowed;
}

@media (max-width: 1300px) {
  .arbeitsflaeche { grid-template-columns: 1fr; }
  .arbeitsflaeche-seite { position: static; }
  .kartenfeld { height: 400px; }
}

/* ---------- Touren ---------- */

.schild--tour-entwurf       { background: #eef1ef;           border-color: var(--linie);  color: var(--tinte-schwach); }
.schild--tour-geplant       { background: var(--gruen-hell); border-color: #bfe4cd;       color: #04713a; }
.schild--tour-versendet     { background: var(--gelb-hell);  border-color: #f2dfa8;       color: var(--bernstein); }
.schild--tour-abgeschlossen { background: #eceafb;           border-color: #d3cef4;       color: #4b3fa8; }

.wochenkopf {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  border-bottom: 1px solid var(--linie);
  padding-bottom: .35rem;
}

.zellenfeld--nr { width: 46px; }

.klein { font-size: .6875rem; }

.versteckt { display: none; }

/* =============================================================
   Planer: alles auf einer Seite

   Die Seite selbst scrollt nicht. Stattdessen hat die Tabelle
   einen eigenen Scrollbereich – dadurch bleiben Wochenleiste,
   Karte und Tourbilanz immer sichtbar.
   ============================================================= */

body.planerseite { overflow-y: hidden; }

.planerseite .inhalt {
  height: calc(100vh - 54px);
  display: flex;
  flex-direction: column;
  padding-bottom: .5rem;
  overflow: hidden;
}

/* Die Fußleiste behält ihre Höhe, die Arbeitsfläche darüber
   nimmt den Rest. */
.planerseite .planer-fussleiste {
  flex: 0 0 auto;
  margin-top: .6rem;
  position: static;
  box-shadow: none;
}

.planerseite .arbeitsflaeche {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 480px;
  margin-bottom: 0;
}

.arbeitsflaeche-liste {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.arbeitsflaeche-liste .tabellenrahmen {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.arbeitsflaeche-liste .tabellenfuss { flex: 0 0 auto; }

.planerseite .arbeitsflaeche-seite {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  gap: .6rem;
}

.planerseite .kartenfeld {
  flex: 1 1 auto;
  height: auto;
  min-height: 380px;
}

/* Unter der Karte stehen nur noch Speichern-Knopf und Tourliste –
   die Bilanz ist in die Fußleiste gewandert. Deshalb braucht der
   Bereich weniger Platz, und die Karte reicht weiter nach unten. */
.seitenrest {
  flex: 0 0 auto;
  overflow-y: auto;
  max-height: 32%;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* ---------- Wochenleiste ---------- */

.heutekw {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .2rem .55rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: #fafbfa;
}

.heutekw-titel {
  font-size: .5625rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tinte-zart);
}

.heutekw-wert {
  font-family: 'Fira Mono', monospace;
  font-size: .9375rem;
  font-weight: 700;
  color: var(--gruen);
  line-height: 1.15;
}

.wochenlabel { margin-right: .1rem; }

.wochenauswahl {
  font-family: 'Fira Mono', monospace;
  font-size: .8125rem;
  padding: .3rem .45rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte);
  min-width: 260px;
}

.wochenauswahl:focus { border-color: var(--gruen); outline: none; }

/* ---------- Plan-Spalte ---------- */

.spalte-plan { width: 62px; }

.plan-kw {
  display: inline-block;
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  font-weight: 700;
  padding: .1rem .3rem;
  border: 1px solid;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
}

.plan-kw--entwurf   { background: #eef1ef;           border-color: var(--linie); color: var(--tinte-schwach); }
.plan-kw--geplant   { background: var(--gruen-hell); border-color: #bfe4cd;      color: #04713a; }
.plan-kw--versendet { background: var(--gelb-hell);  border-color: #f2dfa8;      color: var(--bernstein); }

/* ---------- Schmalere Standortspalte ---------- */

.spalte-standort {
  width: 150px;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spalte-ort   { width: 130px; }
.spalte-kunde { width: 120px; }

.planerseite .spalte-matrix { width: 230px; }

@media (max-width: 1400px) {
  .planerseite .arbeitsflaeche { grid-template-columns: minmax(0, 1fr) 400px; }
  .planerseite .spalte-matrix { width: auto; }
}

@media (max-width: 1150px) {
  body.planerseite { overflow-y: auto; }
  .planerseite .inhalt { height: auto; overflow: visible; }
  .planerseite .arbeitsflaeche { grid-template-columns: 1fr; }
  .planerseite .kartenfeld { height: 380px; flex: none; }
  .seitenrest { max-height: none; overflow: visible; }
}


/* =============================================================
   Spaltendesigner
   ============================================================= */

/* ---------- Überschriften: ziehen und Breite ---------- */

.kopfzeile-titel th[data-spalte] {
  position: relative;
  cursor: grab;
  user-select: none;
}

.kopfzeile-titel th[data-spalte="auswahl"] { cursor: default; }
.kopfzeile-titel th.wird-gezogen { opacity: .35; }

.kopfzeile-titel th.ziel-links::before,
.kopfzeile-titel th.ziel-rechts::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 0;
  border-left: 2px dashed var(--gruen);
}

.kopfzeile-titel th.ziel-links::before  { left: -1px; }
.kopfzeile-titel th.ziel-rechts::before { right: -1px; }

.spaltengriff {
  position: absolute;
  top: 0; right: 0;
  width: 6px; height: 100%;
  cursor: col-resize;
}

.spaltengriff:hover { background: var(--gruen); opacity: .45; }

body.breite-wird-gezogen,
body.breite-wird-gezogen * { cursor: col-resize !important; user-select: none; }

.kopftext { pointer-events: none; }

/* ---------- Fenster ---------- */

.designer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 33, 27, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.designer[hidden] { display: none; }

.designer-flaeche {
  background: var(--karte);
  border-radius: var(--radius);
  box-shadow: 0 14px 44px rgba(0,0,0,.3);
  width: 100%;
  max-width: 840px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.designer-kopf {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem 1.25rem .8rem;
  border-bottom: 1px solid var(--linie);
}

.designer-kopf h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.designer-unterzeile {
  margin: .15rem 0 0;
  font-size: .8125rem;
  color: var(--tinte-zart);
}

.designer-schliessen {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--tinte-zart);
  cursor: pointer;
  padding: 0 .2rem;
}

.designer-schliessen:hover { color: var(--tinte); }

.designer-koerper {
  padding: 1.1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.designer-abschnitt { margin-bottom: 1.5rem; }
.designer-abschnitt:last-child { margin-bottom: 0; }

.designer-abschnitt h3 {
  margin: 0 0 .5rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  font-weight: 600;
}

/* ---------- Das Band mit den aktiven Spalten ---------- */

.spaltenband {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  min-height: 76px;
  padding: .6rem;
  border: 2px dashed var(--linie);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.spaltenband.band-aktiv {
  border-color: var(--gruen);
  background: var(--gruen-hell);
}

.bandhinweis {
  margin: .45rem 0 0;
  font-size: .75rem;
  color: var(--tinte-zart);
}

/* ---------- Spaltenkarten ---------- */

.spaltenkarte {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .45rem .3rem .3rem;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  font-size: .8125rem;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.spaltenkarte:active { cursor: grabbing; }
.spaltenkarte:hover  { border-color: var(--tinte-zart); }
.spaltenkarte.wird-gezogen { opacity: .35; }

.karten-griff {
  width: 8px; height: 16px;
  flex: 0 0 auto;
  background-image: radial-gradient(circle, var(--tinte-zart) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: .7;
}

.karten-titel { white-space: nowrap; }

.karten-weg {
  border: none;
  background: transparent;
  color: var(--tinte-zart);
  font-size: .9375rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 .1rem;
}

.karten-weg:hover { color: var(--rot); }

.spaltenkarte--angebot {
  cursor: pointer;
  border-style: dashed;
  color: var(--tinte-schwach);
  box-shadow: none;
}

.spaltenkarte--angebot:hover {
  border-color: var(--gruen);
  border-style: solid;
  color: var(--gruen);
  background: var(--gruen-hell);
}

.karten-plus {
  font-family: 'Fira Mono', monospace;
  font-weight: 700;
  color: var(--gruen);
}

/* ---------- Die gestrichelte Einfügemarke ---------- */

.einfuegemarke {
  display: inline-block;
  width: 0;
  align-self: stretch;
  min-height: 30px;
  border-left: 3px dashed var(--gruen);
  margin: 0 .1rem;
  animation: markePulst 1s ease-in-out infinite;
}

@keyframes markePulst {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

@media (prefers-reduced-motion: reduce) {
  .einfuegemarke { animation: none; }
}

/* ---------- Angebot ---------- */

.angebotsgruppe { margin-bottom: .85rem; }
.angebotsgruppe:last-child { margin-bottom: 0; }

.angebotsgruppe h4 {
  margin: 0 0 .35rem;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  font-weight: 600;
}

.angebotsreihe {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

/* ---------- Fußleiste ---------- */

.designer-fuss {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1.25rem;
  border-top: 1px solid var(--linie);
}

.designer-status {
  margin-left: auto;
  font-size: .8125rem;
  color: var(--tinte-zart);
}

.designer-status--gut    { color: var(--gruen);     font-weight: 600; }
.designer-status--offen  { color: var(--bernstein); font-weight: 600; }
.designer-status--fehler { color: var(--rot);       font-weight: 600; }

/* ---------- Summenzeile ---------- */

.summenzeile-text { display: flex; align-items: center; gap: .6rem; }

.summenzeile-werte {
  margin-left: auto;
  font-family: 'Fira Mono', monospace;
  color: var(--tinte-schwach);
}

.summenzeile-werte strong { color: var(--tinte); }

/* =============================================================
   Feste Spaltenbreiten

   Ohne table-layout: fixed richtet der Browser die Breiten nach
   dem Inhalt aus und ignoriert die gesetzten Werte. Erst damit
   wirkt das Ziehen am Spaltenrand.
   ============================================================= */

.liste--filterbar {
  table-layout: fixed;
  width: 100%;
}

.liste--filterbar th,
.liste--filterbar td {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zellen, die umbrechen dürfen */
.liste--filterbar td.spalte-matrix,
.liste--filterbar td.spalte-tags {
  overflow: visible;
  white-space: normal;
}

.liste--filterbar tbody td { white-space: nowrap; }

/* Die Matrix darf über ihre Spalte hinausragen, ohne zu drängen */
.liste--filterbar .matrix { width: max-content; }

/* Summenzeile: der Inhalt liegt in einem div, damit colspan wirkt */
.summenzeile td { white-space: normal; overflow: visible; }
.summenzeile-text { display: flex; align-items: center; gap: .6rem; width: 100%; }

/* =============================================================
   Karte: beschriftete Punkte und Umsatz-Cluster

   Beim Hineinzoomen öffnen sich die Punkte und zeigen Standort,
   Kunde und Wert. Bei weiter Ansicht fassen Cluster zusammen und
   nennen den Umsatz, der dort liegt.
   ============================================================= */

.punkthuelle { overflow: visible !important; }

/* ---------- Beschriftung am Punkt ---------- */

.punktschild {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  padding: .12rem .3rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,.93);
  border: 1px solid var(--linie);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  line-height: 1.25;
  pointer-events: none;
}

.karte--nah .punktschild { display: flex; }

.punktschild-name {
  font-size: .625rem;
  font-weight: 700;
  color: var(--tinte);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.punktschild-kunde {
  font-size: .5625rem;
  color: var(--tinte-zart);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.punktschild-wert {
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  font-weight: 700;
}

.punktschild--ueberfaellig .punktschild-wert { color: var(--rot); }
.punktschild--bald        .punktschild-wert { color: var(--bernstein); }
.punktschild--zukunft     .punktschild-wert { color: var(--gruen); }

.punktschild.ist-gewaehlt {
  background: var(--tinte);
  border-color: var(--tinte);
}

.punktschild.ist-gewaehlt .punktschild-name,
.punktschild.ist-gewaehlt .punktschild-kunde,
.punktschild.ist-gewaehlt .punktschild-wert { color: #fff; }

/* ---------- Techniker ---------- */

.technikerpunkt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 4px;
  background: #fff;
  border: 2px solid var(--tinte);
  color: var(--tinte);
  font-size: .875rem;
  line-height: 1;
}

.technikerpunkt.ist-gewaehlt {
  background: var(--tinte);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(20,33,27,.2);
}

.technikerschild {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  white-space: nowrap;
  font-size: .625rem;
  font-weight: 700;
  color: var(--tinte);
  background: rgba(255,255,255,.93);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .05rem .25rem;
  pointer-events: none;
}

.karte--nah .technikerschild { display: block; }

.technikerschild.ist-gewaehlt {
  background: var(--tinte);
  color: #fff;
  border-color: var(--tinte);
  display: block;
}

/* ---------- Cluster mit Umsatzsumme ---------- */

.kartencluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  color: #fff;
  position: relative;
  line-height: 1.1;
}

.kartencluster--klein  { width: 42px; height: 42px; }
.kartencluster--mittel { width: 52px; height: 52px; }
.kartencluster--gross  { width: 62px; height: 62px; }

.cluster-wert {
  font-family: 'Fira Mono', monospace;
  font-weight: 700;
  font-size: .6875rem;
}

.kartencluster--gross .cluster-wert { font-size: .8125rem; }

.cluster-anzahl {
  font-size: .5625rem;
  opacity: .85;
}

.kartencluster--ueberfaellig { background: rgba(192, 54, 44, .92); }
.kartencluster--bald         { background: rgba(217, 155, 0, .92); }
.kartencluster--zukunft      { background: rgba(0, 152, 66, .92); }

.kartencluster.hat-auswahl {
  box-shadow: 0 0 0 4px rgba(20,33,27,.35), 0 2px 6px rgba(0,0,0,.3);
}

.kartencluster em {
  position: absolute;
  top: -7px; right: -7px;
  background: var(--tinte);
  color: #fff;
  font-style: normal;
  font-size: .5625rem;
  line-height: 16px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  padding: 0 3px;
  border: 2px solid #fff;
}

/* ---------- Bezugshinweis in der Wochenleiste ---------- */

.bezugshinweis {
  font-size: .6875rem;
  color: var(--tinte-zart);
  border-left: 1px solid var(--linie);
  padding-left: .5rem;
  margin-left: .1rem;
  cursor: help;
}

/* =============================================================
   Kartenwerkzeuge, Graustufen und Kopplung
   ============================================================= */

.kartenwerkzeuge {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .35rem .5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.kartenschalter {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .6875rem;
  color: var(--tinte-schwach);
  cursor: pointer;
  white-space: nowrap;
}

.kartenschalter input {
  width: 13px; height: 13px;
  accent-color: var(--gruen);
  cursor: pointer;
}

.kartenschalter:hover { color: var(--tinte); }

/* Graustufen wirken nur auf die Kartenkacheln – die Punkte
   behalten ihre Farbe und treten dadurch deutlich hervor. */
.karte--grau .leaflet-tile-pane {
  filter: grayscale(1) contrast(.86) brightness(1.08);
}

/* Ist die Kopplung aktiv, zeigt ein feiner Rahmen, dass der
   Ausschnitt die Liste bestimmt. */
.karte--gekoppelt::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--gruen);
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 450;
  opacity: .45;
}

/* ---------- Deutlichere Rückmeldung an den Punkten ---------- */

.kartenpunkt,
.kartencluster,
.technikerpunkt {
  transition: transform .12s ease, box-shadow .12s ease;
}

.leaflet-marker-icon:hover .kartenpunkt {
  transform: scale(1.35);
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  z-index: 10;
}

.leaflet-marker-icon:hover .kartencluster {
  transform: scale(1.12);
  box-shadow: 0 0 0 5px rgba(255,255,255,.7), 0 3px 10px rgba(0,0,0,.4);
}

.leaflet-marker-icon:hover .technikerpunkt {
  transform: scale(1.25);
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

.leaflet-marker-icon:hover .punktschild,
.leaflet-marker-icon:hover .technikerschild {
  display: flex;
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  z-index: 20;
}

.kartencluster { cursor: pointer; }
.kartenpunkt   { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .kartenpunkt, .kartencluster, .technikerpunkt { transition: none; }
}

/* ---------- Technikername immer sichtbar ---------- */

.technikerschild { display: block; }

/* ---------- Hinweis in der Liste, wenn die Kopplung filtert --------- */

.kopplungshinweis {
  font-size: .6875rem;
  color: var(--gruen);
  font-weight: 600;
}

/* =============================================================
   Auftragswerte und Stundensätze
   ============================================================= */

.kennzahl--gut .kennzahl-wert { color: var(--gruen); }

/* ---------- Stundensatz-Bewertung ---------- */

.satz {
  font-family: 'Fira Mono', monospace;
  font-weight: 700;
  padding: .05rem .3rem;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: help;
}

.satz--gut     { background: var(--gruen-hell); border-color: #bfe4cd; color: #04713a; }
.satz--knapp   { background: var(--gelb-hell);  border-color: #f2dfa8; color: var(--bernstein); }
.satz--schwach { background: var(--rot-hell);   border-color: #f0c9c5; color: var(--rot); }

/* ---------- Auftragswert ---------- */

.auftragskopf {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.auftragswert {
  font-family: 'Fira Mono', monospace;
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--tinte);
}

.auftragsunterzeile {
  font-size: .8125rem;
  color: var(--tinte-schwach);
  margin-top: .15rem;
}

.auftragsprognose { text-align: right; }

/* Balken zeigt, wie viel vom Budget noch offen ist */
.auftragsbalken {
  height: 8px;
  border-radius: 4px;
  background: var(--linie);
  overflow: hidden;
  margin-bottom: 1rem;
}

.auftragsbalken-fuellung {
  display: block;
  height: 100%;
  background: var(--gruen);
  border-radius: 4px;
  transition: width .3s ease;
}

.auftragsformular { margin-top: .5rem; }

/* ---------- Buchungen ---------- */

.betrag--zu { color: var(--gruen); font-weight: 600; }
.betrag--ab { color: var(--tinte-schwach); }

/* ---------- Restwert in der Planerliste ---------- */

.restwert--gross { color: var(--gruen);       font-weight: 700; }
.restwert--klein { color: var(--bernstein);   font-weight: 600; }
.restwert--leer  { color: var(--tinte-zart); }

/* ---------- Einstellungen ---------- */

.einstellungszeile {
  padding: .8rem 0;
  border-bottom: 1px solid var(--linie-zart);
  max-width: 70ch;
}

.einstellungszeile:first-child { padding-top: 0; }

.einstellungszeile .feld input { width: 180px; }

.einstellungszeile .formularhinweis { margin-top: .35rem; }

@media (prefers-reduced-motion: reduce) {
  .auftragsbalken-fuellung { transition: none; }
}

/* =============================================================
   Standortseite: Prüfarten und Abschluss
   ============================================================= */

.pruefartenkopf {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.pruefartenkopf .schalter { padding-bottom: 0; }

/* Nicht zugeordnete Prüfarten bleiben im Formular, sind aber
   nur sichtbar, wenn man sie ausdrücklich einblendet. */
.pruefartenrahmen .zeile--nichtzugeordnet { display: none; }
.pruefartenrahmen.zeigt-alle .zeile--nichtzugeordnet { display: table-row; }

.pruefartenrahmen.zeigt-alle .zeile--zugeordnet td {
  background: #fbfdfb;
}

.leer--klein { padding: 1.5rem 1rem; }

/* ---------- Standortabschluss ---------- */

.abschlusskarte { border-color: #d8ded9; }

.knopf--abschluss {
  background: var(--tinte);
  border-color: var(--tinte);
}

.knopf--abschluss:hover { background: #000; border-color: #000; }

.abschlusskarte .plan-kw { margin-left: .25rem; }

/* Felder, deren Wert bei diesem Ergebnis nicht übernommen wird */
.feld--ohne-uebernahme {
  background: #f6f7f6;
  color: var(--tinte-zart);
}

/* =============================================================
   Nächste Fälligkeit in der Prüfart-Tabelle
   ============================================================= */

.faelligkeit {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.2;
  padding: .12rem .35rem;
  border: 1px solid;
  border-radius: var(--radius);
  cursor: help;
}

.faelligkeit-datum {
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  font-weight: 700;
}

.faelligkeit-tage {
  font-size: .625rem;
  opacity: .85;
  white-space: nowrap;
}

.faelligkeit--ueberfaellig { background: var(--rot-hell);   border-color: #e8b5b0; color: var(--rot); }
.faelligkeit--bald         { background: var(--gelb-hell);  border-color: #eed69a; color: var(--bernstein); }
.faelligkeit--zukunft      { background: var(--gruen-hell); border-color: #b3ddc4; color: #04713a; }

/* =============================================================
   Prüfungen in der Tour erfassen
   ============================================================= */

.erfassungskarte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  margin-bottom: .85rem;
  overflow: hidden;
}

.erfassungskarte.ist-fertig { border-color: #bfe4cd; }

.erfassungskopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .6rem .8rem;
  background: #fafbfa;
  border-bottom: 1px solid var(--linie);
}

.erfassungskarte.ist-fertig .erfassungskopf { background: var(--gruen-hell); }

.erfassungskopf .tournummer { margin-right: .4rem; }

.erfassungsstatus {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.erfassungsdatum {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.erfassungsdatum .feld-titel { margin: 0; }

.erfassungstabelle { margin: 0; }
.erfassungstabelle thead th { background: var(--karte); }

.zeile--erfasst td {
  background: #f7faf8;
  color: var(--tinte-schwach);
}

.haken {
  color: var(--gruen);
  font-weight: 700;
  font-size: 1rem;
  cursor: help;
}

.erfassungsfuss {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.75rem;
}

/* =============================================================
   Tagesablauf einer Tour
   ============================================================= */

.tagkarte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  margin-bottom: .85rem;
  overflow: hidden;
}

.tagkopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem .8rem;
  background: #fafbfa;
  border-bottom: 1px solid var(--linie);
}

.tagnummer {
  font-weight: 700;
  font-size: .9375rem;
  margin-right: .5rem;
}

.tagsumme {
  font-family: 'Fira Mono', monospace;
  font-size: .875rem;
  font-weight: 700;
}

/* ---------- Der Ablauf als Zeitschiene ---------- */

.ablaufliste {
  list-style: none;
  margin: 0;
  padding: .3rem 0;
}

.ablaufzeile {
  display: grid;
  grid-template-columns: 22px minmax(210px, 220px) 1fr 68px 110px;
  align-items: center;
  gap: .6rem;
  padding: .3rem .8rem;
  font-size: .8125rem;
}

.ablaufzeile + .ablaufzeile { border-top: 1px solid var(--linie-zart); }

.ablaufzeit {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  color: var(--tinte-schwach);
  white-space: nowrap;
}

.zeitstrich { color: var(--tinte-zart); }

.zeitfest { min-width: 42px; display: inline-block; }

.ablaufsymbol { text-align: center; color: var(--tinte-zart); }

.ablauftext { min-width: 0; }

.ablaufdauer {
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  text-align: right;
  white-space: nowrap;
}

.ablaufzeile--arbeit .ablaufsymbol { color: var(--gruen); }
.ablaufzeile--arbeit .ablauftext   { font-weight: 600; }

.ablaufzeile--fahrt,
.ablaufzeile--heimfahrt { color: var(--tinte-schwach); }

.ablaufzeile--heimfahrt .ablaufsymbol { color: var(--tinte); }

.ablaufzeile--uebernachtung {
  background: var(--gelb-hell);
  color: var(--bernstein);
  font-weight: 600;
}

.ablaufzeile--uebernachtung .ablaufsymbol { color: var(--bernstein); }

.ueberzogen {
  color: var(--rot);
  font-size: .6875rem;
  cursor: help;
}

/* ---------- Hotel ---------- */

.hotelbereich {
  border-top: 1px solid var(--linie);
  padding: .7rem .8rem .9rem;
  background: #fffdf6;
}

.hotelbereich h4 {
  margin: 0 0 .6rem;
  font-size: .8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.hotelformular .formularraster { margin-bottom: 0; gap: .6rem; }

.feldpaar { display: flex; gap: .35rem; }
.feldpaar input:last-child { flex: 1; min-width: 0; }

/* =============================================================
   Grenzen und Genehmigung
   ============================================================= */

.genehmigung {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 33, 27, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.genehmigung[hidden] { display: none; }

.genehmigung-flaeche {
  background: var(--karte);
  border-radius: var(--radius);
  border-top: 4px solid var(--bernstein);
  box-shadow: 0 14px 44px rgba(0,0,0,.3);
  width: 100%;
  max-width: 520px;
  padding: 1.5rem;
}

.genehmigung-kopf {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1rem;
}

.genehmigung-zeichen {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gelb-hell);
  border: 2px solid var(--bernstein);
  color: var(--bernstein);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.genehmigung-kopf h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.genehmigung-zahl {
  margin: .2rem 0 0;
  font-family: 'Fira Mono', monospace;
  font-size: .875rem;
  color: var(--tinte-schwach);
}

.genehmigung-zahl strong { color: var(--bernstein); }

.genehmigung-text {
  font-size: .875rem;
  line-height: 1.55;
  color: var(--tinte-schwach);
  margin: 0 0 .8rem;
}

.genehmigung-form .feld { margin-bottom: 1rem; }
.genehmigung-form input[type="text"] { width: 100%; }

.genehmigung-knoepfe { display: flex; gap: .6rem; }

.knopf--genehmigen {
  background: var(--bernstein);
  border-color: var(--bernstein);
}

.knopf--genehmigen:hover { background: #8a5800; border-color: #8a5800; }

/* ---------- Orange: jenseits der Wochenarbeitszeit ---------- */

.ablaufzeile.ist-ueber-woche {
  background: var(--gelb-hell);
  box-shadow: inset 3px 0 0 var(--bernstein);
}

.ablaufzeile.ist-ueber-woche .ablauftext { color: var(--bernstein); font-weight: 600; }

.zeile--ueber-woche td {
  background: var(--gelb-hell) !important;
  box-shadow: inset 3px 0 0 var(--bernstein);
}

.zeile--ueber-woche .stark { color: var(--bernstein); }

.tagsumme--lang { color: var(--bernstein); }

/* ---------- Heimfahrt statt Übernachtung ---------- */

.ablaufzeile--heimfahrt_abend,
.ablaufzeile--anfahrt {
  background: #f2f6f3;
  color: var(--tinte-schwach);
}

.ablaufzeile--heimfahrt_abend .ablaufsymbol,
.ablaufzeile--anfahrt .ablaufsymbol { color: var(--gruen); }

.heimhinweis {
  border-top: 1px solid var(--linie);
  padding: .55rem .8rem;
  background: #f4f8f5;
  font-size: .75rem;
  color: var(--tinte-schwach);
}

/* =============================================================
   Tourenübersicht als Kacheln
   ============================================================= */

.wochenkopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--linie);
  padding-bottom: .4rem;
  margin: 1.5rem 0 .85rem;
}

.wochenbilanz {
  display: flex;
  align-items: center;
  gap: .9rem;
  font-family: 'Fira Mono', monospace;
  font-size: .8125rem;
  color: var(--tinte-schwach);
}

.inline-formular { display: inline; }

/* ---------- Kachelraster ---------- */

.tourkacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: .85rem;
  margin-bottom: 1.75rem;
}

.tourkachel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.35fr);
  gap: 1rem;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-left: 4px solid var(--linie);
  border-radius: var(--radius);
  padding: .8rem .9rem;
}

.tourkachel--entwurf       { border-left-color: var(--tinte-zart); }
.tourkachel--geplant       { border-left-color: var(--gruen); }
.tourkachel--versendet     { border-left-color: var(--bernstein); }
.tourkachel--abgeschlossen { border-left-color: #6f66c9; }

.tourkachel:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }

.kachel-spalte {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-width: 0;
}

.kachel-feld { min-width: 0; }

.kachel-titel {
  display: block;
  font-size: .625rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tinte-zart);
  margin-bottom: .1rem;
}

.kachel-feld strong { font-size: .875rem; }

/* ---------- Zahlenblock ---------- */

.kachel-zahlen {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.kachel-zahlen > div {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
}

.kachel-zahlen dt {
  width: 24px;
  color: var(--tinte-zart);
  font-weight: 700;
  flex: 0 0 auto;
}

.kachel-zahlen dd { margin: 0; color: var(--tinte); }

.wert--gut     { color: var(--gruen); font-weight: 700; }
.wert--schwach { color: var(--rot);   font-weight: 700; }

/* ---------- Einsatztage ---------- */

.tagestreifen {
  display: flex;
  align-items: center;
  gap: .18rem;
  flex-wrap: wrap;
}

.tagpunkt {
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  font-weight: 700;
  color: var(--tinte-zart);
  background: #f2f4f2;
  border-radius: 2px;
  padding: .1rem .22rem;
  min-width: 20px;
  text-align: center;
}

.tagpunkt.ist-aktiv {
  background: var(--gruen);
  color: #fff;
}

.tagestreifen .leise { margin-left: .3rem; font-family: 'Fira Sans', sans-serif; }

/* ---------- Kundenchips ---------- */

.kundenchips {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
}

.kundenchip {
  font-size: .625rem;
  padding: .1rem .3rem;
  border: 1px solid #bfe4cd;
  background: var(--gruen-hell);
  color: #04713a;
  border-radius: 2px;
  cursor: help;
  white-space: nowrap;
}

/* ---------- Öffnen-Verweis ---------- */

.kachel-oeffnen {
  position: absolute;
  inset: 0;
  text-indent: -9999px;
  overflow: hidden;
  border-radius: var(--radius);
}

.kachel-oeffnen:focus-visible { outline: 2px solid var(--gruen); outline-offset: 2px; }

/* Verweise innerhalb der Kachel müssen darüber liegen */
.tourkachel a:not(.kachel-oeffnen),
.tourkachel form,
.tourkachel .kundenchip { position: relative; z-index: 1; }

@media (max-width: 900px) {
  .tourkacheln { grid-template-columns: 1fr; }
  .tourkachel { grid-template-columns: 1fr; }
}

/* Kennzeichnet eine Rendite, bei der ein Kostensatz fehlt */
.wert--unsicher {
  color: var(--bernstein);
  font-weight: 700;
  cursor: help;
  margin-left: 1px;
}

.kachel-zahlen > div { cursor: help; }

/* =============================================================
   Technikerkosten
   ============================================================= */

.kostenrechnung {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  margin: 1rem 0;
  max-width: 460px;
}

.kostenrechnung.ist-uebersteuert { opacity: .45; }

.kostenzeile {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .35rem .7rem;
  border-bottom: 1px solid var(--linie-zart);
  font-size: .8125rem;
  color: var(--tinte-schwach);
}

.kostenzeile:last-child { border-bottom: none; }

.kostenzeile strong {
  font-family: 'Fira Mono', monospace;
  font-weight: 500;
  color: var(--tinte);
}

.kostenzeile--summe {
  background: #fafbfa;
  border-top: 1px solid var(--linie);
  font-weight: 600;
}

.kostenzeile--summe strong { font-weight: 700; }

.kostenzeile--ergebnis {
  background: var(--gruen-hell);
  border-top: 1px solid #bfe4cd;
}

.kostenzeile--ergebnis strong {
  color: #04713a;
  font-weight: 700;
  font-size: .9375rem;
}

/* ---------- Qualifikationen ---------- */

.qualifikationsraster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .3rem;
  margin-bottom: 1rem;
}

.qualifikation {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .35rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8125rem;
  min-width: 0;
}

.qualifikation:hover { background: #fafbfa; }

.qualifikation input { accent-color: var(--gruen); }

.qualifikation .leise {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Tagesmarken in der Stoppliste ---------- */

.spalte-tage-marken { width: 110px; }

.tagmarken {
  display: flex;
  align-items: center;
  gap: .15rem;
  flex-wrap: wrap;
}

.tagmarke {
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  font-weight: 700;
  background: var(--gruen);
  color: #fff;
  border-radius: 2px;
  padding: .1rem .28rem;
  cursor: help;
}

/* =============================================================
   Stopps per Ziehen verschieben
   ============================================================= */

.spalte-nr { width: 74px; }

.stoppzeile { cursor: default; }
.stoppzeile[draggable="true"] { cursor: grab; }
.stoppzeile.wird-gezogen { opacity: .4; }

/* Der Griff macht sichtbar, wo man anfassen kann */
.ziehgriff {
  display: inline-block;
  width: 10px; height: 16px;
  margin-right: .3rem;
  vertical-align: -3px;
  background-image: radial-gradient(circle, var(--tinte-zart) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: .6;
  cursor: grab;
}

.stoppzeile:hover .ziehgriff { opacity: 1; }

/* Gestrichelte Linie zeigt die Einfügestelle */
.stoppzeile.ziel-oben  > td { box-shadow: inset 0  3px 0 -1px var(--gruen); }
.stoppzeile.ziel-unten > td { box-shadow: inset 0 -3px 0 -1px var(--gruen); }

/* ---------- Hinweis auf ungespeicherte Reihenfolge ---------- */

.reihenfolgeleiste {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--gelb-hell);
  border: 1px solid #eed69a;
  border-radius: var(--radius);
  padding: .55rem .8rem;
  margin-bottom: .8rem;
  font-size: .8125rem;
  color: var(--bernstein);
}

.reihenfolgeleiste[hidden] { display: none; }

.reihenfolge-zeichen {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.reihenfolgeleiste .knopf { margin-left: auto; }

/* ---------- Mehrarbeit im Tagesablauf ---------- */

.mehrarbeitsmarke {
  margin-left: .5rem;
  font-size: .6875rem;
  font-weight: 700;
  color: var(--bernstein);
  background: var(--gelb-hell);
  border: 1px solid #eed69a;
  border-radius: var(--radius);
  padding: .05rem .35rem;
  cursor: help;
}

/* Balken zeigt die Auslastung des Tages gegen die Obergrenze */
.tagbalken {
  position: relative;
  display: flex;
  height: 5px;
  background: var(--linie-zart);
  overflow: visible;
}

.tagbalken-regel { background: var(--gruen); }
.tagbalken-mehr  { background: var(--bernstein); }

/* Strich an der Stelle des Regelarbeitstags */
.tagbalken-marke {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 9px;
  background: var(--tinte);
  opacity: .45;
  cursor: help;
}

.tagsumme--lang { color: var(--bernstein); }

/* =============================================================
   Tagesablauf von Hand anpassen
   ============================================================= */

.zeitfeld {
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  padding: .12rem .2rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  background: var(--karte);
  color: var(--tinte);
  width: 96px;
  min-width: 96px;
}

.zeitfeld:focus { border-color: var(--gruen); outline: none; }



/* Von Hand geänderte Abschnitte */
.ablaufzeile.ist-manuell { background: #f6f4fb; }

.manuellmarke {
  color: #6f66c9;
  font-size: .75rem;
  cursor: help;
  margin-right: .15rem;
}

.zusammenknopf {
  margin-left: .4rem;
  font-size: .625rem;
  padding: .05rem .35rem;
}

.zeitenfuss {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: .9rem 0 1.25rem;
}

/* Die Zeitspalte braucht mehr Platz, wenn dort Felder stehen */


/* Tag über der Obergrenze – Speichern wird gesperrt */
.tagsumme .ist-zuviel {
  color: var(--rot);
  font-weight: 700;
}

.ablaufzeile .zeitfeld[data-fest="1"] {
  background: #f6f7f6;
  border-style: dashed;
}

/* ---------- Aufgeräumte Ablaufzeile ---------- */

.ablauftext {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  min-width: 0;
}

.ablaufort {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ablaufzusatz {
  font-size: .6875rem;
  color: var(--tinte-zart);
  white-space: nowrap;
}

.ablaufdauer {
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  text-align: right;
  white-space: nowrap;
}

.ablaufaktion { text-align: right; }

.ablaufsymbol {
  text-align: center;
  color: var(--tinte-zart);
  font-size: .875rem;
  line-height: 1;
}

/* Marken in der Tageskopfzeile statt Fließtext unter dem Tag */
.heimmarke,
.nachtmarke {
  margin-left: .4rem;
  font-size: .6875rem;
  border-radius: var(--radius);
  padding: .05rem .35rem;
  cursor: help;
  white-space: nowrap;
}

.heimmarke  { background: #eef4ef; border: 1px solid #cfe0d5; color: #04713a; }
.nachtmarke { background: var(--gelb-hell); border: 1px solid #eed69a; color: var(--bernstein); }

@media (max-width: 1100px) {
  .ablaufzeile { grid-template-columns: 22px 1fr; row-gap: .2rem; }
  .ablaufzeit  { grid-column: 2; }
  .ablauftext  { grid-column: 2; }
  .ablaufdauer { grid-column: 2; text-align: left; }
  .ablaufaktion { grid-column: 2; text-align: left; }
}

/* Gespeicherte Summe und Zeilen widersprechen sich */
.tagsumme .ist-uneins {
  color: var(--rot);
  text-decoration: underline dotted;
  cursor: help;
}

/* Kilometer je Fahrtabschnitt */
.ablaufkm {
  display: block;
  font-size: .625rem;
  color: var(--tinte-zart);
}

/* Hinweis, wenn der Kachelserver nicht antwortet */
.kartenfehler {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 600;
  max-width: 420px;
  background: var(--karte);
  border: 1px solid var(--bernstein);
  border-left: 4px solid var(--bernstein);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--tinte-schwach);
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.kartenfehler code {
  font-family: 'Fira Mono', monospace;
  font-size: .75rem;
  background: #f2f4f2;
  padding: .05rem .25rem;
  border-radius: 2px;
}

/* =============================================================
   Abwesenheitskalender
   ============================================================= */

.kalenderrahmen {
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--karte);
  margin-bottom: .6rem;
}

.kalender {
  border-collapse: collapse;
  width: 100%;
  font-size: .75rem;
}

.kalender th,
.kalender td { border: 1px solid var(--linie-zart); }

/* ---------- Kopfzeilen ---------- */

.kalender-kw {
  font-family: 'Fira Mono', monospace;
  font-size: .6875rem;
  font-weight: 700;
  color: var(--tinte-schwach);
  background: #fafbfa;
  padding: .25rem;
  border-left: 2px solid var(--linie) !important;
}

.kalender-tag {
  width: 24px;
  min-width: 24px;
  padding: .2rem 0;
  text-align: center;
  font-weight: 400;
  background: var(--karte);
}

.tag-wochentag {
  display: block;
  font-size: .5625rem;
  color: var(--tinte-zart);
  text-transform: uppercase;
}

.tag-zahl {
  display: block;
  font-family: 'Fira Mono', monospace;
  font-size: .6875rem;
}

.kalender-tag.ist-heute {
  background: var(--tinte);
  color: #fff;
}

.kalender-tag.ist-heute .tag-wochentag { color: rgba(255,255,255,.7); }

/* ---------- Namensspalte ---------- */

.kalender-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--karte);
  text-align: left;
  padding: .25rem .5rem;
  min-width: 170px;
  font-weight: 600;
  border-right: 2px solid var(--linie) !important;
}

.kalender-name a { text-decoration: none; color: var(--tinte); }
.kalender-name a:hover { color: var(--gruen); }
.kalender-name .klein { margin-left: .3rem; font-weight: 400; }

/* ---------- Zellen ---------- */

.kalender-zelle {
  height: 24px;
  padding: 0;
  text-align: center;
  background: var(--karte);
}

.ist-wochenende { background: #f4f5f4; }
.ist-feiertag   { background: #eceafb; }

.art--urlaub    { background: var(--gruen-hell); }
.art--krank     { background: var(--rot-hell); }
.art--schulung  { background: #e4eefb; }
.art--sonstiges { background: var(--gelb-hell); }

/* Der Strich zeigt einen geplanten Tourtag. Er saß bisher am
   unteren Rand und war auf grauem Wochenendgrund kaum zu sehen. */
.ist-tour::after {
  content: '';
  display: block;
  height: 4px;
  background: var(--tinte);
  margin-top: 18px;
  opacity: .8;
  border-radius: 1px;
}

/* Auf farbigen Feldern braucht er Kontrast nach oben */
.ist-abwesend.ist-tour::after { opacity: 1; }

.ist-konflikt {
  outline: 2px solid var(--rot);
  outline-offset: -2px;
}

.konfliktzeichen {
  color: var(--rot);
  font-weight: 700;
  font-size: .75rem;
  line-height: 24px;
}

/* ---------- Legende ---------- */

.kalenderlegende {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  font-size: .6875rem;
  color: var(--tinte-schwach);
  margin-bottom: 1.5rem;
}

.kalenderlegende span { display: flex; align-items: center; gap: .3rem; }

.legende-feld {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid var(--linie);
  border-radius: 2px;
}

.legende-feld.ist-tour::after { margin-top: 10px; }

/* ---------- Marke in Listen ---------- */

.abwesenheitsmarke {
  font-size: .6875rem;
  padding: .05rem .35rem;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  white-space: nowrap;
}

.abwesenheitsmarke.art--urlaub    { border-color: #bfe4cd; color: #04713a; }
.abwesenheitsmarke.art--krank     { border-color: #e8b5b0; color: var(--rot); }
.abwesenheitsmarke.art--schulung  { border-color: #c3d5ef; color: #2a5b96; }
.abwesenheitsmarke.art--sonstiges { border-color: #eed69a; color: var(--bernstein); }

/* Rückfrage bei Feiertagen */
.feiertagsfrage {
  background: var(--gelb-hell);
  border: 1px solid #eed69a;
  border-left: 4px solid var(--bernstein);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  margin-bottom: 1rem;
}

.feiertagsfrage p { margin: 0 0 .5rem; font-size: .8125rem; line-height: 1.55; }
.feiertagsfrage p:last-of-type { margin-bottom: .7rem; }
.feiertagsfrage strong { color: var(--bernstein); }

/* Feiertag im Tagesablauf */
.ablaufzeile--feiertag {
  background: #eceafb;
  color: #4b3f9e;
}

/* Versionsstempel in der Fußzeile */
.fusszeile-stand {
  margin-left: .6rem;
  font-family: 'Fira Mono', monospace;
  font-size: .625rem;
  color: var(--tinte-zart);
  cursor: help;
}

/* Abwesender Techniker in der Auswahl */
#techniker.ist-abwesend {
  border-color: var(--rot);
  background: var(--rot-hell);
  color: var(--rot);
  font-weight: 600;
}

#techniker option[data-abwesend="1"] { color: var(--rot); }

.abwesenheitswarnung {
  margin: .4rem 0 0;
  font-size: .75rem;
  line-height: 1.45;
  color: var(--rot);
  background: var(--rot-hell);
  border: 1px solid #e8b5b0;
  border-radius: var(--radius);
  padding: .4rem .55rem;
}

.abwesenheitswarnung[hidden] { display: none; }

/* =============================================================
   Planer – Technikerwahl in der oberen Leiste
   ============================================================= */

.technikerwahl {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  padding-left: .9rem;
  border-left: 1px solid var(--linie);
}

.technikerwahl select {
  min-width: 210px;
  max-width: 320px;
}

.technikerwahl .feld-titel { margin: 0; white-space: nowrap; }

/* Pflichtfeld, solange nichts gewählt ist */
#techniker:invalid,
#techniker.ist-leer {
  border-color: var(--bernstein);
  background: var(--gelb-hell);
}

.technikerwahl .abwesenheitswarnung {
  margin: 0;
  padding: .15rem .4rem;
  font-size: .6875rem;
  max-width: 340px;
}

/* =============================================================
   Planer – Fußleiste
   ============================================================= */

.planer-fussleiste {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: .7rem .9rem;
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}

.knopf--optimieren { flex: 0 0 auto; }

.fussbilanz {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.fusswert {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  min-width: 0;
}

.fusswert-titel {
  font-size: .625rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinte-zart);
  white-space: nowrap;
}

.fusswert strong {
  font-family: 'Fira Mono', monospace;
  font-size: .9375rem;
  font-weight: 700;
  white-space: nowrap;
}

.fusswert--gesamt strong { color: var(--gruen); }

.planer-fussleiste .genauigkeitshinweis {
  margin: 0;
  flex: 1 1 200px;
  font-size: .6875rem;
  color: var(--tinte-zart);
  line-height: 1.4;
}

.knopf--leeren { flex: 0 0 auto; margin-left: auto; }

@media (max-width: 1200px) {
  .arbeitsflaeche { grid-template-columns: minmax(0, 1fr); }
  .arbeitsflaeche-seite { position: static; }
  .kartenfeld { height: 440px; }
}

@media (max-width: 760px) {
  .planer-fussleiste { gap: .7rem; }
  .fussbilanz { gap: .9rem; }
  .knopf--leeren { margin-left: 0; }
}
