:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --fl: #ffffff;
  --fl2: #f0ece7;
  --rand: #e4ded6;
  --tx: #181715;
  --tx2: #5a554e;
  --tx3: #8a847b;
  --akz: #a8171a;          /* FWRU Dunkelrot, Hauptakzent und Datenfarbe */
  --akz-hell: #e7b2a9;     /* gedämpfte Balken (nicht gewählt) */
  --akz-tx: #a8171a;
  --gelb: #fcf561;
  --hero: #181715;
  --hero-tx: #ffffff;
  --schatten: 0 1px 2px rgba(24,23,21,.06), 0 4px 16px rgba(24,23,21,.05);
  --r: 14px;
  --heat0: #f3ece6;
  --heat1: #a8171a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121110; --fl: #1c1b19; --fl2: #262422; --rand: #34312d;
    --tx: #f2efeb; --tx2: #bdb6ad; --tx3: #8d867d;
    --akz: #e0453a; --akz-hell: #7a3832; --akz-tx: #ff8a7d;
    --hero: #0b0a09; --schatten: none; --heat0: #24211f; --heat1: #e0453a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121110; --fl: #1c1b19; --fl2: #262422; --rand: #34312d;
  --tx: #f2efeb; --tx2: #bdb6ad; --tx3: #8d867d;
  --akz: #e0453a; --akz-hell: #7a3832; --akz-tx: #ff8a7d;
  --hero: #0b0a09; --schatten: none; --heat0: #24211f; --heat1: #e0453a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--akz-tx); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Kopf */
.hero {
  background: var(--hero); color: var(--hero-tx);
  background-image: radial-gradient(1200px 400px at 85% -10%, rgba(168,23,26,.55), transparent 60%),
                    linear-gradient(180deg, rgba(255,255,255,.02), transparent);
  border-bottom: 4px solid #a8171a;
}
.hero-in { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; padding: 40px 16px 32px; }
.kicker { margin: 0 0 6px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #fcf561; font-weight: 600; }
.hero h1 { margin: 0; font-size: clamp(34px, 6vw, 56px); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.lead { margin: 10px 0 0; max-width: 46ch; color: rgba(255,255,255,.78); font-size: 16px; }
.hero-zahl { text-align: right; min-width: 0; }
.hz-wert { display: block; font-size: clamp(48px, 9vw, 88px); font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.hz-text { display: block; margin-top: 6px; color: rgba(255,255,255,.75); font-size: 14px; }

/* Filter */
.filter { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 16px 0 12px; border-bottom: 1px solid var(--rand); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--rand); background: var(--fl); color: var(--tx);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--akz); }
.chip[aria-selected="true"] { background: var(--akz); border-color: var(--akz); color: #fff; }
.filter-reihe { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-top: 12px; }
.feld { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--tx3); min-width: 0; }
.feld span { padding-left: 2px; }
.feld select, .feld input {
  font: inherit; font-size: 14px; color: var(--tx); background: var(--fl);
  border: 1px solid var(--rand); border-radius: 10px; padding: 8px 10px; min-width: 170px; max-width: 100%;
}
.feld-suche { flex: 1 1 200px; }
.feld-suche input { width: 100%; }
.schalter { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--tx2); padding: 8px 2px; cursor: pointer; }
.schalter input { accent-color: var(--akz); width: 16px; height: 16px; }
.zurueck { font: inherit; font-size: 14px; background: none; border: 0; color: var(--akz-tx); text-decoration: underline; cursor: pointer; padding: 8px 2px; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.kpi { background: var(--fl); border: 1px solid var(--rand); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--schatten); min-width: 0; }
.kpi .k-wert { font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi .k-wert.klein { font-size: 20px; padding-top: 6px; }
.kpi .k-titel { font-size: 13px; color: var(--tx2); margin-top: 4px; }
.kpi .k-zus { font-size: 12px; color: var(--tx3); margin-top: 2px; }
.trend-auf::before { content: "▲ "; font-size: 10px; }
.trend-ab::before { content: "▼ "; font-size: 10px; }

/* Diagramm-Karten */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.karte { background: var(--fl); border: 1px solid var(--rand); border-radius: var(--r); padding: 18px; box-shadow: var(--schatten); min-width: 0; }
.karte.breit { grid-column: 1 / -1; }
.karte header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.karte h2 { margin: 0; font-size: 16px; font-weight: 700; }
.karte header p { margin: 0; font-size: 12px; color: var(--tx3); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--tx3); font-size: 11px; }
.chart .wert { fill: var(--tx2); font-weight: 600; }
.chart .gitter { stroke: var(--rand); stroke-width: 1; }
.chart .balken { fill: var(--akz-hell); cursor: pointer; transition: fill .15s; }
.chart .balken.an { fill: var(--akz); }
.chart .balken:hover { fill: var(--akz); }
.chart .linie { fill: none; stroke: var(--tx3); stroke-width: 2; stroke-dasharray: 4 4; }

.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 44px; gap: 10px; align-items: center; background: none; border: 0; padding: 5px 4px; border-radius: 8px; font: inherit; color: var(--tx); text-align: left; cursor: pointer; }
.hbar:hover, .hbar.an { background: var(--fl2); }
.hbar .hb-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hb-spur { height: 10px; background: var(--fl2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .hb-fuell { display: block; height: 100%; background: var(--akz); border-radius: 0 4px 4px 0; }
.hbar.aus .hb-fuell { background: var(--akz-hell); }
.hbar .hb-zahl { font-size: 13px; font-weight: 600; text-align: right; color: var(--tx2); }

.heat { overflow-x: auto; }
.heat table { border-collapse: separate; border-spacing: 2px; width: 100%; min-width: 420px; table-layout: fixed; }
.heat thead th:first-child { width: 28px; }
.heat th { font-weight: 400; font-size: 10px; color: var(--tx3); padding: 0; }
.heat th.tag { text-align: left; padding-right: 6px; font-size: 11px; width: 24px; }
.heat td { height: 18px; border-radius: 3px; background: var(--heat0); padding: 0; }
.heat-legende { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11px; color: var(--tx3); }
.heat-legende i { display: inline-block; width: 70px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--heat0), var(--heat1)); }

/* Liste */
.liste-kopf { margin: 32px 0 8px; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.liste-kopf h2 { margin: 0; font-size: 22px; font-weight: 800; }
.liste-kopf p { margin: 0; color: var(--tx3); font-size: 13px; }
.monat { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx3); font-weight: 700; display: flex; gap: 8px; align-items: center; }
.monat::after { content: ""; flex: 1; height: 1px; background: var(--rand); }
.einsatz {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  background: var(--fl); border: 1px solid var(--rand); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px;
}
.einsatz:hover { border-color: var(--tx3); }
.e-datum { text-align: center; border-right: 1px solid var(--rand); padding-right: 12px; }
.e-tag { display: block; font-size: 24px; font-weight: 800; line-height: 1; }
.e-mon { display: block; font-size: 12px; color: var(--tx3); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.e-haupt { min-width: 0; }
.e-oben { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--tx3); }
.e-nr { font-weight: 700; color: var(--tx2); }
.e-alst { border: 1px solid var(--rand); border-radius: 999px; padding: 0 8px; font-size: 11px; color: var(--tx2); white-space: nowrap; }
.e-alst.hoch { border-color: var(--akz); color: var(--akz-tx); font-weight: 700; }
.e-art { font-size: 16px; font-weight: 700; margin: 2px 0 0; }
.e-ort { font-size: 14px; color: var(--tx2); }
.e-links { display: flex; gap: 6px 12px; flex-wrap: wrap; margin-top: 6px; }
.e-link { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--akz-tx); }
.e-link:hover { text-decoration: underline; }
.e-link svg { width: 15px; height: 15px; flex: none; }
.e-bild { position: relative; width: 132px; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--fl2); display: block; }
.e-bild img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.e-bild:hover img { transform: scale(1.04); }
.e-bild small { position: absolute; right: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 6px; border-top-left-radius: 6px; }
.leer { text-align: center; color: var(--tx3); padding: 40px 0; }
.mehr-box { text-align: center; margin: 16px 0 8px; }
.mehr { font: inherit; font-weight: 700; background: var(--fl); color: var(--tx); border: 1px solid var(--rand); border-radius: 999px; padding: 10px 22px; cursor: pointer; }
.mehr:hover { border-color: var(--akz); color: var(--akz-tx); }

.fuss { margin: 40px 0 32px; padding-top: 16px; border-top: 1px solid var(--rand); font-size: 12px; color: var(--tx3); }
.fuss p { margin: 4px 0; }

.tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--tx); color: var(--bg);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.35; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 220px;
}
.tip b { font-size: 14px; }

@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .hero-in { flex-direction: column; align-items: flex-start; padding-top: 28px; }
  .hero-zahl { text-align: left; }
  .feld select { min-width: 0; width: 100%; }
  .feld { flex: 1 1 45%; }
  .einsatz { grid-template-columns: 52px 1fr; }
  .e-bild { grid-column: 1 / -1; width: 100%; }
  .filter { position: static; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
