/* Ergaenzungen des Admin-Portals zu style.css.
   style.css bleibt unveraendert und wird zuerst eingebunden; hier stehen NUR
   Bausteine, die es dort noch nicht gibt. Alles, was style.css schon mitbringt,
   wird direkt benutzt statt nachgebaut:
     .kennzahlen/.kennzahl/.kennzahl-wert/.kennzahl-label  Kennzahlenkacheln
     .progress-bar/.progress-bar-gross/.progress-fill      Fortschrittsbalken
     .status-badge/.status-bestanden/.status-arbeit/…      Zustandsmarken
     .abschnitt-titel, .hint, .empty-state, .pagination    Textbausteine
   Farben kommen ausschliesslich aus den CSS-Variablen von style.css
   beziehungsweise aus deren Farbvokabular, damit der Dunkelmodus mitgeht. */

/* ---------------- Hinweis fuer Nicht-Administratoren ---------------- */

.zugriff-sperre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--hot);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin-top: 32px;
}
.zugriff-sperre p { font-size: 14px; line-height: 1.6; color: var(--text); }
.zugriff-sperre a { color: var(--sap-blue); font-weight: 600; }

/* ---------------- Rueckmeldungen ---------------- */
/* Jede Aktion meldet sich sichtbar zurueck — blau bei Erfolg, rot bei Fehler. */

.meldung {
  font-size: 13px;
  line-height: 1.5;
  margin: 8px 0 12px;
  color: var(--text-muted);
}
.meldung-ok { color: var(--sap-blue); font-weight: 600; }
.meldung-fehler { color: var(--hot); font-weight: 600; }

/* ---------------- Formularbeschriftungen ---------------- */
/* "feld-inline" fuer Beschriftungen in einer Zeile, "feld-block" fuer Felder
   mit einer Erklaerung darunter (Reiter "Einstellungen"). */

.feld-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.feld-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sap-dark);
  /* Die Breite gibt das Raster von .grid-form vor; "min-width: 0" verhindert,
     dass ein langer Inhalt die Spalte aufblaeht. */
  min-width: 0;
}
.feld-block .hint { font-weight: 400; margin: 0; line-height: 1.5; }
.feld-block > input, .feld-block > select, .feld-block > textarea { width: 100%; }
/* Felder ueber die ganze Formularbreite (lange Notizen, Mehrfachauswahlen). */
.feld-breit { grid-column: 1 / -1; }
/* Mehrfachauswahlen mit langen Zeilen duerfen zwei Spalten belegen, sobald es
   die ueberhaupt gibt — deshalb die Fensterbedingung: In einem einspaltigen
   Raster wuerde "span 2" eine zweite Spalte erzwingen und die Seite sprengen. */
@media (min-width: 900px) {
  .feld-zwei-spalten { grid-column: span 2; }
}
.grid-form > button[type="submit"] { justify-self: start; align-self: start; }

select[multiple] {
  min-height: 170px;
  padding: 6px;
  background: var(--surface);
  color: var(--text);
}
select[multiple] option { padding: 4px 6px; }

/* ---------------- Ergaenzungen zu vorhandenen Bausteinen ---------------- */

/* Der Zahlenwert der Kennzahlkacheln wird im Admin-Portal groesser gesetzt als
   in der Lernansicht — die Uebersicht lebt von diesen vier Zahlen. */
.kennzahlen-admin { margin-top: 0; margin-bottom: 8px; }
.kennzahl-gross { font-size: 30px; line-height: 1.15; color: var(--sap-blue); }

/* style.css kennt gruene und orange Zustandsmarken, aber keine rote. */
.status-rot {
  background: #fdeaea;
  color: var(--hot);
  border-color: #eccaca;
}
[data-theme="dark"] .status-rot { background: #331c1c; color: #e58080; border-color: #5a2a2a; }

/* Gestaltung der Knopfreihe am Zeilenende: siehe weiter unten im Abschnitt
   "Seitenbreite" — dort darf sie umbrechen statt die Tabelle zu sprengen. */

/* ---------------- Übersicht: Balken je Unit ---------------- */
/* Reines HTML und CSS: die Fuellung ist ein Element mit prozentualer Breite,
   die Balken selbst sind .progress-bar/.progress-fill aus style.css. */

.balken-liste {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.balken-zeile {
  display: grid;
  grid-template-columns: 64px 1fr 92px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}
.balken-label { font-size: 12.5px; font-weight: 600; color: var(--sap-dark); }
.balken-wert { font-size: 12.5px; color: var(--text-muted); text-align: right; }

/* Schmaler Balken in einer Tabellenzelle (Reiter "Zuweisungen"). */
.mini-balken {
  display: inline-block;
  vertical-align: middle;
  width: 90px;
  margin-right: 8px;
}
.mini-wert { font-size: 12.5px; color: var(--text-muted); }

/* ---------------- Fortschrittsmatrix ---------------- */

.legende {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.legende-eintrag { display: flex; align-items: center; gap: 6px; }
.m-punkt {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Bei vielen Units waagrecht scrollbar statt gequetscht. */
.matrix-rahmen { overflow-x: auto; }
table.matrix-tabelle { min-width: 720px; }
table.matrix-tabelle th, table.matrix-tabelle td { padding: 7px 8px; font-size: 12.5px; }
table.matrix-tabelle th.spalte-unit,
table.matrix-tabelle td.m-zelle { text-align: center; width: 62px; }
table.matrix-tabelle th.spalte-zahl,
table.matrix-tabelle td.spalte-zahl { text-align: right; white-space: nowrap; }
table.matrix-tabelle td.spalte-name { font-weight: 600; white-space: nowrap; }

tr.zeile-klickbar { cursor: pointer; }
tr.zeile-klickbar:hover td { background: var(--surface-alt); }

/* Zustandsfarben der Zellen — dasselbe Farbvokabular wie die Zustandsmarken
   und Quizergebnisse in style.css, damit die Matrix nicht aus der Reihe faellt. */
.m-zelle { font-weight: 700; font-variant-numeric: tabular-nums; cursor: help; }
.m-offen { background: var(--surface-hover); color: var(--text-muted); }
.m-arbeit { background: #fdf0e6; color: #99461a; }
.m-bestanden { background: #eaf4ea; color: #1d5c22; }
.m-durchgefallen { background: #fdeaea; color: var(--hot); }
[data-theme="dark"] .m-arbeit { background: #33261a; color: #e8a05c; }
[data-theme="dark"] .m-bestanden { background: #1a2e1c; color: #7fd184; }
[data-theme="dark"] .m-durchgefallen { background: #331c1c; color: #e58080; }

/* Die Legendenpunkte tragen dieselben Klassen wie die Zellen. */
.m-punkt.m-offen { background: var(--low); }
.m-punkt.m-arbeit { background: #99461a; }
.m-punkt.m-bestanden { background: #1d5c22; }
.m-punkt.m-durchgefallen { background: var(--hot); }
[data-theme="dark"] .m-punkt.m-arbeit { background: #e8a05c; }
[data-theme="dark"] .m-punkt.m-bestanden { background: #7fd184; }
[data-theme="dark"] .m-punkt.m-durchgefallen { background: #e58080; }

/* ---------------- Einladungslink ---------------- */

.link-kasten {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 5px solid var(--sap-blue);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.link-kasten .hint { margin-top: 0; }
.link-zeile { display: flex; gap: 8px; flex-wrap: wrap; }
.link-zeile input {
  flex: 1 1 360px;
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 12.5px;
  background: var(--surface);
  color: var(--text);
}

/* ---------------- Dialoge ---------------- */

dialog.admin-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  background: var(--surface);
  color: var(--text);
  padding: 24px 26px;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: auto;
}
dialog.admin-dialog-breit { width: min(980px, 94vw); }
dialog.admin-dialog::backdrop { background: rgba(0,0,0,0.45); }
dialog.admin-dialog h3 {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--sap-dark);
}
.dialog-felder { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.dialog-fuss {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

table.detail-tabelle { box-shadow: none; margin-bottom: 4px; }
table.detail-tabelle th, table.detail-tabelle td { padding: 7px 10px; font-size: 12.5px; }

/* ---------------- Schmale Fenster ---------------- */

@media (max-width: 560px) {
  .balken-zeile { grid-template-columns: 54px 1fr 76px; }
  /* Auf sehr schmalen Schirmen steht jedes Feld allein in der Zeile. */
  .grid-form { grid-template-columns: 1fr; }
}

/* Kurs-Kürzel in der Benutzerliste: kompakt, weil eine Person in mehreren
   Kursen stecken kann und die Spalte sonst die Tabelle sprengen würde. */
.kurs-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--surface-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.kurs-chip.ist-aktiv {
  background: #eaf2fb;
  color: var(--sap-blue-dark);
  border-color: #b6d4f0;
}
[data-theme="dark"] .kurs-chip.ist-aktiv {
  background: #1b3552;
  color: #9ec5ec;
  border-color: #2d5a85;
}

/* =========================================================================
   Kurskacheln, Diagramme, Inhalts-Editor und Meldungen
   ========================================================================= */

/* ---------------- Kurskacheln ---------------- */
.admin-kursliste {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 18px;
  margin: 16px 0 26px;
}
.admin-kurs-karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--sap-blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.admin-kurs-karte:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.10), 0 6px 18px rgba(0,0,0,0.07);
  transform: translateY(-1px);
}
.admin-kurs-karte .kurs-kopf {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.admin-kurs-karte .kurs-kopf-text { min-width: 0; }
.admin-kurs-karte .kurs-stufe {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--sap-blue);
}
.admin-kurs-karte .kurs-titel {
  margin: 3px 0 0; font-size: 17px; font-weight: 700;
  color: var(--sap-dark); cursor: pointer;
}
.admin-kurs-karte .kurs-titel:hover { color: var(--sap-blue); }
.admin-kurs-karte .kurs-untertitel { margin: 4px 0 0; font-size: 12.5px; color: var(--text-muted); }
.admin-kurs-karte .kurs-daten {
  list-style: none; margin: 0 0 14px; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px;
}
.admin-kurs-karte .kurs-daten li {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--border);
}
.admin-kurs-karte .kurs-daten li span { color: var(--text-muted); }
.admin-kurs-karte .unit-fortschritt { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.admin-kurs-karte .unit-fortschritt .progress-bar { flex: 1; }
.admin-kurs-karte .unit-fortschritt-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.admin-kurs-karte .kurs-fuss { margin-top: auto; }

/* Zeile mit dem gewählten Kurs — sie ersetzt die frühere Dropdown-Leiste und
   sagt, worauf sich die Ansicht darunter bezieht. */
.kurs-kontext {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sap-blue);
  border-radius: var(--radius);
}
.kurs-kontext strong { font-size: 15px; }

/* ---------------- Diagramme ---------------- */
.diagramm-karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 24px;
}
.diagramm-legende { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 16px; }
.diagramm-legende .legende-eintrag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-muted);
}
.legende-farbe {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0;
}

/* Gestapelter Balken je Kurs. Die 2 Pixel Abstand zwischen den Abschnitten sind
   Absicht: sie halten die Abschnitte auch dann auseinander, wenn die Farben für
   jemanden schwer zu unterscheiden sind. */
.stapel-zeile {
  display: grid;
  grid-template-columns: minmax(140px, 260px) 1fr 46px;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.stapel-label {
  font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stapel-balken {
  display: flex; height: 26px; border-radius: 4px; overflow: hidden;
  background: var(--surface-hover); gap: 2px;
}
.stapel-teil {
  display: flex; align-items: center; justify-content: center;
  min-width: 2px; transition: width 0.25s ease;
}
.stapel-zahl { color: #fff; font-size: 12px; font-weight: 700; }
.stapel-summe { font-size: 13px; font-weight: 700; text-align: right; }

/* Waagrechte Balken für einen Grössenvergleich, Wert direkt am Ende. */
.balken-zeile2 {
  display: grid;
  grid-template-columns: minmax(110px, 240px) 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.balken-label2 {
  font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.balken-spur { background: var(--surface-hover); border-radius: 4px; height: 20px; }
.balken-wert2 { display: block; height: 100%; border-radius: 4px; transition: width 0.25s ease; }
.balken-zahl { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* ---------------- Benutzerdialog: Kurse ---------------- */
.detail-kurs {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface-alt);
}
.detail-kurs.ist-aktiv { border-left-color: var(--sap-blue); }
.detail-kurs-kopf { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.detail-kurs-zahlen {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px;
}
.detail-kurs-aktionen {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px;
}
.detail-kurs-aktionen .feld-inline { margin: 0; font-size: 12.5px; }
.warnung-text { color: #99461a; font-weight: 600; }

/* ---------------- Inhalts-Editor ---------------- */
.editor-raster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.editor-spalte { min-width: 0; }
.editor-kopf {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 8px; min-height: 22px;
}
.editor-kopf-rechts { white-space: nowrap; }
#editor-text, #original-text {
  width: 100%;
  min-height: 620px;
  font-family: "Consolas", "Menlo", "DejaVu Sans Mono", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  resize: vertical;
  tab-size: 2;
}
.editor-vorschau {
  min-height: 620px;
  max-height: 900px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  background: var(--surface);
}
.editor-aktionen {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px;
}
.link-knopf {
  background: none; border: none; padding: 0; font: inherit; font-size: 12.5px;
  color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-knopf:hover { color: var(--sap-blue); }

/* ---------------- Meldungen ---------------- */
.reiter-zaehler {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 6px;
  border-radius: 9px; background: var(--hot); color: #fff;
  font-size: 11px; font-weight: 700; text-align: center;
}
.meldung-karte {
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface);
}
/* Die vier Status. Die Farbe ist Beiwerk — was gilt, steht als Wort daneben,
   damit die Liste auch ohne Farbunterscheidung lesbar bleibt. */
.meldung-karte.ist-offen { border-left-color: #e9730c; }
.meldung-karte.ist-bearbeitung { border-left-color: #0a6ed1; }
.meldung-karte.ist-geschlossen { border-left-color: #2E7D32; }
.meldung-karte.ist-archiviert { border-left-color: #8a8f95; opacity: 0.85; }
.meldung-kopf {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 6px; flex-wrap: wrap;
}
.meldung-status { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ist-offen .meldung-status { color: #99461a; }
.ist-bearbeitung .meldung-status { color: #0a5aa8; }
.ist-geschlossen .meldung-status { color: #1d5c22; }
.ist-archiviert .meldung-status { color: #5f676d; }
/* Die Ticketnummer steht zuerst und in Maschinenschrift: Sie wird vorgelesen,
   abgetippt und in Mails zitiert — dafür müssen die Ziffern eindeutig sein. */
.ticket-nr {
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--sap-blue);
  letter-spacing: 0.02em;
}
.meldung-melder {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; font-size: 12px; color: var(--text-muted);
}
.meldung-datum { font-size: 12px; color: var(--text-muted); }
.meldung-bezug { margin: 0 0 6px; font-size: 12px; color: var(--text-muted); }
.meldung-text { margin: 0 0 8px; font-size: 13.5px; line-height: 1.55; }
.meldung-antwort {
  margin: 10px 0 0; padding-top: 8px;
  border-top: 1px dashed var(--border); font-size: 13px;
}
.meldung-aktionen { display: flex; gap: 10px; margin-top: 12px; }
.md-original {
  margin: 0 0 16px; padding: 12px 14px;
  background: var(--surface-alt); border-left: 3px solid var(--border);
  border-radius: 4px; font-size: 13.5px; line-height: 1.6;
}
#md-antwort, .admin-dialog textarea {
  width: 100%; font: inherit; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface-alt); color: var(--text); resize: vertical;
}

/* ---------------- Kennzahlkacheln der Meldungen ---------------- */
/* Vier Kacheln, die zugleich der Filter sind. Als Knopf gebaut, nicht als
   Kasten mit Klickzuhörer: So sind sie mit der Tastatur erreichbar und
   kündigen sich dem Vorleseprogramm als bedienbar an. */
.kennzahlen-reihe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 12px;
  margin: 4px 0 18px;
}
.kennzahl-kachel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius);
  padding: 14px 16px !important;
  cursor: pointer;
}
.kennzahl-kachel:hover { background: var(--surface-hover) !important; }
.kennzahl-kachel.ist-aktiv {
  box-shadow: inset 0 0 0 1px var(--sap-blue);
  background: var(--surface-hover) !important;
}
.kennzahl-kachel.ist-offen { border-left-color: #e9730c; }
.kennzahl-kachel.ist-bearbeitung { border-left-color: #0a6ed1; }
.kennzahl-kachel.ist-geschlossen { border-left-color: #2E7D32; }
.kennzahl-kachel.ist-archiviert { border-left-color: #8a8f95; }
.kennzahl-kachel .kennzahl-wert { font-size: 28px; font-weight: 700; line-height: 1.1; }
.kennzahl-kachel .kennzahl-text { font-size: 12.5px; color: var(--text-muted); }

/* ---------------- Firmenliste ---------------- */
.marke-aktiv { background: #d5ecd6; color: #1d5c22; }
.marke-still { background: var(--surface-alt); color: var(--text-muted); }

/* ---------------- Editor über die volle Breite ---------------- */
/* Der Quelltext steht nicht mehr neben einer Vorschau, sondern der Text wird
   direkt in seiner endgültigen Gestalt bearbeitet. Deshalb braucht es hier nur
   noch eine Spalte — und für den Lesefluss eine Begrenzung der Zeilenlänge,
   die der Editor selbst mitbringt. */
.editor-breit { margin-bottom: 4px; }

@media (max-width: 1100px) {
  .editor-raster { grid-template-columns: 1fr; }
  #editor-text, .editor-vorschau { min-height: 360px; }
}
@media (max-width: 900px) {
  .admin-kursliste { grid-template-columns: 1fr; }
  .admin-kurs-karte .kurs-daten { grid-template-columns: 1fr; }
  .stapel-zeile, .balken-zeile2 { grid-template-columns: 1fr; gap: 6px; }
  .stapel-summe { text-align: left; }
}

/* =========================================================================
   Seitenbreite: was von Breite profitiert, bekommt sie
   ========================================================================= */

/* Eine Tabelle, die breiter ist als der Platz, scrollt in ihrem EIGENEN Rahmen.
   Vorher schob sie die ganze Seite nach rechts: Kopfzeile, Reiterleiste und
   Fusszeile wanderten mit, und die Seite bekam einen Balken ganz unten, den man
   erst findet, wenn man ans Ende scrollt. So bleibt das Scrollen dort, wo es
   hingehört — bei der Tabelle. */
.tabelle-rahmen {
  overflow-x: auto;
  border-radius: var(--radius);
}
.tabelle-rahmen > table {
  /* Unterhalb dieser Breite lohnt sich Quetschen nicht mehr — dann wird
     gescrollt. Darüber füllt die Tabelle die verfügbare Breite aus. */
  min-width: 860px;
}

/* Die Knopfreihe am Zeilenende darf umbrechen, statt die Tabelle
   auseinanderzuziehen. Bei fünf Knöpfen je Zeile war genau das der Grund,
   warum die Benutzerliste über die Seite hinausragte. */
.aktionen-zelle {
  white-space: normal;
  min-width: 190px;
}
.aktionen-zelle button {
  margin: 0 4px 4px 0;
  font-size: 12.5px;
  padding: 6px 10px;
}

/* Auf sehr breiten Schirmen sollen die Kurskacheln nicht zu Plakaten werden —
   lieber eine Reihe mehr als zwei riesige Karten. */
@media (min-width: 1500px) {
  .admin-kursliste { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }
  .editor-raster { gap: 24px; }
}

/* Zahlen und Zeitangaben brechen nicht um — "7 h 47 min" über zwei Zeilen
   liest sich schlechter als eine Spalte, die ein paar Pixel breiter ist. */
.zahl-zelle { white-space: nowrap; }

/* Personenzeilen mit Foto. Der Avatar steht links vom Namen, damit die Liste
   beim Überfliegen an den Gesichtern entlanggelesen werden kann — genau dafür
   wurde das Foto eingeführt. */
/* inline-flex, nicht flex: Eine Tabellenzelle, die selbst zum Flex-Container
   wird, verliert ihren Platz in der Zeile — der Name stand dann als eigene
   Zeile ueber dem Rest. Die Hilfsschicht liegt deshalb INNERHALB der Zelle. */
.person-zelle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

/* ===================== Reiter "Fragen" =====================
   Die Karten übernehmen das Aussehen der Meldungen; hinzu kommt der
   Gesprächsverlauf, den style.css bereits für die Lernansicht beschreibt.
   Hier nur, was im Admin-Portal davon abweicht. */

#tab-fragen .frage-karte { overflow: visible; }
#tab-fragen .frage-verlauf {
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}
#tab-fragen .frage-verlauf:empty { display: none; padding: 0; border: 0; }
#tab-fragen .frage-nachrichten { margin: 0 0 12px; }
#tab-fragen .frage-neu { align-self: center; }

/* ===================== Lesezeiten je Lektion =====================
   Der Block sitzt unter der Inhaltsliste, weil die Lesezeit zum Inhalt
   gehört: Wer eine Lektion kürzt, zieht die Zeit im selben Zug nach. */

.lesezeit-block {
  margin: 24px 0 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.lesezeit-block > summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}
.lesezeit-block > summary .hint { margin: 0; }
.lesezeit-unit { margin-top: 20px; }
.lesezeit-unit h4 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--sap-dark);
}
.lesezeit-unit h4 .hint { margin: 0; font-weight: 400; }
.lesezeit-tabelle { width: 100%; }
.lesezeit-tabelle td, .lesezeit-tabelle th { font-size: 13px; }
.lesezeit-feld {
  width: 82px;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.lesezeit-marke {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e8f1fb;
  color: var(--sap-blue-dark);
}
[data-theme="dark"] .lesezeit-marke { background: #16304c; color: #85b8ec; }
.lesezeit-tabelle .link-knopf { margin-left: 8px; }
