:root {
  --text: #1d1d1b;
  --leise: #66655f;
  --linie: #dddbd5;
  --rand: #b3b1aa;
  --flaeche: #f4f3ef;
  --hinter: #ffffff;
  --akzent: #2b4c7e;
  --auf-akzent: #ffffff;
  --fehler: #a12d2d;
  --markiert: #fbf3d5;
  --kopf: #e6edf7;
  --kopf-vorbei: #efeeea;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e7e5df;
    --leise: #a3a19a;
    --linie: #393834;
    --rand: #5c5a55;
    --flaeche: #23221f;
    --hinter: #181715;
    --akzent: #a7c0e8;
    --auf-akzent: #181715;
    --fehler: #e59a9a;
    --markiert: #3a3420;
    --kopf: #1f2836;
    --kopf-vorbei: #24231f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--hinter);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.seite {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

a { color: var(--akzent); }

h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0;
}

.unter {
  margin: .3rem 0 0;
  color: var(--leise);
}

.leise { color: var(--leise); }
.klein { font-size: .875rem; }

/* ---------- Knöpfe und Felder ---------- */

button {
  font: inherit;
  font-size: .9375rem;
  line-height: 1.3;
  color: var(--text);
  background: var(--hinter);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: .3rem .75rem;
  cursor: pointer;
}
button:hover { border-color: var(--text); }
button:disabled { opacity: .6; cursor: default; }

button.haupt {
  background: var(--akzent);
  border-color: var(--akzent);
  color: var(--auf-akzent);
}

button.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--akzent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
}

input, textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--hinter);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: .35rem .5rem;
  width: 100%;
}
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 1px;
}
textarea { resize: vertical; }

/* ---------- Kopf, Reiter ---------- */

.hinweis {
  margin-top: 1.25rem;
  padding: .6rem .8rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  font-size: .9375rem;
}
.hinweis.fehler { border-color: var(--fehler); }

.reiter {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.75rem;
  border-bottom: 1px solid var(--linie);
  overflow-x: auto;
}
.reiter a {
  padding: .5rem 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--leise);
  text-decoration: none;
  white-space: nowrap;
}
.reiter a:hover { color: var(--text); }
.reiter a.aktiv {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}
.reiter .anzahl {
  margin-left: .3rem;
  font-size: .8125rem;
  font-weight: 400;
  color: var(--leise);
}

.leiste {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: .9rem 0 .2rem;
  font-size: .9375rem;
}

.als {
  margin: .9rem 0 0;
  padding: 0;
  font-size: .9375rem;
  color: var(--leise);
}
.als strong { color: var(--text); font-weight: 600; }

.leer {
  color: var(--leise);
  padding: 1.25rem 0;
  margin: 0;
}

/* ---------- Termine ---------- */

.termin, .aufgabe {
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--linie);
}
.termin.vorbei, .aufgabe.vorbei { color: var(--leise); }
.markiert { background: var(--markiert); transition: background 1.5s; }
.termin, .aufgabe { scroll-margin-top: .75rem; }

.t-datum {
  color: var(--leise);
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
}

.termin h2, .aufgabe h2 {
  font-size: 1.3rem;
  line-height: 1.25;
  margin: .1rem 0 0;
}

.t-ort { margin-top: .1rem; }

/* Farbig hinterlegte Terminköpfe (nicht bei „Jugend extern“) */
.termin .t-kopf {
  background: var(--kopf);
  padding: .55rem .75rem .6rem;
  border-radius: 3px;
}
.termin.vorbei .t-kopf { background: var(--kopf-vorbei); }
.termin.extern .t-kopf { background: none; padding: 0; }
.termin.abstimmung .t-kopf { background: none; padding: 0; }

.etikett {
  display: inline-block;
  padding: 0 .4rem;
  border: 1px solid var(--rand);
  border-radius: 3px;
  font-size: .75rem;
  line-height: 1.4;
  color: var(--leise);
  white-space: nowrap;
  vertical-align: .1em;
}

/* „Jugend extern“ eingeklappt: eine Zeile */
.termin.extern.zu { padding: 0; }
.extern-zeile {
  display: grid;
  grid-template-columns: 11rem 1fr auto;
  gap: .2rem .75rem;
  align-items: baseline;
  width: 100%;
  padding: .55rem 0;
  border: 0;
  background: none;
  text-align: left;
  color: var(--leise);
  border-radius: 0;
}
.extern-zeile:hover .e-titel { text-decoration: underline; text-underline-offset: 2px; }
.e-datum { font-variant-numeric: tabular-nums; font-size: .9375rem; }
.e-titel { color: var(--text); min-width: 0; }
.termin.vorbei .e-titel { color: var(--leise); }

label.filter { cursor: pointer; white-space: nowrap; }
label.filter input { margin-right: .35rem; }

.kasten label.haken-zeile.extern-haken { display: block; }
.kasten label.extern-haken input { margin: 0 .45rem 0 0; }
.kasten label.extern-haken .tipp { margin-left: 1.5rem; }

.info {
  white-space: pre-line;
  margin: .5rem 0 0;
  max-width: 38rem;
}

.schichten { margin-top: .75rem; }

.tag-kopf {
  margin-top: 1.1rem;
  font-weight: 600;
}

.station { margin-top: .75rem; }
.station h3 {
  font-size: 1rem;
  margin: 0 0 .15rem;
}

.zeile {
  display: grid;
  grid-template-columns: 7.75rem 2.75rem 1fr auto;
  grid-template-areas: "zeit zahl namen aktion";
  gap: .2rem .75rem;
  align-items: baseline;
  padding: .4rem 0;
  border-top: 1px solid var(--linie);
}
.zeile.ohne-zeit {
  grid-template-columns: 2.75rem 1fr auto;
  grid-template-areas: "zahl namen aktion";
}
.z-zeit { grid-area: zeit; font-variant-numeric: tabular-nums; }
.z-zahl {
  grid-area: zahl;
  color: var(--leise);
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
}
.ist-voll .z-zahl { color: var(--text); }
.z-namen { grid-area: namen; min-width: 0; }
.z-aktion { grid-area: aktion; text-align: right; white-space: nowrap; }
.z-info {
  display: block;
  color: var(--leise);
  font-size: .875rem;
}

.person { white-space: nowrap; }
.person.wartet { opacity: .55; }
.person.ich { font-weight: 600; }
.notiz { color: var(--leise); font-weight: 400; white-space: normal; }

.weg {
  border: 0;
  background: none;
  color: var(--leise);
  padding: 0 0 0 .3rem;
  font-size: 1.05rem;
  line-height: 1;
}
.weg:hover { color: var(--fehler); }

.verw {
  display: block;
  margin-top: .15rem;
  font-size: .8125rem;
}
.verw button + button { margin-left: .5rem; }

.t-links {
  margin-top: .9rem;
  font-size: .9375rem;
}
.trenn { color: var(--leise); }

/* ---------- Unteraufgaben und Abhaken ---------- */

input[type="checkbox"], input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  accent-color: var(--akzent);
  vertical-align: -.15rem;
  cursor: pointer;
}
input[type="checkbox"]:disabled, input[type="radio"]:disabled { cursor: default; }
.kasten label.haken-zeile:has(input:disabled) { color: var(--leise); cursor: default; }

.fortschritt {
  margin-top: .5rem;
  color: var(--leise);
  font-size: .9375rem;
}

.zeile.unteraufgabe {
  grid-template-columns: 1.4rem minmax(0, 13rem) 2.75rem 1fr auto;
  grid-template-areas: "haken titel zahl namen aktion";
}
.z-haken { grid-area: haken; }
.z-titel { grid-area: titel; min-width: 0; }
.zeile.unteraufgabe.erledigt .u-titel { text-decoration: line-through; color: var(--leise); }
.zeile.unteraufgabe.erledigt .z-namen { color: var(--leise); }

.aufgabe.fertig h2 { text-decoration: line-through; color: var(--leise); }

label.haken { cursor: pointer; }
.wahl { white-space: nowrap; }

.kasten label.haken-zeile {
  display: flex;
  align-items: center;
  gap: .45rem;
  align-self: center;
  cursor: pointer;
}
.kasten label.haken-zeile input { margin: 0; }

.kasten .warnung {
  margin: 0 0 .9rem;
  padding: .5rem .7rem;
  border-left: 3px solid var(--fehler);
  background: var(--hinter);
  font-size: .9375rem;
}

.zeile.direkt { border-top-color: var(--rand); }
label.haken input { margin-right: .4rem; }

/* ---------- Tabellenansicht ---------- */

.ansicht {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem 1rem;
  margin: .9rem 0 0;
  font-size: .9375rem;
  color: var(--leise);
}
.ansicht button.aktiv {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

.uebersicht {
  width: 100%;
  border-collapse: collapse;
  margin-top: .75rem;
  font-size: .9375rem;
}
.uebersicht th, .uebersicht td {
  text-align: left;
  vertical-align: top;
  padding: .4rem .9rem .4rem 0;
  border-bottom: 1px solid var(--linie);
}
.uebersicht td:last-child, .uebersicht th:last-child { padding-right: 0; }
.uebersicht thead th {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--leise);
}
.uebersicht .monat-zeile th {
  padding-top: 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  border-bottom-color: var(--rand);
}
.monat-zeile .putz {
  margin-left: .9rem;
  font-size: .9375rem;
  font-weight: 400;
  color: var(--leise);
}
.u-datum, .u-zeit {
  width: 1%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.uebersicht .ferien td {
  background: var(--flaeche);
  color: var(--leise);
}
.uebersicht .ferien td:first-child { padding-left: .4rem; }
.uebersicht .leer-zeile td { color: var(--leise); }
.uebersicht tr.extern td, .uebersicht tr.extern a { color: var(--leise); }
.quelle {
  margin: .75rem 0 0;
  font-size: .8125rem;
  color: var(--leise);
}

/* ---------- Abstimmungen ---------- */

.abschnitt {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--leise);
  margin: 1.75rem 0 0;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--linie);
}

.zeile.abst { grid-template-columns: 9.5rem 2rem 1fr auto; }
.zeile.abst.vorn .z-zahl { color: var(--text); font-weight: 700; }

button.gewaehlt {
  background: var(--akzent);
  border-color: var(--akzent);
  color: var(--auf-akzent);
}

.ergebnis {
  margin: 0;
  padding: .9rem 0;
  border-bottom: 1px solid var(--linie);
}

fieldset.optionen {
  border: 0;
  margin: 0 0 .5rem;
  padding: 0;
}
fieldset.optionen legend {
  font-size: .9375rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: .4rem;
}
.kasten p.tipp {
  color: var(--leise);
  font-size: .8125rem;
  margin: 0 0 .9rem;
}

.monat {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--leise);
  margin: 1.25rem 0 0;
}

.vergangen-schalter {
  margin: 1.25rem 0 0;
  font-size: .9375rem;
}

/* ---------- Formulare ---------- */

form.eintragen {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .6rem;
  margin: 0 0 .4rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
}
form.eintragen input[name="name"] { flex: 1 1 10rem; width: auto; }
form.eintragen input[name="notiz"] { flex: 2 1 12rem; width: auto; }

.knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.kasten {
  margin: .75rem 0;
  padding: 1rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
}
.kasten h3 {
  font-size: 1rem;
  margin: 0 0 .75rem;
}
.kasten label {
  display: block;
  margin-bottom: .75rem;
  font-size: .9375rem;
}
.kasten label input, .kasten label textarea { margin-top: .2rem; }
.kasten .reihe {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}
.kasten .reihe label { flex: 1 1 10rem; }
.kasten .tipp {
  display: block;
  margin-top: .2rem;
  color: var(--leise);
  font-size: .8125rem;
}

form.zeile-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
form.zeile-form input { width: auto; flex: 0 1 14rem; }

/* ---------- Meine Einträge ---------- */

.name-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: 1rem 0 .25rem;
}
.name-form input { flex: 0 1 16rem; width: auto; }
.name-form.als { margin: 0; padding: .9rem 0 0; }

.meine {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
}
.meine li {
  display: grid;
  grid-template-columns: 13rem 1fr auto;
  gap: .2rem .75rem;
  align-items: baseline;
  padding: .5rem 0;
  border-top: 1px solid var(--linie);
}
.meine li:last-child { border-bottom: 1px solid var(--linie); }
.m-wann { font-variant-numeric: tabular-nums; }

/* ---------- Fuß und Meldungen ---------- */

.fuss {
  margin-top: 3rem;
  color: var(--leise);
  font-size: .875rem;
}
.fuss form { margin-top: .5rem; }

.meldung {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: .6rem 1rem;
  background: var(--text);
  color: var(--hinter);
  border-radius: 3px;
  font-size: .9375rem;
  z-index: 10;
}
.meldung.fehler { background: var(--fehler); color: #fff; }
.meldung button.link {
  color: inherit;
  margin-left: .9rem;
  font-weight: 600;
}

/* ---------- Handy ---------- */

@media (max-width: 34rem) {
  .seite { padding-top: 1.25rem; }
  h1 { font-size: 1.5rem; }
  .zeile {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "zeit zahl aktion"
      "namen namen namen";
  }
  .zeile.ohne-zeit {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "zahl aktion"
      "namen namen";
  }
  .zeile.abst { grid-template-columns: auto 1fr auto; }
  .extern-zeile {
    grid-template-columns: 1fr auto;
    grid-template-areas: "datum etikett" "titel titel";
  }
  .e-datum { grid-area: datum; }
  .extern-zeile .etikett { grid-area: etikett; }
  .e-titel { grid-area: titel; }
  .u-datum { white-space: normal; }
  .monat-zeile .putz { display: block; margin-left: 0; }
  .zeile.unteraufgabe {
    grid-template-columns: 1.4rem auto 1fr auto;
    grid-template-areas:
      "haken titel titel aktion"
      ". zahl namen namen";
  }
  .meine li {
    grid-template-columns: 1fr auto;
  }
  .m-wann { grid-column: 1 / -1; color: var(--leise); font-size: .9375rem; }
}

/* ---------- Drucken (z. B. als Aushang) ---------- */

@media print {
  .reiter, .fuss, .leiste, .z-aktion, .weg, .t-links, .verw, .vergangen-schalter,
  .hinweis, .meldung, form, .ansicht, .quelle { display: none !important; }
  .uebersicht a { color: inherit; text-decoration: none; }
  .termin .t-kopf { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .uebersicht tr { break-inside: avoid; }
  .seite { max-width: none; padding: 0; }
  .termin, .aufgabe { break-inside: avoid; }
}

.kasten .lueckenfueller { flex: 1 1 10rem; }

/* ---------- „Für wen?“ ---------- */

.profil-zeile {
  margin: 1.1rem 0 0;
  font-size: .9375rem;
  color: var(--leise);
}
.profil-zeile strong { color: var(--text); font-weight: 600; }
.kasten.profil { margin-top: 1.25rem; border-color: var(--rand); }
.kasten.profil h3 { font-size: 1.1rem; }

.fuer-teil { margin: 0 0 .5rem; }
.fuer-titel {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--leise);
  margin-bottom: .2rem;
}
.kasten label.wahl-box {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0 1.1rem .35rem 0;
  cursor: pointer;
  white-space: nowrap;
}
.kasten label.wahl-box input { margin: 0; }

fieldset.fuer {
  border: 1px solid var(--linie);
  border-radius: 3px;
  margin: 0 0 .9rem;
  padding: .5rem .75rem .35rem;
  background: var(--hinter);
}
fieldset.fuer legend { font-size: .9375rem; padding: 0 .3rem; }
fieldset.fuer > .tipp { margin: 0 0 .5rem; }
.fuer-schnell { font-size: .875rem; color: var(--leise); margin: .2rem 0 .3rem; }
.fuer-schnell select { width: auto; padding: .1rem .3rem; font-size: .875rem; }

select {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--hinter);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: .35rem .5rem;
  width: 100%;
}
select:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }
.kasten label select { margin-top: .2rem; }

.etikett.fuer { border-style: dashed; white-space: normal; }

/* Aufgaben beim Termin */
.t-aufgaben { margin-top: .9rem; }
.t-aufgaben-titel { font-weight: 600; font-size: .9375rem; }
.t-aufgaben ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.t-aufgaben li { margin: .15rem 0; }
.t-team-hinweis { margin: .3rem 0 0; }
.t-aufgaben li.fertig a { text-decoration: line-through; color: var(--leise); }
.t-aufgaben .dabei { font-size: .8125rem; font-weight: 600; }

/* Putzdienst der eigenen Gruppe in der Tabelle */
.monat-zeile .putz.meins { color: var(--text); font-weight: 600; }

/* Termine aus Vorlage übernehmen */
.kasten.import > p { margin: 0 0 .75rem; font-size: .9375rem; }
.vorlage-hinweise {
  margin: 0 0 .9rem;
  font-size: .875rem;
  color: var(--leise);
}
.vorlage-hinweise summary { cursor: pointer; }
.vorlage-hinweise ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.vorlage-hinweise li { margin-bottom: .2rem; }
.import-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  margin-top: 1rem;
}
.import-kopf h4 { margin: 0; font-size: .9375rem; }
.import-kopf span { font-size: .875rem; }
.import-liste {
  width: 100%;
  border-collapse: collapse;
  margin: .3rem 0 .9rem;
  font-size: .9375rem;
}
.import-liste td, .import-liste th {
  text-align: left;
  vertical-align: top;
  padding: .4rem .6rem .4rem 0;
  border-bottom: 1px solid var(--linie);
}
.import-liste td:last-child { padding-right: 0; }
.import-liste .monat th {
  padding-top: .9rem;
  font-weight: 600;
  border-bottom-color: var(--rand);
}
.import-liste td.haken { width: 1%; padding-right: .5rem; }
.import-liste td.haken input { margin: .2rem 0 0; }
.import-liste td.wann {
  width: 1%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.import-liste td.fuer-spalte { width: 24%; color: var(--leise); font-size: .875rem; }
.import-liste tr.leise strong { font-weight: 400; }
.import-liste tr.leise td { color: var(--leise); }
.import-liste details { margin-top: .2rem; }
.import-liste details ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.import-liste summary { cursor: pointer; color: var(--leise); }
.import-liste .fuer-unten { display: none; }
@media (max-width: 560px) {
  .import-liste td.fuer-spalte { display: none; }
  .import-liste .fuer-unten { display: block; }
  .import-liste td { padding-right: .5rem; overflow-wrap: anywhere; }
  .import-liste td.wann { white-space: normal; overflow-wrap: normal; }
  .import-liste .etikett { white-space: normal; }
}
.kasten.import label.jahr-wahl { display: flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; font-weight: 600; }
.kasten.import label.jahr-wahl select { width: auto; margin: 0; }
.import-liste .regel { font-style: italic; }
.import-liste .verschoben { color: var(--fehler); font-style: normal; }

/* „+ Aufgabe dazu“: vorhandene Aufgaben zuordnen */
.zuordnen-liste { max-height: 18rem; overflow-y: auto; margin: 0 0 .75rem; }
.zuordnen-liste .fuer-titel { margin: .5rem 0 .25rem; }
.kasten .zuordnen-liste label.haken-zeile { align-items: flex-start; margin-bottom: .4rem; }
.kasten .zuordnen-liste label.haken-zeile input { margin-top: .2rem; flex: none; }

/* neue Termine seit dem letzten Besuch */
.neu-banner {
  margin: 0 0 .9rem;
  padding: .5rem .75rem;
  border-left: 3px solid var(--akzent);
  background: var(--flaeche);
  font-size: .9375rem;
  line-height: 1.5;
}
.neu-banner .neu-eintrag { white-space: nowrap; }
.neu-banner .neu-ok { margin-left: .5rem; }
.neu-etikett {
  display: inline-block;
  padding: 0 .35rem;
  border-radius: 3px;
  background: var(--akzent);
  color: var(--hinter);
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.45;
  vertical-align: .1em;
}
.kasten label.neues-team { display: inline-block; margin: 0 0 .3rem; }
.kasten fieldset.fuer label.neues-team input { width: 11rem; max-width: 100%; padding: .15rem .4rem; font-size: .875rem; }
