.offstage-chat-root { position: fixed; right: 22px; bottom: 22px; z-index: 99999; font-family: inherit; }
.offstage-chat-toggle { width: 62px; height: 62px; border-radius: 50%; border: 0; background: #050505; box-shadow: 0 12px 30px rgba(0,0,0,.22); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .25s ease, box-shadow .25s ease, background .25s ease; }
.offstage-chat-toggle:hover { transform: translateY(-2px); background: #171717; box-shadow: 0 14px 34px rgba(0,0,0,.28); }
.offstage-chat-toggle-icon { position: relative; width: 28px; height: 22px; border: 2px solid #fff; border-radius: 10px; display: block; }
.offstage-chat-toggle-icon:after { content: ''; position: absolute; left: 6px; bottom: -7px; width: 9px; height: 9px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-18deg); background: #050505; transition: background .25s ease; }
.offstage-chat-toggle:hover .offstage-chat-toggle-icon:after { background: #171717; }
.offstage-chat-panel { position: absolute; right: 0; bottom: 76px; width: min(390px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 116px)); background: #fff; border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.24); overflow: hidden; opacity: 0; pointer-events: none; transform: translateY(14px) scale(.98); transition: opacity .25s ease, transform .25s ease; display: flex; flex-direction: column; }
.offstage-chat-root.is-open .offstage-chat-panel { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.offstage-chat-root.is-open .offstage-chat-toggle { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.92); }
.offstage-chat-header { background: #050505; color: #fff; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.offstage-chat-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.offstage-chat-mark { width: 42px; height: 42px; flex: 0 0 42px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; }
.offstage-chat-mark img { display: block; width: 42px; height: 42px; object-fit: contain; }
.offstage-chat-title { display: block; font-size: 15px; line-height: 1.15; letter-spacing: .02em; white-space: nowrap; }
.offstage-chat-subtitle { display: block; color: rgba(255,255,255,.74); font-size: 12px; line-height: 1.35; margin-top: 3px; }
.offstage-chat-close { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); color: #fff; background: transparent; font-size: 24px; line-height: 28px; cursor: pointer; transition: background .25s ease; }
.offstage-chat-close:hover { background: rgba(255,255,255,.14); }
.offstage-chat-messages { padding: 18px; overflow-y: auto; height: 330px; background: #fbf8f7; }
.offstage-chat-msg { display: flex; flex-direction: column; margin-bottom: 12px; }
.offstage-chat-msg-user { align-items: flex-end; }
.offstage-chat-msg-bot { align-items: flex-start; }
.offstage-chat-bubble { max-width: 86%; padding: 11px 13px; border-radius: 16px; font-size: 14px; line-height: 1.48; box-shadow: 0 4px 14px rgba(0,0,0,.05); white-space: pre-line; }
.offstage-chat-msg-bot .offstage-chat-bubble { background: #fff; color: #4c4541; border-bottom-left-radius: 6px; }
.offstage-chat-msg-user .offstage-chat-bubble { background: #050505; color: #fff; border-bottom-right-radius: 6px; }
.offstage-chat-typing .offstage-chat-bubble { color: #85766d; min-width: 54px; padding: 12px 15px; }
.offstage-chat-typing-dots { display: inline-flex; align-items: center; gap: 5px; height: 14px; }
.offstage-chat-typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: #85766d; opacity: .35; animation: offstageChatTypingDot 1.1s infinite ease-in-out; }
.offstage-chat-typing-dots span:nth-child(2) { animation-delay: .16s; }
.offstage-chat-typing-dots span:nth-child(3) { animation-delay: .32s; }
.offstage-chat-root.is-typing .offstage-chat-send { opacity: .72; cursor: wait; transform: none; }
@keyframes offstageChatTypingDot { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }
.offstage-chat-quick { padding: 12px 14px 5px; background: #fff; display: flex; gap: 7px; flex-wrap: wrap; border-top: 1px solid rgba(0,0,0,.06); }
.offstage-chat-chip { border: 1px solid rgba(0,0,0,.11); background: #fff; border-radius: 999px; padding: 7px 10px; font-size: 12px; line-height: 1; color: #4b403c; cursor: pointer; transition: color .28s ease, background .28s ease, border-color .28s ease; }
.offstage-chat-chip:hover { color: #fff; background: #050505; border-color: #050505; }

.offstage-chat-notice {
  padding: 7px 16px 0;
  background: #fff;
  color: #8b807b;
  font-size: 10.5px;
  line-height: 1.35;
  letter-spacing: .01em;
}
.offstage-chat-form { padding: 10px 14px 14px; display: flex; gap: 8px; background: #fff; }
.offstage-chat-input { flex: 1; min-width: 0; height: 42px; border: 1px solid rgba(0,0,0,.12); border-radius: 999px; padding: 0 14px; font-size: 14px; outline: none; transition: border-color .25s ease, box-shadow .25s ease; }
.offstage-chat-input:focus { border-color: #050505; box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.offstage-chat-send { height: 42px; border: 1px solid #050505; border-radius: 999px; padding: 0 16px; background: #050505; color: #fff; font-size: 13px; cursor: pointer; transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease; }
.offstage-chat-send:hover { background: #fff; color: #050505; border-color: #050505; transform: translateY(-1px); }
.offstage-chat-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 9px; max-width: 86%; padding-left: 2px; }
.offstage-chat-action-link { position: relative; display: inline-block; padding: 2px 0 6px; color: #161616; font-size: 11px; font-weight: 700; line-height: 1.25; letter-spacing: .09em; text-transform: uppercase; text-decoration: none; transition: color .2s ease-in; }
.offstage-chat-action-link:after { content: ''; position: absolute; left: 50%; bottom: 0; width: 100%; height: 2px; background: #161616; transform: translateX(-50%); transition: width .2s ease-in, background .2s ease-in; }
.offstage-chat-action-link:hover { color: #161616; text-decoration: none; }
.offstage-chat-action-link:hover:after { width: 60%; background: #161616; }
@media (max-width: 575px) { .offstage-chat-root { right: 16px; bottom: 16px; } .offstage-chat-toggle { width: 56px; height: 56px; } .offstage-chat-panel { bottom: 68px; width: calc(100vw - 32px); max-height: calc(100vh - 96px); } .offstage-chat-messages { height: 300px; } }
.offstage-chat-msg { animation: offstageChatMessageIn .22s ease both; }
.offstage-chat-root.is-typing .offstage-chat-chip { pointer-events: none; opacity: .68; cursor: wait; }
@keyframes offstageChatMessageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* OFFSTAGE v098: Chat-Button neben Scroll-to-top sauber getrennt */
.offstage-chat-root {
  right: 96px !important;
  bottom: 22px !important;
}
.offstage-chat-panel {
  right: -74px !important;
}
@media (max-width: 575px) {
  .offstage-chat-root {
    right: 76px !important;
    bottom: 16px !important;
  }
  .offstage-chat-panel {
    right: -60px !important;
  }
}

/* OFFSTAGE v132: Offline-only Mikrofon-Button im KI-Assistenten */
.offstage-chat-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.offstage-chat-input-wrap .offstage-chat-input {
  width: 100%;
  padding-right: 48px;
}
.offstage-chat-mic {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #050505;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .25s ease, transform .25s ease, opacity .25s ease;
}
.offstage-chat-mic:hover:not(:disabled) {
  background: #1b1b1b;
  transform: translateY(-1px);
}
.offstage-chat-mic:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
}
.offstage-chat-mic-icon {
  position: relative;
  width: 12px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 9px;
  display: block;
  transform: translateY(-4px);
}
.offstage-chat-mic-icon:before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 16px;
  height: 10px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 11px 11px;
  transform: translateX(-50%);
}
.offstage-chat-mic-icon:after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 2px;
  height: 6px;
  background: currentColor;
  transform: translateX(-50%);
}
.offstage-chat-mic.is-listening {
  background: #da3b85;
  animation: offstageChatMicPulse 1.2s ease-in-out infinite;
}
.offstage-chat-root.is-speech-listening .offstage-chat-input {
  border-color: #da3b85;
  box-shadow: 0 0 0 3px rgba(218,59,133,.13);
}
@keyframes offstageChatMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(218,59,133,.35); }
  50% { box-shadow: 0 0 0 6px rgba(218,59,133,0); }
}


/* OFFSTAGE v158: Mikrofon komplett ausblenden, wenn keine lokale Offline-Spracherkennung verfügbar ist */
.offstage-chat-root:not(.has-speech-available) .offstage-chat-mic,
.offstage-chat-mic[hidden] {
  display: none !important;
}

.offstage-chat-root:not(.has-speech-available) .offstage-chat-input-wrap .offstage-chat-input {
  padding-right: 14px;
}

/* Browser-Sprachgespräch im bestehenden Webseiten-Assistenten */
.offstage-chat-voice[hidden],
.offstage-chat-voice-start[hidden],
.offstage-chat-voice-active[hidden],
.offstage-chat-voice-feedback[hidden] {
  display: none !important;
}
.offstage-chat-root.has-realtime-voice .offstage-chat-messages {
  height: 250px;
  min-height: 130px;
  flex: 1 1 250px;
}
.offstage-chat-voice {
  padding: 10px 14px 9px;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.06);
}
.offstage-chat-voice-start {
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid #050505;
  border-radius: 16px;
  background: #050505;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.offstage-chat-voice-start:hover:not(:disabled) {
  background: #171717;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,.14);
}
.offstage-chat-voice-start:disabled {
  background: #4a4a4a;
  box-shadow: none;
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}
.offstage-chat-voice-start:focus-visible,
.offstage-chat-voice-stop:focus-visible {
  outline: 3px solid rgba(218,59,133,.28);
  outline-offset: 2px;
}
.offstage-chat-voice-icon {
  position: relative;
  width: 20px;
  height: 26px;
  flex: 0 0 34px;
}
.offstage-chat-voice-icon:before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  width: 10px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 8px;
}
.offstage-chat-voice-icon:after {
  content: '';
  position: absolute;
  left: 7px;
  top: 13px;
  width: 18px;
  height: 12px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 5px 0 -3px currentColor;
}
.offstage-chat-voice-copy,
.offstage-chat-voice-live-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.offstage-chat-voice-copy strong,
.offstage-chat-voice-live-copy strong {
  font-size: 13px;
  line-height: 1.2;
}
.offstage-chat-voice-copy small {
  margin-top: 2px;
  color: rgba(255,255,255,.7);
  font-size: 10.5px;
  line-height: 1.25;
}
.offstage-chat-voice-active {
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid rgba(218,59,133,.28);
  border-radius: 16px;
  background: #fff7fb;
  display: flex;
  align-items: center;
  gap: 9px;
}
.offstage-chat-voice-live-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #da3b85;
  box-shadow: 0 0 0 4px rgba(218,59,133,.12);
  animation: offstageVoiceLivePulse 1.25s ease-in-out infinite;
}
.offstage-chat-voice-live-copy strong {
  color: #362c31;
}
.offstage-chat-voice-live-copy small {
  margin-top: 2px;
  color: #8b707c;
  font-size: 10.5px;
}
.offstage-chat-voice-stop {
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid rgba(5,5,5,.18);
  border-radius: 999px;
  background: #fff;
  color: #050505;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
}
.offstage-chat-voice-stop:hover {
  border-color: #050505;
}
.offstage-chat-voice-feedback {
  margin: 7px 2px 0;
  color: #655a5f;
  font-size: 10.5px;
  line-height: 1.35;
}
.offstage-chat-voice-feedback.is-error {
  color: #a1213d;
}
.offstage-chat-voice-privacy {
  margin: 7px 2px 0;
  color: #8b807b;
  font-size: 9.5px;
  line-height: 1.32;
}
.offstage-chat-voice-privacy a {
  color: #5f5257;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.offstage-chat-root.is-realtime-voice-active .offstage-chat-quick,
.offstage-chat-root.is-realtime-voice-active .offstage-chat-form,
.offstage-chat-root.is-realtime-voice-starting .offstage-chat-quick,
.offstage-chat-root.is-realtime-voice-starting .offstage-chat-form {
  opacity: .48;
  pointer-events: none;
}
@keyframes offstageVoiceLivePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(218,59,133,.12); }
  50% { box-shadow: 0 0 0 7px rgba(218,59,133,0); }
}
@media (max-width: 575px) {
  .offstage-chat-root.has-realtime-voice .offstage-chat-messages {
    height: 220px;
    min-height: 100px;
  }
  .offstage-chat-voice-stop {
    max-width: 92px;
  }
}
@media (max-height: 620px) {
  .offstage-chat-root.has-realtime-voice .offstage-chat-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .offstage-chat-root.has-realtime-voice .offstage-chat-messages {
    height: 150px;
    min-height: 72px;
    flex-basis: 150px;
  }
  .offstage-chat-root.is-realtime-voice-starting .offstage-chat-quick,
  .offstage-chat-root.is-realtime-voice-active .offstage-chat-quick {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .offstage-chat-voice-start {
    transition: none;
  }
  .offstage-chat-voice-live-dot {
    animation: none;
  }
}
