/* Funnel lead chat — SambaNova + email transcript to support */
.funnel-lc-launcher {
    position: fixed;
    z-index: 99988;
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: var(--f-font, system-ui, sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff !important;
    background: linear-gradient(135deg, #0d1a1c 0%, #1a2e32 100%);
    box-shadow: 0 4px 24px rgba(13, 26, 28, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.funnel-lc-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(13, 26, 28, 0.4);
    color: #fff !important;
}

.funnel-lc-launcher:focus-visible {
    outline: 3px solid #ff481f;
    outline-offset: 2px;
}

.funnel-lc-launcher .funnel-lc-icon {
    font-size: 1.1rem;
}

/* Above mobile sticky funnel CTAs */
body:has(.funnel-sticky-m) .funnel-lc-launcher {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    body:has(.funnel-sticky-m) .funnel-lc-launcher {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

.funnel-lc-panel {
    position: fixed;
    z-index: 99989;
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    max-width: 420px;
    max-height: min(72vh, 520px);
    margin: 0 auto;
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(13, 26, 28, 0.18);
    overflow: hidden;
}

.funnel-lc-panel.is-open {
    display: flex;
}

@media (min-width: 480px) {
    .funnel-lc-panel {
        left: auto;
        right: auto;
        margin-left: 16px;
        margin-right: auto;
    }
}

body:has(.funnel-sticky-m) .funnel-lc-panel {
    bottom: calc(150px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
    body:has(.funnel-sticky-m) .funnel-lc-panel {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
}

.funnel-lc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: #0d1a1c;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.funnel-lc-title {
    flex: 1;
    min-width: 0;
}

.funnel-lc-head-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.funnel-lc-end-chat {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.funnel-lc-end-chat:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.funnel-lc-end-chat:focus-visible {
    outline: 2px solid #ff481f;
    outline-offset: 1px;
}

.funnel-lc-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.funnel-lc-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.funnel-lc-msgs {
    flex: 1;
    min-height: 200px;
    max-height: 360px;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    font-size: 0.9rem;
    line-height: 1.45;
}

.funnel-lc-bubble {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    max-width: 92%;
    word-break: break-word;
}

.funnel-lc-bubble.user {
    margin-left: auto;
    background: #0d1a1c;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.funnel-lc-bubble.ai {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}

.funnel-lc-bubble.sys {
    background: rgba(255, 72, 31, 0.08);
    border: 1px solid rgba(255, 72, 31, 0.25);
    color: #0f172a;
    font-size: 0.82rem;
}

.funnel-lc-toast {
    position: fixed;
    z-index: 99999;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(12px);
    max-width: min(92vw, 360px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #0d1a1c;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 12px 40px rgba(13, 26, 28, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s ease;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.funnel-lc-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.funnel-lc-input-row {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.funnel-lc-input-row input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.funnel-lc-input-row button.send {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: #ff481f;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.funnel-lc-input-row button.send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.funnel-lc-typing {
    font-size: 0.75rem;
    color: #64748b;
    padding: 0 12px 8px;
}

@media print {
    .funnel-lc-launcher,
    .funnel-lc-panel,
    .funnel-lc-toast {
        display: none !important;
    }
}
