:root {
  /* Leitfarben aus dem SOFTAID-Logo */
  --akzent: #1b6d7a;
  --akzent-dunkel: #12525c;
  --akzent-mittel: #2e8493;
  --akzent-hell: #e4f1f4;
  --akzent-blass: #8cc6d0;
  /* Rot bleibt für Löschen und Fehler reserviert */
  --gefahr: #c62828;
  --gefahr-dunkel: #9d1f1f;
  --gefahr-hell: #fdeceb;
  --gruen: #1a7f4b;
  --gruen-hell: #e7f5ed;
  --text: #1c2530;
  --text-schwach: #63707f;
  --linie: #e2e7ec;
  --flaeche: #ffffff;
  --hintergrund: #f4f6f9;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--hintergrund);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--akzent); }

.schwach { color: var(--text-schwach); }
.klein { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mt { margin-top: 1rem; }
.mt2 { margin-top: 1.75rem; }
.zentriert { text-align: center; }
.versteckt { display: none !important; }

/* ---------- Kopfzeile ---------- */

.kopf {
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 20;
}

.kopf-innen {
  max-width: 1140px;
  margin: 0 auto;
  padding: .5rem 1.25rem;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 1rem 1.5rem;
  /* Bei schmalen Fenstern rutscht die Navigation in eine zweite Zeile,
     statt die Marke zu überlagern. */
  flex-wrap: wrap;
}

.marke {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

/* Bildmarke aus dem Logo, ohne Schriftzug */
.marke-zeichen {
  width: 32px;
  height: 32px;
  display: block;
  flex: 0 0 auto;
}

/* Vollständiges Logo mit Schriftzug (Anmeldeseite) */
.marke-logo {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  margin: 0 auto;
}

.navigation { display: flex; gap: .25rem; margin-left: auto; align-items: center; flex-wrap: wrap; }

.navigation a {
  padding: .45rem .7rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-schwach);
  font-weight: 550;
  font-size: .92rem;
}
.navigation a:hover { background: var(--hintergrund); color: var(--text); }
.navigation a.aktiv { background: var(--akzent-hell); color: var(--akzent-dunkel); }

/* Zweite Leiste mit den Unterpunkten eines Bereichs */
.unterleiste {
  background: var(--akzent-hell);
  border-top: 1px solid var(--linie);
}
.unterleiste-innen {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  gap: .2rem;
  flex-wrap: wrap;
}
.unterleiste a {
  padding: .5rem .7rem;
  text-decoration: none;
  color: var(--akzent-dunkel);
  font-size: .88rem;
  font-weight: 550;
  border-bottom: 2px solid transparent;
}
.unterleiste a:hover { border-bottom-color: var(--akzent-blass); }
.unterleiste a.aktiv { border-bottom-color: var(--akzent); font-weight: 700; }

.nutzer-chip {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding-left: 1rem;
  margin-left: .5rem;
  border-left: 1px solid var(--linie);
}

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #dbe3ec;
  color: #48576a;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700;
}

/* ---------- Layout ---------- */

.inhalt { max-width: 1140px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.schmal { max-width: 760px; }

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1.25rem;
}

.gitter { display: grid; gap: 1rem; }
.gitter-3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.gitter-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.reihe { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.reihe-ende { margin-left: auto; }
.titelzeile { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.titelzeile h1 { margin: 0; }

/* ---------- Kennzahlen ---------- */

.kennzahl { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.1rem; }
.kennzahl .wert { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.kennzahl .bezeichnung { color: var(--text-schwach); font-size: .85rem; }

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

label { display: block; font-size: .87rem; font-weight: 600; margin-bottom: .3rem; color: #3b4655; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=file], select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid #cfd7e0;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: inherit;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px rgba(27, 109, 122, .15);
}
.feld { margin-bottom: .9rem; }
.feld-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }

.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: auto; }

/* ---------- Schaltflächen ---------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem .95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--akzent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.knopf:hover { background: var(--akzent-dunkel); }
.knopf:disabled { opacity: .55; cursor: not-allowed; }
.knopf.sekundaer { background: #fff; color: var(--text); border-color: #cfd7e0; }
.knopf.sekundaer:hover { background: var(--hintergrund); }
.knopf.gruen { background: var(--gruen); }
.knopf.gruen:hover { background: #15683d; }
.knopf.gefahr { background: #fff; color: var(--gefahr); border-color: #f0c4c4; }
.knopf.gefahr:hover { background: var(--gefahr-hell); }
.knopf.klein { padding: .32rem .6rem; font-size: .85rem; }
.knopf.breit { width: 100%; }

/* ---------- Marken / Status ---------- */

.marke-etikett {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 650;
  background: var(--hintergrund);
  color: var(--text-schwach);
  border: 1px solid var(--linie);
}
.marke-etikett.gruen { background: var(--gruen-hell); color: var(--gruen); border-color: #c6e6d5; }
.marke-etikett.rot { background: var(--gefahr-hell); color: var(--gefahr-dunkel); border-color: #f4cfcf; }
.marke-etikett.grau { background: #eef1f5; }
.marke-etikett.akzent { background: var(--akzent-hell); color: var(--akzent-dunkel); border-color: var(--akzent-blass); }
.marke-etikett.gelb { background: #fdf4e3; color: #8a5a00; border-color: #f0dcb4; }

/* ---------- Fortschritt ---------- */

.balken { height: 7px; background: #e6eaef; border-radius: 999px; overflow: hidden; }
.balken > span { display: block; height: 100%; background: var(--gruen); border-radius: 999px; transition: width .3s; }
.balken.rot > span { background: var(--gefahr); }

/* ---------- Kurskarten ---------- */

.kurskarte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.kurskarte:hover { border-color: #c9d2dc; transform: translateY(-1px); }
.kurskarte h3 { margin: 0; }

/* ---------- Listen / Lektionen ---------- */

.liste { border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); overflow: hidden; }
.listenzeile {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem 1rem;
  /* Zeilen sind teils <button>: den Standardrahmen des Browsers abschalten. */
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--linie);
  background: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  /* Zeilen sind teils <a>: die Unterstreichung gehört hier nicht hin. */
  text-decoration: none;
}
.listenzeile:hover { background: #fafbfc; }
.listenzeile:last-child { border-bottom: none; }

/* Der Textblock einer Zeile: darf schrumpfen, bricht aber vor dem Zerfleddern um. */
.zeilentext { flex: 1 1 13rem; min-width: 0; }
/* Bei schmalen Fenstern rutschen Marken und Schaltflächen in eine zweite Zeile. */
@media (max-width: 720px) {
  .listenzeile { flex-wrap: wrap; }
  .zeilentext { flex-basis: 100%; }
}
.listenzeile:hover { background: #fafbfc; }
.listenzeile.aktiv { background: var(--akzent-hell); }
.listenzeile .titel { font-weight: 600; }

.typ-symbol {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--hintergrund);
  font-size: 15px;
  flex: 0 0 auto;
}

.haken {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #cfd7e0;
  display: grid; place-items: center;
  flex: 0 0 auto;
  font-size: 12px;
  color: transparent;
}
.haken.erledigt { background: var(--gruen); border-color: var(--gruen); color: #fff; }

/* ---------- Kursansicht ---------- */

.kurs-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .kurs-layout { grid-template-columns: 1fr; } }

.viewer { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }
.viewer-kopf { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--linie); }
.viewer-koerper { padding: 1.25rem; }
.viewer-fuss { padding: 1rem 1.25rem; border-top: 1px solid var(--linie); background: #fafbfc; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.viewer video, .viewer img.inhalt-bild { width: 100%; display: block; background: #000; max-height: 70vh; object-fit: contain; }
.viewer iframe { width: 100%; height: 72vh; border: 0; display: block; }
.textinhalt { white-space: pre-wrap; line-height: 1.7; }

/* ---------- Standortanleitungen ---------- */

/* Standortliste innerhalb einer Stadtkarte */
.ortliste { display: flex; flex-direction: column; gap: .3rem; margin-top: .3rem; }
.ortlink {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; border-radius: 8px;
  border: 1px solid var(--linie);
  text-decoration: none; color: inherit;
}
.ortlink:hover { background: var(--akzent-hell); border-color: var(--akzent-blass); }

/* Seitenverzeichnis links neben den Rubriken */
.verzeichnis {
  position: sticky; top: 76px;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: .75rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.verzeichnis-titel {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-schwach); font-weight: 700;
  padding: .3rem .5rem;
}
.verzeichnis a {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .5rem; border-radius: 7px;
  text-decoration: none; color: var(--text);
  font-size: .9rem;
}
.verzeichnis a:hover { background: var(--akzent-hell); color: var(--akzent-dunkel); }
@media (max-width: 900px) { .verzeichnis { position: static; } }

/* Eine Rubrik als eigene Karte */
.abschnitt {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  margin-bottom: 1rem;
  scroll-margin-top: 80px;
  overflow: hidden;
}
.abschnitt-kopf {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--linie);
  background: var(--akzent-hell);
}
.abschnitt-kopf h2 { margin: 0; font-size: 1.02rem; color: var(--akzent-dunkel); }
.abschnitt-symbol { font-size: 1.05rem; }
.abschnitt-koerper { padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }

/* Ein einzelner Baustein innerhalb einer Rubrik */
.baustein + .baustein { border-top: 1px dashed var(--linie); padding-top: 1.25rem; }
.baustein-titel { font-weight: 650; margin-bottom: .4rem; }
.baustein-bild {
  display: block; max-width: 100%; height: auto;
  border-radius: 8px; border: 1px solid var(--linie);
}
.baustein-video { width: 100%; border-radius: 8px; background: #000; max-height: 60vh; }
.baustein-pdf {
  border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; background: #f7f8fa;
}
.baustein-pdf iframe { width: 100%; height: 480px; border: 0; display: block; }

/* Verwaltung: Rubrik mit noch leerem Inhalt */
.abschnitt.leer-rubrik .abschnitt-kopf { background: var(--hintergrund); }
.abschnitt.leer-rubrik .abschnitt-kopf h2 { color: var(--text-schwach); }

.trennlinie { height: 1px; background: var(--linie); margin: 1.25rem 0; }

/* Zeitpunkt, seit dem ein Stammdatum so gesetzt ist */
.zeitstempel {
  margin: .35rem 0 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gruen);
}
.zeitstempel-inline {
  display: inline-block;
  margin-left: .5rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gruen);
  white-space: nowrap;
}

/* Feld, das die Person nicht selbst ändern darf */
.nur-lesen {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .55rem .7rem;
  border: 1px dashed #d3dae2;
  border-radius: 8px;
  background: #f7f9fb;
  min-height: 40px;
}
.nur-lesen > span:first-child { flex: 1; min-width: 0; }

/* ---------- Speicherleiste im Stammdatenblatt ---------- */

.speicherleiste {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  /* Volle Breite der Karte abdecken, damit nichts durchscheint. */
  margin: 0 -1.25rem -1rem;
  padding: .9rem 1.25rem;
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
  box-shadow: 0 -6px 16px rgba(16, 24, 40, .07);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- Einarbeitung: Fortschrittsliste ---------- */

.schritt {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  margin-bottom: 1rem;
  overflow: hidden;
}
.schritt.offen { opacity: .6; box-shadow: none; }
.schritt.aktiv { border-color: var(--akzent); box-shadow: 0 0 0 3px rgba(27, 109, 122, .1); }
.schritt.erledigt .schritt-kopf { background: var(--gruen-hell); }

.schritt-kopf {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1.15rem;
  border-bottom: 1px solid var(--linie);
  flex-wrap: wrap;
}
.schritt.offen .schritt-kopf { border-bottom: none; }
.schritt-kopf h2 { margin: 0; font-size: 1.03rem; }
.schritt-koerper { padding: 1.15rem; }

.schritt-nummer {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid; place-items: center;
  background: #e6ebf0;
  color: #55636f;
  font-weight: 700;
  font-size: .95rem;
}
.schritt-nummer.fertig { background: var(--gruen); color: #fff; }

.termin-kasten {
  border: 1px solid var(--akzent-blass);
  background: var(--akzent-hell);
  border-radius: 9px;
  padding: .8rem 1rem;
}
.termin-wann { font-weight: 650; color: var(--akzent-dunkel); }

.upload-feld { margin-top: .5rem; }
.upload-feld label { font-size: .82rem; }

/* ---------- Feedback ---------- */

.feedback-karte.neu {
  border-left: 4px solid var(--akzent);
  background: linear-gradient(90deg, var(--akzent-hell) 0 4px, var(--flaeche) 4px);
}

/* ---------- Abrechnung ---------- */

.rechts { text-align: right; }
.betont { font-weight: 650; }

/* Erfassungstabelle der Leistungstage */
.mitte { text-align: center; }

.erfassung th { white-space: nowrap; }
.erfassung td { padding: .35rem .5rem; vertical-align: middle; }
.erfassung input, .erfassung select { padding: .35rem .5rem; font-size: .9rem; }
.erfassung .menge-feld { width: 4.2rem; text-align: right; }
.erfassung input[type=date] { width: 8.5rem; }
.erfassung input[type=checkbox] { width: auto; transform: scale(1.15); cursor: pointer; }

/* Gruppenzeile über den Spalten */
.erfassung .gruppen th {
  border-bottom: 1px solid var(--linie);
  padding-bottom: .3rem;
  font-size: .72rem;
  color: var(--akzent-dunkel);
  background: var(--akzent-hell);
}
.erfassung .gruppen th + th { border-left: 1px solid var(--akzent-blass); }

.erfassung tfoot td {
  border-top: 2px solid var(--linie);
  background: var(--hintergrund);
  padding: .55rem .5rem;
}

/* Zeile zum Anlegen eines neuen Kurstags */
.erfassung .neu-zeile td { background: var(--hintergrund); }
.erfassung .neu-zeile { border-top: 1px dashed var(--linie); }

/* Zusammenklappbare Rechnung */
.rechnung-klappe > summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  padding: .7rem 1rem;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  font-weight: 650;
  list-style: none;
}
.rechnung-klappe > summary::-webkit-details-marker { display: none; }
.rechnung-klappe > summary::before { content: '▸'; color: var(--text-schwach); }
.rechnung-klappe[open] > summary::before { content: '▾'; }
.rechnung-klappe > summary .schwach { margin-left: auto; }

/* Die Rechnung als Dokument */
.rechnung {
  background: #fff;
  padding: 2.25rem 2.5rem 2.75rem;
  color: #111;
  font-size: .95rem;
}
.rechnung-absender {
  border-bottom: 1px solid #111;
  padding-bottom: .25rem;
  margin-bottom: 2rem;
  font-size: .9rem;
}
.rechnung-empfaenger { line-height: 1.5; margin-bottom: 2rem; }
.rechnung-kopf {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  align-items: center;
  border: 1px solid #111;
  padding: .75rem 1rem;
  margin-bottom: 2rem;
}
.rechnung-titel { font-size: 1.25rem; font-weight: 700; }
.rechnung-wert {
  background: var(--akzent-hell);
  padding: .2rem .5rem;
  font-weight: 650;
  display: inline-block;
  margin-top: .15rem;
}
.rechnung-tabelle { width: 100%; border-collapse: collapse; }
.rechnung-tabelle th {
  text-transform: none;
  letter-spacing: 0;
  font-size: .95rem;
  color: #111;
  border-bottom: 1px solid #111;
  padding: .4rem .5rem;
}
.rechnung-tabelle td { border: 0; padding: .35rem .5rem; }
.rechnung-tabelle tr.schwach td { color: #8a949e; }
.rechnung-summe {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 2px solid #111;
  margin-top: .5rem;
  padding: 1rem .5rem 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.rechnung-summe .betrag { border-bottom: 3px double #111; padding-bottom: .15rem; }
.rechnung-fuss { margin-top: 2.5rem; font-size: .88rem; line-height: 1.55; }
.rechnung-fuss p { margin: 0 0 .35rem; }

/* Beim Drucken bleibt nur die Rechnung übrig. */
@media print {
  body { background: #fff; }
  .kopf, .navigation, .titelzeile, .tabellenrahmen, h2, .reihe, .meldung,
  .hinweis-toast, .dialog-hintergrund { display: none !important; }
  .inhalt { max-width: none; padding: 0; }
  .karte { border: 0; box-shadow: none; padding: 0; }
  .rechnung { padding: 0; }
  .rechnung-wert { background: none; border-bottom: 1px solid #111; }
}

/* ---------- Bewertung / Ampel ---------- */

.ampel {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .15rem .55rem .15rem .4rem;
  border-radius: 999px;
  font-size: .78rem; font-weight: 650;
  border: 1px solid transparent; white-space: nowrap;
}
.ampel .licht { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.ampel.gruen { background: var(--gruen-hell); color: var(--gruen); border-color: #c6e6d5; }
.ampel.gruen .licht { background: #1a7f4b; }
.ampel.gelb  { background: #fdf4e3; color: #8a5b06; border-color: #f0dcb4; }
.ampel.gelb  .licht { background: #e3a008; }
.ampel.rot   { background: var(--gefahr-hell); color: var(--gefahr-dunkel); border-color: #f4cfcf; }
.ampel.rot   .licht { background: #c62828; }

.punktestand { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.punkte-plus  { color: var(--gruen); }
.punkte-minus { color: var(--gefahr); }
.punkte-null  { color: var(--text-schwach); }

/* Punktebadge an einem Akteneintrag */
.punkte-marke {
  min-width: 46px; text-align: center;
  padding: .2rem .5rem; border-radius: 7px;
  font-weight: 700; font-size: .85rem; flex: 0 0 auto;
}
.punkte-marke.plus  { background: var(--gruen-hell); color: var(--gruen); }
.punkte-marke.minus { background: var(--gefahr-hell); color: var(--gefahr-dunkel); }
.punkte-marke.null  { background: #eef1f5; color: var(--text-schwach); }

/* Schnellknöpfe für die Bewertungsgründe */
.gruende { display: flex; flex-wrap: wrap; gap: .5rem; }
.grund-knopf {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .8rem; border-radius: 9px;
  border: 1px solid #cfd7e0; background: #fff;
  font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.grund-knopf:hover { background: var(--hintergrund); border-color: #b6c1cd; }
.grund-knopf .wert { font-weight: 700; font-size: .85rem; }
.grund-knopf.plus  { border-color: #c6e6d5; }
.grund-knopf.plus .wert  { color: var(--gruen); }
.grund-knopf.plus:hover  { background: var(--gruen-hell); }
.grund-knopf.minus { border-color: #f0c4c4; }
.grund-knopf.minus .wert { color: var(--gefahr); }
.grund-knopf.minus:hover { background: var(--gefahr-hell); }

/* Anklickbare Zeile in der Auswertung */
tr.klickbar { cursor: pointer; }
tr.klickbar:hover td { background: #fafbfc; }

/* ---------- Tabellen ---------- */

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--linie); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-schwach); font-weight: 650; }
tbody tr:last-child td { border-bottom: none; }
.tabellenrahmen { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); overflow-x: auto; }

/* Breite Tabellen: Name links und Schaltflächen rechts bleiben beim seitlichen
   Scrollen stehen. Ohne das verschwinden gerade die Knöpfe aus dem Blick. */
.tabellenrahmen.haftend-links th:first-child,
.tabellenrahmen.haftend-links td:first-child,
.tabellenrahmen.haftend-rechts th:last-child,
.tabellenrahmen.haftend-rechts td:last-child {
  position: sticky;
  background: var(--flaeche);
  z-index: 1;
}
.tabellenrahmen.haftend-links th:first-child,
.tabellenrahmen.haftend-links td:first-child { left: 0; box-shadow: 1px 0 0 var(--linie); }
.tabellenrahmen.haftend-rechts th:last-child,
.tabellenrahmen.haftend-rechts td:last-child { right: 0; box-shadow: -1px 0 0 var(--linie); }

/* Auf schmalen Geräten würden die haftenden Spalten fast die ganze Breite
   belegen – dort wird die Tabelle wieder ganz normal seitlich geschoben. */
@media (max-width: 820px) {
  .tabellenrahmen.haftend-links th:first-child,
  .tabellenrahmen.haftend-links td:first-child,
  .tabellenrahmen.haftend-rechts th:last-child,
  .tabellenrahmen.haftend-rechts td:last-child {
    position: static;
    box-shadow: none;
  }
}

/* Beim Überfahren der Zeile färben sich auch die haftenden Zellen mit. */
.tabellenrahmen tr.klickbar:hover th:first-child,
.tabellenrahmen tr.klickbar:hover td:first-child,
.tabellenrahmen tr.klickbar:hover td:last-child { background: #fafbfc; }

/* ---------- Anmeldung ---------- */

.anmeldung-seite { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, #f4f9fa, #dfeef1); }
.anmeldung-box { width: 100%; max-width: 400px; }
.anmeldung-box .karte { padding: 1.75rem; }

/* ---------- Dialog ---------- */

.dialog-hintergrund {
  position: fixed; inset: 0;
  background: rgba(16, 24, 40, .45);
  display: grid; place-items: center;
  padding: 1.5rem;
  z-index: 50;
  overflow-y: auto;
}
.dialog {
  background: var(--flaeche);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
  margin: auto;
}
.dialog-kopf { padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--linie); display: flex; align-items: center; }
.dialog-kopf h2 { margin: 0; font-size: 1.1rem; }
.dialog-koerper { padding: 1.35rem; }
.dialog-fuss { padding: 1rem 1.35rem; border-top: 1px solid var(--linie); display: flex; gap: .6rem; justify-content: flex-end; background: #fafbfc; border-radius: 0 0 12px 12px; }
.schliessen { margin-left: auto; background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text-schwach); }

/* ---------- Meldungen ---------- */

.meldung { padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.meldung.fehler { background: var(--gefahr-hell); color: var(--gefahr-dunkel); border: 1px solid #f4cfcf; }
.meldung.erfolg { background: var(--gruen-hell); color: var(--gruen); border: 1px solid #c6e6d5; }
.meldung.info { background: #eef4fb; color: #1b4f80; border: 1px solid #cfe0f2; }

.hinweis-toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: #1c2530; color: #fff;
  padding: .7rem 1.1rem; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .25);
  z-index: 100; font-size: .9rem;
  animation: hoch .25s ease-out;
}
.hinweis-toast.fehler { background: var(--gefahr-dunkel); }
@keyframes hoch { from { opacity: 0; transform: translate(-50%, 10px); } }

.leer { text-align: center; padding: 3rem 1.5rem; color: var(--text-schwach); }
.leer .symbol { font-size: 2.4rem; margin-bottom: .5rem; }

.zieh-griff { cursor: grab; color: #b4bfcb; user-select: none; padding: 0 .2rem; }
.listenzeile.zieht { opacity: .45; }

/* --- Nur Leserechte -------------------------------------------------------
   Bereiche, in denen eine Mitarbeiterin oder ein Mitarbeiter nur lesen darf.
   Der Server weist Änderungen ohnehin zurück; hier verschwinden die
   Schaltflächen, damit erst gar kein falscher Eindruck entsteht. Zeilen, die
   nur weiterführen (.listenzeile) und ausdrücklich als lesend gekennzeichnete
   Schaltflächen (data-lesen) bleiben nutzbar. */
#ansicht.nur-ansehen::before {
  content: "Nur Leserechte – Sie können diesen Bereich ansehen, aber nichts ändern.";
  display: block;
  background: var(--akzent-hell);
  color: var(--akzent-dunkel);
  border-bottom: 1px solid var(--akzent-blass);
  padding: .5rem 1.5rem;
  font-size: .85rem;
  font-weight: 600;
}

#ansicht.nur-ansehen button:not([data-lesen]):not(.listenzeile) { display: none !important; }

#ansicht.nur-ansehen form input,
#ansicht.nur-ansehen form select,
#ansicht.nur-ansehen form textarea {
  pointer-events: none;
  background: #f7f9fb;
  color: var(--text-schwach);
}

/* ---------- Tickets ---------- */

/* Notfall-Nummer über dem Ticketbereich der Dozenten */
.notfall {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--gefahr-hell);
  border: 1px solid #f4cfcf;
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin-bottom: 1.25rem;
}
.notfall-symbol { font-size: 1.6rem; line-height: 1; }
.notfall-nummer { font-size: 1.15rem; font-weight: 700; letter-spacing: .01em; }
.notfall-nummer a { color: var(--gefahr-dunkel); text-decoration: none; }
.notfall-nummer a:hover { text-decoration: underline; }

/* Gesprächsfaden */
.ticket-verlauf { display: flex; flex-direction: column; gap: .75rem; }

.ticket-nachricht {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  max-width: 85%;
}
/* Eigene Beiträge stehen rechts und farbig – wie in einem Chat */
.ticket-nachricht.eigen {
  margin-left: auto;
  background: var(--akzent-hell);
  border-color: var(--akzent-blass);
}
.ticket-kopf { margin-bottom: .3rem; }
.ticket-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.ticket-dateien { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.ticket-bild img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--linie);
  display: block;
}
.ticket-anhang {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--hintergrund);
  text-decoration: none;
  color: inherit;
  font-size: .88rem;
}
.ticket-anhang:hover { background: #eef2f6; }

@media (max-width: 620px) {
  .ticket-nachricht { max-width: 100%; }
}

/* Dringlichkeit auf einen Blick: farbiger Streifen und leichte Tönung.
   Die Zuordnung der Farben steht in src/tickets.js. */
.dring-sofort   { border-left: 4px solid var(--gefahr) !important; background: #fef6f6; }
.dring-dringend { border-left: 4px solid #e0a33a !important; background: #fefaf2; }
.dring-normal   { border-left: 4px solid var(--akzent-blass) !important; }

.listenzeile.dring-sofort:hover   { background: #fdeceb; }
.listenzeile.dring-dringend:hover { background: #fdf4e3; }

/* Kopfbereich eines geöffneten Tickets */
.ticket-kopfband {
  padding: .9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--linie);
  margin-bottom: 1rem;
}
