/* ==========================================================================
   Kennzahlen-Board — zweites Board des InfoBoards (GF-Beschluss 19.08.2026)
   --------------------------------------------------------------------------
   Gestaltungsprinzip: ruhige Karten, große Zahlen, wenig Text. Farbe trägt
   Bedeutung (Ampel), nicht Dekoration.

   Dark Mode läuft über die Klasse html.dark (Toggle in /shared/dark-mode.js) —
   NICHT über @media (prefers-color-scheme), das greift beim manuellen
   Umschalten nicht. Alle Flächen kommen aus Tokens, nie aus hartem #fff.
   ========================================================================== */

/* ── Umschalter im Kopf ──────────────────────────────────────────────── */
.board-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .06);
  border: 1px solid var(--color-border);
}
html.dark .board-switch { background: rgba(255, 255, 255, .07); }

.board-switch button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--f-head);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 7px 15px;
  border-radius: 999px;
  color: var(--color-text-muted);
  background: transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.board-switch button:hover { color: var(--color-text); }
.board-switch button[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
html.dark .board-switch button[aria-pressed="true"] { color: #06121f; }

/* ── Landing: Auswahl zwischen den beiden Boards ─────────────────────── */
.landing {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 2.5vw, 28px);
  background: var(--color-bg);
}
.landing-card {
  position: relative;
  /* 20.08.2026: von 1080 auf 1340 px — die abgebildeten Boards sollen groß
     genug sein, um als Schaltfläche gelesen zu werden. */
  width: min(1340px, 100%);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
  background: var(--color-surface, var(--color-bg-light));
  border: 1px solid var(--color-border);
}
.landing-hero {
  display: block;
  width: 100%;
  /* Flacher als das Foto (16:9): object-fit: cover schneidet damit die leere
     Wand oben und den Boden unten weg. Was bleibt, sind die beiden Boards —
     sie füllen dadurch spürbar mehr Fläche. */
  aspect-ratio: 16 / 7.4;
  object-fit: cover;
  object-position: center 46%;
}
/* Im Dunkelmodus das Foto etwas zurücknehmen, damit die Knöpfe tragen. */
html.dark .landing-hero { filter: brightness(.72) saturate(.9); }

.landing-overlay {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: clamp(12px, 4vw, 48px);
  padding: clamp(16px, 4vw, 44px);
  background: linear-gradient(to top, rgba(6, 18, 31, .55) 0%, rgba(6, 18, 31, .12) 42%, transparent 70%);
  /* Der Verlauf liegt über dem ganzen Foto und würde die Klickflächen auf den
     abgebildeten Boards abfangen — Klicks gehen deshalb hindurch, nur die
     Knöpfe selbst nehmen sie wieder an. */
  pointer-events: none;
}

/* Sobald die Beschriftungen unter ihrem Board sitzen (von landingAusrichten()
   gesetzt), trägt das Overlay nur noch den Verlauf: kein Raster, kein Abstand.
   Die Knöpfe bekommen ihre Lage dann in Pixeln. */
.landing-overlay.ist-ausgerichtet {
  display: block;
  padding: 0;
  background: linear-gradient(to top, rgba(6, 18, 31, .42) 0%, rgba(6, 18, 31, .10) 46%, transparent 72%);
}
.landing-overlay.ist-ausgerichtet .landing-choice { position: absolute; }

.landing-choice {
  appearance: none;
  pointer-events: auto;
  cursor: pointer;
  text-align: center;
  border-radius: 14px;
  /* Milchglas statt weißer Kachel: Das Foto bleibt durchscheinend sichtbar,
     die Beschriftung wirkt aufgelegt statt aufgeklebt. */
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .78);
  color: #14212e;
  padding: 12px 16px;
  transition: var(--transition);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: 0 8px 24px rgba(6, 18, 31, .22);
}
.landing-choice:hover,
.landing-choice.is-hot,
.landing-choice:focus-visible {
  transform: translateY(-3px);
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .3);
  outline: none;
}
.landing-choice h2 {
  font-family: var(--f-head);
  font-size: clamp(1rem, 1.7vw, 1.32rem);
  font-weight: 700;
  margin: 0 0 2px;
}
.landing-choice p {
  margin: 0;
  font-size: .82rem;
  line-height: 1.35;
  color: #46586b;
}
/* Dunkelmodus: dunkles Glas statt heller Kachel — sonst leuchtet die
   Beschriftung aus dem abgedunkelten Foto heraus. */
html.dark .landing-choice {
  background: rgba(13, 26, 41, .74);
  border-color: rgba(148, 163, 184, .38);
  color: #E2E8F0;
}
html.dark .landing-choice p { color: #A9BACD; }
html.dark .landing-choice:hover,
html.dark .landing-choice.is-hot,
html.dark .landing-choice:focus-visible { background: rgba(13, 26, 41, .88); }

/* Der Hinweis lag auf der dunklen Bodenkante des Fotos und war dort kaum zu
   lesen. Als eigene, dezent abgesetzte Zeile trägt er sich selbst. */
.landing-note {
  position: absolute;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: .74rem;
  color: rgba(255, 255, 255, .92);
  background: rgba(6, 18, 31, .42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Klickflächen auf den abgebildeten Boards. Lage und Größe setzt
   landingAusrichten() in app.js aus der tatsächlichen Bildgeometrie — fest
   verdrahtete Prozente würden bei jeder Änderung an Zuschnitt oder
   Seitenverhältnis verrutschen. Die Werte hier sind nur der Ausgangszustand. */
.landing-spot {
  position: absolute;
  appearance: none;
  pointer-events: auto;
  padding: 0;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
}
.landing-spot.ist-gesetzt { opacity: 1; }
.landing-spot:hover,
.landing-spot.is-hot {
  border-color: rgba(255, 255, 255, .92);
  background: rgba(255, 255, 255, .10);
  box-shadow: 0 0 0 4px rgba(0, 128, 201, .38), 0 14px 34px rgba(0, 0, 0, .30);
}

@media (max-width: 640px) {
  /* Auf dem Telefon sind die abgebildeten Boards zu klein, um sie zu treffen —
     und zwei Beschriftungen ÜBER einem 220 px hohen Foto verdecken es
     vollständig. Dort steht das Bild deshalb oben und die Auswahl darunter. */
  /* Volles Bildformat: Bei einem engeren Ausschnitt schneidet cover links
     und rechts ab — und dort hängen genau die beiden Boards. */
  .landing-hero { aspect-ratio: 16 / 9; object-position: center; }
  .landing-overlay,
  .landing-overlay.ist-ausgerichtet {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    background: none;
  }
  .landing-overlay .landing-choice,
  .landing-overlay.ist-ausgerichtet .landing-choice {
    position: static;
    width: auto;
    text-align: left;
  }
  /* Ohne Lage aus app.js bliebe von der Klickfläche der nackte Rahmen (4 px)
     stehen — auf dem Telefon gibt es sie gar nicht. */
  .landing-spot { display: none; }
  .landing-note { display: none; }
}

/* ── Kennzahlen-Fläche ───────────────────────────────────────────────── */
.kz {
  /* Volle Bildschirmbreite (Vorgabe AL 20.08.2026): Auf breiten Schirmen stand
     das Board bisher als 1440-px-Säule in der Mitte, während links und rechts
     Fläche brachlag — Diagramme und Personentabelle gewinnen genau dort. */
  max-width: none;
  margin: 0;
  padding: 18px clamp(12px, 2vw, 32px) 56px;
}

.kz-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
  margin-bottom: 16px;
}
.kz-kopf h2 {
  font-family: var(--f-head);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
.kz-stand {
  font-size: .82rem;
  color: var(--color-text-muted);
}
.kz-stand b { font-weight: 600; color: var(--color-text); }

.kz-hinweise {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-left: 3px solid var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(220, 80, 15, .07);
  font-size: .84rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}
.kz-hinweise ul { margin: 0; padding-left: 18px; }
.kz-hinweise li + li { margin-top: 3px; }

/* ── Bereichskarte ───────────────────────────────────────────────────── */
.kz-bereiche {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;          /* Karten wachsen nach Inhalt, nicht auf Zeilenhöhe */
  gap: 18px;
}
.kz-karte {
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-light);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;   /* sonst schiebt die breite Personentabelle die Karte auf */
}
html.dark .kz-karte { background: rgba(255, 255, 255, .035); }

.kz-karte-kopf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
}
.kz-karte-kopf h3 {
  font-family: var(--f-head);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
  flex: 1;
}
.kz-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
  flex: none;
}
.kz-dot--orange { background: var(--color-accent); }
.kz-meta {
  font-size: .74rem;
  color: var(--color-text-lighter);
  white-space: nowrap;
}

/* Kachelraster in der Karte */
/* Trennlinien als Rahmen der Kacheln, NICHT als Grid-Lücke mit farbigem
   Untergrund — sonst bleiben in der letzten Zeile graue Leerflächen stehen,
   wenn die Kachelzahl nicht aufgeht. */
.kz-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.kz-kachel {
  padding: 13px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 88px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  min-width: 0;                /* erlaubt Umbruch statt Überlauf */
}

.kz-wert {
  font-family: var(--f-head);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.kz-wert small { font-size: .68em; font-weight: 600; margin-left: 2px; color: var(--color-text-muted); }
.kz-wert--leer { color: var(--color-text-lighter); font-weight: 500; }
.kz-kachel--gut .kz-wert { color: #15803d; }
html.dark .kz-kachel--gut .kz-wert { color: #4ade80; }
.kz-kachel--warn .kz-wert { color: var(--color-accent); }

.kz-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
  overflow-wrap: anywhere;     /* „Lieferantenreklamationen" bricht um */
  hyphens: auto;
}
.kz-hinweis {
  font-size: .7rem;
  color: var(--color-text-lighter);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.kz-wert { overflow-wrap: anywhere; }

/* Verlauf */
.kz-verlauf {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--color-border);
}
.kz-verlauf-titel {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-lighter);
  margin-bottom: 6px;
}
.kz-canvas-wrap { position: relative; height: 132px; }

/* Personen-Tabelle */
/* min-width:0 — ein Flex-/Grid-Kind schrumpft sonst nicht unter seine
   Inhaltsbreite und die Tabelle ragt aus der Karte heraus, statt im eigenen
   Bereich zu scrollen. Die eigentliche Klappkarten-Optik (Rahmen, Karte,
   Pfeil) liefert `.kz-personen` weiter unten (früher gemeinsam mit dem
   inzwischen entfernten `.kz-formeln` definiert). */
.kz-personen { min-width: 0; }

.kz-tabelle-wrap {
  overflow-x: auto;
  padding: 0 16px 14px;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.kz-tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.kz-tabelle th, .kz-tabelle td {
  padding: 6px 9px;
  text-align: right;
  border-bottom: 1px solid var(--color-border-light);
  white-space: nowrap;
}
html.dark .kz-tabelle th, html.dark .kz-tabelle td { border-bottom-color: rgba(180, 200, 225, .14); }
.kz-tabelle th {
  font-size: .72rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.kz-tabelle th:first-child, .kz-tabelle td:first-child { text-align: left; }
.kz-tabelle tbody tr:hover { background: rgba(0, 128, 201, .06); }

/* Einzelwerte-Tabelle (7 Spalten seit 03.09.2026: + Krank/Urlaub/Kurzarbeit)
   NICHT auf 100% strecken — bei so vielen schmalen Zahlenspalten reißt eine
   volle Seitenbreite die Werte zu weit auseinander und erschwert das
   zeilenweise Lesen. Spalten richten sich stattdessen am Inhalt aus. */
.kz-tabelle--personen { width: auto; min-width: 100%; }
@media (min-width: 720px) {
  .kz-tabelle--personen { width: auto; min-width: 0; }
  .kz-tabelle--personen th, .kz-tabelle--personen td { padding-left: 16px; }
  .kz-tabelle--personen th:first-child, .kz-tabelle--personen td:first-child { padding-left: 9px; }
}

/* Personalnummer: Klarname erscheint nur im Tooltip (Pseudonymisierung) */
.kz-pid {
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 1px dotted var(--color-text-lighter);
  cursor: help;
}

/* ── Zustände ────────────────────────────────────────────────────────── */
.kz-state {
  padding: 44px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: .9rem;
  line-height: 1.55;
}
.kz-state h3 {
  font-family: var(--f-head);
  font-size: 1.05rem;
  color: var(--color-text);
  margin: 0 0 6px;
}


/* ── Versions-Pill im Kopf (Angleichung an RMS/MiMa, v2.3.1) ─────────── */
.hdr-version-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  appearance: none;
  cursor: pointer;
  font-family: var(--f-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.hdr-version-pill:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
/* Ungelesene Neuerung: dezenter Akzentpunkt statt Farbschrei */
.hdr-version-pill--neu {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.hdr-version-pill--neu::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-left: 1px;
}

@media (max-width: 720px) {
  /* Auf schmalen Geräten weicht die Pill — Umschalter und Anpinnen haben Vorrang */
  .hdr-version-pill { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Ausbaustufe 2 (v2.3.3): Bereichs-Reiter, Tendenzen, Formeln, Diagramme
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Reiterzeile je Bereich ──────────────────────────────────────────── */
/* ── Bereichsleiste links (v2.3.10) ──────────────────────────────────
   Acht Fachbereiche standen als Reiterzeile oben und wurden ab etwa 1180 px
   eng. Als Spalte tragen sie ihren vollen Namen — Symbole allein wären für
   „Arbeitsvorbereitung" gegen „Einkauf" Ratearbeit. */
.kz-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 0;
  max-width: none;
  margin: 0;
  padding: 0 clamp(8px, 1.4vw, 22px);
  align-items: start;
}
.kz-tabs {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 10px 18px 0;
  border-right: 1px solid var(--color-border);
}
.kz-tab {
  appearance: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--f-head);
  font-size: .84rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  transition: var(--transition);
}
.kz-tab:hover { color: var(--color-text); background: var(--color-bg-light); }
.kz-tab--aktiv {
  background: var(--color-bg-light);
  color: var(--color-primary);
  border-color: var(--color-border);
  /* Der Balken sitzt links statt oben — die Leiste steht jetzt senkrecht. */
  box-shadow: inset 3px 0 0 var(--color-primary);
}
html.dark .kz-tab--aktiv { background: rgba(255, 255, 255, .06); }

@media (max-width: 900px) {
  /* Zu schmal für eine Spalte: Die Leiste legt sich wieder über den Inhalt
     und rollt waagerecht. */
  .kz-shell { grid-template-columns: minmax(0, 1fr); }
  .kz-tabs {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 12px 0;
  }
  .kz-tab { white-space: nowrap; }
  .kz-tab--aktiv { box-shadow: inset 0 -3px 0 var(--color-primary); }
}

/* ── Kacheln: freies Raster (eine Karte je Bereich entfällt) ─────────── */
.kz-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.kz-kachel {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-light);
  padding: 13px 15px 12px;
  min-height: 0;
}
html.dark .kz-kachel { background: rgba(255, 255, 255, .035); }

/* .kz-kachel-kopf ist mit Ausbaustufe 4 entfallen — Zahl und Meta-Spalte
   stehen jetzt als zwei Spalten direkt in der Kachel (siehe unten). */

/* Info-Zeichen: sichtbar genug zum Finden, leise genug zum Ignorieren */
.kz-info {
  appearance: none;
  cursor: pointer;
  flex: none;
  width: 17px; height: 17px;
  margin-top: 3px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-lighter);
  font-family: Georgia, serif;
  font-size: .68rem;
  font-style: italic;
  line-height: 1;
  transition: var(--transition);
}
.kz-info:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(0, 128, 201, .08);
}

/* ── Tendenz ─────────────────────────────────────────────────────────── */
.kz-trend {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 7px;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}
.kz-trend-pfeil { font-size: .66rem; line-height: 1; }
.kz-trend-wert { font-weight: 700; }
.kz-trend-bez { color: var(--color-text-lighter); font-size: .68rem; }
/* Die Farbe folgt der Bedeutung, nicht dem Vorzeichen: bei überfälligen
   Wartungen ist ein Rückgang gut, bei Produktivität ein Anstieg. */
.kz-trend--gut .kz-trend-pfeil, .kz-trend--gut .kz-trend-wert { color: #15803d; }
html.dark .kz-trend--gut .kz-trend-pfeil, html.dark .kz-trend--gut .kz-trend-wert { color: #4ade80; }
.kz-trend--schlecht .kz-trend-pfeil, .kz-trend--schlecht .kz-trend-wert { color: var(--color-accent); }
.kz-trend--neutral .kz-trend-pfeil, .kz-trend--neutral .kz-trend-wert { color: var(--color-text-muted); }

.kz-spark {
  display: block;
  width: 100%;
  height: 22px;
  margin-top: 6px;
  opacity: .85;
}

/* ── Formel-Popover ──────────────────────────────────────────────────── */
.kz-formel-dlg {
  position: fixed;
  z-index: 120;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px));
  max-height: 80vh;
  overflow-y: auto;
  padding: 16px 18px 18px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
html.dark .kz-formel-dlg { background: #131c2c; }
.kz-formel-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.kz-formel-kopf strong {
  font-family: var(--f-head);
  font-size: 1rem;
  color: var(--color-text);
}
.kz-formel-zu {
  appearance: none;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--color-text-lighter);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
}
.kz-formel-zu:hover { color: var(--color-text); }
.kz-formel-titel {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-primary);
  margin: 12px 0 3px;
}
.kz-formel-titel:first-of-type { margin-top: 0; }
.kz-formel-text {
  font-size: .84rem;
  line-height: 1.5;
  color: var(--color-text);
}
.kz-formel-warn { color: var(--color-accent); }

/* ── Klappkarte „Einzelwerte je Mitarbeitendem" ───────────────────────── */
/* Bis 03.09.2026 stand hier zusätzlich der Sammelabschnitt "Wie wird
   gerechnet?" (`.kz-formeln`) — auf Wunsch entfernt (die Info-Buttons an
   den einzelnen Kacheln, `.kz-formel-dlg` weiter oben, bleiben bestehen). */
.kz-personen {
  margin-top: 18px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-light);
  overflow: hidden;
}
html.dark .kz-personen { background: rgba(255, 255, 255, .03); }
.kz-personen > summary {
  cursor: pointer;
  padding: 11px 16px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--color-primary);
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}
.kz-personen > summary h3 {
  font-family: var(--f-head);
  font-size: .92rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
.kz-personen > summary::-webkit-details-marker { display: none; }
.kz-personen > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: var(--transition);
}
.kz-personen[open] > summary::before { transform: rotate(90deg); }
.kz-personen > summary:hover { text-decoration: underline; }

/* ── Diagramme ───────────────────────────────────────────────────────── */
.kz-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 4px;
}
.kz-chart {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-light);
  padding: 14px 16px 16px;
  min-width: 0;
}
html.dark .kz-chart { background: rgba(255, 255, 255, .035); }
.kz-chart-titel {
  font-family: var(--f-head);
  font-size: .84rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
}
.kz-canvas-wrap { position: relative; height: 210px; }

/* ── Feedback-Knopf in Akzent-Orange (Vorgabe AL 19.08.2026) ─────────── */
.hdr-icon--feedback { color: var(--color-accent); }
.hdr-icon--feedback:hover {
  color: #fff;
  background: var(--color-accent);
  border-color: var(--color-accent);
}
html.dark .hdr-icon--feedback:hover { color: #1a0d05; }

@media (max-width: 640px) {
  .kz-kacheln { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .kz-charts { grid-template-columns: 1fr; }
  .kz-canvas-wrap { height: 180px; }
}

/* Laufende Woche: Tendenz nur als Information, ohne Wertung */
.kz-trend--laufend { opacity: .72; font-style: italic; }


/* ── Ausbaustufe 3: Zweitwert, Pfeil, Auffälligkeiten, Zeitraumwahl ───── */

/* Zweiter Wert derselben Kachel (absolute Stunden zur Quote usw.) */
.kz-zweit {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 3px;
}
.kz-zweit-wert {
  font-family: var(--f-head);
  font-size: .95rem;
  font-weight: 700;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.kz-zweit-label { font-size: .7rem; color: var(--color-text-lighter); }

/* Tendenzpfeil: Drehung trägt die Aussage, Farbe die Bewertung */
.kz-trend-pfeil {
  flex: none;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.kz-trend { gap: 6px; align-items: center; margin-top: 7px; }

/* Zeitraumwahl über den Diagrammen */
.kz-zeitwahl {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  flex-wrap: wrap;
}
.kz-zeitwahl-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-lighter);
}
.kz-zeitwahl-knoepfe {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .05);
  border: 1px solid var(--color-border);
}
html.dark .kz-zeitwahl-knoepfe { background: rgba(255, 255, 255, .06); }
.kz-zeit {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--f-body);
  font-size: .74rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.kz-zeit:hover { color: var(--color-text); }
.kz-zeit--aktiv { background: var(--color-primary); color: #fff; }
html.dark .kz-zeit--aktiv { color: #06121f; }


/* ── Ausbaustufe 4: Meta-Spalte (i + Pfeil) und Teilwerte ────────────── */
/* Vorgabe AL 19.08.2026: Der Tendenzpfeil gehört unter das Info-Zeichen und
   muss deutlich größer sein. Beides bildet eine schmale, rechtsbündige
   Spalte — so bleibt die Kachel ruhig, obwohl das Zeichen wächst. */

.kz-kachel {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
.kz-kachel-inhalt {
  flex: 1 1 auto;
  min-width: 0;                /* erlaubt Umbruch statt Überlauf */
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kz-kachel-meta {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;       /* i und Pfeil an derselben rechten Kante */
  gap: 1px;
  /* bewusst ohne max-width: ein langes Delta („+1.234,5 %") darf die Spalte
     breiter machen — abgeschnittene Zahlen gibt es hier nicht */
}
.kz-kachel-meta .kz-info { margin-top: 1px; }

/* Tendenz in der Meta-Spalte: Pfeil oben, Zahl darunter */
.kz-kachel-meta .kz-trend {
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  margin-top: 3px;
  line-height: 1.05;
}
.kz-trend-pfeil { width: 30px; height: 30px; }
.kz-kachel-meta .kz-trend-wert {
  font-size: .7rem;
  white-space: nowrap;
}

/* Teilwerte: mehrere gleichrangige Zahlen nebeneinander, je mit Beschriftung.
   Die Trennlinie macht sie unterscheidbar, ohne eine Rangfolge zu behaupten. */
.kz-teilwerte {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}
.kz-teil {
  flex: 0 1 auto;              /* Breite folgt dem Inhalt: der lange Geldbetrag
                                  bekommt den Platz, den die kurze Anzahl nicht
                                  braucht */
  min-width: 0;
}
.kz-teil + .kz-teil {
  padding-left: 9px;
  border-left: 1px solid var(--color-border);
}
.kz-teil-wert {
  font-family: var(--f-head);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;         /* Ziffernfolgen nie umbrechen */
}
.kz-teil-wert small {
  font-size: .66em;
  font-weight: 600;
  margin-left: 1px;
  color: var(--color-text-muted);
}
.kz-teil-label {
  font-size: .68rem;
  color: var(--color-text-lighter);
  line-height: 1.25;
  overflow-wrap: anywhere;
  hyphens: auto;
}
/* Ampelton der Kachel gilt für alle Teilwerte — gewertet wird die Kachel,
   nicht der einzelne Wert. */
.kz-kachel--gut .kz-teil-wert { color: #15803d; }
html.dark .kz-kachel--gut .kz-teil-wert { color: #4ade80; }
.kz-kachel--warn .kz-teil-wert { color: var(--color-accent); }
/* Fehlender Wert bleibt grau — steht bewusst NACH den Ton-Regeln, sonst
   würde ein „–" in einer gut/warn-Kachel eingefärbt. */
.kz-kachel .kz-teil-wert--leer {
  color: var(--color-text-lighter);
  font-weight: 500;
}

/* Enge Kacheln: kleinere Abstände, sobald die Schrift ohnehin gestuft wurde */
.kz-teilwerte--knapp { gap: 6px; }
.kz-teilwerte--knapp .kz-teil + .kz-teil { padding-left: 6px; }
.kz-teilwerte--knapp .kz-teil-label { font-size: .64rem; }

/* Notlösung für sehr schmale Fenster: passen mehrere lange Beträge selbst in
   der kleinsten Stufe nicht nebeneinander, rücken sie in eine zweite Zeile.
   Die Trennlinie wandert dann weg, sonst stünde sie am Zeilenanfang. */
.kz-teilwerte--umbruch { flex-wrap: wrap; row-gap: 6px; }
.kz-teilwerte--umbruch .kz-teil + .kz-teil {
  border-left: 0;
  padding-left: 0;
}

@media (max-width: 640px) {
  .kz-trend-pfeil { width: 26px; height: 26px; }
}


/* ══════════════════════════════════════════════════════════════════════
   Dashboard-Aufbau je Bereich (v2.3.10)

   Vorbild ist das Dashboard auf dem Bildschirm im Startbild: dunkle Fläche,
   Panels mit feinem Rand, eine große Leitzahl, Ringe für Prozentwerte, eine
   Detailtabelle. Das Raster folgt der Datenlage (Vorgabe AL 20.08.2026) —
   fehlen Ringe oder Personen, wächst das Übrige in den Platz hinein.
   ══════════════════════════════════════════════════════════════════════ */

.kz-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.kz-panel {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-bg-light);
  padding: 16px 18px;
  min-width: 0;
}
/* Auf dunklem Grund heben sich die Panels durch eine hellere Fläche und einen
   feinen Innenschein ab — genau die Wirkung, die die Vorlage ausmacht. */
html.dark .kz-panel {
  background: rgba(255, 255, 255, .045);
  border-color: rgba(148, 163, 184, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.kz-panel--leit { grid-column: span 4; }
.kz-panel--leit-breit { grid-column: span 5; }
.kz-panel--ringe { grid-column: span 8; }
.kz-kachelfeld {
  grid-column: span 12;
  /* auto-fit statt auto-fill: Drei Kacheln sollen die Zeile ausfüllen und
     nicht mit leeren Spalten rechts daneben stehen. */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 0;
}
.kz-panel--leit-breit + .kz-kachelfeld { grid-column: span 7; }
.kz-panel--tabelle { grid-column: span 12; margin-bottom: 16px; }

@media (max-width: 1100px) {
  .kz-panel--leit,
  .kz-panel--leit-breit,
  .kz-panel--ringe,
  .kz-panel--leit-breit + .kz-kachelfeld { grid-column: span 12; }
}

.kz-panel-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 12px;
}
.kz-panel-kopf h3 {
  font-family: var(--f-head);
  font-size: .92rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}
.kz-panel-meta { font-size: .76rem; color: var(--color-text-muted); }

/* ── Leitkennzahl ─────────────────────────────────────────────────────── */
/* Das Panel wird so hoch wie seine Nachbarn im Raster. Damit darunter kein
   leeres Feld entsteht, sitzt die Verlaufskurve am Fuß — bei Technik &
   Maschinen stand sonst die halbe Panelhöhe leer. */
.kz-leit {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.kz-leit .kz-leit-kurve { margin-top: auto; }
.kz-leit-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.kz-leit-zeile { display: flex; align-items: baseline; gap: 6px; }
.kz-leit-wert {
  font-family: var(--f-head);
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1;
  color: var(--akzent, var(--color-primary));
}
.kz-leit-einheit {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.kz-leit-delta { font-size: .78rem; margin-top: 6px; }
.kz-leit-kurve { display: block; width: 100%; height: 54px; margin-top: 12px; }
.kz-leit-spanne { font-size: .7rem; color: var(--color-text-muted); text-align: right; }

/* ── Ringe ────────────────────────────────────────────────────────────── */
.kz-ringreihe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.kz-ring { position: relative; text-align: center; padding: 4px 8px 6px; }
.kz-ring-svg { display: block; width: 100%; max-width: 190px; margin: 0 auto; }
.kz-ring-wert-text {
  font-family: var(--f-head);
  font-size: 1.44rem;
  font-weight: 800;
  color: var(--color-text);
  margin-top: -22px;
}
/* Über 100 %: Der Ring kann nicht weiter, die Zahl zeigt es im Akzent an. */
.kz-ring-ueber { color: var(--akzent, var(--color-primary)); }
.kz-ring-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-top: 6px;
}
.kz-ring-delta { font-size: .7rem; margin-top: 3px; }

/* ── Personentabelle ──────────────────────────────────────────────────── */
.kz-delta--gut { color: #15803D; }
.kz-delta--schlecht { color: #DC500F; }
.kz-delta--neutral { color: var(--color-text-muted); }
html.dark .kz-delta--gut { color: #6EE7A0; }
html.dark .kz-delta--schlecht { color: #FDA172; }

/* Bei 24 Personen wäre die Seite sonst doppelt so lang wie der Rest. */
.kz-panel--tabelle .kz-tabelle-wrap { max-height: 340px; overflow-y: auto; }

/* ── Diagramme im Panel-Stil ──────────────────────────────────────────── */
.kz-chart { border-radius: 14px; }
html.dark .kz-chart {
  background: rgba(255, 255, 255, .045);
  border-color: rgba(148, 163, 184, .22);
}


/* ── Verteilung: tritt an die Stelle der Ringe, wo es keine Prozentwerte gibt
   (heute Technik & Maschinen). Die Anteile beziehen sich auf die Summe der
   gezeigten Teile — keine erfundene Zielmarke. ─────────────────────────── */
.kz-verteilung { display: flex; flex-direction: column; height: 100%; }
.kz-verteilung-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.kz-verteilung-titel {
  font-family: var(--f-head);
  font-size: .92rem;
  font-weight: 700;
  color: var(--color-text);
}
.kz-verteilung-summe {
  font-family: var(--f-head);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--akzent, var(--color-primary));
}
.kz-verteilung-balken {
  display: flex;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  gap: 2px;
}
.kz-verteilung-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-size: .74rem;
  font-weight: 700;
  color: #fff;
  transition: var(--transition);
}
.kz-seg--gut { background: #15803D; }
.kz-seg--warn { background: #DC500F; }
.kz-seg--neutral { background: #64748B; }
html.dark .kz-seg--gut { background: #2F855A; }
html.dark .kz-seg--warn { background: #C2410C; }

.kz-verteilung-legende { margin-top: auto; padding-top: 14px; }
.kz-verteilung-zeile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid var(--color-border);
}
.kz-verteilung-punkt {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.kz-verteilung-name { font-size: .82rem; color: var(--color-text); flex: 1 1 auto; }
.kz-verteilung-wert {
  font-family: var(--f-head);
  font-size: .95rem;
  font-weight: 700;
  color: var(--color-text);
}
.kz-info--zeile { position: static; margin-left: 4px; }

/* ── Excel-Vorschau Krank/Urlaub/KUG (03.09.2026) ─────────────────────── */
.kz-hinweis-klein {
  font-size: .74rem;
  color: var(--color-text-lighter);
  margin: 10px 0 0;
}

/* Icon-Knopf neben „Zeitraum der Kacheln" (öffnet die Excel-Vorschau) */
.kz-excel-icon {
  appearance: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg-light);
  width: 34px;
  height: 34px;
  color: var(--color-primary);
  align-self: center;
}
.kz-excel-icon:hover { border-color: var(--color-primary); background: rgba(0, 128, 201, .08); }
html.dark .kz-excel-icon { background: rgba(255, 255, 255, .04); }

/* Modal für die Excel-Vorschau — deutlich breiter als der Formel-Dialog,
   die Blätter sind nach dem Zuschnitt sehr breit/flach (~5:1). */
/* „Vollen Bildschirm nutzen wenn nötig" (Vorgabe AL 03.09.2026) — deutlich
   breiter als der schmale Formel-Dialog, den diese Klasse überschreibt. */
.kz-excel-dlg { width: calc(100vw - 24px); max-width: 2200px; max-height: 94vh; }
.kz-excel-inhalt { padding: 4px 2px 2px; }
.kz-excel-reiter {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.kz-excel-reiterknopf {
  appearance: none;
  cursor: pointer;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 8px 4px 9px;
  margin-bottom: -1px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.kz-excel-reiterknopf:hover { color: var(--color-text); }
.kz-excel-reiterknopf--aktiv { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.kz-excel-flaeche {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px;
  background: var(--color-bg);
  text-align: center;
  overflow-y: auto;
  max-height: calc(94vh - 130px);
}
/* Tabelle oben auf voller Breite, Diagramm eigenständig darunter (statt
   beides in EIN Bild nebeneinander gepresst — Vorgabe AL 03.09.2026). */
.kz-excel-tabelle { display: block; width: 100%; height: auto; border-radius: 4px; }
.kz-excel-diagramm {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 18px auto 0;
  border-radius: 4px;
}

/* ── Paket H (03.09.2026): eigener Zeitraum-Regler für die Kacheln ───── */
.kz-kachelzeit { position: relative; align-self: center; }
.kz-kachelzeit-knopf {
  cursor: pointer;
  list-style: none;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-bg-light);
  white-space: nowrap;
}
.kz-kachelzeit-knopf::-webkit-details-marker { display: none; }
.kz-kachelzeit-knopf::after { content: " ▾"; }
html.dark .kz-kachelzeit-knopf { background: rgba(255, 255, 255, .04); }
.kz-kachelzeit-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px 4px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-bg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}
html.dark .kz-kachelzeit-panel { background: #131c2c; }
.kz-kachelzeit-zeile {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  font-size: .8rem;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
}
.kz-kachelzeit-zeile:hover { background: rgba(0, 128, 201, .08); }
.kz-kachelzeit-zeile--aktiv {
  background: rgba(0, 128, 201, .1);
  font-weight: 600;
  color: var(--color-primary);
}
html.dark .kz-kachelzeit-zeile--aktiv { background: rgba(56, 189, 248, .14); }

/* ===========================================================================
   Auftragszeiten und Werkerleistung (v2.4.0, 08.09.2026)
   ---------------------------------------------------------------------------
   Zwei Reiter mit eigener Datenform: Betriebsaufträge statt Bereichskacheln.
   Sie nutzen die Farbvariablen und Radien des Boards, bringen aber eigene
   Bausteine mit — Blockkarten, Label-Wert-Zeilen, breite Tabellen.
   Jede Tabelle scrollt in ihrem eigenen Rahmen; die Seite selbst darf nie
   seitwärts laufen.
   =========================================================================== */

.ba-schalter { display: inline-flex; gap: 2px; padding: 2px; margin-left: auto;
  background: var(--color-bg-light); border: 1px solid var(--color-border);
  border-radius: 999px; }
.ba-schalter-knopf { padding: .3rem .95rem; font-size: .82rem; font-weight: 600;
  color: var(--color-text-muted); background: none; border: none;
  border-radius: 999px; cursor: pointer; }
.ba-schalter-knopf:hover { color: var(--color-primary); }
.ba-schalter-knopf--aktiv { color: #fff; background: var(--color-primary); }
html.dark .ba-schalter-knopf--aktiv { color: #06131c; }

.ba-wahl { display: flex; align-items: center; gap: .6rem; margin: .9rem 0 1.1rem; }
.ba-wahl-label { font-size: .78rem; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .04em; }
.ba-wahl-select { padding: .4rem .7rem; font: inherit; font-size: .88rem;
  color: var(--color-text); background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-radius: var(--radius); cursor: pointer; }
.ba-wahl-select:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* --- Blockkarten der Monatsansicht --- */
.ba-karten { display: grid; gap: 1rem; margin-bottom: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.ba-karte { padding: 1rem 1.1rem; background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-radius: var(--radius); }
.ba-karte-titel { margin: 0 0 .7rem; font-size: .92rem; font-weight: 700;
  color: var(--color-primary); }
.ba-zeile { display: flex; justify-content: space-between; align-items: baseline;
  gap: 1rem; padding: .22rem 0; font-size: .85rem; }
.ba-zeile-label { color: var(--color-text-muted); }
.ba-zeile-wert { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ba-zeile--betont .ba-zeile-wert { font-size: 1.05rem; color: var(--color-primary); }
.ba-fussnote { margin-top: .3rem; font-size: .74rem; color: var(--color-text-lighter);
  line-height: 1.45; }
.ba-trenner { margin: .6rem 0 .5rem; border: none;
  border-top: 1px solid var(--color-border); }

/* --- Vielfalt-Leiste --- */
.ba-vielfalt { display: flex; flex-wrap: wrap; gap: 1.6rem; padding: .8rem 1.1rem;
  margin-bottom: 1.2rem; background: var(--color-bg-light);
  border-left: 3px solid var(--color-primary); border-radius: var(--radius); }
.ba-vielfalt-feld { display: flex; flex-direction: column; }
.ba-vielfalt-wert { font-size: 1.3rem; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--color-text); }
.ba-vielfalt-label { font-size: .74rem; color: var(--color-text-muted); }

/* --- Kacheln der Wochenansicht --- */
.ba-kacheln { display: grid; gap: .8rem; margin-bottom: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ba-kachel { padding: .85rem 1rem; background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-radius: var(--radius); }
.ba-kachel--leit { border-color: var(--color-primary); border-width: 2px; }
.ba-kachel-label { font-size: .76rem; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .03em; }
.ba-kachel-wert { margin: .3rem 0 .25rem; font-size: 1.75rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.ba-kachel--leit .ba-kachel-wert { color: var(--color-primary); }
.ba-kachel-einheit { font-size: .95rem; font-weight: 600; color: var(--color-text-muted); }
.ba-kachel-hinweis { font-size: .74rem; color: var(--color-text-lighter); line-height: 1.45; }
.ba-zeitraum { margin-bottom: 1.1rem; font-size: .78rem; color: var(--color-text-muted); }

/* --- Tabellen: scrollen im eigenen Rahmen, nie die Seite --- */
.ba-tabelle-wrap { overflow-x: auto; margin: .4rem 0 .2rem;
  border: 1px solid var(--color-border); border-radius: var(--radius); }
.ba-tabelle { width: 100%; border-collapse: collapse; font-size: .82rem; }
.ba-tabelle th { padding: .5rem .7rem; font-size: .72rem; font-weight: 700;
  color: #fff; text-align: left; background: var(--color-primary);
  white-space: nowrap; position: sticky; top: 0; }
html.dark .ba-tabelle th { color: #06131c; }
.ba-tabelle td { padding: .4rem .7rem; border-top: 1px solid var(--color-border);
  white-space: nowrap; }
.ba-tabelle tbody tr:nth-child(even) { background: var(--color-bg-light); }
.ba-num { text-align: right; font-variant-numeric: tabular-nums; }
.ba-negativ td:first-child { box-shadow: inset 3px 0 0 var(--color-accent, #DC500F); }
.ba-tabelle--werker td:nth-child(3) { font-weight: 700; }
.ba-tabelle--reihe td { white-space: nowrap; }
.ba-reihe-jahr { font-weight: 700; font-size: .95rem; color: var(--color-primary);
  vertical-align: top; border-right: 1px solid var(--color-border); }
.ba-reihe-art { font-size: .74rem; color: var(--color-text-muted); }
.ba-reihe-schnitt { font-weight: 700; border-left: 1px solid var(--color-border); }
.ba-hervor { font-weight: 700; color: var(--color-primary);
  background: rgba(0, 128, 201, .1); }
html.dark .ba-hervor { background: rgba(56, 189, 248, .16); }

/* --- Aufklappbare Abschnitte --- */
.ba-klappe { margin: .9rem 0; background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-radius: var(--radius); }
.ba-klappe > summary { display: flex; align-items: baseline; gap: .7rem;
  padding: .6rem .9rem; cursor: pointer; list-style: none; }
.ba-klappe > summary::-webkit-details-marker { display: none; }
.ba-klappe > summary::before { content: '▸'; color: var(--color-primary);
  font-size: .8rem; transition: transform .15s ease; }
.ba-klappe[open] > summary::before { transform: rotate(90deg); }
.ba-klappe > summary:focus-visible { outline: 2px solid var(--color-primary);
  outline-offset: -2px; }
.ba-klappe-titel { font-size: .88rem; font-weight: 700; }
.ba-klappe-zusatz { font-size: .76rem; color: var(--color-text-muted); }
.ba-klappe > *:not(summary) { padding: 0 .9rem .9rem; }
.ba-klappe > .ba-tabelle-wrap { margin: 0 .9rem .9rem; padding: 0; }
.ba-vorbehalt-liste { margin: 0; padding-left: 1.6rem; font-size: .8rem;
  line-height: 1.6; color: var(--color-text-muted); }
.ba-vorbehalt-liste li { margin-bottom: .45rem; }

/* --- Streuung: zwei Spalten, zwei Adressaten --- */
.ba-streuung { margin-top: 1.4rem; }
.ba-streuung-kopf h3 { margin: 0 0 .3rem; font-size: 1rem; }
.ba-streuung-text { margin: 0 0 .9rem; max-width: 68ch; font-size: .82rem;
  line-height: 1.6; color: var(--color-text-muted); }
.ba-streuung-spalten { display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.ba-spalte { padding: .9rem 1rem; background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-radius: var(--radius); }
.ba-spalte h4 { margin: 0 0 .2rem; font-size: .88rem; }
.ba-spalte--zeit { border-top: 3px solid var(--color-primary); }
.ba-spalte--ablauf { border-top: 3px solid var(--color-accent, #DC500F); }
.ba-spalte-hinweis { margin: 0 0 .6rem; font-size: .76rem; color: var(--color-text-muted); }
.ba-spalte .ba-tabelle-wrap { margin-left: 0; margin-right: 0; }
.ba-leer { font-size: .8rem; color: var(--color-text-lighter); }

/* --- Werkerleistung --- */
.ba-datenschutz { padding: .7rem 1rem; margin-bottom: 1rem; font-size: .82rem;
  line-height: 1.55; background: rgba(220, 80, 15, .08);
  border-left: 3px solid var(--color-accent, #DC500F); border-radius: var(--radius); }
.ba-bezug { display: flex; align-items: center; gap: 1.2rem; padding: .9rem 1.1rem;
  margin-bottom: 1rem; background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-radius: var(--radius); }
.ba-bezug-wert { font-size: 2.1rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--color-primary); white-space: nowrap; }
.ba-bezug-text { font-size: .82rem; line-height: 1.55; max-width: 62ch;
  color: var(--color-text-muted); }
.ba-bezug-text strong { color: var(--color-text); }
.ba-abstand { font-variant-numeric: tabular-nums; font-weight: 600; }
.ba-abstand--hoch { color: var(--color-accent, #DC500F); }
.ba-abstand--tief { color: var(--color-text-muted); }
.ba-abdeckung { margin-top: .7rem; font-size: .76rem; line-height: 1.5;
  color: var(--color-text-lighter); }

/* --- Warnung des Siemens-Wächters --- */
.ba-warnung { padding: .7rem 1rem; margin-bottom: 1rem; font-size: .84rem;
  line-height: 1.5; background: rgba(220, 80, 15, .1);
  border: 1px solid rgba(220, 80, 15, .35); border-radius: var(--radius); }

@media (max-width: 640px) {
  .ba-schalter { margin-left: 0; }
  .ba-bezug { flex-direction: column; align-items: flex-start; gap: .5rem; }
}
.ba-unvollstaendig { padding: .55rem .9rem; margin: -.5rem 0 1.1rem; font-size: .8rem;
  line-height: 1.5; background: rgba(220, 80, 15, .08);
  border-left: 3px solid var(--color-accent, #DC500F); border-radius: var(--radius); }

/* --- v2.4.1: kompakte, sortierbare Tabellen mit Einheit in der Überschrift --- */
.ba-tabelle { font-size: .78rem; }
.ba-tabelle th {
  padding: .35rem .5rem; text-align: center; vertical-align: bottom;
  cursor: pointer; user-select: none; position: sticky; top: 0;
}
.ba-tabelle th:hover { background: var(--color-primary-dark, #005B8F); }
.ba-tabelle th:focus-visible { outline: 2px solid var(--color-accent, #DC500F);
  outline-offset: -2px; }
.ba-th-inner { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.ba-th-titel { font-size: .72rem; }
.ba-th-einheit { font-size: .62rem; font-weight: 500; opacity: .78; letter-spacing: .02em; }
.ba-sort { margin-left: .25rem; font-size: .6rem; opacity: .85; }
.ba-th--sortiert { background: var(--color-primary-dark, #005B8F); }
.ba-tabelle td { padding: .28rem .5rem; text-align: center; }
.ba-tabelle td.ba-links, .ba-tabelle th.ba-links { text-align: left; }
.ba-tabelle th.ba-links .ba-th-inner { align-items: flex-start; }
.ba-tabelle td { font-variant-numeric: tabular-nums; }

/* Anteilsbalken in der Zelle */
.ba-balken-box { display: inline-flex; align-items: center; gap: .4rem; }
.ba-balken { position: relative; display: inline-block; width: 54px; height: 7px;
  background: var(--color-border); border-radius: 4px; overflow: hidden; }
.ba-balken-fuell { display: block; height: 100%; background: var(--color-primary);
  border-radius: 4px; }
.ba-balken--warn .ba-balken-fuell { background: var(--color-accent, #DC500F); }
.ba-balken-zahl { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }

/* Dritte Streuungsspalte */
.ba-spalte--reserve { border-top: 3px solid var(--gruen, #1E7B4D); }
html.dark .ba-spalte--reserve { border-top-color: #4FBF85; }

/* Diagramme */
.ba-diagramme { display: grid; gap: 1rem; margin-top: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.ba-diagramme .kz-chart { margin: 0; }

/* Beurteilung der Werkerleistung */
.ba-beurteilung-kopf { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-bottom: .8rem; }
.ba-verteilung { display: flex; flex-direction: column; padding: .5rem .9rem;
  background: var(--color-bg-light); border-radius: var(--radius);
  border-left: 3px solid var(--color-border); }
.ba-verteilung--gut { border-left-color: var(--gruen, #1E7B4D); }
.ba-verteilung--warn { border-left-color: var(--color-accent, #DC500F); }
.ba-verteilung-wert { font-size: 1.5rem; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.ba-verteilung-label { font-size: .72rem; color: var(--color-text-muted); }
.ba-marke { display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em; }
.ba-marke--gut { background: rgba(30,123,77,.14); color: #1E7B4D; }
html.dark .ba-marke--gut { background: rgba(79,191,133,.18); color: #4FBF85; }
.ba-marke--neutral { background: var(--color-bg-light); color: var(--color-text-muted); }
.ba-marke--warn { background: rgba(220,80,15,.14); color: #DC500F; }
html.dark .ba-marke--warn { background: rgba(251,146,60,.2); color: #FB923C; }
.ba-trend { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ba-trend--verschlechtert { color: var(--color-accent, #DC500F); }
.ba-trend--verbessert { color: var(--gruen, #1E7B4D); }
html.dark .ba-trend--verbessert { color: #4FBF85; }

.ba-urteile { display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.ba-urteil { padding: .7rem .9rem; background: var(--color-bg-light);
  border: 1px solid var(--color-border); border-left-width: 3px;
  border-radius: var(--radius); }
.ba-urteil--auffaellig { border-left-color: var(--color-accent, #DC500F); }
.ba-urteil--schnell { border-left-color: var(--gruen, #1E7B4D); }
.ba-urteil--im_rahmen { border-left-color: var(--color-border); }
.ba-urteil-kopf { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .35rem; }
.ba-urteil-nr { font-size: .72rem; color: var(--color-text-lighter);
  font-variant-numeric: tabular-nums; }
.ba-urteil-wert { margin-left: auto; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.ba-urteil-analyse { margin: 0 0 .4rem; font-size: .78rem; line-height: 1.5;
  color: var(--color-text-muted); }
.ba-urteil-empfehlung { margin: 0; font-size: .78rem; line-height: 1.5; }
/* Die Streuungsspalten teilen sich eine Zeile — dort ist Platz knapp. Lange
   Bezeichnungen werden gekürzt statt die Zahlenspalten aus dem Bild zu drücken. */
.ba-streuung-spalten { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.ba-spalte .ba-tabelle td.ba-links { max-width: 15rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.ba-tabelle--versteckt td.ba-links:last-child { max-width: 22rem; overflow: hidden;
  text-overflow: ellipsis; }
.ba-marke--leise { background: var(--color-bg-light); color: var(--color-text-lighter);
  font-weight: 500; }
.ba-urteil--zu_wenig_daten { border-left-color: var(--color-border); opacity: .82; }
/* Zweiter Umschalter (mit/ohne Siemens) sitzt neben dem ersten, nicht darunter:
   beide steuern dieselbe Ansicht. margin-left:auto hat schon der erste. */
.ba-schalter--gruppe { margin-left: .5rem; }
.ba-gruppenhinweis { padding: .55rem .9rem; margin: .9rem 0 0; font-size: .78rem;
  line-height: 1.5; color: var(--color-text-muted);
  background: var(--color-bg-light); border-left: 3px solid var(--color-border);
  border-radius: var(--radius); }
.ba-gruppenhinweis strong { color: var(--color-text); }
@media (max-width: 780px) { .ba-schalter--gruppe { margin-left: 0; } }

/* --- v2.4.4: vier Kacheln mit Zweitwert, Diagramm je Kachel --- */
.ba-kacheln--vier { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.ba-kachel-zweit { display: flex; align-items: baseline; gap: .4rem;
  margin: -.1rem 0 .3rem; padding-top: .25rem;
  border-top: 1px solid var(--color-border); }
.ba-kachel-zweit-wert { font-size: 1.05rem; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--color-accent, #DC500F); }
html.dark .ba-kachel-zweit-wert { color: #FB923C; }
.ba-kachel-zweit-label { font-size: .72rem; color: var(--color-text-muted); }
.ba-diagramme--einzeln { grid-template-columns: 1fr; margin: 0 0 1.1rem; }
.ba-kachel-praefix { font-size: 1.1rem; font-weight: 600; color: var(--color-text-muted); }
.ba-kachel-nachsatz { font-size: .74rem; font-weight: 600; color: var(--color-text-muted);
  letter-spacing: .01em; white-space: nowrap; }
/* Kachel-Titel nie mitten im Wort trennen (Großschrift macht aus ß ein SS). */
.ba-kachel-label { overflow-wrap: normal; word-break: keep-all; hyphens: none; }
/* Vier Verläufe stehen als 2x2 ruhiger als in einer 3+1-Reihe — und die
   Diagramme werden dabei groß genug, um die Wochen einzeln abzulesen. */
@media (min-width: 900px) {
  .ba-diagramme--paare { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
