:root {
  --bg: #f5f6f8;
  --karte: #ffffff;
  --text: #1d2330;
  --dezent: #6b7280;
  --linie: #e3e6eb;
  --akzent: #2f5d8a;
  --fehler: #b42318;
  --heute: #eef4fb;
  --regulaer: #dbe7f3;  --regulaer-rand: #2f5d8a;
  --zusatz: #dcefe3;    --zusatz-rand: #1f7a4a;
  --sonder: #fde8cf;    --sonder-rand: #c2650a;
  --ersatz: #ebe3f6;    --ersatz-rand: #6b46a8;
  --ueber: #d9f0ef;     --ueber-rand: #0f766e;
  --gestrichen: #eef0f3;
  --warn-bg: #fdecea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --karte: #1d2128;
    --text: #e6e8eb;
    --dezent: #9aa1ab;
    --linie: #2e333c;
    --akzent: #7fb0e0;
    --fehler: #f97066;
    --heute: #1c2633;
    --regulaer: #1f3550;  --regulaer-rand: #7fb0e0;
    --zusatz: #1c3a2b;    --zusatz-rand: #6fcf97;
    --sonder: #45301a;    --sonder-rand: #f2a65a;
    --ersatz: #332848;    --ersatz-rand: #b49be6;
    --ueber: #173a38;     --ueber-rand: #5eead4;
    --gestrichen: #23272e;
    --warn-bg: #3a1f1d;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1 { margin: 0 0 .5rem; font-size: 1.6rem; }
h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
a { color: var(--akzent); }


.karte {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1rem;
  overflow-x: auto;
}
.karte.schmal { max-width: 380px; margin: 3rem auto; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 560px; }
.versammlungsliste th:nth-child(-n+2) { width: 25%; }
/* Benutzerliste: Avatar wie im Kontomenü, gesperrte Konten blass. */
.benutzerliste th:first-child { width: 40%; }
.benutzerliste td:first-child { display: flex; align-items: center; gap: .6rem; }
.benutzerliste tr.gesperrt td:not(.zeilenaktionen) { opacity: .55; }
.marke-gesperrt {
  margin-left: .35rem; padding: .05rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  color: var(--fehler); background: color-mix(in srgb, var(--fehler) 10%, transparent);
}
.zeilenaktionen .loeschen { color: var(--fehler); }
.anfrage-aktionen .loeschen { color: var(--fehler); }
.raumliste th:first-child { width: 50%; }
.formular.schmal-formular { max-width: 520px; }
.raum-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.raum-chips span { padding: .25rem .7rem; border: 1px solid var(--linie); border-radius: 999px; font-size: .85rem; color: var(--dezent); }
/* Feld, das für die gewählte Option nicht gebraucht wird (z. B. Versammlung bei Gästen). */
.nebensache { opacity: .5; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .85rem; color: var(--dezent); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.dezent { color: var(--dezent); font-weight: normal; font-size: .9em; }
.hinweis { color: var(--dezent); margin-bottom: 1.25rem; }
.fehler { color: var(--fehler); }

label { display: block; margin-bottom: .75rem; font-size: .9rem; }
input[type=text], input[type=password] {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--linie); border-radius: 6px;
}
button {
  font: inherit; padding: .5rem 1rem; border: 0; border-radius: 6px;
  background: var(--akzent); color: #fff; cursor: pointer;
}
button.link { background: none; color: var(--akzent); padding: 0; text-decoration: underline; }

/* ---------- Wochen-Navigation ---------- */
.wochennav { margin-bottom: 1rem; }
.reiter { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .75rem; }
.reiter a {
  padding: .35rem .8rem; border-radius: 999px; text-decoration: none;
  color: var(--text); border: 1px solid var(--linie); background: var(--karte); font-size: .9rem;
}
.reiter a[aria-current="page"] { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.wochenwahl { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.wochenwahl .woche { display: flex; align-items: center; gap: .5rem 1rem; }
.woche .kw {
  display: flex; flex-direction: column; line-height: 1.2; min-width: 9.5rem; text-align: center;
  color: var(--text); text-decoration: none; padding: .3rem .9rem;
}
.woche .kw:hover { border-color: var(--akzent); }
.woche .kw .zurueck { color: var(--akzent); }
.werkzeuge { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-left: auto; }
.knopf {
  display: inline-block; padding: .35rem .75rem; border-radius: 6px; text-decoration: none;
  border: 1px solid var(--linie); background: var(--karte); color: var(--text);
}
select {
  font: inherit; padding: .35rem .5rem; color: var(--text); background: var(--karte);
  border: 1px solid var(--linie); border-radius: 6px;
}
.warnung {
  margin: .75rem 0 0; padding: .5rem .75rem; border-radius: 6px;
  background: var(--warn-bg); color: var(--fehler); font-size: .9rem;
}

/* ---------- Belegungs-Einträge ---------- */
.eintrag {
  border-left: 3px solid var(--regulaer-rand); background: var(--regulaer);
  border-radius: 4px; padding: .2rem .4rem; margin-bottom: .25rem;
  font-size: .78rem; line-height: 1.25; overflow: hidden;
}
.eintrag .zeit { display: block; color: var(--dezent); font-variant-numeric: tabular-nums; }
.eintrag .titel { display: block; font-weight: 600; }
.eintrag .status { display: block; font-size: .7rem; color: var(--dezent); }
.art-zusatz { background: var(--zusatz); border-left-color: var(--zusatz-rand); }
.art-sonder { background: var(--sonder); border-left-color: var(--sonder-rand); }
.art-ersatz { background: var(--ersatz); border-left-color: var(--ersatz-rand); }
.art-ueber { background: var(--ueber); border-left-color: var(--ueber-rand); }
.eintrag.verdraengt, .eintrag.verlegt {
  background: var(--gestrichen); border-left-color: var(--dezent); opacity: .75;
}
.eintrag.verdraengt .titel, .eintrag.verlegt .titel { text-decoration: line-through; font-weight: normal; }
.eintrag.konflikt { outline: 2px solid var(--fehler); outline-offset: -2px; }
.eintrag.markiert { box-shadow: 0 0 0 2px var(--text); }
.eintrag.gedimmt:not(.konflikt) { opacity: .35; }

.legende {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; list-style: none;
  padding: 0; margin: .5rem 0 0; font-size: .85rem; color: var(--dezent);
}
.legende li { display: flex; align-items: center; gap: .4rem; }
.muster {
  display: inline-block; width: 1.1rem; height: .8rem; border-radius: 2px;
  background: var(--regulaer); border-left: 3px solid var(--regulaer-rand);
}
.muster.art-zusatz { background: var(--zusatz); border-left-color: var(--zusatz-rand); }
.muster.art-sonder { background: var(--sonder); border-left-color: var(--sonder-rand); }
.muster.art-ersatz { background: var(--ersatz); border-left-color: var(--ersatz-rand); }
.muster.art-ueber { background: var(--ueber); border-left-color: var(--ueber-rand); }
.muster.verdraengt { background: var(--gestrichen); border-left-color: var(--dezent); }
.muster.konflikt { background: transparent; border: 2px solid var(--fehler); }

/* ---------- Gesamtübersicht ---------- */
.raster-karte { padding: 0; }
.wochenraster { min-width: 900px; table-layout: fixed; }
.wochenraster th, .wochenraster td { padding: .35rem; border-right: 1px solid var(--linie); }
.wochenraster .raumspalte { width: 8rem; position: sticky; left: 0; background: var(--karte); z-index: 1; }
.wochenraster .raumspalte a { color: var(--text); text-decoration: none; }
.wochenraster tr.hauptsaal td, .wochenraster tr.hauptsaal th { border-bottom-style: dashed; }
.wochenraster tr.nebensaal th.raumspalte { font-weight: normal; color: var(--dezent); }
.wochenraster tr.nebensaal td, .wochenraster tr.nebensaal th { border-bottom: 2px solid var(--linie); }
.wochenraster thead th.heute, .zeitraster .heute { background: var(--heute); }
.wochenraster tbody tr:last-child td, .wochenraster tbody tr:last-child th { border-bottom: 0; }
.wochenraster tr.trenner th, .wochenraster tr.trenner td {
  background: var(--bg); padding: .5rem .35rem .3rem; font-size: .85rem; color: var(--dezent);
  border-top: 2px solid var(--linie);
}
.wochenraster tr.weiterer td, .wochenraster tr.weiterer th { border-bottom: 1px solid var(--linie); }

/* ---------- Saal-Ansicht (Zeitraster) ---------- */
.zeitraster { min-width: max(860px, calc(var(--spuren, 2) * 7 * 60px + 3.25rem)); }
.zeitraster .kopfzeile, .zeitraster .koerper {
  display: grid; grid-template-columns: 3.25rem repeat(7, 1fr);
}
.zeitraster .kopfzeile { border-bottom: 1px solid var(--linie); }
.tagkopf { padding: .4rem .25rem .25rem; text-align: center; font-size: .9rem; border-left: 1px solid var(--linie); }
.raumkoepfe { display: grid; grid-template-columns: repeat(var(--spuren, 2), minmax(0, 1fr)); font-size: .7rem; color: var(--dezent); margin-top: .15rem; }
.raumkoepfe span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.zeitraster .koerper { position: relative; }
.zeitraster .koerper .achse { position: relative; }
.stunde { position: absolute; right: .4rem; transform: translateY(-50%); font-size: .7rem; color: var(--dezent); }
.stunde:first-child { transform: none; }
.zeitraster .tag {
  position: relative; display: grid; grid-template-columns: repeat(var(--spuren, 2), minmax(0, 1fr));
  border-left: 1px solid var(--linie);
}
.zeitraster .linie { position: absolute; left: 0; right: 0; border-top: 1px solid var(--linie); }
.raumspur { position: relative; }
.raumspur.folgespur { border-left: 1px dashed var(--linie); }
.raumspur .eintrag {
  position: absolute; margin: 0; z-index: 1;
  padding: .15rem .25rem; font-size: .7rem;
  border-right: 1px solid var(--karte);
}
.raumspur .eintrag .status { display: none; }
.raumspur .eintrag .zeit, .raumspur .eintrag .titel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 640px) {
  main { padding: 1rem 1rem 2rem; }
  .wochenraster .raumspalte { width: 5.5rem; font-size: .8rem; }
}

/* ---------- Formulare & Bearbeiten ---------- */
.titelzeile { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.titelzeile h1 { margin: 0; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.meldung {
  padding: .5rem .75rem; border-radius: 6px; margin: 0 0 1rem;
  background: var(--zusatz); border-left: 3px solid var(--zusatz-rand);
  transition: opacity .6s;
}
.meldung.weg { opacity: 0; }
a.eintrag { display: block; color: inherit; text-decoration: none; }
a.eintrag:hover { filter: brightness(.96); outline: 1px solid var(--akzent); }
.wochenraster td { position: relative; padding-bottom: 1.4rem; }
.wochenraster a.neu {
  position: absolute; left: .35rem; right: .35rem; bottom: .2rem;
  text-align: center; text-decoration: none; color: var(--dezent);
  border: 1px dashed transparent; border-radius: 4px; line-height: 1.1rem; font-size: .9rem;
}
.wochenraster td:hover a.neu, .wochenraster a.neu:focus { border-color: var(--linie); color: var(--akzent); }

.formular { max-width: 880px; }
.feldraster { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1.25rem; }
.feld { margin-bottom: .75rem; }
.feld.breit { grid-column: 1 / -1; }
.feld label, .feld legend { display: block; font-size: .85rem; color: var(--dezent); margin-bottom: .25rem; }
.feld input[type=text], .feld input[type=number], .feld input[type=date], .feld input[type=time],
.feld input[type=email], .feld input[type=password], .feld select, .feld textarea {
  width: 100%; padding: .45rem .6rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--linie); border-radius: 6px;
}
.feld.zeiten { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
/* Springt der Browser zu einem Feld (Pflichtfeld leer, Fehler), bleibt es frei von Kopfzeile und Knopfleiste. */
input, select, textarea, .feld, fieldset { scroll-margin: 5rem 0 8rem; }
.fehlt { outline: 2px solid var(--akzent); outline-offset: .4rem; border-radius: 8px; }
.fehlt input, .fehlt textarea, .fehlt select { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent); }
.fehlt-hinweis { display: block; color: var(--fehler); font-size: .85rem; margin-top: .25rem; }
.feld .errorlist, .fehler ul { color: var(--fehler); list-style: none; padding: 0; margin: .25rem 0 0; font-size: .85rem; }
.feld ul:not(.errorlist) { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
/* Räume: Saal n jeweils über Nebensaal n */
.raumwahl.kompakt > div, .raumgruppe.saele {
  display: grid; grid-template-rows: auto auto; grid-auto-flow: column;
  grid-auto-columns: max-content; gap: .3rem 1rem; overflow-x: auto;
}
.feld ul:not(.errorlist) label, .raumwahl > div label { display: flex; gap: .35rem; align-items: center; color: var(--text); font-size: .95rem; margin: 0; }
fieldset.raumwahl { border: 0; padding: 0; }
.raumwahl > div > div { display: contents; }
.raumwahl.kompakt label { font-size: .85rem !important; }
.aktionen { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 1rem; }
.aktionen .loeschen { margin-left: auto; color: var(--fehler); }
/* Feste Knopfleiste am unteren Bildrand (Versammlung bearbeiten); die Karte darf dafür nicht selbst scrollen. */
.karte.mit-leiste { overflow: visible; }
.aktionen.leiste {
  position: sticky; bottom: 0; z-index: 5;
  margin: 1rem -1.25rem -1rem; padding: .75rem 1.25rem;
  background: var(--karte); border-top: 1px solid var(--linie); border-radius: 0 0 10px 10px;
  box-shadow: 0 -6px 12px -8px rgb(0 0 0 / .2);
}
.karte.mit-leiste fieldset.termin { scroll-margin-bottom: 6rem; }
.warnkasten {
  background: var(--warn-bg); border: 1px solid var(--fehler); border-radius: 8px;
  padding: .75rem 1rem; margin-bottom: 1.25rem;
}
.warnkasten h2 { color: var(--fehler); font-size: 1.05rem; }
.warnkasten ul { margin: .25rem 0 .75rem; padding-left: 1.25rem; }
button.warnknopf { background: var(--fehler); }
fieldset.termin {
  display: grid; grid-template-columns: 10rem 8rem 8rem 1fr; gap: .75rem 1rem; align-items: start;
  border: 1px solid var(--linie); border-radius: 8px; padding: .75rem; margin: 0 0 .75rem;
}
fieldset.termin .feld { margin: 0; }
fieldset.termin .raumwahl { grid-column: 1 / -1; grid-row: 2; }
fieldset.termin .entfernen { justify-self: end; align-self: center; }
.entfernen { display: flex; gap: .35rem; align-items: center; font-size: .85rem; color: var(--dezent); margin: 0; }

@media (max-width: 640px) {
  .feldraster { grid-template-columns: 1fr; }
  fieldset.termin { grid-template-columns: 1fr 1fr; }
}

/* ---------- Ersatz ---------- */
.meldung.warning { background: var(--sonder); border-left-color: var(--sonder-rand); }
.karte.offen { border-left: 3px solid var(--sonder-rand); }
.karte.offen h2 { font-size: 1rem; margin-bottom: .5rem; }
.karte.offen ul { list-style: none; padding: 0; margin: 0; }
.karte.offen li {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  padding: .4rem 0; border-top: 1px solid var(--linie);
}
.karte.offen li:first-child { border-top: 0; }
.vorschlaege { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.vorschlaege form {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  padding: .6rem .75rem; margin-bottom: .5rem;
  border: 1px solid var(--linie); border-radius: 8px; background: var(--bg);
}
.vorschlag-text { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: baseline; }
.marke-klein {
  display: inline-block; font-size: .7rem; font-weight: 600; padding: .05rem .4rem; margin-left: .25rem;
  border-radius: 999px; background: var(--zusatz); color: var(--zusatz-rand); vertical-align: middle;
}

/* ---------- Weitere Räume ---------- */
.raumgruppe > div label, .raumwahl.kompakt label { display: flex; gap: .35rem; align-items: center; color: var(--text); font-size: .95rem; margin: 0; }
.raumgruppe.weitere { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; }
.raumgruppe-titel { font-size: .8rem; color: var(--dezent); margin: .6rem 0 .25rem; }

/* ---------- Versammlungsfarben ---------- */
/* --vf wird pro Eintrag gesetzt; heller Farbton als Fläche, volle Farbe als Rand. */
.eintrag.vfarbe:not(.verdraengt):not(.verlegt),
.muster.vfarbe {
  background-color: color-mix(in srgb, var(--vf) 24%, var(--karte));
  border-left-color: var(--vf);
}
.eintrag.vfarbe.art-zusatz:not(.verdraengt):not(.verlegt),
.eintrag.vfarbe.art-ersatz:not(.verdraengt):not(.verlegt),
.muster.vfarbe.art-zusatz {
  background-image: repeating-linear-gradient(
    135deg, transparent 0 6px, color-mix(in srgb, var(--karte) 55%, transparent) 6px 10px
  );
}
.versammlungsfarben { margin-top: .35rem; }
.farbpunkt {
  display: inline-block; width: .8rem; height: .8rem; border-radius: 50%;
  margin-right: .4rem; vertical-align: -1px;
}
.knopfgruppe { display: flex; flex-wrap: wrap; gap: .5rem; }
input.farbwahl {
  width: 3.25rem; height: 2.25rem; padding: 2px; cursor: pointer;
  border: 1px solid var(--linie); border-radius: 6px; background: var(--karte);
}
.farbvorschau { width: 11rem; margin: 0; }
.farbtabelle td { vertical-align: middle; }

/* ---------- Auswahl mehrerer Versammlungen ---------- */
.auswahl { position: relative; }
.auswahl summary { list-style: none; cursor: pointer; user-select: none; }
.auswahl summary::-webkit-details-marker { display: none; }
.auswahl summary::after { content: " ▾"; color: var(--dezent); }
.auswahl[open] summary::after { content: " ▴"; }
.auswahl-panel {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20;
  width: min(30rem, calc(100vw - 2rem)); padding: .75rem;
  background: var(--karte); border: 1px solid var(--linie); border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .15);
}
.auswahl-liste {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: .2rem .75rem; max-height: 50vh; overflow-y: auto; margin-bottom: .6rem;
}
/* In der Filterkarte scrollt nur die Liste; Modus und „Fertig“ bleiben sichtbar. */
.filterkarte .auswahl-liste { flex: 0 1 auto; min-height: 5rem; max-height: none; overscroll-behavior: contain; }
.auswahl-liste label, .auswahl-modus label {
  display: flex; align-items: center; gap: .4rem; margin: 0; font-size: .9rem; cursor: pointer;
}
.auswahl-liste .farbpunkt { margin-right: 0; flex: none; }
.auswahl-modus { border: 0; border-top: 1px solid var(--linie); padding: .5rem 0 0; margin: 0 0 .6rem; display: grid; gap: .2rem; }
@media (max-width: 640px) {
  .auswahl-panel { left: 0; right: auto; }
}

/* ---------- Serien und mehrtägige Termine ---------- */
.eintrag .serie { font-weight: 600; color: var(--text); }
.serienhinweis { color: var(--akzent); }
.abschnitt { border-top: 1px solid var(--linie); padding-top: .75rem; }
.abschnitt[hidden] { display: none; }
.schalter { display: flex !important; gap: .4rem; align-items: center; color: var(--text) !important; font-size: .95rem !important; }
.unterfelder { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1.25rem; margin-top: .5rem; }
.unterfelder[hidden], .unterfelder [hidden] { display: none; }
.feld.radios div { display: grid; gap: .2rem; }
.feld.radios label { display: flex; gap: .4rem; align-items: center; color: var(--text); font-size: .9rem; margin: 0; }
fieldset.umfang {
  border: 1px solid var(--akzent); border-radius: 8px; padding: .6rem .9rem; margin: 0 0 1rem;
  display: flex; flex-wrap: wrap; gap: .4rem 1.25rem;
}
fieldset.umfang legend { font-size: .85rem; color: var(--dezent); padding: 0 .3rem; }
fieldset.umfang label { display: flex; gap: .35rem; align-items: center; font-size: .95rem; margin: 0; }
.probleme { list-style: none; padding: 0; margin: .25rem 0 .75rem; max-height: 18rem; overflow-y: auto; }
.probleme li { padding: .35rem 0; border-top: 1px solid var(--linie); }
.probleme label { display: flex; gap: .4rem; align-items: center; margin: 0; font-size: .95rem; }
.probleme-detail { font-size: .85rem; color: var(--dezent); margin-left: 1.5rem; }
.ausnahmen { list-style: none; padding: 0; }
.ausnahmen li { display: flex; gap: 1rem; align-items: center; padding: .2rem 0; }
.ausnahmen form { margin: 0; }
@media (max-width: 640px) { .unterfelder { grid-template-columns: 1fr; } }

/* ---------- Ziehen und Ablegen ---------- */
.eintrag[draggable="true"] { cursor: grab; }
.eintrag.wird-gezogen { opacity: .4; }
.ablage-ziel { outline: 2px dashed var(--akzent); outline-offset: -2px; background: var(--heute) !important; }
.verschiebe-dialog {
  border: 1px solid var(--linie); border-radius: 10px; padding: 1rem 1.25rem;
  max-width: min(32rem, calc(100vw - 2rem)); background: var(--karte); color: var(--text);
}
.verschiebe-dialog::backdrop { background: rgb(0 0 0 / .35); }
.verschiebe-dialog h2 { margin-top: 0; }
.verschiebe-dialog fieldset.umfang { display: grid; }
.dialog-meldung { margin: .5rem 0; }
.dialog-meldung ul { margin: .25rem 0; padding-left: 1.25rem; font-size: .9rem; }

/* ---------- Verschobene Termine ---------- */
.verschoben { font-weight: 600; color: var(--akzent); }
.herkunft {
  margin: 0 0 1rem; padding: .5rem .75rem; border-radius: 6px;
  background: var(--heute); border-left: 3px solid var(--akzent); font-size: .95rem;
}

/* ---------- Icon für Versammlungstermine und Besprechungen ---------- */
.eintrag.mit-icon { position: relative; padding-right: 1.45rem; }
.raumspur .eintrag.mit-icon { position: absolute; padding-right: 1.3rem; }
.termin-icon {
  position: absolute; top: 3px; right: 3px; width: 16px; height: 16px;
  fill: currentColor; color: var(--text); opacity: .85; pointer-events: none;
}
.vfarbe .termin-icon { color: color-mix(in srgb, var(--vf) 45%, var(--text)); opacity: 1; }
.raumspur .termin-icon { width: 14px; height: 14px; top: 2px; right: 2px; }
.termin-icon.legende-icon, .termin-icon.inline { position: static; width: 15px; height: 15px; vertical-align: -2px; }
.kennzeichnung-wahl { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; border: 0; padding: 0; margin: .6rem 0 0; }
.kennzeichnung-wahl legend { padding: 0; margin-bottom: .25rem; font-size: .9rem; color: var(--dezent); }
.kennzeichnung-wahl .termin-icon { position: static; flex: none; width: 17px; height: 17px; }

/* ---------- Datensicherung ---------- */
.hochladen { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.zeilenaktionen { white-space: nowrap; }
.zeilenaktionen a + a { margin-left: 1rem; }
.titelzeile form { margin: 0; }

/* ---------- Handy-Ansicht: Tagesliste und kompaktes Menü ---------- */
.tagesliste { display: none; }
.listentag {
  background: var(--karte); border: 1px solid var(--linie); border-radius: 10px;
  padding: .6rem .75rem; margin-bottom: .6rem;
}
.listentag.heute { border-color: var(--akzent); box-shadow: inset 3px 0 0 var(--akzent); }
.listentag h2 {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  font-size: 1rem; margin: 0 0 .4rem;
}
.heute-marke {
  font-size: .75rem; font-weight: 600; color: #fff; background: var(--akzent);
  border-radius: 999px; padding: .05rem .5rem; vertical-align: middle;
}
.listentag a.neu {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.25rem; height: 2.25rem; border: 1px solid var(--linie); border-radius: 6px;
  text-decoration: none; font-size: 1.3rem; line-height: 1; color: var(--akzent);
}
.listeneintrag { font-size: .95rem; padding: .45rem .6rem; margin-bottom: .4rem; }
.listeneintrag:last-child { margin-bottom: 0; }
.listeneintrag .orte { display: block; font-size: .85rem; color: var(--dezent); }
.listeneintrag .status { font-size: .8rem; }
.listeneintrag.mit-icon { padding-right: 1.9rem; }
.listentag .leer { margin: 0; color: var(--dezent); font-size: .9rem; }

@media (max-width: 640px) {
  .raster-karte { display: none; }
  .tagesliste { display: block; }

}

/* Termine, die der angemeldete Vertreter bearbeiten darf (bei Admins nicht, die dürfen alles). */
.eintrag.bearbeitbar:not(.konflikt) {
  outline: 2px solid color-mix(in srgb, var(--akzent) 60%, transparent); outline-offset: -2px;
}

/* ---------- Legende (Hilfeseite) ---------- */
.legende-panel .legende { flex-direction: column; gap: .35rem; margin: 0; color: var(--text); }
.legende-panel .versammlungsfarben {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--linie);
}
@media (max-width: 640px) {
  /* Panels an der Navigationszeile ausrichten, damit sie nicht über den Rand ragen. */
  .werkzeuge { position: relative; }
  .werkzeuge .auswahl { position: static; }
}
.muster.bearbeitbar {
  background: var(--karte); outline: 2px solid color-mix(in srgb, var(--akzent) 60%, transparent); outline-offset: -2px;
}

/* ---------- X zum Schließen von Eingabekarten (nur Handy) ---------- */
.karte-schliessen { display: none; }
@media (max-width: 640px) {
  .karte-schliessen {
    display: inline-flex; align-items: center; justify-content: center; float: right;
    width: 2.5rem; height: 2.5rem; margin: -.4rem -.6rem .25rem .5rem;
    border-radius: 50%; color: var(--dezent); text-decoration: none;
  }
  .karte-schliessen:active { background: var(--linie); }
  .karte-schliessen svg {
    width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
  }
}

/* ---------- Handy: Kopf der Wochen- und Saal-Ansichten ---------- */
@media (max-width: 640px) {
  .nur-desktop { display: none !important; }
  /* Gleiche Bausteine wie am Desktop, umgeordnet: Woche, Filter, Suche, zuletzt die
     Warnung. Alle Zeilen und der Übergang zu den Tageskarten haben denselben Abstand. */
  .wochennav { display: flex; flex-direction: column; margin-bottom: var(--zeilenabstand); }
  :root { --zeilenabstand: .75rem; }
  .wochenwahl { display: contents; }
  .wochenwahl .woche { order: 1; display: grid; grid-template-columns: 3.25rem 1fr 3.25rem; gap: .5rem; align-items: stretch; margin-bottom: var(--zeilenabstand); }
  .woche .pfeil {
    display: flex; align-items: center; justify-content: center;
    height: 3.5rem; padding: 0; font-size: 1.7rem; line-height: 1;
  }
  .woche .kw {
    min-width: 0; align-items: center; justify-content: center; padding: 0 .5rem;
    background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; line-height: 1.25;
  }
  .woche .kw strong { font-size: 1.3rem; }
  /* Filterknöpfe über die volle Breite, die Suche darunter. */
  .werkzeuge { order: 4; display: block; margin-left: 0; }
  .wochennav .warnung { order: 5; }
}

/* ---------- Handy: feste Wochenleiste ---------- */
.woche-leiste { display: none; }
@media (max-width: 640px) {
  .woche-leiste {
    --leiste: 4rem;  /* in wochen.js als LEISTE (64 px) */
    display: grid; grid-template-columns: 3.5rem 1fr 3.5rem; align-items: stretch;
    position: fixed; top: calc(var(--kopf) + var(--reiter, 0px)); left: 0; right: 0; z-index: 30; height: var(--leiste);
    background: var(--karte); border-bottom: 1px solid var(--linie);
    box-shadow: 0 2px 8px rgb(0 0 0 / .08);
    transform: translateY(-110%); transition: transform .2s ease-out;
  }
  body.leiste-sichtbar .woche-leiste { transform: none; }
  .woche-leiste a {
    display: flex; align-items: center; justify-content: center; margin: .45rem .35rem;
    border: 1px solid var(--linie); border-radius: 8px;
    font-size: 2rem; line-height: 1; color: var(--akzent); text-decoration: none;
  }
  .woche-leiste .mitte {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    margin: .3rem 0; border-radius: 8px; line-height: 1.2; white-space: nowrap;
  }
  .woche-leiste .mitte strong { font-size: 1.3rem; }
  .woche-leiste .mitte span { font-size: 1.1rem; color: var(--dezent); }
  .woche-leiste .mitte > div { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .woche-leiste .mitte small { font-size: .8rem; color: var(--akzent); font-weight: 600; }
  /* Nach einem Wochenwechsel weiter unten kurz aufleuchten, damit der Wechsel auffällt. */
  .woche-leiste.gewechselt .mitte { animation: kw-gewechselt 1.4s ease-out; }
  @keyframes kw-gewechselt {
    0%, 30% { background: color-mix(in srgb, var(--akzent) 22%, transparent); }
    100% { background: transparent; }
  }
}

/* ---------- Handy: „Heute“ springt zur heutigen Tageskarte ---------- */
@media (max-width: 640px) {
  /* Die Karte landet unter Menüzeile und Wochenleiste statt dahinter. */
  .listentag#heute, .sprungziel { scroll-margin-top: calc(var(--kopf) + var(--reiter, 0px) + 4rem + .5rem); }
  .listentag:has(.sprungziel:target) { animation: heute-gezeigt 1.6s ease-out; }
  .listentag#heute:target { animation: heute-gezeigt 1.6s ease-out; }
  @keyframes heute-gezeigt {
    0%, 35% { background: color-mix(in srgb, var(--akzent) 16%, var(--karte)); }
    100% { background: var(--karte); }
  }
}

/* ---------- Handy: Eingabemasken und Tabellen ---------- */
/* Fieldsets sind sonst mindestens so breit wie ihr Inhalt und sprengen die Karte. */
fieldset { min-width: 0; }

@media (max-width: 640px) {
  .karte { padding: 1rem; }
  .karte.schmal { margin: 1.5rem auto; }

  /* Gut treffbare Felder; 16 px Schrift verhindert das automatische Zoomen von iOS. */
  .feld input[type=text], .feld input[type=number], .feld input[type=date],
  .feld input[type=time], .feld input[type=email], .feld select, .feld textarea,
  input[type=text], input[type=password] {
    min-height: 2.75rem; font-size: 16px;
  }
  input[type=checkbox], input[type=radio] {
    width: 1.25rem; height: 1.25rem; margin: 0; flex: none; accent-color: var(--akzent);
  }
  .feld ul:not(.errorlist) label, .raumwahl > div label, .raumgruppe > div label,
  .raumwahl.kompakt label, .feld.radios label, fieldset.umfang label, .probleme label, .schalter {
    min-height: 2.25rem; gap: .5rem !important; font-size: 1rem !important;
  }


  /* Reguläre Termine: Wochentag, dann Beginn und Ende, dann Räume, dann „entfernen“. */
  fieldset.termin { grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
  fieldset.termin .feld.tag, fieldset.termin .raumwahl { grid-column: 1 / -1; grid-row: auto; }
  fieldset.termin .entfernen { grid-column: 1 / -1; justify-self: end; min-height: 2.25rem; }

  /* Aktionen: Hauptknopf über die volle Breite, Links darunter gut treffbar. */
  .aktionen { flex-direction: column; align-items: stretch; gap: .25rem; }
  .aktionen button { width: 100%; min-height: 2.9rem; font-size: 1rem; }
  .aktionen a { text-align: center; padding: .65rem 0; }
  .aktionen .loeschen { margin-left: 0; }
  #termin-neu { width: 100%; padding: .6rem; }
  .aktionen.leiste {
    display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .5rem;
    margin: 1rem -1rem -1rem; padding: .6rem 1rem calc(.4rem + env(safe-area-inset-bottom));
  }
  .aktionen.leiste #termin-neu, .aktionen.leiste button { min-height: 2.9rem; font-size: .95rem; padding: .4rem; }
  .aktionen.leiste a { grid-column: 1 / -1; padding: .35rem 0; }
  .karte.mit-leiste fieldset.termin { scroll-margin-bottom: 9rem; }

  /* Tabellen als gestapelte Einträge statt seitlich zu wischen. */
  table.stapel { min-width: 0; }
  table.stapel thead { display: none; }
  table.stapel tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .75rem;
    padding: .6rem 0; border-bottom: 1px solid var(--linie);
  }
  table.stapel tr:last-child { border-bottom: 0; }
  table.stapel td { display: block; padding: 0; border: 0; }
  table.stapel td.voll { flex-basis: 100%; }
  table.stapel td[data-label]::before { content: attr(data-label) ": "; color: var(--dezent); font-size: .85rem; }
  table.stapel td:empty { display: none; }
  .zeilenaktionen { display: flex !important; gap: 1.25rem; }
  .farbtabelle .farbvorschau { width: 9rem; }
}

/* Räume: je Zeile Saal n und Nebensaal n statt einer langen Zeile zum Wischen
   (Handy und Tablet hochkant). */
@media (max-width: 900px) {
  .raumwahl.kompakt > div, .raumgruppe.saele {
    grid-auto-flow: row; grid-template-rows: none; grid-template-columns: 1fr 1fr;
    grid-auto-columns: auto; overflow: visible; gap: 0 1rem; max-width: 26rem;
  }
  .raumgruppe.weitere { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; max-width: 26rem; }
}

/* ---------- Verwaltung ---------- */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.kachel { display: flex; flex-direction: column; margin: 0; }
.kachel h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.kachel p { margin: 0 0 .5rem; }
.kachel-aktionen { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding-top: .5rem; }

/* Versammlungsfilter über Listen: Karte klappt nach rechts auf. */
/* Buchungsliste: Filter links, „+ Neue Buchung“ rechts in derselben Zeile. Die Karte
   hängt an der ganzen Zeile, damit sie auf dem Handy die volle Breite bekommt. */
.filterzeile { position: relative; display: flex; align-items: stretch; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.filterzeile .filter { position: static; }
.filterzeile .filterkarte { left: 0; right: auto; }
.filterzeile > .knopf { display: inline-flex; align-items: center; white-space: nowrap; }
@media (max-width: 640px) {
  .filterzeile .filterkarte { position: absolute; top: 100%; right: 0; }
}

/* ---------- Kopfzeile und Hauptmenü ---------- */
.mi { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kopf {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  height: 3.75rem; padding: 0 1.25rem;
  background: color-mix(in srgb, var(--karte) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--linie);
}
.marke-block { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.kopf .marke {
  display: inline-flex; align-items: center; gap: .55rem; align-self: center;
  font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; text-decoration: none; color: var(--text);
}
.marke-icon {
  width: 2rem; height: 2rem; padding: .3rem; border-radius: 9px;
  color: #fff; background: linear-gradient(135deg, var(--akzent), color-mix(in srgb, var(--akzent) 70%, #000));
  stroke-width: 2;
}
.kopf-rolle { display: none; }
/* Fragezeichen: Hilfe mit Legende. */
.hilfe-knopf {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--dezent); text-decoration: none;
}
.hilfe-knopf:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.hilfe-knopf[aria-current="page"] { background: color-mix(in srgb, var(--akzent) 13%, transparent); color: var(--akzent); }
.hilfe-knopf .mi { width: 1.4rem; height: 1.4rem; }
.hilfe { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 1rem; align-items: start; }
.hilfe-liste { margin: 0; }
.hilfe-liste dt { font-weight: 600; margin-top: .75rem; }
.hilfe-liste dt:first-child { margin-top: 0; }
.hilfe-liste dd { margin: .15rem 0 0; color: var(--dezent); font-size: .95rem; }
@media (max-width: 900px) { .hilfe { grid-template-columns: 1fr; } }

#hauptmenue { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; }
.menue-punkte { display: flex; gap: .25rem; }
.menue-punkte a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .8rem; border-radius: 999px;
  color: var(--dezent); font-weight: 500; font-size: .95rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.menue-punkte a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.menue-punkte a[aria-current="page"] {
  background: color-mix(in srgb, var(--akzent) 13%, transparent); color: var(--akzent); font-weight: 600;
}

.konto { position: relative; }
.konto-knopf {
  display: flex; align-items: center; gap: .6rem; padding: .25rem .75rem .25rem .25rem;
  background: none; color: var(--text); border: 1px solid transparent; border-radius: 999px; text-align: left;
}
.konto-knopf:hover, .konto.offen .konto-knopf { background: color-mix(in srgb, var(--text) 6%, transparent); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: color-mix(in srgb, var(--akzent) 16%, var(--karte)); color: var(--akzent);
  font-size: .8rem; font-weight: 700; letter-spacing: .02em;
}
.konto-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.konto-text strong { font-size: .9rem; font-weight: 600; }
.konto-text small { font-size: .78rem; color: var(--dezent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.konto-panel {
  display: none; position: absolute; right: 0; top: calc(100% + .5rem); z-index: 50;
  min-width: 15rem; padding: .5rem;
  background: var(--karte); border: 1px solid var(--linie); border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .14);
}
.konto.offen .konto-panel { display: block; }
.konto-panel .benutzer { display: block; padding: .4rem .6rem .5rem; color: var(--dezent); font-size: .85rem; }
.konto-panel form { margin: 0; }
.abmelden {
  display: flex; align-items: center; gap: .5rem; width: 100%; padding: .55rem .6rem;
  background: none; color: var(--fehler); border: 0; border-radius: 8px; font-weight: 500; text-align: left;
}
.abmelden:hover { background: color-mix(in srgb, var(--fehler) 9%, transparent); }

/* Mittlere Breite: nur Icons im Menü, damit die Zeile nicht umbricht. */
@media (max-width: 1060px) and (min-width: 641px) {
  .menue-punkte a { padding: .5rem .65rem; }
  .menue-punkte a:not([aria-current="page"]) { font-size: 0; gap: 0; }
  .konto-text { display: none; }
  .konto-knopf { padding: .25rem; }
}

/* Handy: kompakte Kopfzeile; das Hauptmenü wird zur Icon-Leiste am unteren Bildrand. */
.menue-punkte .kurz, .konto-knopf .kurz { display: none; }
@media (max-width: 640px) {
  :root { --kopf: 3.5rem; --tabs: 3.6rem; }  /* --kopf: in wochen.js über die Höhe der Kopfzeile berücksichtigt */
  /* Ohne Weichzeichner, sonst bezöge sich „fixed“ der Leiste auf die Kopfzeile statt auf den Bildschirm. */
  .kopf {
    height: var(--kopf); padding: 0 1rem; gap: .75rem;
    background: var(--karte); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .kopf .marke { font-size: 1.2rem; gap: .45rem; }
  .marke-icon { width: 1.85rem; height: 1.85rem; }
  .marke-block { flex: 1; align-items: center; justify-content: space-between; gap: .75rem; }
  .kopf-rolle {
    display: inline; font-size: .72rem; font-weight: 600; color: var(--akzent); white-space: nowrap;
    padding: .05rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--akzent) 12%, transparent);
  }

  body { padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom)); }
  #hauptmenue {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; align-items: stretch; gap: 0;
    height: calc(var(--tabs) + env(safe-area-inset-bottom)); padding: 0 .25rem env(safe-area-inset-bottom);
    background: var(--karte); border-top: 1px solid var(--linie);
  }
  .menue-punkte { display: contents; }
  /* Jeder Eintrag: gleich breite Spalte, Icon-Feld fester Höhe, Beschriftung darunter –
     so stehen Icons und Texte aller Einträge exakt auf einer Linie. */
  .menue-punkte a, .konto-knopf {
    flex: 1 1 0; min-width: 0; height: var(--tabs);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
    padding: 0; border: 0; border-radius: 0; background: none;
    color: var(--dezent); font-size: .68rem; font-weight: 500; line-height: 1; text-align: center;
  }
  .menue-punkte a:hover, .konto-knopf:hover, .konto.offen .konto-knopf { background: none; }
  .menue-punkte a .lang, .konto-text { display: none; }
  .menue-punkte a .kurz, .konto-knopf .kurz { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menue-punkte a .mi {
    box-sizing: content-box; width: 1.4rem; height: 1.4rem; padding: .25rem 1rem; border-radius: 999px;
    transition: background .15s;
  }
  .avatar { width: 1.9rem; height: 1.9rem; font-size: .7rem; }
  .menue-punkte a[aria-current="page"] { background: none; color: var(--akzent); font-weight: 600; }
  .menue-punkte a[aria-current="page"] .mi { background: color-mix(in srgb, var(--akzent) 14%, transparent); }
  .konto { flex: 1 1 0; min-width: 0; display: flex; position: static; }
  .konto.offen .konto-knopf { color: var(--akzent); }

  /* Konto: Karte über der Leiste mit Benutzer und Abmelden. */
  .konto-panel { right: .5rem; top: auto; bottom: calc(100% + .5rem); }
  .abmelden { padding: .75rem .8rem; font-size: 1rem; gap: .75rem; }

  /* In Masken mit eigener Knopfleiste (Speichern …) gehört der untere Rand dieser allein. */
  body:has(.aktionen.leiste) #hauptmenue { display: none; }
  body:has(.aktionen.leiste) { padding-bottom: 0; }
}

/* ---------- Buchungsliste: Spalten nach Inhalt statt gleich breit ---------- */
.buchungsliste .sp-datum { width: 9rem; }
.buchungsliste .sp-zeit { width: 7rem; }
.buchungsliste .sp-art { width: 15rem; }
.buchungsliste .sp-raeume { width: 11%; }
.buchungsliste .sp-von { width: 8rem; }
.buchungsliste .sp-aktion { width: 6rem; }
.buchungsliste td.zeit { white-space: nowrap; }
.art-zelle { display: inline-flex; align-items: baseline; gap: .45rem; }
.art-zelle .muster { flex: none; align-self: center; }
.titelzelle .termin-icon { margin-right: .35rem; }
@media (max-width: 1000px) {
  .buchungsliste td.titelzelle { display: flex; align-items: baseline; }
  .titelzelle .termin-icon { flex: none; align-self: flex-start; margin-top: calc((1.5em - 15px) / 2); }
}
/* Unter 1000px passen die sieben Spalten nicht mehr nebeneinander; die Liste
   erscheint dann wie auf dem Handy als Einträge (siehe table.stapel). */
@media (max-width: 1000px) {
  .buchungsliste colgroup { display: none; }
  table.buchungsliste { min-width: 0; }
  .buchungsliste thead { display: none; }
  .buchungsliste tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .75rem;
    padding: .6rem 0; border-bottom: 1px solid var(--linie);
  }
  .buchungsliste tr:last-child { border-bottom: 0; }
  .buchungsliste td { display: block; padding: 0; border: 0; }
  .buchungsliste td.voll { flex-basis: 100%; }
  .buchungsliste td[data-label]::before { content: attr(data-label) ": "; color: var(--dezent); font-size: .85rem; }
  .buchungsliste td:empty { display: none; }
}

/* ---------- Filter „Räume“ und „Versammlung“ ---------- */
.filter { position: relative; margin: 0; }
.filterknoepfe { display: flex; gap: .5rem; }
.filterknopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .4rem 1rem; border-radius: 999px; font-size: .95rem; white-space: nowrap;
  background: var(--karte); color: var(--text); border: 1px solid var(--linie);
}
.filterknopf .pfeil::after { content: "▾"; color: var(--dezent); font-size: .8em; }
.filterknopf[aria-expanded="true"] .pfeil::after { content: "▴"; }
/* Offener Filter: Knopf trägt den Rahmen der Karte, damit beide zusammengehören. */
.filterknopf[aria-expanded="true"] { border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
/* Gesetzter Filter: hellblau mit deutlichem Rahmen und Anzahl. */
.filterknopf.gesetzt {
  background: color-mix(in srgb, var(--akzent) 13%, var(--karte)); color: var(--akzent);
  border: 2px solid var(--akzent); padding: calc(.4rem - 1px) calc(1rem - 1px); font-weight: 600;
}
.filterknopf .zahl {
  min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; line-height: 1.25rem;
  background: var(--akzent); color: var(--karte); font-size: .75rem; font-weight: 700; text-align: center;
}
.filterkarte {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 25;
  width: min(30rem, calc(100vw - 2rem)); padding: .75rem;
  background: color-mix(in srgb, var(--akzent) 4%, var(--karte));
  border: 2px solid color-mix(in srgb, var(--akzent) 55%, var(--linie)); border-radius: 12px;
  box-shadow: 0 10px 28px rgb(0 0 0 / .18);
  display: flex; flex-direction: column; max-height: calc(100dvh - 10rem); overflow-y: auto;
}
.filterkarte .karten-kopf {
  display: flex; align-items: center; gap: .4rem; margin: -.1rem 0 .6rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--linie); font-weight: 600; font-size: .9rem; color: var(--akzent);
}
.filterkarte .karten-kopf .mi { width: 1.05rem; height: 1.05rem; }
/* Solange eine Filterkarte offen ist, tritt alles andere zurück (Suche, Legende, Termine). */
body.filter-offen main > :not(.wochennav, .filterzeile, .jahresnav),
body.filter-offen .wochennav > :not(.wochenwahl),
body.filter-offen .wochenwahl > .woche,
body.filter-offen .jahresnav > .woche,
body.filter-offen .such-zeile,
body.filter-offen .filterzeile > .knopf {
  opacity: .3; filter: grayscale(.6); transition: opacity .15s, filter .15s;
}
.filterkarte > * { flex: none; }
.filterkarte[hidden] { display: none; }
/* Handy: Die offene Karte ist wie die Icon-Leiste am Bildschirm festgemacht (Lage und Höhe
   setzt _filter.html), so bleibt der Fuß mit „Fertig“ auch beim Scrollen der Seite sichtbar. */
.filterkarte.schwebend { position: fixed; left: 1rem; right: 1rem; width: auto; margin: 0; z-index: 44; }
.filterkarte .gruppe { font-size: .8rem; color: var(--dezent); margin: .25rem 0 .3rem; }
.filterkarte .gruppe:first-child { margin-top: 0; }
.chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: .35rem; margin-bottom: .5rem; }
.chips.breit { grid-template-columns: repeat(2, 1fr); }
.chip { margin: 0; font-size: .85rem; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: block; padding: .4rem .3rem; text-align: center; cursor: pointer;
  border: 1px solid var(--linie); border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip input:checked + span { background: var(--akzent); border-color: var(--akzent); color: var(--karte); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: 2px; }
.karten-fuss {
  display: flex; align-items: center; gap: .75rem; margin-top: .5rem; padding-top: .6rem;
  border-top: 1px solid var(--linie); font-size: .85rem;
}
.karten-fuss .stand { color: var(--dezent); }
.karten-fuss .fertig {
  margin-left: auto; padding: .4rem 1.3rem; border-radius: 999px;
  background: var(--akzent); color: var(--karte); font-weight: 600;
}
@media (max-width: 640px) {
  .filterknoepfe { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  /* Auf dem Handy liegt die Karte im Fluss unter den Knöpfen statt darüber, höchstens so hoch
     wie der Platz zwischen Kopfzeile/Wochenleiste und Icon-Leiste; _filter.html scrollt sie ins Bild. */
  .filterkarte { position: static; width: auto; margin-top: .5rem; box-shadow: 0 8px 22px rgb(0 0 0 / .14); max-height: calc(100dvh - 8.5rem - var(--tabs) - env(safe-area-inset-bottom)); }
}

/* ---------- Suche ---------- */
.such-zeile { display: flex; align-items: center; gap: .5rem 1rem; }
.suche { position: relative; margin: 0; display: flex; align-items: center; }
.suche .mi { position: absolute; left: .6rem; width: 1.05rem; height: 1.05rem; color: var(--dezent); pointer-events: none; }
.suche input {
  width: 13rem; padding: .4rem .6rem .4rem 2rem; margin: 0;
  font: inherit; font-size: .95rem; color: var(--text); background: var(--karte);
  border: 1px solid var(--linie); border-radius: 6px;
}
.suche input:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: var(--akzent); }
.suche-seite { gap: .5rem; margin: .5rem 0 1rem; max-width: 34rem; }
.suche-seite input { flex: 1; width: auto; padding-top: .55rem; padding-bottom: .55rem; font-size: 1rem; }
.sprungziel { display: block; }
.trefferliste .listentag h2 { margin-bottom: .5rem; }
.trefferliste .listeneintrag { margin-bottom: .4rem; }
.trefferliste { max-width: 40rem; }
.treffer-abschnitt { font-size: 1.05rem; margin: 1.25rem 0 .6rem; padding-bottom: .3rem; border-bottom: 1px solid var(--linie); }
.trefferliste:first-of-type .treffer-abschnitt { margin-top: .25rem; }
#vergangen { scroll-margin-top: calc(var(--kopf, 3.75rem) + .5rem); }
/* Vergangene Treffer ausgegraut, beim Antippen oder Überfahren wieder voll lesbar. */
.trefferliste.vergangen .listentag { opacity: .55; filter: grayscale(.7); transition: opacity .15s, filter .15s; }
.trefferliste.vergangen .listentag:hover, .trefferliste.vergangen .listentag:focus-within { opacity: 1; filter: none; }
@media (max-width: 640px) {
  /* Suchfeld über die volle Breite unter den Filterknöpfen. */
  .such-zeile { margin-top: var(--zeilenabstand); }
  .suche { flex: 1; }
  .suche input { width: 100%; font-size: 1rem; }
}

/* ---------- Handy: Buchung nach links wischen → Löschen ---------- */
.wisch { position: relative; margin-bottom: .4rem; border-radius: 4px; overflow: hidden; }
.wisch:last-child { margin-bottom: 0; }
.wisch .listeneintrag { position: relative; z-index: 1; margin-bottom: 0; transition: transform .2s ease-out; }
.wisch.zieht .listeneintrag { transition: none; }
.wisch.offen .listeneintrag { transform: translateX(-5.5rem); }
.wisch-loeschen {
  position: absolute; top: 0; right: 0; bottom: 0; width: 5.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--fehler); color: #fff; font-weight: 600; text-decoration: none;
}
/* Erst beim Wischen sichtbar, sonst schiene er durch ausgegraute Einträge. */
.wisch:not(.offen):not(.zieht) .wisch-loeschen { visibility: hidden; }

/* ---------- Planansichten: Reiter „Woche“ / „Jahr“ statt Überschrift ---------- */
/* Die Reiterzeile bleibt beim Scrollen unter der Kopfzeile stehen; --reiter ist ihre Höhe
   (Wochenleiste und Sprungziele liegen darunter, wochen.js misst sie selbst). */
/* Sie schließt bündig an die Kopfzeile an, in deren Farbe und über die volle Breite
   (box-shadow + clip-path füllen den Rand neben main). */
body:has(.plan-kopf) { --reiter: 3.75rem; }
.plan-kopf {
  position: sticky; top: var(--kopf, 3.75rem); z-index: 35;
  height: var(--reiter); margin: -1.5rem -1rem .75rem; padding: 0 1rem; box-sizing: border-box;
  align-items: flex-end; background: var(--karte);
  box-shadow: 0 0 0 100vmax var(--karte); clip-path: inset(0 -100vmax);
}
.plan-kopf .knopfgruppe { align-self: center; }
.ansicht-reiter { display: flex; gap: 1.5rem; margin: 0; border-bottom: 1px solid var(--linie); }
.ansicht-reiter a {
  display: inline-flex; align-items: center; gap: .45rem; padding: .15rem .1rem .45rem; margin-bottom: -1px;
  color: var(--dezent); text-decoration: none; border-bottom: 3px solid transparent;
}
.ansicht-reiter a .mi { width: 1.3rem; height: 1.3rem; }
.ansicht-reiter a:hover { color: var(--text); }
.ansicht-reiter a[aria-current="page"] { color: var(--text); border-bottom-color: var(--akzent); }
.ansicht-reiter a[aria-current="page"] .mi { color: var(--akzent); }

/* ---------- Jahresansicht ---------- */
.jahresnav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .75rem; }
.jahresnav .woche { display: flex; align-items: center; gap: .5rem 1rem; }
.jahr-legende { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .85rem; color: var(--dezent); }
.jahr-legende li { display: flex; align-items: center; gap: .4rem; }
.punkt { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; flex: none; }
.p-sonder { background: var(--sonder-rand); }
.p-zusatz { background: var(--zusatz-rand); }
.p-ueber { background: var(--ueber-rand); }
.p-ersatz { background: var(--ersatz-rand); }
.p-verdraengt { background: var(--dezent); }
.jahr-monate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.jahr-monat { margin: 0; padding: .75rem .8rem .8rem; }
.jahr-monat h2 { font-size: 1rem; margin: 0 0 .4rem; }
.jahr-monat.aktuell h2 { color: var(--akzent); }
.jahr-tage { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; font-size: .85rem; }
.jahr-tage .wt { text-align: center; font-size: .7rem; color: var(--dezent); padding-bottom: .15rem; }
.jahr-tage .tag {
  position: relative; display: flex; align-items: flex-start; justify-content: center;
  height: 2.1rem; padding-top: .25rem; border-radius: 6px; color: var(--text); text-decoration: none;
}
.jahr-tage .tag.we { color: var(--dezent); }
.jahr-tage .tag:hover { background: color-mix(in srgb, var(--akzent) 10%, transparent); }
.jahr-tage .tag.belegt { font-weight: 600; }
.jahr-tage .tag.heute { outline: 2px solid var(--akzent); outline-offset: -2px; color: var(--akzent); }
.jahr-tage .punkte { position: absolute; bottom: .3rem; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; }
.jahr-tage .punkte .punkt { width: .4rem; height: .4rem; }
@media (max-width: 1100px) { .jahr-monate { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .jahr-monate { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  body:has(.plan-kopf) { --reiter: 3.35rem; }
  .plan-kopf { margin-top: -1rem; margin-bottom: var(--zeilenabstand); }
  .ansicht-reiter { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .ansicht-reiter a { justify-content: center; padding-bottom: .55rem; }
  .jahresnav { flex-direction: column; align-items: stretch; gap: var(--zeilenabstand); margin-bottom: var(--zeilenabstand); }
  .jahresnav .woche { display: grid; grid-template-columns: 3.25rem 1fr 3.25rem; gap: .5rem; align-items: stretch; }
  .jahr-monate { grid-template-columns: 1fr; gap: var(--zeilenabstand); }
  .jahr-monat { scroll-margin-top: calc(var(--kopf) + var(--reiter, 0px) + .5rem); }
  .jahr-tage { font-size: 1rem; }
  .jahr-tage .tag { height: 2.6rem; padding-top: .4rem; }
  .jahr-legende { font-size: .8rem; margin-bottom: var(--zeilenabstand); }
}

/* ---------- Abstimmung: angefragte Buchungen und Seite „Anfragen“ ---------- */
.eintrag.angefragt { outline: 2px dashed var(--sonder-rand); outline-offset: -2px; }
.eintrag.angefragt:not(.verdraengt) {
  background-image: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--sonder-rand) 12%, transparent) 6px 12px);
}
.angefragt-hinweis { color: var(--sonder-rand); font-weight: 600; }
/* Zähler offener Anfragen am Menüsymbol. */
.mi-rahmen { position: relative; display: inline-flex; }
.zaehler {
  position: absolute; top: -.4rem; right: -.55rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem;
  border-radius: 999px; background: var(--fehler); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.05rem; text-align: center;
}
.konto-verwaltung { display: none; }
@media (max-width: 640px) {
  .menue-punkte a .zaehler { top: -.15rem; right: .35rem; }
  .menue-punkte .verwaltung-link { display: none; }
  .konto-verwaltung {
    display: flex; align-items: center; gap: .75rem; padding: .75rem .8rem; border-radius: 8px;
    color: var(--text); text-decoration: none; font-weight: 500;
  }
}
.anfragen-abschnitt { max-width: 46rem; margin-bottom: 1.5rem; }
.anfragen-abschnitt > h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
.anfrage { margin-bottom: .75rem; }
.anfrage h3 { margin: .35rem 0 .2rem; font-size: 1.05rem; }
.anfrage-zeile { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.anfrage-art { display: inline-flex; align-items: center; gap: .4rem; color: var(--dezent); }
.anfrage-frist { margin-left: auto; color: var(--sonder-rand); font-weight: 600; }
.anfrage-termin { margin: 0 0 .5rem; }
.anfrage-anlass { margin: 0 0 .6rem; white-space: normal; }
.anfrage-eigene { margin: 0 0 .6rem; padding: .4rem .6rem; border-left: 3px solid var(--akzent); background: color-mix(in srgb, var(--akzent) 8%, transparent); font-size: .9rem; }
.anfrage-status { margin: 0 0 .35rem; font-weight: 600; }
.status-genehmigt .anfrage-status { color: var(--zusatz-rand); }
.status-abgelehnt .anfrage-status { color: var(--fehler); }
.status-angefragt .anfrage-status { color: var(--sonder-rand); }
.ablehnung { margin: 0 0 .6rem; padding: .4rem .6rem; border-left: 3px solid var(--fehler); background: color-mix(in srgb, var(--fehler) 8%, transparent); }
.ablehnung p { margin: 0; }
.ablehnung p + p { margin-top: .4rem; }
.zustimmungen { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .3rem; }
.zustimmungen li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .2rem .75rem; }
.zustimmungen .begruendung { flex-basis: 100%; color: var(--dezent); }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: color-mix(in srgb, var(--text) 8%, transparent); }
.chip.antwort-ja { background: color-mix(in srgb, var(--zusatz-rand) 18%, transparent); color: var(--zusatz-rand); }
.chip.antwort-nein { background: color-mix(in srgb, var(--fehler) 15%, transparent); color: var(--fehler); }
.chip.antwort-frage, .chip.antwort-offen { background: color-mix(in srgb, var(--sonder-rand) 15%, transparent); color: var(--sonder-rand); }
.anfrage-verlauf { list-style: none; padding: .5rem .7rem; margin: 0 0 .6rem; border-radius: 8px; background: color-mix(in srgb, var(--text) 5%, transparent); display: grid; gap: .45rem; font-size: .9rem; }
.anfrage-aktionen { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.anfrage-aktionen > button.primaer, .admin-entscheidung button { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.anfrage-aktionen > button.primaer { margin-left: auto; }
.anfrage-mehr summary { list-style: none; cursor: pointer; }
.anfrage-mehr summary::-webkit-details-marker { display: none; }
.anfrage-mehr[open] { flex-basis: 100%; order: 3; display: grid; gap: .4rem; }
.anfrage-mehr textarea { width: 100%; font: inherit; padding: .45rem .6rem; border: 1px solid var(--linie); border-radius: 6px; background: var(--bg); color: var(--text); box-sizing: border-box; }
.anfrage-nachricht { flex: 1 1 100%; display: grid; gap: .3rem; }
.anfrage-nachricht label { font-size: .9rem; font-weight: 600; }
.anfrage-nachricht .zeile { display: flex; gap: .4rem; }
.anfrage-nachricht input { flex: 1; min-width: 0; padding: .4rem .6rem; font: inherit; border: 1px solid var(--linie); border-radius: 6px; background: var(--bg); color: var(--text); }
.abstimmung-hinweis { margin: .25rem 0 .5rem; padding: .45rem .7rem; border-left: 3px solid var(--sonder-rand); background: color-mix(in srgb, var(--sonder-rand) 9%, transparent); font-size: .92rem; }
.abstimmung-hinweis:empty { display: none; }
.konto-link { display: flex; align-items: center; gap: .5rem; padding: .55rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.konto-link:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
@media (max-width: 640px) { .konto-link { padding: .75rem .8rem; gap: .75rem; } }
.marke-hinweis {
  margin-left: .35rem; padding: .05rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  color: var(--sonder-rand); background: color-mix(in srgb, var(--sonder-rand) 12%, transparent);
}
