/* =============================================================================
   AI Chatbot widget — powered by Appsgain Technologies
   -----------------------------------------------------------------------------
   Loaded only while the assistant is switched on (includes/header.php).
   Every colour reads through the site's design tokens, so the Theme Engine and
   dark mode restyle the widget together with the rest of the site.
   Stacking: launcher and panel sit at 1040 — above the floating buttons (810)
   and the sticky header (900), below the cookie banner (1050), SweetAlert
   (1060) and the navigation drawers (1100+), which must cover the chat.
   ============================================================================ */

.pwf-chat {
    --pc-primary:  var(--primary, #0B4E3D);
    --pc-accent:   var(--green, #2F8065);
    --pc-cta:      var(--orange, #F15A24);
    --pc-link:     var(--brand, #0B4E3D);
    --pc-surface:  var(--surface, #FDFEFE);
    --pc-surface2: var(--surface-2, #F4F8FC);
    --pc-canvas:   var(--bg-alt, #F1F6FB);
    --pc-text:     var(--text-soft, #374151);
    --pc-heading:  var(--text, #0B4E3D);
    --pc-muted:    var(--muted, #6B7280);
    --pc-border:   var(--border, #E5E7EB);
    --pc-danger:   #DC2626;
    --pc-grad:     linear-gradient(135deg, var(--pc-primary) 0%, var(--pc-accent) 100%);
    --pc-edge:     24px;
    --pc-launcher: 60px;
    --pc-z:        1040;
    --pc-radius:   22px;
    --pc-shadow:   0 28px 70px -18px rgba(3, 25, 19, .42), 0 10px 26px -12px rgba(3, 25, 19, .28);
    font-family: var(--font-sans, 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] .pwf-chat { --pc-danger: #FCA5A5; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pwf-chat { --pc-danger: #FCA5A5; }
}

.pwf-chat *, .pwf-chat *::before, .pwf-chat *::after { box-sizing: border-box; }
.pwf-chat [hidden] { display: none !important; }
.pwf-chat .pwf-chat-ico { width: 20px; height: 20px; flex: 0 0 auto; display: block; }
.pwf-chat button { -webkit-tap-highlight-color: transparent; }
.pwf-chat__sr, .pwf-chat__hp {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ launcher */
.pwf-chat__launcher {
    position: fixed; bottom: var(--pc-edge); z-index: var(--pc-z);
    width: var(--pc-launcher); height: var(--pc-launcher); padding: 0; border: 0; border-radius: 50%;
    display: grid; place-items: center; color: #fff; background: var(--pc-grad); cursor: pointer;
    box-shadow: 0 14px 30px -10px rgba(11, 78, 61, .65), 0 4px 10px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .2);
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s ease;
}
.pwf-chat--right .pwf-chat__launcher { right: var(--pc-edge); }
.pwf-chat--left  .pwf-chat__launcher { left: var(--pc-edge); }
.pwf-chat__launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 20px 36px -12px rgba(11, 78, 61, .7), 0 6px 14px rgba(0, 0, 0, .14); }
.pwf-chat__launcher:focus-visible { outline: 3px solid var(--pc-cta); outline-offset: 3px; }
.pwf-chat__launcher-ico { grid-area: 1 / 1; display: grid; place-items: center; transition: transform .3s ease, opacity .2s ease; }
.pwf-chat__launcher-ico .pwf-chat-ico { width: 28px; height: 28px; }
.pwf-chat__launcher-ico--close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.pwf-chat[data-state="open"] .pwf-chat__launcher-ico--open  { opacity: 0; transform: rotate(90deg) scale(.6); }
.pwf-chat[data-state="open"] .pwf-chat__launcher-ico--close { opacity: 1; transform: none; }
.pwf-chat__launcher::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--pc-accent); opacity: 0; pointer-events: none;
}
.pwf-chat.is-attention .pwf-chat__launcher::after { animation: pwfChatPulse 2.4s ease-out 3; }
.pwf-chat__badge {
    position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px;
    display: grid; place-items: center; border-radius: 999px; border: 2px solid #fff;
    background: var(--pc-cta); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}

/* The existing floating buttons make room: WhatsApp + Donate stack above the
   launcher, back-to-top sits beside it. Only elements AFTER .pwf-chat match,
   which is why footer.php renders the widget first. */
.pwf-chat--right ~ .fab-stack   { right: 27px; bottom: 98px; }
.pwf-chat--right ~ .back-to-top { right: 98px; bottom: 30px; }

/* ------------------------------------------------------------------ teaser */
.pwf-chat__teaser {
    position: fixed; z-index: var(--pc-z); bottom: calc(var(--pc-edge) + var(--pc-launcher) + 14px);
    display: flex; align-items: flex-start; gap: 6px; max-width: min(310px, calc(100vw - 32px));
    animation: pwfChatRise .45s cubic-bezier(.2, .9, .3, 1.2) both;
}
.pwf-chat--right .pwf-chat__teaser { right: var(--pc-edge); }
.pwf-chat--left  .pwf-chat__teaser { left: var(--pc-edge); flex-direction: row-reverse; }
.pwf-chat__teaser-text {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--pc-heading);
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: 16px 16px 4px 16px; box-shadow: var(--pc-shadow);
}
.pwf-chat--left .pwf-chat__teaser-text { border-radius: 16px 16px 16px 4px; }
.pwf-chat__teaser-avatar { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--pc-grad); color: #fff; }
.pwf-chat__teaser-avatar .pwf-chat-ico { width: 16px; height: 16px; }
.pwf-chat__teaser-close {
    width: 26px; height: 26px; padding: 0; flex: 0 0 auto; display: grid; place-items: center; cursor: pointer;
    border-radius: 50%; border: 1px solid var(--pc-border); background: var(--pc-surface); color: var(--pc-muted);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.pwf-chat__teaser-close .pwf-chat-ico { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ panel */
.pwf-chat__panel {
    position: fixed; z-index: var(--pc-z); bottom: calc(var(--pc-edge) + var(--pc-launcher) + 16px);
    width: 400px; max-width: calc(100vw - 32px);
    height: min(680px, calc(100vh - 140px)); height: min(680px, calc(100dvh - 140px));
    display: flex; flex-direction: column; overflow: hidden;
    color: var(--pc-text); background: var(--pc-surface);
    border: 1px solid var(--pc-border); border-radius: var(--pc-radius); box-shadow: var(--pc-shadow);
    transform-origin: bottom right; animation: pwfChatOpen .32s cubic-bezier(.2, .9, .3, 1.05) both;
}
.pwf-chat--right .pwf-chat__panel { right: var(--pc-edge); }
.pwf-chat--left  .pwf-chat__panel { left: var(--pc-edge); transform-origin: bottom left; }

.pwf-chat__head {
    position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 12px;
    padding: 14px 10px 14px 16px; color: #fff; background: var(--pc-grad);
}
.pwf-chat__head::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .2) 0%, transparent 55%);
}
.pwf-chat__avatar {
    position: relative; z-index: 1; width: 42px; height: 42px; flex: 0 0 auto; padding: 3px;
    border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
}
.pwf-chat__avatar img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.pwf-chat__who { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; }
.pwf-chat__title {
    margin: 0; color: #fff; font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: -.005em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pwf-chat__status { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; color: #fff; font-size: 12px; opacity: .92; }
.pwf-chat__online { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .28); }
.pwf-chat__head-actions { position: relative; z-index: 1; display: flex; gap: 2px; }
.pwf-chat__hbtn {
    width: 36px; height: 36px; padding: 0; display: grid; place-items: center; cursor: pointer;
    border: 0; border-radius: 10px; background: transparent; color: #fff; transition: background .15s ease;
}
.pwf-chat__hbtn:hover { background: rgba(255, 255, 255, .16); }
.pwf-chat__hbtn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.pwf-chat__hbtn .pwf-chat-ico { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ messages */
.pwf-chat__body {
    flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column; gap: 10px; padding: 18px 14px 10px; background: var(--pc-canvas);
}
/* Flex items never shrink here. The lead card clips its accent bar with
   overflow:hidden, and an overflow-hidden flex item's automatic minimum height
   is zero — without this the column squeezed the whole form to a 31px sliver. */
.pwf-chat__body > * { flex-shrink: 0; }
.pwf-chat__body:focus-visible { outline: 2px solid var(--pc-accent); outline-offset: -2px; }
.pwf-chat__body::-webkit-scrollbar { width: 6px; }
.pwf-chat__body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 6px; }

.pwf-chat__intro { text-align: center; padding: 6px 8px 2px; animation: pwfChatRise .35s ease both; }
.pwf-chat__intro-avatar {
    width: 60px; height: 60px; margin: 0 auto 10px; padding: 5px; border-radius: 50%; background: #fff;
    box-shadow: 0 0 0 4px rgba(47, 128, 101, .15), 0 10px 24px -12px rgba(3, 25, 19, .45);
}
.pwf-chat__intro-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.pwf-chat__intro h3 { margin: 0 0 2px; color: var(--pc-heading); font-size: 15px; font-weight: 700; }
.pwf-chat__intro p { margin: 0; color: var(--pc-muted); font-size: 12px; }

.pwf-chat__row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; animation: pwfChatRise .28s ease both; }
.pwf-chat__row--user { justify-content: flex-end; }
.pwf-chat__row-avatar {
    width: 28px; height: 28px; margin-bottom: 22px; flex: 0 0 auto; display: grid; place-items: center;
    border-radius: 50%; background: var(--pc-grad); color: #fff;
}
.pwf-chat__row-avatar .pwf-chat-ico { width: 15px; height: 15px; }
.pwf-chat__stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 84%; }
.pwf-chat__row--user .pwf-chat__stack { align-items: flex-end; }

.pwf-chat__bubble { padding: 10px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.pwf-chat__row--bot .pwf-chat__bubble {
    color: var(--pc-text); background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.pwf-chat__row--user .pwf-chat__bubble {
    color: #fff; background: var(--pc-grad); border-bottom-right-radius: 6px; white-space: pre-wrap;
    box-shadow: 0 6px 16px -8px rgba(11, 78, 61, .55);
}
.pwf-chat__row--error .pwf-chat__bubble { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .06); }
.pwf-chat__bubble p { margin: 0 0 8px; }
.pwf-chat__bubble p:last-child, .pwf-chat__bubble ul:last-child, .pwf-chat__bubble ol:last-child { margin-bottom: 0; }
.pwf-chat__bubble ul, .pwf-chat__bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.pwf-chat__bubble li { margin: 2px 0; }
.pwf-chat__bubble strong { color: var(--pc-heading); font-weight: 700; }
.pwf-chat__row--user .pwf-chat__bubble strong { color: #fff; }
.pwf-chat__bubble a { color: var(--pc-link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.pwf-chat__bubble code { padding: 1px 5px; border-radius: 5px; background: var(--pc-surface2); font-size: 13px; }
.pwf-chat__bubble.is-streaming::after {
    content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px;
    background: currentColor; opacity: .55; animation: pwfChatCaret 1s steps(2) infinite;
}

.pwf-chat__meta { display: flex; align-items: center; gap: 2px; min-height: 22px; padding: 0 4px; color: var(--pc-muted); font-size: 11px; }
.pwf-chat__meta time { margin-right: 4px; }
.pwf-chat__act {
    width: 26px; height: 26px; padding: 0; display: grid; place-items: center; cursor: pointer;
    border: 0; border-radius: 8px; background: transparent; color: var(--pc-muted); opacity: .8;
}
.pwf-chat__act:hover, .pwf-chat__act:focus-visible { opacity: 1; color: var(--pc-heading); background: var(--pc-surface2); outline: none; }
.pwf-chat__act.is-on { opacity: 1; color: var(--pc-accent); }
.pwf-chat__act .pwf-chat-ico { width: 14px; height: 14px; }

.pwf-chat__typing { display: inline-flex; gap: 4px; padding: 14px 16px !important; }
.pwf-chat__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pc-muted); opacity: .45; animation: pwfChatDot 1.2s infinite ease-in-out; }
.pwf-chat__typing i:nth-child(2) { animation-delay: .15s; }
.pwf-chat__typing i:nth-child(3) { animation-delay: .3s; }

.pwf-chat__notice {
    align-self: center; max-width: 92%; padding: 8px 12px; text-align: center;
    color: var(--pc-muted); background: var(--pc-surface); border: 1px dashed var(--pc-border); border-radius: 12px; font-size: 12.5px;
}
.pwf-chat__notice--error { color: var(--pc-danger); border-color: rgba(220, 38, 38, .35); }
.pwf-chat__notice a { color: inherit; font-weight: 700; }

/* ------------------------------------------------------------------ chips */
.pwf-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 36px; animation: pwfChatRise .3s ease both; }
.pwf-chat__chips--start { justify-content: center; padding: 4px 4px 0; }
.pwf-chat__chip {
    padding: 7px 12px; cursor: pointer; text-align: left;
    font: inherit; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--pc-link);
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: 999px;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.pwf-chat__chip:hover, .pwf-chat__chip:focus-visible { color: #fff; background: var(--pc-primary); border-color: var(--pc-primary); transform: translateY(-1px); outline: none; }

/* ------------------------------------------------------------------ lead card */
.pwf-chat__lead {
    position: relative; overflow: hidden; padding: 16px 14px 14px;
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: 18px;
    box-shadow: 0 12px 30px -20px rgba(3, 25, 19, .45); animation: pwfChatRise .35s ease both;
}
.pwf-chat__lead::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--pc-grad); }
.pwf-chat__lead-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pwf-chat__lead-ico {
    width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px;
    color: var(--pc-accent); background: rgba(47, 128, 101, .12);
}
.pwf-chat__lead-ico .pwf-chat-ico { width: 18px; height: 18px; }
.pwf-chat__lead h3 { margin: 0; color: var(--pc-heading); font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.pwf-chat__lead p { margin: 2px 0 0; color: var(--pc-muted); font-size: 12.5px; line-height: 1.4; }
.pwf-chat__field { position: relative; margin-bottom: 8px; }
.pwf-chat__field > .pwf-chat-ico { position: absolute; left: 11px; top: 21px; transform: translateY(-50%); width: 16px; height: 16px; color: var(--pc-muted); pointer-events: none; }
.pwf-chat__field input {
    width: 100%; padding: 10px 12px 10px 36px; outline: none;
    font: inherit; font-size: 14px; color: var(--pc-heading); background: var(--pc-surface2);
    border: 1px solid var(--pc-border); border-radius: 12px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.pwf-chat__field input:focus { border-color: var(--pc-accent); background: var(--pc-surface); box-shadow: 0 0 0 3px rgba(47, 128, 101, .2); }
.pwf-chat__field input[aria-invalid="true"] { border-color: var(--pc-danger); }
.pwf-chat__ferr { display: block; margin: 3px 2px 0; color: var(--pc-danger); font-size: 11.5px; }
.pwf-chat__consent { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 12px; cursor: pointer; color: var(--pc-text); font-size: 12px; line-height: 1.45; }
.pwf-chat__consent input { width: 16px; height: 16px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--pc-accent); }
.pwf-chat__consent a { color: inherit; text-decoration: underline; }
.pwf-chat__consent + .pwf-chat__ferr { margin: -8px 2px 10px 24px; }
.pwf-chat__lead-actions { display: flex; align-items: center; gap: 8px; }
.pwf-chat__btn {
    flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 700; color: #fff; background: var(--pc-grad);
    border: 0; border-radius: 12px; box-shadow: 0 8px 18px -10px rgba(11, 78, 61, .75);
}
.pwf-chat__btn:focus-visible { outline: 2px solid var(--pc-cta); outline-offset: 2px; }
.pwf-chat__btn[disabled] { opacity: .7; cursor: progress; }
.pwf-chat__btn--ghost { flex: 0 0 auto; color: var(--pc-muted); background: transparent; box-shadow: none; font-weight: 600; }
.pwf-chat__btn--ghost:hover { color: var(--pc-heading); background: var(--pc-surface2); }
.pwf-chat__lead-done { display: flex; align-items: center; gap: 10px; color: var(--pc-heading); font-size: 14px; font-weight: 600; }
.pwf-chat__lead-done .pwf-chat__lead-ico { color: #16A34A; background: rgba(34, 197, 94, .14); }

/* ------------------------------------------------------------------ composer */
.pwf-chat__dock { position: relative; flex: 0 0 auto; padding: 10px 12px 6px; background: var(--pc-surface); border-top: 1px solid var(--pc-border); }
.pwf-chat__composer {
    display: flex; align-items: flex-end; gap: 4px; padding: 5px 5px 5px 14px;
    background: var(--pc-surface2); border: 1px solid var(--pc-border); border-radius: 16px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.pwf-chat__composer:focus-within { border-color: var(--pc-accent); background: var(--pc-surface); box-shadow: 0 0 0 3px rgba(47, 128, 101, .18); }
.pwf-chat__input {
    flex: 1 1 auto; min-width: 0; min-height: 38px; max-height: 120px; padding: 8px 0; resize: none;
    border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; line-height: 1.45; color: var(--pc-heading);
}
.pwf-chat__input::placeholder { color: var(--pc-muted); }
/* The site's global form focus ring would draw a second box inside the
   composer, which already shows focus on its own border (:focus-within). */
.pwf-chat .pwf-chat__input:focus,
.pwf-chat .pwf-chat__input:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; background: transparent !important; }
.pwf-chat__ibtn, .pwf-chat__send {
    width: 38px; height: 38px; padding: 0; flex: 0 0 auto; display: grid; place-items: center; cursor: pointer;
    border: 0; border-radius: 12px; transition: color .15s ease, background .15s ease, transform .15s ease, opacity .15s ease;
}
.pwf-chat__ibtn { color: var(--pc-muted); background: transparent; }
.pwf-chat__ibtn:hover { color: var(--pc-primary); background: rgba(47, 128, 101, .12); }
.pwf-chat__send { color: #fff; background: var(--pc-grad); box-shadow: 0 6px 14px -8px rgba(11, 78, 61, .8); }
.pwf-chat__send:hover:not([disabled]) { transform: scale(1.06); }
.pwf-chat__send[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.pwf-chat__send .pwf-chat-ico { width: 18px; height: 18px; }
.pwf-chat__ibtn:focus-visible, .pwf-chat__send:focus-visible { outline: 2px solid var(--pc-accent); outline-offset: 2px; }

.pwf-chat__recorder {
    display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 5px 5px 5px 6px;
    background: rgba(239, 68, 68, .07); border: 1px solid rgba(239, 68, 68, .3); border-radius: 16px;
}
.pwf-chat__rec-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #EF4444; animation: pwfChatBlink 1s infinite; }
.pwf-chat__rec-time { min-width: 36px; color: var(--pc-heading); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pwf-chat__rec-meter { display: flex; align-items: center; gap: 3px; height: 24px; }
.pwf-chat__rec-meter i { width: 3px; height: 20%; border-radius: 3px; background: #EF4444; transition: height .08s linear; }
.pwf-chat__rec-label { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--pc-muted); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.pwf-chat__recorder.is-busy .pwf-chat__rec-dot,
.pwf-chat__recorder.is-busy .pwf-chat__rec-time,
.pwf-chat__recorder.is-busy .pwf-chat__rec-meter { display: none; }
.pwf-chat__spin { width: 16px; height: 16px; flex: 0 0 auto; display: inline-block; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pwfChatSpin .7s linear infinite; }
.pwf-chat__counter { padding: 4px 6px 0; text-align: right; color: var(--pc-muted); font-size: 11px; }
.pwf-chat__counter.is-low { color: var(--pc-danger); }

/* ------------------------------------------------------------------ footer */
.pwf-chat__foot {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 14px 9px; color: var(--pc-muted); background: var(--pc-surface); font-size: 11.5px;
}
.pwf-chat__foot a { color: var(--pc-heading); font-weight: 700; text-decoration: none; }
.pwf-chat__foot a:hover { text-decoration: underline; }
.pwf-chat__foot .pwf-chat__foot-privacy { display: inline-flex; align-items: center; gap: 4px; color: var(--pc-muted); font-weight: 500; }
.pwf-chat__foot-privacy .pwf-chat-ico { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ motion */
@keyframes pwfChatOpen  { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pwfChatRise  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pwfChatPulse { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes pwfChatCaret { 50% { opacity: 0; } }
@keyframes pwfChatDot   { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-5px); opacity: .9; } }
@keyframes pwfChatBlink { 50% { opacity: .3; } }
@keyframes pwfChatSpin  { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ phones */
@media (max-width: 640px) {
    .pwf-chat { --pc-edge: 16px; --pc-launcher: 56px; }
    .pwf-chat--right ~ .fab-stack   { right: 17px; bottom: 84px; }
    .pwf-chat--right ~ .back-to-top { right: 84px; bottom: 20px; }
    .pwf-chat__panel,
    .pwf-chat--right .pwf-chat__panel,
    .pwf-chat--left .pwf-chat__panel {
        inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh;
        border: 0; border-radius: 0; animation-name: pwfChatRise;
    }
    .pwf-chat[data-state="open"] .pwf-chat__launcher,
    .pwf-chat[data-state="open"] .pwf-chat__teaser { display: none; }
    .pwf-chat__head { padding-top: max(14px, env(safe-area-inset-top)); }
    .pwf-chat__foot { padding-bottom: max(9px, env(safe-area-inset-bottom)); }
    .pwf-chat__input, .pwf-chat__field input { font-size: 16px; }   /* stops iOS zooming on focus */
    .pwf-chat__stack { max-width: 88%; }
}
html.pwf-chat-locked, html.pwf-chat-locked body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
    .pwf-chat *, .pwf-chat *::before, .pwf-chat *::after { animation: none !important; transition: none !important; }
}
@media print {
    .pwf-chat { display: none !important; }
}
