/* =====================================================================
   KI-Kundenmonitor Commodity: Stylesheet (Thüga-Designsystem)
   Quelle: docs/marke.md und globals.css aus SLH.THEE.SMS. Keine Rundungen,
   keine Schatten, Tiefe über Linien und Flächen. Präfix km-. Alle Maße in rem
   (Raster 4 px = 0.25rem); die Wurzelschrift wächst auf großen Bildschirmen,
   damit die Demo auf dem Beamer lesbar bleibt.

   KLASSENVERZEICHNIS (Modifikatoren nach Schrägstrich; is-… sind Zustände)

   HÜLLE
   km-app            Vollbild-Hülle (Topbar, Hinweisstreifen, Shell)
   km-topbar         dunkelblaue Kopfzeile
   km-brand          Produktname links (km-brand__mark Plus-Quadrat, __name, __sub)
   km-topbar__spacer schiebt den Rest nach rechts
   km-topbar__badge  Hinweis-Badge Demonstrator
   km-tenant         Mandanten-Feld (km-tenant__label, __field, __logo, __name)
   km-persona        Persona-Umschalter als details (__summary, __avatar, __name,
                     __role, __panel, __option / is-selected, __option-name, __option-role)
   km-notice-strip   schmaler Hinweisstreifen unter der Topbar
   km-shell          Zeile aus Sidebar und Hauptbereich
   km-sidebar        helle Navigation (__foot, __logo, __org)
   km-nav            Navigationsliste; km-nav__link / is-active, km-nav__label, km-nav__count
   km-main           scrollender Hauptbereich (id km-main)
   km-page           Inhaltsbreite im Hauptbereich

   SEITENKOPF UND TITEL
   km-page-header    Kopf mit Titel links, Aktionen rechts (__main, __sub, __actions)
   km-breadcrumb     Brotkrumen über dem Titel
   km-headline       Seitentitel in Versalien; Text in <span> bekommt den Balken
   km-section-title  Abschnittstitel in Versalien; Text in <span> bekommt den Balken
   km-balken         Balken für beliebigen Inline-Text
   km-entity-title   Firmenname gemischt, dunkelblau, ohne Balken
   km-label          Kleinbeschriftung in Versalien (Feld- und Blockbeschriftung)
   km-section        Abschnitt mit oberem Abstand (__head)

   KENNZAHLEN UND CARDS
   km-kpi-row        Raster für Kennzahl-Kacheln
   km-kpi            Kachel / is-critical (roter Rand, rote Zahl);
                     __label, __value, __delta (is-up, is-down, is-good, is-bad), __note
   km-card           weiße Fläche mit Linie / km-card--accent (blauer Kopfrand),
                     km-card--flush (Inhalt ohne Innenabstand); __head, __title, __body, __foot
   km-detail         Detailpanel (__head, __section, __section-title)

   TABELLEN, TABS, FILTER
   km-table-wrap     Rahmen um Tabelle (Notbremse gegen Überbreite)
   km-table          Tabelle; tr.km-row--click klickbar, tr.is-selected, tr.is-tenant
   km-num            Zahlenzelle rechts, tabellarische Ziffern
   km-cell-main      Hauptzeile in der Zelle; km-cell-sub Nebenzeile
   km-tabs           Tab-Leiste; km-tab / is-active, km-tab__count
   km-filterbar      Filterleiste (__spacer, __count)
   km-segment        Segment-Schalter; km-segment__btn / is-active
   km-select         Auswahlliste (am <select>)
   km-search         Suchfeld mit Lupe (Wrapper um km-input)

   BADGES
   km-badge          Basis / --bestand, --ziel, --strom, --gas, --evidenz-hoch,
                     --evidenz-mittel, --evidenz-niedrig, --beispiel, --oeffentlich,
                     --live, --neu, --uebernommen, --verworfen, --demo
   km-badges         Reihe von Badges
   km-chips, km-chip Produkt-Schlagworte

   SCORE
   km-score          Gesamtwert / --hoch, --mittel, --niedrig, --sm (kompakt);
                     __value, __level, __text, __title, __sub
   km-scorecard      Score samt Dimensionen
   km-dims, km-dim   drei Dimensionen (__label, __bar mit style=--wert:1..5, __value, __reason)

   SIGNAL-FEED
   km-feed           Liste von Signal-Karten
   km-signal         Signal-Karte / is-new, is-selected; __icon, __body, __meta, __date, __type,
                     __new, __company, __title, __summary, __foot, __source, __score
   km-listrow        kompakte Listenzeile (__icon, __main, __title, __meta, __end)

   LAYOUT
   km-split          zweispaltig: __list links, __detail rechts (klappt unter 1100 px um)
   km-stack          vertikaler Abstand; km-row Reihe; km-grid-2, km-grid-3 Raster
   km-spacer         flexibler Zwischenraum

   INHALTSBLÖCKE
   km-action         Aktionsvorschlag / is-accepted, is-discarded; __head, __title, __marker,
                     __why, __facts, __fact, __cols, __block, __block-title, __foot, __status
   km-steps          nummerierte Schrittliste
   km-prompts        Gesprächsleitfaden (Zitat-Liste)
   km-hypothesis     Hypothese, gestrichelt und kursiv, nicht belegt
   km-fact           Belegtes, durchgezogener Rand (__label, __source)
   km-kv             Schlüssel-Wert-Liste (__row); km-kv--compact
   km-hbar           waagerechter Balken (__label, __track, __fill, __value); --mandant, --median
   km-chart          Diagramm-Rahmen (__head, __title, __plot, __caption)
   km-legend         Legende; km-legend__item / --strom, --gas
   km-svg-*          SVG-Teile: -grid, -axis, -tick, -unit, -line (--strom, --gas), -area,
                     -dot, -marker, -marker-label
   km-flow           Ablaufanzeige Beobachten, Bewerten, Handeln; km-flow__step / is-open,
                     is-active, is-done; __num, __title, __text, __status

   BEDIENELEMENTE
   km-btn            Button / --primary, --secondary, --ghost, --danger, --sm, --block;
                     Zustände is-loading, [disabled]
   km-field          Feldgruppe (__hint, __error); km-required Pflichtmarke
   km-input, km-textarea, km-select; Fehler: aria-invalid="true" oder is-invalid
   km-callout        Hinweis-Box / --info, --warn, --success, --error; __title, __text
   km-empty          Leerzustand (__plus, __title, __text, __actions)
   km-toast-region   Behälter für Toasts; km-toast / --success, --error; __icon, __body,
                     __title, __text, __close
   km-overlay        Dialog-Hintergrund; km-dialog / --wide; __head, __title, __body, __foot, __close
   km-skeleton       Platzhalterfläche / --title, --short, --block; km-dots Ladepunkte
   km-icon           Icon-Größe (km-icon--sm, km-icon--lg); Quelle: Sprite in index.html
   km-sr-only        nur für Screenreader sichtbar
   km-muted          Sekundärtext

   ERGÄNZUNGEN (Runde 2, am Dateiende)
   km-th-sort        Button im Tabellenkopf zum Sortieren; Pfeil per CSS nach th[aria-sort]
   km-listrow--link  klickbare Listenzeile als <a> (Hover, Fokus)
   km-svg-area--gas, km-svg-dot--gas   Gas-Varianten für Chart-Fläche und Endpunkt
   km-hbar--solo     Balken ohne Label (zwei Spalten), z. B. in Tabellenzellen
   km-kpi__unit      Einheit neben dem Kennzahlwert
   km-table--dense   engere Tabelle mit umbrechenden Köpfen; km-cell-wrap für lange Firmennamen
   km-note           Hinweiszeile unter Karten
   km-deadline       Fristzeile mit Kalender-Icon; --warn in Warnfarbe (auch als Textklasse)
   ===================================================================== */

/* ---------- Schrift (PT Sans lokal, Lizenz OFL; Gill Sans greift zuerst) ---------- */
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local("PT Sans"), local("PTSans-Regular"), url("fonts/pt-sans-regular.woff2") format("woff2");
}
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local("PT Sans Bold"), local("PTSans-Bold"), url("fonts/pt-sans-bold.woff2") format("woff2");
}
@font-face {
  font-family: "PT Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: local("PT Sans Italic"), local("PTSans-Italic"), url("fonts/pt-sans-italic.woff2") format("woff2");
}

/* ---------- Tokens (1:1 aus globals.css, dazu AA-Ableitungen) ---------- */
:root {
  --thee-dunkelblau: #234b69;
  --thee-blau: #6b9acd;
  --thee-rot: #e73446;
  --thee-dunkelgruen: #298742;
  --thee-hellgruen: #93c23b;
  --thee-grau: #a6a6a6;

  --text: #23282d;
  --text-sekundaer: #5b6570;
  --grau: #7e7e7e;
  --flaeche: #f4f8fa;
  --karte: #ffffff;
  --linie: #e1e7ed;
  --zeilenlinie: #eef2f5;
  --blau-hell: #e8eef4;
  --markierung: #b9d0e8;
  --rot-hell: #fdecee;
  --warnung: #b9780a;
  --warnung-flaeche: #fdf3e1;
  --topbar-suche: #1a3a52;

  --eingabe-linie: #c9d2db;
  --kopfzeile: #f9fbfc;
  --topbar-gedimmt: #9fb9d8;
  --deaktiviert: #6b7c8c;
  --gruen-hell: #e6f4ec;
  --grau-hell: #f2f2f2;

  /* Abgeleitet, damit Text und Bedienelemente WCAG AA erreichen */
  --rot-text: #c4182b; /* Rot als Schrift auf Weiß/Rot hell (4,6:1 und mehr) */
  --warnung-text: #8a5800; /* Warnung als Schrift auf Warnung-Fläche */
  --gruen-text: #1f6e36; /* Dunkelgrün als kleine Schrift auf Grün hell */
  --gas-flaeche: #eef4dd; /* Hellgrün abgestuft */
  --gas-text: #435f0f;
  --auf-blau: #0f2437; /* Schrift auf Thüga-Blau (Weiß erreicht nur 2,9:1) */
  --blau-hover: #8db2db;
  --eingabe-rand: #8793a0; /* Rand von Eingaben, 3:1 gegen Weiß */
  --platzhalter: #66707a;
  --overlay: rgba(26, 58, 82, 0.6);

  --font: "Gill Sans MT", "Gill Sans", "Gill Sans Nova", "PT Sans", sans-serif;

  /* Abstände im 4-px-Raster */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.25rem;
  --s6: 1.5rem;
  --s8: 2rem;
  --s10: 2.5rem;
  --s12: 3rem;

  --topbar-h: 3.5rem;
  --strip-h: 2.25rem;
}

/* ---------- Basis ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 1600px) {
  html { font-size: 106.25%; } /* 17 px */
}
@media (min-width: 1900px) {
  html { font-size: 112.5%; } /* 18 px */
}
body {
  margin: 0;
  background: var(--flaeche);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* gescrollt wird nur in .km-main */
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

a {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-color: var(--thee-rot);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--thee-dunkelblau);
  text-decoration-color: var(--thee-dunkelblau);
}
:focus-visible {
  outline: 3px solid var(--thee-blau);
  outline-offset: 2px;
}
::placeholder { color: var(--platzhalter); opacity: 1; }
::selection { background: var(--markierung); }

.km-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.km-muted { color: var(--text-sekundaer); }
.km-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.km-spacer { flex: 1 1 auto; }

/* ---------- Icons (Sprite in index.html, Linienstil) ---------- */
.km-icon {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.km-icon--sm { width: 0.875rem; height: 0.875rem; stroke-width: 2; }
.km-icon--lg { width: 1.5rem; height: 1.5rem; }

/* ---------- Hülle ---------- */
.km-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}
.km-topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--s6);
  padding: 0 var(--s6);
  background: var(--thee-dunkelblau);
  color: #fff;
}
.km-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: none;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.km-brand:hover { color: #fff; }
.km-brand__mark { width: 1.75rem; height: 1.75rem; flex: none; }
.km-brand__name { font-size: 1.0625rem; font-weight: 700; letter-spacing: 0.01em; }
.km-brand__sub { font-size: 1.0625rem; font-weight: 400; opacity: 0.85; }
.km-topbar__spacer { flex: 1 1 auto; }
.km-topbar__badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 1.5rem;
  padding: 0 0.625rem;
  border: 1px solid var(--topbar-gedimmt);
  color: var(--topbar-gedimmt);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.km-tenant { flex: none; display: flex; align-items: center; gap: var(--s3); }
.km-tenant__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--topbar-gedimmt);
}
.km-tenant__field {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: 2.25rem;
  padding: 0 var(--s3);
  background: #fff;
  color: var(--text);
}
.km-tenant__logo { height: 1.5rem; width: auto; display: block; }
.km-tenant__name { font-size: 0.9375rem; font-weight: 700; color: var(--thee-dunkelblau); white-space: nowrap; }

.km-persona { position: relative; flex: none; }
.km-persona__summary {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.5rem;
  padding: 0 var(--s1) 0 var(--s3);
  cursor: pointer;
  list-style: none;
  color: #fff;
}
.km-persona__summary::-webkit-details-marker { display: none; }
.km-persona__summary:hover .km-persona__name { text-decoration: underline; text-decoration-color: var(--thee-blau); text-underline-offset: 3px; }
.km-persona__who { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.km-persona__name { font-size: 0.875rem; font-weight: 700; }
.km-persona__role { font-size: 0.75rem; color: var(--topbar-gedimmt); white-space: nowrap; }
.km-persona__avatar {
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--thee-blau);
  color: var(--auf-blau);
  font-size: 0.8125rem;
  font-weight: 700;
}
.km-persona__chevron { color: var(--topbar-gedimmt); }
.km-persona[open] .km-persona__chevron { transform: rotate(180deg); }
.km-persona__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 60;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  background: var(--karte);
  color: var(--text);
  border: 1px solid var(--linie);
  border-top: 3px solid var(--thee-blau);
}
.km-persona__heading { padding: var(--s3) var(--s4) var(--s2); }
.km-persona__option {
  display: block;
  width: 100%;
  padding: var(--s3) var(--s4) var(--s3) calc(var(--s4) - 3px);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-top: 1px solid var(--zeilenlinie);
  text-align: left;
  cursor: pointer;
}
.km-persona__option:hover { background: var(--flaeche); }
.km-persona__option.is-selected { background: var(--blau-hell); border-left-color: var(--thee-blau); }
.km-persona__option-name { display: block; font-weight: 700; color: var(--thee-dunkelblau); }
.km-persona__option-role { display: block; font-size: 0.8125rem; color: var(--text-sekundaer); }

.km-notice-strip {
  flex: none;
  min-height: var(--strip-h);
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s6);
  background: var(--warnung-flaeche);
  color: var(--warnung-text);
  border-bottom: 1px solid #efdcb0;
  font-size: 0.8125rem;
}
.km-notice-strip strong { font-weight: 700; }

.km-shell { flex: 1 1 auto; display: flex; min-height: 0; }

.km-sidebar {
  flex: none;
  width: 15rem;
  display: flex;
  flex-direction: column;
  background: var(--karte);
  border-right: 1px solid var(--linie);
  padding: var(--s4) 0 0;
  overflow-y: auto;
}
.km-nav { display: flex; flex-direction: column; }
.km-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0.625rem var(--s4) 0.625rem calc(var(--s4) - 3px);
  border-left: 3px solid transparent;
  color: var(--text-sekundaer);
  font-size: 1rem;
  text-decoration: none;
}
.km-nav__link:hover { background: var(--flaeche); color: var(--thee-dunkelblau); }
.km-nav__link.is-active,
.km-nav__link[aria-current="page"] {
  background: var(--blau-hell);
  border-left-color: var(--thee-blau);
  color: var(--thee-dunkelblau);
  font-weight: 700;
}
.km-nav__label { flex: 1 1 auto; }
.km-nav__count {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--thee-rot);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.km-sidebar__foot {
  margin-top: auto;
  border-top: 1px solid var(--linie);
}
.km-sidebar__logo { padding: var(--s5) var(--s5) var(--s3); background: #fff; }
.km-sidebar__logo img { display: block; height: 1.75rem; min-height: 18px; width: auto; }
.km-sidebar__org { padding: 0 var(--s5) var(--s5); font-size: 0.8125rem; color: var(--text-sekundaer); }

.km-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: var(--s8) var(--s10) var(--s12);
}
.km-main:focus { outline: none; }
.km-page { max-width: 96rem; margin: 0 auto; }

/* ---------- Titel ---------- */
.km-balken,
.km-headline > span,
.km-section-title > span {
  background-image: linear-gradient(transparent 58%, var(--markierung) 58%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 0.3em 0 0.1em;
}
.km-headline {
  font-size: 1.625rem;
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #000;
}
.km-section-title {
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #000;
}
.km-entity-title {
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--thee-dunkelblau);
}
.km-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-sekundaer);
}
.km-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  font-size: 0.8125rem;
  color: var(--text-sekundaer);
}
.km-breadcrumb a { color: var(--text-sekundaer); }
.km-breadcrumb li + li::before { content: "/"; margin-right: var(--s2); color: var(--grau); }

.km-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s4) var(--s6);
  margin-bottom: var(--s6);
}
.km-page-header__main { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.km-page-header__sub { max-width: 46rem; font-size: 1.0625rem; color: var(--text-sekundaer); }
.km-page-header__actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

.km-section { margin-top: var(--s8); }
.km-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s3);
}

/* ---------- Layout-Helfer ---------- */
.km-stack { display: flex; flex-direction: column; gap: var(--s4); }
.km-stack--lg { gap: var(--s6); }
.km-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.km-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.km-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }

/* ---------- Kennzahlen ---------- */
.km-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--s4);
}
.km-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) var(--s5);
  background: var(--karte);
  border: 1px solid var(--linie);
  border-top: 3px solid var(--markierung);
}
.km-kpi__label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-sekundaer); }
.km-kpi__value { font-size: 2.25rem; line-height: 1; font-weight: 700; color: var(--thee-dunkelblau); font-variant-numeric: tabular-nums; }
.km-kpi__delta { display: inline-flex; align-items: center; gap: var(--s2); font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-kpi__delta.is-up::before,
.km-kpi__delta.is-down::before {
  content: "";
  width: 0; height: 0;
  border-left: 0.3125rem solid transparent;
  border-right: 0.3125rem solid transparent;
}
.km-kpi__delta.is-up::before { border-bottom: 0.5rem solid currentColor; }
.km-kpi__delta.is-down::before { border-top: 0.5rem solid currentColor; }
.km-kpi__delta.is-good { color: var(--gruen-text); }
.km-kpi__delta.is-bad { color: var(--rot-text); }
.km-kpi__note { font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-kpi.is-critical { border-top-color: var(--thee-rot); }
.km-kpi.is-critical .km-kpi__value { color: var(--rot-text); }

/* ---------- Card ---------- */
.km-card { background: var(--karte); border: 1px solid var(--linie); min-width: 0; }
.km-card--accent { border-top: 3px solid var(--thee-blau); }
.km-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--linie);
}
.km-card__title { font-size: 1.0625rem; line-height: 1.6; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #000; }
.km-card__title > span { background-image: linear-gradient(transparent 58%, var(--markierung) 58%); padding: 0 0.3em 0 0.1em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.km-card__body { padding: var(--s5); }
.km-card--flush .km-card__body { padding: 0; }
.km-card__foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--linie); background: var(--kopfzeile); }

/* ---------- Tabellen ---------- */
.km-table-wrap { overflow-x: auto; max-width: 100%; }
.km-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.km-table th {
  padding: 0.625rem var(--s4);
  background: var(--kopfzeile);
  border-bottom: 1px solid var(--linie);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-sekundaer);
  white-space: nowrap;
}
.km-table th.km-num { text-align: right; }
.km-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--zeilenlinie);
  vertical-align: middle;
}
.km-table tr:last-child td { border-bottom: 0; }
.km-table th:first-child,
.km-table td:first-child { border-left: 3px solid transparent; }
.km-row--click { cursor: pointer; }
.km-row--click:hover { background: var(--flaeche); }
.km-row--click:focus-visible { outline-offset: -3px; }
.km-table tr.is-selected { background: var(--blau-hell); }
.km-table tr.is-selected td:first-child { border-left-color: var(--thee-blau); }
.km-table tr.is-tenant { background: var(--blau-hell); font-weight: 700; }
.km-cell-main { display: block; font-weight: 700; color: var(--thee-dunkelblau); }
.km-cell-sub { display: block; font-size: 0.8125rem; color: var(--text-sekundaer); }

/* ---------- Tabs ---------- */
.km-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--linie); }
.km-tab {
  padding: var(--s3) var(--s5);
  margin-bottom: -1px;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font-size: 0.9375rem;
  color: var(--text-sekundaer);
  text-decoration: none;
  cursor: pointer;
}
.km-tab:hover { color: var(--thee-dunkelblau); background: var(--flaeche); }
.km-tab.is-active,
.km-tab[aria-selected="true"] { font-weight: 700; color: var(--thee-dunkelblau); border-bottom-color: var(--thee-blau); }
.km-tab__count { margin-left: var(--s1); font-weight: 400; color: var(--text-sekundaer); font-variant-numeric: tabular-nums; }

/* ---------- Eingaben ---------- */
.km-field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.km-field__hint { font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-field__error { font-size: 0.8125rem; color: var(--rot-text); }
.km-required { color: var(--rot-text); }
.km-input,
.km-textarea,
.km-select {
  width: 100%;
  min-width: 0;
  height: 2.5rem;
  padding: 0 var(--s3);
  background: #fff;
  border: 1px solid var(--eingabe-rand);
  border-radius: 0;
  color: var(--text);
  font-size: 0.9375rem;
}
.km-textarea { height: auto; min-height: 7.5rem; padding: var(--s3); line-height: 1.5; resize: vertical; }
.km-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6570' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}
.km-input:hover, .km-textarea:hover, .km-select:hover { border-color: var(--thee-dunkelblau); }
.km-input:focus, .km-textarea:focus, .km-select:focus {
  border-color: var(--thee-dunkelblau);
  outline: 2px solid var(--thee-blau);
  outline-offset: 0;
}
.km-input.is-invalid, .km-textarea.is-invalid, .km-select.is-invalid,
.km-input[aria-invalid="true"], .km-textarea[aria-invalid="true"], .km-select[aria-invalid="true"] {
  border-color: var(--thee-rot);
  background-color: var(--rot-hell);
}
.km-input:disabled, .km-textarea:disabled, .km-select:disabled { background-color: var(--blau-hell); color: var(--deaktiviert); border-color: var(--eingabe-linie); cursor: not-allowed; }

.km-search { position: relative; flex: 1 1 14rem; max-width: 24rem; }
.km-search .km-icon { position: absolute; left: var(--s3); top: 50%; transform: translateY(-50%); color: var(--text-sekundaer); pointer-events: none; }
.km-search .km-input { padding-left: 2.375rem; }

.km-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3) var(--s4);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  background: var(--karte);
  border: 1px solid var(--linie);
}
.km-filterbar .km-input, .km-filterbar .km-select { height: 2.25rem; }
.km-filterbar .km-select { width: auto; min-width: 11rem; }
.km-filterbar__spacer { flex: 1 1 auto; }
.km-filterbar__count { font-size: 0.8125rem; color: var(--text-sekundaer); font-variant-numeric: tabular-nums; }

.km-segment { display: inline-flex; border: 1px solid var(--thee-dunkelblau); }
.km-segment__btn {
  height: 2.25rem;
  padding: 0 var(--s4);
  background: #fff;
  border: 0;
  border-left: 1px solid var(--thee-dunkelblau);
  color: var(--thee-dunkelblau);
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
}
.km-segment__btn:first-child { border-left: 0; }
.km-segment__btn:hover { background: var(--blau-hell); }
.km-segment__btn.is-active,
.km-segment__btn[aria-pressed="true"] { background: var(--thee-dunkelblau); color: #fff; font-weight: 700; }
.km-segment__btn:focus-visible { outline-offset: -3px; }

/* ---------- Buttons ---------- */
.km-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 2.5rem;
  padding: 0 1.125rem;
  background: #fff;
  border: 1px solid var(--thee-dunkelblau);
  border-radius: 0;
  color: var(--thee-dunkelblau);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.km-btn:hover { background: var(--blau-hell); color: var(--thee-dunkelblau); }
.km-btn--secondary { }
.km-btn--primary { background: var(--thee-blau); border-color: var(--thee-blau); color: var(--auf-blau); }
.km-btn--primary:hover { background: var(--blau-hover); border-color: var(--blau-hover); color: var(--auf-blau); }
.km-btn--ghost { background: transparent; border-color: transparent; color: var(--thee-dunkelblau); }
.km-btn--ghost:hover { background: var(--blau-hell); }
.km-btn--danger { background: #fff; border-color: var(--thee-rot); color: var(--rot-text); }
.km-btn--danger:hover { background: var(--rot-hell); color: var(--rot-text); }
.km-btn--sm { height: 2rem; padding: 0 var(--s3); font-size: 0.8125rem; }
.km-btn--block { width: 100%; }
.km-btn[disabled], .km-btn.is-disabled {
  background: var(--blau-hell);
  border-color: var(--blau-hell);
  color: var(--deaktiviert);
  cursor: not-allowed;
}
.km-btn.is-loading { cursor: progress; pointer-events: none; }
.km-btn.is-loading::before {
  content: "";
  width: 0.75rem; height: 0.75rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: km-drehen 0.9s steps(4) infinite;
}

/* ---------- Badges ---------- */
.km-badges { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.km-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 1.5rem;
  padding: 0 0.625rem;
  background: var(--grau-hell);
  color: var(--text-sekundaer);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.km-badge .km-icon { width: 0.8125rem; height: 0.8125rem; stroke-width: 2.2; }
.km-badge--bestand { background: var(--thee-dunkelblau); color: #fff; }
.km-badge--ziel { background: #fff; color: var(--thee-dunkelblau); box-shadow: none; border: 1px solid var(--thee-dunkelblau); }
.km-badge--strom { background: var(--blau-hell); color: var(--thee-dunkelblau); }
.km-badge--gas { background: var(--gas-flaeche); color: var(--gas-text); }
.km-badge--evidenz-hoch { background: var(--gruen-hell); color: var(--gruen-text); }
.km-badge--evidenz-mittel { background: var(--warnung-flaeche); color: var(--warnung-text); }
.km-badge--evidenz-niedrig { background: var(--grau-hell); color: var(--text-sekundaer); }
.km-badge--beispiel { background: var(--warnung-flaeche); color: var(--warnung-text); }
.km-badge--oeffentlich { background: #fff; color: var(--text-sekundaer); border: 1px solid var(--eingabe-linie); }
.km-badge--live { background: var(--rot-hell); color: var(--rot-text); }
.km-badge--live::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  background: var(--thee-rot);
  animation: km-blinken 1.6s steps(2, jump-none) infinite;
}
.km-badge--neu { background: var(--thee-blau); color: var(--auf-blau); }
.km-badge--uebernommen { background: var(--gruen-hell); color: var(--gruen-text); }
.km-badge--verworfen { background: var(--grau-hell); color: var(--text-sekundaer); text-decoration: line-through; }
.km-badge--demo { background: var(--thee-dunkelblau); color: #fff; }

.km-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.km-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.125rem var(--s3);
  background: var(--blau-hell);
  color: var(--thee-dunkelblau);
  font-size: 0.875rem;
}

/* ---------- Score ---------- */
.km-score { display: inline-flex; align-items: center; gap: var(--s4); }
.km-score__value {
  width: 5rem; height: 5rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--grau-hell);
  border: 1px solid var(--linie);
  color: var(--text-sekundaer);
  font-size: 2.25rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.km-score__value small { margin-top: 0.25rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.km-score__text { display: flex; flex-direction: column; gap: 0.125rem; }
.km-score__title { font-size: 1.25rem; font-weight: 700; color: var(--thee-dunkelblau); line-height: 1.2; }
.km-score__sub { font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-score__level { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-sekundaer); }
.km-score--hoch .km-score__value { background: var(--thee-dunkelblau); border-color: var(--thee-dunkelblau); color: #fff; }
.km-score--mittel .km-score__value { background: var(--thee-blau); border-color: var(--thee-blau); color: var(--auf-blau); }
.km-score--niedrig .km-score__value { background: var(--grau-hell); color: var(--text-sekundaer); }
.km-score--sm { flex-direction: column; align-items: center; gap: 0.25rem; }
.km-score--sm .km-score__value { width: 3.25rem; height: 3.25rem; font-size: 1.375rem; }
.km-score--sm .km-score__value small { display: none; }

.km-scorecard { display: flex; flex-direction: column; gap: var(--s5); }
.km-dims { display: flex; flex-direction: column; }
.km-dim {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) 2.5rem;
  align-items: center;
  gap: var(--s1) var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--zeilenlinie);
}
.km-dim:last-child { border-bottom: 0; }
.km-dim__label { font-weight: 700; color: var(--thee-dunkelblau); }
.km-dim__bar {
  --wert: 0;
  position: relative;
  height: 0.625rem;
  background: var(--blau-hell);
}
.km-dim__bar::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: calc(var(--wert) / 5 * 100%);
  background: var(--thee-dunkelblau);
}
.km-dim__bar::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(20% - 3px), #fff calc(20% - 3px), #fff 20%);
}
.km-dim__value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.km-dim__value small { font-weight: 400; color: var(--text-sekundaer); }
.km-dim__reason { grid-column: 1 / -1; font-size: 0.875rem; color: var(--text-sekundaer); }

/* ---------- Signal-Feed ---------- */
.km-feed { display: flex; flex-direction: column; gap: var(--s2); }
.km-signal {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: var(--s4);
  padding: var(--s4) var(--s5) var(--s4) calc(var(--s5) - 4px);
  background: var(--karte);
  border: 1px solid var(--linie);
  border-left: 4px solid transparent;
  cursor: pointer;
}
.km-signal:hover { border-color: var(--markierung); border-left-color: var(--markierung); }
.km-signal.is-new { border-left-color: var(--thee-blau); }
.km-signal.is-selected {
  background: var(--blau-hell);
  border-color: var(--thee-dunkelblau);
  border-left-color: var(--thee-dunkelblau);
}
.km-signal:focus-visible { outline-offset: 0; }
.km-signal__icon {
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--blau-hell);
  color: var(--thee-dunkelblau);
}
.km-signal.is-selected .km-signal__icon { background: #fff; }
.km-signal__body { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.km-signal__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-signal__date { font-variant-numeric: tabular-nums; }
.km-signal__type { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.75rem; }
.km-signal__new {
  padding: 0 0.375rem;
  background: var(--thee-blau);
  color: var(--auf-blau);
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.km-signal__company { font-size: 0.9375rem; font-weight: 700; color: var(--thee-dunkelblau); }
.km-signal__title { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; color: var(--text); }
.km-signal__summary { font-size: 0.9375rem; color: var(--text-sekundaer); }
.km-signal__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-top: var(--s2); }
.km-signal__source { display: inline-flex; align-items: center; gap: var(--s1); font-size: 0.8125rem; }
.km-signal__score { align-self: start; }

.km-listrow {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: var(--s3);
  align-items: center;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--zeilenlinie);
}
.km-listrow:last-child { border-bottom: 0; }
.km-listrow__icon { width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; background: var(--blau-hell); color: var(--thee-dunkelblau); }
.km-listrow__main { min-width: 0; }
.km-listrow__title { display: block; font-weight: 700; color: var(--thee-dunkelblau); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.km-listrow__meta { display: block; font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-listrow__end { display: flex; align-items: center; gap: var(--s3); }

/* ---------- Zweispaltig und Detail ---------- */
.km-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s6);
  align-items: start;
}
.km-split__list { min-width: 0; }
.km-split__detail {
  min-width: 0;
  position: sticky;
  top: var(--s1);
  max-height: calc(100vh - var(--topbar-h) - var(--strip-h) - var(--s4));
  max-height: calc(100dvh - var(--topbar-h) - var(--strip-h) - var(--s4));
  overflow: auto;
}
.km-detail { background: var(--karte); border: 1px solid var(--linie); border-top: 3px solid var(--thee-dunkelblau); }
.km-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--linie);
}
.km-detail__head > div:first-child { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.km-detail__section { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5) var(--s6); border-bottom: 1px solid var(--zeilenlinie); }
.km-detail__section:last-child { border-bottom: 0; }
.km-detail__section-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-sekundaer); }

/* ---------- Aktionsvorschlag, Hypothese, Beleg ---------- */
.km-action { background: var(--karte); border: 1px solid var(--linie); border-top: 3px solid var(--thee-dunkelgruen); }
.km-action__head { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5) var(--s6) var(--s4); }
.km-action__title { font-size: 1.25rem; line-height: 1.3; font-weight: 700; color: var(--text); }
.km-action__marker { color: var(--thee-dunkelgruen); margin-right: var(--s2); letter-spacing: 0.02em; }
.km-action__status { display: flex; align-items: center; gap: var(--s2); }
.km-action__why { color: var(--text-sekundaer); font-size: 1rem; }
.km-action__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s4); padding: var(--s4) var(--s6); background: var(--kopfzeile); border-top: 1px solid var(--zeilenlinie); border-bottom: 1px solid var(--zeilenlinie); }
.km-action__fact { display: flex; flex-direction: column; gap: 0.25rem; }
.km-action__fact strong { display: inline-flex; align-items: center; gap: var(--s2); font-size: 1rem; color: var(--thee-dunkelblau); }
.km-action__fact span { font-size: 0.875rem; color: var(--text-sekundaer); }
.km-action__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--s5) var(--s6); padding: var(--s5) var(--s6); }
.km-action__block { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.km-action__block-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-sekundaer); }
.km-action__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding: var(--s4) var(--s6); background: var(--kopfzeile); border-top: 1px solid var(--linie); }
.km-action.is-accepted { border-top-color: var(--thee-dunkelgruen); background: #fbfdfc; }
.km-action.is-discarded { border-top-color: var(--thee-grau); }
.km-action.is-discarded .km-action__title,
.km-action.is-discarded .km-action__why { color: var(--text-sekundaer); }
.km-action.is-discarded .km-action__marker { color: var(--text-sekundaer); }

.km-steps { counter-reset: schritt; display: flex; flex-direction: column; gap: var(--s3); }
.km-steps li { counter-increment: schritt; position: relative; padding-left: 2.25rem; min-height: 1.5rem; }
.km-steps li::before {
  content: counter(schritt);
  position: absolute; left: 0; top: 0;
  width: 1.5rem; height: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--blau-hell);
  color: var(--thee-dunkelblau);
  font-size: 0.8125rem; font-weight: 700;
}
.km-prompts { display: flex; flex-direction: column; gap: var(--s3); }
.km-prompts li { padding: 0 0 0 var(--s4); border-left: 3px solid var(--thee-blau); font-style: italic; }

.km-hypothesis {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) var(--s5);
  background: var(--grau-hell);
  border: 1px dashed var(--text-sekundaer);
  font-style: italic;
  color: var(--text);
}
.km-hypothesis .km-label { display: flex; align-items: center; gap: var(--s2); font-style: normal; }
.km-fact {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) var(--s5);
  background: #fff;
  border: 1px solid var(--linie);
  border-left: 4px solid var(--thee-dunkelblau);
}
.km-fact__label { display: flex; align-items: center; gap: var(--s2); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--thee-dunkelblau); }
.km-fact__source { font-size: 0.8125rem; color: var(--text-sekundaer); }

/* ---------- Schlüssel-Wert ---------- */
.km-kv { display: flex; flex-direction: column; }
.km-kv__row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: var(--s4);
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--zeilenlinie);
}
.km-kv__row:last-child { border-bottom: 0; }
.km-kv dt { font-size: 0.875rem; color: var(--text-sekundaer); }
.km-kv dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.km-kv--compact .km-kv__row { padding: 0.375rem 0; }

/* ---------- Waagerechte Balken (Verbund, Vergleich) ---------- */
.km-hbar { display: grid; grid-template-columns: 11rem minmax(0, 1fr) 4.5rem; align-items: center; gap: var(--s3); padding: 0.375rem 0; }
.km-hbar__label { font-size: 0.875rem; color: var(--text); }
.km-hbar__track { position: relative; height: 0.875rem; background: var(--blau-hell); }
.km-hbar__fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--anteil, 0) * 1%); background: var(--thee-dunkelblau); }
.km-hbar--mandant .km-hbar__fill { background: var(--thee-dunkelblau); }
.km-hbar--median .km-hbar__fill { background: var(--thee-grau); }
.km-hbar__value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Diagramm ---------- */
.km-chart { background: var(--karte); border: 1px solid var(--linie); padding: var(--s4) var(--s5) var(--s3); }
.km-chart__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-bottom: var(--s3); }
.km-chart__title { font-weight: 700; color: var(--thee-dunkelblau); }
.km-chart__plot { display: block; width: 100%; height: auto; }
.km-chart__caption { margin-top: var(--s2); font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-legend { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-legend__item { display: inline-flex; align-items: center; gap: var(--s2); }
.km-legend__item::before { content: ""; width: 1.25rem; height: 3px; background: var(--thee-dunkelblau); }
.km-legend__item--gas::before { background: var(--thee-dunkelgruen); }
.km-svg-grid { stroke: var(--linie); stroke-width: 1; }
.km-svg-axis { stroke: var(--eingabe-rand); stroke-width: 1; }
.km-svg-tick { fill: var(--text-sekundaer); font-size: 13px; font-family: var(--font); }
.km-svg-unit { fill: var(--text-sekundaer); font-size: 12px; font-weight: 700; font-family: var(--font); letter-spacing: 0.08em; }
.km-svg-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.km-svg-line--strom { stroke: var(--thee-dunkelblau); }
.km-svg-line--gas { stroke: var(--thee-dunkelgruen); }
.km-svg-area { fill: var(--thee-dunkelblau); fill-opacity: 0.08; stroke: none; }
.km-svg-dot { fill: #fff; stroke: var(--thee-dunkelblau); stroke-width: 2.5; }
.km-svg-marker { stroke: var(--thee-rot); stroke-width: 1.5; stroke-dasharray: 4 3; }
.km-svg-marker-label { fill: var(--rot-text); font-size: 12px; font-weight: 700; font-family: var(--font); }

/* ---------- Ablaufanzeige ---------- */
.km-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); counter-reset: ablauf; }
.km-flow__step {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--s1) var(--s3);
  padding: var(--s4) var(--s5);
  background: var(--karte);
  border: 1px solid var(--linie);
  border-top: 3px solid var(--linie);
}
.km-flow__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%; left: 100%;
  width: var(--s6); height: 2px;
  background: var(--linie);
}
.km-flow__num {
  grid-row: 1 / span 3;
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--eingabe-rand);
  color: var(--text-sekundaer);
  font-size: 1.125rem; font-weight: 700;
}
.km-flow__title { font-size: 1.0625rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-sekundaer); }
.km-flow__text { font-size: 0.875rem; color: var(--text-sekundaer); }
.km-flow__status { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-sekundaer); }
.km-flow__step.is-active { border-top-color: var(--thee-blau); background: var(--blau-hell); border-color: var(--markierung); border-top-color: var(--thee-blau); }
.km-flow__step.is-active .km-flow__num { background: var(--thee-blau); border-color: var(--thee-blau); color: var(--auf-blau); }
.km-flow__step.is-active .km-flow__title { color: var(--thee-dunkelblau); }
.km-flow__step.is-active .km-flow__status { color: var(--thee-dunkelblau); }
.km-flow__step.is-done { border-top-color: var(--thee-dunkelgruen); }
.km-flow__step.is-done .km-flow__num { background: var(--thee-dunkelgruen); border-color: var(--thee-dunkelgruen); color: #fff; }
.km-flow__step.is-done .km-flow__title { color: var(--thee-dunkelblau); }
.km-flow__step.is-done .km-flow__status { color: var(--gruen-text); }

/* ---------- Hinweis-Box ---------- */
.km-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  background: var(--blau-hell);
  border-left: 4px solid var(--thee-blau);
  color: var(--text);
}
.km-callout > .km-icon { margin-top: 0.125rem; color: var(--thee-dunkelblau); }
.km-callout__title { font-weight: 700; color: var(--thee-dunkelblau); }
.km-callout__text { font-size: 0.9375rem; }
.km-callout--warn { background: var(--warnung-flaeche); border-left-color: var(--warnung); }
.km-callout--warn > .km-icon, .km-callout--warn .km-callout__title { color: var(--warnung-text); }
.km-callout--success { background: var(--gruen-hell); border-left-color: var(--thee-dunkelgruen); }
.km-callout--success > .km-icon, .km-callout--success .km-callout__title { color: var(--gruen-text); }
.km-callout--error { background: var(--rot-hell); border-left-color: var(--thee-rot); }
.km-callout--error > .km-icon, .km-callout--error .km-callout__title { color: var(--rot-text); }

/* ---------- Leerzustand ---------- */
.km-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s12) var(--s6);
  text-align: center;
  background: var(--karte);
  border: 1px solid var(--linie);
}
.km-empty__plus { width: 4rem; height: 4rem; color: var(--thee-blau); margin-bottom: var(--s2); }
.km-empty__title { font-size: 1.375rem; font-weight: 700; color: var(--thee-dunkelblau); }
.km-empty__text { max-width: 30rem; font-size: 1rem; color: var(--text-sekundaer); }
.km-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); margin-top: var(--s2); }

/* ---------- Toast ---------- */
.km-toast-region {
  position: fixed;
  right: var(--s6);
  bottom: var(--s6);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: min(26rem, calc(100vw - 3rem));
  pointer-events: none;
}
.km-toast-region--static { position: static; width: min(26rem, 100%); }
.km-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--s3);
  align-items: start;
  padding: 0.875rem var(--s4);
  background: var(--thee-dunkelblau);
  border-left: 4px solid var(--thee-blau);
  color: #fff;
  animation: km-rein 0.18s ease-out;
}
.km-toast__icon { margin-top: 0.125rem; color: var(--thee-blau); }
.km-toast__body { min-width: 0; }
.km-toast__title { font-weight: 700; }
.km-toast__text { font-size: 0.875rem; color: #dbe6f1; }
.km-toast__close { background: transparent; border: 0; padding: var(--s1); color: #dbe6f1; cursor: pointer; }
.km-toast__close:hover { color: #fff; }
.km-toast--success { border-left-color: var(--thee-hellgruen); }
.km-toast--success .km-toast__icon { color: var(--thee-hellgruen); }
.km-toast--error { border-left-color: var(--thee-rot); }
.km-toast--error .km-toast__icon { color: #ff8f9a; }
.km-toast.is-leaving { opacity: 0; transition: opacity 0.18s; }

/* ---------- Dialog ---------- */
.km-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6);
  background: var(--overlay);
}
.km-overlay--static { position: relative; inset: auto; z-index: 0; min-height: 22rem; }
.km-dialog {
  display: flex;
  flex-direction: column;
  width: min(36rem, 100%);
  max-height: calc(100vh - 3rem);
  background: var(--karte);
  border-top: 3px solid var(--thee-blau);
}
.km-dialog--wide { width: min(52rem, 100%); }
.km-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); padding: var(--s5) var(--s6) var(--s3); }
.km-dialog__title { font-size: 1.25rem; font-weight: 700; color: var(--thee-dunkelblau); line-height: 1.3; }
.km-dialog__close { background: transparent; border: 0; padding: var(--s1); color: var(--text-sekundaer); cursor: pointer; }
.km-dialog__close:hover { color: var(--thee-dunkelblau); }
.km-dialog__body { padding: 0 var(--s6) var(--s5); overflow: auto; display: flex; flex-direction: column; gap: var(--s4); }
.km-dialog__foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s3); padding: var(--s4) var(--s6); border-top: 1px solid var(--linie); background: var(--kopfzeile); }

/* ---------- Laden ---------- */
.km-skeleton { display: block; height: 1rem; background: var(--blau-hell); animation: km-pulsieren 1.5s ease-in-out infinite; }
.km-skeleton + .km-skeleton { margin-top: var(--s2); }
.km-skeleton--title { height: 1.75rem; width: 45%; }
.km-skeleton--short { width: 60%; }
.km-skeleton--block { height: 6rem; }
.km-dots { display: inline-flex; align-items: center; gap: 0.25rem; }
.km-dots > span { width: 0.5rem; height: 0.5rem; background: var(--thee-blau); animation: km-pulsieren 1s ease-in-out infinite; }
.km-dots > span:nth-child(2) { animation-delay: 0.15s; }
.km-dots > span:nth-child(3) { animation-delay: 0.3s; }

@keyframes km-drehen { to { transform: rotate(360deg); } }
@keyframes km-pulsieren { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes km-blinken { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes km-rein { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }

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

/* ---------- Schmale Fenster ---------- */
@media (max-width: 1280px) {
  .km-main { padding: var(--s6) var(--s6) var(--s10); }
  .km-tenant__label { display: none; }
  .km-persona__role { display: none; }
}
@media (max-width: 1100px) {
  .km-sidebar { width: 4rem; }
  .km-nav__link { justify-content: center; padding: var(--s3) 0; }
  .km-nav__label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .km-nav__count { position: absolute; top: 0.25rem; right: 0.25rem; min-width: 1rem; height: 1rem; padding: 0 0.25rem; font-size: 0.6875rem; }
  .km-sidebar__foot { display: none; }
  .km-split { grid-template-columns: minmax(0, 1fr); }
  .km-split__detail { position: static; max-height: none; overflow: visible; }
  .km-topbar { gap: var(--s4); padding: 0 var(--s4); }
  .km-topbar__badge { display: none; }
  .km-flow { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .km-flow__step:not(:last-child)::after { display: none; }
  .km-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .km-brand__sub { display: none; }
  .km-main { padding: var(--s4) var(--s4) var(--s8); }
  .km-grid-2, .km-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .km-hbar { grid-template-columns: 7rem minmax(0, 1fr) 3.5rem; }
  .km-dim { grid-template-columns: 7rem minmax(0, 1fr) 2.25rem; }
  .km-signal { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .km-signal__score { grid-column: 2; justify-self: start; }
}


/* ---------- Ergänzungen Runde 2 ---------- */
.km-th-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.km-th-sort:hover { color: var(--thee-dunkelblau); }
.km-th-sort::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 0.25rem solid transparent;
  border-right: 0.25rem solid transparent;
  border-top: 0.3125rem solid currentColor;
  opacity: 0;
}
.km-table th[aria-sort="ascending"] .km-th-sort::after { opacity: 1; border-top: 0; border-bottom: 0.3125rem solid currentColor; }
.km-table th[aria-sort="descending"] .km-th-sort::after { opacity: 1; }
.km-table th[aria-sort="ascending"],
.km-table th[aria-sort="descending"] { color: var(--thee-dunkelblau); }
.km-table th .km-th-sort:hover::after { opacity: 0.45; }
.km-table th[aria-sort="ascending"] .km-th-sort:hover::after,
.km-table th[aria-sort="descending"] .km-th-sort:hover::after { opacity: 1; }

a.km-listrow--link { text-decoration: none; color: inherit; }
a.km-listrow--link:hover { background: var(--flaeche); }
a.km-listrow--link:hover .km-listrow__title { text-decoration: underline; }
a.km-listrow--link:focus-visible { outline-offset: -3px; }

.km-svg-area--gas { fill: var(--thee-dunkelgruen); }
.km-svg-dot--gas { stroke: var(--thee-dunkelgruen); }

.km-hbar--solo { grid-template-columns: minmax(6rem, 1fr) 3.5rem; }

.km-kpi__value { white-space: nowrap; }
.km-kpi__unit { font-size: 1rem; font-weight: 700; color: var(--text-sekundaer); margin-left: var(--s1); }
.km-kpi.is-critical .km-kpi__value { white-space: nowrap; }
.km-kpi__unit { color: var(--rot-text); }

.km-cell-wrap { display: block; min-width: 12rem; max-width: 26rem; overflow-wrap: break-word; }
.km-table--dense { font-size: 0.875rem; }
.km-table--dense th { white-space: normal; vertical-align: bottom; padding: 0.5rem; letter-spacing: 0.04em; }
.km-table--dense td { padding: 0.625rem 0.5rem; }
.km-table--dense .km-badges { gap: 0.25rem; }
.km-table--dense .km-cell-wrap { min-width: 9rem; max-width: 18rem; }
.km-note { margin-top: var(--s3); font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-signal__company, .km-listrow__title--wrap { overflow-wrap: anywhere; }
.km-listrow__title--wrap { white-space: normal; }
.km-entity-title { overflow-wrap: anywhere; }
.km-table td, .km-table th { vertical-align: middle; }

.km-deadline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin: var(--s1) 0 0; font-size: 0.8125rem; color: var(--text-sekundaer); }
.km-deadline strong { color: var(--thee-dunkelblau); }
.km-deadline--warn strong, strong.km-deadline--warn, .km-deadline--warn .km-icon { color: var(--warnung-text); }
.km-deadline--warn strong { font-weight: 700; }
.km-kv dd .km-deadline--warn strong { color: var(--warnung-text); }
