/* =========================================================================
   Die Bautrockner – Aussehen
   Zuerst fürs Handy gebaut, ab 720 px Breite mehr Platz für Tablet/PC.
   Hell/Dunkel richtet sich automatisch nach dem Gerät.
   ========================================================================= */

:root {
  --hintergrund: #f3f5f8;
  --flaeche: #ffffff;
  --text: #1c2430;
  --text-leise: #5b6676;
  --linie: #dde2e9;
  --akzent: #1d4f91;
  --akzent-text: #ffffff;
  --gut: #1f8a4c;      --gut-hg: #e2f5ea;
  --mittel: #9a6b00;   --mittel-hg: #fff3cc;
  --schlecht: #c0262d; --schlecht-hg: #fde4e4;
  --neutral-hg: #eef1f5;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #11161d;
    --flaeche: #1b222c;
    --text: #e6eaf0;
    --text-leise: #9aa5b4;
    --linie: #2e3845;
    --akzent: #6ea8ff;
    --akzent-text: #0d1520;
    --gut: #5fd394;      --gut-hg: #173326;
    --mittel: #f2c14e;   --mittel-hg: #3a2f12;
    --schlecht: #ff7b7b; --schlecht-hg: #3d1b1d;
    --neutral-hg: #26303c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 4px 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
a { color: var(--akzent); }

/* --- Kopfleiste ---------------------------------------------------------- */
.kopfleiste {
  background: var(--akzent);
  color: var(--akzent-text);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 10px 16px;
  position: sticky; top: 0; z-index: 2000;  /* über den Karten-Knöpfen */
}
.marke { color: inherit; font-weight: 700; text-decoration: none; font-size: 1.1rem;
         display: flex; align-items: center; gap: 10px; }
/* Logo auf weißem Feld, damit es auf hellem und dunklem Hintergrund lesbar bleibt */
.marke .logo, .login-logo { background: #fff; border-radius: 8px; display: block; }
.marke .logo { height: 48px; width: auto; padding: 3px 6px; }
.login-logo { width: 220px; max-width: 70%; height: auto; padding: 10px 14px; margin: 0 auto 16px; }
@media (max-width: 560px) { .marke .logo { height: 36px; } .marke { font-size: 1rem; } }
.kopfleiste nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.kopfleiste nav a {
  color: inherit; text-decoration: none; padding: 8px 12px; border-radius: 8px;
  opacity: .85;
}
.kopfleiste nav a.aktiv, .kopfleiste nav a:hover { background: rgb(255 255 255 / .18); opacity: 1; }

/* Handy: Navigation als volle Zeile unter dem Namen */
@media (max-width: 560px) {
  .kopfleiste nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .kopfleiste nav a { padding: 8px 6px; }
}

.fuss { text-align: center; color: var(--text-leise); font-size: .85rem; padding: 24px 16px; }

/* --- Meldungen --------------------------------------------------------- */
.meldung { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; background: var(--neutral-hg); }
.meldung.fehler  { background: var(--schlecht-hg); color: var(--schlecht); }
.meldung.warnung { background: var(--mittel-hg);   color: var(--mittel); }
.meldung.erfolg  { background: var(--gut-hg);      color: var(--gut); }
.leer, .hinweis { color: var(--text-leise); }
.hinweis { font-size: .9rem; }
.hinweis.saison { margin: -8px 0 16px; }

/* --- Formulare und Knöpfe ------------------------------------------------ */
.feld { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--text-leise); }
input, select {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: 8px;
  padding: 10px 12px; min-height: 44px;   /* gut mit dem Finger zu treffen */
}
input:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--text);
  font: inherit; text-decoration: none; cursor: pointer;
}
.knopf:hover { border-color: var(--akzent); }
.knopf.haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); width: 100%; }

.werkzeugleiste { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.werkzeugleiste .feld { flex: 1 1 140px; }
.werkzeugleiste .knopf { flex: 0 0 auto; }

/* --- Anmeldung --------------------------------------------------------- */
.login {
  max-width: 380px; margin: 10vh auto 0; padding: 28px 24px;
  background: var(--flaeche); border-radius: var(--radius); border: 1px solid var(--linie);
}
.login h1 { margin-top: 0; }
.login form { display: flex; flex-direction: column; gap: 16px; }

/* --- Kästen und Karten --------------------------------------------------- */
.kasten {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.kasten-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.kasten-kopf h2 { margin: 0; }

.werte { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.werte dt { color: var(--text-leise); }
.werte dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* --- Übersicht: Zusammenfassung, Suche, kompakte Liste -------------------- */
.zusammenfassung { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
@media (max-width: 560px) { .zusammenfassung { grid-template-columns: repeat(2, 1fr); } }
.kachel {
  font: inherit; color: var(--text); background: var(--flaeche); cursor: pointer;
  border: 1px solid var(--linie); border-top: 4px solid var(--akzent); border-radius: var(--radius);
  padding: 10px 12px; text-align: left; display: flex; flex-direction: column;
}
.kachel strong { font-size: 1.6rem; line-height: 1.1; }
.kachel span { color: var(--text-leise); font-size: .85rem; }
.kachel.schlecht { border-top-color: var(--schlecht); }
.kachel.schlecht strong { color: var(--schlecht); }
.kachel.mittel { border-top-color: var(--mittel); }
.kachel.mittel strong { color: var(--mittel); }
.kachel.gut { border-top-color: var(--gut); }
.kachel.aktiv { outline: 2px solid var(--akzent); outline-offset: -1px; }
.kachel:disabled { opacity: .5; cursor: default; }

.suche { display: block; margin-bottom: 12px; }
.suche input { width: 100%; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.liste {
  list-style: none; margin: 0 0 12px; padding: 0;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden;
}
.liste li + li { border-top: 1px solid var(--linie); }
.zeile {
  display: grid; align-items: center; gap: 4px 12px;
  grid-template-columns: 48px 90px minmax(120px, 360px) 1fr auto;
  padding: 10px 12px; min-height: 52px;
  color: inherit; text-decoration: none; border-left: 4px solid var(--gut);
}
.zeile:hover { background: var(--neutral-hg); }
.zeile.stoerung { border-left-color: var(--schlecht); background: var(--schlecht-hg); }
.zeile.veraltet { border-left-color: var(--mittel); }
.zeile .nr { font-weight: 700; font-size: 1.1rem; }
.zeile .fuell { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.zeile .fuell small { color: var(--text-leise); font-weight: 400; }
.zeile .fuell.niedrig { color: var(--schlecht); }
.zeile .ort { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .zustand { display: flex; flex-wrap: wrap; gap: 4px; }
.zeile .alter { color: var(--text-leise); font-size: .85rem; white-space: nowrap; text-align: right; }
.zeile .alter.veraltet { color: var(--mittel); font-weight: 600; }

/* Handy: Status rutscht in eine zweite Zeile */
@media (max-width: 560px) {
  .zeile { grid-template-columns: 40px 1fr auto; }
  .zeile .fuell { text-align: left; }
  .zeile .ort { grid-column: 2 / -1; grid-row: 2; color: var(--text-leise); font-size: .9rem; }
  .zeile .ort.ohne { display: none; }
  .zeile .zustand { grid-column: 2 / -1; grid-row: 3; }
}

/* --- Statusanzeigen (Ampel) ---------------------------------------------- */
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .85rem; white-space: nowrap; background: var(--neutral-hg); }
.status.gut      { background: var(--gut-hg);      color: var(--gut); }
.status.mittel   { background: var(--mittel-hg);   color: var(--mittel); }
.status.schlecht { background: var(--schlecht-hg); color: var(--schlecht); font-weight: 600; }
.status.unbekannt { color: var(--text-leise); }
.legende { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Diagramm ------------------------------------------------------------- */
.diagramm { position: relative; height: 300px; }
@media (min-width: 720px) { .diagramm { height: 380px; } }

.umschalter { display: flex; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; }
.umschalter button {
  font: inherit; font-size: .9rem; border: 0; background: var(--flaeche); color: var(--text);
  padding: 8px 12px; min-height: 40px; cursor: pointer;
}
.umschalter button + button { border-left: 1px solid var(--linie); }
.umschalter button.aktiv { background: var(--akzent); color: var(--akzent-text); }

/* --- Tabellen: auf schmalen Bildschirmen seitlich scrollen ---------------- */
.tabelle-rahmen { overflow: auto; max-height: 70vh; border: 1px solid var(--linie); border-radius: 8px; }
.tabelle-rahmen.kurz { max-height: 420px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--linie); }
th { position: sticky; top: 0; background: var(--neutral-hg); z-index: 1; }
td.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tr.problem td { background: var(--schlecht-hg); }
/* erste Spalte (Datum) bleibt beim seitlichen Scrollen stehen */
th:first-child, td:first-child { position: sticky; left: 0; background: var(--flaeche); }
th:first-child { z-index: 2; background: var(--neutral-hg); }
tr.problem td:first-child { background: var(--schlecht-hg); }

/* --- Netz-Seite ------------------------------------------------------------ */
.zweispaltig { display: grid; gap: 16px; }
@media (min-width: 900px) { .zweispaltig { grid-template-columns: 1fr 2fr; } }
.karte-osm { height: 320px; border-radius: 8px; }
@media (min-width: 900px) { .karte-osm { height: 520px; } }

/* --- Allgemeine Infos (Verlauf-Seite) -------------------------------------- */
h1 .untertitel { color: var(--text-leise); font-weight: 400; }
details.info summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
details.info summary::-webkit-details-marker { display: none; }
details.info summary h2 { margin: 0; }
details[open].info summary .knopf { visibility: hidden; }
.knopf.klein { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.info-anzeige { margin-top: 12px; }
.info-anzeige .werte { max-width: 520px; }
.karte-osm.adresse { height: 260px; margin-top: 16px; }
@media (min-width: 900px) { .karte-osm.adresse { height: 320px; } }
details[open] + .info-anzeige { display: none; }
.info-formular { display: grid; gap: 12px; margin-top: 16px; grid-template-columns: repeat(3, 1fr); }
.info-formular .feld.breit { grid-column: span 3; }
.info-formular .feld.breit2 { grid-column: span 2; }
@media (max-width: 560px) {
  .info-formular { grid-template-columns: 1fr; }
  .info-formular .feld.breit, .info-formular .feld.breit2 { grid-column: auto; }
}
.info-formular .feld[hidden] { display: none; }
.info-formular select { font: inherit; }
.info-formular .standard-hinweis { grid-column: 1 / -1; margin: 0; }
.info-formular .knoepfe { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.info-formular .knoepfe .knopf { width: auto; flex: 1; }
@media (min-width: 720px) { .info-formular .knoepfe .knopf { flex: 0 0 160px; } }
