/* ---- Gestaltung: Farben, Radien, Schatten ----
   --grund: Seitenleiste und Eingabefelder, --flaeche: Chatbereich, Karten und Menüs, --flaeche-2: Hover.
   --akzent füllt Knöpfe und Balken (weiße Schrift darauf), --akzent-schrift ist der Akzent als Schrift- oder Linienfarbe. */
:root {
  --grund: #f6f6f8;
  --flaeche: #ffffff;
  --flaeche-2: #efeff2;
  --linie: #e4e5e9;
  --linie-stark: #d2d4da;
  --text: #1b1c1f;
  --gedimmt: #6b6e76;
  --akzent: #3b5bdb;
  --akzent-schrift: #3b5bdb;
  --akzent-zart: rgba(59, 91, 219, .1);
  --akzent-text: #ffffff;
  --nutzer: #edf0fb;
  --gut: #1a7f4b;
  --warn: #b26a00;
  --warn-zart: rgba(214, 150, 40, .12);
  --schlecht: #c93535;
  --schlecht-flaeche: #c93535;
  --system: #c2410c;
  --code: #f3f3f6;
  --markiert: #ffe58a;
  --r-xs: 4px;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --radius: var(--r-m);
  --schatten-1: 0 1px 2px rgba(17, 20, 28, .06);
  --schatten-2: 0 1px 3px rgba(17, 20, 28, .05), 0 6px 20px rgba(17, 20, 28, .07);
  --schatten-3: 0 4px 12px rgba(17, 20, 28, .08), 0 16px 40px rgba(17, 20, 28, .14);
  --spalte: 820px;
  --schnell: .15s ease;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "DejaVu Sans Mono", monospace;
  color-scheme: light;
}
/* Dunkel: nach Systemeinstellung, außer hell ist fest gewählt (thema.js), oder fest gewählt */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #121316;
    --flaeche: #1a1b1f;
    --flaeche-2: #26272c;
    --linie: #2d2e34;
    --linie-stark: #3d3e45;
    --text: #e8e9ec;
    --gedimmt: #9b9ea8;
    --akzent: #4263eb;
    --akzent-schrift: #91a7ff;
    --akzent-zart: rgba(110, 140, 255, .14);
    --nutzer: #262b3d;
    --gut: #2f9e60;
    --warn: #e0a34a;
    --warn-zart: rgba(224, 163, 74, .12);
    --schlecht: #e5534b;
    --system: #f08c4a;
    --code: #232429;
    --markiert: #7a6118;
    --schatten-1: 0 1px 2px rgba(0, 0, 0, .3);
    --schatten-2: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
    --schatten-3: 0 4px 12px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --grund: #121316;
  --flaeche: #1a1b1f;
  --flaeche-2: #26272c;
  --linie: #2d2e34;
  --linie-stark: #3d3e45;
  --text: #e8e9ec;
  --gedimmt: #9b9ea8;
  --akzent: #4263eb;
  --akzent-schrift: #91a7ff;
  --akzent-zart: rgba(110, 140, 255, .14);
  --nutzer: #262b3d;
  --gut: #2f9e60;
  --warn: #e0a34a;
  --warn-zart: rgba(224, 163, 74, .12);
  --schlecht: #e5534b;
  --system: #f08c4a;
  --code: #232429;
  --markiert: #7a6118;
  --schatten-1: 0 1px 2px rgba(0, 0, 0, .3);
  --schatten-2: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
  --schatten-3: 0 4px 12px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--grund);
  color: var(--text);
  font: 15px/1.55 var(--schrift);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
button, input, textarea, select { font: inherit; color: inherit; }
button {
  border: 1px solid var(--linie);
  background: var(--flaeche);
  border-radius: var(--r-s);
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color var(--schnell), border-color var(--schnell), color var(--schnell), box-shadow var(--schnell);
}
/* Ohne Gewicht, damit jede Klasse mit eigenem Hintergrund (aktiv, gewählt …) Vorrang behält */
:where(button:hover:not(:disabled)) { background: var(--flaeche-2); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
:where(input:not([type=checkbox], [type=radio], [type=file], [type=range], [type=color]), textarea, select) {
  border: 1px solid var(--linie); border-radius: var(--r-s); background: var(--grund);
  transition: border-color var(--schnell), box-shadow var(--schnell);
}
:where(input:not([type=checkbox], [type=radio], [type=file]), textarea, select):focus-visible {
  outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-zart);
}
input[type=checkbox], input[type=radio] { accent-color: var(--akzent); }
.knopf-primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); font-weight: 550; }
.knopf-primaer:hover:not(:disabled) { background: var(--akzent); filter: brightness(1.1); }
.knopf-stopp { background: var(--schlecht-flaeche); border-color: var(--schlecht-flaeche); color: #fff; }
.knopf-stopp:hover:not(:disabled) { background: var(--schlecht-flaeche); filter: brightness(1.1); }
.knopf-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; flex: none;
  border: none; background: none; border-radius: var(--r-s); color: var(--gedimmt); font-size: 18px; line-height: 1; text-decoration: none;
}
.knopf-icon:hover:not(:disabled) { background: var(--flaeche-2); color: var(--text); }
.knopf-icon.knopf-rahmen { border: 1px solid var(--linie); background: var(--flaeche); }
.knopf-icon.knopf-rahmen:hover:not(:disabled) { background: var(--flaeche-2); }
/* Symbole aus icons.svg (Lucide): Linienzeichnung in der Schriftfarbe */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic.dreht { animation: drehen 1s linear infinite; }
.mit-symbol > .ic:first-child { width: 1.15em; height: 1.15em; margin-right: .4em; vertical-align: -.2em; }
.nur-symbol { display: inline-grid; place-items: center; vertical-align: middle; }
.nur-symbol .ic { width: 15px; height: 15px; }
@keyframes drehen { to { transform: rotate(360deg); } }
@keyframes puls { 50% { opacity: .3; } }
@keyframes auftauchen { from { opacity: 0; transform: translateY(-4px); } }
.gedimmt { color: var(--gedimmt); }
.fehler { color: var(--schlecht); }
[hidden] { display: none !important; }
code, pre { font-family: var(--mono); font-size: 13px; }
* { scrollbar-width: thin; scrollbar-color: var(--linie-stark) transparent; }

/* ---- Kopplung und Anmeldung ---- */
#koppeln, #anmelden { display: grid; place-items: center; min-height: 100%; padding: 16px; background: var(--grund); }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-l); padding: 28px; max-width: 420px; width: 100%; box-shadow: var(--schatten-2); }
.karte-logo { display: block; width: 44px; height: 44px; border-radius: 11px; margin-bottom: 16px; }
.karte h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.01em; }
.karte p { color: var(--gedimmt); margin: 0 0 18px; }
#koppel-form, #anmelde-form { display: grid; gap: 10px; }
#koppel-form input, #anmelde-form input { padding: 10px 12px; font-size: 16px; }
#koppel-form button, #anmelde-form button { padding: 9px 12px; }
#koppel-code { font-size: 24px !important; letter-spacing: 6px; text-align: center; }

/* ---- Gerüst ---- */
#app { display: flex; height: 100dvh; }
#seitenleiste {
  width: 288px; flex: none; display: flex; flex-direction: column;
  background: var(--grund); border-right: 1px solid var(--linie);
}
.leiste-kopf { display: grid; gap: 12px; padding: 14px 12px 10px; }
.marke { display: flex; align-items: center; gap: 9px; padding: 0 4px; font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; }
.marke img { width: 24px; height: 24px; border-radius: 6px; }
.neu-knoepfe { display: flex; gap: 6px; align-items: center; }
#neu { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; }
#neu .ic { width: 17px; height: 17px; stroke-width: 2.2; }
.suche-zeile { display: flex; gap: 6px; margin: 0 12px 8px; }
.suche-feld { position: relative; display: block; flex: 1; min-width: 0; }
/* Reihenfolge der Chatliste: zeigt, wonach sortiert ist, Klick wechselt */
#sortierung { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 0 8px; font-size: 12.5px; color: var(--gedimmt); }
#sortierung:hover { color: var(--text); background: var(--flaeche-2); }
#sortierung .ic { width: 14px; height: 14px; }
.suche-feld .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--gedimmt); pointer-events: none; }
#suche { width: 100%; padding: 7px 10px 7px 32px; background: var(--flaeche); }
#chatliste { flex: 1; overflow-y: auto; padding: 2px 8px 12px; }

/* Ordnergruppen: Pfeil aus zwei Rändern, Knöpfe erst beim Überfahren */
.gruppe { margin-top: 2px; }
.gruppe summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px;
  padding: 5px 6px 5px 8px; border-radius: var(--r-s); font-size: 13px; font-weight: 600; color: var(--gedimmt);
}
.gruppe summary:hover { background: var(--flaeche-2); color: var(--text); }
.gruppe summary::-webkit-details-marker { display: none; }
.gruppe summary::before, details.denken > summary::before, details.werkzeug > summary::before {
  content: ""; flex: none; display: inline-block; width: 5px; height: 5px; margin: 0 7px 0 1px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--schnell); opacity: .7;
}
.gruppe[open] summary::before, details.denken[open] > summary::before, details.werkzeug[open] > summary::before { transform: rotate(45deg); }
.gruppe-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gruppe-name.vorlaeufig { font-style: italic; }
.gruppe-neu {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; flex: none;
  border: none; background: none; color: var(--gedimmt); border-radius: 6px; cursor: pointer; opacity: 0;
}
.gruppe-neu .ic { width: 15px; height: 15px; }
.gruppe summary:hover .gruppe-neu, .gruppe-neu:focus-visible { opacity: 1; }
.gruppe-neu:hover:not(:disabled) { background: var(--linie); color: var(--text); }
@media (hover: none) { .gruppe-neu { opacity: .8; } }
.gruppe > .eintrag, .gruppe > .chat-zeile > .eintrag { padding-left: 22px; }

/* Ordner mit nur einem Chat: eine Zeile, Ordnerknöpfe beim Überfahren (am Touchgerät am geöffneten Chat).
   Chats in einer Ordnergruppe: ebenso der Knopf zum Löschen des Chats. */
.einzeln { position: relative; margin-top: 2px; }
.chat-zeile { position: relative; }
.zeile-aktionen { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; gap: 1px; opacity: 0; pointer-events: none; }
/* Die Zeile blendet ein, der Knopf selbst ist sichtbar (sonst bliebe er bei .gruppe-neu auf opacity 0) */
.zeile-aktionen .gruppe-neu { opacity: 1; }
.einzeln:hover .zeile-aktionen, .einzeln:focus-within .zeile-aktionen,
.chat-zeile:hover .zeile-aktionen, .chat-zeile:focus-within .zeile-aktionen { opacity: 1; pointer-events: auto; }
.einzeln:hover .eintrag .zeit, .einzeln:focus-within .eintrag .zeit,
.chat-zeile:hover .eintrag .zeit, .chat-zeile:focus-within .eintrag .zeit { visibility: hidden; }
@media (hover: none) {
  .einzeln:has(.eintrag.aktiv) .zeile-aktionen, .chat-zeile:has(.eintrag.aktiv) .zeile-aktionen { opacity: 1; pointer-events: auto; }
  .einzeln:has(.eintrag.aktiv) .zeit, .chat-zeile:has(.eintrag.aktiv) .zeit { visibility: hidden; }
}

.eintrag {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font-size: 14px;
  border: none; background: none; border-radius: var(--r-s); padding: 7px 8px; color: var(--text);
}
.eintrag:hover:not(:disabled) { background: var(--flaeche-2); }
.eintrag.aktiv, .eintrag.aktiv:hover:not(:disabled) { background: var(--flaeche); box-shadow: var(--schatten-1), inset 0 0 0 1px var(--linie); }
.eintrag.aktiv .name { font-weight: 550; }
.eintrag .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag .name .ic { width: 14px; height: 14px; margin-right: 4px; }
.eintrag .zeit { font-size: 11.5px; color: var(--gedimmt); flex: none; font-variant-numeric: tabular-nums; }
.punkt { width: 7px; height: 7px; border-radius: 50%; flex: none; background: transparent; }
.punkt.busy { background: var(--akzent); animation: puls 1.2s infinite; }
.punkt.frage { background: var(--warn); }
/* Systemzugriff: Shell-Befehle dieses Chats laufen als der Benutzer selbst statt in der Sandbox */
.eintrag.systemzugriff { box-shadow: inset 3px 0 0 var(--system); }
.eintrag.systemzugriff .name { color: var(--system); font-weight: 600; }
body.systemzugriff-an .chat-kopf { box-shadow: inset 0 -3px 0 var(--system); }
body.systemzugriff-an #titel { color: var(--system); }
body.systemzugriff-an .eingabe-karte { border-color: var(--system); }
.systemzugriff-leiste {
  max-width: var(--spalte); width: calc(100% - 40px); margin: 8px auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  border: 1px solid var(--system); border-left-width: 4px; border-radius: var(--r-m); background: var(--flaeche);
  padding: 8px 12px; font-size: 13px;
}
.systemzugriff-leiste[hidden] { display: none; }
.systemzugriff-leiste span { flex: 1; min-width: 200px; }
.systemzugriff-leiste > .ic { color: var(--system); width: 16px; height: 16px; }

/* Fuß der Seitenleiste */
.leiste-fuss { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 8px; border-top: 1px solid var(--linie); }
.leiste-fuss button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  font-size: 12.5px; padding: 7px 4px; border: none; background: none; color: var(--gedimmt);
}
.leiste-fuss button .ic { width: 16px; height: 16px; }
.leiste-fuss button:hover:not(:disabled) { background: var(--flaeche-2); color: var(--text); }
.leiste-fuss button.aktiv, .leiste-fuss button.aktiv:hover:not(:disabled) { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-1), inset 0 0 0 1px var(--linie); }
.leiste-unten { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px calc(10px + env(safe-area-inset-bottom)); }
.verbindung { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--gedimmt); }
.verbindung.ok::before, .verbindung.weg::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gut);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gut) 22%, transparent);
}
.verbindung.weg::before { background: var(--schlecht); box-shadow: 0 0 0 3px color-mix(in srgb, var(--schlecht) 22%, transparent); }
.abmelden { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 8px; border: none; background: none; color: var(--gedimmt); }
.abmelden .ic { width: 14px; height: 14px; }
.thema-knopf { width: 28px; height: 28px; margin-left: auto; }
.thema-knopf .ic { width: 15px; height: 15px; }

/* ---- Chat: Kopfzeile ---- */
#chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--flaeche); }
.chat-kopf {
  display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 8px 12px 8px 20px;
  border-bottom: 1px solid var(--linie); background: var(--flaeche);
}
#menue { display: none; }
.chat-titel { flex: 1; min-width: 0; }
#titel { font-weight: 600; letter-spacing: -.005em; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#untertitel { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Status, Kontext und Tempo in einer Kapsel; ohne sichtbaren Inhalt verschwindet sie */
.kopf-status {
  display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; padding: 4px 12px; height: 30px;
  border: 1px solid var(--linie); border-radius: 999px; background: var(--grund); font-size: 12px; color: var(--gedimmt);
}
.kopf-status:not(:has(> :not([hidden]))) { display: none; }
.status { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: var(--gedimmt); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gut); }
.status.busy { color: var(--akzent-schrift); }
.status.busy::before { background: var(--akzent); animation: puls 1.2s infinite; }
/* Auswahlfelder als Kapseln mit eigenem Pfeil */
#stufe, #agent {
  appearance: none; -webkit-appearance: none; flex: none; height: 30px; cursor: pointer;
  border: 1px solid var(--linie); border-radius: 999px; padding: 0 26px 0 12px; font-size: 12.5px;
  background: var(--flaeche) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8d96' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 12px;
}
#stufe:hover, #agent:hover { border-color: var(--linie-stark); }

/* ---- Verlauf ---- */
#verlauf { flex: 1; overflow-y: auto; padding: 24px 20px 8px; }
.leer { color: var(--gedimmt); text-align: center; margin: 18vh auto 0; max-width: 380px; }
.leer h2 { color: var(--text); font-size: 18px; font-weight: 600; margin: 16px 0 6px; letter-spacing: -.01em; }
.leer p { margin: 0; font-size: 14px; }
.leer-symbol { box-sizing: content-box; width: 26px; height: 26px; padding: 14px; border-radius: 16px; background: var(--akzent-zart); color: var(--akzent-schrift); stroke-width: 1.6; }
.nachricht { max-width: var(--spalte); margin: 0 auto 22px; }
.nachricht.user .blase {
  width: fit-content; max-width: 85%; margin-left: auto;
  background: var(--nutzer); border-radius: 18px 18px 6px 18px; padding: 10px 16px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.meta { font-size: 12px; color: var(--gedimmt); margin: 4px 2px; }
.verdichtung-marke { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--gedimmt); }
.verdichtung-marke::before, .verdichtung-marke::after { content: ""; flex: 1; border-top: 1px dashed var(--linie-stark); }
.teil { margin: 6px 0; }
.teil:has(> details.werkzeug) { margin: 2px 0; }
.text { overflow-wrap: anywhere; line-height: 1.65; }
.text > :first-child { margin-top: 0; }
.text > :last-child { margin-bottom: 0; }
.text h1, .text h2, .text h3, .text h4 { line-height: 1.3; letter-spacing: -.01em; margin: 1.3em 0 .5em; }
.text h1 { font-size: 1.4em; }
.text h2 { font-size: 1.22em; }
.text h3 { font-size: 1.08em; }
.text h4 { font-size: 1em; }
.text li { margin: .2em 0; }
.text a { color: var(--akzent-schrift); text-underline-offset: 2px; text-decoration-thickness: 1px; }
.text hr { border: none; border-top: 1px solid var(--linie); margin: 1.4em 0; }
.text pre { background: var(--code); border: 1px solid var(--linie); padding: 12px 14px; border-radius: var(--r-m); overflow-x: auto; line-height: 1.5; }
.text code { background: var(--code); padding: 1px 5px; border-radius: var(--r-xs); font-size: .88em; }
.text pre code { background: none; padding: 0; font-size: 13px; }
/* Codeblock mit Kopierknopf (md.js); der Knopf bleibt beim waagrechten Blättern stehen */
.code-block { position: relative; margin: 1em 0; }
.text > .code-block:first-child { margin-top: 0; }
.text > .code-block:last-child { margin-bottom: 0; }
.code-block > pre { margin: 0; }
.code-kopie {
  position: absolute; top: 7px; right: 7px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--gedimmt); border-radius: var(--r-s);
  opacity: 0; transition: opacity var(--schnell), color var(--schnell), background-color var(--schnell);
}
.code-kopie .ic { width: 15px; height: 15px; }
.code-block:hover .code-kopie, .code-kopie:focus-visible, .code-kopie.kopiert { opacity: 1; }
.code-kopie:hover:not(:disabled) { color: var(--text); }
.code-kopie.kopiert { color: var(--gut); }
@media (hover: none) { .code-kopie { opacity: .85; } }
.kopier-hilfe { position: fixed; top: 0; left: -9999px; opacity: 0; }
.text table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; }
.text th, .text td { border: 1px solid var(--linie); padding: 6px 10px; text-align: left; vertical-align: top; }
.text th { background: var(--grund); font-weight: 600; }
.text blockquote { border-left: 3px solid var(--linie-stark); margin: 8px 0; padding-left: 14px; color: var(--gedimmt); }
.text .formel { font-family: var(--mono); background: var(--code); padding: 6px 10px; border-radius: var(--r-s); overflow-x: auto; white-space: pre; }

/* Denkphase und Werkzeuge: zugeklappt nur eine graue Zeile, aufgeklappt eine Karte */
details.denken, details.werkzeug { border: 1px solid transparent; border-radius: var(--r-m); transition: background-color var(--schnell), border-color var(--schnell); }
details.denken[open], details.werkzeug[open] { border-color: var(--linie); background: var(--grund); }
details.denken > summary, details.werkzeug > summary {
  list-style: none; display: block; width: fit-content; max-width: 100%; cursor: pointer;
  padding: 4px 10px; border-radius: var(--r-m); font-size: 13px; color: var(--gedimmt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
details.denken > summary::-webkit-details-marker, details.werkzeug > summary::-webkit-details-marker { display: none; }
details.denken > summary::before, details.werkzeug > summary::before { vertical-align: .15em; }
details.denken > summary:hover, details.werkzeug > summary:hover { background: var(--flaeche-2); color: var(--text); }
details.denken[open] > summary, details.werkzeug[open] > summary { width: auto; }
details.denken[open] > summary:hover, details.werkzeug[open] > summary:hover { background: none; }
.denken-text {
  white-space: pre-wrap; font-size: 13px; color: var(--gedimmt); line-height: 1.55;
  padding: 0 14px 12px; max-height: 50vh; overflow-y: auto; overflow-wrap: anywhere;
}
.zusammenfassung-text { padding: 0 14px 12px; font-size: 13px; max-height: 60vh; overflow-y: auto; }
.werkzeug-inhalt { padding: 0 10px 10px; }
.werkzeug-inhalt pre {
  background: var(--flaeche); border: 1px solid var(--linie); padding: 8px 10px; border-radius: var(--r-s); overflow-x: auto;
  max-height: 40vh; overflow-y: auto; margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ok-zeichen { color: var(--gut); }
.fehl-zeichen { color: var(--schlecht); }
.ok-zeichen .ic, .fehl-zeichen .ic, summary > .ic { width: 14px; height: 14px; vertical-align: -.15em; stroke-width: 2.2; }
summary > .ic.schloss { width: 13px; height: 13px; margin-right: 3px; stroke-width: 2; color: var(--gedimmt); }
.fehler-kasten {
  max-width: var(--spalte); margin: 0 auto 18px; border: 1px solid color-mix(in srgb, var(--schlecht) 45%, transparent);
  background: color-mix(in srgb, var(--schlecht) 7%, transparent);
  color: var(--schlecht); border-radius: var(--r-m); padding: 10px 14px; white-space: pre-wrap;
}

#rueckfragen { padding: 0 20px; }
.rueckfrage {
  max-width: var(--spalte); margin: 8px auto; border: 1px solid var(--linie); border-left: 4px solid var(--warn);
  border-radius: var(--r-m); background: var(--flaeche); padding: 14px 16px; box-shadow: var(--schatten-2);
}
.rueckfrage h3 { margin: 0 0 6px; font-size: 14px; }
.rueckfrage pre { background: var(--code); padding: 8px 10px; border-radius: var(--r-s); margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40vh; overflow-y: auto; }
.rueckfrage .optionen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rueckfrage .option small { display: block; color: var(--gedimmt); font-size: 12px; }
.rueckfrage .eigene-antwort { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.rueckfrage .eigene-antwort textarea { flex: 1; min-width: 0; resize: vertical; min-height: 40px; max-height: 30vh; padding: 8px 10px; }
.rueckfrage .option.gewaehlt { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); background: color-mix(in srgb, var(--akzent) 12%, var(--flaeche)); }
.rueckfrage .frage + .frage { border-top: 1px solid var(--linie); margin-top: 14px; padding-top: 12px; }
.rueckfrage .frage .meta { margin-bottom: 4px; }
.rueckfrage .absenden { margin-top: 14px; }
/* Rückfrage im Verlauf (beantwortet oder geschlossen) */
.frage-verlauf { border: 1px solid var(--linie); border-left: 3px solid var(--warn); border-radius: var(--r-m); padding: 8px 12px; }
.frage-verlauf-kopf { font-size: 12px; color: var(--gedimmt); }
.frage-verlauf-eintrag { margin-top: 8px; }
.frage-verlauf-frage { font-size: 14px; font-weight: 550; }
.frage-verlauf-optionen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.frage-chip { font-size: 13px; padding: 2px 10px; border: 1px solid var(--linie); border-radius: 999px; color: var(--gedimmt); }
button.frage-chip { color: var(--text); }
.frage-chip.gewaehlt { color: var(--text); border-color: var(--akzent); background: color-mix(in srgb, var(--akzent) 12%, var(--flaeche)); font-weight: 550; }
.frage-offen { font-size: 12px; color: var(--warn); }

/* ---- Eingabe: Karte mit Textfeld oben und Knopfleiste unten ---- */
.eingabe { padding: 6px 20px calc(16px + env(safe-area-inset-bottom)); background: var(--flaeche); }
.eingabe-karte {
  position: relative; max-width: var(--spalte); margin: 0 auto; display: flex; flex-direction: column;
  background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 20px; box-shadow: var(--schatten-2);
  transition: border-color var(--schnell), box-shadow var(--schnell);
}
.eingabe-karte:focus-within { border-color: color-mix(in srgb, var(--akzent) 55%, var(--linie)); box-shadow: var(--schatten-2), 0 0 0 3px var(--akzent-zart); }
.eingabe-feld { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 0; }
#eingabe {
  width: 100%; resize: none; max-height: 40vh; padding: 4px; overflow-y: hidden; line-height: 1.5;
  border: none; border-radius: 0; background: transparent; box-shadow: none; outline: none;
}
.eingabe-leiste { display: flex; align-items: center; gap: 2px; padding: 4px 8px 8px; }
.eingabe-leiste .fuellung { flex: 1; }
.knopf-senden, #stopp, #zweig-stopp { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; flex: none; border-radius: 50%; }
.knopf-senden .ic { stroke-width: 2.3; }
#stopp, #zweig-stopp { background: var(--text); border-color: var(--text); color: var(--flaeche); margin-right: 4px; }
#stopp .ic, #zweig-stopp .ic { width: 13px; height: 13px; fill: currentColor; }
.knopf-senden:disabled { background: var(--linie-stark); border-color: var(--linie-stark); opacity: 1; }

dialog {
  border: 1px solid var(--linie); border-radius: var(--r-l); background: var(--flaeche); color: var(--text);
  width: min(480px, calc(100vw - 32px)); padding: 22px; box-shadow: var(--schatten-3);
}
dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.01em; }
#neu-form { display: grid; gap: 8px; }
#neu-ordner { padding: 8px 10px; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---- Schmal (Handy) ---- */
@media (max-width: 760px) {
  #menue { display: inline-grid; }
  #seitenleiste {
    position: fixed; inset: 0 auto 0 0; z-index: 10; width: min(86vw, 320px);
    transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
    padding-top: env(safe-area-inset-top);
  }
  body.leiste-offen #seitenleiste { transform: none; box-shadow: var(--schatten-3); }
  #verlauf { padding: 14px 12px 6px; }
  .nachricht.user .blase { max-width: 90%; }
}

/* ---- Stufe 2 ---- */
.menue-wrap { position: relative; }
.menue-liste {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-m);
  box-shadow: var(--schatten-3); padding: 5px; display: grid; animation: auftauchen .12s ease-out;
}
.menue-liste button { border: none; text-align: left; background: none; padding: 8px 10px; border-radius: var(--r-s); font-size: 14px; white-space: nowrap; }
.menue-liste button:hover:not(:disabled) { background: var(--flaeche-2); }
.menue-liste .gefahr { color: var(--schlecht); }

#plan { max-width: var(--spalte); width: calc(100% - 40px); margin: 0 auto 8px; border: 1px solid var(--linie); border-radius: var(--r-m); background: var(--flaeche); box-shadow: var(--schatten-1); }
#plan summary { cursor: pointer; padding: 7px 12px; font-size: 13px; font-weight: 600; }
#plan-liste { margin: 0; padding: 0 12px 10px 36px; font-size: 13px; max-height: 30vh; overflow-y: auto; }
#plan-liste li { margin: 2px 0; }
#plan-liste li.completed { color: var(--gedimmt); text-decoration: line-through; }
#plan-liste li.cancelled { color: var(--gedimmt); text-decoration: line-through; font-style: italic; }
#plan-liste li.in_progress { font-weight: 600; }
#plan-liste li.in_progress::marker { color: var(--akzent-schrift); }
#plan.veraltet summary { color: var(--gedimmt); font-weight: 500; }
#plan.veraltet #plan-liste li.in_progress { font-weight: normal; }
#plan.veraltet #plan-liste li.in_progress::marker { color: inherit; }

.anhaenge { display: flex; flex-wrap: wrap; gap: 6px; }
.anhang { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--flaeche-2); border-radius: 999px; padding: 3px 4px 3px 10px; max-width: 100%; }
.anhang span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anhang button { border: none; background: none; padding: 0 6px; }
.vorschlaege {
  position: absolute; bottom: 100%; left: 0; right: 0; margin-bottom: 8px; z-index: 5;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-m);
  box-shadow: var(--schatten-3); max-height: 40vh; overflow-y: auto; padding: 5px;
}
.vorschlaege button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 7px 10px; border-radius: var(--r-s); }
.vorschlaege button.gewaehlt, .vorschlaege button:hover:not(:disabled) { background: var(--flaeche-2); }
.vorschlaege small { display: block; color: var(--gedimmt); }
#chat.ziehen::after {
  content: "Datei hier ablegen"; position: fixed; inset: 8px; display: grid; place-items: center; border-radius: var(--r-l);
  background: var(--akzent-zart); border: 2px dashed var(--akzent); color: var(--akzent-schrift); font-size: 20px; font-weight: 600; pointer-events: none;
}

#suchtreffer { border-top: 1px solid var(--linie); padding: 6px; max-height: 45%; overflow-y: auto; }
#suchtreffer h4 { margin: 4px 8px; font-size: 12px; color: var(--gedimmt); }
.treffer { display: block; width: 100%; text-align: left; border: none; background: none; border-radius: var(--r-s); padding: 6px 8px; }
.treffer:hover:not(:disabled) { background: var(--flaeche-2); }
.treffer .name { font-weight: 600; font-size: 13px; }
.treffer .auszug { font-size: 12px; color: var(--gedimmt); display: block; overflow-wrap: anywhere; }
.treffer mark { background: var(--markiert); color: inherit; border-radius: 2px; }

/* ---- Stufe 3: System und Prüfläufe ---- */
#panel { flex: 1; overflow-y: auto; padding: 20px; }
.kacheln { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); max-width: 1100px; margin: 0 auto; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-m); padding: 16px; min-width: 0; box-shadow: var(--schatten-1); }
.kachel h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: -.005em; }
.kachel .zeile { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 2px 0; }
.kachel .zeile span:first-child { color: var(--gedimmt); }
.balken { height: 8px; background: var(--flaeche-2); border-radius: 999px; overflow: hidden; margin: 6px 0 8px; }
.balken > div { height: 100%; background: var(--akzent); border-radius: 999px; }
.balken.voll > div { background: var(--warn); }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.knopfreihe select { flex: 1; min-width: 0; max-width: 260px; padding: 5px; }
.knopfreihe button.gewaehlt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.hinweis { font-size: 12px; color: var(--gedimmt); margin-top: 8px; }
.marke-zustand { font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--flaeche-2); white-space: nowrap; }
.marke-zustand.laeuft { background: var(--akzent); color: var(--akzent-text); }
.marke-zustand.fertig { background: var(--gut); color: #fff; }
.marke-zustand.wartet { background: var(--warn); color: #fff; }
.marke-zustand.relevanz-hoch { background: var(--schlecht); color: #fff; }
.marke-zustand.relevanz-mittel { background: var(--warn); color: #fff; }

/* ---- Beobachtungen ---- */
.leiste-fuss .zaehler { font-size: 11px; line-height: 16px; min-width: 16px; padding: 0 5px; border-radius: 999px;
  background: var(--schlecht); color: #fff; font-weight: 600; }
.lauf.ungelesen .kopf > span:first-child::before { content: "● "; color: var(--akzent); }
.beob-text { color: var(--text) !important; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.beob-fehler { color: var(--schlecht) !important; }
.beob-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 18px 0 8px; }
.beob-filter h3 { margin: 0 8px 0 0; }
.beob-filter button.gewaehlt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.beob-aktionen { margin-bottom: 14px; }
.beob-zitat { margin: 0; padding: 8px 14px; border-left: 3px solid var(--akzent); background: var(--flaeche); border-radius: 0 var(--r-s) var(--r-s) 0; }
/* ---- Sicherheit ---- */
.sich-befund, .sich-app { margin-bottom: 10px; padding: 12px 14px; }
.sich-befund .kopf, .sich-app .kopf, .heise-heft .kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.heise-liste { display: grid; gap: 12px; }
.heise-heft details { margin-top: 10px; }
.heise-heft summary { cursor: pointer; font-weight: 600; }
.heise-themen { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 10px; }
.heise-themen li > div { margin-top: 2px; }
.heise-heft .knopfreihe { margin-top: 10px; }
.heise-vorschlag { justify-self: start; }
.sich-marken { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sich-abhilfe { margin: 8px 0 4px; font-size: 13px; }
.sich-meldungen { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.sich-meldungen li { margin-bottom: 6px; }
.sich-befund .klein, .sich-app .klein, .sich-geprueft .klein { font-size: 12px; overflow-wrap: anywhere; }
.sich-geprueft { font-size: 13px; margin: 6px 0; }
.sich-teil { margin-bottom: 10px; }
.sich-teil > summary + * { margin-top: 10px; }
.lauf { display: block; width: 100%; text-align: left; margin-bottom: 8px; border-radius: var(--r-m); padding: 10px 14px; }
.lauf .kopf { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 600; }
.lauf .klein { font-size: 12px; color: var(--gedimmt); overflow-wrap: anywhere; margin-top: 4px; }
.panel-inhalt { max-width: 1000px; margin: 0 auto; }
.panel-inhalt pre { background: var(--code); padding: 10px; border-radius: var(--r-s); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; max-height: 40vh; overflow-y: auto; }
.zurueck { margin-bottom: 12px; }

/* ---- Prüflauf-Formular ---- */
.pruef-formular { display: grid; gap: 14px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-m); padding: 18px; box-shadow: var(--schatten-1); }
.feld { display: grid; gap: 6px; }
.feld-name { font-weight: 600; font-size: 14px; }
.feld textarea, .feld input:not([type]) { width: 100%; padding: 8px 10px; }
.feld input[type=file] { font-size: 13px; }
.quellen { display: grid; gap: 4px; max-height: 30vh; overflow-y: auto; padding: 6px 8px; border: 1px solid var(--linie); border-radius: var(--r-s); background: var(--grund); }
.quelle { font-size: 13px; overflow-wrap: anywhere; }
.schalter { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 6px; font-weight: 600; font-size: 14px; }
.schalter .hinweis { grid-column: 2; font-weight: normal; margin-top: 0; }
.pruef-formular .knopf-primaer { justify-self: start; padding: 8px 18px; }

.tabellen-wrap table { display: table; width: 100%; font-size: 13px; background: var(--flaeche); }
.tabellen-wrap tr.summe td { font-weight: 700; border-top: 2px solid var(--linie-stark); }
.tabellen-wrap tr.laufend td { color: var(--akzent-schrift); }
.tabellen-wrap td:nth-child(n+3), .tabellen-wrap th:nth-child(n+3) { text-align: right; }

#diktat-knopf.aufnahme, #diktat-knopf.aufnahme:hover:not(:disabled) {
  width: auto; padding: 0 10px; gap: 6px; grid-auto-flow: column; background: var(--schlecht-flaeche); color: #fff;
  border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
#diktat-knopf.aufnahme .ic { width: 12px; height: 12px; fill: currentColor; }
#diktat-knopf.arbeitet { cursor: progress; }
#web-schalter { position: relative; }
#web-schalter.web-an { color: var(--akzent-schrift); }
#web-schalter.web-aus { opacity: .55; }
#web-schalter.web-aus::after {
  content: ""; position: absolute; left: 7px; right: 7px; top: 50%; height: 2px; border-radius: 1px;
  background: var(--schlecht); transform: rotate(-35deg);
}

.nachricht-aktionen { display: flex; justify-content: flex-end; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity var(--schnell); }
.nachricht.user:hover .nachricht-aktionen, .nachricht.user:focus-within .nachricht-aktionen { opacity: 1; }
@media (pointer: coarse) { .nachricht-aktionen { opacity: .8; } }
.nachricht-aktionen button { border: none; background: none; font-size: 12px; color: var(--gedimmt); padding: 2px 8px; border-radius: 6px; }
.nachricht-aktionen button:hover:not(:disabled) { color: var(--akzent-schrift); background: var(--flaeche-2); }
.frage-editor { margin-left: 15%; background: var(--nutzer); border-radius: var(--r-l); padding: 8px; }
.frage-editor textarea { display: block; width: 100%; min-height: 80px; resize: vertical; background: var(--flaeche); padding: 8px 10px; }
.frage-editor .optionen { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.frage-editor .optionen .meta { margin-right: auto; }
@media (max-width: 700px) { .frage-editor { margin-left: 8%; } }

.abbruch-hinweis { font-size: 13px; color: var(--gedimmt); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.abbruch-hinweis button, .fehler-kasten button { font-size: 12px; padding: 2px 10px; }

#neu-form .hinweis { font-size: 12px; color: var(--gedimmt); }
#neu-form code { font-size: 12px; }

.kontext { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gedimmt); flex: none; min-width: 0; }
.kontext-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kontext-balken { width: 64px; height: 5px; flex: none; border-radius: 999px; background: var(--linie); overflow: hidden; }
.kontext-balken > div { height: 100%; width: 0; background: var(--akzent); border-radius: 999px; }
.kontext.voll .kontext-balken > div { background: var(--warn); }
.kontext.kritisch .kontext-balken > div { background: var(--schlecht); }
.kontext-hinweis { color: var(--warn); }
.kontext.aus .kontext-text { color: var(--schlecht); font-weight: 600; }
@media (max-width: 760px) { .kontext-balken { width: 40px; } #stufe, #agent { max-width: 120px; } }

a.knopf { display: inline-block; border: 1px solid var(--linie); background: var(--flaeche); border-radius: var(--r-s);
          padding: 6px 12px; color: inherit; text-decoration: none; font-size: 14px; transition: background-color var(--schnell); }
a.knopf:hover { background: var(--flaeche-2); }
details.kachel summary { cursor: pointer; font-weight: 600; }

/* ---- Datei-Ansicht ---- */
.dateien .pfad { font-size: 12px; margin: 8px 0; overflow-wrap: anywhere; }
.dateiliste { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--flaeche); }
.dateiliste td { border-bottom: 1px solid var(--linie); padding: 6px; vertical-align: middle; }
.dateiliste tr:hover td { background: var(--grund); }
.dateiliste td.name { width: 55%; }
.dateiliste td.aktionen { text-align: right; white-space: nowrap; }
.dateiname { border: none; background: none; padding: 2px 0; text-align: left; overflow-wrap: anywhere; }
.dateiname:hover:not(:disabled) { color: var(--akzent-schrift); background: none; }
button.klein, a.knopf.klein { font-size: 12px; padding: 2px 8px; margin-left: 3px; }
button.gefahr { color: var(--schlecht); }
.vorschau { width: 100%; height: 75vh; border: 1px solid var(--linie); border-radius: var(--r-s); background: #fff; }
.vorschau-bild { max-width: 100%; border: 1px solid var(--linie); border-radius: var(--r-s); }
@media (max-width: 760px) { .dateiliste td:nth-child(2), .dateiliste td:nth-child(3) { display: none; } }

#hinweise { position: fixed; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.hinweis-toast { display: grid; gap: 2px; text-align: left; background: var(--flaeche); border: 1px solid var(--linie);
  border-left: 4px solid var(--akzent); border-radius: var(--r-m); padding: 10px 14px; box-shadow: var(--schatten-3); animation: auftauchen .15s ease-out; }
.hinweis-toast span { font-size: 13px; color: var(--gedimmt); overflow-wrap: anywhere; }

/* ---- Dateiänderungen ---- */
details.aenderungen { margin: 6px 0 0 15%; border: 1px solid var(--linie); border-radius: var(--r-m); background: var(--flaeche); font-size: 13px; }
details.aenderungen > summary { cursor: pointer; padding: 6px 12px; color: var(--gedimmt); }
.aenderungen-inhalt { padding: 0 12px 12px; display: grid; gap: 6px; }
.aenderungen-inhalt > button { justify-self: start; }
details.diff-datei summary { cursor: pointer; font-family: var(--mono); font-size: 12px; }
pre.diff { background: var(--code); padding: 8px; border-radius: var(--r-s); overflow-x: auto; max-height: 40vh; font-size: 12px; margin: 4px 0 0; }
.plus { color: var(--gut); } .minus { color: var(--schlecht); }
.zurueckgesetzt { max-width: var(--spalte); margin: 0 auto 8px; width: calc(100% - 40px); display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--linie); border-left: 4px solid var(--warn); border-radius: var(--r-m); padding: 8px 12px; font-size: 13px; background: var(--flaeche); }
.nachricht.verworfen { opacity: .35; }
.fortsetzung { max-width: var(--spalte); margin: 0 auto 8px; width: calc(100% - 40px); display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; border: 1px solid var(--linie); border-left: 4px solid var(--akzent); border-radius: var(--r-m); padding: 8px 12px;
  font-size: 13px; background: var(--flaeche); }
.fortsetzung > span { flex: 1 1 260px; }
.fortsetzung.fehler { border-left-color: var(--warn); }
.fortsetzung-kopf { max-width: var(--spalte); margin: 8px auto; width: calc(100% - 40px); font-size: 13px; color: var(--gedimmt); }
@media (max-width: 760px) { details.aenderungen { margin-left: 0; } }

.kopplungscode { font-family: var(--mono); font-size: 26px; letter-spacing: 6px; font-weight: 700; }
.vorlagen-dialog { width: min(720px, calc(100vw - 32px)); }
.vorlagen-liste { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; margin: 8px 0; }
.vorlage-zeile { display: grid; grid-template-columns: 1fr auto; gap: 6px; border: 1px solid var(--linie); border-radius: var(--r-m); padding: 10px; }
.vorlage-zeile input, .vorlage-zeile textarea { padding: 6px 8px; width: 100%; }
.vorlage-zeile textarea { grid-column: 1 / -1; resize: vertical; }
.vorlage-zeile button { grid-row: 1; grid-column: 2; }

/* ---- Anonymisierung ---- */
.anonym-leiste { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.anonym-zaehler { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.anon-typ { background: var(--flaeche-2); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.anonym-aktion { position: sticky; top: 0; z-index: 2; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-m);
  padding: 6px 10px; margin-bottom: 8px; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; box-shadow: var(--schatten-1); }
.anonym-aktion select { padding: 2px 4px; }
.anonym-text { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: var(--flaeche);
  border: 1px solid var(--linie); border-radius: var(--r-m); padding: 12px; max-height: 70vh; overflow: auto; }
mark.anon { cursor: pointer; border-radius: 3px; padding: 0 1px; }
mark.anon.an { background: #ffd66b; color: #1f2328; }
mark.anon.aus { background: transparent; color: inherit; text-decoration: line-through; text-decoration-color: var(--gedimmt); outline: 1px dashed var(--linie); }
.anonym-hinweis { overflow-wrap: anywhere; }   /* langer Pfad zur Zuordnung auf dem Handy */
.anonym-ergebnis { background: var(--code); padding: 12px; border-radius: var(--r-s); white-space: pre-wrap; max-height: 60vh; overflow: auto; font-size: 12px; }
.hinweis-kasten { border: 1px solid var(--linie); border-left: 4px solid var(--warn); border-radius: var(--r-s); padding: 8px 12px; margin: 8px 0; font-size: 13px; }
.vorlagen-dialog textarea { width: 100%; padding: 8px; margin-top: 6px; }

.agent-hinweis { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: var(--spalte); width: calc(100% - 40px); margin: 0 auto 8px; padding: 10px 14px; border: 1px solid var(--linie); border-radius: var(--r-m); background: var(--flaeche); box-shadow: var(--schatten-2); font-size: 14px; }
.agent-hinweis span { flex: 1 1 220px; }
.agent-hinweis button { padding: 4px 12px; border-radius: var(--r-s); border: 1px solid var(--linie); background: none; cursor: pointer; }
.agent-hinweis button.knopf-primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }

.anhang-bild { width: 28px; height: 28px; object-fit: cover; border-radius: var(--r-xs); margin-left: -6px; }
.blase-bilder { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.blase-bilder img { max-width: 220px; max-height: 160px; border-radius: var(--r-s); cursor: zoom-in; display: block; }

.grafiken { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.grafiken a { display: flex; flex-direction: column; gap: 4px; max-width: 100%; text-decoration: none; color: var(--gedimmt); font-size: 12px; }
.grafiken img { max-width: min(640px, 100%); max-height: 420px; object-fit: contain; border: 1px solid var(--linie); border-radius: var(--r-m); background: #fff; cursor: zoom-in; }

.pruefhinweise details { margin: 6px 0; font-size: 13px; border: 1px solid var(--linie); border-radius: var(--r-m); padding: 4px 12px; }
.pruefhinweise summary { cursor: pointer; color: var(--gedimmt); }
.pruefhinweise ul { margin: 6px 0; padding-left: 18px; }
.pruefhinweise li { margin: 2px 0; }
.pruefhinweise button { margin: 4px 0 6px; padding: 4px 10px; border-radius: var(--r-s); border: 1px solid var(--linie); background: none; cursor: pointer; }

/* ---------- Aktions-Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.chip { font-size: 12.5px; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); color: inherit; cursor: pointer; line-height: 1.5; }
.chip:hover:not(:disabled) { border-color: var(--akzent); color: var(--akzent-schrift); background: var(--akzent-zart); }
.chip .ic { width: 14px; height: 14px; margin-right: 4px; }
.teil .chips { opacity: .6; transition: opacity var(--schnell); }
.nachricht:hover .teil .chips, .teil .chips:focus-within { opacity: 1; }
@media (hover: none) { .teil .chips { opacity: 1; } }
.grafiken a + .chips, .grafik-karte .chips { margin-top: 2px; }
.grafik-karte { display: flex; flex-direction: column; gap: 4px; }
a.chip { text-decoration: none; display: inline-block; }

/* ---------- Auswahl-Werkzeugleiste ---------- */
.auswahl-leiste { position: fixed; z-index: 50; display: flex; gap: 2px; padding: 4px; border-radius: var(--r-m); background: var(--flaeche); border: 1px solid var(--linie); box-shadow: var(--schatten-3); }
.auswahl-leiste button { font-size: 13px; padding: 4px 10px; border: none; background: none; border-radius: var(--r-s); cursor: pointer; color: inherit; }
.auswahl-leiste button:hover:not(:disabled) { background: var(--flaeche-2); }

/* ---------- Absichts-Chip ---------- */
.absicht { display: flex; gap: 6px; align-items: center; margin: 0 0 2px; font-size: 12.5px; }
.absicht button { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche-2); cursor: pointer; color: inherit; }
.absicht button.gewaehlt { border-color: var(--akzent); color: var(--akzent-schrift); background: var(--akzent-zart); }

/* ---------- Start-Kacheln ---------- */
.start { max-width: 720px; margin: 9vh auto 0; text-align: center; }
.start h2 { font-size: 22px; font-weight: 650; letter-spacing: -.015em; margin: 0 0 20px; }
.start-kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; text-align: left; }
.start-kachel {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: start; align-content: start;
  border: 1px solid var(--linie); border-radius: var(--r-m); padding: 14px; background: var(--flaeche);
  box-shadow: var(--schatten-1); cursor: pointer; color: inherit; font: inherit; text-align: left;
  transition: border-color var(--schnell), box-shadow var(--schnell), transform var(--schnell);
}
.start-kachel:hover:not(:disabled) { border-color: color-mix(in srgb, var(--akzent) 50%, var(--linie)); box-shadow: var(--schatten-2); transform: translateY(-1px); background: var(--flaeche); }
.start-kachel .ic { grid-row: span 2; width: 20px; height: 20px; padding: 8px; box-sizing: content-box; border-radius: 10px; background: var(--akzent-zart); color: var(--akzent-schrift); }
.start-kachel b { display: block; margin-bottom: 2px; font-weight: 600; }
.start-kachel span { font-size: 12.5px; color: var(--gedimmt); }

/* ---------- Seitenfelder: Arbeitsmappe, Nebenzweig, Datei ---------- */
#mappe, #zweig, #dateifeld { flex: 0 0 auto; border-left: 1px solid var(--linie); display: flex; flex-direction: column; min-width: 0; background: var(--flaeche); }
#mappe { width: 420px; }
#mappe.breit { width: 50vw; }
.mappe-kopf { display: flex; align-items: center; gap: 2px; min-height: 58px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--linie); }
.mappe-kopf #mappe-zurueck { margin-left: -8px; }
.mappe-titel { flex: 1; min-width: 0; }
#mappe-titel, #zweig-titel, #dateifeld-titel { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mappe-unter, #zweig-unter, #dateifeld-unter { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mappe-inhalt { flex: 1; overflow-y: auto; padding: 14px; }
.mappe-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mappe-filter button { font-size: 12.5px; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--linie); background: none; cursor: pointer; color: inherit; }
.mappe-filter button.aktiv { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.mappe-karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mappe-karte {
  border: 1px solid var(--linie); border-radius: var(--r-m); overflow: hidden; background: var(--flaeche); cursor: pointer;
  display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit; font: inherit; box-shadow: var(--schatten-1);
}
.mappe-karte:hover:not(:disabled) { border-color: color-mix(in srgb, var(--akzent) 50%, var(--linie)); box-shadow: var(--schatten-2); background: var(--flaeche); }
.mappe-karte .vorschau { height: 110px; display: flex; align-items: center; justify-content: center; background: var(--grund); font-size: 34px; overflow: hidden; border: none; border-radius: 0; border-bottom: 1px solid var(--linie); }
.mappe-karte .vorschau img { width: 100%; height: 100%; object-fit: cover; }
.mappe-karte .vorschau > .ic { width: 34px; height: 34px; stroke-width: 1.3; color: var(--gedimmt); }
.mappe-karte .vorschau pre { font-size: 9px; line-height: 1.3; margin: 0; padding: 8px; white-space: pre-wrap; overflow: hidden; height: 100%; width: 100%; text-align: left; color: var(--gedimmt); font-family: inherit; }
.mappe-karte .info { padding: 8px 10px; }
.mappe-karte .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mappe-karte .meta { font-size: 11.5px; color: var(--gedimmt); margin: 2px 0 0; }
.mappe-leer { color: var(--gedimmt); font-size: 14px; }
.mappe-detail h3 { margin: 0 0 4px; font-size: 15px; word-break: break-word; }
.mappe-detail img.gross { max-width: 100%; border-radius: var(--r-s); border: 1px solid var(--linie); background: #fff; cursor: zoom-in; }
.mappe-detail textarea { width: 100%; min-height: 45vh; font: 13.5px/1.5 var(--mono); padding: 10px; resize: vertical; }
.mappe-detail iframe { width: 100%; height: 60vh; border: 1px solid var(--linie); border-radius: var(--r-s); background: #fff; }
.mappe-detail .leiste { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mappe-detail .beschreibung { font-size: 12.5px; color: var(--gedimmt); white-space: pre-wrap; margin: 6px 0; }
.mappe-detail .vorschau-text { border: 1px solid var(--linie); border-radius: var(--r-s); padding: 10px 14px; background: var(--grund); }
.versionen { margin-top: 14px; font-size: 13px; }
.versionen li { margin: 3px 0; }
.versionen button { font-size: 12px; padding: 1px 8px; margin-left: 6px; border-radius: 6px; border: 1px solid var(--linie); background: none; cursor: pointer; color: inherit; }
.versionen .alt { background: var(--flaeche-2); padding: 8px; border-radius: var(--r-s); margin-top: 6px; white-space: pre-wrap; font-size: 12.5px; max-height: 40vh; overflow: auto; }
#mappe-knopf.offen { color: var(--akzent-schrift); background: var(--akzent-zart); }
@media (max-width: 1100px) { #mappe.breit { width: 60vw; } }
@media (max-width: 760px) { #mappe, #mappe.breit { position: fixed; inset: 0; width: auto; z-index: 40; border-left: none; } }
.kurzhinweis { position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--flaeche); padding: 8px 16px; border-radius: 999px; z-index: 60; font-size: 13.5px; box-shadow: var(--schatten-3); }

.einbinden-wahl { display: flex; gap: 6px; align-items: center; font-size: 13.5px; margin-top: 4px; }
#einbinden-felder { display: grid; gap: 6px; }
#neu-thema-name { padding: 8px 10px; }

.freigabe-leiste { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--linie); border-radius: var(--r-s); background: var(--grund); }
.freigabe-leiste span { flex: 1 1 220px; }
.mappe-karte .freigabe { display: inline-block; margin-top: 4px; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--linie); cursor: pointer; }
.mappe-karte .freigabe.an { color: var(--gut); border-color: currentColor; }
.mappe-karte .freigabe.aus { color: var(--gedimmt); }
.mappe-karte.gesperrt .vorschau { opacity: .45; }

.schutz-liste { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12.5px; max-height: 260px; overflow-y: auto; }
.schutz-liste li { padding: 3px 0; border-bottom: 1px solid var(--linie); word-break: break-word; }
.schutz-liste li.abgelehnt b { color: var(--schlecht); }
.schutz-liste code { font-size: 11.5px; }

/* ---------- Nebenzweige ---------- */
#zweig { width: 460px; }
.zweig-verlauf { flex: 1; overflow-y: auto; padding: 14px; font-size: 14px; }
.zweig-verlauf .z-frage { background: var(--nutzer); border-radius: 16px 16px 6px 16px; padding: 8px 14px; margin: 10px 0 6px auto; width: fit-content; max-width: 90%; white-space: pre-wrap; }
.zweig-verlauf .z-antwort { margin: 6px 0 12px; }
.zweig-verlauf .z-werkzeug { font-size: 12px; color: var(--gedimmt); margin: 2px 0; }
.zweig-verlauf .z-kopiert { font-size: 12.5px; color: var(--gedimmt); border: 1px dashed var(--linie-stark); border-radius: var(--r-s); padding: 6px 10px; margin-bottom: 8px; cursor: pointer; }
.zweig-verlauf .z-kopiert-inhalt { opacity: .65; }
.zweig-verlauf .z-denkt { font-size: 12px; color: var(--gedimmt); font-style: italic; }
.zweig-eingabe { display: flex; gap: 6px; margin: 0 12px 12px; padding: 6px 6px 6px 4px; align-items: flex-end; border: 1px solid var(--linie-stark); border-radius: 18px; box-shadow: var(--schatten-2); transition: border-color var(--schnell), box-shadow var(--schnell); }
.zweig-eingabe:focus-within { border-color: color-mix(in srgb, var(--akzent) 55%, var(--linie)); box-shadow: var(--schatten-2), 0 0 0 3px var(--akzent-zart); }
.zweig-eingabe textarea { flex: 1; resize: none; min-height: 40px; max-height: 30vh; padding: 8px 10px; border: none; background: transparent; box-shadow: none !important; }
.zweig-uebernahme { padding: 10px 12px; border-top: 1px solid var(--linie); display: grid; gap: 6px; font-size: 13px; }
.zweig-uebernahme textarea { min-height: 120px; padding: 8px; }
.zweig-marker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; font-size: 12.5px; color: var(--gedimmt); }
.zweig-marker .chip { color: var(--akzent-schrift); border-color: var(--akzent); }
@media (max-width: 760px) { #zweig { position: fixed; inset: 0; width: auto; z-index: 41; border-left: none; } }
.zweig-chip { margin: 2px 0 4px; opacity: .6; }
.nachricht:hover .zweig-chip { opacity: 1; }
@media (hover: none) { .zweig-chip { opacity: 1; } }

/* Quellen einer Antwort (quellen.js) */
.quellen-chip { margin: 2px 0 4px 6px; opacity: .6; }
.nachricht:hover .quellen-chip, .quellen-chip.an { opacity: 1; }
.quellen-chip.an { border-color: var(--akzent); color: var(--akzent-schrift); }
@media (hover: none) { .quellen-chip { opacity: 1; } }
.quellen-liste { margin: 4px 0 8px; padding: 6px 12px 8px; border: 1px solid var(--linie); border-radius: var(--r-m); font-size: 14px; }
.quellen-gruppe { font-size: 12px; font-weight: 600; color: var(--gedimmt); margin: 6px 0 2px; }
.quellen-unter { font-size: 13px; font-weight: 600; margin: 10px 0 2px; padding-top: 6px; border-top: 1px solid var(--linie); }
.quellen-liste ul { margin: 0; padding-left: 18px; }
.quellen-liste li { margin: 3px 0; overflow-wrap: anywhere; }
.quellen-liste a { color: var(--akzent-schrift); text-underline-offset: 2px; text-decoration-thickness: 1px; }
.quellen-link { border: none; background: none; padding: 0; font: inherit; color: var(--akzent-schrift); text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.quellen-suchen li { font-size: 13px; }
.quellen-liste .chips { margin-top: 6px; }
.quellen-mail-kopf { display: grid; gap: 2px; font-size: 13px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--linie); overflow-wrap: anywhere; }
.quellen-mail-betreff { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.zweig-eintrag .name { color: var(--gedimmt); font-size: 13.5px; }
.zweig-eintrag.aktiv .name { color: inherit; }
.anhang .anonym-knopf { border: none; background: none; padding: 0 4px; cursor: pointer; font-size: 13px; }
.anhang .anonym-knopf .ic { width: 14px; height: 14px; }
.anhang.anonym { background: var(--akzent); color: var(--akzent-text); }
.anhang.anonym button { color: inherit; }
.neue-version { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; gap: 10px; align-items: center; padding: 8px 10px 8px 16px; border-radius: 999px; background: var(--flaeche); border: 1px solid var(--linie); box-shadow: var(--schatten-3); font-size: 14px; }

/* Fortschritt der laufenden Antwort */
.fortschritt { max-width: var(--spalte); width: calc(100% - 40px); margin: 0 auto 6px; padding: 4px 12px; font-size: 13px; color: var(--gedimmt); cursor: help; }

/* Belegprüfung unter einer Antwort */
.belegpruefung:empty { display: none; }
.belegpruefung { margin: 6px 0; font-size: 14px; }
.belegpruefung details { border: 1px solid var(--linie); border-radius: var(--r-m); padding: 6px 12px; }
.belegpruefung summary { cursor: pointer; }
.belegpruefung ul { margin: 6px 0; padding-left: 20px; }
.belegpruefung li { margin: 4px 0; }
.belegpruefung button { margin-top: 6px; padding: 4px 10px; border-radius: var(--r-s); border: 1px solid var(--linie); background: none; cursor: pointer; }
.beleg-laeuft, .beleg-fehler { color: var(--gedimmt); padding: 4px 2px; }
.beleg-auto { display: block; margin-top: 6px; font-size: 13px; cursor: pointer; }

/* Recherche ohne Mails: Übergabetext vor dem Start prüfen */
.recherche-dialog { width: min(640px, calc(100vw - 32px)); }
.recherche-dialog form { display: flex; flex-direction: column; gap: 8px; }
.recherche-dialog textarea { width: 100%; padding: 8px; color: var(--text); }
.recherche-stand { min-height: 1.2em; font-size: 13px; }
.recherche-warnung { border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-zart); border-radius: var(--r-s); padding: 8px 12px; font-size: 14px; }
.recherche-warnung ul { margin: 4px 0; padding-left: 20px; }
.recherche-dialog .dialog-knoepfe button:first-child { margin-right: auto; }

/* Runde ohne Antwort (nur Denkphase) */
.leer-hinweis { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-zart); border-radius: var(--r-m); padding: 8px 12px; margin: 6px 0; font-size: 14px; }

/* Token-Rate neben der Kontextanzeige */
.tempo { font-size: 12px; color: var(--text); flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tempo.ruhe { color: var(--gedimmt); opacity: .8; }
.tempo.fertig { color: var(--gedimmt); }
@media (max-width: 760px) { .tempo.ruhe { display: none; } }

/* Datei im Seitenfeld neben dem Chat */
#dateifeld { width: 42vw; max-width: 680px; }
#dateifeld.breit { width: 62vw; max-width: none; }
.dateifeld-inhalt { flex: 1; overflow-y: auto; padding: 14px 18px; font-size: 14px; }
.dateifeld-inhalt table { border-collapse: collapse; font-size: 13px; }
.dateifeld-inhalt th, .dateifeld-inhalt td { border: 1px solid var(--linie); padding: 4px 8px; vertical-align: top; }
.dateifeld-pdf { width: 100%; height: 100%; border: 0; background: #fff; }
.dateifeld-roh { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; margin: 0; }
.datei-chips { margin-top: 6px; }
@media (max-width: 1100px) { #dateifeld, #dateifeld.breit { width: 55vw; } }
@media (max-width: 760px) { #dateifeld, #dateifeld.breit { position: fixed; inset: 0; width: auto; max-width: none; z-index: 40; border-left: none; } }
/* Neben einem Seitenfeld wird der Chat schmal: Kopfzeile schrumpfen lassen, statt Knöpfe hinauszuschieben */
#chat { container-type: inline-size; container-name: chat; }
@container chat (max-width: 700px) {
  .kontext-balken { width: 40px; }
  #stufe, #agent { max-width: 120px; }
  .tempo.ruhe { display: none; }
  .tempo:not(.fertig):not(.ruhe) { display: none; }
}
@container chat (max-width: 520px) { #stufe { display: none; } }

/* Fortschrittszeile mit Abbruch der Belegprüfung */
.fortschritt-reihe { display: flex; align-items: center; gap: 8px; max-width: var(--spalte); width: calc(100% - 40px); margin: 0 auto; }
.fortschritt-reihe .fortschritt { flex: 1; width: auto; margin: 0 0 6px; }
.fortschritt-reihe #pruefung-stopp { flex: none; margin-bottom: 6px; }
.beleg-laeuft .chip, .beleg-fehler .chip { margin-left: 6px; }
.knopf-primaer.gefahr-voll, .knopf-primaer.gefahr-voll:hover:not(:disabled) { background: var(--schlecht-flaeche); border-color: var(--schlecht-flaeche); }
.skill-zeile { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.skill-zeile input { margin-top: 2px; }
.skill-text { min-width: 0; overflow-wrap: anywhere; }

/* ---- Handy: Kopfzeile in zwei Reihen, schmale Eingabezeile, Eingabefelder ohne Zoom ---- */
@media (max-width: 760px) {
  /* Oben Chatliste, Titel, Mappe und Chat-Menü, darunter Status-Kapsel, Denkstufe und Agent. In einer Reihe
     drückten die Anzeigen den Titel auf null Breite und das Chat-Menü aus dem Bild. */
  .chat-kopf { flex-wrap: wrap; row-gap: 0; min-height: 0; padding: 6px 8px 6px 4px; }
  .chat-kopf::after { content: ""; flex-basis: 100%; order: 1; }
  .chat-kopf > .kopf-status, .chat-kopf > #stufe, .chat-kopf > #agent { order: 2; margin: 2px 0; height: 28px; }
  /* Die Kapsel ohne Rahmen, damit Kontext und beide Auswahlfelder in eine Reihe passen; der Kontexttext kürzt sich zuletzt */
  .chat-kopf > .kopf-status { flex: 1 1 0; min-width: 0; overflow: hidden; margin-left: 8px; padding: 0; gap: 8px; border: none; background: none; }
  .kontext { flex: 0 1 auto; }
  .kontext-balken { width: 32px; }
  .chat-kopf > #stufe { display: block; margin-left: auto; }   /* in der zweiten Reihe ist Platz, die Containerregel blendet sie sonst aus */
  .chat-kopf > #stufe, .chat-kopf > #agent { max-width: none; padding: 0 18px 0 8px; background-position: right 5px center; background-size: 11px; }
  .chat-kopf > #agent { margin-left: 6px; }
  .kopf-status > #status { display: none; }   /* „arbeitet“ zeigen schon Stopp-Knopf, Fortschrittszeile und Fertig-Zeit */
  .menue-liste { max-width: calc(100vw - 16px); }
  .menue-liste button { padding: 11px 12px; }

  .eingabe { padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); }
  .eingabe-karte { border-radius: 18px; }
  .eingabe-feld { padding: 8px 10px 0; }
  .eingabe-leiste { padding: 2px 6px 6px; }

  /* Unter 16px vergrößert iOS die Seite beim Antippen eines Eingabefelds */
  input, textarea, select { font-size: 16px; }

  /* Mappe, Nebenzweig und Datei liegen hier im Vollbild: Abstand zu Kerbe und Startleiste, „breiter“ hat keinen Sinn */
  #mappe, #zweig, #dateifeld { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  #mappe-breit, #dateifeld-breit { display: none; }

  /* Abgedunkelter Rest neben der offenen Chatliste; Antippen schließt sie (app.js) */
  body.leiste-offen::after { content: ""; position: fixed; inset: 0; z-index: 9; background: rgba(10, 12, 16, .4); backdrop-filter: blur(2px); }
}
