/* Hilfe-Chat „Frag uns“ – schwebender Knopf + Fenster. Farben aus den Glas-Tokens der Seite (--accent, --ink, --muted …).
   Hell auf der öffentlichen Webseite, dunkel im Kundenbereich: folgt <html data-theme>, NICHT der Systemeinstellung
   (sonst Weiß auf Weiß am iPhone im Dunkelmodus, Fehler 26.11.2026). Alle Textpaare ≥ 4,5:1. */
.dwc {
  --dwc-ak: var(--accent, #3242c8);
  --dwc-ak-tx: var(--accent-ink, #ffffff);
  --dwc-bg: #ffffff;
  --dwc-fl: #eef0f7;
  --dwc-feld: #ffffff;
  --dwc-tx: var(--ink, #10142a);
  --dwc-gd: var(--muted, #4f5674);
  --dwc-rand: rgba(16, 20, 42, 0.14);
  --dwc-feld-rand: rgba(16, 20, 42, 0.32);
  --dwc-schatten: 0 12px 40px rgba(16, 20, 42, 0.18), 0 2px 8px rgba(16, 20, 42, 0.08);
  --dwc-nutzer: var(--dwc-ak);
  --dwc-nutzer-tx: var(--dwc-ak-tx);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--dwc-tx);
  color-scheme: light;
}
:root[data-theme="dark"] .dwc {
  --dwc-ak: var(--accent, #95a5ff);
  --dwc-ak-tx: var(--accent-ink, #0a0d18);
  --dwc-bg: #141a2e;
  --dwc-fl: #222a45;
  --dwc-feld: #0d1222;
  --dwc-tx: var(--ink, #f1f3fa);
  --dwc-gd: var(--muted, #a9b0ca);
  --dwc-rand: rgba(255, 255, 255, 0.14);
  --dwc-feld-rand: rgba(255, 255, 255, 0.3);
  --dwc-schatten: 0 12px 40px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
.dwc textarea::placeholder, .dwc input::placeholder { color: var(--dwc-gd); opacity: 1; }
.dwc *, .dwc *::before, .dwc *::after { box-sizing: border-box; }

/* runder Knopf */
.dwc-knopf {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 2147483000; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--dwc-ak); color: var(--dwc-ak-tx); box-shadow: var(--dwc-schatten);
  display: grid; place-items: center; cursor: pointer;
  transition: transform 160ms cubic-bezier(.2,.8,.2,1);
}
.dwc-knopf:hover { transform: scale(1.05); }
.dwc-knopf:active { transform: scale(0.96); }
.dwc-knopf:focus-visible, .dwc button:focus-visible, .dwc textarea:focus-visible, .dwc input:focus-visible, .dwc a:focus-visible {
  outline: 3px solid var(--dwc-ak); outline-offset: 2px;
}
.dwc-knopf svg { width: 26px; height: 26px; }
.dwc-knopf[aria-expanded="true"] { display: none; }

/* Fenster */
.dwc-fenster {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 2147483001; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 32px));
  background: var(--dwc-bg); border: 1px solid var(--dwc-rand); border-radius: 18px; box-shadow: var(--dwc-schatten);
  display: flex; flex-direction: column; overflow: hidden; padding: 0; margin: 0; /* <section>: Seitenabstände der Webseite nicht übernehmen */
  transform-origin: bottom right; animation: dwc-auf 180ms cubic-bezier(.2,.8,.2,1);
}
.dwc-fenster[hidden] { display: none; }
@keyframes dwc-auf { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dwc-fenster { animation: none; } .dwc-knopf { transition: none; } }
@media (max-width: 520px) {
  .dwc-fenster { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}
/* eingebettet auf /hilfe */
.dwc-seite .dwc-fenster { position: static; width: 100%; height: min(70dvh, 640px); animation: none; box-shadow: none; }

.dwc-kopf { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--dwc-rand); }
.dwc-titel { flex: 1; min-width: 0; }
.dwc-titel strong { display: block; font-size: 16px; }
.dwc-titel span { display: block; font-size: 12.5px; color: var(--dwc-gd); }
.dwc-kopf button {
  border: 0; background: transparent; color: var(--dwc-tx); border-radius: 10px; min-width: 40px; height: 40px; padding: 0 10px;
  cursor: pointer; font: inherit; font-size: 14px;
}
.dwc-kopf button:hover { background: var(--dwc-fl); }

.dwc-liste { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.dwc-blase { max-width: 88%; padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.dwc-blase p { margin: 0 0 .5em; } .dwc-blase p:last-child { margin-bottom: 0; }
.dwc-blase ul, .dwc-blase ol { margin: .25em 0 .5em; padding-left: 1.25em; }
.dwc-nutzer { align-self: flex-end; background: var(--dwc-nutzer); color: var(--dwc-nutzer-tx); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.dwc-assistent { align-self: flex-start; background: var(--dwc-fl); border-bottom-left-radius: 6px; }
.dwc-hinweis { align-self: stretch; font-size: 13.5px; color: var(--dwc-gd); background: transparent; border: 1px dashed var(--dwc-rand); border-radius: 12px; padding: 8px 12px; }
.dwc-aktionen { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.dwc-aktionen a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--dwc-ak); color: var(--dwc-ak); text-decoration: none; font-size: 14px;
}
.dwc-aktionen a:hover { background: var(--dwc-ak); color: var(--dwc-ak-tx); }
.dwc-tippt::after { content: "…"; animation: dwc-puls 1s infinite; }
@keyframes dwc-puls { 50% { opacity: .3; } }

.dwc-fuss { border-top: 1px solid var(--dwc-rand); padding: 10px 12px 12px; display: grid; gap: 8px; }
.dwc-eingabe { display: flex; gap: 8px; align-items: flex-end; }
.dwc-eingabe textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--dwc-feld-rand); background: var(--dwc-feld); color: var(--dwc-tx); font: inherit;
}
.dwc-senden {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--dwc-ak); color: var(--dwc-ak-tx);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.dwc-senden:disabled { opacity: .45; cursor: default; }
.dwc-senden svg { width: 20px; height: 20px; }
.dwc-unten { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dwc-gd); }
.dwc-mensch { border: 0; background: transparent; color: var(--dwc-ak); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 2px; text-decoration: underline; text-underline-offset: 2px; }

.dwc-formular { display: grid; gap: 8px; padding: 10px 12px; background: var(--dwc-fl); border-radius: 12px; align-self: stretch; }
.dwc-formular label { font-size: 13.5px; display: grid; gap: 4px; }
.dwc-formular input, .dwc-formular textarea {
  padding: 9px 11px; border-radius: 10px; border: 1px solid var(--dwc-feld-rand); background: var(--dwc-feld); color: var(--dwc-tx); font: inherit;
}
.dwc-formular .dwc-zeile { display: flex; gap: 8px; justify-content: flex-end; }
.dwc-formular button { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--dwc-rand); background: var(--dwc-bg); color: var(--dwc-tx); font: inherit; cursor: pointer; }
.dwc-formular button[type="submit"] { background: var(--dwc-ak); color: var(--dwc-ak-tx); border-color: var(--dwc-ak); }
.dwc-nur-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- Reiter „Hilfe-Chat | Feedback“ (26.11.2026) */
.dwc-bereich { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dwc-bereich[hidden] { display: none; }
.dwc-reiter { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--dwc-rand); }
.dwc-reiter-knopf {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--dwc-rand); background: transparent; color: var(--dwc-tx);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.dwc-reiter-knopf svg { width: 17px; height: 17px; flex: none; }
.dwc-reiter-knopf:hover { background: var(--dwc-fl); }
.dwc-reiter-knopf[aria-selected="true"] { background: var(--dwc-ak); color: var(--dwc-ak-tx); border-color: var(--dwc-ak); }
.dwc .dwc-reiter-knopf:focus-visible { outline: 3px solid var(--dwc-ak); outline-offset: 2px; }
.dwc-kopf button[hidden] { display: none; }

/* Hinweis neben dem runden Knopf im Feedback-Modus */
.dwc-modus-hinweis {
  position: fixed; right: calc(max(16px, env(safe-area-inset-right)) + 64px); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 12px);
  z-index: 2147483000; max-width: min(260px, calc(100vw - 100px)); min-height: 32px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--dwc-ak); background: var(--dwc-bg); color: var(--dwc-tx); box-shadow: var(--dwc-schatten);
  font: 600 13px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dwc-modus-hinweis::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--dwc-ak); vertical-align: 1px; }
.dwc-modus-hinweis[hidden] { display: none; }
.dwc .dwc-modus-hinweis:focus-visible { outline: 3px solid var(--dwc-ak); outline-offset: 2px; }

/* Feedback: Auswahl */
.dwc-fb { position: relative; }
.dwc-fb-auswahl, .dwc-fb-code { padding: 16px 14px; display: grid; gap: 12px; align-content: start; overflow-y: auto; }
.dwc-fb-einleitung { margin: 0 0 2px; color: var(--dwc-tx); }
.dwc-fb-klein { margin: 0; font-size: 13px; color: var(--dwc-gd); }
.dwc-gross {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 14px; border-radius: 14px; text-align: left;
  border: 1px solid var(--dwc-feld-rand); background: var(--dwc-fl); color: var(--dwc-tx); font: inherit; text-decoration: none; cursor: pointer;
}
.dwc-gross:hover { border-color: var(--dwc-ak); }
.dwc-gross:disabled { opacity: .5; cursor: default; }
.dwc-gross-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--dwc-ak); color: var(--dwc-ak-tx); flex: none; }
.dwc-gross-icon svg { width: 22px; height: 22px; }
.dwc-gross-text { display: grid; gap: 2px; min-width: 0; }
.dwc-gross-text strong { font-size: 15.5px; }
.dwc-gross-text span { font-size: 13px; color: var(--dwc-gd); }
.dwc-fb-code label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; }
.dwc-fb-code input {
  min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--dwc-feld-rand); background: var(--dwc-feld);
  color: var(--dwc-tx); font: inherit; font-weight: 400;
}
.dwc-fb-code input[name="code"] { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em; text-transform: uppercase; }
.dwc-fb-code input[name="code"]::placeholder { text-transform: none; }
.dwc-zeile { display: flex; gap: 8px; justify-content: flex-end; }
.dwc-haupt, .dwc-zweit {
  min-height: 44px; padding: 0 18px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.dwc-haupt { border: 1px solid var(--dwc-ak); background: var(--dwc-ak); color: var(--dwc-ak-tx); }
.dwc-haupt:disabled { opacity: .45; cursor: default; }
.dwc-zweit { border: 1px solid var(--dwc-feld-rand); background: transparent; color: var(--dwc-tx); }
.dwc-fb-fehler { margin: 0; font-size: 13.5px; color: var(--bad, #a91f31); }
:root[data-theme="dark"] .dwc-fb-fehler { color: var(--bad, #ff9097); }
.dwc-fb-fehler[hidden] { display: none; }

/* Feedback: Formular wie ein Chat-Eingabefeld */
.dwc-fb-verlauf { flex: 1; }
.dwc-fb-fuss { gap: 8px; }
.dwc-fb-form { display: grid; gap: 8px; }
.dwc-fb-form textarea {
  width: 100%; resize: none; min-height: 72px; max-height: 200px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--dwc-feld-rand); background: var(--dwc-feld); color: var(--dwc-tx); font: inherit;
}
.dwc-fb-sendet .dwc-fb-form textarea, .dwc-fb-sendet .dwc-fb-kachel { opacity: .6; }
.dwc-fb-leiste { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.dwc-fb-bild {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--dwc-feld-rand); background: transparent; color: var(--dwc-tx); font: inherit; font-size: 14px; cursor: pointer;
}
.dwc-fb-bild svg { width: 18px; height: 18px; }
.dwc-fb-bild:disabled { opacity: .45; cursor: default; }
.dwc-fb-kacheln { display: flex; flex-wrap: wrap; gap: 8px; }
.dwc-fb-kacheln[hidden] { display: none; }
.dwc-fb-kachel {
  position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--dwc-feld-rand); background: var(--dwc-fl);
}
.dwc-fb-kachel img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dwc-fb-laedt { display: grid; place-items: center; font-size: 11px; line-height: 1.2; padding: 4px; text-align: center; color: var(--dwc-gd); width: 96px; }
.dwc-fb-weg {
  position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(16, 20, 42, 0.78); color: #fff; font-size: 13px; line-height: 26px; cursor: pointer;
}
.dwc-fb-gesendet { display: grid; gap: 6px; }
.dwc-fb-gesendet-bilder { display: flex; flex-wrap: wrap; gap: 6px; }
.dwc-fb-gesendet-bilder img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid rgba(255, 255, 255, 0.5); }
.dwc-fb-ok { border-style: solid; }
.dwc-fb-ziehen::after {
  content: attr(data-ziehen); position: absolute; inset: 8px; border: 2px dashed var(--dwc-ak); border-radius: 14px;
  background: color-mix(in srgb, var(--dwc-bg) 88%, transparent); pointer-events: none;
  display: grid; place-items: center; font-weight: 600; color: var(--dwc-tx);
}
@media (max-width: 520px) {
  .dwc-modus-hinweis { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 12px); }
}
