/* Schlichte Chat-Oberfläche, zuerst für das Smartphone gestaltet. */

* {
  box-sizing: border-box;
}

/* Ausgeblendete Elemente bleiben ausgeblendet, auch wenn ihre Klasse eine Anzeigeart festlegt. */
[hidden] {
  display: none !important;
}

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

/* Im Chat scrollt nur der Gesprächsverlauf, nie die ganze Seite (sonst schiebt die Tastatur den Kopf weg). */
.chat-seite,
.chat-seite body {
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: #1d1d1f;
  background: #f2f2f5;
}

.seite {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  /* Im Chat: genau der sichtbare Bereich über der Bildschirmtastatur (setzt chat.js). */
  height: var(--sichtbare-hoehe, 100dvh);
  /* Teilnehmenden-Ansicht: auf dem Laptop breiter als auf dem Smartphone, aber gut lesbar. */
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
}

.kopf {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e5;
}

.kopf h1 {
  margin: 0;
  font-size: 1.15rem;
}

.kopf-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 10px;
}

.navigation a {
  color: #2f6fde;
  text-decoration: none;
  font-weight: 600;
}

.navigation form {
  margin-left: auto;
}

.verlauf {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leer {
  margin: auto;
  max-width: 28em;
  text-align: center;
  color: #6e6e73;
}

/* Eine Nachricht: Avatar daneben, Name darüber. Coach links, Person rechts. */
.zeile {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  /* Sprechblasen höchstens ca. 70 Zeichen breit, damit lange Zeilen lesbar bleiben. */
  max-width: min(88%, 44rem);
}

.zeile.bot {
  align-self: flex-start;
}

.zeile.person {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.zeile.bot .avatar {
  background: #e0884f;
}

.zeile.person .avatar {
  background: #2f6fde;
}

.inhalt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.zeile.person .inhalt {
  align-items: flex-end;
}

.name {
  margin: 0 4px 3px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #48484d;
}

.blase {
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.blase.person {
  color: #fff;
  background: #2f6fde;
}

.blase.bot {
  background: #ececf0;
}

/* Ältere, bestätigte Übergabe im Chat: breiter als normale Blasen. */
.zeile.uebergabe-zeile {
  max-width: min(100%, 44rem);
  width: 100%;
}

.uebergabe-zeile .inhalt {
  flex: 1;
}

.uebergabe-karte {
  white-space: normal;
}

.uebergabe-karte h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.uebergabe-karte dt {
  display: block;
  margin: 8px 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
}

.uebergabe-karte dl {
  margin: 0;
}

/* Zeilenumbrüche der Person erhalten, aber nicht die der Vorlage. */
.uebergabe-karte dd {
  margin: 0;
  white-space: pre-wrap;
}

.blase.laedt {
  font-style: italic;
  color: #6e6e73;
  background: #f6f6f8;
}

.blase.fehler {
  align-self: stretch;
  color: #8a1c1c;
  background: #fde8e8;
  border: 1px solid #f3b4b4;
}

/* Hinweis bei einer Nachricht ohne Antwort, ggf. mit „Erneut senden“ */
.fehler-hinweis {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.fehler-hinweis .blase.fehler {
  margin: 0;
}

/* Fehlversuche zu einer Nachricht (Verlauf im Forschungsbereich, Testansicht) */
.fehlversuche {
  margin: 4px 4px 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: #8a1c1c;
}

/* Seite für die Namensangabe vor der ersten Sitzung */
.name-seite .formular,
.anmelde-seite .formular,
.zugang-seite .formular {
  max-width: 26rem;
}

.name-seite .hinweis-text {
  margin: 2px 0 0;
  font-size: 0.9rem;
}

/* Avatar-Baukasten vor der ersten Sitzung: links die Vorschau, rechts die Bausteine (auf dem Smartphone untereinander). */
.baukasten-seite .hinweis-text {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.baukasten {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 24px;
  align-items: start;
}

.baukasten-vorschau {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.baukasten-bild {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
}

.baukasten-steuerung {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.baukasten-knoepfe {
  display: flex;
  gap: 8px;
}

.baukasten-beispiel {
  align-self: stretch;
}

.baukasten-klein {
  flex: none;
  width: 36px;
  height: 36px;
}

.baukasten-absenden,
.baukasten-absenden .knopf {
  width: 100%;
}

.baukasten-gruppe {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.baukasten-gruppe legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 600;
}

.baukasten-wahl {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.baukasten-wahl button {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f6f6f8;
  cursor: pointer;
}

.baukasten-wahl button[aria-pressed="true"] {
  border-color: #2f6fde;
  background: #eef4ff;
}

.baukasten-wahl img {
  display: block;
  width: 60px;
  height: 60px;
}

/* Geschlecht: Textknöpfe; bis eines gewählt ist, gibt es keine Vorschau (eine Spalte). */
.baukasten-wahl .baukasten-text {
  min-height: 44px;
  padding: 8px 18px;
  font: inherit;
  color: inherit;
}

.baukasten-vorschau[hidden] {
  display: none;
}

.baukasten:has(> .baukasten-vorschau[hidden]) {
  grid-template-columns: 1fr;
}

/* Farbfelder: mindestens 40 px, damit sie sich auf dem Smartphone gut treffen lassen. */
.baukasten-wahl .baukasten-farbe {
  width: 40px;
  height: 40px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #c7c7cc;
}

.baukasten-wahl .baukasten-farbe[aria-pressed="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 3px #2f6fde;
}

.baukasten-lizenz {
  margin: 16px 0 0;
  font-size: 0.75rem;
  color: #6e6e73;
}

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

  .baukasten-vorschau {
    /* ganz oben am Rand des Scrollbereichs (dessen Innenabstand ist 16 px) */
    position: sticky;
    top: -16px;
    z-index: 1;
    flex-direction: row;
    gap: 14px;
    margin: 0 -16px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e5;
  }

  .baukasten-bild {
    width: 96px;
    flex: none;
  }

  .baukasten-steuerung {
    align-items: stretch;
    gap: 8px;
  }

  .baukasten-beispiel {
    display: none;
  }

  .baukasten-wahl img {
    width: 54px;
    height: 54px;
  }
}

/* Studien-ID und „Abmelden“ unten auf der Sitzungsseite. */
.konto-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #e3e6ec;
  font-size: 0.9rem;
}

.abgeschlossen-hinweis {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #1e6b34;
  background: #dcf3e2;
}

.limit-hinweis {
  margin: 0;
  padding: 6px 16px 0;
  font-size: 0.88rem;
  color: #7a4b00;
}

.eingabe {
  display: flex;
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #e0e0e5;
}

/* Seit 03.12.2026: „Sitzung beenden“ links neben dem Textfeld, kompakt in zwei Zeilen, rot und klar
   zweitrangig neben „Senden“ (Umriss statt Fläche), damit das Textfeld auf dem Handy breit bleibt. */
.eingabe .beenden-knopf {
  flex: none;
  width: 72px;
  min-width: 0;
  padding: 0 4px;
  font-size: 0.78rem;
  line-height: 1.15;
  color: #c62828;
  background: #fff;
  border: 1px solid #e57373;
}

/* „Senden“ schmaler, damit neben „Sitzung beenden“ genug Platz für das Textfeld bleibt. */
.eingabe #senden {
  min-width: 0;
  padding: 0 14px;
}

.eingabe-feld {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.zeichenzaehler {
  align-self: flex-end;
  font-size: 0.8rem;
  color: #6e6e73;
}

.zeichenzaehler.am-limit {
  color: #8a1c1c;
  font-weight: 600;
}

/* Wächst beim Schreiben mit (per JavaScript), höchstens etwa 6 Zeilen. */
.eingabe textarea {
  min-height: 44px;
  max-height: 10.5rem;
  overflow-y: auto;
  /* Zeile 24px + 9px oben und unten + Rand: genau so hoch wie die beiden Knöpfe daneben (44px). */
  padding: 9px 10px;
  font: inherit;
  line-height: 24px; /* nach „font“, das die Zeilenhöhe sonst zurücksetzt */
  border: 1px solid #c7c7cc;
  border-radius: 12px;
  resize: none;
}

/* Der Platzhalter bleibt in einer Zeile (bei sehr schmalen Bildschirmen mit „…“ gekürzt). */
.eingabe textarea::placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eingabe button {
  align-self: flex-end;
  min-width: 80px;
  min-height: 44px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #2f6fde;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.eingabe button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Profilauswahl und Sitzungsübersicht */
.bereich {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.bereich h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.warnhinweis {
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #7a4b00;
  background: #ffefc2;
}

.hinweis-text,
.leer-text {
  color: #6e6e73;
}

.liste {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listeneintrag {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  text-align: left;
  text-decoration: none;
  color: inherit;
  background: #f6f6f8;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
  cursor: pointer;
}

.listeneintrag .titel {
  font-weight: 600;
}

.listeneintrag .details {
  font-size: 0.85rem;
  color: #6e6e73;
}

.status {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  /* Abzeichen nie mitten im Text umbrechen, lieber als Ganzes in die nächste Zeile. */
  white-space: nowrap;
}

.status.offen {
  color: #1e6b34;
  background: #dcf3e2;
}

.status.beendet {
  color: #48484d;
  background: #e5e5ea;
}

/* Studie im Entwurf (orange) oder freigegeben (grün); Profilart „Test“ (blau). */
.status.entwurf {
  color: #8a4b00;
  background: #ffe2bf;
}

.status.freigegeben {
  color: #1e6b34;
  background: #dcf3e2;
}

.status.test {
  color: #1e3a8a;
  background: #dfe7f6;
}

.status.teilnahme {
  color: #5b2c83;
  background: #efe3f8;
}

.status.gesperrt {
  color: #fff;
  background: #b42318;
}

/* Unübersehbares Band über den Reitern, solange die Studie im Entwurf ist. */
.entwurf-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 6px -16px 2px;
  padding: 8px 16px;
  color: #6b3a00;
  background: #ffd8a8;
  border-top: 1px solid #f3b874;
  border-bottom: 1px solid #f3b874;
}

.entwurf-knopf {
  min-height: 34px;
  padding: 0 12px;
  color: #fff;
  background: #c25e00;
  border: none;
}

.gesperrt-hinweis {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e6b34;
  background: #dcf3e2;
}

/* Forschungsbereich: Übergaben einer Person. */
.uebergaben {
  margin-top: 24px;
}

.uebergabe-eintrag {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #e0e0e5;
  border-radius: 10px;
}

.uebergabe-eintrag .werte {
  margin: 4px 0 0;
}

/* Konfiguration bearbeiten: Vorlagen unter Systemprompt und Begrüßung. */
.vorlagen-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: -8px 0 12px;
}

.vorlagen-leiste select {
  max-width: 100%;
  padding: 4px 8px;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid #c7c7cc;
  border-radius: 8px;
  background: #fff;
}

.vorlage-status {
  margin: 0;
}

/* Seite „Vorlagen“ */
.neue-vorlage {
  margin: 12px 0 20px;
}

.neue-vorlage > summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
}

.neue-vorlage > summary::-webkit-details-marker {
  display: none;
}

.neue-vorlage[open] > summary {
  margin-bottom: 12px;
}

.vorlagen-gruppe h3 {
  margin: 20px 0 8px;
}

/* Vorlagen: Zeile links (aufklappbar), Bearbeiten/Löschen rechts oben; auf schmalen Bildschirmen darunter. */
.vorlage-eintrag {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.vorlage-knoepfe {
  flex-wrap: nowrap;
  margin: 0;
  padding: 8px 14px 8px 0;
}

@media (max-width: 560px) {
  .vorlage-eintrag {
    grid-template-columns: minmax(0, 1fr);
  }

  .vorlage-knoepfe {
    padding: 0 14px 10px;
  }
}

.freigabe-formular fieldset {
  margin: 16px 0;
  padding: 0;
  border: none;
}

.freigabe-formular legend {
  margin-bottom: 8px;
  font-weight: 600;
}

.freigabe-formular .wahl {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 400;
}

.freigabe-formular .wahl input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex: none;
}

.knopf,
.knopf-klein {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
}

.knopf {
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: #2f6fde;
  border: 0;
}

.knopf-klein {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
  color: #8a1c1c;
  background: #fff;
  border: 1px solid #f3b4b4;
}

.ladekreis {
  width: 44px;
  height: 44px;
  border: 4px solid #d6e2f8;
  border-top-color: #2f6fde;
  border-radius: 50%;
  animation: ladekreis-drehen 0.9s linear infinite;
}

@keyframes ladekreis-drehen {
  to {
    transform: rotate(360deg);
  }
}

/* Wer Bewegung reduziert haben möchte: langsamer drehender Kreis. */
@media (prefers-reduced-motion: reduce) {
  .ladekreis {
    animation-duration: 3s;
  }
}

.beendet-hinweis {
  margin: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  text-align: center;
  color: #48484d;
  background: #f6f6f8;
  border-top: 1px solid #e0e0e5;
}

.befragung-knopf {
  display: flex;
  width: fit-content;
  margin: 10px auto 0;
}

.befragung-weiter {
  text-align: center;
}

.befragung-weiter .knopf {
  margin: 8px 0 16px;
}

/* Testansicht */
.testansicht section {
  margin: 20px 0;
}

.testansicht h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.testansicht h3 .details {
  font-weight: 400;
  font-size: 0.85rem;
  color: #6e6e73;
}

.werte {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
}

.werte dt {
  color: #48484d;
}

.werte dd {
  margin: 0;
  font-weight: 600;
}

.block {
  margin: 0 0 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f6f6f8;
  border: 1px solid #e0e0e5;
  border-radius: 8px;
}

.block-zeile .rolle {
  display: block;
  margin-bottom: 2px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6e6e73;
}

/* Konfiguration */
.konfiguration section {
  margin: 24px 0;
}

.formular .feld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.formular label {
  font-weight: 600;
  font-size: 0.95rem;
}

.formular input,
.formular select,
.formular textarea {
  padding: 10px 12px;
  font: inherit;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
}

.formular textarea {
  resize: vertical;
}

.formular select {
  min-height: 44px;
  background: #fff;
}

.feldfehler {
  margin: 0;
  color: #8a1c1c;
  font-size: 0.9rem;
}

/* Feldname mit ⓘ: Die Erklärung erscheint beim Darüberfahren, beim Ansteuern per Tab-Taste
   und beim Antippen (forschung.js setzt dann aria-expanded). */
.feld-kopf {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.info-knopf {
  /* Kleines Zeichen, aber eine ausreichend große Tippfläche. */
  min-width: 32px;
  min-height: 32px;
  margin: -6px 0;
  padding: 0;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  color: #0a5bd3;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.info-knopf:focus-visible {
  outline: 2px solid #0a5bd3;
}

.info-text {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  width: max-content;
  max-width: min(100%, 26rem);
  margin-top: 4px;
  padding: 8px 10px;
  font-size: 0.9rem;
  font-weight: normal;
  color: #fff;
  background: #3a3a3c;
  border-radius: 8px;
}

.info-knopf[aria-expanded="true"] + .info-text,
.info:not(.zu) .info-knopf:focus-visible + .info-text {
  display: block;
}

/* Nur bei Geräten mit Maus; auf dem Smartphone würde „Hover“ nach dem Antippen hängen bleiben. */
@media (hover: hover) {
  .info:not(.zu):hover .info-text {
    display: block;
  }
}

.version {
  background: #f6f6f8;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
}

.version.aktiv {
  border-color: #8fd0a2;
}

.version .titel {
  font-weight: 600;
}

.version .details {
  font-size: 0.85rem;
  color: #6e6e73;
}

.version-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.version-zeile::-webkit-details-marker {
  display: none;
}

.version-zeile::before {
  content: "▸";
  color: #6e6e73;
}

.version details[open] > .version-zeile::before {
  content: "▾";
}

.version-kurz {
  font-size: 0.9rem;
  color: #48484d;
}

.version-inhalt {
  padding: 0 14px 12px;
}

.knopf-klein.neutral {
  color: #2f6fde;
  border-color: #b9cdf3;
}

/* Erfolgsmeldungen */
.meldungen {
  padding: 8px 16px 0;
}

.meldung {
  margin: 0 0 6px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #1e6b34;
  background: #dcf3e2;
}

.meldung.error {
  color: #8a1c1c;
  background: #fde8e8;
}

/* Löschen */
.eintrag-mit-aktion {
  display: flex;
  align-items: center;
  gap: 10px;
}

.knopf.gefahr {
  background: #b42318;
}

/* Runder Löschen-Knopf mit Kreuz (Studienverwaltung); Hinweis „Studie löschen“ beim Darüberfahren. */
.loeschen-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  background: #fff;
  border: 2px solid #b42318;
  border-radius: 50%;
}

.loeschen-symbol svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #b42318;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.loeschen-symbol:hover,
.loeschen-symbol:focus-visible {
  background: #b42318;
}

.loeschen-symbol:hover svg,
.loeschen-symbol:focus-visible svg {
  stroke: #fff;
}

.knopf-klein.gefahr {
  color: #b42318;
  border-color: #b42318;
  background: #fff;
}

/* Gefüllt (rot mit weißer Schrift), z. B. „Löschen“ bei Testprofilen. */
.knopf-klein.gefahr.voll {
  color: #fff;
  background: #b42318;
}

.knopf-klein.gefahr.voll:hover,
.knopf-klein.gefahr.voll:focus-visible {
  background: #8f1c13;
}

/* Zweitrangiger Knopf in voller Größe, z. B. „Abbrechen“ neben „Speichern“. */
.knopf.neutral {
  color: #2f6fde;
  background: #fff;
  border: 1px solid #b9cdf3;
}

/* Noch nicht verfügbar (z. B. Zugänge im Entwurf): grau, ein Klick zeigt nur einen Hinweis. */
.knopf.grau {
  color: #6e6e73;
  background: #e5e5ea;
  cursor: not-allowed;
}

/* Grauer Knopf mit Erklärung wie beim ⓘ: sieht aus wie ein normaler Knopf, die Erklärung erscheint darunter. */
.info-gesperrt {
  position: relative;
  display: inline-block;
}

.info-gesperrt .knopf.info-knopf {
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  font-size: inherit;
  line-height: normal;
  border-radius: 12px;
}

/* Forschungsbereich */
.forschung-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-top: 8px;
}

.kopf-forschung {
  background: #eef2f7;
}

/* „Angemeldet als … · Abmelden“ rechts im Kopf des Forschungsbereichs. */
.angemeldet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-left: auto;
  font-size: 0.9rem;
}

.bereich-schild {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: #1e3a8a;
}

/* Forschungsbereich: Studienmenü links, rechts Studientitel, Reiter und Inhalt */
.forschung-rahmen {
  flex: 1;
  display: flex;
  min-height: 0;
}

.studienmenue {
  flex: none;
  width: 230px;
  padding: 14px 12px;
  overflow-y: auto;
  background: #f6f8fb;
  border-right: 1px solid #e0e0e5;
}

.menue-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 8px;
}

.menue-kopf h2 {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e6e73;
}

.menue-knopf,
.menue-schliessen {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: #1e3a8a;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.menue-knopf {
  margin: -6px -4px -6px -8px;
}

.menue-knopf:focus-visible,
.menue-schliessen:focus-visible {
  outline: 2px solid #0a5bd3;
}

/* Das ✕ gibt es nur, wenn das Menü auf schmalen Bildschirmen über der Seite liegt. */
.menue-schliessen {
  display: none;
}

.studienliste {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.studienliste form {
  margin: 0;
}

.studie-waehlen,
.menue-link {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  color: #1d1d1f;
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.studie-waehlen:hover,
.menue-link:hover {
  background: #e8edf5;
}

.studie-waehlen[aria-current="true"],
.menue-link[aria-current="page"] {
  font-weight: 700;
  color: #1e3a8a;
  background: #dfe7f6;
}

.menue-link {
  color: #2f6fde;
  font-weight: 600;
}

.kuerzel {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #48484d;
  background: #ececf0;
}

.forschung-spalte {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Damit der Inhalt innerhalb der Seite scrollt, statt unten herauszuragen (v. a. auf dem Smartphone). */
  min-height: 0;
}

.studien-kopf {
  padding: 12px 16px 0;
  border-bottom: 1px solid #e0e0e5;
}

.studien-titel {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
}

.studien-kopf:not(:has(.reiter)) {
  padding-bottom: 10px;
}

/* Breite Bildschirme: eingeklapptes Menü ganz ausblenden. */
@media (min-width: 900px) {
  .forschung-rahmen.mit-js:not(.menue-offen) .studienmenue {
    display: none;
  }
}

/* Schmale Bildschirme: ohne JavaScript steht das Menü über dem Inhalt,
   mit JavaScript liegt es nach ☰ über der Seite. */
@media (max-width: 899px) {
  .forschung-rahmen {
    flex-direction: column;
  }

  .studienmenue {
    width: auto;
    border-right: none;
    border-bottom: 1px solid #e0e0e5;
  }

  .forschung-rahmen.mit-js .studienmenue {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(85vw, 300px);
    border-right: 1px solid #e0e0e5;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    visibility: hidden;
    /* Beim Schließen erst nach dem Hinausgleiten unsichtbar … */
    transition: transform 0.2s ease, visibility 0s 0.2s;
  }

  .forschung-rahmen.mit-js.menue-offen .studienmenue {
    transform: none;
    visibility: visible;
    /* … beim Öffnen sofort sichtbar, damit der Fokus hineinspringen kann. */
    transition: transform 0.2s ease, visibility 0s;
  }

  .forschung-rahmen.mit-js .menue-schliessen {
    display: inline-block;
  }

  .menue-hintergrund {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.35);
  }
}

.studien-titel .kuerzel {
  margin-left: 4px;
  vertical-align: 0.15em;
}

/* Studienverwaltung: Tabelle der Studien und aufklappbares Formular „Neue Studie“ */
.studie-zelle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

/* Schaltfläche, die wie ein Link aussieht (Studie auswählen braucht ein Formular). */
.link-knopf {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #2f6fde;
  background: none;
  border: none;
  cursor: pointer;
}

.link-knopf:hover {
  text-decoration: underline;
}

.neue-studie {
  margin: 12px 0 16px;
  padding: 12px 16px 4px;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
  background: #f9fafc;
}


.reiter {
  display: flex;
  gap: 4px;
  margin: 4px -16px 0;
  padding: 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.reiter a {
  flex: none;
  padding: 10px 12px;
  color: #48484d;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.reiter a[aria-current="page"] {
  color: #2f6fde;
  border-bottom-color: #2f6fde;
}

/* Unterreiter im Reiter „Konfiguration“: Links beim Ansehen, Knöpfe im Formular (forschung.js). */
.unterreiter {
  display: flex;
  gap: 4px;
  margin: 8px 0 16px;
  border-bottom: 1px solid #e0e0e5;
}

.unterreiter[hidden] {
  display: none;
}

.unterreiter a,
.unterreiter button {
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  color: #48484d;
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}

.unterreiter a[aria-current="page"],
.unterreiter button[aria-selected="true"] {
  color: #2f6fde;
  border-bottom-color: #2f6fde;
}

/* Mit Unterreitern ist die Überschrift je Teil überflüssig (ohne JavaScript bleibt sie sichtbar). */
.mit-unterreitern .teil-titel {
  display: none;
}

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.kachel {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: #f6f6f8;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
}

.kachel .zahl {
  font-size: 1.6rem;
  font-weight: 700;
}

.kachel .was {
  color: #6e6e73;
  font-size: 0.9rem;
}

.forschung section {
  margin: 24px 0;
}

.forschung h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

/* Unterseiten im Forschungsbereich (Person, Verlauf, Testansicht): Zurück-Knopf,
   Titel und rechts die wichtigste Aktion – im Stil der App-Leiste im Chat. */
.unterseiten-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: -4px 0 12px -8px;
}

.unterseiten-leiste h2 {
  margin: 0;
}

.unterseiten-aktion {
  margin: 0 0 0 auto;
}

/* Seitenüberschrift mit Knopf rechts (z. B. Konfiguration → „Neue Version erstellen“). */
.seitenkopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.seitenkopf h2 {
  margin: 0;
}

/* Konfiguration: aktive Version und Angaben jeder Version (nur lesend). */
.aktive-version {
  padding: 14px 16px 6px;
  border: 1px solid #8fd0a2;
  border-radius: 12px;
  background: #f4fbf6;
}

.version-werte {
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.version-prompt-titel {
  margin: 0 0 4px;
}

/* Aktive Version: langer Systemprompt nur zwei Zeilen, danach „…“
   (vollständig unter „Alle Versionen“). */
.prompt-kurz {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.version-aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.version-aktionen form {
  margin: 0;
}

/* Coach: großes Prompt-Feld, kleineres Begrüßungsfeld, schmale Zahlenfelder. */
.formular-design #id_systemprompt {
  min-height: 22rem;
}

/* In der Zwei-Spalten-Ansicht soll das Prompt-Feld nicht die ganze Spaltenhöhe füllen (die Begrüßung steht darüber). */
.formular-design #id_begruessung {
  min-height: 5.5rem;
}

.formular-reihe .feld {
  max-width: 16rem;
}

.formular-reihe select {
  min-height: 44px;
}

/* Anrede: du / Sie nebeneinander */
.feld-anrede .feld > div {
  display: flex;
  gap: 20px;
}

.feld-anrede label:has(input) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  font-weight: 400;
}

.formular .feld-anrede input[type="radio"] {
  width: 20px;
  height: 20px;
  margin: 0;
}

/* Anweisungen je Sitzung */
.sitzungsanweisungen {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

/* Coach: oben Begrüßung | Anrede und Name, darunter der Systemprompt über die volle Breite;
   auf schmalen Bildschirmen alles untereinander. */
.design-oben {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 28px;
}

.raster-prompt {
  position: relative;
}

/* Der Systemprompt ist das wichtigste Feld: so hoch, dass er den Bildschirm über der Speicherleiste füllt. */
.seite-breit .formular .raster-prompt textarea {
  min-height: max(20rem, calc(100dvh - 430px));
}

/* Längenanzeige rechts neben der Überschrift „Systemprompt“. */
.raster-prompt .prompt-zaehler {
  position: absolute;
  top: 2px;
  right: 0;
  margin: 0;
}

@container (min-width: 760px) {
  .design-oben {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
  }

  /* Unterreiter „Sitzungen“: Kästen nebeneinander, so viele, wie Platz ist. */
  .sitzungsanweisungen {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
    align-items: start;
  }

  .sitzungsanweisungen .ohne-anzahl {
    grid-column: 1 / -1;
  }
}

/* Kontakt ist kurz: drei Zeilen genügen. */
.seite-breit .formular #id_kontakt {
  min-height: 5.5rem;
}

/* Je Sitzung ein schmaler, nummerierter Kasten mit Titel; die Anweisung lässt sich aufklappen. */
.sitzungskasten {
  padding: 8px 10px;
  border: 1px solid #e0e0e5;
  border-radius: 10px;
  background: #f9fafc;
}

.sitzungskasten-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sitzungsnummer {
  flex: none;
  min-width: 26px;
  height: 26px;
  border-radius: 13px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  color: #fff;
  background: #1e3a8a;
}

.formular .sitzungskasten-kopf input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  background: #fff;
}

.aufklappen {
  flex: none;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  font: inherit;
  font-size: 1rem;
  color: #2f6fde;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.aufklappen:focus-visible {
  outline: 2px solid #0a5bd3;
}

.anweisung-vorhanden {
  display: block;
  margin: 4px 0 0 34px;
  font-size: 0.8rem;
  color: #1e6b34;
}

.sitzungskasten-inhalt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 2px 34px;
}

.sitzungskasten-inhalt label {
  font-size: 0.85rem;
}

.formular.formular-design .sitzungskasten textarea {
  min-height: 5rem;
  background: #fff;
}

/* Anweisungen sind meist länger als Begrüßungen. */
.formular.formular-design .sitzungskasten textarea[name^="anweisung_"] {
  min-height: 9rem;
}

/* Teilnehmende: Auswahl der Bedingung neben „Neues Testprofil anlegen“. */
.testprofil-anlegen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.testprofil-anlegen select {
  min-height: 44px;
  padding: 0 10px;
  font: inherit;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
  background: #fff;
}

/* Unterreiter „Manipulation“: Ausprägungen als kleine Tabelle mit Eingabefeldern. */
.auspraegungen .feld-titel {
  margin: 4px 0 4px;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Bedingungen: schmal (Nummer + Wert); die Auswahl so breit wie die Listen darüber. */
.tabelle.auspraegungen-tabelle {
  width: 560px;
  max-width: 100%;
}

.auspraegungen-tabelle th:first-child {
  width: 100px;
}

.auspraegungen-tabelle select {
  width: 240px;
  max-width: 100%;
}

/* Unterreiter „Fragebogen“: eigener Link nach einzelnen Sitzungen. */
.sitzungslinks .feld-titel {
  margin: 4px 0 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.sitzungslinks .sitzungslink label {
  font-weight: 400;
}

.anweisungsliste {
  margin: 0 0 10px;
  padding-left: 0;
  list-style: none;
  font-size: 0.92rem;
}

.anweisungsliste li {
  margin-bottom: 4px;
}

.anweisung-nummer {
  font-weight: 600;
}

.prompt-zaehler {
  font-size: 0.85rem;
}

/* Mehrzeiliger Text in einer Werteliste (z. B. Begrüßung). */
.mehrzeilig {
  white-space: pre-wrap;
}

/* Lange Adressen ohne Leerzeichen (z. B. Befragungslink) dürfen überall umbrechen. */
.umbruch {
  overflow-wrap: anywhere;
}

.formular-knoepfe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

/* Konfiguration bearbeiten: Kopf (zurück, Titel, Unterreiter) bleibt oben, die Speicherleiste unten im Bild. */
.bearbeiten-kopf {
  position: sticky;
  top: -16px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px 24px;
  margin: -16px -16px 16px;
  padding: 10px 16px 0;
  background: #fff;
  border-bottom: 1px solid #e0e0e5;
}

.bearbeiten-titel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 8px;
}

.bearbeiten-titel h2 {
  margin: 0;
}

/* Unterreiter „Versionen“: Überschrift je Bereich in einer aufgeklappten Version. */
.version-bereich {
  margin: 14px 0 6px;
  font-size: 0.9rem;
  color: #48484d;
}

.version-bereich:first-child {
  margin-top: 0;
}

.bearbeiten-kopf .unterreiter {
  margin: 0;
  border-bottom: none;
}

.speicherleiste {
  position: sticky;
  bottom: -16px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin: 16px -16px -16px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid #e0e0e5;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.speicherleiste-notiz {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  flex: 1 1 22rem;
}

.speicherleiste-notiz label {
  font-size: 0.9rem;
  white-space: nowrap;
}

.speicherleiste-notiz input {
  flex: 1 1 14rem;
  min-height: 40px;
}

.speicherleiste-notiz .feldfehler {
  flex-basis: 100%;
}

.speicherleiste-hinweis {
  flex: 1 1 16rem;
  margin: 0;
  font-size: 0.85rem;
  color: #6e6e73;
}

.ungespeichert {
  font-weight: 600;
  color: #9a5a00;
}

.speicherleiste-knoepfe {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* Laptop: Das Formular füllt immer mindestens die sichtbare Höhe, damit die Speicherleiste auch bei
   kurzen Unterreitern (z. B. Technik) ganz unten am Bildschirmrand steht. */
@media (min-width: 700px) {
  .formular.formular-design {
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  .formular-design > .speicherleiste {
    margin-top: auto;
  }
}

/* Smartphone (nur ausnahmsweise im Forschungsbereich): Kopf und Speicherleiste nicht feststehend,
   damit genug Platz zum Bearbeiten bleibt; die Unterreiter lassen sich seitlich wischen. */
@media (max-width: 699px) {
  .bearbeiten-kopf,
  .speicherleiste {
    position: static;
    box-shadow: none;
  }

  .bearbeiten-kopf .unterreiter {
    max-width: 100%;
    overflow-x: auto;
  }

  .bearbeiten-kopf .unterreiter button {
    flex: none;
  }
}

.listeneintrag.statisch {
  cursor: default;
}

.verlauf.nur-lesen {
  padding: 8px 0;
  overflow: visible;
}

.name .zeit {
  font-weight: 400;
  color: #6e6e73;
}

/* Testleiste in der Teilnehmenden-Ansicht (nur für angemeldete Forschende mit geöffnetem Testprofil) */
.testleiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 16px;
  color: #fff;
  background: #1e3a8a;
}

.testleiste-text {
  font-size: 0.95rem;
}

.testleiste-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.testleiste-knopf {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e3a8a;
  text-decoration: none;
  background: #fff;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

/* Schmale Bildschirme: Testleiste höchstens zwei Zeilen (Text, darunter beide Knöpfe nebeneinander). */
@media (max-width: 480px) {
  .testleiste {
    padding: 6px 12px;
  }

  /* Knöpfe dürfen in eine zweite Zeile rutschen, statt über den Rand zu ragen. */
  .testleiste-knoepfe {
    gap: 6px;
  }

  .testleiste-knopf {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
}

.testkasten {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffefc2;
  color: #7a4b00;
}

.testkasten p {
  margin: 0 0 12px;
}

/* Der Eintrag nimmt den Platz ein, ein Knopf daneben (z. B. „Löschen“) behält seine Breite. */
.eintrag-mit-aktion > .listeneintrag {
  flex: 1;
  min-width: 0;
}

.eintrag-mit-aktion > .knopf-klein {
  flex: none;
}

/* Kompakter Kopf im Chat */
.kopf-kompakt {
  padding: 8px 16px;
}

/* Chat: App-Leiste mit Zurück-Knopf links, Sitzungstitel in der Mitte, „Beenden“ rechts. */
.app-leiste {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.app-leiste-zurueck {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px 0 8px;
  font-weight: 600;
  color: #2f6fde;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 10px;
}

.app-leiste-zurueck:hover {
  background: #eef3fd;
}

.app-leiste-titel {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
}

.app-leiste-rechts {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* „Kontakt“ im Chat: führt zum Kontakt unten auf der Sitzungsübersicht. */
.app-leiste-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 8px;
  font-size: 0.9rem;
  color: #2f6fde;
  text-decoration: none;
  border-radius: 10px;
}

.app-leiste-link:hover {
  background: #eef3fd;
}

.app-leiste-rechts form {
  margin: 0;
}

.app-leiste .knopf-klein {
  min-height: 36px;
}

/* Smartphones: weniger Abstand, damit Zurück, Titel, „Kontakt“ und „Beenden“ in eine Zeile passen. */
@media (max-width: 400px) {
  /* Der Titel gibt notfalls nach („Sitzu…“), statt die Knöpfe aus dem Bild zu schieben. */
  .app-leiste {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px;
  }

  .app-leiste-titel {
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }

  .app-leiste-zurueck {
    padding: 0 6px 0 2px;
  }

  .app-leiste-link {
    padding: 0 4px;
  }
}

/* Sehr schmale Smartphones: noch etwas weniger Abstand. */
@media (max-width: 360px) {
  .app-leiste {
    gap: 4px;
  }

  .app-leiste-zurueck {
    padding: 0 6px 0 2px;
  }

  .app-leiste .knopf-klein {
    padding: 0 8px;
  }

  .app-leiste-link {
    padding: 0 4px;
  }
}

/* Forschungsbereich: mehr Breite für Listen, Testansicht und Konfiguration. */
.seite.seite-breit {
  max-width: 1600px;
}

.seite-breit .formular textarea {
  min-height: 14rem;
}

/* Konfiguration bei genügend Platz im Inhaltsbereich (je nachdem, ob das Studienmenü
   offen ist): Systemprompt links, Einstellungen rechts. */
.forschung {
  container-type: inline-size;
}

@container (min-width: 760px) {
  .formular-spalten {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 0 28px;
  }

  .formular-spalten.technik-spalten,
  .formular-spalten.gleiche-spalten {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* Tabellen mit Suche (Teilnehmende, Studien) */
/* Mehrere Knöpfe nebeneinander links in der Werkzeugleiste (auf schmalen Bildschirmen untereinander).
   Die Gruppe nimmt immer eine eigene Zeile ein, die Suche steht darunter. So kann sich nichts
   überschneiden, auch in Browsern, die die Breite einer umbrechenden Gruppe anders berechnen. */
.werkzeug-knoepfe {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 8px;
}

/* Die Suche darunter bekommt die ganze Zeile und beginnt links unter den Knöpfen
   (ohne feste Zeilenbreite rechnen manche Browser das Suchfeld zu schmal). */
.werkzeug-knoepfe + .suche {
  flex: 1 1 100%;
  justify-content: flex-start;
}

.werkzeugleiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 12px 0 4px;
}

.suche {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
}

.suche select {
  min-height: 40px;
  padding: 0 10px;
  font: inherit;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
  background: #fff;
}

.suche input {
  /* Ausreichende Breite auf dem Laptop, damit der Platzhaltertext ganz sichtbar ist; darf schmaler
     werden, wenn der Platz nicht reicht, statt über den Rand hinauszulaufen. */
  flex: 0 1 auto;
  width: 18rem;
  min-width: 0;
  height: 40px;
  padding: 8px 12px;
  font: inherit;
  border: 1px solid #c7c7cc;
  border-radius: 10px;
}

/* „Suchen“ genau so hoch wie das Suchfeld daneben. */
.suche .knopf-klein {
  height: 40px;
  min-height: 40px;
}

/* Schmale Bildschirme: Suche in eigener Zeile über die ganze Breite. */
@media (max-width: 640px) {
  .suche {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .suche input {
    /* Nimmt den Platz neben „Suchen“ ein, ohne die Schaltfläche in die nächste Zeile zu drängen. */
    flex: 1 1 0;
    min-width: 0;
  }
}

/* Konten: Knöpfe dürfen umbrechen, damit die Tabelle auch auf dem Smartphone ohne Wischen passt. */
.konto-anmeldung {
  display: block;
}

.tabelle.konten-tabelle td {
  white-space: normal;
}

.tabelle.konten-tabelle .aktionen {
  width: 1%;
  text-align: right;
}

.konten-tabelle .aktionen .knopf-klein {
  white-space: normal;
  text-align: center;
}

.tabelle-rahmen {
  overflow-x: auto;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
}

.tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.tabelle th,
.tabelle td {
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #e0e0e5;
}

.tabelle tbody tr:last-child > * {
  border-bottom: 0;
}

.tabelle thead th {
  font-size: 0.85rem;
  background: #f6f6f8;
}

.tabelle thead a {
  color: #48484d;
  text-decoration: none;
}

.tabelle thead th[aria-sort] a {
  color: #1e3a8a;
}

.tabelle .zahl {
  text-align: right;
}

.tabelle tbody th a {
  color: #2f6fde;
  font-weight: 600;
  text-decoration: none;
}

/* Kennung bleibt beim seitlichen Wischen auf dem Smartphone stehen. */
.tabelle tbody th,
.tabelle thead th:first-child {
  position: sticky;
  left: 0;
  background: #fff;
}

.tabelle thead th:first-child {
  background: #f6f6f8;
}

/* Kompakte Tabelle mit vielen Spalten (Studien): Überschriften und lange Werte dürfen umbrechen. */
.tabelle.kompakt th,
.tabelle.kompakt td {
  padding: 8px;
}

.tabelle.kompakt thead th,
.tabelle.kompakt .umbrechen {
  white-space: normal;
}

.tabelle.kompakt thead th {
  vertical-align: bottom;
}

.tabelle.kompakt .umbrechen {
  min-width: 5.5rem;
}

.tabelle.kompakt .zusammen {
  white-space: nowrap;
}

/* Sicherungen: Herunterladen und Löschen nebeneinander. */
.sicherung-aktionen {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sicherung-aktionen form {
  margin: 0;
}

/* Name, Kürzel und „gewählt“ dürfen untereinander rutschen, wenn es eng wird. */
.tabelle.kompakt tbody th {
  white-space: normal;
}

.tabelle.kompakt .studie-zelle {
  flex-wrap: wrap;
}

.tabelle .aktionen-inhalt {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Ab Laptop-Breite bleibt die Spalte mit den Aktionen (z. B. „Löschen“) am rechten Rand stehen;
   nur die Spalten dazwischen lassen sich bei Bedarf seitlich verschieben. Auf dem Smartphone
   nicht, damit neben Kennung und Aktionen noch Platz für die Werte bleibt. */
@media (min-width: 641px) {
  .tabelle .aktionen {
    position: sticky;
    right: 0;
    background: #fff;
  }

  .tabelle thead .aktionen {
    background: #f6f6f8;
  }
}

.tabelle .aktionen a {
  color: #2f6fde;
}

.unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Zugänge für Teilnehmende: Erzeugen (Liste der Teilnehmenden) und Verwalten (Seite der Person). */
.formular .zugaenge-zeile {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.zugaenge-zeile input {
  width: 7rem;
}

.zugaenge-zeile input[type="date"] {
  width: auto;
}

.zugang-verwalten {
  margin: 12px 0 20px;
}

/* Detailseite einer Person: der von ihr gestaltete Coach-Avatar. */
.avatar-angaben {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 12px 0 20px;
}

.avatar-angaben .hinweis-text {
  margin: 0;
}

.code-anzeige {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
}

.link-anzeige {
  overflow-wrap: anywhere;
}

/* Ja/Nein-Einstellung als Häkchen mit Beschriftung daneben (z. B. „Name für die Ansprache abfragen“). */
.feld-haken label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.feld-haken input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.feld-haken .hinweis-text {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

/* Prüfliste vor der Freigabe (siehe pruefung.py). */
.pruef-kasten {
  margin: 12px 0 20px;
  padding: 12px 16px;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
  background: #f9fafc;
}

.pruef-kasten.mit-offenen {
  border-color: #f3b874;
  background: #fff8ee;
}

.pruef-kasten h3 {
  margin: 0 0 8px;
}

.pruef-kasten h4 {
  margin: 12px 0 4px;
  font-size: 0.95rem;
}

.pruefliste {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pruefliste li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.pruef-zeichen {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #48484d;
  background: #e5e5ea;
  border-radius: 50%;
}

.pruefliste .erledigt .pruef-zeichen {
  color: #fff;
  background: #1e8a3c;
}

.pruefliste .offen .pruef-zeichen {
  color: #fff;
  background: #c26a00;
}

.pruef-zusammenfassung {
  margin: 0 0 4px;
  font-weight: 600;
}

.pruef-hinweis {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  color: #6e6e73;
}

/* Startseite: neutraler Hinweis (Studie abgeschlossen, Zugang gesperrt). */
.zugang-hinweis {
  margin: 0 0 14px;
  padding: 10px 14px;
  color: #1d1d1f;
  background: #f2f2f7;
  border-radius: 12px;
}

.status.abgeschlossen {
  color: #48484d;
  background: #e5e5ea;
}

/* „Studie abschließen“ neben dem Status einer laufenden Studie. */
.abschliessen-knopf {
  margin-left: 6px;
  min-height: 30px;
  vertical-align: middle;
}

/* Manipulation „Avatar“: festgelegter Avatar je Ausprägung (Vorschau und Knopf) und Dialog mit dem Baukasten. */
.fester-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.fester-avatar[hidden] {
  display: none;
}

.fester-avatar-bild {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  vertical-align: middle;
}

.anweisung-text .fester-avatar-bild {
  width: 32px;
  height: 32px;
}

.avatar-dialog {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 20px;
  border: 0;
  border-radius: 12px;
}

.avatar-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.avatar-dialog h3 {
  margin: 0 0 6px;
}

.avatar-dialog-knoepfe {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Pop-up „Coach-Vorstellung“ vor der ersten Sitzung: Bild des Coaches, darunter seine Sprechblase und die Knöpfe. */
.vorstellung-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
  border: 0;
  border-radius: 16px;
  text-align: center;
}

.vorstellung-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.vorstellung-dialog h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.vorstellung-inhalt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.vorstellung-bild {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: #dbe7f6;
}

.vorstellung-blase {
  position: relative;
  text-align: left;
  line-height: 1.45;
}

/* Kleiner Zipfel nach oben zum Bild, damit klar ist, wer spricht. */
.vorstellung-blase::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top: 0;
  border-bottom-color: #ececf0;
}

.vorstellung-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

/* Reiter „Testprofile“: Alle Testprofile löschen, abgesetzt unter der Tabelle. */
.testdaten-loeschen {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e5;
}

/* Kleine Zusatzangabe in einer Tabellenzelle (z. B. „von Admin1“ unter dem Datum). */
.tabelle .klein {
  font-size: 0.8rem;
  color: #6e6e73;
}

/* Überblick als Dashboard: Kacheln über die ganze Breite, darunter Felder im Raster (bei genug Platz
   Fortschritt und Bedingungen nebeneinander, nicht beendete Sitzungen darunter über die ganze Breite). */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 12px 0 24px;
}

.dashboard-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.kachel .zahl.zahl-klein {
  font-size: 1.15rem;
  line-height: 2.05rem;
  white-space: nowrap;
}

.kachel .uhrzeit {
  color: #6e6e73;
  font-weight: 400;
}

.kachel.kachel-warnung {
  background: #fff4e5;
  border-color: #ffd28a;
}

.kachel.kachel-warnung .zahl {
  color: #8a4b00;
}

.dashboard-raster {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.forschung .dashboard-feld {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #e0e0e5;
  border-radius: 12px;
}

.dashboard-feld h3 {
  margin: 0 0 10px;
}

.feld-zusatz {
  margin-left: 6px;
  color: #6e6e73;
  font-size: 0.85rem;
  font-weight: 400;
}

.tabelle-scroll {
  overflow-x: auto;
}

.dashboard-feld .leer-text {
  margin: 0;
}

/* Fortschritt: heller Balken = begonnen, dunkler = beendet, jeweils von allen aktiven Teilnehmenden. */
.fortschritt-tabelle .balken-spalte {
  width: 40%;
  min-width: 120px;
  white-space: nowrap;
}

.balken {
  position: relative;
  display: inline-block;
  width: calc(100% - 3.5rem);
  height: 10px;
  vertical-align: middle;
  background: #ececf0;
  border-radius: 5px;
  overflow: hidden;
}

.balken-begonnen,
.balken-beendet {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 5px;
}

.balken-begonnen {
  background: #b9d3f5;
}

.balken-beendet {
  background: #2f6fd6;
}

.balken-zahl {
  display: inline-block;
  width: 3.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@container (min-width: 900px) {
  .dashboard-raster {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }

  .dashboard-raster.ohne-bedingungen {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-breit {
    grid-column: 1 / -1;
  }
}

/* Unterreiter „Manipulation“: Vorschau des vorgegebenen Avatars in eigener Spalte. */
.avatar-vorschau-zelle {
  width: 120px;
  text-align: center;
}

.avatar-vorschau-zelle img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

/* Unterreiter „Manipulation“: Auswahl der Manipulation und Anzahl Gruppen nebeneinander, beide schmal. */
.manipulation-kopf {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.manipulation-kopf .feld {
  width: 200px;
}

.manipulation-kopf [data-auspraegungen][hidden] {
  display: none;
}

/* Pop-up beim Beenden einer Sitzung (seit 03.12.2026): Rückfrage, Zusammenfassung, Vorsatz und Themen.
   Auf dem Handy fast bildschirmfüllend, damit Textfeld und Knöpfe auch mit eingeblendeter Tastatur passen. */
.abschluss-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(var(--sichtbare-hoehe, 100dvh) - 24px);
  padding: 20px;
  border: 0;
  border-radius: 16px;
  overflow-y: auto;
}

.abschluss-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.abschluss-dialog section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.abschluss-dialog section[hidden] {
  display: none;
}

.abschluss-dialog h2 {
  margin: 0;
  font-size: 1.2rem;
}

.abschluss-dialog p,
.abschluss-dialog label {
  margin: 0;
  line-height: 1.45;
}

.abschluss-dialog label {
  font-weight: 600;
}

.abschluss-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font: inherit;
  line-height: 1.45;
  border: 1px solid #c7c7cc;
  border-radius: 12px;
  resize: vertical;
}

.abschluss-dialog [data-schritt="laedt"] {
  align-items: center;
  padding: 16px 0;
  text-align: center;
}

.abschluss-meldung {
  padding: 10px 12px;
  border-radius: 10px;
  color: #7a4b00;
  background: #ffefc2;
}

.abschluss-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}
