/* infobuerger.de — Auswertungsoberfläche
 *
 * Nüchtern und dicht. Der Gegenstand verträgt keine Effekte, und wer eine
 * Tabelle mit dreißig Spalten liest, braucht Platz, keine Verzierung.
 */

:root {
  --grund:        #ffffff;
  --flaeche:      #f5f6f7;
  --flaeche-tief: #eceef0;
  --rand:         #d6dade;
  --rand-stark:   #b3bac0;
  --schrift:      #1a1d20;
  --schrift-matt: #5c656d;
  --schrift-schwach: #868f97;
  --akzent:       #2f5d7c;
  --akzent-hell:  #e6eef4;
  --warnung:      #8a3324;
  --warnung-hell: #fbf0ed;
  --gut:          #2c6046;
  --schatten:     0 1px 2px rgba(0, 0, 0, .06);
  --radius:       4px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund:        #16191c;
    --flaeche:      #1d2126;
    --flaeche-tief: #24292f;
    --rand:         #333a41;
    --rand-stark:   #4a535c;
    --schrift:      #e6e9ec;
    --schrift-matt: #a3adb6;
    --schrift-schwach: #7b858e;
    --akzent:       #7fb0d0;
    --akzent-hell:  #1e2c36;
    --warnung:      #e2917f;
    --warnung-hell: #2e1f1c;
    --gut:          #8fc4a8;
    --schatten:     none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--schrift);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--akzent); }
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9em;
  background: var(--flaeche-tief);
  padding: .1em .35em;
  border-radius: 3px;
}

/* ------------------------------------------------------------- Gerüst */

.kopf {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .6rem 1.5rem;
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
  flex-wrap: wrap;
}
.kopf .marke {
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--schrift);
  text-decoration: none;
}
.kopf nav { display: flex; gap: 1.25rem; flex: 1; }
.kopf nav a {
  text-decoration: none;
  color: var(--schrift-matt);
  padding: .2rem 0;
  border-bottom: 2px solid transparent;
}
.kopf nav a:hover { color: var(--schrift); }
.kopf nav a.aktiv { color: var(--schrift); border-bottom-color: var(--akzent); }
.kopf .abmelden { font-size: .85rem; color: var(--schrift-schwach); }

main { padding: 1.5rem; max-width: 1800px; margin: 0 auto; }

h1 { font-size: 1.5rem; margin: 0 0 .2rem; font-weight: 600; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 600; }

.untertitel  { margin: 0 0 1rem; color: var(--schrift-matt); }
.beschreibung { margin: 0 0 .75rem; color: var(--schrift-matt); max-width: 75ch; }
.schwach     { color: var(--schrift-schwach); }
.hinweis     { font-size: .85rem; color: var(--schrift-schwach); margin: .75rem 0 0; max-width: 80ch; }

.fuss {
  margin-top: 3rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--rand);
  font-size: .8rem;
  color: var(--schrift-schwach);
}
.fuss p { margin: 0; }

/* -------------------------------------------------------- Hinweiskästen */

.vorbehalt {
  margin: 0 0 1.25rem;
  padding: .7rem .9rem;
  background: var(--flaeche);
  border-left: 3px solid var(--rand-stark);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .875rem;
  color: var(--schrift-matt);
  max-width: 100ch;
}
.vorbehalt strong { color: var(--schrift); }

.warnung {
  padding: .7rem .9rem;
  background: var(--warnung-hell);
  border-left: 3px solid var(--warnung);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--warnung);
  max-width: 100ch;
}

/* --------------------------------------------------------- Datensätze */

.datensaetze {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 1rem;
}
.datensaetze a {
  padding: .3rem .7rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--schrift-matt);
  font-size: .875rem;
  background: var(--grund);
}
.datensaetze a:hover { border-color: var(--rand-stark); color: var(--schrift); }
.datensaetze a.aktiv {
  background: var(--akzent-hell);
  border-color: var(--akzent);
  color: var(--schrift);
  font-weight: 500;
}

/* ------------------------------------------------------------- Layout */

.spalten-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.links { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }

@media (max-width: 1000px) {
  .spalten-layout { grid-template-columns: 1fr; }
  .links { position: static; max-height: none; }
}

/* ----------------------------------------------------------- Formular */

.filter {
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--grund);
  box-shadow: var(--schatten);
}

.filter-kopf {
  padding: .75rem;
  border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
  border-radius: var(--radius) var(--radius) 0 0;
  position: sticky;
  top: 0;
  z-index: 3;
}
.modus { display: flex; gap: 1rem; margin-bottom: .6rem; font-size: .875rem; }
.modus label { display: flex; align-items: center; gap: .3rem; cursor: pointer; }

.knoepfe { display: flex; gap: .5rem; align-items: center; }

button.haupt {
  flex: 1;
  padding: .45rem .9rem;
  background: var(--akzent);
  color: #fff;
  border: 1px solid var(--akzent);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
button.haupt:hover { filter: brightness(1.1); }
@media (prefers-color-scheme: dark) { button.haupt { color: #11171c; } }

.knopf-flach {
  padding: .45rem .7rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--schrift-matt);
  font-size: .85rem;
  white-space: nowrap;
}
.knopf-flach:hover { border-color: var(--rand-stark); }

.haeufigkeit-optionen {
  padding: .75rem;
  border-bottom: 1px solid var(--rand);
  background: var(--akzent-hell);
  display: grid;
  gap: .5rem;
  font-size: .875rem;
}
.haeufigkeit-optionen.versteckt { display: none; }
.haeufigkeit-optionen label { display: grid; gap: .2rem; }
.haeufigkeit-optionen select { width: 100%; }

select, input[type="search"], input[type="number"], input[type="date"], input[type="password"] {
  font: inherit;
  font-size: .875rem;
  padding: .3rem .4rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--grund);
  color: var(--schrift);
  min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 1px;
}

fieldset.gruppe {
  border: none;
  border-bottom: 1px solid var(--rand);
  margin: 0;
  padding: .75rem;
}
fieldset.gruppe:last-of-type { border-bottom: none; }
fieldset.gruppe legend {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--schrift-schwach);
  padding: 0;
  margin-bottom: .5rem;
}
.gruppe-hinweis {
  font-size: .8rem;
  color: var(--schrift-schwach);
  margin: -.25rem 0 .6rem;
}

.felder { display: grid; gap: .9rem; }

.feld { }
.feld-titel {
  font-size: .8rem;
  font-weight: 600;
  color: var(--schrift-matt);
  margin-bottom: .25rem;
}
.feld-aktiv .feld-titel { color: var(--akzent); }
.feld-aktiv .feld-titel::after { content: " •"; }
.feld-hinweis { font-size: .75rem; color: var(--schrift-schwach); margin: 0 0 .3rem; }

.kasten-werkzeug {
  display: flex;
  gap: .3rem;
  margin-bottom: .35rem;
  align-items: center;
}
.kasten-werkzeug .kasten-suche { flex: 1; font-size: .8rem; padding: .2rem .35rem; }
.kasten-werkzeug.schmal { justify-content: flex-start; }

button.mini {
  font: inherit;
  font-size: .72rem;
  padding: .15rem .4rem;
  border: 1px solid var(--rand);
  border-radius: 3px;
  background: var(--flaeche);
  color: var(--schrift-matt);
  cursor: pointer;
}
button.mini:hover { border-color: var(--rand-stark); color: var(--schrift); }

.kasten-gruppe-lang .kasten-liste {
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: .3rem;
  background: var(--flaeche);
}
.kasten-liste-breit {
  columns: 2;
  column-gap: .75rem;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: .3rem;
  background: var(--flaeche);
}

label.kasten {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  padding: .1rem 0;
  font-size: .85rem;
  cursor: pointer;
  line-height: 1.35;
  break-inside: avoid;
}
label.kasten:hover { color: var(--akzent); }
label.kasten input { margin: 0; flex: none; position: relative; top: 1px; }
label.kasten.versteckt { display: none; }
label.leer-kasten { color: var(--schrift-schwach); font-style: italic; }
label.kasten-vertraulich span { color: var(--warnung); }

.bereich-eingabe {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .35rem;
  font-size: .8rem;
  color: var(--schrift-schwach);
}
.bereich-eingabe input { width: 100%; }
.text-eingabe { width: 100%; }

.filter-fuss {
  padding: .75rem;
  border-top: 1px solid var(--rand);
  background: var(--flaeche);
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  gap: .75rem;
  align-items: end;
  position: sticky;
  bottom: 0;
}
.filter-fuss label { font-size: .8rem; color: var(--schrift-matt); display: grid; gap: .2rem; }

/* ---------------------------------------------------------- Ergebnisse */

.ergebnis-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.zaehler { margin: 0; font-size: .85rem; color: var(--schrift-schwach); }

.auswahl-liste {
  list-style: none;
  margin: 0 0 .75rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}
.auswahl-liste li {
  font-size: .78rem;
  background: var(--akzent-hell);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: .12rem .55rem;
  color: var(--schrift-matt);
}
.auswahl-feld { font-weight: 600; color: var(--schrift); }
.auswahl-feld::after { content: ":"; }
.auswahl-leer { font-size: .8rem; color: var(--schrift-schwach); margin: 0 0 .75rem; }

.tabelle-rahmen {
  overflow-x: auto;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--grund);
}

table.ergebnis {
  border-collapse: collapse;
  width: 100%;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
table.ergebnis th, table.ergebnis td {
  padding: .35rem .55rem;
  text-align: left;
  border-bottom: 1px solid var(--rand);
  white-space: nowrap;
  vertical-align: top;
}
table.ergebnis thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--flaeche);
  font-weight: 600;
  font-size: .75rem;
  color: var(--schrift-matt);
  border-bottom: 1px solid var(--rand-stark);
}
table.ergebnis thead th a { text-decoration: none; color: inherit; display: block; }
table.ergebnis thead th a:hover { color: var(--akzent); }
table.ergebnis thead th a.sortiert { color: var(--schrift); }
table.ergebnis tbody tr:hover { background: var(--flaeche); }
table.ergebnis tbody tr:last-child td { border-bottom: none; }
table.ergebnis tfoot th {
  background: var(--flaeche);
  border-top: 1px solid var(--rand-stark);
  border-bottom: none;
  font-size: .8rem;
}
.rechts { text-align: right !important; }
.zahl { font-variant-numeric: tabular-nums; }
.leer { color: var(--schrift-schwach); }
td .schwach, .schwach { color: var(--schrift-schwach); }

.kein-treffer {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--schrift-schwach);
  border: 1px dashed var(--rand);
  border-radius: var(--radius);
}

.blaettern {
  display: flex;
  gap: .25rem;
  margin-top: .75rem;
  flex-wrap: wrap;
  align-items: center;
}
.blaettern a {
  padding: .25rem .6rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--schrift-matt);
  font-size: .85rem;
}
.blaettern a:hover { border-color: var(--rand-stark); color: var(--schrift); }
.blaettern a.aktiv {
  background: var(--akzent);
  border-color: var(--akzent);
  color: #fff;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) { .blaettern a.aktiv { color: #11171c; } }
.blaettern .luecke { color: var(--schrift-schwach); padding: 0 .2rem; }

/* --------------------------------------------------------- Startseite */

.karten {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  max-width: 1100px;
}
.karte {
  display: block;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--schrift);
  background: var(--grund);
  box-shadow: var(--schatten);
}
.karte:hover { border-color: var(--akzent); }
.karte h2 { margin-bottom: .3rem; }
.karte p { margin: .4rem 0 0; font-size: .875rem; color: var(--schrift-matt); }
.karte-zahlen { font-variant-numeric: tabular-nums; color: var(--schrift) !important; font-weight: 500; }
.karte-warnung { font-size: .8rem !important; color: var(--schrift-schwach) !important; }

.datenpflege { font-size: .875rem; color: var(--schrift-matt); }

/* ---------------------------------------------------------- Selbsttest */

table.selbsttest td { white-space: normal; }
tr.stufe-fehler td:first-child  { border-left: 3px solid var(--warnung); font-weight: 600; }
tr.stufe-warnung td:first-child { border-left: 3px solid var(--rand-stark); }
tr.stufe-gut td:first-child     { border-left: 3px solid var(--gut); }

/* --------------------------------------------------------- Anmeldung */

body.anmeldeseite { display: grid; place-items: center; min-height: 100vh; }
.anmeldung {
  width: min(24rem, 90vw);
  padding: 2rem;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--grund);
  box-shadow: var(--schatten);
}
.anmeldung h1 { font-size: 1.25rem; }
.anmeldung form { display: grid; gap: .5rem; margin: 1.5rem 0; }
.anmeldung label { font-size: .8rem; color: var(--schrift-matt); }
.anmeldung input[type="password"] { width: 100%; padding: .5rem; }
.anmeldung .schwach { font-size: .78rem; margin: 0; }
.anmeldung .warnung { font-size: .875rem; }

/* ------------------------------------------------------------ Drucken */

@media print {
  .kopf, .fuss, .links, .blaettern, .datensaetze { display: none; }
  .spalten-layout { display: block; }
  .tabelle-rahmen { border: none; overflow: visible; }
  table.ergebnis { font-size: 8pt; }
  table.ergebnis th, table.ergebnis td { white-space: normal; }
}

/* Kurze Werte nebeneinander: Jahreszahlen und Kategorien füllen sonst
   die halbe Filterspalte. */
.kasten-liste-eng { columns: 2; column-gap: .5rem; }
.kasten-liste-eng label.kasten { break-inside: avoid; }
