/* Bewusst schlicht gehalten: Lesbarkeit vor Gestaltung.
   Farbe wird nur dort eingesetzt, wo sie eine Bedeutung hat. */

:root {
  --text: #1b1f23;
  --text-leise: #5b6570;
  --linie: #d7dce1;
  --flaeche: #ffffff;
  --hintergrund: #f4f6f8;
  --fokus: #1a4f8a;

  --blau: #1a4f8a;   --blau-hell: #e4edf7;
  --rot: #9c1f1f;    --rot-hell: #fbe6e6;
  --gelb: #7a5600;   --gelb-hell: #fbf0d5;
  --gruen: #1d6b33;  --gruen-hell: #e2f2e6;
  --grau: #4a5560;   --grau-hell: #e9ecef;
}

* { box-sizing: border-box; }

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

h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
a { color: var(--fokus); }

:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

/* --- Kopfbereich --------------------------------------------------------- */

.kopf {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}
.marke { font-weight: 700; text-decoration: none; color: var(--text); }
.hauptnavigation { display: flex; gap: 1rem; }
.hauptnavigation a { text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.hauptnavigation a[aria-current="page"] { border-bottom-color: var(--fokus); font-weight: 600; }
.abmelden { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.benutzername { color: var(--text-leise); font-size: 0.9rem; }

.inhalt { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.seitenkopf { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.zurueck { margin: 0 0 0.5rem; font-size: 0.9rem; }

/* --- Meldungen ----------------------------------------------------------- */

.meldung { padding: 0.6rem 0.9rem; border-radius: 4px; border-left: 4px solid; margin: 0 0 1rem; }
.meldung-erfolg { background: var(--gruen-hell); border-color: var(--gruen); }
.meldung-fehler { background: var(--rot-hell); border-color: var(--rot); }
.feldfehler { color: var(--rot); font-size: 0.9rem; margin: 0.15rem 0 0.5rem; }
.warnung { color: var(--rot); font-weight: 600; }
.leer { color: var(--text-leise); background: var(--flaeche); border: 1px dashed var(--linie); padding: 1rem; border-radius: 4px; }
.hilfetext { color: var(--text-leise); font-size: 0.85rem; }

/* --- Reiter und Kacheln -------------------------------------------------- */

.reiter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.reiter-knopf {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.5rem 0.9rem; text-decoration: none; color: var(--text);
  background: var(--flaeche); border: 1px solid var(--linie);
  border-left: 5px solid var(--randfarbe, var(--linie)); border-radius: 4px;
}
.reiter-knopf.aktiv { background: var(--flaechefarbe, var(--grau-hell)); font-weight: 600; }
.reiter-anzahl { background: var(--hintergrund); border-radius: 999px; padding: 0 0.5rem; font-size: 0.85rem; }

.kachelreihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.kachel {
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.9rem; text-decoration: none; color: var(--text);
  background: var(--flaeche); border: 1px solid var(--linie);
  border-left: 5px solid var(--randfarbe, var(--linie)); border-radius: 4px;
}
.kachel-zahl { font-size: 1.6rem; font-weight: 700; }
.kachel-text { color: var(--text-leise); }

/* Bedeutungsfarben */
.farbe-blau  { --randfarbe: var(--blau);  --flaechefarbe: var(--blau-hell); }
.farbe-rot   { --randfarbe: var(--rot);   --flaechefarbe: var(--rot-hell); }
.farbe-gelb  { --randfarbe: var(--gelb);  --flaechefarbe: var(--gelb-hell); }
.farbe-gruen { --randfarbe: var(--gruen); --flaechefarbe: var(--gruen-hell); }
.farbe-grau  { --randfarbe: var(--grau);  --flaechefarbe: var(--grau-hell); }

.abzeichen {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.85rem;
  background: var(--flaechefarbe); border: 1px solid var(--randfarbe); color: var(--randfarbe);
}
.marke-dringend {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.8rem; font-weight: 700;
  background: var(--rot); color: #fff; letter-spacing: 0.02em;
}
.marke-teilweise {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.8rem;
  background: var(--gelb-hell); border: 1px solid var(--gelb); color: var(--gelb);
}

/* --- Karten und Raster --------------------------------------------------- */

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 4px; padding: 1rem; margin: 1rem 0; }
.zwei-spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }

.daten { display: grid; grid-template-columns: minmax(9rem, auto) 1fr; gap: 0.35rem 1rem; margin: 0; }
.daten dt { color: var(--text-leise); }
.daten dd { margin: 0; }

.liste-schlicht { list-style: none; margin: 0; padding: 0; }
.liste-schlicht li { padding: 0.5rem 0; border-bottom: 1px solid var(--linie); }

/* --- Tabellen ------------------------------------------------------------ */

.tabelle-rahmen { border-left: 5px solid var(--randfarbe, var(--linie)); border-radius: 4px; overflow-x: auto; background: var(--flaeche); }
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); font-size: 0.95rem; }
.tabelle th, .tabelle td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle th { background: var(--hintergrund); font-size: 0.85rem; text-transform: none; white-space: nowrap; }
.tabelle .zahl { text-align: right; white-space: nowrap; }
.tabelle .kommentar { max-width: 22rem; }
.tabelle-schmal { font-size: 0.9rem; }
tr.anklickbar { cursor: pointer; }
tr.anklickbar:hover { background: var(--hintergrund); }
tr.zeile-dringend { box-shadow: inset 4px 0 0 var(--rot); }
tr.zeile-teilweise td { background: var(--gelb-hell); }

/* --- Formulare ----------------------------------------------------------- */

.formular { display: block; max-width: 30rem; }
.formular-breit { max-width: 46rem; }
.formular label, .anmeldebereich label { display: block; margin: 0.75rem 0 0.2rem; font-weight: 600; }
.formular input[type="text"], .formular input:not([type]), .formular input[type="password"],
.formular input[type="date"], .formular select, .formular textarea,
.anmeldebereich input {
  width: 100%; padding: 0.5rem; font: inherit;
  border: 1px solid var(--linie); border-radius: 3px; background: #fff; color: var(--text);
}
.formular fieldset { border: 1px solid var(--linie); border-radius: 4px; padding: 0.75rem 1rem 1rem; margin: 0 0 1rem; background: var(--flaeche); }
.formular legend { font-weight: 700; padding: 0 0.4rem; }
.pflicht { color: var(--rot); }
.rechenhinweis { background: var(--hintergrund); border: 1px solid var(--linie); border-radius: 3px; padding: 0.5rem 0.7rem; margin: 0.75rem 0; }
.auswahlreihe { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 0.35rem 0; }
.schalter { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400 !important; margin: 0 !important; }
.schalter input { width: auto !important; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1rem; }

.reihe-formular {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid var(--linie);
}
.reihe-formular:last-child { border-bottom: none; }
.reihe-formular label { font-weight: 600; margin: 0; }
.reihe-formular input, .reihe-formular select { padding: 0.4rem; font: inherit; border: 1px solid var(--linie); border-radius: 3px; }

.filterleiste {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 4px;
  padding: 0.75rem; margin-bottom: 1rem;
}
.filter-feld { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--text-leise); }
.filter-feld input, .filter-feld select { padding: 0.35rem; font-size: 0.95rem; border: 1px solid var(--linie); border-radius: 3px; }
.filter-schalter { flex-direction: row; align-items: center; gap: 0.4rem; padding-bottom: 0.4rem; }

/* --- Knöpfe -------------------------------------------------------------- */

.knopf {
  display: inline-block; padding: 0.45rem 0.9rem; font: inherit; cursor: pointer;
  border-radius: 3px; border: 1px solid var(--linie); background: var(--flaeche);
  color: var(--text); text-decoration: none;
}
.knopf:hover { background: var(--hintergrund); }
.knopf-haupt { background: var(--fokus); border-color: var(--fokus); color: #fff; font-weight: 600; }
.knopf-haupt:hover { background: #14406f; }
.knopf[disabled] { opacity: 0.5; cursor: not-allowed; }

.anmeldebereich { max-width: 22rem; margin: 4rem auto; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 4px; padding: 1.5rem; }
.anmeldebereich .knopf { margin-top: 1rem; width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Kg-Anzeige in Reitern und Kacheln */
.reiter-kg { font-size: 0.78rem; color: var(--text-leise); }
.kachel-kg { font-size: 0.85rem; color: var(--text-leise); margin-top: 0.1rem; }
.status-kg { color: var(--text-leise); font-size: 0.9rem; margin: -0.5rem 0 0.75rem; }

/* Mini-Knöpfe in Tabellenzeilen */
.knopf-mini { padding: 0.2rem 0.5rem; font-size: 0.85rem; }
.zeile-aktionen { white-space: nowrap; text-align: right; }
