/* Farben: Referenzpalette der dataviz-Leitlinien (palette.md), hell und dunkel
   jeweils eigens gewaehlt, nicht umgedreht. Eine Datenfarbe (Reihe 1), dazu die
   festen Statusfarben – die tragen nie allein Bedeutung, immer mit Symbol und
   Text. Texte stehen immer in Textfarben, nie in der Datenfarbe. */
:root {
  color-scheme: light;
  --seite: #f9f9f7;
  --flaeche: #fcfcfb;
  --tinte: #0b0b0b;
  --tinte-2: #52514e;
  /* Abweichung von der Palette (#898781): die erreicht auf der hellen Flaeche
     nur etwa 3,5:1 – zu wenig fuer 11-px-Achsenbeschriftung. */
  --gedaempft: #6f6d68;
  --raster: #e1e0d9;
  --achse: #c3c2b7;
  --rand: rgba(11, 11, 11, 0.10);
  --reihe: #2a78d6;
  --reihe-flaeche: rgba(42, 120, 214, 0.10);
  --gut: #0ca30c;
  --warnung: #fab219;
  --kritisch: #d03b3b;
  --warnung-grund: rgba(250, 178, 25, 0.14);
  --kritisch-grund: rgba(208, 59, 59, 0.12);
  --hover: rgba(11, 11, 11, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --seite: #0d0d0d;
    --flaeche: #1a1a19;
    --tinte: #ffffff;
    --tinte-2: #c3c2b7;
    --gedaempft: #898781;
    --raster: #2c2c2a;
    --achse: #383835;
    --rand: rgba(255, 255, 255, 0.10);
    --reihe: #3987e5;
    --reihe-flaeche: rgba(57, 135, 229, 0.12);
    --warnung-grund: rgba(250, 178, 25, 0.10);
    --kritisch-grund: rgba(208, 59, 59, 0.14);
    --hover: rgba(255, 255, 255, 0.05);
  }
}

* { box-sizing: border-box; }
html { background: var(--seite); }
body {
  margin: 0;
  background: var(--seite);
  color: var(--tinte);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.seite { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; }
body.veraltet main > :not(.kopf) { opacity: 0.55; transition: opacity .2s; }

h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; margin: 0; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; color: var(--tinte-2); }
.unterzeile, .hinweis { color: var(--tinte-2); margin: 4px 0 0; font-size: 13px; }
.hinweis.klein { font-size: 12px; margin-top: 10px; max-width: 78ch; }

/* Kopf */
.kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.zustand {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--flaeche); border: 1px solid var(--rand);
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.zustand svg { width: 16px; height: 16px; flex: none; }
.symbol-gut { color: var(--gut); }
.symbol-warnung { color: var(--warnung); }
.symbol-kritisch { color: var(--kritisch); }

/* Warnungen */
.warnungen:empty { display: none; }
.warnungen { display: grid; gap: 8px; margin-bottom: 16px; }
.warnung {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rand);
  background: var(--warnung-grund);
}
.warnung.kritisch { background: var(--kritisch-grund); }
.warnung svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.warnung strong { display: block; }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kacheln.innen { margin: 14px 0 20px; }
.kachel { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.innen .kachel { background: transparent; }
.kachel .etikett { color: var(--tinte-2); font-size: 13px; }
.kachel .wert { font-size: 24px; font-weight: 650; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kachel .wert.text { font-size: 17px; line-height: 1.35; padding-top: 5px; white-space: normal; }
.kachel .unter { color: var(--tinte-2); font-size: 12px; margin-top: 2px; }
.messleiste { height: 6px; border-radius: 3px; background: var(--raster); margin-top: 8px; overflow: hidden; }
.messleiste > span { display: block; height: 100%; border-radius: 3px; background: var(--reihe); }
.messleiste.warnung > span { background: var(--warnung); }
.messleiste.kritisch > span { background: var(--kritisch); }

/* Bloecke */
.block { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 18px 18px 16px; margin-bottom: 16px; min-width: 0; }
.block-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.block > h2 { margin-bottom: 12px; }
.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.zweispaltig.aussen { gap: 16px; }
.zweispaltig.aussen > .block { margin-bottom: 16px; }
@media (max-width: 820px) { .zweispaltig { grid-template-columns: 1fr; } }

/* Tabellen */
.tabellen-rahmen { overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th { text-align: left; font-weight: 600; font-size: 12px; color: var(--tinte-2); padding: 0 10px 8px; border-bottom: 1px solid var(--raster); white-space: nowrap; }
.tabelle td { padding: 8px 10px; border-bottom: 1px solid var(--raster); vertical-align: middle; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle th:first-child, .tabelle td:first-child { padding-left: 0; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle.kompakt td { padding: 6px 10px; }
.tabelle tbody tr:hover { background: var(--hover); }
/* break-word statt anywhere: bricht nur, wenn ein einzelnes Wort gar nicht
   passt. anywhere zaehlt fuer die Spaltenbreite jeden Buchstaben als
   Bruchstelle – dann zerlegt die Tabelle Namen mitten im Wort. */
.name { font-weight: 600; overflow-wrap: break-word; }
.keinumbruch { white-space: nowrap; font-variant-numeric: tabular-nums; }
.marke { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--rand); color: var(--tinte-2); font-size: 11px; font-weight: 500; vertical-align: 1px; }
.guete { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.guete svg { width: 14px; height: 14px; flex: none; }
.leer { color: var(--tinte-2); padding: 18px 0 6px; margin: 0; }
@media (max-width: 640px) { .breit { display: none; } }

/* Sparkline */
.spark { display: block; width: 132px; height: 28px; cursor: crosshair; }
@media (max-width: 640px) {
  .spark { width: 84px; }
  .kacheln.innen { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
}
.spark:focus-visible { outline: 2px solid var(--reihe); outline-offset: 2px; border-radius: 3px; }

/* Kopieren */
.kopieren { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--raster); }
.kopieren-kopf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.knopf {
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--tinte); color: var(--flaeche); border: 1px solid var(--tinte);
}
.knopf:hover { opacity: .88; }
.knopf:focus-visible { outline: 2px solid var(--reihe); outline-offset: 2px; }
.knopf:disabled { opacity: .4; cursor: not-allowed; }
.kopiert { color: var(--tinte-2); font-size: 13px; }
.chatzeile {
  display: block; margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--seite); border: 1px solid var(--rand);
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere;
}

/* Diagramm */
.diagramm { margin: 0; position: relative; }
.diagramm svg { display: block; width: 100%; height: auto; }
.diagramm text { fill: var(--gedaempft); font-size: 11px; font-variant-numeric: tabular-nums; }
.tabellen-ansicht { margin-top: 10px; }
.tabellen-ansicht summary { cursor: pointer; color: var(--tinte-2); font-size: 13px; }
.tabellen-ansicht[open] summary { margin-bottom: 8px; }

/* Balken (Karten) */
.balken { display: grid; gap: 8px; }
.balken-zeile { display: grid; grid-template-columns: minmax(90px, 40%) 1fr; gap: 10px; align-items: center; font-size: 13px; }
.balken-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinte); }
.balken-spur { display: flex; align-items: center; gap: 8px; min-width: 0; }
.balken-strich { height: 14px; background: var(--reihe); border-radius: 0 4px 4px 0; min-width: 3px; }
.balken-wert { color: var(--tinte-2); font-variant-numeric: tabular-nums; }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.liste li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--raster); padding-bottom: 8px; }
.liste li:last-child { border-bottom: 0; }
.liste .erklaerung { display: block; color: var(--tinte-2); font-size: 12px; }
.liste .anzahl { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ereignisse { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.ereignisse li { display: grid; grid-template-columns: 70px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--raster); }
.ereignisse li:last-child { border-bottom: 0; }
.ereignisse time { color: var(--tinte-2); font-variant-numeric: tabular-nums; }

/* Zeitraum */
.zeitraum { display: flex; align-items: center; gap: 6px; margin: 24px 0 12px; flex-wrap: wrap; }
.zeitraum-titel { font-weight: 650; margin-right: 6px; }
.zeitraum button {
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: var(--flaeche); color: var(--tinte-2); border: 1px solid var(--rand);
}
.zeitraum button[aria-pressed="true"] { background: var(--tinte); color: var(--flaeche); border-color: var(--tinte); font-weight: 600; }
.zeitraum button:focus-visible { outline: 2px solid var(--reihe); outline-offset: 2px; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--flaeche); color: var(--tinte); border: 1px solid var(--rand);
  border-radius: 8px; padding: 7px 10px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
.tooltip strong { font-size: 15px; display: block; }
.tooltip span { color: var(--tinte-2); }

.fuss { color: var(--gedaempft); font-size: 12px; margin-top: 8px; }
