/* REHE Hub – gemeinsames Design für Portal und Module.
   Ruhige, warme Flächen im hellen und abgestufter Graphit im dunklen Modus, Limette nur als Akzent.
   Alle Farben, Radien und Abstände stehen als Variablen am Anfang; Seiten verwenden nur diese. */

/* ---- Designvariablen */
:root {
  --grund: #F5F4F0;          /* Seitenhintergrund */
  --flaeche: #FCFBF8;        /* Navigation und Hauptflächen */
  --karte: #FAF9F6;          /* Karten */
  --feld: #FFFFFF;           /* Eingabefelder */
  --text: #171817;
  --text-leise: #61645E;
  --linie: #DEDFD7;
  --feld-rand: #8E9186;      /* kräftiger als --linie: Felder müssen als Felder erkennbar sein */
  --akzent: #DFFA91;
  --akzent-leise: #F0F6D5;
  --auf-akzent: #202615;
  --deko: #CFE08F;           /* Zierlinien im Begrüßungsbereich */
  --gut: #2C6B2F;      --gut-grund: #E8F3DC;
  --schlecht: #A3261D; --schlecht-grund: #FBE9E6;
  --achtung: #7A5200;  --achtung-grund: #FBF1D4;
  --schatten: 0 1px 2px rgba(23, 24, 23, .04), 0 8px 24px rgba(23, 24, 23, .04);

  --r-karte: 18px; --r-feld: 12px; --r-klein: 8px; --r-pille: 999px;
  --a1: 4px; --a2: 8px; --a3: 12px; --a4: 16px; --a5: 24px; --a6: 32px; --a7: 48px;
  --dauer: 160ms;
  --leiste-breite: 232px;
  --unten-hoehe: 64px;
  --schrift: Inter, "SF Pro Text", "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --grund: #1D1F1D;
  --flaeche: #242624;
  --karte: #2B2D2A;
  --feld: #1F211F;
  --text: #F5F6F0;
  --text-leise: #B7BBB1;
  --linie: #42463D;
  --feld-rand: #767B6E;
  --akzent: #DFFA91;
  --akzent-leise: #384224;
  --auf-akzent: #202615;
  --deko: #5E6B36;
  --gut: #BFE596;      --gut-grund: #2E3A20;
  --schlecht: #FFA79C; --schlecht-grund: #45221E;
  --achtung: #F0CD7A;  --achtung-grund: #3D3216;
  --schatten: none;
  color-scheme: dark;
}

/* Erhöhter Kontrast (Systemeinstellung): Sekundärtext, Linien und Feldrahmen deutlich kräftiger. */
@media (prefers-contrast: more) {
  :root { --text: #000000; --text-leise: #3A3D38; --linie: #8E9186; --feld-rand: #3A3D38; }
  :root[data-theme="dark"] { --text: #FFFFFF; --text-leise: #E3E6DD; --linie: #8A8F82; --feld-rand: #C9CDC2; }
}

/* ---- Grundlagen */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--schrift); font-size: 1rem; line-height: 1.5;
  color: var(--text); background: var(--flaeche);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.25rem); line-height: 1.12; font-weight: 700; letter-spacing: -.025em; margin: 0 0 var(--a2); }
h2 { font-size: 1.3rem; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; margin: 0 0 var(--a3); }
h1, h2 { overflow-wrap: break-word; hyphens: auto; } /* lange Wörter brechen bei großer Schrift um, statt die Seite zu verbreitern */
p { margin: 0 0 var(--a4); }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .88em; background: var(--grund); border: 1px solid var(--linie); border-radius: 6px; padding: 1px 5px; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.symbol { width: 24px; height: 24px; flex: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sprung { position: absolute; left: var(--a4); top: -100px; z-index: 50; background: var(--text); color: var(--flaeche); padding: var(--a2) var(--a4); border-radius: var(--r-klein); }
.sprung:focus { top: var(--a2); }

/* ---- Seitenrahmen */
.rahmen { display: flex; min-height: 100vh; min-height: 100dvh; }
.buehne { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inhalt { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--a6) var(--a6) var(--a7); }
.fuss { font-size: .8125rem; color: var(--text-leise); padding: var(--a4) var(--a6); border-top: 1px solid var(--linie); }

.marke { display: inline-flex; align-items: baseline; text-decoration: none; font-size: min(1.35rem, 28px); letter-spacing: -.02em; line-height: 1; min-height: 44px; align-items: center; border-radius: var(--r-klein); }
.marke-rehe { font-weight: 800; }
.marke-hub { font-weight: 400; }

/* Seitenleiste (Desktop) */
.leiste {
  flex: none; width: var(--leiste-breite); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--a5); padding: var(--a5) var(--a3) var(--a4);
  background: var(--flaeche); border-right: 1px solid var(--linie);
}
.leiste .marke { padding: 0 var(--a3); }
.leiste-nav { display: grid; gap: var(--a1); }
.nav-eintrag {
  display: flex; align-items: center; gap: var(--a3); min-height: 44px; padding: var(--a2) var(--a3);
  border-radius: var(--r-feld); text-decoration: none; font-size: .9375rem; font-weight: 500; color: var(--text);
  transition: background-color var(--dauer) ease;
}
.nav-eintrag .symbol { width: 22px; height: 22px; }
.nav-eintrag:hover { background: var(--grund); }
.nav-eintrag:active { background: var(--linie); }
.nav-eintrag[aria-current] { background: var(--akzent-leise); font-weight: 650; }
.nav-extern { margin-left: auto; color: var(--text-leise); display: inline-flex; }
.nav-extern .symbol { width: 16px; height: 16px; }
.leiste-unten { margin-top: auto; display: grid; gap: var(--a3); }
.leiste-admin { border-top: 1px solid var(--linie); padding-top: var(--a3); }
.profil { display: flex; align-items: center; gap: var(--a1); padding-top: var(--a2); min-width: 0; }
.profil-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--a3); min-height: 44px; padding: var(--a1) var(--a2) var(--a1) var(--a3); border-radius: var(--r-feld); text-decoration: none; transition: background-color var(--dauer) ease; }
.profil-link:hover { background: var(--grund); }
.profil-link .profil-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.profil-text { display: grid; min-width: 0; flex: 1; }
.profil-name { font-weight: 650; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profil-zusatz { font-size: .8125rem; color: var(--text-leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--akzent); color: var(--auf-akzent); display: grid; place-items: center; font-weight: 700; font-size: .8125rem; letter-spacing: .02em; }
.symbolknopf { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-feld); color: var(--text-leise); transition: background-color var(--dauer) ease, color var(--dauer) ease; }
.symbolknopf .symbol { width: 20px; height: 20px; }
.symbolknopf:hover { background: var(--grund); color: var(--text); }

/* Kopfzeile */
.oben { display: flex; align-items: center; gap: var(--a4); min-height: 60px; padding: var(--a2) var(--a6); border-bottom: 1px solid var(--linie); }
.oben-marke { display: none; }
.oben-rechts { margin-left: auto; display: flex; align-items: center; gap: var(--a2); }
.pfad { display: flex; align-items: center; gap: var(--a2); font-size: .875rem; color: var(--text-leise); min-width: 0; }
.pfad a { text-decoration: none; padding: var(--a3) 0; }
.pfad a:hover { color: var(--text); text-decoration: underline; }
.pfad strong { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfad-trenner { color: var(--feld-rand); }

/* Profilmenü (nur in der mobilen Kopfzeile) */
.profilmenue { display: none; position: relative; }
.profilmenue summary { list-style: none; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.profilmenue summary::-webkit-details-marker { display: none; }
.profilmenue-inhalt { position: absolute; right: 0; top: calc(100% + var(--a1)); z-index: 30; width: min(280px, calc(100vw - 2 * var(--a4))); display: grid; gap: var(--a1); padding: var(--a4); background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r-karte); box-shadow: var(--schatten); }
.profilmenue-inhalt .knopf { margin-top: var(--a2); }
.profilmenue-inhalt .profil-zusatz { margin-bottom: var(--a2); }

/* Untere Navigation (Smartphone) */
.unten { display: none; }

/* ---- Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--a2);
  min-height: 44px; padding: var(--a2) 18px; border-radius: var(--r-feld); border: 1px solid var(--text);
  background: var(--text); color: var(--flaeche);
  font: inherit; font-weight: 650; font-size: .9375rem; text-decoration: none; cursor: pointer;
  transition: opacity var(--dauer) ease, background-color var(--dauer) ease, border-color var(--dauer) ease;
}
.knopf .symbol { width: 18px; height: 18px; }
.knopf:hover { opacity: .86; }
.knopf:active { opacity: .72; }
.knopf[disabled] { opacity: .45; cursor: not-allowed; }
.knopf-gross { min-height: 52px; padding: var(--a3) var(--a6); font-size: 1rem; }
.knopf-breit { width: 100%; }
.knopf-leise { background: transparent; color: var(--text); border-color: var(--feld-rand); }
.knopf-leise:hover { background: var(--grund); opacity: 1; }
.knopf-leise:active { background: var(--linie); opacity: 1; }
.knopf-klein { min-height: 36px; padding: var(--a1) var(--a3); font-size: .875rem; border-radius: 10px; }
.knopf-gefahr { background: transparent; color: var(--schlecht); border-color: var(--feld-rand); }
.knopf-gefahr:hover { background: var(--schlecht-grund); border-color: var(--schlecht); opacity: 1; }

/* ---- Startseite */
.held { position: relative; padding: var(--a2) 0 var(--a6); }
.held-linien { position: absolute; right: calc(-1 * var(--a6)); top: calc(-1 * var(--a6)); width: min(46%, 420px); height: auto; pointer-events: none; }
.held-linien path { fill: none; stroke: var(--deko); stroke-width: 1; vector-effect: non-scaling-stroke; }
.held-gruss { position: relative; font-size: 1.125rem; margin: 0 0 var(--a1); }
.held-titel { position: relative; font-size: clamp(1.75rem, 1rem + 3.4vw, 3.1rem); font-weight: 750; letter-spacing: -.035em; line-height: 1.06; margin: 0 0 var(--a5); }
.suche { position: relative; display: block; }
.suche .symbol { position: absolute; left: var(--a4); top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-leise); pointer-events: none; }
.suche input[type=search] { padding-left: 46px; min-height: 48px; background: var(--flaeche); border-color: var(--feld-rand); }

.abschnitt-kopf { display: flex; align-items: center; flex-wrap: wrap; gap: var(--a2) var(--a5); margin-bottom: var(--a4); }
.filter { display: flex; gap: var(--a2); }
.pille { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--a4); border: 1px solid var(--linie); border-radius: var(--r-pille); background: var(--karte); color: var(--text); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background-color var(--dauer) ease, border-color var(--dauer) ease; }
.pille:hover { border-color: var(--feld-rand); }
.pille[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.abstand-oben { margin-top: var(--a6); }
.abschnitt-kopf h2 { margin: 0; }
.module { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--a4); }
.modul {
  display: flex; align-items: center; gap: var(--a5); min-height: 88px; padding: var(--a4) var(--a5);
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r-karte);
  color: inherit; text-decoration: none;
  transition: background-color var(--dauer) ease, border-color var(--dauer) ease;
}
a.modul:hover { background: var(--akzent-leise); border-color: var(--feld-rand); }
a.modul:active { border-color: var(--text); }
.modul-symbol { flex: none; display: grid; place-items: center; align-self: stretch; padding-right: var(--a5); border-right: 1px solid var(--linie); }
.modul-symbol .symbol { width: 32px; height: 32px; }
.modul-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.modul-titel { font-weight: 700; font-size: 1.125rem; letter-spacing: -.015em; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.modul-beschreibung { color: var(--text-leise); font-size: .9375rem; line-height: 1.4; }
.modul-status { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--text-leise); margin-top: 2px; }
.modul-status .symbol { width: 14px; height: 14px; }
.modul-pfeil { flex: none; display: inline-flex; color: var(--text); transition: transform var(--dauer) ease; }
.modul-pfeil .symbol { width: 20px; height: 20px; }
a.modul:hover .modul-pfeil { transform: translateX(3px); }
.modul-geplant { background: transparent; border-style: dashed; }
.modul-geplant .modul-symbol, .modul-geplant .modul-titel { color: var(--text-leise); }
.modul-breit { grid-column: 1 / -1; }
.leer { color: var(--text-leise); padding: var(--a3) 0; margin: 0; }

/* ---- Unterseiten: Seitentitel, Karten, Formulare */
.seitenkopf { margin-bottom: var(--a5); }
.seitenkopf p { color: var(--text-leise); margin: 0; max-width: 60ch; }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--r-karte); padding: var(--a5); margin-bottom: var(--a4); }
.karte > :last-child { margin-bottom: 0; }
.schmal { max-width: 640px; }
.hinweis { color: var(--text-leise); font-size: .875rem; font-weight: 400; }
.formular { display: grid; gap: var(--a4); }
.formular label, .feldname { display: grid; gap: 6px; font-weight: 600; font-size: .875rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: var(--a3); }
legend { font-weight: 650; padding: 0; margin-bottom: var(--a2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px var(--a3); font: inherit; font-size: 1rem; font-weight: 400; color: var(--text);
  background: var(--feld); border: 1px solid var(--feld-rand); border-radius: var(--r-feld);
  transition: border-color var(--dauer) ease, box-shadow var(--dauer) ease;
}
input::placeholder, textarea::placeholder { color: var(--text-leise); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--text); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; border-color: var(--text); }
/* iPhone: Datumsfelder haben in Safari eine eigene Mindestbreite und ragen sonst aus ihrer Spalte heraus. */
input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; min-height: 1.5em; }
.formular label, .formular fieldset, .zwei > *, .zeile > * { min-width: 0; }
input, select, textarea { max-width: 100%; }
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .875rem; }
input[readonly] { background: var(--grund); color: var(--text-leise); border-color: var(--linie); }
input[type=checkbox], input[type=radio] { accent-color: var(--text); }
/* Zwei Felder nebeneinander, solange jedes mindestens 8,5rem breit bleibt; bei großer Schrift untereinander. */
.zwei { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: var(--a3); }
.zwei input, .zeile input, .zeile select { min-width: 0; }
.haken { display: flex !important; align-items: flex-start; gap: var(--a3); font-weight: 400 !important; font-size: .9375rem !important; }
.haken input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }
.auswahl { display: grid; grid-template-columns: 1fr 1fr; gap: var(--a2); }
.auswahl label { display: flex; align-items: center; justify-content: center; gap: var(--a2); min-height: 48px; border: 1px solid var(--feld-rand); border-radius: var(--r-feld); cursor: pointer; background: var(--feld); font-weight: 600; font-size: .9375rem; transition: background-color var(--dauer) ease, border-color var(--dauer) ease; }
.auswahl label:hover { border-color: var(--text); }
.auswahl label:has(input:checked) { background: var(--akzent-leise); border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.auswahl label:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.auswahl-drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wahlknopf { display: flex; align-items: center; justify-content: center; gap: var(--a2); min-height: 48px; padding: var(--a1) var(--a2); border: 1px solid var(--feld-rand); border-radius: var(--r-feld); background: var(--feld); color: var(--text); font: inherit; font-size: .9375rem; font-weight: 600; cursor: pointer; transition: background-color var(--dauer) ease, border-color var(--dauer) ease; }
.wahlknopf .symbol { width: 18px; height: 18px; }
.wahlknopf:hover { border-color: var(--text); }
.wahlknopf[aria-pressed="true"] { background: var(--akzent-leise); border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.angaben { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--a2) var(--a5); margin: 0 0 var(--a4); }
.angaben dt { color: var(--text-leise); font-size: .875rem; }
.angaben dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.hakenliste { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: var(--a2) var(--a4); }
.hakenliste-lang { max-height: 18rem; overflow-y: auto; padding: var(--a3); border: 1px solid var(--linie); border-radius: var(--r-feld); background: var(--flaeche); }
.hakenliste .haken { min-height: 32px; align-items: center; }
.hakenliste .haken input { margin: 0; }
.gruppe-kopf { display: grid; gap: 2px; padding: var(--a1) 0; }
.gruppe-loeschen { margin-top: var(--a4); }
.knopfzeile { display: flex; gap: var(--a2); flex-wrap: wrap; }

/* ---- Meldungen (Farbe + Text, nie Farbe allein) */
.meldung { padding: var(--a3) var(--a4); border-radius: var(--r-feld); margin-bottom: var(--a4); background: var(--gut-grund); color: var(--gut); border: 1px solid currentColor; font-size: .9375rem; font-weight: 500; overflow-wrap: anywhere; }
.meldung-fehler { background: var(--schlecht-grund); color: var(--schlecht); }
.meldung-achtung { background: var(--achtung-grund); color: var(--achtung); }
.datenschutz { font-size: .875rem; background: var(--grund); border: 1px solid var(--linie); border-radius: var(--r-feld); padding: var(--a4); }
.datenschutz strong { display: block; margin-bottom: var(--a1); }
.datenschutz strong.im-text { display: inline; }
.datenschutz ul { margin: 0; padding-left: 18px; color: var(--text-leise); display: grid; gap: var(--a1); }
.datenschutz .haken { margin-bottom: var(--a3); }

/* ---- Krankmeldung */
.abschnitt { border-top: 1px solid var(--linie); padding-top: var(--a4); }
.upload { border: 1.5px dashed var(--feld-rand); border-radius: var(--r-karte); padding: var(--a4); text-align: center; display: grid; gap: var(--a3); background: var(--flaeche); }
.upload-knoepfe { display: flex; gap: var(--a2); justify-content: center; flex-wrap: wrap; }
.upload-datei { display: flex; align-items: center; justify-content: space-between; gap: var(--a3); text-align: left; background: var(--grund); border-radius: var(--r-feld); padding: var(--a2) var(--a3); font-size: .875rem; overflow-wrap: anywhere; }
.upload-vorschau { max-width: 100%; max-height: 220px; border-radius: var(--r-feld); border: 1px solid var(--linie); justify-self: center; }
.upload .meldung { margin: 0; text-align: left; }
.balken { height: 6px; background: var(--linie); border-radius: 3px; overflow: hidden; margin-bottom: var(--a2); }
.balken-wert { height: 100%; width: 35%; background: var(--text); border-radius: 3px; }
.balken-laeuft { animation: balken 1.2s ease-in-out infinite alternate; }
@keyframes balken { from { margin-left: 0; } to { margin-left: 65%; } }
.erfolg { text-align: center; padding: var(--a6) var(--a5); }
.erfolg-zeichen { width: 64px; height: 64px; border-radius: 50%; background: var(--akzent); color: var(--auf-akzent); display: grid; place-items: center; margin: 0 auto var(--a4); }
.erfolg-zeichen .symbol { width: 30px; height: 30px; stroke-width: 2; }
.meldung-fuer { margin: 0; color: var(--text-leise); }
.meldung-fuer strong { color: var(--text); font-weight: 650; }
.empfaenger-zeile { font-size: .8125rem; color: var(--text-leise); text-align: center; margin: 0; overflow-wrap: anywhere; }
.empfaenger-zeile strong { color: var(--text); font-weight: 600; }

/* ---- Verwaltung */
.reiter { display: flex; gap: var(--a2); flex-wrap: wrap; margin-bottom: var(--a5); }
.reiter a { display: inline-flex; align-items: center; min-height: 40px; padding: var(--a1) var(--a4); border: 1px solid var(--linie); border-radius: var(--r-pille); text-decoration: none; font-size: .875rem; font-weight: 600; white-space: nowrap; background: var(--karte); transition: background-color var(--dauer) ease, border-color var(--dauer) ease; }
.reiter a:hover { border-color: var(--feld-rand); background: var(--grund); }
.reiter a[aria-current] { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.tabelle-rahmen { overflow-x: auto; margin-bottom: var(--a4); }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th { text-align: left; font-size: .8125rem; font-weight: 600; color: var(--text-leise); padding: var(--a2) var(--a3); border-bottom: 1px solid var(--linie); white-space: nowrap; }
td { padding: var(--a3); border-bottom: 1px solid var(--linie); vertical-align: middle; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
td.aktion { text-align: right; white-space: nowrap; }
td.aktion form { display: inline; }
.zeile { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--a3); align-items: end; }
.abzeichen { display: inline-block; font-size: .8125rem; font-weight: 500; padding: 2px 10px; border-radius: var(--r-pille); background: var(--grund); border: 1px solid var(--linie); white-space: nowrap; }
.abzeichen-gut { background: var(--gut-grund); color: var(--gut); border-color: transparent; }
.abzeichen-schlecht { background: var(--schlecht-grund); color: var(--schlecht); border-color: transparent; }
details summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; border-radius: var(--r-klein); }
details[open] > summary { margin-bottom: var(--a3); }

/* ---- Anmeldeseite und Seiten ohne Anmeldung */
body.gast { background: var(--grund); }
body.gast .oben { border-bottom: 0; }
body.gast .oben-marke { display: block; }
body.gast .inhalt { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 560px; }
body.gast .inhalt > * { width: 100%; }
body.gast .fuss { border-top: 0; text-align: center; }
.anmeldung { text-align: center; padding: var(--a7) var(--a5); box-shadow: var(--schatten); }
.anmeldung .marke-gross { font-size: 2.5rem; letter-spacing: -.03em; line-height: 1; margin-bottom: var(--a4); }
.anmeldung-text { color: var(--text-leise); margin-bottom: var(--a6); }

/* ---- Tablet und Smartphone: Seitenleiste weicht Kopfzeile + unterer Navigation */
@media (max-width: 899px) {
  .leiste, .pfad { display: none; }
  .oben-marke { display: block; }
  .oben { padding: var(--a1) var(--a4); min-height: 56px; position: sticky; top: 0; z-index: 20; background: var(--flaeche); }
  .angemeldet .profilmenue { display: block; }
  .inhalt { padding: var(--a5) var(--a4) var(--a6); }
  .fuss { padding: var(--a4); }
  .angemeldet .buehne { padding-bottom: calc(var(--unten-hoehe) + env(safe-area-inset-bottom, 0px)); }
  .unten {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px max(var(--a1), env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(var(--a1), env(safe-area-inset-right, 0px));
    background: var(--flaeche); border-top: 1px solid var(--linie);
  }
  .unten-eintrag { flex: 1 1 auto; min-width: 0; padding: 0 2px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--r-feld); text-decoration: none; font-size: clamp(11px, .6875rem, 12px); letter-spacing: -.01em; font-weight: 600; color: var(--text-leise); transition: background-color var(--dauer) ease; }
  .unten-eintrag span:not(.unsichtbar) { white-space: nowrap; }
  .unten-eintrag .symbol { width: 22px; height: 22px; }
  .unten-eintrag:active { background: var(--grund); }
  .unten-eintrag[aria-current] { background: var(--akzent-leise); color: var(--text); }
  .held-linien { right: calc(-1 * var(--a4)); top: calc(-1 * var(--a5)); width: 52%; }
  .reiter { flex-wrap: nowrap; overflow-x: auto; margin-left: calc(-1 * var(--a4)); margin-right: calc(-1 * var(--a4)); padding: 2px var(--a4) var(--a2); scrollbar-width: none; }
  .reiter::-webkit-scrollbar { display: none; }
  .reiter a, .pille { min-height: 44px; }
}

/* Tabellen auf schmalen Bildschirmen als gestapelte Einträge */
@media (max-width: 640px) {
  .karte { padding: var(--a4); }
  .tabelle-rahmen { overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { padding: var(--a3) 0; border-bottom: 1px solid var(--linie); }
  tr:last-child { border-bottom: 0; }
  td, td:first-child, td:last-child { padding: var(--a1) 0; border: 0; }
  td[data-th]::before { content: attr(data-th); display: block; font-size: .8125rem; color: var(--text-leise); }
  td.aktion { text-align: left; white-space: normal; display: flex; flex-wrap: wrap; gap: var(--a2); padding-top: var(--a2); }
  td.aktion .knopf { min-height: 44px; }
  .knopf-klein { min-height: 44px; }
}

/* Smartphone: kompakte Modulkarten in zwei Spalten, Symbol oben.
   Grenzen in em, damit bei vergrößerter Schrift früher auf eine Spalte gewechselt wird. */
@media (max-width: 35em) {
  /* Zwei Spalten nur, solange jede Karte mindestens 9,5rem breit bleibt – bei großer Schrift oder sehr schmalem Display eine Spalte. */
  .module { gap: var(--a3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
  .modul:not(.modul-breit) { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: var(--a3) var(--a2); padding: var(--a4); min-height: 0; }
  .modul:not(.modul-breit) .modul-symbol { justify-self: start; padding: 0; border: 0; }
  .modul:not(.modul-breit) .modul-symbol .symbol { width: 28px; height: 28px; }
  .modul:not(.modul-breit) .modul-symbol { grid-area: 1 / 1; }
  .modul:not(.modul-breit) .modul-pfeil { grid-area: 1 / 2; padding-top: var(--a1); }
  .modul:not(.modul-breit) .modul-text { grid-area: 2 / 1 / 3 / -1; }
  .modul-titel { font-size: 1rem; }
  .modul-beschreibung { font-size: .8125rem; }
  .modul-breit { gap: var(--a4); padding: var(--a4); min-height: 72px; }
  .modul-breit .modul-symbol { padding-right: var(--a4); }
  .modul-breit .modul-symbol .symbol { width: 28px; height: 28px; }
  .held-gruss { font-size: 1rem; }
  .zwei-stapel { grid-template-columns: 1fr; }
}
@media (max-width: 21em) {
  .zwei { grid-template-columns: 1fr; }
  .auswahl-drei { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  a.modul:hover .modul-pfeil { transform: none; }
  .balken-laeuft { animation: none; width: 100%; opacity: .6; }
}
