/* ====================================================================
 * LOKAL gehostete Fonts (Sprint 2026-05-14, Buerger-Fonts-Lokalisierung).
 * Frueher von fonts.googleapis.com — jetzt unter src/static/fonts/.
 * Hintergrund: Tracking-Prevention (Edge/Firefox Strict, Brave) blockt
 * Google-Fonts; DSGVO-Drittuebermittlung (LG Muenchen 2022); FOUT-Hygiene.
 * Variable Fonts: Geist/Geist-Mono je 1 File fuer alle Weights, Fraunces
 * je 1 File fuer normal+italic. Pfad relativ zu src/static/styles.css.
 * ==================================================================== */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/fraunces.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('fonts/fraunces-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/geist.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('fonts/geist-mono.woff2') format('woff2');
}

/* ===================================================================
   teamApp eco — Agent · Editorial Minimalism
   Display: Fraunces (variable serif)
   Body:    Geist sans
   Mono:    Geist Mono
   Palette: warmes Off-White, gedaempftes Forest-Gruen, Akzent ocker
   =================================================================== */

:root {
  /* Brand-Color-Source-of-Truth (Sprint brand-color-refactor 2026-05-15):
   * --green-500 / --green-700 sind die semantischen Brand-Slots. JS (chat.js
   * applyBrandColorFromWelcome) ueberschreibt sie aus welcomeData.brand_color
   * — Default-Werte unten dienen als Fallback fuer den Initial-Render bis
   * /agent/welcome geantwortet hat. Mandant-spezifische `body.mandant-X`-
   * Bloecke wurden entfernt; DB.brand_color ist die einzige Quelle. */
  --green-50:  #ecf2e7;
  --green-200: #b9cda6;
  --green-400: #7faf6c;
  --green-500: #5e9457;
  --green-600: #4a7c44;
  --green-700: #335731;
  --green-900: #1a2a18;
  /* Derived Brand-Tones (Sprint brand-color-refactor 2026-05-15):
   * werden ueber color-mix() aus dem aktuellen --green-500 abgeleitet —
   * passen sich automatisch an, wenn JS den Mandant-Brand setzt. */
  --brand-deep: color-mix(in srgb, var(--green-500) 75%, black);
  --brand-soft: color-mix(in srgb, var(--green-500) 12%, white);

  /* Warm neutrals (paper) */
  --paper-0:   #faf7ef;   /* page bg */
  --paper-50:  #f3eee2;
  --paper-100: #ebe5d4;
  --paper-200: #d9d2bd;
  --paper-300: #b6ad95;

  /* Ink */
  --ink-900: #1c1d18;
  --ink-700: #43463d;
  --ink-500: #6f7367;
  --ink-300: #9aa098;

  /* Accent (warm ochre, sparingly) */
  --accent: #b87333;
  --accent-soft: #e0a96d;

  /* Status */
  --status-live:    #5e9457;
  --status-dry:     #b87333;
  --status-warn:    #c25450;

  /* Shadows (soft, cardstock) */
  --shadow-sm: 0 1px 0 rgba(28, 29, 24, 0.04), 0 2px 6px rgba(28, 29, 24, 0.05);
  --shadow-md: 0 1px 0 rgba(28, 29, 24, 0.05), 0 8px 22px rgba(28, 29, 24, 0.08);
  --shadow-lg: 0 1px 0 rgba(28, 29, 24, 0.05), 0 24px 60px -8px rgba(28, 29, 24, 0.18);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body:    "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono:    "Geist Mono", "SFMono-Regular", "Cascadia Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--paper-0);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 100vh;
  font-feature-settings: "ss01", "cv02", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Subtle paper grain over everything === */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.10 0 0 0 0 0.10 0 0 0 0 0.06 0 0 0 0.16 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

/* === HEADER === */
header {
  position: relative; z-index: 100;
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-5);
  padding: var(--space-5) clamp(20px, 5vw, 56px) var(--space-4);
  border-bottom: 1px solid var(--paper-100);
  background: linear-gradient(180deg, var(--paper-0) 0%, var(--paper-0) 100%);
}

.brand { display: flex; align-items: center; gap: var(--space-4); }
.brand-mark {
  width: 36px; height: 36px;
  color: var(--green-700);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 100%; height: 100%; }
/* Hotfix Sprint 13 (2026-05-17): Mandant-Logo via <img> (Server-Side gerendert)
 * braucht analoge Constraints — sonst rendert das PNG/WebP in Original-Groesse
 * und ueberdeckt den ganzen Screen. */
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }

.brand-text h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink-900);
  font-feature-settings: "ss01";
}
.brand-text h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--green-700);
  font-feature-settings: "ss01";
}
.brand-sub {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
}
.dot-sep { display: inline-block; margin: 0 6px; color: var(--paper-300); }

.meta { display: flex; align-items: center; gap: var(--space-5); position: relative; }

/* Sprint 5 UX-Redesign 2026-05-15 (Item 2) — Header-Kebab-Dropdown.
 *
 * Existing Header-Icons (TTS-Mute, Einfache-Sprache, Sprach-Globus) wandern
 * zur Laufzeit (siehe chat.js:setupHeaderKebab) in ein Dropdown-Menu. Im
 * Header sichtbar bleibt: Logo+Brand (links), Kebab+ggf. Close (rechts).
 * Reduziert Header-Buttons von 3 auf 1. */
.kebab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kebab-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--paper-0, #fff);
  border: 1px solid var(--paper-200, #e3dfd5);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
.kebab-menu[hidden] { display: none; }
.kebab-menu-item-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.kebab-menu-item-wrap > .kebab-menu-item-btn {
  /* Original-Header-Btn wird hier Vollzeilen-Menu-Item. Reset der
   * Pill-Geometrie aus .meta-btn. */
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  text-align: left;
  font-size: 13px;
  color: var(--ink-900, #2b2a26);
  cursor: pointer;
  min-height: 40px;
  justify-content: flex-start;
}
.kebab-menu-item-wrap > .kebab-menu-item-btn:hover {
  background: var(--paper-50, #f5f3eb);
  color: var(--accent, var(--green-700));
}
.kebab-menu-item-wrap > .kebab-menu-item-btn[aria-pressed="true"] {
  color: var(--accent, var(--green-700));
}
.kebab-menu-item-wrap > .kebab-menu-item-btn .easy-lang-label {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}
.kebab-menu-item {
  /* Synth. Menu-Item (z.B. Voice-Mode-Toggle aus addVoiceModeToggleToKebab). */
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 13px;
  color: var(--ink-900, #2b2a26);
  cursor: pointer;
  min-height: 40px;
}
.kebab-menu-item:hover {
  background: var(--paper-50, #f5f3eb);
  color: var(--accent, var(--green-700));
}
.kebab-menu-item[aria-pressed="true"] {
  color: var(--accent, var(--green-700));
}
.kebab-menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.kebab-menu-item-label {
  flex: 1;
}
.meta-stack { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.meta-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.meta-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-300);
  font-weight: 500;
}
.meta-value {
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: 0.02em;
}
.meta-value.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-700);
  font-weight: 400;
}

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--status-dry);
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 2.4s ease-in-out infinite;
  color: var(--status-dry);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 115, 51, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(184, 115, 51, 0); }
}
body[data-mode="MUSTERSTADT"] .status-dot { background: var(--status-dry); color: var(--status-dry); }
body[data-mode="GERMERSHEIM"] .status-dot { background: var(--status-live); color: var(--status-live); }
body[data-mode="GERMERSHEIM"] .status-dot { animation-name: pulse-live; }
@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(94, 148, 87, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(94, 148, 87, 0); }
}
body[data-mode="DRY"] .status-dot { background: var(--ink-300); color: var(--ink-300); animation: none; }

.meta-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  color: var(--ink-700);
  border: 1px solid var(--paper-200);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
  min-height: 36px;
}
.meta-btn:hover {
  border-color: var(--green-500);
  color: var(--green-700);
  background: var(--green-50);
}
.meta-btn:active { transform: scale(0.98); }

/* COST-WIDGET START */
.cost-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--green-200);
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green-700);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cost-counter .cc-sep { color: var(--paper-300); }
.cost-counter .cc-cost { font-weight: 600; }
/* COST-WIDGET END */

/* === MAIN === */
main {
  position: relative; z-index: 1;
  display: flex; align-items: stretch; justify-content: center;
  padding: var(--space-5) clamp(16px, 5vw, 56px);
  overflow: hidden;
}
.frame {
  position: relative;
  width: 100%; max-width: 760px;
  display: flex; flex-direction: column;
  background: #fff;
  border: 1px solid var(--paper-100);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.frame-rule {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--green-700) 0%, var(--green-500) 60%, var(--accent) 100%);
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-7) var(--space-5) var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: var(--paper-200) transparent;
  /* Beim Scroll oben+unten weicher Fade, damit Bubbles nicht harten Rand des Frames stossen */
  mask-image: linear-gradient(180deg, transparent 0px, #000 28px, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0px, #000 28px, #000 calc(100% - 12px), transparent 100%);
}
#messages::-webkit-scrollbar { width: 8px; }
#messages::-webkit-scrollbar-thumb { background: var(--paper-200); border-radius: 4px; }

/* === Chat Bubbles === */
.msg {
  position: relative;
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  line-height: 1.6;
  font-size: 15px;
  animation: msg-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  /* Hotfix 2026-05-17: Auto-Silbentrennung fuer deutsche Komposita
   * ("Landkreis Germersheim"). html lang="de" steht im Template. */
  hyphens: auto;
  -webkit-hyphens: auto;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.user {
  align-self: flex-end;
  background: var(--green-700);
  color: #fff;
  border-bottom-right-radius: 4px;
  letter-spacing: 0.005em;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--paper-50);
  color: var(--ink-900);
  border-bottom-left-radius: 4px;
  border-left: 2px solid var(--green-500);
  padding-left: 14px;
}
.msg strong {
  font-weight: 600;
  color: var(--green-700);
}
.msg.user strong { color: #ffe7c8; }
.msg .li {
  display: flex;
  gap: 10px;
  margin: 4px 0;
  align-items: flex-start;
}
.msg .li-num {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: var(--green-500);
  flex-shrink: 0;
  min-width: 24px;
}
.msg .li-body {
  flex: 1;
  min-width: 0;
}
.msg.user .li-num { color: var(--accent-soft); }
.msg em { font-family: var(--font-display); font-style: italic; }

/* Inline-Quellenangaben [N] (gerendert als <sup>N</sup>) und Plain-URL-
 * Linkify in Bot-Antworten. Kleine Brand-Farbe + dezente Klick-Affordance. */
.msg .footnote-ref {
  color: var(--green-500, #335731);
  font-weight: 500;
  font-size: 0.7em;
  margin-left: 1px;
}
/* Markdown-Headlines (rendered von chat.js renderMarkdown ##/###/#) */
.msg .md-h {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  margin-top: 0.5em;
  margin-bottom: 0.25em;
}
.msg h2.md-h { font-size: 1.15em; line-height: 1.25; }
.msg h3.md-h { font-size: 1.05em; line-height: 1.3; }
.msg h4.md-h { font-size: 0.98em; line-height: 1.35; color: var(--ink-700); }
.msg .md-h:first-child { margin-top: 0; }
/* GFM-Tabellen (Sprint 18 2026-05-18) */
.msg table.md-table {
  border-collapse: collapse;
  width: auto;
  max-width: 100%;
  margin: 8px 0;
  font-size: 0.95em;
  background: #fff;
  table-layout: auto;
}
.msg table.md-table th,
.msg table.md-table td {
  padding: 6px 10px;
  border: 1px solid var(--ink-300, #d6d8d2);
  vertical-align: top;
  /* Anti-Text-Tower: lange Wörter umbrechen statt Spalte schmal zu klemmen */
  word-break: normal;
  overflow-wrap: anywhere;
  min-width: 80px;
}
.msg table.md-table th {
  background: var(--ink-300, #f2f3ef);
  font-weight: 600;
  color: var(--ink-900);
}
.msg table.md-table tr:nth-child(even) td { background: #fafaf7; }
/* Trennung bei aufeinanderfolgenden Quellen — sonst sieht ¹⁷ aus wie 17 */
.msg .footnote-ref + .footnote-ref::before {
  content: ",";
  margin-right: 1px;
  color: var(--green-500, #335731);
  font-size: 0.7em;
  vertical-align: super;
}
.msg.user .footnote-ref { color: inherit; }
.msg a {
  color: var(--green-700, #335731);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.msg a:hover { text-decoration: none; }
.msg.user a { color: inherit; }

/* === Input === */
#chat-form {
  display: flex; gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--paper-100);
  background: linear-gradient(180deg, transparent, var(--paper-0) 80%);
}
.input-wrap {
  flex: 1;
  position: relative;
  display: flex; align-items: center;
  background: #fff;
  border: 1px solid var(--paper-200);
  border-radius: var(--r-md);
  padding: 0 14px 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.input-wrap:focus-within {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(94, 148, 87, 0.12);
}
.input-prompt {
  font-family: var(--font-mono);
  color: var(--green-500);
  font-size: 16px;
  margin-right: 8px;
  font-weight: 500;
  user-select: none;
}
#chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink-900);
  padding: 10px 0;
}
#chat-input::placeholder { color: var(--ink-300); }

.send-btn {
  width: 44px; height: 44px;
  border: none;
  background: var(--green-700);
  color: #fff;
  border-radius: var(--r-md);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, transform 0.1s;
}
.send-btn:hover { background: var(--green-900); }
.send-btn:active { transform: scale(0.96); }

/* === Mic-Button (STT) === */
.mic-btn {
  width: 44px; height: 44px;
  border: 1px solid var(--paper-200);
  background: #fff;
  color: var(--ink-700);
  border-radius: var(--r-md);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.mic-btn:hover {
  border-color: var(--green-500);
  color: var(--green-700);
  background: var(--green-50);
}
.mic-btn:active { transform: scale(0.96); }
.mic-btn.recording {
  background: var(--status-warn);
  color: #fff;
  border-color: var(--status-warn);
  animation: mic-pulse 1.4s ease-in-out infinite;
}
.mic-btn.recording:hover {
  background: var(--status-warn);
  color: #fff;
  border-color: var(--status-warn);
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(194, 84, 80, 0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(194, 84, 80, 0); }
}

/* === TTS-Toggle im Header === */
.meta-btn-icon {
  padding: 8px;
  min-width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  position: relative;
}
.meta-btn-icon .tts-icon-on,
.meta-btn-icon .tts-icon-off {
  display: none;
}
.meta-btn-icon[aria-pressed="true"] .tts-icon-on { display: inline-block; }
.meta-btn-icon[aria-pressed="false"] .tts-icon-off { display: inline-block; }
.meta-btn-icon[aria-pressed="true"] {
  border-color: var(--green-500);
  color: var(--green-700);
  background: var(--green-50);
}

/* === DEBUG PANEL === */
#debug-panel {
  position: relative; z-index: 2;
  background: var(--ink-900);
  color: var(--green-200);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  border-top: 1px solid var(--paper-100);
}
#debug-panel summary {
  padding: 10px clamp(20px, 5vw, 56px);
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--paper-300);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}
#debug-panel summary::-webkit-details-marker { display: none; }
#debug-panel summary::before {
  content: "▸";
  margin-right: 8px;
  transition: transform 0.15s;
  display: inline-block;
}
#debug-panel[open] summary::before { transform: rotate(90deg); }
#debug-panel summary > span:first-child { flex: 1; }
.kbd {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 2px 6px;
  background: var(--green-900);
  color: var(--green-200);
  border-radius: 3px;
  letter-spacing: 0.08em;
}
#debug-log {
  white-space: pre-wrap;
  padding: 0 clamp(20px, 5vw, 56px) 14px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--green-700) transparent;
}
#debug-log::-webkit-scrollbar { width: 6px; }
#debug-log::-webkit-scrollbar-thumb { background: var(--green-700); border-radius: 3px; }

/* === FOOTER === */
footer {
  position: relative; z-index: 2;
  display: flex; justify-content: flex-start; align-items: center;
  padding: 14px clamp(20px, 5vw, 56px);
  border-top: 1px solid var(--paper-100);
  background: var(--paper-0);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-500);
}
.foot-mark {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  color: var(--green-700);
  letter-spacing: 0;
}
.foot-text {
  text-align: right;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
}

/* === RESPONSIVE === */
@media (max-width: 720px) {
  header {
    flex-direction: column; align-items: flex-start; gap: var(--space-3);
    padding: var(--space-4) var(--space-4);
  }
  .meta { width: 100%; justify-content: space-between; }
  .meta-stack { align-items: flex-start; }
  main { padding: var(--space-3); }
  .frame { border-radius: var(--r-md); }
  #messages { padding: var(--space-4) var(--space-3) var(--space-3); }
  .msg { max-width: 88%; }
  footer { flex-direction: column; gap: 4px; align-items: flex-start; }
  .foot-text { text-align: left; }
}

/* === LOAD ANIMATION === */
@media (prefers-reduced-motion: no-preference) {
  header > .brand        { animation: fade-up 0.7s 0.05s cubic-bezier(0.2,0.7,0.2,1) both; }
  header > .meta         { animation: fade-up 0.7s 0.15s cubic-bezier(0.2,0.7,0.2,1) both; }
  main > .frame          { animation: fade-up 0.7s 0.25s cubic-bezier(0.2,0.7,0.2,1) both; }
  footer                 { animation: fade-up 0.7s 0.40s cubic-bezier(0.2,0.7,0.2,1) both; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ TIPPEN-/TOOL-STATUS-INDIKATOR (Task 6, Streaming-Sprint 28.04.) ============ */

.bot-bubble--status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f3f0;
    border-radius: 18px;
    padding: 12px 16px;
    margin: 8px 0;
    max-width: 80%;
    font-size: 14px;
    color: var(--green-700, #335731);
    align-self: flex-start;
}

/* Mode: thinking — 3 pulsierende Punkte */
.bot-bubble--status[data-state="thinking"] .bot-status__dots {
    display: inline-flex;
    gap: 4px;
}
.bot-bubble--status[data-state="thinking"] .bot-status__icon,
.bot-bubble--status[data-state="thinking"] .bot-status__text {
    display: none;
}

.bot-status__dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-700, #335731);
    display: inline-block;
    animation: tae-bounce 1.4s ease-in-out infinite both;
}
.bot-status__dots span:nth-child(2) { animation-delay: 0.16s; }
.bot-status__dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes tae-bounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
    40%           { transform: scale(1.0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .bot-status__dots span {
    animation: none !important;
  }
}

/* Mode: tool_status — Icon + Text */
.bot-bubble--status[data-state="tool_status"] .bot-status__dots {
    display: none;
}
.bot-bubble--status[data-state="tool_status"] .bot-status__icon,
.bot-bubble--status[data-state="tool_status"] .bot-status__text {
    display: inline;
}
.bot-status__icon { font-size: 16px; margin-right: 4px; }
.bot-status__text { color: var(--green-700, #335731); }

/* ============ WELCOME-BASELINE (Task 8, Streaming-Sprint 28.04.) ============ */

.welcome-bubble {
    background: #f1f3f0;
    color: var(--green-700, #335731);
}

.welcome-quick-replies {
    /* Grid 2-Spalten — alle Buttons gleich breit + gleich hoch.
     * Aufgeraeumter Look, Chat-Bot-Standard (Intercom/Drift).
     * Welcome-Bubble + QR-Container beide auf 78% gezwungen damit sie
     * visuell aligned sind (sonst nimmt Bubble content-width und wirkt
     * schmaler als die QR-Cards). */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 4px 0 16px 0;
    width: 78%;
    max-width: 78%;
    box-sizing: border-box;
}

/* Welcome-Bubble auf gleiche 78% wie QR-Container stretchen (statt
 * content-width via .msg max-width). So sind Bubble und QR-Cards
 * exakt gleich breit. */
.welcome-bubble {
    width: 78%;
    box-sizing: border-box;
}

/* ChatGPT-Scroll-Pattern (Sprint 2026-05-12):
 * Spacer-Div am Ende von #messages reserviert Scroll-Spielraum INNERHALB
 * der Liste, damit User-Bubble nach Submit zum Top gescrollt werden kann.
 * overflow-anchor:none verhindert Browser-Reinpfuschen waehrend Streaming.
 * scroll-behavior:smooth animiert alle scrollTop-Updates. */
#messages {
    scroll-behavior: smooth;
}
.scroll-spacer {
    min-height: 0;
    pointer-events: none;
    flex: 0 0 auto;
}
#messages > * {
    overflow-anchor: none;
}

.welcome-qr-btn {
    background: #fff;
    border: 1px solid var(--green-700, #335731);
    color: var(--green-700, #335731);
    border-radius: 18px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    /* Sprint 2 Differenzierung 2026-05-15: aufgewertete Pills mit Lift +
     * Brand-Color-Glow im Hover. */
    transition: background 0.15s ease, border-color 0.15s ease,
                box-shadow 0.18s ease, transform 0.18s ease;
    /* Full-width via Grid-Slot; Text linksbuendig statt zentriert
     * sieht aufgeraeumter aus bei verschieden-langen Texten. */
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 6px;
}
.welcome-qr-btn:hover,
.welcome-qr-btn:focus-visible {
    background: #f1f3f0;
    border-color: var(--green-500, #5e9457);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--green-500) 22%, transparent);
    transform: translateY(-1px);
    outline: none;
}
@media (prefers-reduced-motion: reduce) {
    .welcome-qr-btn { transition: background 0.15s ease; }
    .welcome-qr-btn:hover,
    .welcome-qr-btn:focus-visible {
        transform: none;
        box-shadow: none;
    }
}

/* Auf sehr schmalen Mobile-Breiten (< 480px) zurueck auf 1-spaltig */
@media (max-width: 480px) {
    .welcome-quick-replies {
        grid-template-columns: 1fr;
    }
}

/* Icon-Span: SVG erbt currentColor von .welcome-qr-btn (#335731). Damit
 * sind die Icons monochrom in Brand-Color statt bunte OS-Emoji. */
.welcome-qr-icon {
    display: inline-flex;
    align-items: center;
    color: var(--green-700, #335731);
}
.welcome-qr-icon svg {
    display: block;
}

/* Follow-up-Pill Emoji-Icon (Sprint 2026-05-12): wenn Emoji im Label
 * gegen SVG ausgetauscht wird, brauchen wir kompakte Sizing. */
.follow-up-emoji-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 2px;
}
.follow-up-emoji-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* Mandant-spezifisches Header-Branding (Sprint 2026-05-11) — Logo als img. */
.brand-mark-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: block;
    border-radius: 50%;
}
.brand-mark-logo--teamwerk {
    /* teamwerk-Logo hat eingebauten weissen Rand zwischen Halbmond und Kreis */
    width: 32px;
    height: 32px;
}
/* Mandant-Branding (Sprint brand-color-refactor 2026-05-15):
 * Frueher hardcoded body.mandant-germersheim-Block mit ~25 !important-
 * Overrides pro Mandant. Jetzt entfernt — JS (applyBrandColorFromWelcome
 * in chat.js) setzt --green-500/--green-700/--accent/--brand-color aus
 * DB.brand_color aufs <html>-Element. Alle nachfolgenden CSS-Regeln
 * referenzieren bereits var(--green-500) / var(--green-700) und greifen
 * den Mandant-Wert automatisch ab. Logo-Sizing und mandant-spezifisches
 * Logo-Markup bleibt in chat.js + brand-mark-logo-Klassen. */

/* Akquise-Demo-Mode (Sprint 2026-05-11): Disclaimer-Banner + Sidebar versteckt.
 * Aktiv wenn body.demo-mode gesetzt ist (chat.js prueft Hostname). */
.demo-disclaimer {
    display: none;
}
body.demo-mode .demo-disclaimer {
    display: block;
    background: #fef9e7;
    border-bottom: 1px solid #e8d870;
    color: #6b4f00;
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    /* box-sizing: border-box damit padding nicht ueber 100% schiebt */
    box-sizing: border-box;
    width: 100%;
    overflow-wrap: break-word;
}
.demo-disclaimer__inner {
    /* Full-width — kein max-width, damit das Banner von Rand zu Rand geht.
     * Padding kommt von .demo-disclaimer selbst. Text-balance verbessert
     * den Umbruch bei mehrzeiligen Bannern. */
    margin: 0;
    text-align: center;
    text-wrap: balance;
}
.demo-disclaimer__sep {
    margin: 0 0.5em;
    opacity: 0.5;
}
.demo-disclaimer__link {
    color: #6b4f00;
    text-decoration: underline;
}
body.demo-mode .sidebar,
body.demo-mode .sidebar-toggle {
    display: none !important;
}
/* Body selbst hat padding-left vom Sidebar-Offset — bei Demo aufheben */
body.demo-mode.has-sidebar {
    padding-left: 0 !important;
}
body.demo-mode .layout-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}
/* Header + Footer ueber volle Breite, Main-Inhalt (Chat-Card) bleibt
 * durch sein Default-CSS (.frame max-width) zentriert. Sidebar ist weg,
 * also greift das Default-Layout. */
body.demo-mode header,
body.demo-mode footer {
    max-width: none !important;
    width: 100% !important;
}
body.demo-mode main {
    max-width: none !important;
    width: 100% !important;
}

/* Footer zentriert auf Demo-Page (statt Default flex-start) */
body.demo-mode footer {
    justify-content: center !important;
    text-align: center;
}

/* No-Scroll-Layout fuer Akquise-Demo: alles passt in den Viewport.
 * Body + layout-content auf 100vh fixieren, main scrollt intern bei Bedarf. */
body.demo-mode {
    height: 100vh;
    overflow: hidden;
}
body.demo-mode .layout-content {
    height: 100vh !important;
    min-height: 100vh !important;
    overflow: hidden;
}
body.demo-mode main {
    overflow-y: auto;
    min-height: 0;
}
/* Kompaktere Header-Padding fuer Demo-Mode damit der Footer in den
 * Viewport passt. */
body.demo-mode header {
    padding-top: 12px !important;
    padding-bottom: 10px !important;
}
body.demo-mode footer {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* Frame-Rule (Linie oben an der Chat-Card) wird Default-Gradient-aus-
 * Brand-Color-Mix gezeichnet — Mandant-Spezial-Override (Germersheim
 * Solid-Blau) entfaellt mit dem brand-color-refactor 2026-05-15. */

/* Welcome-Hint (Sprint 2026-05-11): expliziter Hinweis nach den Quick-Replies
 * dass der User auch eigene Fragen tippen kann — Quick-Replies sind Beispiele,
 * kein Limit. */
.welcome-hint {
    margin: 16px 0 8px 4px;
    font-size: 13px;
    color: var(--ink-500, #6f7367);
    font-style: italic;
    text-align: left;
}
.welcome-hint__arrow {
    display: inline-block;
    margin-left: 4px;
    font-style: normal;
    color: var(--green-500, #5e9457);
    font-weight: 600;
}
/* suew-eww-Mandant-Branding (Sprint brand-color-refactor 2026-05-15):
 * Frueher hardcoded body.mandant-suew-eww-Block mit ~25 !important-
 * Overrides (Brand: Petrol/Teal #2f4747). Analog zum germersheim-Block
 * entfernt — JS setzt --green-500/--green-700 aus DB.brand_color, alle
 * nachfolgenden CSS-Regeln nutzen die Variable. */

/* Session-ID + Modus-Anzeige im Header verstecken — fuer Buerger
 * irrelevant, wirkt nach Beta/Debug. */
body.demo-mode .meta-stack {
    display: none !important;
}

/* (Widget bleibt eingeblendet — Akquise-Vorzeige-Element fuer den Embed-Pitch) */

/* Einfache-Sprache-Toggle (Sprint 2026-05-10): kompakter Header-Button.
 * Aktiviert (aria-pressed="true") faerbt Hintergrund Brand-Color. */
.easy-lang-toggle .easy-lang-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: currentColor;
}
.easy-lang-toggle[aria-pressed="true"] {
    background: var(--green-700, #335731);
    color: #fff;
    border-color: var(--green-700, #335731);
}
.easy-lang-toggle[aria-pressed="true"] .easy-lang-label {
    color: #fff;
}

/* Follow-up-Pills (Sprint 2026-05-10): kleinere Pills unter jeder Bot-Bubble
 * mit thematisch verwandten Seiten aus dem RAG-Index. Visuell abgesetzt vom
 * Welcome (kompakter, etwas heller). */
.follow-up-pills {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 14px 8px;
}
.follow-up-pill {
    background: #f5f7f4;
    border: 1px solid #cdd5cb;
    color: var(--green-700, #335731);
    border-radius: 14px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
}
.follow-up-pill:hover {
    background: #e9ede7;
    border-color: var(--green-700, #335731);
}

/* Skeleton-Loading fuer Follow-Up-Pills (Sprint quickreplies-skeleton,
 * 2026-05-14): wird waehrend `suggest_followups`-Tool-Call eingeblendet,
 * verschwindet sobald echte Pills via `follow_ups`-SSE-Event ankommen.
 * Gleiches Margin/Gap wie .follow-up-pills, damit Layout nicht springt. */
.follow-up-skeleton {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin: 4px 0 14px 8px;
}
.follow-up-skeleton .skel-pill {
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(
        90deg,
        #f5f7f4 25%,
        #e4e9e2 50%,
        #f5f7f4 75%
    );
    background-size: 200% 100%;
    animation: skel-shimmer 1.4s ease-in-out infinite;
}
.follow-up-skeleton .skel-pill:nth-child(1) { width: 110px; }
.follow-up-skeleton .skel-pill:nth-child(2) { width: 150px; }
.follow-up-skeleton .skel-pill:nth-child(3) { width: 120px; }
@keyframes skel-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
/* Reduced-Motion-Respekt: kein Shimmer, nur statisches Grau. */
@media (prefers-reduced-motion: reduce) {
    .follow-up-skeleton .skel-pill {
        animation: none;
        background: #e9ede7;
    }
}

/* Input-Lock-Styling (Sprint 2026-05-13, fix/input-lock-streaming):
 * Buttons/Inputs werden waehrend Bot-Stream via `disabled` gesperrt.
 * Custom-Styles oben uebersteuern Browser-Default fuer `:disabled` —
 * hier explizit ausgrauen und Hover/Cursor abschalten. */
.welcome-qr-btn:disabled,
.follow-up-pill:disabled,
.send-btn:disabled,
.escalation-form-btn:disabled,
#chat-input:disabled,
.escalation-form-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.welcome-qr-btn:disabled:hover,
.follow-up-pill:disabled:hover,
.send-btn:disabled:hover,
.escalation-form-btn:disabled:hover {
    /* Hover-Effekte waehrend disabled unterdruecken */
    background: inherit;
    border-color: inherit;
}

.follow-up-icon {
    color: #5a7758;
    font-weight: 600;
    font-size: 13px;
}

/* ============ SPRACH-PICKER (Task 11) ============ */

.lang-picker-popup {
    position: absolute;
    top: 44px;
    right: 0;
    /* Sprint 5 UX-Redesign 2026-05-15 (Item 2): Lang-Picker sitzt im
     * Kebab-Menu (z-index 1000) — Sub-Popup muss darueber liegen. */
    z-index: 1100;
    background: #fff;
    border: 1px solid var(--paper-200);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    padding: 6px;
    display: flex;
    flex-direction: column;
    min-width: 160px;
    max-height: 320px;
    overflow-y: auto;
}

.lang-picker-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--ink-700);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.lang-picker-item:hover {
    background: var(--green-50);
    color: var(--green-700);
}

.lang-picker-item.active {
    background: var(--green-50);
    color: var(--green-700);
    font-weight: 600;
}

.meta {
    position: relative;
}

/* ============ RTL-OVERRIDES (Task 11) — minimaler Eingriff ============ */
/* Vollstaendiges RTL-Layout-Tuning ist Polish-Sprint, hier nur das
   wirklich Stoerende: Chevron-Prompt und Send-Icon spiegeln. */

[dir="rtl"] .input-prompt {
    transform: scaleX(-1);
}

[dir="rtl"] .send-btn svg {
    transform: scaleX(-1);
}

[dir="rtl"] .lang-picker-popup {
    right: auto;
    left: 0;
}

/* ============ HIDDEN-ATTRIBUTE-OVERRIDE (Sprint X2 Hotfix 3) ============ */
/* Klassen wie .mic-btn / .meta-btn-icon setzen display:grid
   bzw. display:inline-grid — das hat hoehere Spezifitaet als das User-Agent
   [hidden] { display: none } und macht Buttons sichtbar trotz hidden=true.
   HTML5-Spec-Standard-Pattern: [hidden] mit !important erzwingt Versteckung. */
[hidden] {
    display: none !important;
}

/* ===================================================================
   Akquise-Demo-Sidebar (2026-05-09)
   Linker Aside-Container, ~240px breit, collapsible auf Mobile.
   =================================================================== */

:root {
  --sidebar-w: 240px;
  --brand-color: var(--green-700);  /* per-Mandant via JS ueberschreibbar */
}

/* Layout: wenn Sidebar aktiv, Content nach rechts ruecken.
   Wir benutzen padding-left auf body statt margin, damit der bestehende
   grid-template-rows (header 1fr footer footer) erhalten bleibt. */
body.has-sidebar {
  padding-left: var(--sidebar-w);
  transition: padding-left 0.18s ease;
}
body.has-sidebar.sidebar-collapsed {
  padding-left: 0;
}

/* layout-content wrappt Header/Main/Footer (Sidebar-Sprint 2026-05-09).
   Body-Grid greift dann nicht mehr fuer die Inner-Childs, also muss
   layout-content selbst Height fuellen + main mit flex:1 expandieren —
   sonst stuende der Footer auf halber Hoehe. */
.layout-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.layout-content > main {
  flex: 1 1 auto;
}

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--paper-50);
  border-right: 1px solid var(--paper-100);
  z-index: 110;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4);
  overflow-y: auto;
  transition: transform 0.2s ease;
}
.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-section {
  margin-bottom: var(--space-5);
}
.sidebar-section:last-of-type {
  margin-top: auto;
  margin-bottom: 0;
}

.sidebar-heading {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-300);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.mandant-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mandant-list-loading {
  font-size: 12px;
  color: var(--ink-300);
  font-style: italic;
  padding: 8px 12px;
}
.mandant-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-700);
  user-select: none;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.mandant-item:hover {
  background: var(--green-50);
  border-color: var(--green-200);
}
.mandant-item.active {
  background: var(--green-50);
  border-color: var(--green-500);
  color: var(--green-700);
  font-weight: 500;
}
.mandant-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mandant-item-status {
  font-size: 12px;
  flex-shrink: 0;
}
.mandant-item-status.status-ready { color: var(--status-live); }
.mandant-item-status.status-crawling {
  color: var(--accent);
  animation: spin 1.6s linear infinite;
  display: inline-block;
}
.mandant-item-status.status-error { color: var(--status-warn); }
.mandant-item-status.status-idle { color: var(--ink-300); }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.mandant-item-progress {
  font-size: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-left: 6px;
  flex-shrink: 0;
}
.mandant-item-dots {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--ink-300);
  flex-shrink: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.mandant-item-dots:hover {
  background: var(--paper-100);
  color: var(--ink-700);
}

.sidebar-add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--paper-300);
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-700);
  font-weight: 500;
  transition: border-color 0.12s, background 0.12s;
}
.sidebar-add-btn:hover {
  border-color: var(--green-500);
  background: var(--green-50);
  color: var(--green-700);
}
.sidebar-add-plus {
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.add-mandant-form {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--paper-100);
  border-radius: var(--r-md);
  padding: var(--space-3);
}
.add-mandant-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  font-weight: 500;
  text-transform: uppercase;
}
.add-mandant-label input {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-900);
  border: 1px solid var(--paper-200);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.add-mandant-label input:focus { outline: none; }
.add-mandant-label input:focus-visible {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(94, 148, 87, 0.45);
}
.add-mandant-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.sidebar-btn-primary {
  background: var(--green-700);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.sidebar-btn-primary:hover { background: var(--green-600); }
.sidebar-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sidebar-btn-link {
  background: transparent;
  border: none;
  color: var(--ink-500);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 0;
}
.sidebar-btn-link:hover { color: var(--ink-700); text-decoration: underline; }
.add-mandant-error {
  font-size: 12px;
  color: var(--status-warn);
  background: rgba(194, 84, 80, 0.08);
  border-radius: var(--r-sm);
  padding: 6px 8px;
}

.sidebar-footer {
  padding: var(--space-3);
  background: var(--paper-100);
  border-radius: var(--r-md);
  font-size: 11px;
  color: var(--ink-500);
  margin-top: auto;
}
.sidebar-footer-label {
  font-weight: 600;
  color: var(--ink-700);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  margin-bottom: 4px;
}
.sidebar-footer-hint {
  line-height: 1.4;
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-w) + 12px);
  z-index: 120;
  background: #fff;
  border: 1px solid var(--paper-200);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: none;  /* nur auf Mobile sichtbar */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  color: var(--ink-700);
  transition: left 0.2s ease;
}
.sidebar-collapsed .sidebar-toggle {
  left: 12px;
}

/* Brand-Color via CSS-Variable (per-Mandant). brand-mark + frame-rule + dots
   ziehen ihre Farbe aus --brand-color wenn gesetzt. Default = green-700. */
.brand-mark { color: var(--brand-color); }
body[data-mandant-active] .frame-rule {
  background: linear-gradient(90deg, var(--brand-color) 0%, var(--green-500) 60%, var(--accent) 100%);
}

/* Kontextmenue (Rechtsklick auf Demo-Mandant) */
.mandant-context-menu {
  position: fixed;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--paper-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.mandant-context-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-700);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.mandant-context-item:hover { background: var(--paper-50); }
.mandant-context-item--danger { color: var(--status-warn); }
.mandant-context-item--danger:hover { background: rgba(194, 84, 80, 0.08); }

/* Mobile: Sidebar als Overlay statt Spalte */
@media (max-width: 900px) {
  body.has-sidebar { padding-left: 0; }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  body.has-sidebar:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }
  body.has-sidebar.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }
  .sidebar-toggle {
    display: flex;
    left: 12px;
  }
  body.has-sidebar:not(.sidebar-collapsed) .sidebar-toggle {
    left: calc(var(--sidebar-w) + 12px);
  }
}

/* ===================================================================
   MOBILE-SPRINT 2026-05-09 (Variante B "Sauber")
   Demo-fest auf iPhone 13/SE, Pixel 7, iPad portrait.
   Reihenfolge: Safe-Area → Header-Stack → Cost/Status hide → Quick-Reply
   Wrap → Bubble-Padding → Touch-Targets → Form-Inputs → Lang-Picker.
   =================================================================== */

/* iOS Safe-Area: viewport-fit=cover ist im HTML; hier geben wir Header,
   Footer und Sidebar genug Platz, damit Inhalt nicht unter Notch/
   Home-Indicator rutscht. Auf Desktop hat env(...) Default 0 — kein Effekt. */
header {
  padding-top: max(var(--space-5), env(safe-area-inset-top));
  padding-left: max(clamp(20px, 5vw, 56px), env(safe-area-inset-left));
  padding-right: max(clamp(20px, 5vw, 56px), env(safe-area-inset-right));
}
footer {
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  padding-left: max(clamp(20px, 5vw, 56px), env(safe-area-inset-left));
  padding-right: max(clamp(20px, 5vw, 56px), env(safe-area-inset-right));
}
.sidebar {
  padding-top: max(var(--space-5), env(safe-area-inset-top));
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
}
.sidebar-toggle {
  /* Toggle-Button auch unter Notch nicht verstecken */
  top: max(16px, env(safe-area-inset-top));
}
#chat-form {
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
}

/* Sidebar-Toggle: Touch-Target sauber 44x44 auf Mobile. */
@media (max-width: 900px) {
  .sidebar-toggle {
    width: 44px;
    height: 44px;
  }
}

/* === Phone-Range (≤ 768px) ============================================
   Hier passiert das meiste: Header stacked, Cost-Widget weg (debug-only),
   Status-Rows kompakt, Buttons-only-Icons, Quick-Replies wrap groß. */

@media (max-width: 768px) {
  /* Header: Brand oben, Buttons-Reihe darunter, Status-Stack rechts in der Reihe */
  header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    padding: max(var(--space-3), env(safe-area-inset-top)) var(--space-4) var(--space-3);
    /* Platz fuer den Hamburger oben links */
    padding-left: max(64px, calc(env(safe-area-inset-left) + 64px));
  }
  .brand { gap: var(--space-3); }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text h1 { font-size: 20px; }
  .brand-sub { font-size: 10px; letter-spacing: 0.10em; }

  .meta {
    width: 100%;
    justify-content: flex-end;
    gap: var(--space-2);
    flex-wrap: wrap;
  }
  /* Status-Stack: Modus + Session in eine Reihe ziehen, Session-ID weg
     (war eh nur Debug-Info, Session-ID hilft auf Mobile niemandem). */
  .meta-stack {
    flex-direction: row;
    gap: var(--space-3);
    align-items: center;
    flex: 1 1 auto;
    flex-wrap: wrap;
  }
  .meta-stack .meta-row:nth-child(2) { display: none; }
  .meta-stack .meta-label { font-size: 9px; }
  .meta-stack .meta-value { font-size: 11px; }

  /* Cost-Widget verstecken auf Mobile (außer ?debug=1). chat.js setzt
     display:flex direkt im style="" — wir overrulen mit !important nur
     wenn der Body keinen debug-Marker hat. Pragmatisch: chat.js setzt
     auf body.classList wenn debug=1, sonst wird's hier ausgeblendet. */
  body:not(.debug-on) #cost-counter {
    display: none !important;
  }

  /* Header-Buttons: Touch-Target 44x44, "Neue Sitzung"-Text raus,
     nur Icon. Lang-Picker / TTS bleiben sowieso Icon-Only. */
  .meta-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 12px;
  }
  .meta-btn-icon {
    min-height: 44px;
    min-width: 44px;
  }

  /* Main + Frame: voller Breitenplatz, weniger Padding */
  main {
    padding: var(--space-3) var(--space-3);
  }
  .frame {
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
  }
  #messages {
    padding: var(--space-5) var(--space-3) var(--space-3);
    gap: var(--space-2);
  }

  /* Bubbles: max-width 95% (war 78%), padding kompakter */
  .msg {
    max-width: 95%;
    padding: 10px 13px;
    font-size: 14.5px;
  }

  /* Welcome-Bubble + Quick-Replies */
  .welcome-bubble { padding: 12px 14px; font-size: 14.5px; }
  .welcome-quick-replies {
    gap: 8px;
    /* Pro Button: min 100% — dadurch volle Breite-Stack auf engen Schirmen */
    flex-direction: column;
  }
  .welcome-qr-btn {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
    justify-content: flex-start;
    border-radius: 14px;
  }

  /* Form-Eingabe: Inputs 16px font-size, sonst zoomt iOS Safari beim Fokus */
  #chat-input { font-size: 16px; padding: 12px 0; }
  .input-wrap { min-height: 48px; }
  .send-btn, .mic-btn { width: 48px; height: 48px; }
  #chat-form { gap: 6px; padding: var(--space-3); }

  /* Sidebar: voller Slide-Over, leicht Akkomodation an iOS-Safe-Area */
  .sidebar {
    width: min(85vw, 320px);
  }
  .mandant-item { min-height: 44px; }
  .sidebar-add-btn { min-height: 44px; padding: 12px 14px; }
  .sidebar-btn-primary, .sidebar-btn-link { min-height: 44px; padding: 10px 16px; }
  .add-mandant-label input {
    font-size: 16px;   /* anti iOS-Zoom */
    padding: 12px 14px;
  }

  /* Footer: dezent, kein iOS-Notch-Konflikt */
  footer {
    padding-top: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 10px;
  }

  /* Lang-Picker: Bottom-Sheet-Variante. Kommt von oben rechts ins
     Viewport-Bottom; volle Breite minus Sicherheitsabstand. */
  .lang-picker-popup {
    position: fixed;
    top: auto;
    right: var(--space-3);
    left: var(--space-3);
    bottom: max(var(--space-3), env(safe-area-inset-bottom));
    min-width: 0;
    max-height: 60vh;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  }
  .lang-picker-item {
    padding: 14px 16px;
    font-size: 15px;
    min-height: 44px;
  }

  /* Debug-Panel klein halten (sonst frisst es die Hälfte vom Viewport) */
  #debug-panel summary { padding: 10px var(--space-3); font-size: 10px; }
  #debug-log { padding: 0 var(--space-3) 12px; max-height: 140px; }
}

/* === Schmal-Phone-Range (≤ 480px, iPhone SE & schmäler) ===============
   Sidebar nimmt alles, Header noch etwas kompakter, kein H-Scroll. */

@media (max-width: 480px) {
  body { font-size: 14px; }
  header {
    padding-left: max(56px, calc(env(safe-area-inset-left) + 56px));
    padding-right: var(--space-3);
  }
  .brand-text h1 { font-size: 18px; }
  .brand-sub { font-size: 9px; }
  /* Status-Modus auf SE: nur der Dot, kein Label-Text mehr */
  .meta-stack .meta-label { display: none; }
  .meta-stack .meta-value { font-size: 10.5px; }

  main { padding: var(--space-2); }
  #messages { padding: var(--space-3) var(--space-2) var(--space-2); }
  .msg { max-width: 96%; padding: 10px 12px; }

  .welcome-quick-replies { gap: 6px; }
  .welcome-qr-btn { padding: 12px 14px; font-size: 13.5px; }

  .sidebar { width: 92vw; }
}


/* ========================================================================
   Eskalations-Form (Sprint 2026-05-12)
   Inline-Form bei escalate_to_human-Tool: Email/Telefon erfassen, DSGVO-
   Hinweis, Absenden/Abbrechen. Look orientiert sich an .welcome-qr-btn
   und .follow-up-pill — Brand-Color-aware via currentColor & Mandant-CSS.
   ======================================================================== */
.escalation-form-wrap {
  margin: 8px 0 16px 0;
  width: 100%;
  /* Hotfix 2026-05-17: gleiche max-width wie .msg-Bubble (Z406: 78%) +
   * align-self damit linksbuendig wie .msg.assistant. Davor 480px war
   * Mismatch zur Bubble-Breite. */
  max-width: 78%;
  align-self: flex-start;
  box-sizing: border-box;
  /* Sprint 14 Polish 2026-05-17 (Bug 2): Sanftes Fade-In statt hartem
   * Layout-Snap beim Insert. Translate-Y bleibt im Compositor (kein
   * Reflow), opacity dazu fuer den weichen Auftritt. 220ms reicht damit
   * der Wechsel von "Pill verschwand" → "Form erschien" als Bewegung
   * lesbar wird und nicht als Flicker. */
  animation: escalation-form-fade-in 220ms ease-out both;
}
@keyframes escalation-form-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .escalation-form-wrap { animation: none; }
}
.escalation-form {
  background: #ffffff;
  border: 1px solid var(--green-700, #335731);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #1f2417;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.escalation-form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.escalation-form-label { font-weight: 600; color: var(--green-700, #335731); }
.escalation-form-required { color: #c0382b; }
.escalation-form-optional { color: #6b7060; font-weight: 400; font-size: 12px; }
.escalation-form-input {
  border: 1px solid #cfd5cb;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #ffffff;
  color: #1f2417;
  transition: border-color 0.15s;
}
.escalation-form-input:focus { outline: none; }
.escalation-form-input:focus-visible {
  outline: none;
  border-color: var(--green-700, #335731);
  box-shadow: 0 0 0 2px rgba(51, 87, 49, 0.45);
}
.escalation-form-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.45;
}
.escalation-form-privacy {
  font-size: 11.5px;
  line-height: 1.55;
  color: #6b7060;
  background: #f5f7f2;
  border-radius: 8px;
  padding: 8px 10px;
}
.escalation-form-privacy a { color: var(--green-700, #335731); }
.escalation-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.escalation-form-btn {
  border-radius: 18px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.escalation-form-btn--primary {
  background: var(--green-700, #335731);
  color: #fff;
  border-color: var(--green-700, #335731);
}
.escalation-form-btn--primary:hover {
  background: var(--brand-deep, #28461f);
  border-color: var(--brand-deep, #28461f);
}
.escalation-form-btn--primary:disabled { background: #8b9b88; border-color: #8b9b88; cursor: not-allowed; }
.escalation-form-btn--ghost {
  background: transparent;
  color: var(--green-700, #335731);
  border-color: #cfd5cb;
}
.escalation-form-btn--ghost:hover { background: #f1f3f0; }
.escalation-form-btn--ghost:disabled { color: #8b9b88; cursor: not-allowed; }
.escalation-form-error {
  font-size: 12.5px;
  color: #c0382b;
  background: #fdecea;
  border-radius: 8px;
  padding: 8px 10px;
}
.escalation-confirmation {
  background: var(--brand-soft, #eaf3e6);
  color: var(--green-700, #335731);
  border-left: 3px solid var(--green-700, #335731);
}

/* ============================================================
   Hotline-Card (Sprint Telefon-Followup 2026-05-17)
   Wird im escalation-form-wrap PROMINENT oben gerendert, wenn
   der Mandant eine Hotline-Nummer hinterlegt hat. tel:-Link auf
   Phone-Number + "Jetzt anrufen"-Button. Brand-Color-aware via
   --green-700/--brand-deep wie bei den Eskalations-Form-Buttons.
   ============================================================ */
.hotline-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--green-700, #335731);
  border-radius: 12px;
  background: var(--brand-soft, #eaf3e6);
  margin-bottom: 12px;
  align-items: center;
  box-sizing: border-box;
  width: 96%;
  max-width: 96%;
}
.hotline-card-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.hotline-card-body {
  flex: 1;
  min-width: 0;
}
.hotline-phone {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--green-700, #335731);
  text-decoration: none;
  line-height: 1.2;
  word-break: break-word;
}
.hotline-phone:hover { text-decoration: underline; }
.hotline-hours {
  font-size: 12px;
  color: #6b7060;
  margin-top: 2px;
}
.hotline-call-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: var(--green-700, #335731);
  color: #fff;
  border-radius: 18px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--green-700, #335731);
  transition: background 0.15s, border-color 0.15s;
}
.hotline-call-btn:hover {
  background: var(--brand-deep, #28461f);
  border-color: var(--brand-deep, #28461f);
  color: #fff;
}
.hotline-separator {
  text-align: center;
  margin: 12px 0;
  position: relative;
  font-size: 12px;
  color: #6b7060;
  width: 96%;
  max-width: 96%;
}
.hotline-separator::before,
.hotline-separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}
.hotline-separator::before { left: 0; }
.hotline-separator::after { right: 0; }
.hotline-separator span {
  background: #fff;
  padding: 0 10px;
  position: relative;
  display: inline-block;
}

/* Mandant-Overrides fuer Eskalations-Form (Sprint brand-color-refactor
 * 2026-05-15): entfernt. Form-Styling unten greift jetzt direkt auf
 * --green-500 / --green-700, daher folgt das Form-Branding automatisch
 * der Mandant-Brand-Farbe aus DB.brand_color. */

@media (max-width: 480px) {
  .escalation-form { padding: 12px 14px; }
  .escalation-form-actions { gap: 6px; }
  .escalation-form-btn { padding: 9px 14px; font-size: 13px; }
}

/* ============ Daumen-Feedback-Widget (Sprint daumen-feedback, 2026-05-14) ============
 * Erscheint nach Bot-Antwort-Streaming-Ende rechts unten in der Bot-Bubble.
 * Wird per feedback_widget.js dynamisch eingehangen wenn
 * features.feedback_enabled == true. Toggle-Semantik: zweiter Klick auf
 * den gleichen Daumen setzt zurueck auf neutral. */
/* Daumen-Feedback-Widget — linksbuendig unter Bot-Bubble, dezent, Mandant-Brand-Farbe.
   Sprint daumen-svg (2026-05-14): SVG-Icons statt Emoji.
   Sprint daumen-phosphor (2026-05-14): Wechsel auf Phosphor Bold (20x20, stroke-width
   20 inline im Markup) — kraeftiger als Lucide (stroke-width 1.8).
   currentColor erbt aus .msg-fb-btn (color: var(--accent)) -> Icon ist Brand-Color.
   Default: Outline (fill:none/stroke:currentColor). Active (aria-pressed=true):
   Filled (fill:currentColor) -> voller Daumen in Brand-Color. */
.msg.assistant > .msg-feedback {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  /* kein justify-content (default flex-start = linksbuendig) */
  /* keine Trennlinie */
}
.msg-fb-btn {
  background: transparent;
  border: none;
  color: var(--accent, #5e9457);
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms ease, transform 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0; /* SVG addiert sonst Extra-Hoehe */
  font-family: inherit;
}
.msg-fb-btn:hover {
  opacity: 1;
}
.msg-fb-btn:active {
  transform: scale(0.92);
}
.msg-fb-btn svg {
  fill: none;
  stroke: currentColor;
  pointer-events: none;
  display: block;
}
.msg-fb-btn[aria-pressed="true"] {
  opacity: 1;
}
.msg-fb-btn[aria-pressed="true"] svg {
  fill: currentColor; /* Outline + Fill in selber Brand-Color = solider Daumen */
}
.msg-fb-btn:focus-visible {
  outline: 2px solid var(--accent, #5e9457);
  outline-offset: 2px;
  border-radius: 4px;
}
.msg-fb-btn:disabled { cursor: not-allowed; opacity: 0.4; }

/* ============================================================
   Custom-Form-Widget (Sprint custom-bot-forms 2026-05-14, Phase 1).
   Inline-Form unter Bot-Bubble. Brand-Color fuer Submit-Button +
   Focus-Outline. Keine Box-Shadows / Roundness ueber das Bot-Bubble-
   Niveau hinaus — wirkt wie nahtloser Bot-Output.
   ============================================================ */
/* Sprint 18 Polish (2026-05-19): Wenn eine Bot-Bubble ein Custom-Form
   enthaelt, eigene Bubble-Deko entfernen — sonst doppelte Rahmung
   (sandfarbene Bubble + grüner Form-Border). Form rendert dann wie eine
   eigenstaendige Box analog escalation-form-wrap. */
.msg.assistant:has(> .custom-form-widget) {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 100%;
}
.custom-form-widget {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--accent, #5e9457);
  border-radius: 8px;
  background: rgba(94, 148, 87, 0.05);
}
.cf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cf-icon { font-size: 18px; line-height: 1; }
.cf-title { font-size: 15px; color: var(--ink, #1f2417); }
.cf-description {
  font-size: 13px;
  color: var(--ink-soft, #4a4f3e);
  margin: 0 0 10px 0;
  line-height: 1.45;
}
.cf-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cf-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cf-label {
  font-size: 13px;
  color: var(--ink, #1f2417);
  font-weight: 500;
}
.cf-input {
  padding: 8px 10px;
  border: 1px solid rgba(31, 36, 23, 0.18);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--ink, #1f2417);
  box-sizing: border-box;
  width: 100%;
}
.cf-input:focus {
  outline: 2px solid var(--accent, #5e9457);
  outline-offset: 1px;
  border-color: var(--accent, #5e9457);
}
.cf-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}
.cf-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft, #4a4f3e) 50%),
                    linear-gradient(135deg, var(--ink-soft, #4a4f3e) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.cf-field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.cf-field-checkbox .cf-label {
  order: 2;
  font-weight: 400;
  cursor: pointer;
}
.cf-field-checkbox .cf-input {
  width: auto;
  margin: 0;
}
.cf-privacy {
  font-size: 11px;
  color: var(--ink-faint, #8b8f7f);
  margin: 4px 0 0 0;
  line-height: 1.4;
}
.cf-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.cf-submit-btn {
  padding: 8px 18px;
  background: var(--accent, #5e9457);
  color: #fff;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 120ms ease, transform 80ms ease;
}
.cf-submit-btn:hover { opacity: 0.92; }
.cf-submit-btn:active { transform: scale(0.98); }
.cf-submit-btn:disabled { opacity: 0.55; cursor: wait; }
.cf-status {
  font-size: 12px;
  color: #c44;
  min-height: 16px;
  margin-top: 4px;
}
.cf-success {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-deep, var(--accent, #4f7e49));
  font-size: 14px;
}
.cf-success-icon {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.cf-success-text { margin: 0; line-height: 1.45; }

/* Welcome-Pill-Variante: leicht akzentuiert damit Form-Pills vom RAG-FAQ-
   Pool unterscheidbar sind. Brand-Color Border statt voller Fill — wirkt
   als CTA ohne aufdringlich zu sein. */
.welcome-qr-btn--form {
  border-color: var(--accent, #5e9457);
  background: rgba(94, 148, 87, 0.06);
}
.welcome-qr-btn--form:hover {
  background: rgba(94, 148, 87, 0.12);
}

/* ====================================================================
 * VOICE-INTERACTIVE-MODE (Sprint 2026-05-14)
 * State-Klassen werden von voice_mode.js auf <body> gesetzt:
 *   body.voice-mode-active    — Voice-Modus aktiv (auch in listening/etc.)
 *   body.voice-listening      — User haelt Push-to-Talk
 *   body.voice-processing     — STT/LLM-Pipeline laeuft
 *   body.voice-speaking       — Bot-Audio spielt
 *
 * Brand-Color kommt aus --accent. prefers-reduced-motion respektiert.
 * ==================================================================== */

/* Exit-Button neben Mikro (X-Symbol)
 *
 * Sprint 2 Hotfix-3 2026-05-15 (Fix 4): Groesse von 32x32 auf 44x44 hoch,
 * sodass der X-Button optisch mit Mikro, Voice-Mode-Btn und Send-Btn
 * fluchtet (alle 44x44 mit border-radius var(--r-md)). Vorher wirkte der
 * Exit-Btn deutlich kleiner und unsauber. SVG-Icon analog von 14px auf
 * 18px hoch (gleicher visueller Schwer-Eindruck wie der 16er Mikro/Send-
 * Pfad, mit dem 18er X bisschen luftiger weil X-Geometrie weniger Pixel
 * pro Achse braucht). */
/* Sprint 6 Voice-UI V2 2026-05-16: Voice-Exit-Btn lebt im Header (rechts
 * neben Sprach-Globus). Sichtbarkeit per body.voice-mode-active. Als
 * meta-btn-icon stylet er sich automatisch wie Easy-Lang + Sprach-Globus. */
.voice-exit-btn.header-voice-exit {
  display: none;
}
body.voice-mode-active .voice-exit-btn.header-voice-exit {
  display: inline-flex;
}
.voice-exit-btn.header-voice-exit:hover {
  color: var(--status-warn, #c25450);
}

/* Sprint 6 Voice-UI V2 2026-05-16: Voice-Settings-Btn (Gear-Icon) im Header.
 * Nur sichtbar im Voice-Mode-Active. Trigger-Btn + Dropdown-Panel sind beide
 * auf body.voice-mode-active gegated. */
.voice-settings-btn.header-voice-settings {
  display: none;
  position: relative;
}
body.voice-mode-active .voice-settings-btn.header-voice-settings {
  display: inline-flex;
}
.voice-settings-btn[aria-expanded="true"] {
  background: var(--paper-50);
  color: var(--accent, var(--green-700));
}
/* Settings-Dropdown-Panel — absolute, rechts unter dem Trigger. */
.voice-settings-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 220px;
  background: var(--paper-0, #fff);
  border: 1px solid var(--paper-200);
  border-radius: var(--r-md, 8px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.12));
  padding: 4px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.voice-settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm, 6px);
  text-align: left;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-700);
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}
.voice-settings-item:hover {
  background: var(--paper-50);
}
.voice-settings-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
  color: var(--ink-500);
}
.voice-settings-item-label {
  flex: 1;
  min-width: 0;
}
.voice-settings-item[aria-checked="true"] {
  background: color-mix(in srgb, var(--accent, var(--green-500)) 6%, transparent);
}
.voice-settings-item[aria-checked="true"] .voice-settings-item-icon {
  color: var(--accent, var(--green-700));
}
.voice-settings-item--mode[aria-checked="true"] .voice-settings-item-label {
  color: var(--accent, var(--green-700));
  font-weight: 500;
}

/* Mikro-Button ist seit Sprint voice-button-trennung 2026-05-14 reines
 * Single-Shot-STT. Die `body.voice-*` State-Klassen treffen ausschliesslich
 * den separaten `.voice-mode-btn` (siehe unten). */

/* Speaking: aktive Bot-Bubble (.msg.assistant.is-speaking) kriegt
   pulsierenden Brand-Color-Border */
.msg.assistant.is-speaking {
  border: 2px solid var(--accent, var(--green-500));
  animation: voice-bubble-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, var(--green-500)) 25%, transparent);
}
@keyframes voice-bubble-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, var(--green-500)) 25%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent, var(--green-500)) 0%, transparent);
  }
}

/* DSGVO-Consent-Modal */
.voice-consent-modal {
  position: fixed;
  inset: 0;
  background: rgba(28, 29, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: voice-modal-in 0.18s ease-out;
}
@keyframes voice-modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.voice-consent-modal__box {
  background: var(--paper-0);
  border-radius: var(--r-lg);
  padding: 24px 22px 20px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--paper-200);
}
.voice-consent-modal__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink-900);
}
.voice-consent-modal__body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-700);
  margin-bottom: 18px;
}
.voice-consent-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.voice-consent-modal__btn {
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--paper-200);
  background: #fff;
  color: var(--ink-700);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.voice-consent-modal__btn--cancel:hover {
  background: var(--paper-50);
  border-color: var(--paper-300);
}
.voice-consent-modal__btn--confirm {
  background: var(--accent, var(--green-700));
  color: #fff;
  border-color: var(--accent, var(--green-700));
}
.voice-consent-modal__btn--confirm:hover {
  filter: brightness(0.95);
}

/* Voice-Toast (Browser-Unsupported / Mic-Permission-Denied) */
.voice-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: var(--paper-0);
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  z-index: 9998;
  animation: voice-toast-in 0.2s ease-out;
}
.voice-toast--out {
  animation: voice-toast-out 0.4s ease-in forwards;
}
@keyframes voice-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes voice-toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Reduced-Motion: alle Voice-Animationen abklemmen */
@media (prefers-reduced-motion: reduce) {
  body.voice-listening .voice-mode-btn,
  body.voice-processing .voice-mode-btn,
  .voice-mode-btn.recording,
  .msg.assistant.is-speaking,
  .voice-toast,
  .voice-toast--out,
  .voice-consent-modal {
    animation: none !important;
  }
  body.voice-listening .voice-mode-btn,
  .voice-mode-btn.recording {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--green-500)) 25%, transparent);
    background: color-mix(in srgb, var(--accent, var(--green-500)) 15%, transparent);
  }
  .msg.assistant.is-speaking {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, var(--green-500)) 20%, transparent);
  }
}

/* ====================================================================
 * Voice-Mode-Button (Sprint voice-button-trennung 2026-05-14)
 *
 * Separater zweiter Button neben dem klassischen Mikrofon-Button. Eigene
 * visuelle Sprache: Brand-Color statt rot (Mikro=einmaliges Aufnehmen,
 * Voice-Mode=aktiver Sprach-Dialog).
 * ==================================================================== */
.voice-mode-btn {
  width: 44px; height: 44px;
  border: 1px solid var(--paper-200);
  background: #fff;
  color: var(--ink-700);
  border-radius: var(--r-md);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
  margin-left: 4px;
}
.voice-mode-btn:hover {
  border-color: var(--accent, var(--green-500));
  color: var(--accent, var(--green-700));
  background: color-mix(in srgb, var(--accent, var(--green-500)) 6%, transparent);
}
.voice-mode-btn:active { transform: scale(0.96); }

/* Active/Listening: pulsierender Brand-Glow (NICHT rot wie Mikro) */
.voice-mode-btn.recording,
body.voice-listening .voice-mode-btn {
  background: var(--accent, var(--green-500));
  color: #fff;
  border-color: var(--accent, var(--green-500));
  animation: voice-pulse 1.4s ease-in-out infinite;
}
.voice-mode-btn.recording:hover,
body.voice-listening .voice-mode-btn:hover {
  background: var(--accent, var(--green-500));
  color: #fff;
  border-color: var(--accent, var(--green-500));
}
@keyframes voice-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, var(--accent, var(--green-500)) 55%, transparent),
      0 0 0 0 color-mix(in srgb, var(--accent, var(--green-500)) 35%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--accent, var(--green-500)) 18%, transparent),
      0 0 0 12px color-mix(in srgb, var(--accent, var(--green-500)) 0%, transparent);
  }
}

/* Voice-Mode-aktiv (idle nach activate, vor Listening): leichter Tint */
body.voice-mode-active .voice-mode-btn:not(.recording) {
  border-color: var(--accent, var(--green-500));
  color: var(--accent, var(--green-700));
  background: color-mix(in srgb, var(--accent, var(--green-500)) 8%, transparent);
}

/* Processing: subtilerer Spinner-Hint */
body.voice-processing .voice-mode-btn {
  border-color: var(--accent, var(--green-500));
  color: var(--accent, var(--green-700));
  animation: voice-mode-processing 1.6s linear infinite;
}
@keyframes voice-mode-processing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--green-500)) 12%, transparent); }
}

/* ====================================================================
 * Listening-Banner unter dem Input-Bereich.
 *
 * Sprint 2 Hotfix-2 (2026-05-15) — Mini-Bar-Layout:
 *   Voriges Layout war ein ~120-160px hoher zentrierter Block mit grossem
 *   Orb darueber und Text darunter — hat ~40% des Chatscreens belegt.
 *   Jetzt: schmale Mini-Bar (~48px Hoehe) direkt ueber dem Input. Orb
 *   klein links, Status-Text + Live-Transcript inline rechts.
 *   ChatGPT-Web-Voice-Pattern als Inspiration (Apr 2026).
 * ==================================================================== */
.voice-listening-banner {
  display: none;
  min-height: 56px;
  padding: 8px 16px;
  background: var(--paper-deep, color-mix(in srgb, var(--accent, var(--green-500)) 8%, transparent));
  border-top: 1px solid var(--rule, color-mix(in srgb, var(--ink-700, #333) 12%, transparent));
  border-radius: 0;
  font-size: 13px;
  color: var(--ink-soft, var(--ink-700));
  margin: 0;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 12px;
  transition: opacity 180ms ease;
}

/* Sprint 6 Voice-UI V2 2026-05-16 — Voice-Footer reduziert auf
 * Soundwave + Status-Text zentriert. Alle Action-Buttons sind raus
 * (X in Header, Mode/Mute in Settings-Dropdown). Footer ist deutlich
 * groesser fuer die Soundwave-Visualisierung. */
body.voice-mode-active .voice-mode-footer,
body.voice-listening .voice-mode-footer,
body.voice-processing .voice-mode-footer,
body.voice-speaking .voice-mode-footer {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Sprint 6 Hotfix 2026-05-16: kompakter (vorher 120px) */
  min-height: 88px;
  padding: 10px;
  gap: 4px;
  /* Hotfix 2026-05-16: Clean White Card. Weiss + subtile Top-Border + Soft-
   * Shadow nach oben fuer dezente Tiefe. Passt zum hellen Widget-Design.
   * Soundwave-Bars bleiben in Brand-Color (--accent via _readAccent-Fallback),
   * Petrol auf Weiss ist hoch-kontrastreich. */
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

/* Sprint 5 UX-Redesign 2026-05-15 (Item 3) — Voice-Modal-Switch.
 *
 * Im Voice-Mode wird der Text-Footer (#chat-form) komplett versteckt;
 * der Voice-Footer (.voice-mode-footer = .voice-listening-banner) ersetzt
 * ihn. Reduziert sichtbare UI-Elemente von ~13 auf ~6 und entspricht dem
 * Industry-Standard 2026 (ChatGPT/Claude/ElevenLabs/OpenAI Realtime).
 * Smooth Transition 200ms — Voice-Mode-Btn als „Tor" bleibt im Text-Footer
 * sichtbar, beim Klick triggert chat.js body.classList.add("voice-mode-active").
 */
body.voice-mode-active #chat-form {
  display: none;
}
#chat-form {
  transition: opacity 200ms ease;
}
.voice-mode-footer {
  /* Visibility kommt aus den body.voice-*-Selektoren weiter unten. */
}
/* Sprint 6 Voice-UI V2 2026-05-16: Mute-Btn ist nicht mehr im Voice-Footer
 * — Funktion lebt im Settings-Dropdown im Header. Btn-Styles bleiben als
 * No-Op (display:none) falls Cache-Drift einen alten DOM-Knoten liefert. */
.voice-mute-btn {
  display: none !important;
}

/* Sprint 6 Voice-UI V2 2026-05-16: Mode-Toggle ist nicht mehr im Voice-
 * Footer — Funktion lebt im Settings-Dropdown im Header. */
.voice-mode-toggle-btn {
  display: none !important;
}
.voice-listening-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.voice-listening-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Sprint 6 Voice-UI V2 2026-05-16: Im Voice-Footer-Layout (column, centered)
 * darf der Status-Text nicht mehr ueber-flex-1-en. Stattdessen schmaler
 * + zentriert direkt unter der Soundwave. */
body.voice-mode-active .voice-mode-footer .voice-listening-text,
body.voice-listening .voice-mode-footer .voice-listening-text,
body.voice-processing .voice-mode-footer .voice-listening-text,
body.voice-speaking .voice-mode-footer .voice-listening-text {
  flex: 0 1 auto;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft, var(--ink-500));
  opacity: 0.9;
  margin: 0;
  max-width: 90%;
}
/* Banner sichtbar in allen aktiven Voice-States. */
body.voice-mode-active .voice-listening-banner,
body.voice-listening .voice-listening-banner,
body.voice-processing .voice-listening-banner,
body.voice-speaking .voice-listening-banner {
  display: flex;
}
@media (prefers-reduced-motion: reduce) {
  .voice-listening-banner { transition: none; }
}

/* ============================================================
   Sprint sprint-1-ux-polish (2026-05-15) — Message-Action-Bar.

   Pro Bot-Bubble: [Copy] [Vorlesen] [Daumen-up] [Daumen-down].
   .msg-actions liefert Copy + Vorlesen, .msg-feedback (vom
   feedback_widget.js) liefert die Daumen. Beide Container stehen
   in einer Zeile — flex via .msg.assistant flex-basis-Setup.
   Dezent-Default (opacity 0.55), volle Sichtbarkeit on hover.
   ============================================================ */
/* Sprint 5 UX-Redesign 2026-05-15 (Item 1): Content-Wrapper für Bot-Text.
 * Im Voice-Pfad rendert chat.js / embed.js die Bot-Bubble in dieses Div statt
 * direkt in .msg.assistant — damit ueberlebt die .msg-toolbar als Sibling
 * den innerHTML-Rerender. Reine Strukturhilfe, kein Visual. */
.msg-bot-content {
  /* Erbt Font/Color/Padding von .msg.assistant. Kein eigenes Styling. */
}

/* Sprint sprint-1-fix-3 2026-05-15: Toolbar als eigene Zeile rechtsbuendig
 * unter dem Bot-Text. Reihenfolge [Copy][Vorlesen][Daumen-Up][Daumen-Down],
 * alle Brand-Color, gleiche Groesse. Wirkt gepflegter als auf-Texthoehe. */
.msg-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
  /* Sprint 6 Hotfix 2026-05-16: Safety-Padding rechts damit Daumen-SVG
   * (die etwas overflow durch SVG-stroke-Outside-Boxing haben) nicht am
   * rechten Bubble-Rand abgeschnitten werden. */
  padding-right: 4px;
  box-sizing: border-box;
  /* Hotfix 2026-05-17: dezent permanent sichtbar (ChatGPT/Claude-Pattern). */
  opacity: 0.55;
  transition: opacity 180ms ease;
}
/* Hotfix 2026-05-17: Toolbar permanent sichtbar dezent (ChatGPT/Claude-Pattern).
 * Vorher on-hover, aber das reservierte Platz fuer leere Zeile bei nicht-hover.
 * Marktstandard 2026: permanent mit opacity 0.55, on-hover 1.0. Kein leerer
 * Space mehr. Touch-Devices sehen den gleichen Stil. */
@media (hover: hover) {
  .msg.assistant:hover .msg-toolbar,
  .msg-toolbar:focus-within {
    opacity: 1;
  }
}
.msg-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.msg-action-btn {
  background: transparent;
  border: none;
  color: var(--accent, #5e9457);
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms ease, transform 120ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-family: inherit;
}
.msg-action-btn:hover {
  opacity: 1;
}
.msg-action-btn:active {
  transform: scale(0.92);
}
.msg-action-btn:focus-visible {
  outline: 2px solid var(--accent, #5e9457);
  outline-offset: 2px;
}
.msg-action-btn--active {
  opacity: 1;
}
.msg-action-btn svg { display: block; pointer-events: none; }

/* Falls Daumen direkt an .msg.assistant haengen (Edge-Case: Toolbar
 * noch nicht aufgebaut), als Sibling normal anzeigen. Wenn sie im
 * .msg-toolbar liegen, greift dort flex-end. */
.msg.assistant > .msg-feedback {
  display: inline-flex;
  vertical-align: middle;
}
.msg-toolbar > .msg-feedback {
  margin-top: 0;
}

/* ============================================================
   Stop-Generation-Button (sprint-1-ux-polish Task 6).

   Rundes Quadrat-Icon im Input-Bereich (links vom Send-Btn).
   Nur sichtbar waehrend Bot-Stream — User-Affordance fuer
   manuellen Abbruch des aktuellen Token-Streams.
   ============================================================ */
.stop-stream-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper-0, #fff);
  border: 1px solid var(--accent, #5e9457);
  color: var(--accent, #5e9457);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 4px;
  transition: background 0.12s ease;
  font-family: inherit;
}
.stop-stream-btn:hover {
  background: rgba(94, 148, 87, 0.1);
}
.stop-stream-btn:focus-visible {
  outline: 2px solid var(--accent, #5e9457);
  outline-offset: 2px;
}
.stop-stream-btn[hidden] { display: none; }

/* ============================================================
   Easy-Language-Status-Badge (sprint-1-ux-polish Task 8).

   Pill neben dem Header-Toggle. Sichtbar wenn Einfache Sprache
   aktiv ist (EAA-Compliance Juni 2026 — Status muss klar
   erkennbar sein).
   ============================================================ */
.easy-lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(94, 148, 87, 0.12);
  color: var(--accent, #5e9457);
  border: 1px solid var(--accent, #5e9457);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-right: 6px;
  line-height: 1.2;
  white-space: nowrap;
}
.easy-lang-badge::before {
  content: "\2713"; /* Checkmark */
  font-weight: 700;
  display: inline-block;
}
.easy-lang-badge[hidden] { display: none; }

/* =================================================================
   Step-Indicators (Sprint 2 Differenzierung 2026-05-15)
   ----------------------------------------------------------------
   Pill-Reihe oberhalb der Bot-Antwort-Bubble. Zeigt visuell welche
   Tool-Schritte der Bot gerade durchlaeuft (Durchsuche Wissensbasis,
   Generiere Folge-Fragen, ...). Ersetzt die alte einzelne Status-
   Bubble durch eine kumulative Pill-Strip.
   ================================================================= */
.step-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
  align-self: flex-start;
  max-width: 84%;
  transition: opacity 0.4s ease;
}
.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: color-mix(in srgb, var(--green-500) 8%, transparent);
  color: var(--ink-500);
  border: 1px solid color-mix(in srgb, var(--green-500) 20%, transparent);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  transition: all 0.2s ease;
}
.step-pill-icon {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 1;
}
.step-pill-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 24ch;
}
.step-pill--active {
  color: var(--green-700);
  background: color-mix(in srgb, var(--green-500) 12%, white);
  border-color: color-mix(in srgb, var(--green-500) 50%, transparent);
  animation: step-pulse 1.4s ease-in-out infinite;
}
.step-pill--done {
  color: color-mix(in srgb, var(--green-700) 60%, var(--ink-500));
  opacity: 0.7;
  animation: none;
}
.step-pill--done .step-pill-icon::before {
  content: "\2713\00a0"; /* Checkmark + nbsp */
  font-weight: 700;
  color: var(--green-500);
}
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--green-500) 15%, transparent); }
}
.step-indicators.is-fading {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .step-pill--active { animation: none; }
  .step-indicators { transition: none; }
}

/* =================================================================
   Citation-Cards (Sprint 2 Differenzierung 2026-05-15, Perplexity-Style)
   ----------------------------------------------------------------
   Horizontal-scrollbare Card-Liste unter Bot-Antworten mit RAG-
   Treffern. Jede Card: Favicon + Title + Domain + Snippet, klickbar
   öffnet in neuem Tab.
   ================================================================= */
.citation-cards {
  /* Sprint 2 Hotfix 2026-05-15 (Fix 4): Overflow-Fix.
   * - position: relative damit ::after-Gradient relativ am Container haengt
   * - max-width: 100% damit Cards niemals ueber Bubble-Boundary rausragen
   * - padding-right + mask-image fade als visueller Indicator dass rechts mehr ist
   * - scroll-snap fuer angenehmes Mobile-Swipe-Verhalten
   */
  position: relative;
  max-width: 100%;
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 0 16px 4px 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-200) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  /* Soft-Fade am rechten Rand — signalisiert "scroll for more". */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent 100%);
}
.citation-cards::-webkit-scrollbar { height: 4px; }
.citation-cards::-webkit-scrollbar-track { background: transparent; }
.citation-cards::-webkit-scrollbar-thumb {
  background: var(--paper-200);
  border-radius: 2px;
}
/* Wenn nur 1-2 Cards drin sind (alle sichtbar): kein Fade noetig. Wird
 * pragmatisch via scroll-Indicator-CSS-Variable umgangen — Default ist Fade,
 * akzeptabel auch wenn keine Cards überstehen. */
.citation-card {
  flex: 0 0 200px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--paper-200);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 16px 1fr;
  grid-template-rows: auto auto auto;
  gap: 4px 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  font-size: 12px;
  scroll-snap-align: start;
}
.citation-card:hover,
.citation-card:focus-visible {
  border-color: var(--green-500);
  box-shadow: 0 2px 6px rgba(28, 29, 24, 0.07);
  transform: translateY(-1px);
  outline: none;
}
.citation-card-favicon {
  grid-row: 1;
  grid-column: 1;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  align-self: center;
}
.citation-card-title {
  grid-row: 1;
  grid-column: 2;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  color: var(--green-700);
  font-size: 12.5px;
}
.citation-card-domain {
  grid-row: 2;
  grid-column: 1 / -1;
  color: var(--ink-500);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}
.citation-card-snippet {
  grid-row: 3;
  grid-column: 1 / -1;
  color: var(--ink-500);
  font-size: 11.5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .citation-card { transition: none; }
  .citation-card:hover { transform: none; }
}

/* =================================================================
   Welcome-Heroes (Sprint 2 Differenzierung 2026-05-15)
   ----------------------------------------------------------------
   Vollbild-Mode: 1-2 Hero-Q&A-Cards OBERHALB der QR-Pills.
   Click triggert sendMessage(question). Im Widget-Mode nicht
   gerendert (chat.js only).
   ================================================================= */
.welcome-heroes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 16px;
}
.welcome-hero-card {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--paper-200);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.welcome-hero-card:hover,
.welcome-hero-card:focus-visible {
  border-color: var(--green-500);
  box-shadow: 0 4px 14px rgba(28, 29, 24, 0.07);
  transform: translateY(-1px);
  outline: none;
}
.welcome-hero-q {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-900);
  line-height: 1.35;
  margin-bottom: 4px;
}
.welcome-hero-a {
  font-size: 12.5px;
  color: var(--ink-500);
  line-height: 1.45;
  margin-bottom: 6px;
}
.welcome-hero-cta {
  font-size: 11.5px;
  color: var(--green-700);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-top: auto;
}
@media (max-width: 640px) {
  .welcome-heroes { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-hero-card { transition: none; }
  .welcome-hero-card:hover { transform: none; }
}

/* =================================================================
   Voice-Soundwave (Sprint 6 Voice-UI V2 2026-05-16)
   ----------------------------------------------------------------
   Canvas-basierte audio-reaktive Soundwave (7 vertikale Bars in Brand-
   Color). Ersetzt den Voice-Orb (Sprint 2). Layout: querformat, mittig
   im Voice-Footer. ChatGPT-iOS-Voice-Style.

   4 States via JS-Logik (voice_mode.js):
     voice_mode_active : sanftes Atmen (~30% Hoehe, langsame Sinus-Wave)
     listening         : audio-reaktiv (Mic-AnalyserNode)
     processing        : wandernde Welle (Phase-Animation, kein Audio)
     speaking          : audio-reaktiv (TTS-AnalyserNode)
   ================================================================= */
.voice-soundwave {
  display: block;
  margin: 0 auto;
  flex-shrink: 0;
}
/* Welcome-Pulse beim Uebergang processing/speaking → voice_mode_active. */
.voice-soundwave--welcome-pulse {
  animation: voice-soundwave-welcome-pulse 320ms ease-out;
}
@keyframes voice-soundwave-welcome-pulse {
  0%   { transform: scale(1);    filter: brightness(1); }
  50%  { transform: scale(1.05); filter: brightness(1.15); }
  100% { transform: scale(1);    filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-soundwave--welcome-pulse { animation: none; }
}
/* Mikro-Emoji-Icon im Banner ausblenden — die Soundwave ersetzt es. */
body.voice-mode-active .voice-listening-banner .voice-listening-icon,
body.voice-listening .voice-listening-banner .voice-listening-icon,
body.voice-processing .voice-listening-banner .voice-listening-icon,
body.voice-speaking .voice-listening-banner .voice-listening-icon {
  display: none;
}

/* Sprint 5 Hotfix 2026-05-15 (Bug 1): VAD-Loading-Indicator.
 * Beim ersten Voice-Activate laedt die VAD-Library asynchron (~3-5s). In
 * dieser Zeit zeigt der Banner "Lade Spracherkennung…" plus animierte
 * Punkte. Sobald VAD ready ist, re-feuert voice_mode.js onState und der
 * Banner wechselt auf "Du kannst sprechen". CSS-only-Spinner mit ::after-
 * Punkten — kein extra Markup-Knoten noetig.
 */
.voice-listening-text.voice-loading {
  position: relative;
}
.voice-listening-text.voice-loading::after {
  content: "";
  display: inline-block;
  width: 1em;
  text-align: left;
  margin-left: 1px;
  animation: voice-loading-dots 1.4s steps(4, end) infinite;
}
@keyframes voice-loading-dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: ""; }
}
@media (prefers-reduced-motion: reduce) {
  .voice-listening-text.voice-loading::after {
    animation: none;
    content: "...";
  }
}

/* Sprint 4 Voice-Polish 2026-05-15 (Bug 2): "Sprechen-erlaubt"-Indikator.
 * Kurzer Scale-Pulse am Orb (300ms) + dezenter Banner-Hint-Pulse (1.2s).
 * Wird beim Uebergang processing/speaking -> voice_mode_active im
 * Hands-Free-Modus angetriggert (siehe voice_mode.js _setState).
 */
.voice-orb--welcome-pulse {
  animation: voice-orb-welcome-pulse 320ms ease-out;
}
@keyframes voice-orb-welcome-pulse {
  0%   { transform: scale(1);    filter: brightness(1); }
  50%  { transform: scale(1.15); filter: brightness(1.15); }
  100% { transform: scale(1);    filter: brightness(1); }
}
.voice-hint-pulse {
  animation: voice-hint-pulse-fade 1200ms ease-out;
  font-weight: 600;
  color: var(--accent, #5e9457);
  opacity: 1 !important;
}
@keyframes voice-hint-pulse-fade {
  0%   { opacity: 0.4; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .voice-orb--welcome-pulse { animation: none; }
  .voice-hint-pulse { animation: none; }
}

/* Sprint 6 Voice-UI V2 2026-05-16: Live-Transcript-Bubble.
 * User-Bubble die sofort beim VAD-Speech-Start (oder beim ersten
 * transcript_partial) entsteht und mit jedem Partial mitwaechst. Visuell
 * dezent abgesetzt von einer "festen" User-Bubble: opacity, dashed border,
 * leichtes Pulsieren. Bei transcript_final wird die Klasse entfernt und
 * die Bubble wird zur normalen User-Bubble.
 */
.msg.user.msg-live-transcript {
  opacity: 0.78;
  border: 1px dashed color-mix(in srgb, var(--accent, var(--green-500)) 50%, transparent);
  animation: live-transcript-pulse 1.6s ease-in-out infinite;
}
@keyframes live-transcript-pulse {
  0%, 100% { opacity: 0.78; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .msg.user.msg-live-transcript {
    animation: none;
    opacity: 0.85;
  }
}

/* Hotfix 2026-05-17 (Rate-Limit-Hardening): Auto-Session-Reset-Info-Bubble.
 * Wird zwischen alte und neue Konversation gerendert wenn Backend Auto-Reset
 * macht. Dezent, kein Bubble-Style, kein Avatar. */
.session-reset-info {
  align-self: center;
  font-size: 12px;
  color: var(--ink-faint, #888);
  background: transparent;
  padding: 4px 12px;
  margin: 12px 0;
  text-align: center;
  font-style: italic;
}

/* Sprint custom-form-validation (2026-05-19): Field-States fuer Live-Validation. */
.cf-field-hint {
  font-size: 12px;
  color: var(--ink-500, #6f7367);
  margin-top: 4px;
  line-height: 1.4;
}
.cf-field-error {
  font-size: 12px;
  color: #c0382b;
  margin-top: 4px;
  line-height: 1.4;
}
.cf-field-valid input,
.cf-field-valid textarea,
.cf-field-valid select {
  border-color: #5e9457;
}
.cf-field-invalid input,
.cf-field-invalid textarea,
.cf-field-invalid select {
  border-color: #c0382b;
}
.cf-field-invalid input:focus,
.cf-field-invalid textarea:focus,
.cf-field-invalid select:focus {
  outline-color: #c0382b;
}

/* Sprint Pilot-Demo 2026-05-20: Embedded-Mode fuer iframe-Einbettung.
   Versteckt Akquise-Sidebar + Demo-Disclaimer + Header — der Bot wirkt
   wie ein eigenstaendiges Widget innerhalb der Landingpage.
   Voice-Floating-Button + Mini-Voice-Bar werden ebenfalls ausgeblendet:
   Voice-Demo wird stattdessen ausserhalb des iframes auf der Landingpage
   selbst angeboten (mehr Platz, sauberere UX). */
body.embedded-mode header,
body.embedded-mode .sidebar,
body.embedded-mode #sidebar-toggle,
body.embedded-mode .demo-disclaimer,
body.embedded-mode .voice-mode-btn,
body.embedded-mode #voice-mode-btn,
body.embedded-mode .voice-listening-banner,
body.embedded-mode .voice-mode-footer,
body.embedded-mode .mini-voice-bar,
body.embedded-mode .voice-settings-btn,
body.embedded-mode .voice-exit-btn {
  display: none !important;
}
body.embedded-mode .layout-content {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}
body.embedded-mode {
  background: #fff;
}
