/* Chat-Platzhalter (Zwei-Klick-Lösung), eigenständig – funktioniert auf Website und im Portal */
.sb4-chat { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 2147483000;
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.45; color: #4C4D52;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.sb4-chat *, .sb4-chat *::before, .sb4-chat *::after { box-sizing: border-box; }
.sb4-chat [hidden] { display: none !important; }
/* im eingeloggten Portal über der Tab-Leiste */
.app-session .sb4-chat { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1025px) { .app-session .sb4-chat { bottom: 16px; } }

.sb4-chat button { font: inherit; cursor: pointer; margin: 0; }
.sb4-chat-launcher { width: 60px; height: 60px; border-radius: 18px; border: 0; padding: 0; background: #4C4D52; color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.22); transition: transform .15s ease, background .15s ease; }
.sb4-chat-launcher:hover { transform: translateY(-2px); background: #3d3e42; }
.sb4-chat-launcher:focus-visible, .sb4-chat button:focus-visible, .sb4-chat a:focus-visible { outline: 3px solid #3AA9D7; outline-offset: 2px; }
.sb4-chat.is-open .sb4-chat-launcher svg { transform: scale(.85); }

/* Begrüßung */
.sb4-chat-teaser { position: relative; max-width: 290px; animation: sb4-chat-in .25s ease-out; }
.sb4-chat-teaser-body { display: flex; gap: 10px; align-items: center; text-align: left; background: #fff; color: #4C4D52; border: 0;
  border-radius: 14px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.16); }
.sb4-chat-teaser-body::after { content: ""; position: absolute; right: 24px; bottom: -7px; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); }
.sb4-chat-teaser img, .sb4-chat-head img { border-radius: 50%; object-fit: cover; background: #CAEBFF; flex: none; }
.sb4-chat-teaser-close { position: absolute; top: -10px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0;
  background: #4C4D52; color: #fff; font-size: 16px; line-height: 24px; z-index: 1; }

/* Fenster */
.sb4-chat-panel { width: min(370px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); overflow: auto; background: #fff;
  border-radius: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: sb4-chat-in .2s ease-out; }
.sb4-chat-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px; background: #1F7FA8; color: #fff; border-radius: 18px 18px 0 0; position: sticky; top: 0; }
.sb4-chat-head div { flex: 1; display: flex; flex-direction: column; }
.sb4-chat-head strong { font-size: 17px; }
.sb4-chat-head span { font-size: 13px; opacity: .9; }
.sb4-chat-x { width: 32px; height: 32px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 20px; line-height: 32px; }
.sb4-chat-body { padding: 16px 18px 18px; background: #F4F8FA; }
.sb4-chat-msg { background: #fff; border-radius: 4px 14px 14px 14px; padding: 10px 14px; margin: 0 0 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 90%; }
.sb4-chat-consent { background: #fff; border: 1px solid #D9E3E8; border-radius: 14px; padding: 14px; }
.sb4-chat-consent p { margin: 0 0 10px; font-size: 14px; }
.sb4-chat-consent a, .sb4-chat-alt a { color: #1F7FA8; }
.sb4-chat-remember { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 0 0 12px; }
.sb4-chat-remember input { width: 18px; height: 18px; margin: 0; accent-color: #1F7FA8; }
.sb4-chat-start { width: 100%; min-height: 46px; border: 0; border-radius: 999px; background: #1F7FA8; color: #fff; font-weight: 700; font-size: 16px; }
.sb4-chat-start:hover { background: #17698c; }
.sb4-chat.is-loading .sb4-chat-start { opacity: .7; cursor: progress; }
.sb4-chat-alt { margin: 12px 0 0; font-size: 13px; text-align: center; }

@keyframes sb4-chat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sb4-chat-teaser, .sb4-chat-panel { animation: none; } .sb4-chat-launcher { transition: none; } }
@media print { .sb4-chat { display: none; } }
