/* GridState – ruhiges, sachliches Erscheinungsbild, hell und dunkel */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #17202a;
  --muted: #5b6776;
  --line: #dde2e8;
  --grid: #e8ecf0;
  --accent: #1f6feb;

  --ok: #2e9d5b;
  --watch: #d99a1b;
  --critical: #d4483b;
  --unknown: #8a94a3;

  /* Energieträger */
  --c-braunkohle: #8b6a4f;
  --c-steinkohle: #4a4f57;
  --c-gas: #e07b39;
  --c-sonstige: #a3a8b0;
  --c-biomasse: #6aa84f;
  --c-wasser: #3d85c6;
  --c-windon: #5fb3d9;
  --c-windoff: #2f6f9f;
  --c-solar: #f1c232;
  --c-import: #b07cc6;
  --c-load: #17202a;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --surface: #16212c;
    --surface-2: #1d2a37;
    --text: #e6ebf0;
    --muted: #9aa7b4;
    --line: #2a3846;
    --grid: #223040;
    --accent: #6ea8fe;
    --ok: #3fbf72;
    --watch: #f0b43c;
    --critical: #ff6b5e;
    --c-steinkohle: #7d848e;
    --c-load: #e6ebf0;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 .6em; }
small { font-size: .6em; font-weight: 500; color: var(--muted); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Kopf und Fuß */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }

main.wrap { padding-top: 20px; padding-bottom: 40px; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; }
.footer-inner { padding: 20px 16px 28px; }
.legal { display: flex; gap: 16px; }

/* Ampel */
.hero { display: flex; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border-left: 8px solid var(--state); }
.hero-ok { --state: var(--ok); }
.hero-watch { --state: var(--watch); }
.hero-critical { --state: var(--critical); }
.hero-unknown { --state: var(--unknown); }
.hero-light { flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--state); box-shadow: 0 0 0 8px color-mix(in srgb, var(--state) 20%, transparent); }
.hero-kicker { color: var(--muted); font-size: .9rem; margin: 0 0 2px; }
.hero-label { font-size: 2rem; margin: 0 0 4px; }
.hero-text { font-size: 1.1rem; margin: 0; }

/* Einflussgrößen */
.factors { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 14px 0; }
.factor { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.factor .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; background: var(--state); }
.factor-ok { --state: var(--ok); }
.factor-watch { --state: var(--watch); }
.factor-critical { --state: var(--critical); }
.factor-unknown { --state: var(--unknown); }
.factor-head { margin: 0; display: flex; justify-content: space-between; gap: 8px; }
.factor-state { color: var(--state); font-weight: 600; font-size: .9rem; }
.factor-value { margin: 2px 0; font-variant-numeric: tabular-nums; }
.factor-text { color: var(--muted); font-size: .9rem; margin: 0; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi-label { color: var(--muted); font-size: .85rem; margin: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: .8rem; margin: 0; }

/* Karten und Diagramme */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-note { color: var(--muted); font-size: .9rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.grid-2 .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 14px; }
.chart { position: relative; width: 100%; height: 260px; }
.chart-tall { height: 340px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); }
.chart .ref { stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.chart .ref-watch { stroke: var(--watch); }
.chart .ref-critical { stroke: var(--critical); }
.chart .ref-mid { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .now { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .band { fill: var(--accent); fill-opacity: .35; stroke: var(--accent); stroke-width: 1; }
.chart .loadline { fill: none; stroke: var(--c-load); stroke-width: 2; }
.chart .bar-pos { fill: var(--accent); }
.chart .bar-neg { fill: var(--ok); }
.chart .bar-import { fill: var(--c-import); }
.chart .bar-export { fill: var(--ok); }
.chart .cursor { stroke: var(--muted); stroke-width: 1; }
.chart .empty { fill: var(--muted); font-size: 13px; }
.s-braunkohle { fill: var(--c-braunkohle); }
.s-steinkohle { fill: var(--c-steinkohle); }
.s-gas { fill: var(--c-gas); }
.s-sonstige { fill: var(--c-sonstige); }
.s-biomasse { fill: var(--c-biomasse); }
.s-wasser { fill: var(--c-wasser); }
.s-windon { fill: var(--c-windon); }
.s-windoff { fill: var(--c-windoff); }
.s-solar { fill: var(--c-solar); }
.s-import { fill: var(--c-import); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 12px; height: 12px; }
.legend-text { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }

.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: .8rem; box-shadow: 0 4px 14px rgba(0,0,0,.15); white-space: nowrap; z-index: 5; font-variant-numeric: tabular-nums; }
.tooltip b { display: block; margin-bottom: 2px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Inhaltsseiten */
.prose { max-width: 760px; }
.prose h1 { font-size: 1.8rem; }
.prose h2 { font-size: 1.25rem; margin-top: 1.4em; }
.prose li { margin-bottom: .3em; }
.todo { background: color-mix(in srgb, var(--watch) 25%, transparent); padding: 0 4px; border-radius: 4px; }
.button { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.teaser { border-style: dashed; }

.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0; }
.product { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.product h3 { font-size: 1.05rem; margin: 0; }
.product .tag { align-self: flex-start; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.product .note { color: var(--muted); font-size: .9rem; }
.product .button { margin-top: auto; align-self: flex-start; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding-left: 28px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .25em; width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 4px; }
.hint { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: .9rem; }

@media (max-width: 600px) {
  .hero { flex-direction: column; align-items: flex-start; padding: 18px; }
  .hero-light { width: 44px; height: 44px; }
  .hero-label { font-size: 1.6rem; }
  .chart { height: 220px; }
  .chart-tall { height: 300px; }
  .grid-2 { grid-template-columns: 1fr; }
}
