/* Handgeschrieben, bewusst klein. Kein Tailwind, kein Build-Schritt —
   dieses System soll in zehn Jahren noch ohne Node-Toolchain baubar sein. */

:root {
  /* Beide Paletten stehen je Farbe in einer Zeile. Vorher gab es einen
     zweiten Block fuer dunkel — und der wurde beim Aendern einer Farbe
     verlaesslich vergessen: Warnung und Fehler blieben dort auf ihren
     dunklen Rottoenen stehen und waren auf dunklem Grund kaum zu lesen.
     light-dark() waehlt anhand von color-scheme aus, damit gibt es die
     zweite Stelle nicht mehr. */
  color-scheme: light dark;

  --grund:       light-dark(#1a1d21, #e8eaed);
  --gedaempft:   light-dark(#69707e, #9aa3af);
  --linie:       light-dark(#e2e5e9, #2f343a);
  --flaeche:     light-dark(#ffffff, #1b1f24);
  --hintergrund: light-dark(#f5f6f8, #131619);
  --akzent:      light-dark(#1f5f8b, #6ba8d6);
  --warnung:     light-dark(#b45309, #e0913c);
  --fehler:      light-dark(#b91c1c, #f08a84);
  /* Schrift auf dem Akzentknopf: hell auf dunklem Blau, dunkel auf hellem. */
  --auf-akzent:  light-dark(#ffffff, #10161c);
  --radius: 6px;
}

/* Die Umschaltung ist eine Zeile: color-scheme entscheidet, welche Haelfte
   von light-dark() gilt — und nebenbei auch, wie Auswahlfelder, Bildlaufleiste
   und Datumsauswahl des Browsers aussehen. Ohne Angabe gilt die
   Systemeinstellung. */
:root[data-thema="hell"] { color-scheme: light; }
:root[data-thema="dunkel"] { color-scheme: dark; }

* { box-sizing: border-box; }

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

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}

.kopf nav { display: flex; align-items: center; gap: 1rem; }
.kopf form { margin: 0; }

.marke { font-weight: 600; text-decoration: none; color: var(--grund); }
.wer { color: var(--gedaempft); font-size: 0.9rem; }

.inhalt {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }

.hinweis { color: var(--gedaempft); max-width: 60ch; }
.fehler { color: var(--fehler); }

.anmeldung {
  max-width: 22rem;
  margin: 12vh auto 0;
  padding: 1.75rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.anmeldung h1 { text-align: center; margin-bottom: 1.5rem; }
.anmeldung label { display: block; margin: 0.9rem 0 0.25rem; font-size: 0.875rem; }

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--grund);
  background: var(--hintergrund);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 1px;
}

.knopf {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 500;
  color: var(--auf-akzent);
  background: var(--akzent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.knopf-schlicht {
  font: inherit;
  font-size: 0.9rem;
  color: var(--gedaempft);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.tabelle {
  width: 100%;
  border-collapse: collapse;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.tabelle th,
.tabelle td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--linie);
}

.tabelle th { font-size: 0.8rem; text-transform: uppercase; color: var(--gedaempft); }
.tabelle tr:last-child td { border-bottom: 0; }

/* Beträge gehören rechtsbündig und in Tabellenziffern — bei Buchhaltung
   ist das keine Kosmetik, sondern Lesbarkeit beim Abgleich. */
.betrag {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Erfassungsmaske --- */

.erfassung {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem 1rem;
  padding: 1.25rem;
  margin-bottom: 2rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.feld { display: flex; flex-direction: column; }
.feld--breit { grid-column: 1 / -1; }
.feld--aktion { grid-column: 1 / -1; align-items: flex-start; }
.feld--aktion .knopf { width: auto; min-width: 12rem; margin-top: 0.5rem; }

.feld label { margin-bottom: 0.25rem; font-size: 0.875rem; }

select,
input[type="date"] {
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--grund);
  background: var(--hintergrund);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.beiwerk { margin-top: 0.2rem; font-size: 0.8rem; color: var(--gedaempft); }
.warnung { color: var(--warnung); font-weight: 500; }

.feld ul.errorlist {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--fehler);
}

.zeitraumwahl { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }

/* Die Soll-/Habenzeilen einer Buchung. Klein gesetzt: sie sind der Nachweis,
   was aus dem Vorgang geworden ist, nicht die Hauptinformation. */
.zeilen { font-size: 0.8rem; color: var(--gedaempft); white-space: nowrap; }
.zeile { display: block; font-variant-numeric: tabular-nums; }

.marker {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  font-size: 0.75rem;
  border: 1px solid var(--linie);
  border-radius: 999px;
}
.marker--warnung { color: var(--warnung); border-color: var(--warnung); }

.kopf nav a { color: var(--gedaempft); text-decoration: none; font-size: 0.9rem; }
.kopf nav a:hover { color: var(--grund); text-decoration: underline; }

/* --- Ein offener Bankumsatz --- */

.umsatz {
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.umsatz__kopf {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.umsatz__datum { font-variant-numeric: tabular-nums; color: var(--gedaempft); }
.umsatz__betrag { font-weight: 600; min-width: 7rem; }
.umsatz__partei { font-weight: 500; }

.umsatz__zweck {
  margin: 0.35rem 0 0.6rem;
  color: var(--gedaempft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* Der Vorschlag muss erkennbar ein Vorschlag bleiben, keine Tatsache. */
.vorschlag {
  margin: 0 0 0.6rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  background: var(--hintergrund);
  border-left: 3px solid var(--akzent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.umsatz__aktion { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.umsatz__aktion select { flex: 1 1 16rem; }
.umsatz__aktion input[type="text"] { flex: 2 1 18rem; }

.knopf--schmal { width: auto; margin-top: 0; padding: 0.55rem 1.2rem; }

.umsatz__mehr { margin-top: 0.6rem; }
.umsatz__mehr summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--gedaempft);
}
.umsatz__mehr .umsatz__aktion { margin-top: 0.5rem; }

.meldungen { list-style: none; padding: 0; margin: 0 0 1rem; }
.meldung {
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--linie);
  background: var(--flaeche);
}
.meldung--error { border-color: var(--fehler); color: var(--fehler); }
.meldung--warning { border-color: var(--warnung); color: var(--warnung); }

/* Die Zahllast-Zeile der Voranmeldung — die eine Zahl, die zählt. */
.zeile--summe td {
  border-top: 2px solid var(--linie);
  font-weight: 600;
}

/* --- Themawahl ---------------------------------------------------------- */

.themawahl {
  font: inherit;
  font-size: 0.85rem;
  color: var(--gedaempft);
  background: none;
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 0.15rem 0.35rem;
  cursor: pointer;
}

/* Ohne JavaScript schaltet nichts um. Ein Bedienelement, das nichts tut,
   ist schlimmer als keines — dann bleibt es bei der Systemeinstellung. */
.themawahl--wirkungslos { display: none; }

/* Die Anmeldeseite hat keine Kopfleiste; dort steht die Wahl fuer sich. */
.leiste--nackt {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem 0;
}
