/* =========================================================
   Kanzlei-Chatbot Widget — generisch, einbettbar.
   Erbt Farben/Fonts der Host-Seite über CSS-Variablen mit
   Fallbacks (var(--rot, #c96040) …) → passt sich pro Kanzlei
   automatisch an, ohne Anpassung.
   Klassen-Präfix "kchat-" gegen Kollisionen.
   ========================================================= */

.kchat-fab {
  position: fixed; right: clamp(1rem, 4vw, 2rem); bottom: clamp(1rem, 4vw, 2rem);
  z-index: 9998;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--rot, #c96040); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  transition: transform .25s cubic-bezier(.23,1,.32,1), box-shadow .25s;
}
.kchat-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.kchat-fab svg { width: 28px; height: 28px; }
.kchat-fab[hidden] { display: none; }

.kchat-panel {
  position: fixed; right: clamp(1rem, 4vw, 2rem); bottom: clamp(1rem, 4vw, 2rem);
  z-index: 9999;
  width: min(380px, calc(100vw - 2rem));
  height: min(620px, calc(100vh - 2rem));
  display: flex; flex-direction: column;
  background: var(--weiss, #fff); color: var(--ink, #1a1411);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.30);
  font-family: var(--sans, system-ui, sans-serif);
  opacity: 0; transform: translateY(12px) scale(.98);
  transition: opacity .22s ease, transform .22s cubic-bezier(.23,1,.32,1);
}
.kchat-panel.kchat-open { opacity: 1; transform: none; }
.kchat-panel[hidden] { display: none; }
/* [hidden] muss display-Regeln der Kinder überstimmen (sonst bleibt Consent sichtbar) */
.kchat-panel [hidden] { display: none !important; }

.kchat-head {
  background: var(--rot, #c96040); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.kchat-head__title { font-family: var(--serif, Georgia, serif); font-size: 1.15rem; font-weight: 600; line-height: 1.1; }
.kchat-head__sub { font-size: .72rem; opacity: .85; }
.kchat-headback {
  flex: none; color: #fff; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
  transition: background .2s;
}
.kchat-headback:hover { background: rgba(255,255,255,.18); }
.kchat-close {
  margin-left: auto; color: #fff; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1;
  transition: background .2s;
}
.kchat-close:hover { background: rgba(255,255,255,.18); }

.kchat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--hell, #f6f4f2); }

/* Kinder eines scrollenden Flex-Containers schrumpfen standardmäßig
   (flex-shrink: 1). Am 16.08.2026 im Browser gemessen: sobald der geführte
   Einstieg überlief, war das Ergänzungs-Textfeld 22px hoch statt der zwei
   Zeilen aus rows="2". Hier darf nichts schrumpfen, der Container scrollt. */
.kchat-guide > *,
.kchat-consent > *,
.kchat-body > * { flex: none; }

.kchat-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; font-size: .92rem; line-height: 1.5; }
.kchat-msg--bot { align-self: flex-start; background: var(--weiss, #fff); border: 1px solid rgba(0,0,0,.07); border-bottom-left-radius: 4px; }
.kchat-msg--user { align-self: flex-end; background: var(--rot, #c96040); color: #fff; border-bottom-right-radius: 4px; }

.kchat-cta { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.kchat-cta__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px; font-size: .85rem; font-weight: 500;
  background: var(--rot, #c96040); color: #fff;
  transition: background .2s, transform .15s;
}
.kchat-cta__btn:hover { background: var(--rot-dunkel, #a84e30); transform: translateY(-1px); }
.kchat-cta__btn--ghost { background: transparent; color: var(--rot, #c96040); border: 1px solid var(--rot, #c96040); }
.kchat-cta__btn--ghost:hover { background: var(--rot-glas, rgba(201,96,64,.1)); }
/* Knöpfe als Link (Anrufen) sehen aus wie Knöpfe als button: ohne Unterstreichung aus style.css (12.11.2026) */
a.kchat-cta__btn { text-decoration: none; }
/* Offenes Mobilmenü der Seite (#hdr.is-open, z-index 61) liegt über dem Assistenten: solange es offen ist,
   ist der Assistent unsichtbar und nicht klickbar, danach steht er wieder da wie vorher (12.11.2026). */
body:has(#hdr.is-open) .kchat-fab,
body:has(#hdr.is-open) .kchat-panel,
body:has(#hdr.is-open) .kchat-teaser { visibility: hidden; }

.kchat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; }
.kchat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #888); opacity: .5; animation: kchat-bounce 1.2s infinite; }
.kchat-typing span:nth-child(2) { animation-delay: .2s; }
.kchat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes kchat-bounce { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* Consent-Gate */
.kchat-consent { padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; flex: 1; }
.kchat-consent__lead { font-size: .92rem; line-height: 1.55; }
.kchat-consent__label { display: flex; gap: 9px; align-items: flex-start; font-size: .8rem; line-height: 1.45; color: var(--muted, #555); cursor: pointer; }
.kchat-consent__label input { margin-top: 3px; flex: none; }
.kchat-consent__label a { color: var(--rot, #c96040); text-decoration: underline; }
.kchat-start { margin-top: auto; padding: 11px 16px; border-radius: 10px; background: var(--rot, #c96040); color: #fff; font-weight: 500; font-size: .92rem; transition: background .2s, opacity .2s; }
.kchat-start:disabled { opacity: .45; cursor: not-allowed; }
.kchat-start:not(:disabled):hover { background: var(--rot-dunkel, #a84e30); }

/* Eingabe */
.kchat-foot { border-top: 1px solid rgba(0,0,0,.08); padding: 10px; background: var(--weiss, #fff); }
.kchat-disclaimer { font-size: .68rem; color: var(--muted, #777); line-height: 1.4; margin-bottom: 8px; }
.kchat-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.kchat-input {
  flex: 1; resize: none; max-height: 90px; min-height: 40px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,.16);
  font: inherit; font-size: .9rem; line-height: 1.4; color: var(--ink, #1a1411);
}
.kchat-input:focus { outline: 2px solid var(--rot, #c96040); outline-offset: 1px; border-color: transparent; }
.kchat-send {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  background: var(--rot, #c96040); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.kchat-send:hover { background: var(--rot-dunkel, #a84e30); }
.kchat-send:disabled { opacity: .45; cursor: not-allowed; }
.kchat-send svg { width: 18px; height: 18px; }

/* Geführter Einstieg (Picker + Unterfragen) */
.kchat-guide { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; background: var(--hell, #f6f4f2); }
.kchat-guide__lead { font-size: .92rem; line-height: 1.5; color: var(--ink, #1a1411); }
.kchat-areas { display: flex; flex-direction: column; gap: 8px; }
.kchat-area {
  display: flex; align-items: center; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 10px; font-size: .92rem; font-weight: 500;
  background: var(--weiss, #fff); color: var(--ink, #1a1411);
  border: 1px solid rgba(0,0,0,.1);
  transition: border-color .2s, transform .12s, background .2s;
}
.kchat-area:hover { border-color: var(--rot, #c96040); transform: translateX(2px); }
.kchat-area__arrow { margin-left: auto; color: var(--rot, #c96040); font-size: 1.1rem; line-height: 1; }
.kchat-area--unsure { margin-top: 4px; justify-content: center; color: var(--muted, #666); font-weight: 400; font-size: .86rem; background: transparent; border-style: dashed; }
.kchat-area--unsure:hover { color: var(--rot, #c96040); transform: none; }

.kchat-guide__top { display: flex; align-items: center; gap: 10px; }
.kchat-back { font-size: .85rem; color: var(--muted, #555); padding: 4px 6px; border-radius: 8px; transition: color .2s; }
.kchat-back:hover { color: var(--rot, #c96040); }
.kchat-guide__area { font-family: var(--serif, Georgia, serif); font-size: 1.05rem; font-weight: 600; color: var(--ink, #1a1411); }

.kchat-q { display: flex; flex-direction: column; gap: 7px; }
.kchat-q__label { font-size: .88rem; font-weight: 600; color: var(--ink, #1a1411); }
.kchat-q__opts { display: flex; flex-wrap: wrap; gap: 7px; }
.kchat-opt {
  padding: 7px 12px; border-radius: 999px; font-size: .84rem;
  background: var(--weiss, #fff); color: var(--ink, #1a1411);
  border: 1px solid rgba(0,0,0,.16);
  transition: background .15s, border-color .15s, color .15s;
}
.kchat-opt:hover { border-color: var(--rot, #c96040); }
.kchat-opt.is-on { background: var(--rot, #c96040); color: #fff; border-color: var(--rot, #c96040); }

.kchat-guide__text {
  resize: none; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,.16);
  font: inherit; font-size: .9rem; line-height: 1.4; color: var(--ink, #1a1411); background: var(--weiss, #fff);
}
.kchat-guide__text:focus { outline: 2px solid var(--rot, #c96040); outline-offset: 1px; border-color: transparent; }
.kchat-guide__submit {
  margin-top: 4px; padding: 11px 16px; border-radius: 10px;
  background: var(--rot, #c96040); color: #fff; font-weight: 500; font-size: .92rem;
  transition: background .2s;
}
.kchat-guide__submit:hover { background: var(--rot-dunkel, #a84e30); }

@media (prefers-reduced-motion: reduce) {
  .kchat-fab, .kchat-panel, .kchat-cta__btn, .kchat-typing span,
  .kchat-area, .kchat-opt { transition: none; animation: none; }
}
/* =========================================================
   Kanzlei-Chatbot Widget — COMPLIANCE-DEMO.
   Baut auf chat-widget.css auf und ergaenzt nur die neuen
   Compliance-Elemente (KI-Label, Hinweisboxen, Block-Meldung,
   Lokal-Badge, geschuetzte Rechtsgebiete).
   Erbt Farben/Fonts der Host-Seite ueber CSS-Variablen.
   ========================================================= */

/* ── KI-Kennzeichnung im Kopf (Gate 1, Art. 50 AI Act) ───────────────── */
.kchat-head__ki {
  display: flex; align-items: center; gap: .4em;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  opacity: .95; margin-top: 2px;
}
.kchat-head__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
  animation: kchat-pulse 2.4s ease-in-out infinite;
}
@keyframes kchat-pulse { 0%,100% { opacity: .45 } 50% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .kchat-head__dot { animation: none } }

/* ── Hinweisboxen ────────────────────────────────────────────────────── */
.kchat-notice {
  border-radius: 10px; padding: .8em .9em; margin-bottom: .8em;
  font-size: .82rem; line-height: 1.5;
}
.kchat-notice strong { display: block; margin-bottom: .25em; font-weight: 650; }
.kchat-notice p { margin: 0; }

.kchat-notice--ki {
  background: var(--rot-glas, rgba(201,96,64,.10));
  border-left: 3px solid var(--rot, #c96040);
  color: var(--ink, #1a1411);
}
.kchat-notice--warn {
  background: oklch(0.96 0.05 75 / 1);
  border-left: 3px solid oklch(0.70 0.15 60);
  color: oklch(0.32 0.06 60);
}
.kchat-notice--lock {
  background: oklch(0.96 0.04 155 / 1);
  border-left: 3px solid oklch(0.55 0.11 155);
  color: oklch(0.30 0.05 155);
  margin-top: .2em;
}

/* ── Alternative ohne KI (Gate 3) ────────────────────────────────────── */
.kchat-alt {
  margin-top: .9em; padding-top: .8em;
  border-top: 1px solid var(--linie, #e6e0dc);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5em;
  font-size: .82rem; color: var(--muted, #6b625c);
}
.kchat-alt__link {
  color: var(--rot, #c96040); font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px;
}
.kchat-alt__link:hover { color: var(--rot-dunkel, #a04a30); }

/* ── Geschuetzte Rechtsgebiete in der Auswahl ────────────────────────── */
.kchat-area--sensibel { position: relative; }
.kchat-area__lock {
  display: inline-block; margin-left: .5em;
  font-size: .64rem; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase;
  padding: .16em .5em; border-radius: 999px;
  background: oklch(0.93 0.05 155); color: oklch(0.38 0.08 155);
  vertical-align: middle;
}

/* ── Block-Meldung des Pre-Send-Filters (Gate 2) ─────────────────────── */
.kchat-blocked {
  background: oklch(0.95 0.055 25);
  border: 1px solid oklch(0.72 0.13 25);
  color: oklch(0.36 0.11 25);
  border-radius: 10px; padding: .7em .85em; margin-bottom: .6em;
  font-size: .8rem; line-height: 1.5;
}
.kchat-blocked[hidden] { display: none; }

/* ── Lokale Auswertung, kein externer Call ───────────────────────────── */
.kchat-local-badge {
  margin: .35em 0 .1em; padding: .45em .7em;
  background: oklch(0.95 0.045 155); color: oklch(0.34 0.07 155);
  border-radius: 8px; font-size: .74rem; line-height: 1.45;
  align-self: flex-start; max-width: 92%;
}
.kchat-local-badge::before { content: '✓ '; font-weight: 700; }

/* ── Inline-Hinweise im Nachrichtenstrom ─────────────────────────────── */
.kchat-inline-hint {
  margin: .3em 0; padding: 0 .2em;
  font-size: .73rem; line-height: 1.5;
  color: var(--muted, #6b625c);
}
.kchat-inline-hint--feedback { font-style: italic; }

.kchat-hint {
  margin: .4em 0 0; font-size: .73rem; line-height: 1.5;
  color: var(--muted, #6b625c);
}

.kchat-guide__foot {
  margin: 1em 0 0; padding-top: .8em;
  border-top: 1px solid var(--linie, #e6e0dc);
  font-size: .73rem; line-height: 1.5; color: var(--muted, #6b625c);
}

/* ── Notfall-/Fristantwort ───────────────────────────────────────────── */
.kchat-msg--notfall {
  background: oklch(0.95 0.055 25) !important;
  border: 1px solid oklch(0.75 0.12 25);
  color: oklch(0.32 0.10 25) !important;
}
.kchat-msg--notfall strong { display: block; margin-bottom: .3em; }
.kchat-msg--notfall p { margin: 0; font-size: .82rem; line-height: 1.5; }
/* Gefuehrter Modus: „Ich finde mein Thema nicht“ (12.11.2026) */
.kchat-msg--handoff strong { display: block; margin-bottom: .3em; }
.kchat-msg--handoff p { margin: 0; font-size: .82rem; line-height: 1.5; }

/* ── Hinweis zu Fristen (Herr Stapf, 03.11.2026) ─────────────────────── */
.kchat-msg--frist { border-left: 3px solid var(--rot, #c96040); }
.kchat-msg--frist strong { display: block; margin-bottom: .35em; }
.kchat-msg--frist p { margin: 0 0 .45em; font-size: .82rem; line-height: 1.5; }
.kchat-msg--frist p:last-child { margin-bottom: 0; }
.kchat-frist__allg { margin-top: .6em; padding-top: .55em; border-top: 1px solid rgba(0,0,0,.08); }
.kchat-frist__allg .kchat-frist__kopf { margin-bottom: .3em; font-weight: 600; }
.kchat-frist__allg ul { margin: 0; padding-left: 1.1em; font-size: .78rem; line-height: 1.5; }
.kchat-frist__allg li + li { margin-top: .25em; }

/* ── Demo-Banner der Seite ───────────────────────────────────────────── */
.demo-banner {
  position: sticky; top: 0; z-index: 10000;
  background: oklch(0.30 0.02 30); color: #fff;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: .78rem; line-height: 1.45;
  padding: .55em 1em; text-align: center;
}
.demo-banner strong { font-weight: 650; }
.demo-banner span { opacity: .8; }

/* Freitext per Embedding (26.10.2026): Knöpfe einer festen Frage und der Platzhalter-Satz */
.kchat-cta__btn:disabled { opacity: .5; cursor: default; transform: none; }
.kchat-cta__btn--ghost.is-on, .kchat-cta__btn--ghost.is-on:disabled { background: var(--rot, #c96040); color: #fff; opacity: 1; }
.kchat-msg--platzhalter { background: transparent; border: 1px dashed var(--rot, #c96040); }
.kchat-platzhalter__label {
  display: block; margin-bottom: .25em;
  font-size: .72rem; font-weight: 650; letter-spacing: .01em; color: var(--rot-dunkel, #a84e30);
}

/* ── Erkenntnisse aus der Reiss-Analyse (27.10.2026) ─────────────────── */

/* Begrüßungsblase über dem Knopf: 12 px Abstand zum 60-px-Knopf. Mit
   KI-Kennzeichnung, ohne Foto (bei Reiss/Superchat: Porträt und „wir“). */
.kchat-teaser {
  position: fixed; z-index: 9998;
  right: clamp(1rem, 4vw, 2rem); bottom: calc(clamp(1rem, 4vw, 2rem) + 72px);
  width: max-content; max-width: min(280px, calc(100vw - 2rem));
  display: flex; align-items: flex-start;
  background: var(--weiss, #fff); color: var(--ink, #1a1411);
  border-radius: 14px; border-bottom-right-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  font-family: var(--sans, system-ui, sans-serif);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s cubic-bezier(.23,1,.32,1);
}
.kchat-teaser--da { opacity: 1; transform: none; }
.kchat-teaser[hidden] { display: none; }
.kchat-teaser__auf { flex: 1; min-width: 0; text-align: left; padding: 12px 4px 12px 14px; font-size: .88rem; line-height: 1.45; color: inherit; }
.kchat-teaser__ki { display: block; margin-bottom: 2px; font-size: .72rem; font-weight: 650; letter-spacing: .02em; color: var(--rot, #c96040); }
.kchat-teaser__zu {
  flex: none; width: 32px; height: 32px; margin: 6px 6px 0 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; color: var(--muted, #6b625c); transition: background .2s;
}
.kchat-teaser__zu:hover { background: rgba(0,0,0,.06); }
.kchat-teaser__auf:focus-visible, .kchat-teaser__zu:focus-visible { outline: 2px solid var(--rot, #c96040); outline-offset: -2px; border-radius: 8px; }

/* Nur für Screenreader (Text der Tipp-Anzeige) */
.kchat-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Safari auf iPhone und iPad zoomt beim Antippen in Felder unter 16 px.
   Vorher .9rem = 14,4 px. Massgeblich ist die Schrift des Felds, nicht die
   des Platzhalters: Der bleibt kleiner, sonst bricht „Ihr Thema in
   Stichworten, ohne Namen…“ um (gemessen iPhone: 294 px Text bei 16 px auf
   264 px Platz; bei 14,4 px waren es schon 265 auf 264).                 */
@media (pointer: coarse) {
  .kchat-input, .kchat-guide__text { font-size: 16px; }
  .kchat-input::placeholder, .kchat-guide__text::placeholder { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) { .kchat-teaser { transition: none; } }

/* Angaben zum Verkehrsunfall im Chat (Variante B, unfall.js baut die Felder). Schrift 16 px: sonst zoomt iOS beim Tippen. */
.kchat-unfall { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: var(--weiss, #fff); border: 1px solid rgba(0,0,0,.12); }
.kchat-unfall__felder { display: flex; flex-direction: column; gap: 10px; }
.kchat-unfall__feld { display: flex; flex-direction: column; gap: 4px; }
.kchat-unfall__feld label, .kchat-unfall__wahl legend { font-size: .86rem; font-weight: 600; color: var(--ink, #1a1411); }
.kchat-unfall .kchat-guide__text { width: 100%; font-size: 16px; resize: vertical; }
.kchat-unfall input.kchat-guide__text { min-height: 42px; }
.kchat-unfall__wahl { display: flex; flex-wrap: wrap; gap: 2px 16px; border: 0; padding: 0; margin: 0; min-width: 0; }
.kchat-unfall__wahl legend { width: 100%; margin-bottom: 2px; padding: 0; }
.kchat-unfall__wahl label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: .92rem; }
.kchat-unfall__wahl input { width: 18px; height: 18px; accent-color: var(--rot, #c96040); }
.kchat-unfall [hidden] { display: none; }
