:root {
  --bg: #f4f6f8; --karte: #ffffff; --text: #17202a; --leise: #5f6b7a; --linie: #e2e7ec;
  --akzent: #0f766e; --eg: #0f766e; --og1: #2563eb; --og2: #d97706; --allg: #94a3b8;
  --solar: #eab308; --netz: #475569; --einsp: #16a34a; --warn: #b91c1c;
  --r: 12px; --gap: clamp(8px, 1.2vw, 14px);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
#app {
  height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto;
  gap: var(--gap); padding: var(--gap) clamp(12px, 2vw, 24px);
}
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Kopf */
.kopf { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kopf h1 { font-size: 20px; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.kopf .stand { color: var(--leise); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf select { margin-left: auto; font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--linie); border-radius: 8px; background: var(--karte); max-width: 46vw; }

/* Reiter */
.reiter { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r); padding: 4px; gap: 4px; }
.reiter button { font: inherit; font-size: 14px; border: 0; background: none; padding: 8px 4px; border-radius: 8px; cursor: pointer; color: var(--leise); display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.reiter button.an { background: var(--akzent); color: #fff; }

/* Inhalt */
.inhalt { min-height: 0; display: grid; gap: var(--gap); grid-auto-rows: minmax(0, 1fr); }
.reihe { display: grid; gap: var(--gap); min-height: 0; }
.r3 { grid-template-columns: repeat(3, 1fr); }
.r4 { grid-template-columns: repeat(4, 1fr); }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r); padding: clamp(10px, 1.4vw, 18px); min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.karte h2 { font-size: 14px; font-weight: 600; color: var(--leise); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zahl { font-size: clamp(20px, 2.6vw, 32px); font-weight: 700; white-space: nowrap; }
.zahl small { font-size: 0.5em; font-weight: 600; color: var(--leise); margin-left: 4px; }
.zeile { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; font-size: 14px; }
.zeile span:first-child { color: var(--leise); display: flex; align-items: center; gap: 6px; }
.zeile b { font-weight: 600; }
.fuss { color: var(--leise); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hinweis { color: var(--leise); font-size: 14px; margin: auto 0; }
.warn { color: var(--warn); }
.punkt { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

/* Balken */
.balken { display: flex; height: clamp(26px, 4vh, 40px); border-radius: 8px; overflow: hidden; background: var(--linie); }
.balken div { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.legende span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* Verlauf (Gas) */
.verlauf { flex: 1; min-height: 60px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--linie); }
.verlauf div { flex: 1; background: var(--akzent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.verlauf div.wahl { opacity: 1; outline: 2px solid var(--text); outline-offset: -2px; }
.achse { display: flex; gap: 4px; font-size: 11px; color: var(--leise); }
.achse span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; }

/* Tabelle */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--leise); font-weight: 600; font-size: 13px; }
tfoot td { font-weight: 700; border-bottom: 0; }

@media (max-width: 700px) {
  body { font-size: 14px; }
  .r3 { grid-template-columns: 1fr; }
  .r4 { grid-template-columns: repeat(2, 1fr); }
  .kopf h1 { font-size: 17px; }
  .kopf .stand { display: none; }
  .reiter button { font-size: 13px; padding: 7px 2px; }
  .reiter button svg { display: none; }
  .karte { padding: 10px 12px; gap: 3px; }
  .zahl { font-size: 20px; }
  .zeile { font-size: 13px; }
  th, td { padding: 6px 3px; font-size: 12.5px; }
  .nur-pc { display: none; }
}

/* Kacheln: Inhalt mittig zwischen Titel und Unterkante */
.karte[data-mitte] > h2 { margin-bottom: auto; }
.karte[data-mitte] > :last-child { margin-bottom: auto; }
.karte[data-mitte] .zeile { font-size: clamp(14px, 1.4vw, 18px); padding: 4px 0; }
.offen { font-size: 14px; font-weight: 500; color: var(--leise); }
.verlauf { justify-content: center; }
.verlauf div { max-width: 56px; }
@media (max-width: 700px) { .karte[data-mitte] .zeile { font-size: 14px; padding: 1px 0; } }

.r2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .r2 { grid-template-columns: 1fr; } }
.karte[data-mitte] .balken + .legende { margin-top: 4px; }
