/* ITSC AI Chatbot – Widget-Styles
   Optik: Messenger-Fenster mit Profilbild, Sprechblasen, Zeitstempel und
   Lesebestaetigung (zwei Haken). Farben stammen aus der Hausfarbpalette,
   nicht aus dem WhatsApp-Gruen. */

/* Staerkster Schutzwall: Am aeussersten Container jede vom Theme geerbte oder
   aufgezwungene Eigenschaft auf den Browser-Standard zuruecksetzen. Danach
   gelten nur noch die Regeln dieses Stylesheets. Das faengt auch Eigenschaften
   ab, an die man einzeln nie denken wuerde. Die eigene Positionierung wird
   direkt darunter neu gesetzt. */
#foaic-chatbot {
    all: revert;
}

/* Abschirmung gegen das aktive Theme. Block-Themes wie Twenty Twenty setzen
   Farben, Raender und Umrisse sehr breit ueber * und svg - das laeuft sonst
   sichtbar in das Widget hinein (blaue Balken, verfaerbte Symbole). Hier werden
   am Container und an allen Kindern die geerbten Werte neutralisiert; die
   eigentliche Optik setzen die Regeln darunter danach gezielt wieder. */
#foaic-chatbot,
#foaic-chatbot * {
    box-sizing: border-box;
    /* Nur Eigenschaften zuruecksetzen, die Themes von aussen aufzwingen und die
       das Widget selbst nirgends braucht. Hintergruende und Raender bleiben
       unangetastet - die setzt das Widget gleich gezielt selbst. */
    text-shadow: none;
    float: none;
    text-transform: none;
    letter-spacing: normal;
    animation: none;
}

/* Eigener Stacking-Context, damit Theme-Overlays nicht ueber das Widget laufen. */
#foaic-chatbot {
    isolation: isolate;
}

/* Kein Theme darf dem Widget einen Aussenrand oder Umriss aufzwingen - das war
   der blaue Balken auf Twenty Twenty. Bewusst nur auf dem Container, nicht auf
   allen Kindern, damit die inneren Raender (z. B. Eingabefeld) erhalten bleiben. */
#foaic-chatbot,
#foaic-chatbot > * {
    outline: 0;
}

#foaic-chatbot button,
#foaic-chatbot input,
#foaic-chatbot textarea,
#foaic-chatbot a {
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
}

#foaic-chatbot {
    /* Farben zentral. Werden aus dem Backend gesetzt; hier die Standardwerte. */
    --foaic-accent: #2a9ad1;      /* Akzent: Buttons, Nutzer-Blase, Sende-Knopf */
    --foaic-accent-dark: #238ac0; /* Akzent beim Ueberfahren */
    --foaic-header: #2c3747;      /* Kopfzeile */
    --foaic-text: #172033;        /* Grundtextfarbe */
    --foaic-online: #35c46a;      /* Online-Punkt */
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--foaic-text);
}

/* ---------------------------------------------------------------- Toggle */

#foaic-toggle {
    border: 0;
    width: auto;
    min-width: 138px;
    height: 60px;
    border-radius: 999px !important;
    padding: 0 22px 0 18px;
    background: linear-gradient(135deg, var(--foaic-button, #283646) 0%, var(--foaic-button-dark, #1f2b39) 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(31, 43, 57, 0.35);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

#foaic-toggle:hover,
#foaic-toggle:focus {
    transform: translateY(-2px);
    box-shadow: 0 16px 38px rgba(31, 43, 57, 0.42);
    outline: none;
}

#foaic-toggle .foaic-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
}

#foaic-toggle .foaic-icon svg {
    width: 26px;
    height: 26px;
    display: block;
}

#foaic-toggle .foaic-button-text {
    display: inline-block;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- Fenster */

#foaic-window {
    /* Fest am Bildschirm verankert. Die !important-Werte sind noetig, weil
       Block-Themes wie Twenty Twenty ein top auf fixierte Elemente setzen -
       stehen top UND bottom, quetscht der Browser die Hoehe dazwischen zusammen
       (Fenster wird zu kurz und rutscht nach oben). top/left werden daher hart
       auf auto gezwungen, damit allein bottom+right zaehlen. */
    position: fixed !important;
    right: 22px !important;
    bottom: 94px !important;
    left: auto !important;
    top: auto !important;
    width: 372px;
    max-width: calc(100vw - 32px);
    height: 596px;
    max-height: calc(100vh - 132px);
    /* dvh beruecksichtigt die ein- und ausblendende Adressleiste auf Mobilgeraeten,
       wo 100vh oft zu gross gerechnet wird. Fuer aeltere Browser bleibt die
       vh-Zeile darueber als Rueckfall stehen. */
    max-height: calc(100dvh - 132px);
    background: #ffffff;
    border: 1px solid rgba(39, 52, 68, 0.12);
    border-radius: 18px !important;
    overflow: hidden;
    box-shadow: 0 22px 60px rgba(31, 43, 57, 0.28);
    transform-origin: bottom right;
    /* Spaltenlayout: Der Nachrichtenbereich nimmt den Rest ein, statt dass seine
       Hoehe aus der Summe der Fusszeilen berechnet werden muss. */
    display: flex;
    flex-direction: column;
}

/* Fuer eingeloggte Admins sitzt oben die WordPress-Leiste (46px mobil, 32px ab
   783px). Nur dann die Fensterhoehe zusaetzlich verkleinern, damit es nicht
   dahinter geraet. Normale Besucher sehen die Leiste nicht. */
body.admin-bar #foaic-window {
    max-height: calc(100dvh - 132px - 46px);
}
@media screen and (min-width: 783px) {
    body.admin-bar #foaic-window {
        max-height: calc(100dvh - 132px - 32px);
    }
}

/* Muss nach der display-Regel stehen, sonst ueberschreibt flex das hidden-Attribut. */
#foaic-chatbot #foaic-window[hidden] {
    /* !important + hohe Spezifitaet, damit das Ausblenden auch gegen ein
       display:block !important des Themes gewinnt und der X-Knopf zuverlaessig
       schliesst. */
    display: none !important;
}

#foaic-header,
#foaic-privacy,
#foaic-form,
#foaic-promo {
    flex: 0 0 auto;
}

#foaic-window.foaic-open {
    animation: foaic-pop 170ms ease-out;
}

@keyframes foaic-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------------------------------------------------------- Kopfzeile */

#foaic-header {
    min-height: 66px;
    padding: 0 8px 0 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: var(--foaic-header);
    color: #ffffff;
    border-bottom: 3px solid var(--foaic-accent);
}

.foaic-avatar {
    position: relative;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50% !important;
    overflow: hidden;
    background: var(--foaic-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.foaic-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    display: block;
    border-radius: 50% !important;
}

.foaic-avatar-wrap {
    position: relative;
    flex: 0 0 42px;
}

/* Gruener Online-Punkt am Profilbild in der Kopfzeile. */
.foaic-avatar-wrap::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50% !important;
    background: var(--foaic-online);
    border: 2px solid var(--foaic-header);
}

#foaic-header .foaic-headtext {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.25;
}

#foaic-header .foaic-title {
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#foaic-header .foaic-status {
    font-size: 11.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#foaic-header .foaic-status[hidden] {
    display: none;
}

.foaic-head-btn {
    border: 0;
    background: transparent;
    color: #ffffff;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.foaic-head-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    /* Die Kopf-Icons sind reine Strich-Icons (fill=none, stroke=currentColor).
       Gegen Block-Themes, die svg global einfaerben, hier ausdruecklich: weisse
       Linie, keine Fuellung. */
    stroke: #ffffff !important;
    fill: none !important;
    color: #ffffff;
}

#foaic-sound-on,
#foaic-sound-off {
    display: flex;
}

#foaic-sound-on[hidden],
#foaic-sound-off[hidden] {
    display: none;
}

.foaic-head-btn:hover,
.foaic-head-btn:focus {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
}

#foaic-close {
    font-size: 26px;
}

/* ---------------------------------------------------------------- Verlauf */

#foaic-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 14px 10px;
    font-size: 14px;
    line-height: 1.45;
    /* Dezente Punktetextur wie in einem Messenger-Hintergrund. */
    background-color: #e9eef4;
    background-image: radial-gradient(rgba(44, 55, 71, 0.055) 1px, transparent 1px);
    background-size: 18px 18px;
}

/* Datums-/Trennchip oben im Verlauf. */
.foaic-daychip {
    display: block;
    width: fit-content;
    margin: 0 auto 14px;
    padding: 4px 12px;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.82);
    color: #5b6879;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(31, 43, 57, 0.08);
}

.foaic-row {
    display: flex;
    /* Oben ausgerichtet, damit Profilbild und Blasenspitze auf einer Linie liegen. */
    align-items: flex-start;
    gap: 7px;
    margin: 0 0 9px;
}

.foaic-row-user {
    justify-content: flex-end;
}

.foaic-row .foaic-avatar {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    font-size: 11px;
    box-shadow: none;
    margin-top: 1px;
}

/* Folgt eine weitere Bot-Nachricht, bleibt der Platz frei, damit die
   Blasen buendig stehen, aber das Bild sich nicht wiederholt. */
.foaic-row .foaic-avatar-spacer {
    flex: 0 0 28px;
    width: 28px;
}

.foaic-bubble {
    position: relative;
    max-width: 78%;
    padding: 7px 10px 5px;
    border-radius: 12px !important;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(31, 43, 57, 0.13);
}

.foaic-row-bot .foaic-bubble {
    background: #ffffff;
    color: #172033;
    border-top-left-radius: 4px;
}

.foaic-row-user .foaic-bubble {
    background: #d7eefb;
    color: #14212e;
    border-top-right-radius: 4px;
}

/* Kleine Sprechblasen-Spitzen. */
.foaic-row-bot .foaic-bubble::before,
.foaic-row-user .foaic-bubble::before {
    content: "";
    position: absolute;
    top: 0;
    width: 9px;
    height: 12px;
}

.foaic-row-bot .foaic-bubble::before {
    left: -7px;
    background: #ffffff;
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.foaic-row-user .foaic-bubble::before {
    right: -7px;
    background: #d7eefb;
    clip-path: polygon(0 0, 0 100%, 100% 0);
}

.foaic-bubble-text a {
    color: #1f7fae;
}

/* Absaetze innerhalb einer Antwort. Der Abstand wird hier festgelegt und nicht
   mehr ueber gestapelte Zeilenumbrueche, die deutlich zu weit auseinanderliefen. */
.foaic-bubble-text .foaic-p {
    margin: 0 0 0.62em;
}

.foaic-bubble-text .foaic-p:last-child {
    margin-bottom: 0;
}

/* Die Anrede steht als eigene Zeile ueber der Antwort und bekommt etwas mehr
   Luft als die uebrigen Absaetze, damit sie sich als Gruss abhebt. */
.foaic-bubble-text .foaic-greeting {
    margin-bottom: 0.9em;
}

.foaic-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 2px;
    font-size: 10.5px;
    line-height: 1;
    color: #7a8899;
    user-select: none;
}

/* --- Lesebestaetigung: ein Haken beim Senden, zwei blaue nach der Antwort --- */

.foaic-ticks svg {
    display: block;
    width: 16px;
    height: 11px;
    overflow: visible;
}

.foaic-ticks path {
    fill: none;
    stroke: #93a2b3;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 200ms ease;
}

.foaic-ticks .foaic-tick-2 {
    opacity: 0;
    transition: opacity 200ms ease;
}

.foaic-ticks.is-delivered .foaic-tick-2 {
    opacity: 1;
}

.foaic-ticks.is-read path {
    stroke: var(--foaic-accent);
}

.foaic-ticks.is-read .foaic-tick-2 {
    opacity: 1;
}

/* --- Tippanzeige statt Text-Platzhalter --- */

.foaic-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px 3px;
}

.foaic-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50% !important;
    background: #9aa8b8;
    animation: foaic-blink 1.2s infinite ease-in-out;
}

.foaic-typing span:nth-child(2) { animation-delay: 0.18s; }
.foaic-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes foaic-blink {
    0%, 60%, 100% { opacity: 0.32; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------------------------------------------------------------- Vorschlaege */

.foaic-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 14px 35px;
}

.foaic-suggestion-btn {
    border: 1px solid var(--foaic-accent);
    background: rgba(255, 255, 255, 0.94);
    color: #1f7fae;
    border-radius: 999px !important;
    padding: 7px 13px;
    font-size: 12.5px;
    line-height: 1.3;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.foaic-suggestion-btn:hover,
.foaic-suggestion-btn:focus {
    background: var(--foaic-accent);
    color: #ffffff;
    outline: none;
}

/* ---------------------------------------------------------------- Kontaktbuttons */

/* Die Buttonreihe steht frei unter der Antwort, nicht in einer eigenen Sprechblase. */
.foaic-row-contact .foaic-bubble {
    max-width: 94%;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.foaic-row-contact .foaic-bubble::before {
    display: none;
}

/* Kleine Zeile ueber der Buttonreihe, damit klar ist, wofuer die drei Wege stehen. */
.foaic-actions-caption {
    font-size: 11.5px;
    font-weight: 600;
    color: #6b7b90;
    margin: 0 0 6px 2px;
}

.foaic-contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 3px;
}

.foaic-contact-btn {
    display: inline-block;
    background: var(--foaic-header);
    color: #ffffff !important;
    text-decoration: none;
    padding: 8px 13px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: background 140ms ease;
}

.foaic-contact-btn:hover,
.foaic-contact-btn:focus {
    background: #1f2837;
    outline: none;
}

.foaic-contact-btn-primary {
    background: var(--foaic-accent);
}

.foaic-contact-btn-primary:hover,
.foaic-contact-btn-primary:focus {
    background: var(--foaic-accent-dark);
}

.foaic-contact-btn-secondary {
    background: #ffffff;
    color: var(--foaic-header) !important;
    border: 1px solid #cfdbe6;
}

.foaic-contact-btn-secondary:hover,
.foaic-contact-btn-secondary:focus {
    background: #f1f5f9;
}

/* ---------------------------------------------------------------- Anfrage-Dialog
   Der Bot fragt die Angaben im Chat ab. Es gibt kein eigenes Formularfenster,
   nur Schnellantwort-Buttons und eine Zusammenfassung in einer Sprechblase. */

.foaic-quickreplies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 2px 0 12px 35px;
}

.foaic-row-summary .foaic-bubble {
    max-width: 92%;
}

.foaic-summary {
    margin: 9px 0 4px;
    padding: 9px 11px;
    border-radius: 10px;
    background: #f1f6fb;
    border: 1px solid #dbe6f1;
    font-size: 13px;
    line-height: 1.45;
}

.foaic-summary-row {
    display: flex;
    gap: 8px;
    padding: 3px 0;
}

.foaic-summary-row + .foaic-summary-row {
    border-top: 1px solid #e4ecf4;
}

.foaic-summary-row span {
    flex: 0 0 68px;
    color: #6b7b90;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-top: 1px;
}

.foaic-summary-row b {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    color: #172033;
    overflow-wrap: anywhere;
}

/* Das Anliegen kann mehrzeilig sein und behaelt seine Umbrueche. */
.foaic-summary-concern b {
    white-space: pre-wrap;
    font-weight: 500;
}

.foaic-consent-note {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.45;
    color: #6b7b90;
}

.foaic-consent-note a {
    color: #1f7fae;
}

/* ---------------------------------------------------------------- Fusszeilen */

#foaic-privacy {
    margin: 0;
    padding: 8px 14px;
    font-size: 11px;
    color: #687587;
    background: #ffffff;
    border-top: 1px solid #dce5ee;
}

#foaic-privacy a {
    color: #687587;
    text-decoration: underline;
}

#foaic-privacy a:hover,
#foaic-privacy a:focus {
    color: var(--foaic-accent);
}

#foaic-promo {
    margin: 0;
    padding: 7px 14px;
    font-size: 11.5px;
    background: #f4f7fb;
    border-top: 1px solid #dce5ee;
    text-align: center;
}

#foaic-promo[hidden] {
    display: none;
}

#foaic-promo a {
    color: var(--foaic-accent);
    text-decoration: none;
    font-weight: 600;
}

#foaic-promo a:hover,
#foaic-promo a:focus {
    text-decoration: underline;
}

/* ---------------------------------------------------------------- Antwort kopieren
   Erscheint erst beim Ueberfahren der Blase, damit die Zeile ruhig bleibt.
   Auf Touchgeraeten steht der Knopf dauerhaft, dort gibt es kein Hover. */

.foaic-copy {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.9);
    color: #8494a6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 130ms ease, color 130ms ease, background 130ms ease;
}

.foaic-copy svg {
    width: 14px;
    height: 14px;
    display: block;
}

.foaic-row-bot .foaic-bubble:hover .foaic-copy,
.foaic-copy:focus {
    opacity: 1;
    outline: none;
}

.foaic-copy:hover {
    color: var(--foaic-accent);
    background: #eef5fa;
}

.foaic-copy.is-done {
    opacity: 1;
    color: #0a7d3f;
    background: #e6f5ec;
}

.foaic-copy.is-failed {
    opacity: 1;
    color: #b32d2e;
    background: #fdecec;
}

@media (hover: none) {
    .foaic-copy {
        opacity: 0.55;
    }
}

/* Platz fuer den Knopf, damit er nicht auf dem Text liegt. */
.foaic-row-bot .foaic-bubble {
    padding-right: 32px;
}

.foaic-row-contact .foaic-bubble,
.foaic-row-typing .foaic-bubble {
    padding-right: 10px;
}

/* ---------------------------------------------------------------- Eingabe */

#foaic-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #dce5ee;
}

.foaic-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    min-width: 0;
}

/* Zeichenzaehler sitzt im Feld, rechts vor dem Rand. */
#foaic-counter {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #93a2b3;
    pointer-events: none;
    background: #ffffff;
    padding-left: 5px;
}

#foaic-counter[hidden] {
    display: none;
}

#foaic-counter.is-tight {
    color: #c9553d;
}

#foaic-question {
    flex: 1;
    height: 44px;
    min-width: 0;
    border: 1.5px solid #c3d2e0;
    border-radius: 999px !important;
    padding: 0 16px;
    font-size: 14.5px;
    outline: none;
    background: #ffffff;
    color: #172033;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

/* Klasse wird vom Widget gesetzt, sobald der Zaehler sichtbar ist.
   :has() waere kuerzer, ist aber noch nicht in allen Browsern verfuegbar. */
.foaic-input-wrap.has-counter #foaic-question {
    padding-right: 44px;
}

#foaic-question:focus {
    border-color: var(--foaic-accent);
    box-shadow: 0 0 0 3px rgba(42, 154, 209, 0.18);
}

#foaic-question::placeholder {
    color: #6b7b90;
    opacity: 1;
}

#foaic-send {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 140ms ease;
}

#foaic-send svg {
    width: 20px;
    height: 20px;
    display: block;
}

#foaic-send {
    background: var(--foaic-accent);
    color: #ffffff;
}

#foaic-send:hover,
#foaic-send:focus {
    background: var(--foaic-accent-dark);
    outline: none;
}

#foaic-send:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

/* ---------------------------------------------------------------- Mobil */

@media (max-width: 640px) {
    #foaic-chatbot {
        right: 14px;
        bottom: 14px;
    }

    /* Beschriftung bleibt auch mobil stehen, nur etwas kompakter.
       Ein reines Symbol laesst offen, was sich dahinter verbirgt. */
    #foaic-toggle {
        min-width: 0;
        height: 52px;
        padding: 0 18px 0 15px;
        gap: 8px;
        font-size: 15px;
    }

    #foaic-toggle .foaic-icon,
    #foaic-toggle .foaic-icon svg {
        width: 23px;
        height: 23px;
    }

    #foaic-toggle .foaic-icon {
        flex: 0 0 23px;
    }

    #foaic-window {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 78px;
        width: auto;
        max-width: none;
        height: min(80vh, 620px);
        max-height: 80vh;
        border-radius: 18px;
        transform-origin: bottom center;
    }

    #foaic-window.foaic-open {
        animation: foaic-sheet 180ms ease-out;
    }

    #foaic-header {
        min-height: 60px;
    }

    #foaic-messages {
        padding: 14px 12px 8px;
        font-size: 14px;
    }

    .foaic-bubble {
        max-width: 84%;
    }

    #foaic-question {
        /* Nicht kleiner als 16px: Darunter zoomt iOS beim Antippen automatisch hinein. */
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    #foaic-toggle {
        height: 48px;
        padding: 0 15px 0 13px;
        gap: 7px;
        font-size: 14.5px;
    }

    /* Laengere Firmennamen sollen in der Kopfzeile nicht abgeschnitten werden.
       Profilbild, Abstaende und Buttons geben dafuer etwas Breite ab. */
    #foaic-header {
        padding: 0 4px 0 10px;
        gap: 8px;
    }

    #foaic-header .foaic-avatar-wrap,
    #foaic-header .foaic-avatar {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    #foaic-header .foaic-title {
        font-size: 14px;
    }

    #foaic-header .foaic-status {
        font-size: 11px;
    }

    .foaic-head-btn {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
    }

    #foaic-window {
        left: 8px;
        right: 8px;
        bottom: 72px;
        height: 72vh;
        max-height: 72vh;
    }

    #foaic-messages {
        font-size: 13.5px;
    }
}

@keyframes foaic-sheet {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    #foaic-window.foaic-open {
        animation: none;
    }

    .foaic-typing span {
        animation: none;
        opacity: 0.6;
    }

    #foaic-toggle {
        transition: none;
    }
}
