:root {
  --bg: #f5f6f8; --karte: #fff; --text: #1d2230; --leise: #5d6475; --linie: #dde1e8;
  --akzent: #3b4fc4; --akzent-h: #e6e9fb; --gut: #0f7a4a; --gut-h: #e2f4ea; --gefahr: #b42318; --gefahr-h: #fde8e6;
  --admin: #8a3ffc; --admin-h: #efe6ff; --lehr: #0f9488; --lehr-h: #e3f4f2;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171f; --karte: #1d212c; --text: #e9ecf3; --leise: #9aa2b4; --linie: #2d3240;
    --akzent: #8f9cff; --akzent-h: #262c4d; --gut: #5fd39a; --gut-h: #173326; --gefahr: #ff8a80; --gefahr-h: #3a1d1b;
    --admin: #c3a2ff; --admin-h: #2e2245; --lehr: #4fd1c2; --lehr-h: #183836; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--akzent); }
main { width: 100%; max-width: 980px; margin: 0 auto; padding: 1.6rem 1.2rem 2rem; flex: 1; }
h1 { margin: 0 0 .3rem; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--leise); margin: 0 0 .7rem; }
h2.abschnitt { margin: 2rem 0 .3rem; }
h3 { margin: 0; font-size: 1.1rem; }
code { font: .95em ui-monospace, Menlo, monospace; }
.leise { color: var(--leise); }
.klein { font-size: .85rem; }

/* Kopfzeile: gemeinsame Leiste (leiste.css), darunter die Navigation des Kontos */
.unterleiste { display: flex; gap: .2rem; flex-wrap: wrap; padding: .45rem 1rem; background: var(--karte); border-bottom: 1px solid var(--linie); }
.unterleiste a { padding: .35rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.unterleiste a:hover { background: var(--bg); }
.unterleiste a.aktiv { background: var(--akzent-h); color: var(--akzent); font-weight: 600; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--linie); color: var(--text); vertical-align: middle; }
.badge.admin { background: var(--admin-h); color: var(--admin); }
.badge.lehrkraft { background: var(--lehr-h); color: var(--lehr); }
.badge.schueler { background: var(--akzent-h); color: var(--akzent); }

.meldung { padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; background: var(--gut-h); color: var(--gut); border: 1px solid currentColor; overflow-wrap: anywhere; }
.meldung.fehler { background: var(--gefahr-h); color: var(--gefahr); }

.einleitung { margin: .5rem 0 1.4rem; }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 16px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.karte.leer { color: var(--leise); }
.karte.gesperrt, tr.gesperrt { opacity: .55; }
.kartenkopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.kartenkopf h2 { margin: 0; }
details.karte summary { cursor: pointer; font-weight: 600; }
details.karte[open] summary { margin-bottom: .8rem; }
.zwei { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.schmal { max-width: 460px; }

.formular { display: flex; flex-direction: column; gap: .8rem; }
.formular.reihe { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.formular.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: end; }
.formular .voll, .formular.reihe .voll { grid-column: 1 / -1; flex-basis: 100%; margin: 0; }
.formular .zeile { display: flex; gap: 1rem; align-items: center; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--leise); }
label.haken { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--linie); border-radius: 10px; padding: .5rem .7rem; min-width: 0; }
textarea { font: .95rem ui-monospace, Menlo, monospace; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--akzent); }
.code-eingabe { font: 600 1.3rem ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: lowercase; }
input.kurz { width: 7rem; padding: .25rem .5rem; }
button, .knopf { font: inherit; font-weight: 600; padding: .55rem 1.1rem; border-radius: 10px; border: 0; background: var(--akzent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
@media (prefers-color-scheme: dark) { button, .knopf { color: #10131a; } }
button.zweit, .knopf.zweit { background: var(--akzent-h); color: var(--akzent); }
button.gefahr { background: var(--gefahr); }
button.link { background: none; color: var(--akzent); padding: 0; font-weight: 400; text-decoration: underline; }
button.link.gefahr { color: var(--gefahr); }
form.inline { display: inline; }
.aktionen { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .9rem; }
td.aktionen { display: table-cell; }
td.aktionen form + form { margin-left: .8rem; }

.tabelle { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.tabelle th, .tabelle td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tabelle thead th { font-size: .8rem; color: var(--leise); font-weight: 600; }
.scroll { overflow-x: auto; }
.matrix th, .matrix td { text-align: center; white-space: nowrap; }
.matrix tbody th { text-align: left; font-weight: 500; }
button.spalte { background: var(--akzent-h); color: var(--akzent); padding: .15rem .5rem; font-size: .8rem; border-radius: 6px; }

.kacheln { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.kachel { background: var(--karte); border: 1px solid var(--linie); border-radius: 16px; overflow: hidden; }
.kachel-kopf { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; color: var(--text); text-decoration: none; }
.kachel-kopf:hover { background: var(--akzent-h); }
.symbol { flex: none; display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 12px; background: var(--akzent-h); color: var(--akzent); font: 700 1.1rem ui-monospace, Menlo, monospace; }
.text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.text b { font-size: 1.05rem; }
.text span { color: var(--leise); font-size: .9rem; }
.pfeil { color: var(--leise); font-size: 1.3rem; }
.lektionen { margin: 0; padding: .3rem 1.2rem .9rem 2.6rem; border-top: 1px solid var(--linie); }
.lektionen li { padding: .15rem 0; }
.kachel .leise.klein { padding: 0 1.1rem .9rem; margin: 0; }

.fuss { text-align: center; color: var(--leise); font-size: .82rem; padding: 1.5rem; }
.fuss a { color: var(--leise); }

/* Kärtchen zum Ausdrucken */
body.druck { background: #fff; color: #000; display: block; padding: 1rem; }
.kaertchen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.kaertchen-1 { border: 1px dashed #999; padding: .9rem 1rem; break-inside: avoid; height: 5.3cm; display: flex; flex-direction: column; justify-content: space-between; }
.k-kopf { display: flex; justify-content: space-between; font-size: .85rem; color: #444; }
.k-code { font: 700 1.7rem ui-monospace, Menlo, monospace; letter-spacing: .08em; text-align: center; }
.k-fuss { font-size: .75rem; color: #444; }
@media print { .nicht-drucken { display: none; } body.druck { padding: 0; } }
.badge.offen { background: #fdecc8; color: #8a5a00; }
td.anzeigename .vorschlag { margin-top: .2rem; }
td.anzeigename form.inline { display: inline; }
