#hx-live-chat-root {
    --hx-chat-accent: #14532d;
    --hx-chat-accent-soft: rgba(20, 83, 45, 0.14);
    --hx-chat-gold: #d4a72c;
    --hx-chat-gold-soft: #f0d060;
    --hx-chat-bg: #071a10;
    --hx-chat-panel: #0c2218;
    --hx-chat-text: #eef6f1;
    --hx-chat-muted: #94a3b8;
    --hx-chat-border: rgba(212, 167, 44, 0.16);
    --hx-chat-bottom: 24px;
    position: fixed;
    bottom: calc(var(--hx-chat-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    font-family: Inter, Poppins, system-ui, sans-serif;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    max-height: calc(100dvh - 12px);
}

#hx-live-chat-root.hx-chat-open {
    --hx-chat-bottom: 10px;
}

#hx-live-chat-root .hx-chat-panel,
#hx-live-chat-root .hx-chat-launcher-wrap,
#hx-live-chat-root .hx-chat-toast-stack {
    pointer-events: auto;
}

#hx-live-chat-root.hx-chat-left {
    left: 20px;
    right: auto;
    align-items: flex-start;
}

#hx-live-chat-root.hx-chat-right {
    right: 20px;
    left: auto;
    align-items: flex-end;
}

.hx-chat-notify-hint {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px dashed rgba(212, 167, 44, .45);
    border-radius: 10px;
    background: rgba(212, 167, 44, .08);
    color: var(--hx-chat-gold-soft);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.hx-chat-notify-hint:hover {
    background: rgba(212, 167, 44, .14);
}

.hx-chat-badge.hx-has-alert {
    background: #dc2626 !important;
    color: #fff !important;
    animation: hx-chat-badge-pulse 1.2s ease infinite;
}

@keyframes hx-chat-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

#hx-live-chat-root,
#hx-live-chat-root * {
    box-sizing: border-box;
}

/* ── Launcher wrap ── */
.hx-chat-launcher-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.hx-chat-launcher-teaser {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    background: linear-gradient(135deg, rgba(7, 26, 16, 0.96), rgba(15, 47, 27, 0.94));
    border: 1px solid rgba(212, 167, 44, 0.28);
    box-shadow: 0 14px 34px rgba(7, 26, 16, 0.28);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.35;
    max-width: 220px;
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.hx-chat-launcher-teaser.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.hx-chat-launcher-teaser strong {
    display: block;
    color: var(--hx-chat-gold-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.hx-chat-launcher-teaser button {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: 16px;
    line-height: 1;
    padding: 0 0 0 6px;
    cursor: pointer;
}

.hx-chat-launcher-stack {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hx-chat-launcher-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(212, 167, 44, 0.45);
    opacity: 0;
    animation: none;
    pointer-events: none;
}

.hx-chat-launcher.hx-pulse .hx-chat-launcher-ring {
    opacity: 1;
    animation: hxLauncherRing 2.4s ease-out infinite;
}

.hx-chat-launcher.hx-pulse .hx-chat-launcher-ring:nth-child(2) {
    animation-delay: 1.2s;
}

@keyframes hxLauncherRing {
    0% { transform: scale(0.92); opacity: 0.75; }
    70% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

.hx-chat-launcher {
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #0f2f1b 0%, #14532d 52%, #1a5c36 100%);
    color: #fff;
    box-shadow:
        0 0 0 2px rgba(212, 167, 44, 0.55),
        0 14px 32px rgba(7, 26, 16, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.28s ease;
    overflow: hidden;
}

.hx-chat-launcher::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), transparent 55%);
    pointer-events: none;
}

.hx-chat-launcher:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 0 0 2px rgba(240, 208, 96, 0.75),
        0 18px 40px rgba(7, 26, 16, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.hx-chat-launcher.is-open {
    transform: rotate(0deg) scale(1);
    background: linear-gradient(145deg, #14532d, #0f2f1b);
}

.hx-chat-launcher-icon,
.hx-chat-launcher-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.22s ease, transform 0.28s ease;
}

.hx-chat-launcher-icon svg,
.hx-chat-launcher-close svg {
    width: 30px;
    height: 30px;
    display: block;
}

.hx-chat-launcher-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}

.hx-chat-launcher.is-open .hx-chat-launcher-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}

.hx-chat-launcher.is-open .hx-chat-launcher-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.hx-chat-launcher .hx-chat-badge {
    position: absolute;
    /* Sit on the rim — never cover Sophia's face. */
    bottom: 2px;
    right: 2px;
    top: auto;
    min-width: 14px;
    width: 14px;
    height: 14px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #4ade80);
    border: 2px solid #fff;
    color: transparent;
    font-size: 0;
    line-height: 0;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.45);
    z-index: 3;
}

.hx-chat-launcher .hx-chat-badge.hx-chat-badge--dot,
.hx-chat-launcher .hx-chat-badge:empty {
    min-width: 14px;
    width: 14px;
    height: 14px;
    padding: 0;
    font-size: 0;
    color: transparent;
}

.hx-chat-launcher .hx-chat-badge.offline {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: transparent;
}

.hx-chat-launcher .hx-chat-badge.hx-has-alert {
    background: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35), 0 2px 8px rgba(220, 38, 38, 0.45);
}

/* Homepage premium treatment */
#hx-live-chat-root.hx-chat-homepage .hx-chat-launcher {
    width: 68px;
    height: 68px;
}

#hx-live-chat-root.hx-chat-homepage .hx-chat-launcher-teaser {
    border-radius: 16px 16px 4px 16px;
    padding: 12px 16px;
    font-size: 13px;
}

#hx-live-chat-root.hx-chat-homepage .hx-chat-launcher-wrap {
    gap: 12px;
}

.hx-chat-toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    left: auto;
    width: min(360px, calc(100vw - 36px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99995;
}

#hx-live-chat-root.hx-chat-left .hx-chat-toast-stack {
    right: auto;
    left: 18px;
}

.hx-chat-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(212, 167, 44, 0.35);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(7, 26, 16, 0.98), rgba(15, 47, 27, 0.96));
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.42);
    color: #fff;
    text-align: left;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.hx-chat-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hx-chat-toast-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.hx-chat-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: cover;
}

.hx-chat-toast-icon--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 167, 44, 0.18);
    font-size: 18px;
}

.hx-chat-toast-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.hx-chat-toast-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--hx-chat-gold-soft);
}

.hx-chat-toast-body {
    display: block;
    font-size: 12px;
    line-height: 1.45;
    color: #dbe7df;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hx-chat-toast-action {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #86efac;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.hx-chat-panel {
    width: min(380px, calc(100vw - 32px));
    height: min(500px, calc(100dvh - 130px));
    max-height: min(500px, calc(100dvh - 130px));
    margin-bottom: 12px;
    border-radius: 20px;
    overflow: hidden;
    background: var(--hx-chat-panel);
    border: 1px solid var(--hx-chat-border);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
    display: none;
    flex-direction: column;
    min-height: 0;
}

.hx-chat-panel.open {
    display: flex;
    height: min(480px, calc(100dvh - 118px));
    max-height: min(480px, calc(100dvh - 118px));
    animation: hxChatSlideUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

@keyframes hxChatSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.hx-chat-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(15, 47, 27, 0.95), rgba(7, 26, 16, 0.88));
    border-bottom: 1px solid var(--hx-chat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.hx-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hx-chat-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.hx-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(212, 167, 44, 0.18), rgba(20, 83, 45, 0.35));
    color: var(--hx-chat-gold-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    border: 2px solid rgba(212, 167, 44, 0.35);
    box-shadow: 0 6px 16px rgba(7, 26, 16, 0.28);
    position: relative;
    overflow: visible;
}

.hx-chat-avatar--care .hx-chat-avatar-svg {
    width: 44px;
    height: 44px;
    display: block;
}

.hx-chat-avatar--brand {
    overflow: hidden;
    background: #0c2218;
}

.hx-chat-avatar-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.hx-chat-avatar-badge {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #14532d, #0f2f1b);
    border: 1.5px solid #d4a72c;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.hx-chat-headset-badge {
    width: 13px;
    height: 13px;
    display: block;
}

.hx-chat-agent h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--hx-chat-text);
}

.hx-chat-agent p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--hx-chat-muted);
}

.hx-chat-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #86efac;
}

.hx-chat-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

.hx-chat-status.offline {
    color: #fbbf24;
}

.hx-chat-status.offline::before {
    background: #fbbf24;
}

.hx-chat-close {
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--hx-chat-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
}

.hx-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, rgba(7, 26, 16, 0.4), rgba(12, 34, 24, 0.2));
    scroll-behavior: smooth;
}

.hx-chat-bubble {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.hx-chat-bubble.bot,
.hx-chat-bubble.system {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: var(--hx-chat-text);
    border: 1px solid var(--hx-chat-border);
}

.hx-chat-bubble.admin {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(212, 167, 44, 0.18), rgba(20, 83, 45, 0.35));
    color: #fff;
    border: 1px solid rgba(212, 167, 44, 0.35);
}

.hx-chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #14532d, #1a5c36);
    color: #fff;
    border: 1px solid rgba(212, 167, 44, 0.2);
}

.hx-chat-typing {
    align-self: flex-start;
    display: none;
    gap: 4px;
    padding: 10px 12px;
    margin: 0 16px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--hx-chat-border);
    flex-shrink: 0;
}

.hx-chat-typing.show {
    display: inline-flex;
}

.hx-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hx-chat-muted);
    animation: hxChatTyping 1.2s infinite;
}

.hx-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.hx-chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes hxChatTyping {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

.hx-chat-quick {
    padding: 0 14px 10px;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.hx-chat-quick button {
    border: 1px solid var(--hx-chat-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--hx-chat-text);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    flex: 0 0 auto;
    white-space: nowrap;
}

.hx-chat-quick button:hover {
    border-color: var(--hx-chat-gold);
    color: #fff;
    background: rgba(212, 167, 44, 0.12);
}

.hx-chat-input-wrap {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--hx-chat-border);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.hx-chat-input-wrap input {
    flex: 1;
    border: 1px solid var(--hx-chat-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--hx-chat-text);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
}

.hx-chat-input-wrap input:focus {
    outline: none;
    border-color: var(--hx-chat-gold);
}

.hx-chat-send-btn {
    border: none;
    background: linear-gradient(135deg, #14532d, #1a5c36);
    color: #f0d060;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(212, 167, 44, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px rgba(7, 26, 16, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.hx-chat-send-btn:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 16px rgba(7, 26, 16, 0.32);
}

.hx-chat-send-btn:active {
    transform: translateY(0);
}

.hx-chat-send-svg {
    width: 20px;
    height: 20px;
    display: block;
}

.hx-chat-escalate {
    padding: 0 14px 12px;
    flex-shrink: 0;
}

.hx-chat-email-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hx-chat-gold-soft);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(212, 167, 44, 0.28);
    background: rgba(212, 167, 44, 0.08);
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.hx-chat-email-link:hover {
    color: #fff;
    border-color: rgba(212, 167, 44, 0.5);
    background: rgba(212, 167, 44, 0.16);
}

.hx-chat-email-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(20, 83, 45, 0.55);
    border: 1px solid rgba(74, 222, 128, 0.25);
    flex-shrink: 0;
    color: #f0d060;
}

.hx-chat-email-svg {
    width: 16px;
    height: 16px;
    display: block;
}

@media (max-width: 480px) {
    #hx-live-chat-root {
        --hx-chat-bottom: 14px;
    }

    #hx-live-chat-root.hx-chat-open {
        --hx-chat-bottom: 6px;
    }

    #hx-live-chat-root.hx-chat-right,
    #hx-live-chat-root.hx-chat-left {
        right: 12px;
        left: 12px;
    }

    .hx-chat-panel {
        width: 100%;
        height: min(68dvh, 460px);
        max-height: min(68dvh, 460px);
    }

    .hx-chat-panel.open {
        height: min(64dvh, 440px);
        max-height: min(64dvh, calc(100dvh - 104px));
    }

    .hx-chat-toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    #hx-live-chat-root.hx-chat-left .hx-chat-toast-stack {
        left: 12px;
        right: 12px;
    }

    .hx-chat-launcher-teaser {
        max-width: 180px;
        font-size: 11px;
    }
}
/* ── Sophia portrait advisor ── */
.hx-chat-avatar--photo {
    overflow: visible;
    background: #0c2218;
    border-color: rgba(240, 208, 96, 0.55);
    box-shadow: 0 0 0 2px rgba(20, 83, 45, 0.35), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.hx-chat-avatar-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.hx-chat-launcher--portrait {
    /* Visible so the online-status dot can sit on the rim without covering the face. */
    overflow: visible;
    padding: 0;
    background: linear-gradient(145deg, #0f2f1b, #14532d 55%, #0a1f14);
}

.hx-chat-launcher--portrait .hx-chat-launcher-face {
    /* Clip only the photo to a circle; badge remains outside the face area. */
    overflow: hidden;
    border-radius: 50%;
}

.hx-chat-launcher-face {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
    border-radius: 50%;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Keep the portrait fully visible — status lives only on the bottom-right rim. */
.hx-chat-launcher--portrait .hx-chat-badge {
    bottom: 0;
    right: 0;
    top: auto;
    left: auto;
    transform: translate(15%, 15%);
}

.hx-chat-launcher.is-open .hx-chat-launcher-face {
    opacity: 0;
    transform: scale(0.6);
}

.hx-chat-launcher-teaser .hx-chat-teaser-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hx-chat-teaser-face {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid rgba(212, 167, 44, 0.55);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.hx-chat-teaser-copy {
    font-size: 12.5px;
    line-height: 1.35;
    color: #e2e8f0;
    min-width: 0;
}
