:root {
  --grund: #f4f6f9; --flaeche: #ffffff; --flaeche2: #eef2f7; --text: #18212d; --leise: #5f6b7a;
  --linie: #dbe1e9; --akzent: #1f5fae; --akzent-text: #ffffff; --plus: #17803d; --minus: #b42318;
  --warn-grund: #fff6dc; --warn-linie: #e9c45a; --fehler-grund: #fde8e6; --ok-grund: #e5f5ea;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --rund: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #0f141b; --flaeche: #171e27; --flaeche2: #1e2732; --text: #e6ebf1; --leise: #98a4b3;
    --linie: #2a3542; --akzent: #5b9be6; --akzent-text: #0b1220; --plus: #4cc47a; --minus: #f07a6c;
    --warn-grund: #3a3115; --warn-linie: #8a7224; --fehler-grund: #3c1a18; --ok-grund: #163222;
    --schatten: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--grund); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 .7rem; display: flex; align-items: center; gap: .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }

.kopf { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 54px;
  background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.marke { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--akzent); color: var(--akzent-text); font-weight: 800; }
.logo.gross { width: 54px; height: 54px; font-size: 28px; border-radius: 14px; margin: 0 auto 10px; }
.kopf nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.kopf nav a { padding: 8px 11px; border-radius: 8px; color: var(--leise); white-space: nowrap; }
.kopf nav a.an, .kopf nav a:hover { background: var(--flaeche2); color: var(--text); text-decoration: none; }
.abmelden { margin: 0; }
@media (max-width: 760px) {
  .kopf { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 6px; }
  .kopf nav { order: 3; flex-basis: 100%; }
  .marke { flex: 1; }
}

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 16px; margin-bottom: 16px; box-shadow: var(--schatten); }
details.karte > summary { cursor: pointer; font-weight: 600; }
.raster { display: grid; gap: 16px; }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.raster > .karte { margin-bottom: 0; }
.raster + * { margin-top: 16px; }
.zeile-titel { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.zeile-titel h1, .zeile-titel h2 { margin: 0; }

.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--rund); padding: 12px 14px; box-shadow: var(--schatten); }
.kachel span { display: block; color: var(--leise); font-size: .85rem; }
.kachel b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kachel b.klein { font-size: 1.05rem; }
.kachel small { color: var(--leise); }
.kachel.plus b, .plus { color: var(--plus); }
.kachel.minus b, .minus { color: var(--minus); }

.knoepfe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.knoepfe.unten { margin: 4px 0 20px; }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--linie);
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none !important; min-height: 38px; }
.knopf:hover { background: var(--flaeche2); }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.haupt:hover { filter: brightness(1.07); }
.knopf.gefahr { color: var(--minus); }
.knopf.leer { border-color: transparent; background: none; }
.knopf.klein { padding: 3px 9px; min-height: 0; font-size: .85rem; }
.knopf.gross { padding: 12px 18px; font-size: 1.05rem; }
.knopf.breit { width: 100%; }
.knopf.rechts { margin-left: auto; }
button.link { background: none; border: 0; padding: 0; color: var(--akzent); font: inherit; cursor: pointer; }
button.link.gefahr { color: var(--minus); }
.klein { font-size: .85rem; }

.formular .felder, form.felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 14px; }
.felder .breit { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--leise); }
label.haken { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--akzent) 45%, transparent); border-color: var(--akzent); }
.formular.schmal { max-width: 560px; }
.umschalter { display: flex; gap: 0; border: 1px solid var(--linie); border-radius: 9px; overflow: hidden; width: max-content; margin-bottom: 14px; max-width: 100%; }
.umschalter label { flex-direction: row; align-items: center; gap: 6px; padding: 8px 14px; color: var(--text); cursor: pointer; border-right: 1px solid var(--linie); }
.umschalter label:last-child { border-right: 0; }
.umschalter label:has(input:checked) { background: var(--akzent); color: var(--akzent-text); }
.umschalter input { position: absolute; opacity: 0; }
.offenfeld { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
@media (max-width: 560px) { .offenfeld { grid-template-columns: 1fr; } }

.ablageflaeche { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--linie); border-radius: var(--rund); padding: 18px; text-align: center; color: var(--leise); cursor: pointer; margin: 8px 0; }
.ablageflaeche:hover, .ablageflaeche.drueber { border-color: var(--akzent); color: var(--text); }
.ablageflaeche input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ablageflaeche.gross { min-height: 150px; font-size: 1.1rem; }
.ablageflaeche img { max-width: 100%; max-height: 260px; border-radius: 8px; }

.tabelle-rahmen { overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabelle th { text-align: left; font-weight: 600; color: var(--leise); font-size: .82rem; border-bottom: 1px solid var(--linie); padding: 6px 8px; }
.tabelle td { border-bottom: 1px solid var(--linie); padding: 7px 8px; vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle tr[data-href] { cursor: pointer; }
.tabelle tr[data-href]:hover td { background: var(--flaeche2); }
.tabelle tr.offen td { background: var(--warn-grund); }
.tabelle tr.einnahme .betrag { color: var(--plus); }
.tabelle .r { text-align: right; }
.tabelle.klein td, .tabelle.klein th { font-size: .82rem; }
.tabelle.euer td.zeile { width: 52px; color: var(--leise); }
.tabelle.euer tr.abschnitt td { font-weight: 700; padding-top: 16px; border-bottom: 1px solid var(--linie); }
.tabelle.euer tr.summe td { font-weight: 700; background: var(--flaeche2); }
.tabelle.euer tr.summe.gross td { font-size: 1.1rem; }
.tabelle.euer tr.summe.plus td:last-child { color: var(--plus); }
.tabelle.euer tr.summe.minus td:last-child { color: var(--minus); }
.tabelle summary { cursor: pointer; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; word-break: break-all; }
.beleg-nein { color: var(--minus); }
.nurschmal { display: none; }
@media (max-width: 760px) { .nurbreit { display: none; } .nurschmal { display: block; } }

.leise { color: var(--leise); }
.zahl { background: var(--flaeche2); border-radius: 99px; padding: 0 9px; font-size: .85rem; color: var(--leise); }
.marke, .marke-offen { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; vertical-align: middle; }
.marke { background: var(--flaeche2); color: var(--leise); }
.marke-offen { background: var(--warn-grund); color: var(--text); border: 1px solid var(--warn-linie); }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: 6px 0; border-bottom: 1px solid var(--linie); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.liste li:last-child { border-bottom: 0; }

.meldung { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--ok-grund); }
.meldung.fehler { background: var(--fehler-grund); }
.hinweis { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; background: var(--flaeche2); }
.hinweis.warnung { background: var(--warn-grund); border: 1px solid var(--warn-linie); }
.hinweis.fehler { background: var(--fehler-grund); }
.fehlertext { color: var(--minus); }

.balken { height: 10px; background: var(--flaeche2); border-radius: 99px; overflow: hidden; margin: 6px 0 10px; }
.balken i { display: block; height: 100%; width: 0; background: var(--akzent); border-radius: 99px; }
.balken i.voll { background: var(--minus); }

.belege { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 10px; }
.beleg { border: 1px solid var(--linie); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.beleg img { width: 100%; height: 150px; object-fit: cover; border-radius: 6px; background: var(--flaeche2); }
.beleg .pdf { display: grid; place-items: center; height: 150px; background: var(--flaeche2); border-radius: 6px; font-weight: 700; font-size: 1.2rem; }
.belegknoepfe { display: flex; justify-content: space-between; }

.filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filter input[type=search] { flex: 1 1 260px; width: auto; }
.filter select { width: auto; flex: 0 1 auto; }
.jahrwahl { display: inline; margin: 0; }
.jahrwahl select { width: auto; font-size: 1.2rem; font-weight: 700; padding: 2px 8px; min-height: 0; }
.reiter { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--linie); }
.reiter a { padding: 8px 12px; color: var(--leise); border-bottom: 2px solid transparent; }
.reiter a.an { color: var(--text); border-bottom-color: var(--akzent); }

.anmeldung { min-height: 80vh; display: grid; place-items: center; }
.anmeldung .karte { width: min(380px, 100%); text-align: center; }
.anmeldung form { text-align: left; display: grid; gap: 12px; margin-top: 16px; }
.zahl.rot { background: var(--minus); color: #fff; }
.aufgabe { border: 1px solid var(--linie); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.aufgabe.frage { border-left: 4px solid var(--akzent); }
.aufgabe.beleg { border-left: 4px solid var(--warn-linie); }
.aufgabe.erledigt { opacity: .6; }
.aufgabe-kopf { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.aufgabe-text { margin: 8px 0; white-space: pre-line; }
.aufgabe-antwort { display: grid; gap: 8px; }
.ablageflaeche.klein { padding: 8px; margin: 0; }
.ablage { display: grid; gap: 8px; }
.ablage .ablageflaeche { margin: 0; }
.aufgabe.beantwortet { border-left-color: var(--plus); }
.antwort { background: var(--ok-grund); border-radius: 6px; padding: 8px 10px; margin: 6px 0; white-space: pre-line; }
