/* Assistent: runder Knopf, schwebendes Fenster, Chat-Bedienfeld, Vorschlaege */

.fab {
  position: fixed; z-index: 80; right: calc(22px + var(--sa-r)); bottom: calc(22px + var(--sa-b)); width: 54px; height: 54px; display: grid; place-items: center;
  border-radius: 50%; border: 0; background: var(--jade); color: var(--on-jade); box-shadow: 0 4px 16px color-mix(in srgb, var(--jade) 40%, transparent), var(--shadow); padding: 0;
}
.fab:hover { filter: brightness(1.08); }
.chat-fenster {
  position: fixed; z-index: 100; display: flex; flex-direction: column; min-width: 320px; min-height: 360px; overflow: hidden;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow);
}
.chat-fenster .griff { position: absolute; z-index: 5; touch-action: none; }
.griff-n { left: 10px; right: 10px; top: -3px; height: 8px; cursor: ns-resize; } .griff-s { left: 10px; right: 10px; bottom: -3px; height: 8px; cursor: ns-resize; }
.griff-e { top: 10px; bottom: 10px; right: -3px; width: 8px; cursor: ew-resize; } .griff-w { top: 10px; bottom: 10px; left: -3px; width: 8px; cursor: ew-resize; }
.griff-ne { top: -3px; right: -3px; width: 14px; height: 14px; cursor: nesw-resize; } .griff-nw { top: -3px; left: -3px; width: 14px; height: 14px; cursor: nwse-resize; }
.griff-se { bottom: -3px; right: -3px; width: 14px; height: 14px; cursor: nwse-resize; } .griff-sw { bottom: -3px; left: -3px; width: 14px; height: 14px; cursor: nesw-resize; }

.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; height: 100%; }
.chat-kopf { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--rule); background: var(--wash); }
.im-fenster .chat-kopf { cursor: grab; touch-action: none; }
.chat-kopf-text { flex: 1; min-width: 0; }
.chat-titel { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-kosten { font-size: 11.5px; color: var(--mute); font-variant-numeric: tabular-nums; min-height: 16px; }
.rolle { font-size: 12.5px; padding: 3px 24px 3px 8px; min-height: 28px; border-color: transparent; background-color: transparent; color: var(--ink-2); }
.rolle:hover { border-color: var(--rule); }

.chat-verlauf { flex: 1; min-height: 0; overflow: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.im-tab .chat-verlauf { padding-left: max(18px, calc((100% - 760px) / 2)); padding-right: max(18px, calc((100% - 760px) / 2)); }
.chat-leer { margin: auto; text-align: center; padding: 16px 4px; color: var(--ink-2); }
.chat-leer-titel { font: 600 19px var(--serif); margin: 0 0 14px; color: var(--ink); }
.beispiele { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.beispiel { background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; padding: 9px 14px; font-size: 13.5px; color: var(--ink-2); max-width: 100%; text-align: left; }
.beispiel:hover { border-color: color-mix(in srgb, var(--jade) 45%, var(--rule)); color: var(--ink); }

.nachricht { display: flex; flex-direction: column; gap: 8px; max-width: 100%; min-width: 0; }
.nachricht.nutzer { align-items: flex-end; }
.blase { background: var(--jade-soft); color: var(--ink); border-radius: 14px 14px 4px 14px; padding: 9px 13px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 14.5px; }
.nachricht.assistent { align-items: stretch; }
.antwort { font-size: 14.5px; line-height: 1.7; }
.antwort .md { line-height: 1.7; }
.antwort .md > :first-child { margin-top: 0; } .antwort .md > :last-child { margin-bottom: 0; }
.antwort .md h1, .antwort .md h2, .antwort .md h3 { font-size: 1.05em; margin: 1em 0 0.3em; }
.fehlertext { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.fuss-kosten { font-size: 11.5px; color: var(--mute); font-variant-numeric: tabular-nums; }

.schritte { margin: 0; padding-left: 1.4em; font-size: 12.5px; color: var(--mute); display: flex; flex-direction: column; gap: 2px; }
.schritte-fertig { font-size: 12.5px; color: var(--mute); }
.schritte-fertig summary { cursor: pointer; padding: 2px 0; }
.denkt { display: flex; align-items: center; gap: 9px; color: var(--ink-2); font-size: 13.5px; }
.denkt .uhr { color: var(--mute); font-variant-numeric: tabular-nums; margin-left: auto; font-size: 12px; }
.puls { width: 9px; height: 9px; border-radius: 50%; background: var(--jade); animation: puls 1.1s ease-in-out infinite; flex: none; }
@keyframes puls { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }

.quellen { border-top: 1px solid var(--rule); padding-top: 8px; }
.quellen-titel { font-size: 11.5px; color: var(--mute); letter-spacing: 0.08em; margin-bottom: 4px; }
.quellen ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.quelle { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left; padding: 4px 8px; background: none; border: 0; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
button.quelle:hover { background: var(--wash); color: var(--jade); }
.q-nr { color: var(--jade); font-variant-numeric: tabular-nums; min-width: 1.4em; }
.q-datum { color: var(--mute); font-variant-numeric: tabular-nums; }
.q-titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Vorschlaege */
.vorschlag { border: 1px solid color-mix(in srgb, var(--jade) 35%, var(--rule)); border-radius: 12px; background: var(--paper); overflow: hidden; }
.vorschlag.erledigt { opacity: 0.85; border-color: var(--rule); }
.vorschlag-kopf { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--jade-soft); color: var(--jade); font-size: 12.5px; }
.vorschlag-kopf .link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; padding: 2px 4px; min-width: 0; }
.vorschlag-grund { margin: 8px 12px 0; font-size: 13px; color: var(--ink-2); }
.vorschlag-hinweis { margin: 6px 12px 0; font-size: 12px; color: var(--mute); }
.diff { margin: 8px 0 0; font: 12.5px/1.6 ui-monospace, "SF Mono", Menlo, "PingFang SC", monospace; max-height: 260px; overflow: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.diff-zeile { display: flex; white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 10px 0 0; }
.diff-zeichen { flex: none; width: 22px; text-align: center; color: var(--mute); user-select: none; }
.diff-zeile.add { background: var(--add-bg); } .diff-zeile.del { background: var(--del-bg); }
.diff-zeile.add .diff-zeichen { color: var(--jade); } .diff-zeile.del .diff-zeichen { color: var(--danger); }
.diff-zeile.del .diff-text { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.diff-zeile.luecke { color: var(--mute); }
.vorschlag-aktionen { display: flex; gap: 8px; padding: 10px 12px; align-items: center; }
.vorschlag-status { font-size: 12.5px; color: var(--mute); }
.vorschlag-status.angenommen { color: var(--jade); } .vorschlag-status.veraltet { color: var(--danger); }

/* Eingabe */
.chat-fuss { padding: 8px 12px calc(10px + var(--sa-b)); border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; background: var(--sheet); }
.im-tab .chat-fuss { padding-left: max(14px, calc((100% - 760px) / 2)); padding-right: max(14px, calc((100% - 760px) / 2)); }
.chips-zeile { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips-zeile::-webkit-scrollbar { display: none; }
.chip { flex: none; background: var(--paper); border: 1px solid var(--rule); border-radius: 99px; padding: 3px 11px; font-size: 12.5px; color: var(--ink-2); }
.chip:hover:not(:disabled) { border-color: color-mix(in srgb, var(--jade) 45%, var(--rule)); color: var(--jade); background: var(--jade-soft); }
.chat-hinweis { font-size: 11.5px; color: var(--mute); min-height: 0; }
.chat-hinweis:empty { display: none; }
.chat-eingabe { display: flex; align-items: flex-end; gap: 6px; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; padding: 4px 5px 4px 12px; }
.chat-eingabe:focus-within { border-color: var(--jade); }
.chat-feld { flex: 1; border: 0 !important; background: transparent !important; resize: none; padding: 7px 0; max-height: 180px; line-height: 1.5; font-size: 15px; outline: none !important; }
.rund { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 0; background: none; color: var(--ink-2); flex: none; }
.rund:hover:not(:disabled) { background: var(--wash); color: var(--jade); }
.rund.senden { background: var(--jade); color: var(--on-jade); }
.rund.senden:hover:not(:disabled) { background: var(--jade); filter: brightness(1.1); color: var(--on-jade); }
.rund.senden.stopp { background: var(--ink-2); }
.rund.aufnahme { background: var(--danger); color: #fff; animation: puls 1.1s ease-in-out infinite; }
.mikro-zeit { font-size: 12px; color: var(--danger); font-variant-numeric: tabular-nums; align-self: center; }
.mikro-zeit:empty { display: none; }

@media (max-width: 760px) {
  .chat-fenster, .chat-fenster[style] {
    inset: 0 !important; width: auto !important; height: auto !important; min-width: 0; min-height: 0; border-radius: 0; border: 0; z-index: 130;
    padding-top: var(--sa-t);
  }
  .chat-fenster .griff { display: none; }
  .chat-kopf { padding-top: 8px; }
  .chat-verlauf { padding: 12px; }
  .blase { max-width: 94%; }
}
.vorschlag-warnung { margin: 8px 12px 0; font-size: 13px; color: var(--danger); font-weight: 550; }

/* Position des Assistenten: schwebend / links / rechts */
.chat-layout { display: flex; gap: 1px; padding: 2px; border-radius: 8px; background: var(--wash-2); }
.chat-layout .werkzeug { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--mute); }
.chat-layout .werkzeug[aria-pressed="true"] { background: var(--sheet); color: var(--ink); }
.chat-layout .gespiegelt .icon { transform: scaleX(-1); }
.werkzeug.mikro.aufnahme { background: var(--danger); color: #fff; animation: puls 1.1s ease-in-out infinite; }
