@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/BricolageGrotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --tinte: #1c2440;
  --blatt: #f6f7fa;
  --flaeche: #ffffff;
  --linie: #d7dbe6;
  --gedaempft: #5b6479;
  --messing: #d9a62e;
  --messing-dunkel: #b98a1f;
  --rot: #b3261e;
  --rot-hell: #fbeceb;
  --fokus: #3355cc;
  --breite: 46rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--blatt);
  color: var(--tinte);
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 750; letter-spacing: -.02em; margin: .25rem 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; margin: 1.75rem 0 .6rem; }
p { margin: 0 0 .75rem; }
a { color: var(--fokus); }

:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

/* Kopfband mit fünf Notenlinien */
.kopf {
  height: 3.25rem;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background-color: var(--tinte);
  background-image:
    linear-gradient(#ffffff1a, #ffffff1a),
    linear-gradient(#ffffff1a, #ffffff1a),
    linear-gradient(#ffffff1a, #ffffff1a),
    linear-gradient(#ffffff1a, #ffffff1a),
    linear-gradient(#ffffff1a, #ffffff1a);
  background-size: 100% 1px;
  background-position: 0 22%, 0 36%, 0 50%, 0 64%, 0 78%;
  background-repeat: no-repeat;
}
.marke { color: #fff; font-size: 1.2rem; font-weight: 750; letter-spacing: -.01em; }

/* Navigation: am Handy als Leiste unten (Daumen), am Rechner im Kopfband */
.hauptnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
.hauptnav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.75rem;
  color: var(--gedaempft);
  font-weight: 600;
  text-decoration: none;
  border-top: 3px solid transparent;
}
.hauptnav a[aria-current="page"] { color: var(--tinte); border-top-color: var(--messing); }

.seite { max-width: var(--breite); margin: 0 auto; padding: 1.25rem 1rem 0; }

/* Bedienelemente: mind. 44 px, 16 px Schrift (kein Zoomen auf iOS) */
input, select, button, .knopf {
  font: inherit;
  min-height: 2.75rem;
  padding: .45rem .9rem;
  border: 1px solid #b9c0d3;
  border-radius: .65rem;
  background: var(--flaeche);
  color: var(--tinte);
}
input, select { min-width: 0; }
button, .knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .12s ease, transform .06s ease;
}
button:hover, .knopf:hover { background: #eef0f6; }
button:active, .knopf:active { transform: translateY(1px); }
.primaer { background: var(--messing); border-color: var(--messing-dunkel); }
.primaer:hover { background: #e3b23c; }
.gefahr { color: var(--rot); border-color: #e2b4b0; }
.gefahr:hover { background: var(--rot-hell); }

form { margin: 0; }
label { font-size: .9rem; font-weight: 600; color: var(--gedaempft); }
.hinweis { color: var(--gedaempft); margin-bottom: .5rem; }

/* Rückmeldungen: Erfolg ruhig grün, Fehler/Hinweis deutlich rot. Immer mit Symbol (nicht nur Farbe). */
.meldungen { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .5rem; }
.meldung {
  display: flex; gap: .7rem; align-items: flex-start; padding: .75rem 1rem; border-radius: .6rem;
  border-left: 5px solid; font-weight: 600; line-height: 1.4;
}
.meldung::before { flex: 0 0 auto; font-weight: 800; }
.meldung.ok { background: #e8f6ec; border-color: #2e8b57; color: #17502f; }
.meldung.ok::before { content: "✓"; }
.meldung.fehler { background: var(--rot-hell); border-color: var(--rot); color: #7d1a14; }
.meldung.fehler::before { content: "!"; }

/* Formulare: Felder umbrechen, am Handy untereinander über die volle Breite */
.formular { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.formular label { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 9rem; }
.formular label input, .formular label select { color: var(--tinte); font-weight: 400; }
.formular button { flex: 0 0 auto; }

/* Schüler: Listenzeilen mit Haarlinien statt Kartenwand */
.karte { padding: 1rem 0; border-bottom: 1px solid var(--linie); }
.karte:first-of-type { border-top: 1px solid var(--linie); }
.karte .zeile { display: flex; gap: .5rem; }
.karte .zeile input { flex: 1 1 auto; font-weight: 600; }
.karte .aktionen { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; }
.karte .aktionen form { margin-left: auto; }

/* Zeiträume */
.liste { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--linie); }
.liste li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--linie);
  font-weight: 600;
}

/* Plan-Varianten */
.plan-variante {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 1rem;
}
.plan-variante h2 { margin-top: 0; }
.kennzahlen { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.kennzahlen p { margin: 0 0 .3rem; font-weight: 650; font-size: .95rem; }
.meter {
  height: .5rem;
  border-radius: .25rem;
  background: linear-gradient(90deg, var(--tinte) var(--wert), #e4e8f2 var(--wert));
}
.meter-zufrieden { background: linear-gradient(90deg, var(--messing) var(--wert), #e4e8f2 var(--wert)); }

.plan-variante table { width: 100%; border-collapse: collapse; margin: 0; }
.plan-variante th {
  text-align: left;
  padding: .4rem .4rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gedaempft);
  border-bottom: 1px solid var(--linie);
}
.plan-variante td { padding: .6rem .4rem; border-bottom: 1px solid var(--linie); }
.plan-variante tbody tr:last-child td { border-bottom: 0; }
.plan-variante td.tag { width: 6.5rem; font-weight: 700; }
.plan-variante td.zeit { white-space: nowrap; }
.plan-variante tbody tr:not(.frei) td:last-child { font-weight: 650; }
.plan-variante tr.frei td { color: var(--gedaempft); }
.plan-variante tbody tr:has(.tag:not(:empty)):not(:first-child) td { border-top: 2px solid var(--linie); }
.nicht-eingeplant { margin: .9rem 0 0; color: var(--rot); font-weight: 650; }
.plan-variante + p { margin-top: -.75rem; }

/* Präferenz-Raster: Stufen wie Noten - gefüllt, hohl, Pause */
.legende { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.legende span, .slot-button { border-width: 2px; border-style: solid; }
.legende span { padding: .2rem .8rem; border-radius: .6rem; font-size: .85rem; font-weight: 650; }

.stufe-favorit { background: var(--tinte); color: #fff; border-color: var(--tinte); }
.stufe-geht { background: #e7ebf8; color: var(--tinte); border-color: var(--tinte); }
.stufe-geht_nicht {
  background: repeating-linear-gradient(135deg, #eceef4 0 6px, #f8f9fb 6px 12px);
  color: #667089;
  border-color: #d2d8e5;
}
button.stufe-favorit:hover { background: #2a3560; }
button.stufe-geht:hover { background: #d9dff3; }
button.stufe-geht_nicht:hover { background: repeating-linear-gradient(135deg, #e3e6ee 0 6px, #f1f3f8 6px 12px); }

.scroll { overflow-x: auto; margin: 0 -1rem 1rem; padding: 0 1rem .25rem; }
.raster { border-collapse: separate; border-spacing: 0; width: auto; }
.raster th { padding: .35rem .3rem; font-size: .9rem; font-weight: 700; text-align: center; }
.raster tbody th { position: sticky; left: 0; background: var(--blatt); z-index: 1; padding-right: .6rem; text-align: right; }
.raster td { padding: .2rem; }
.slot-button {
  width: 100%;
  min-width: 5rem;
  min-height: 2.75rem;
  padding: .3rem .4rem;
  font-size: .85rem;
  font-weight: 650;
  border-radius: .6rem;
  transition: background-color .12s ease, color .12s ease;
}
.slot-leer { display: block; text-align: center; color: #b3bacb; }

/* Ab Tablet/Rechner: Navigation ins Kopfband */
@media (min-width: 720px) {
  body { padding-bottom: 2rem; }
  .kopf { height: 3.5rem; padding: 0 max(1rem, calc((100vw - var(--breite)) / 2 + 1rem)); justify-content: space-between; }
  .hauptnav {
    position: static;
    display: flex;
    gap: .25rem;
    align-self: stretch;
    background: transparent;
    border: 0;
    padding: 0;
  }
  .hauptnav a {
    min-height: 0;
    padding: 0 .9rem;
    color: #b9c1dc;
    border-top: 0;
    border-bottom: 3px solid transparent;
  }
  .hauptnav a:hover { color: #fff; }
  .hauptnav a[aria-current="page"] { color: #fff; border-bottom-color: var(--messing); }
  .hauptnav a:focus-visible { outline-color: #fff; outline-offset: -4px; }
  h1 { font-size: 2rem; }
}

@media (max-width: 600px) {
  .formular label { flex-basis: 100%; }
  .formular button { width: 100%; }
  .kennzahlen { grid-template-columns: 1fr; gap: .6rem; }
  .plan-variante td.tag { width: 5.2rem; }
  .plan-variante td, .plan-variante th { padding-inline: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Konten, Login, Nutzer-Menü ---------- */
body.ohne-nav { padding-bottom: 2rem; }

.nutzer { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.nutzer a, .text-knopf {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  padding: 0 .55rem;
  border: 0;
  background: transparent;
  color: #d5daee;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: .5rem;
}
.nutzer a:hover, .text-knopf:hover { background: #ffffff1f; color: #fff; }
.nutzer a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--messing); border-radius: 0; }

.auth-karte { max-width: 24rem; margin: 1.5rem auto 0; }
.stapel { display: flex; flex-direction: column; gap: .9rem; }
.stapel label, .formular label { display: flex; flex-direction: column; gap: .25rem; }
.stapel input[type="email"], .stapel input[type="password"], .stapel input[type="text"] { font-weight: 400; }
label.haken { flex-direction: row; align-items: center; gap: .55rem; font-weight: 500; }
label.haken input { min-height: 0; width: 1.25rem; height: 1.25rem; padding: 0; }
.nebenlink { margin-top: 1.1rem; text-align: center; }

.banner-impersonation {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: .55rem max(1rem, calc((100vw - var(--breite)) / 2 + 1rem));
  background: var(--messing); color: var(--tinte); font-weight: 600;
}
.banner-impersonation button { min-height: 2.25rem; background: var(--tinte); color: #fff; border-color: var(--tinte); }

.marke-klein {
  display: inline-block; margin-left: .35rem; padding: .05rem .5rem;
  border-radius: 1rem; background: #e7ebf8; font-size: .75rem; font-weight: 700; vertical-align: middle;
}
.marke-klein.gesperrt { background: var(--rot-hell); color: var(--rot); }

/* ---------- Schülerliste ---------- */
.karte .zeile-schueler { flex-wrap: wrap; }
.karte .zeile-schueler input[name="name"] { flex: 1 1 10rem; }
.karte .zeile-schueler input[name="email"] { flex: 2 1 12rem; }
.karte .aktionen { flex-wrap: wrap; }
.karte .aktionen form { margin-left: 0; }
.karte .aktionen form:last-child { margin-left: auto; }
.status { margin: .55rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.plakette {
  display: inline-block; padding: .1rem .6rem; border-radius: 1rem;
  background: #eceef4; color: #465069; font-size: .82rem; font-weight: 650;
}
.plakette.ok { background: #dcefe0; color: #1f5a2c; }
.plakette.offen { background: #fdf0d4; color: #7a5410; }
.alle-einladen { margin-bottom: 1rem; }
.zeile-info { margin-bottom: .6rem; }

/* ---------- Zähler und Schüler-Seite ---------- */
.zaehler { font-weight: 700; padding: .5rem .8rem; border-radius: .6rem; background: #fdf0d4; color: #7a5410; }
.zaehler.erreicht { background: #dcefe0; color: #1f5a2c; }
.fertig { margin: 1.25rem 0 .75rem; }
.fertig button { width: 100%; min-height: 3.25rem; font-size: 1.05rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.datenschutz { margin-top: 1.5rem; font-size: .82rem; color: var(--gedaempft); }

/* ---------- Pläne ---------- */
.warnkasten {
  margin: 0 0 1.25rem; padding: .8rem 1rem;
  background: #fdf0d4; border-left: 4px solid var(--messing-dunkel); border-radius: .5rem;
}
.warnkasten ul { margin: .4rem 0 .8rem; padding-left: 1.2rem; }
.aktionen-zeile { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.liste-plaene li { align-items: flex-start; }
.liste-plaene a:not(.knopf) { font-size: 1.05rem; }
.speichern-zeile { margin: -.5rem 0 1.75rem; }
.umbenennen { margin-bottom: 1rem; }

.plan-editor { margin-bottom: 1rem; }
.tag-block h3 { margin: 1.1rem 0 .4rem; font-size: 1rem; }
.slot-zeile {
  display: grid; grid-template-columns: 5.5rem 1fr 1.5rem; gap: .5rem; align-items: center;
  padding: .3rem 0; border-bottom: 1px solid var(--linie);
}
.slot-zeile .uhrzeit { color: var(--tinte); font-size: 1rem; font-variant-numeric: tabular-nums; }
.slot-zeile select { width: 100%; }
.slot-zeile .start-eingabe { width: 100%; }
.slot-zeile .einplanen-knopf { white-space: nowrap; }
.slot-zeile .warn-marke { visibility: hidden; color: var(--rot); font-weight: 700; }
.slot-zeile.warnung .warn-marke { visibility: visible; }
.slot-zeile.warnung select { border-color: var(--rot); background: var(--rot-hell); }
p .warn-marke { color: var(--rot); }

/* Live-Status: geänderte Plakette hebt sich kurz hervor */
.plakette { transition: box-shadow .4s ease; }
.plakette.geaendert { box-shadow: 0 0 0 3px var(--messing); }

.liste-empfaenger li { justify-content: flex-start; font-weight: 400; }
.liste-empfaenger li.ruhig { color: var(--gedaempft); }
.liste-empfaenger label.haken { align-items: flex-start; }
.liste-empfaenger .hinweis { display: block; margin: 0; }
.mail-vorschau {
  white-space: pre-wrap; padding: 1rem; margin: 0 0 1.25rem;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: .75rem;
  font: inherit; font-size: .95rem;
}

@media (min-width: 720px) {
  .kopf .hauptnav { order: 2; margin: 0 auto; }
  .kopf .nutzer { order: 3; margin-left: 0; }
}

/* Erklär-Bausteine: kurze Zeile immer sichtbar, Längeres aufklappbar */
.hilfe { margin: .3rem 0 .9rem; color: var(--gedaempft); font-size: 1rem; line-height: 1.4; }
details.info { margin: 0 0 1rem; }
details.info > summary {
  display: inline-block; cursor: pointer; padding: .5rem .8rem; min-height: 2.75rem; box-sizing: border-box;
  border: 1px solid var(--linie); border-radius: .6rem; background: var(--flaeche);
  color: var(--fokus); font-weight: 650; font-size: 1rem; list-style: none;
}
details.info > summary::-webkit-details-marker { display: none; }
details.info[open] > summary { border-color: var(--fokus); }
details.info > p { margin: .6rem 0 0; padding: .8rem 1rem; background: #eef2ff; border-radius: .6rem; line-height: 1.45; }
.fuss { margin: 2.5rem 0 5.5rem; padding-top: 1rem; border-top: 1px solid var(--linie); text-align: center; font-size: 1rem; }

/* Schüler-Ansicht: feste Leiste, die jederzeit zeigt, ob die Auswahl schon gilt */
.speicherleiste {
  position: sticky; top: 0; z-index: 5; display: flex; gap: .75rem; align-items: flex-start;
  margin: .5rem 0 1rem; padding: .85rem 1rem; border-radius: .75rem; font-size: 1.05rem; font-weight: 650;
  line-height: 1.35; border: 2px solid transparent;
}
.speicherleiste .symbol { font-size: 1.4rem; line-height: 1; }
.speicherleiste.offen { background: #fff6dd; border-color: var(--messing); color: #5c4400; }
.speicherleiste.ok { background: #e8f6ec; border-color: #2e8b57; color: #17502f; }

/* Aktionen mit Erklärung: Knopf und Satz nebeneinander, auf dem Handy untereinander */
.aktionen-liste { margin-top: .5rem; }
.aktion { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: 0 0 .85rem; }
.aktion > .knopf, .aktion > button { flex: 0 0 auto; }
.aktion .hilfe { flex: 1 1 14rem; margin: 0; }

/* Schüler-Liste: kompakte Karten, Weiteres klappt auf */
.uebersicht { margin: 0 0 .75rem; }
.uebersicht-text { margin: 0 0 .4rem; font-size: 1.05rem; }
.schueler-karte { padding: 1rem 0 .85rem; }
.karte-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.karte-kopf .name { margin: 0; font-size: 1.15rem; line-height: 1.25; overflow-wrap: anywhere; }
.karte-kopf .plakette { flex: 0 0 auto; margin-top: .1rem; }
.unterzeile { margin: .15rem 0 .7rem; color: var(--gedaempft); overflow-wrap: anywhere; }
.karte-aktionen { display: flex; flex-wrap: wrap; gap: .5rem; }
.karte-aktionen > .knopf, .karte-aktionen > button, .karte-aktionen > form > button { width: 100%; }
@media (min-width: 480px) {
  .karte-aktionen > .knopf, .karte-aktionen > button, .karte-aktionen > form > button { width: auto; }
}
.karte-mehr { margin-top: .7rem; }
.karte-mehr > summary {
  cursor: pointer; display: inline-block; padding: .5rem 0; min-height: 2.75rem; box-sizing: border-box;
  color: var(--fokus); font-weight: 650; list-style: none;
}
.karte-mehr > summary::-webkit-details-marker { display: none; }
.karte-mehr > summary::before { content: "▸ "; }
.karte-mehr[open] > summary::before { content: "▾ "; }
.karte-mehr > .zeile-schueler { display: grid; gap: .6rem; margin: .4rem 0 1rem; padding: 1rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: .75rem; }
.karte-mehr .zeile-schueler label { display: grid; gap: .25rem; }
.leer { padding: 1.25rem 1rem; background: var(--flaeche); border: 1px dashed #b9c0d3; border-radius: .75rem; }

/* Raster: volle Stunden als ruhige Gliederung, Legende mit Klartext */
.raster tr.volle-stunde th, .raster tr.volle-stunde td { border-top: 1px solid var(--linie); padding-top: .45rem; }
.raster tr.volle-stunde:first-child th, .raster tr.volle-stunde:first-child td { border-top: 0; }
.legende { display: flex; flex-wrap: wrap; gap: .4rem .5rem; margin: 0 0 .9rem; }
.legende span { font-size: .95rem; }
.slot-button:empty::after { content: "\00a0"; }

/* Plan-Editor: freie Blöcke bleiben zugeklappt, bis man einplanen will */
.slot-zeile.frei { display: grid; grid-template-columns: 5.5rem 1fr; gap: .5rem; align-items: start; }
.frei-block > summary {
  cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; color: var(--fokus); font-weight: 650; list-style: none;
}
.frei-block > summary::-webkit-details-marker { display: none; }
.frei-block > summary::before { content: "+"; margin-right: .5rem; font-weight: 800; }
.frei-block[open] > summary::before { content: "–"; }
.karte-aktionen > form { flex: 1 1 100%; }
@media (min-width: 480px) { .karte-aktionen > form { flex: 0 0 auto; } }
.speichern-zeile { margin-top: .75rem; }
.einplanen-form { display: grid; gap: .6rem; margin: .2rem 0 .6rem; padding: .9rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: .75rem; }
.einplanen-form label { display: grid; gap: .25rem; }
.einplanen-form .start-eingabe, .einplanen-form .schueler-auswahl { width: 100%; }
