/* ============================================================================
 * Grow-Control — Gestaltung
 * ============================================================================
 *
 * WIE CSS HIER FUNKTIONIERT (fuer den Einstieg)
 *
 * Ganz oben stehen unter `:root` sogenannte Custom Properties — Variablen.
 * `--flaeche: #ffffff;` legt einen Namen fuer eine Farbe fest. Weiter unten
 * wird er mit `var(--flaeche)` benutzt. Aendert man den Wert oben, aendert
 * sich alles, was ihn verwendet. Das ist derselbe Gedanke wie hinter
 * Design-Tokens in Tailwind, nur ohne Werkzeugkette.
 *
 * Der zweite Block `@media (prefers-color-scheme: dark)` setzt dieselben
 * Namen noch einmal — mit dunklen Werten. Der Browser waehlt automatisch,
 * je nachdem, was im Betriebssystem eingestellt ist. Deshalb steht weiter
 * unten nirgends mehr eine Farbe direkt im Code.
 *
 * FARBWAHL
 *
 * Neutrale Graustufen, weisse Karten, ein einziger Akzent (ein gedecktes
 * Blau) fuer Links, aktive Zustaende und die Hauptschaltflaeche. Farbe wird
 * ausschliesslich zur Bedeutung eingesetzt, nie zur Dekoration: Bernstein
 * heisst „schau hin", Rot heisst „handle jetzt". Wenn alles bunt ist,
 * bedeutet Farbe nichts mehr — und dieses Werkzeug soll auf einen Blick
 * zeigen, ob im Zelt etwas nicht stimmt.
 * ========================================================================= */

:root {
  color-scheme: light dark;

  /* Flaechen, von hinten nach vorn */
  --grund: #fafafa;
  --flaeche: #ffffff;
  --flaeche-2: #f4f4f5;
  --rand: #e4e4e7;
  --rand-stark: #d4d4d8;

  /* Text, von wichtig nach nebensaechlich */
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #a1a1aa;

  /* Akzent — sparsam */
  --akzent: #2563eb;
  --akzent-schwach: #eff6ff;

  /* Zustaende. Nur fuer Bedeutung, nie fuer Schmuck. */
  --gut: #15803d;
  --warn: #b45309;
  --warn-flaeche: #fffbeb;
  --alarm: #b91c1c;
  --alarm-flaeche: #fef2f2;

  --linie: #3f3f46;
  --band: rgba(37, 99, 235, .07);

  --radius: 8px;
  --radius-gross: 12px;
  --schatten: 0 1px 2px rgba(0, 0, 0, .04);
  --schrift: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #09090b;
    --flaeche: #131316;
    --flaeche-2: #1c1c20;
    --rand: #27272a;
    --rand-stark: #3f3f46;

    --text: #fafafa;
    --text-2: #a1a1aa;
    --text-3: #71717a;

    --akzent: #60a5fa;
    --akzent-schwach: #172554;

    --gut: #4ade80;
    --warn: #fbbf24;
    --warn-flaeche: #291d05;
    --alarm: #f87171;
    --alarm-flaeche: #2b1113;

    --linie: #a1a1aa;
    --band: rgba(96, 165, 250, .10);
    --schatten: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { letter-spacing: -0.011em; }

/* ============================================================================
 * Grundgeruest: Seitenleiste links, Inhalt rechts
 *
 * `display: grid` teilt die Seite in Spalten. `grid-template-columns` sagt:
 * erste Spalte 232 Pixel breit, zweite nimmt den Rest (`1fr` = ein Anteil).
 * Auf schmalen Bildschirmen wird das weiter unten wieder aufgehoben.
 * ========================================================================= */

.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.seitenleiste {
  background: var(--flaeche);
  border-right: 1px solid var(--rand);
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.marke {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 .5rem;
  font-weight: 600;
  font-size: .95rem;
}

.marke .punkt {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gut);
  flex: none;
}
.marke .punkt.warn { background: var(--warn); }
.marke .punkt.alarm { background: var(--alarm); }

.nav-gruppe { display: flex; flex-direction: column; gap: 1px; }

.nav-titel {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 .5rem .35rem;
}

.nav-gruppe a {
  display: block;
  padding: .4rem .5rem;
  border-radius: 6px;
  color: var(--text-2);
  font-size: .875rem;
  text-decoration: none;
}
.nav-gruppe a:hover { background: var(--flaeche-2); color: var(--text); text-decoration: none; }
.nav-gruppe a.aktiv { background: var(--akzent-schwach); color: var(--akzent); font-weight: 550; }

.seitenleiste .fuss {
  margin-top: auto;
  padding: .75rem .5rem 0;
  border-top: 1px solid var(--rand);
  font-size: .72rem;
  color: var(--text-3);
  line-height: 1.45;
}

.inhalt { padding: 1.5rem 1.75rem 4rem; max-width: 1100px; }

.seitenkopf {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.seitenkopf h1 { font-size: 1.35rem; font-weight: 600; margin: 0; }
.seitenkopf p { margin: .15rem 0 0; color: var(--text-2); font-size: .875rem; }
.seitenkopf .rechts { margin-left: auto; display: flex; gap: .4rem; align-items: center; }

/* Segmentierte Auswahl, z. B. Zeitraum */
.segmente {
  display: inline-flex;
  border: 1px solid var(--rand);
  border-radius: 7px;
  overflow: hidden;
  background: var(--flaeche);
}
.segmente a {
  padding: .3rem .65rem;
  font-size: .8rem;
  color: var(--text-2);
  border-right: 1px solid var(--rand);
  text-decoration: none;
}
.segmente a:last-child { border-right: none; }
.segmente a:hover { background: var(--flaeche-2); text-decoration: none; }
.segmente a.aktiv { background: var(--flaeche-2); color: var(--text); font-weight: 550; }

/* ============================================================================
 * Kennzahlen und Karten
 * ========================================================================= */

.kennzahlen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius-gross);
  box-shadow: var(--schatten);
}

.kachel { padding: .85rem 1rem; }

.kachel .beschriftung {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: .25rem;
}

.kachel .wert {
  font-size: 1.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.kachel .wert .einheit {
  font-size: .85rem;
  font-weight: 450;
  color: var(--text-3);
  margin-left: .12rem;
}
.kachel .zusatz {
  font-size: .75rem;
  color: var(--text-3);
  margin-top: .2rem;
  font-variant-numeric: tabular-nums;
}
.kachel .zusatz.warn { color: var(--warn); }
.kachel .zusatz.alarm { color: var(--alarm); }

.karte.abschnitt { padding: 1.1rem 1.25rem; margin-bottom: 1rem; }

.karte.abschnitt > h2 {
  font-size: .95rem;
  font-weight: 600;
  margin: 0 0 .15rem;
}
.karte.abschnitt > .erklaerung {
  font-size: .82rem;
  color: var(--text-2);
  margin: 0 0 1rem;
  max-width: 62ch;
}

/* ============================================================================
 * Diagramme
 * ========================================================================= */

svg.diagramm { width: 100%; height: auto; display: block; }
.diagramm .raster { stroke: var(--rand); stroke-width: 1; }
.diagramm .achse { fill: var(--text-3); font-size: 10px; font-family: var(--mono); }
.diagramm .verlauf { fill: none; stroke: var(--linie); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .punkt { fill: var(--linie); }
.diagramm .zielband { fill: var(--band); }

/* ============================================================================
 * Tabellen, Marken, Hinweise
 * ========================================================================= */

table.liste { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.liste td, table.liste th { padding: .5rem .5rem; border-top: 1px solid var(--rand); vertical-align: top; text-align: left; }
table.liste tr:first-child td, table.liste thead th { border-top: none; }
table.liste thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
table.liste td.name { font-weight: 550; width: 9rem; }
table.liste td.grund { color: var(--text-2); }

.marke {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .03em;
  padding: .1rem .4rem;
  border-radius: 4px;
  background: var(--flaeche-2);
  color: var(--text-2);
  white-space: nowrap;
}
.marke.an { background: var(--akzent-schwach); color: var(--akzent); }
.marke.warn { background: var(--warn-flaeche); color: var(--warn); }
.marke.alarm { background: var(--alarm-flaeche); color: var(--alarm); }

.hinweis {
  display: flex;
  gap: .6rem;
  padding: .65rem .85rem;
  border: 1px solid var(--rand);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius);
  background: var(--flaeche);
  margin-bottom: .5rem;
  font-size: .875rem;
}
.hinweis.warn { border-left-color: var(--warn); background: var(--warn-flaeche); }
.hinweis.alarm { border-left-color: var(--alarm); background: var(--alarm-flaeche); }
.hinweis strong { font-weight: 600; }

/* ============================================================================
 * Formulare
 * ========================================================================= */

.feldgruppe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .85rem 1rem;
  margin-bottom: 1rem;
}

label.feld { display: block; font-size: .8rem; }
label.feld > span.bezeichnung {
  display: block;
  font-weight: 550;
  color: var(--text-2);
  margin-bottom: .25rem;
}
label.feld > span.hilfe {
  display: block;
  font-size: .75rem;
  color: var(--text-3);
  margin-top: .25rem;
  line-height: 1.4;
}

input[type="text"], input[type="number"], input[type="password"],
input[type="date"], input[type="file"], select, textarea {
  font: inherit;
  font-size: .875rem;
  width: 100%;
  padding: .42rem .55rem;
  background: var(--flaeche);
  color: var(--text);
  border: 1px solid var(--rand-stark);
  border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--akzent);
  outline-offset: -1px;
  border-color: var(--akzent);
}
input[readonly] { background: var(--flaeche-2); color: var(--text-2); }
textarea { min-height: 4.5rem; resize: vertical; }

.knopfzeile {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding-top: .9rem;
  margin-top: .3rem;
  border-top: 1px solid var(--rand);
}

button, .knopf {
  font: inherit;
  font-size: .85rem;
  font-weight: 550;
  padding: .42rem .9rem;
  background: var(--akzent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
button:hover, .knopf:hover { filter: brightness(1.08); text-decoration: none; }
button.zweitrangig, .knopf.zweitrangig {
  background: var(--flaeche);
  color: var(--text);
  border-color: var(--rand-stark);
}
button.zweitrangig:hover { background: var(--flaeche-2); filter: none; }

/* ============================================================================
 * Fotos
 * ========================================================================= */

.foto-gitter {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.foto-karte { overflow: hidden; }
.foto-karte img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--flaeche-2);
}
.foto-karte .inhalt { padding: .8rem .9rem 1rem; }
.foto-karte .zeit { font-size: .74rem; color: var(--text-3); font-family: var(--mono); }

.bewertung {
  white-space: pre-wrap;
  font-size: .84rem;
  line-height: 1.55;
  margin-top: .6rem;
  padding-top: .6rem;
  border-top: 1px solid var(--rand);
  color: var(--text-2);
}

.klima-zeile {
  font-size: .74rem;
  color: var(--text-3);
  font-family: var(--mono);
  margin-top: .35rem;
}

/* ============================================================================
 * Kleinkram
 * ========================================================================= */

.leise { color: var(--text-2); font-size: .82rem; }
.mono { font-family: var(--mono); font-size: .95em; }
.zahl { font-variant-numeric: tabular-nums; }
.leer { color: var(--text-3); font-size: .875rem; padding: 1.5rem 0; text-align: center; }

/* Schmale Bildschirme: Seitenleiste nach oben, Navigation waagerecht. */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .seitenleiste {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--rand);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .75rem 1rem;
  }
  .nav-gruppe { flex-direction: row; gap: .25rem; }
  .nav-titel, .seitenleiste .fuss { display: none; }
  .inhalt { padding: 1.25rem 1rem 3rem; }
}
