/* Bereich Kennzahlen (Vorbild KM-KPI). Klassen mit Kürzel kz-. Farben laut Gesamtentwurf. */

.kz-seite { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.kz-zeile { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.kz-rahmen { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Rahmen: Banner, Filter, Stand, Reiter, Meldung ---------- */
.kz-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.kz-filter-hinweis { align-self: center; }
.kz-feld { display: flex; flex-direction: column; gap: 4px; }
.kz-feld select, .kz-feld input, .kz-formular input, .kz-formular select, .kz-formular textarea, .kz-eingabe, .kz-eingabe-zahl {
    min-height: 32px; box-sizing: border-box; padding: 4px 6px; border: 1px solid #8a8a89; border-radius: 4px; background: #fff; font: inherit; color: #161616;
}
.kz-feld select:focus, .kz-feld input:focus, .kz-formular input:focus, .kz-formular select:focus, .kz-formular textarea:focus { outline: none; border-color: var(--km-fokus); box-shadow: 0 0 0 .2rem rgba(31,127,207,.25); }
.kz-stand { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.kz-reiterleiste { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; border-bottom: 1px solid #e0e0e0; }
.kz-reiter { display: flex; flex-wrap: wrap; gap: 2px; }
.kz-reiter button { min-height: 36px; padding: 6px 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; background: transparent; font: inherit; color: #161616; cursor: pointer; }
.kz-reiter button:hover { background: var(--km-gruen-hell); }
.kz-reiter button.aktiv { background: #d6eefd; border-bottom-color: #46a9ff; font-weight: 600; }
.kz-reiter-aktionen { padding-bottom: 6px; }
.kz-meldung { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 8px; background: #e7f7ec; border: 1px solid #bce7c6; color: #1c7a3a; }
.kz-modus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }

.kz-klein-btn { min-height: 26px; padding: 2px 8px; font-size: 13px; }
.kz-link-btn { border: 0; background: transparent; padding: 0; font: inherit; color: var(--km-fokus); cursor: pointer; text-align: left; }
.kz-link-btn:hover { text-decoration: underline; }
.kz-link { color: var(--km-fokus); text-decoration: none; }
.kz-link:hover { text-decoration: underline; }

/* ---------- Segment-Schalter ---------- */
.kz-segment-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.kz-segment { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.kz-segment button { min-height: 30px; padding: 4px 12px; border-radius: 4px; border: 1px solid #d3d3d2; background: #fff; font: inherit; cursor: pointer; color: #161616; }
.kz-segment button.aktiv { background: #d6eefd; border-color: #46a9ff; font-weight: 600; }

/* ---------- Karten ---------- */
.kz-karte { box-sizing: border-box; min-width: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.1); overflow: hidden; }
.kz-karte-kopf { min-height: 56px; box-sizing: border-box; padding: 8px 16px; background: #acde79; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.kz-karte-kopf h2 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.2; color: #2c3332; }
.kz-karte-unter { margin-top: 2px; font-size: 12px; color: #2c3332; }
.kz-karte-titel { min-width: 0; }
.kz-karte-inhalt { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; }
.kz-karte-fuss { padding: 8px 16px; border-top: 1px solid #e9ecef; font-size: 12px; color: #5c636a; background: #fafbfb; }

/* ---------- KPI-Kacheln ---------- */
.kz-kpis { display: grid; gap: 12px; }
.kz-kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 8px; background: #fff; border: 1px solid #e9ecef; border-left: 4px solid #e9ecef; box-shadow: 0 1px 3px rgba(0,0,0,.06); min-width: 0; }
.kz-kpi-label { font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: #5c636a; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kz-kpi-wert { font-size: 24px; font-weight: 700; line-height: 1.25; color: #146c43; font-variant-numeric: tabular-nums; }
.kz-kpi-meta { font-size: 12px; color: #5c636a; }
.kz-kpi-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 4px; font-size: 13px; }
.kz-seg { display: flex; height: 8px; border-radius: 4px; background: #e1e8eb; overflow: hidden; }
.kz-seg > span { display: block; height: 8px; }

/* ---------- Hinweise ---------- */
.kz-hinweis { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; border: 1px solid; }
.kz-hinweis strong { font-weight: 600; margin-right: 6px; }
.kz-hinweis.info { background: #e8f3ff; border-color: #c7e4fb; color: #235b7e; }
.kz-hinweis.ok { background: #e7f7ec; border-color: #bce7c6; color: #1c7a3a; }
.kz-hinweis.warn { background: #fdf1da; border-color: #f5d9a8; color: #9a6206; }
.kz-hinweis.danger { background: #fbe9e6; border-color: #f0b9b0; color: #a01b1b; }
.kz-hinweis.neutral { background: #e1e8eb; border-color: #e1e8eb; color: #2c3332; }
.kz-schloss { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }

/* ---------- Tabellen ---------- */
.kz-tabelle-titel { font-weight: 600; font-size: 14px; color: #2c3332; }
.kz-tabelle-rahmen { overflow-x: auto; max-width: 100%; }
.kz-tabelle { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kz-tabelle th { text-align: left; font-weight: 600; font-size: 12px; color: #3f3f3e; padding: 6px 8px; border-bottom: 2px solid #e0e0e0; white-space: nowrap; background: #fff; }
.kz-tabelle td { padding: 6px 8px; border-bottom: 1px solid #eef1f2; vertical-align: top; }
.kz-tabelle tbody tr:nth-child(even) { background: rgba(225,232,235,.5); }
.kz-tabelle tbody tr.kz-fuss, .kz-tabelle tbody tr.kz-fuss:nth-child(even) { background: #f2f2f2; font-weight: 600; }
.kz-tabelle tbody tr.kz-abgeblendet { opacity: .55; }
.kz-tabelle .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kz-tabelle .f { font-weight: 600; }
.kz-tabelle .kz-einzug { padding-left: 24px; }
.kz-tabelle .kz-einzug2 { padding-left: 32px; }
.kz-tabelle .kz-leer { color: #5c636a; font-style: italic; }
.kz-unter { font-size: 12px; color: #5c636a; font-weight: 400; }
.kz-tag { margin-left: 6px; }
.kz-zbalken { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; }
.kz-zbalken-spur { display: inline-block; flex: 1; min-width: 70px; height: 8px; border-radius: 4px; background: #e1e8eb; overflow: hidden; }
.kz-zbalken-spur > span { display: block; height: 8px; border-radius: 4px; }
.kz-umschalter { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600; cursor: pointer; text-align: left; color: #161616; }
.kz-pfeil { display: inline-block; width: 14px; color: #5c636a; }
.kz-dialog-tabelle { max-height: 420px; overflow: auto; }
.kz-eingabe { width: 100%; }
.kz-eingabe-zahl { width: 120px; text-align: right; }

/* ---------- Diagramme (inline-SVG) ---------- */
.kz-diagramm { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kz-dg-titel { display: flex; justify-content: space-between; font-size: 12px; color: #5c636a; }
.kz-dg-raster { display: grid; column-gap: 6px; row-gap: 4px; }
.kz-dg-y { position: relative; font-size: 11px; color: #5c636a; }
.kz-dg-y > span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kz-dg-y2 > span { right: auto; left: 0; }
.kz-dg-plot { position: relative; min-width: 0; }
.kz-dg-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.kz-dg-plot rect:hover { fill: rgba(70,169,255,.08); }
.kz-dg-x { display: grid; font-size: 11px; color: #5c636a; text-align: center; }
.kz-dg-x > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kz-dg-xtitel { font-size: 12px; color: #5c636a; text-align: center; }
.kz-legende { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12px; color: #3f3f3e; }
.kz-legende-eintrag { display: inline-flex; align-items: center; gap: 6px; }
.kz-lg-flaeche { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.kz-lg-linie { display: inline-block; width: 18px; height: 0; border-top: 3px solid; }
.kz-lg-linie.gestrichelt { border-top-style: dashed; border-top-width: 2px; }

/* ---------- Ring ---------- */
.kz-ring { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.kz-ring svg { width: 140px; height: 140px; flex: none; }
.kz-ring-legende { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.kz-ring-legende li { display: grid; grid-template-columns: 14px auto auto; gap: 8px; align-items: center; }
.kz-ring-legende strong { font-variant-numeric: tabular-nums; }

/* ---------- Balkenliste und Schritte ---------- */
.kz-balkenliste { display: flex; flex-direction: column; gap: 8px; }
.kz-balkenzeile { display: grid; grid-template-columns: minmax(140px, 40%) 1fr auto; align-items: center; gap: 8px; }
.kz-balken-spur { height: 10px; border-radius: 5px; background: #e1e8eb; overflow: hidden; }
.kz-balken-spur > span { display: block; height: 10px; border-radius: 5px; }
.kz-balken-wert { font-weight: 600; font-variant-numeric: tabular-nums; }
.kz-balken-meta { grid-column: 1 / -1; }
.kz-schritte { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kz-schritte li { padding: 6px 10px; border-left: 4px solid #e1e8eb; background: #f8f9fa; border-radius: 0 6px 6px 0; }
.kz-schritt-kopf { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.kz-schritt-wert { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Engpässe ---------- */
.kz-engpaesse { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.kz-engpass { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid #e9ecef; border-left: 4px solid #e9ecef; border-radius: 6px; }
.kz-kundenliste { list-style: none; margin: 4px 0 0; padding: 6px 10px; background: #f8f9fa; border-radius: 6px; display: flex; flex-direction: column; gap: 4px; }
.kz-kundenliste li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }

/* ---------- Formulare ---------- */
.kz-formular { display: flex; flex-direction: column; gap: 10px; }
.kz-formular label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #5c636a; }
.kz-raster2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kz-raster3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 10px 0; }
.kz-ganz { grid-column: 1 / -1; }
.kz-formular label.kz-check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: #161616; }
.kz-formular label.kz-check input { min-height: 0; }
.kz-formular-zeile { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.kz-suche input { min-width: 280px; }
.kz-suche { max-width: 360px; }
.kz-grid { min-width: 0; }
.kz-auswahl-breit select { min-width: 360px; max-width: 100%; }

@media (max-width: 700px) {
    .kz-stand { margin-left: 0; }
    .kz-auswahl-breit select, .kz-suche input { min-width: 0; width: 100%; }
    .kz-kpi-wert { font-size: 20px; }
}

/* Karten direkt in der Seitenspalte nicht in der Höhe stauchen (Breite kommt inline für Zeilen). */
.kz-seite > .kz-karte { flex: 0 0 auto !important; }
.kz-tabelle .km-ampel { white-space: nowrap; }

/* Forderungen: Altersstruktur und Kundentabelle untereinander, erst ab 1921 px nebeneinander. */
.kz-ford-zeile { display: flex; flex-direction: column; gap: 20px; align-items: stretch; }
.kz-ford-zeile > .kz-karte { flex: 0 0 auto !important; width: 100%; }
@media (min-width: 1921px) {
    .kz-ford-zeile { flex-direction: row; align-items: flex-start; }
    .kz-ford-zeile > .kz-karte:first-child { flex: 1 1 380px !important; width: auto; }
    .kz-ford-zeile > .kz-karte:last-child { flex: 2 1 560px !important; width: auto; }
}

/* Tabelle „Offene Forderungen je Kunde“: scrollt in sich, Kopf bleibt stehen. */
.kz-ford-rahmen { overflow-x: auto; max-width: 100%; }  /* keine eigene Höhe: die Seite scrollt, nicht die Tabelle */
.kz-ford thead th { border-bottom: 0; box-shadow: inset 0 -2px 0 #e0e0e0; }
.kz-ford tbody tr.kz-ford-kunde { background: transparent; }
.kz-ford tbody:nth-of-type(even) tr.kz-ford-kunde { background: rgba(225,232,235,.5); }
.kz-ford tbody tr.kz-ford-detail { background: #fff; }
.kz-ford tbody tr.kz-ford-detail > td { padding: 4px 8px 12px 30px; }
.kz-ford-pfeil { margin-right: 2px; }
.kz-sort-btn { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; white-space: nowrap; }
.kz-sort-btn:hover { text-decoration: underline; }
.kz-sort-pfeil { margin-left: 4px; font-size: 10px; color: #5c636a; }
