/* Mobile first. Die Eingabe passiert am Telefon, die Auswertung am Rechner. */
:root {
  --rand: #d8d4cc;
  --grund: #fbfaf8;
  --karte: #fff;
  --text: #22201d;
  --leise: #6b6660;
  --akzent: #1f5f4b;
  --warnung: #8a5a00;
  --fehler: #9b2c2c;
  --gut: #1f5f4b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --rand: #3a3833; --grund: #1a1917; --karte: #232220; --text: #ece9e3;
    --leise: #a8a29a; --akzent: #6cc0a2; --warnung: #e0b05c; --fehler: #e08a8a; --gut: #6cc0a2;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.huelle { max-width: 54rem; margin: 0 auto; padding: 0 1rem 3rem; }
header {
  border-bottom: 1px solid var(--rand); margin-bottom: 1.5rem;
  padding: 1rem 0; display: flex; flex-wrap: wrap; gap: .75rem;
  align-items: baseline; justify-content: space-between;
}
header h1 { font-size: 1.15rem; margin: 0; font-weight: 600; }
header .objekt { color: var(--leise); font-size: .85rem; font-weight: 400; }
nav {
  display: flex; gap: .4rem 1rem; align-items: center; font-size: .95rem;
  flex-wrap: wrap; width: 100%;
}
nav a { color: var(--akzent); text-decoration: none; }
nav a[aria-current] { font-weight: 600; text-decoration: underline; }
nav form { margin: 0; }
/* Rutscht nach rechts und bei engem Schirm in eine eigene Zeile, damit
   "abmelden" nicht aus dem Bild fällt. */
nav .konto {
  display: inline-flex; align-items: baseline; gap: .5rem;
  margin-left: auto; white-space: nowrap;
}
nav .konto strong { font-weight: 600; }
nav button.leise {
  background: none; border: 0; color: var(--leise); cursor: pointer;
  font: inherit; padding: 0; text-decoration: underline;
}
h2 { font-size: 1.05rem; margin: 2rem 0 .75rem; }
h2:first-of-type { margin-top: 0; }
p { margin: .5rem 0; }
.hinweis { color: var(--leise); font-size: .9rem; }

/* Kennzahlen */
.kacheln { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 30rem) { .kacheln { grid-template-columns: 1fr 1fr; } }
@media (min-width: 46rem) { .kacheln.drei { grid-template-columns: 1fr 1fr 1fr; } }
.kachel {
  background: var(--karte); border: 1px solid var(--rand); border-radius: .5rem;
  padding: .85rem 1rem;
}
.kachel .titel { color: var(--leise); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.kachel .wert { font-size: 1.6rem; font-variant-numeric: tabular-nums; margin-top: .2rem; }
.kachel .wert .einheit { font-size: .9rem; color: var(--leise); }
.kachel .fuss { color: var(--leise); font-size: .85rem; margin-top: .25rem; }
.kachel.offen .wert { font-size: 1.05rem; color: var(--leise); }

/* Fortschritt */
.balken { background: var(--rand); border-radius: 1rem; height: .5rem; overflow: hidden; margin: .4rem 0; }
.balken i { display: block; height: 100%; background: var(--akzent); }

/* Formular */
form.erfassung { margin: 0; }
.feld { margin-bottom: 1.1rem; }
.feld label { display: block; font-weight: 600; margin-bottom: .2rem; }
.feld .zusatz { color: var(--leise); font-size: .85rem; margin-bottom: .35rem; }
.feld input {
  width: 100%; padding: .7rem .8rem; font-size: 1.1rem; font-variant-numeric: tabular-nums;
  border: 1px solid var(--rand); border-radius: .4rem;
  background: var(--karte); color: var(--text);
}
.feld input:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
.gruppe { border: 0; padding: 0; margin: 0 0 1.5rem; }
.gruppe legend { font-weight: 600; padding: 0; margin-bottom: .6rem; color: var(--leise); }
button.haupt {
  width: 100%; padding: .85rem; font-size: 1.05rem; font-weight: 600;
  background: var(--akzent); color: #fff; border: 0; border-radius: .4rem; cursor: pointer;
}
@media (min-width: 30rem) { button.haupt { width: auto; padding: .8rem 2rem; } }

/* Meldungen */
.meldung { border-radius: .4rem; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .95rem; }
.meldung.fehler { background: color-mix(in srgb, var(--fehler) 12%, var(--karte)); border: 1px solid var(--fehler); }
.meldung.warnung { background: color-mix(in srgb, var(--warnung) 14%, var(--karte)); border: 1px solid var(--warnung); }
.meldung.gut { background: color-mix(in srgb, var(--gut) 12%, var(--karte)); border: 1px solid var(--gut); }
.meldung ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* Tabellen */
.rollbar { overflow-x: auto; margin: 0 -1rem; padding: 0 1rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: right; padding: .45rem .5rem; border-bottom: 1px solid var(--rand); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--leise); font-weight: 600; font-size: .8rem; }
td { font-variant-numeric: tabular-nums; }
tr.hervor td { font-weight: 600; }

/* Diagramme */
.diagramm { background: var(--karte); border: 1px solid var(--rand); border-radius: .5rem; padding: .75rem; margin-bottom: 1rem; }
.diagramm canvas { width: 100% !important; height: 15rem !important; }
@media (min-width: 46rem) { .diagramm canvas { height: 17rem !important; } }

/* Fußzeile */
footer {
  margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rand);
  color: var(--leise); font-size: .85rem;
}
footer p { margin: .4rem 0; }
footer dl { margin: .4rem 0; display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; }
footer dt { font-weight: 600; }
footer dd { margin: 0; }

/* Anmeldung */
.anmeldung { max-width: 22rem; margin: 15vh auto 0; }

/* Diagrammfarben: validierte kategoriale Slots 1-3 (dataviz-Referenzpalette),
   je Modus eigene Stufen - keine automatische Umkehrung. */
:root {
  --serie-1: #2a78d6;   /* EG / gemessen */
  --serie-2: #eb6834;   /* OG / bereinigt bzw. Bereitschaftsverlust */
  --serie-3: #1baf7a;   /* DG / im Warmwasser angekommen */
  --gitter: #e7e4de;
  --achse: #6b6660;
}
@media (prefers-color-scheme: dark) {
  :root {
    --serie-1: #3987e5;
    --serie-2: #d95926;
    --serie-3: #199e70;
    --gitter: #35332e;
    --achse: #a8a29a;
  }
}
.legende { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .85rem; color: var(--leise); margin: 0 0 .5rem; }
.legende span { display: inline-flex; align-items: center; gap: .35rem; }
.legende i { width: .7rem; height: .7rem; border-radius: .15rem; display: inline-block; }
