﻿:root {
    --cw-accent: #0b7bd3;
    --cw-accent-dark: #0b5f9d;
    --cw-bg: #ffffff;
    --cw-ink: #19344d;
    --cw-muted: #5f7991;
    --cw-line: #d4e4f2;
}

#cw-launcher {
    position: fixed;
    right: 22px;
    bottom: 12px !important;
    border: 0;
    border-radius: 999px;
    padding: 5px 8px;
    background: linear-gradient(135deg, var(--cw-accent), var(--cw-accent-dark));
    color: #fff;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(18, 95, 158, 0.28);
    z-index: 2147483646 !important;
    line-height: 1.2;
    font-size: 12px !important;
    background: linear-gradient(135deg, #0e9c43, #25D366);
}

#cw-panel {
    position: fixed;
    right: 22px;
    bottom: 74px;
    width: min(360px, calc(100vw - 22px));
    max-height: min(600px, calc(100vh - 100px));
    display: none;
    grid-template-rows: auto 1fr auto;
    border-radius: 16px;
    overflow: hidden;
    background: var(--cw-bg);
    border: 1px solid var(--cw-line);
    box-shadow: 0 16px 40px rgba(16, 52, 84, 0.24);
    z-index: 9999;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    max-height: min(600px, calc(100vh - 96px));
    max-height: min(600px, calc(100dvh - 96px));
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    z-index: 2147483647 !important;
}

    #cw-panel.cw-open {
        display: grid;
    }
    #cw-panel .cw-head-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    #cw-panel #cw-close {
        padding: 0 2px;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
    }

    #cw-panel .cw-whatsapp-cta {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-top: 10px;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.35;
    }

    #cw-panel .cw-whatsapp-btn {
        display: inline-flex;
        padding: 7px 11px;
        align-items: center;
        gap: 6px;
        border-radius: 6px;
        background: #25d366;
        color: #fff !important;
        text-decoration: none !important;
        white-space: nowrap;
    }

.cw-head {
    background: linear-gradient(135deg, var(--cw-accent), var(--cw-accent-dark));
    color: #fff;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 700;
}

.cw-stage {
    display: grid;
    overflow: hidden;
}

.cw-screen {
    padding: 14px;
    overflow: auto;
}

.cw-label {
    display: block;
    width: 100%;
    padding: 0;
    margin-bottom: 4px;
    color: var(--cw-muted);
    font-size: 0.82rem;
}

.cw-input, .cw-textarea {
    width: 100%;
    border: 1px solid #c5d7e8;
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    margin-bottom: 2px;
}

.cw-textarea {
    min-height: 82px;
    resize: vertical;
}

.cw-btn {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--cw-accent), var(--cw-accent-dark));
    color: #fff;
    padding: 10px;
    font-weight: 700;
    cursor: pointer;
}

.cw-note {
    font-size: 0.84rem;
    color: var(--cw-muted);
    margin: 0 0 12px;
}

.cw-messages {
    display: grid;
    align-content: start;
    gap: 10px;
}

.cw-msg {
    max-width: 85%;
    border: 1px solid #cfdeec;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.87rem;
    line-height: 1.4;
    color: var(--cw-ink);
}

    .cw-msg.cw-agent {
        margin-left: auto;
        background: #ebf5ff;
        border-color: #bfdcf6;
    }

.cw-chat-form {
    padding: 10px;
    border-top: 1px solid var(--cw-line);
    display: grid;
    grid-template-columns: 1fr 88px;
    gap: 8px;
}

.cw-footer {
    padding: 8px 12px;
    border-top: 1px solid var(--cw-line);
    font-size: 0.78rem;
    color: var(--cw-muted);
}
#cw-panel .cw-input,
#cw-panel .cw-textarea {
    color: var(--cw-ink) !important;
    background-color: #fff !important;
    -webkit-text-fill-color: var(--cw-ink) !important;
    caret-color: var(--cw-ink);
}
    #cw-panel .cw-input:-webkit-autofill,
    #cw-panel .cw-input:-webkit-autofill:hover,
    #cw-panel .cw-input:-webkit-autofill:focus,
    #cw-panel .cw-input:-webkit-autofill:active {
        -webkit-text-fill-color: var(--cw-ink) !important;
        -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    }

@media (max-width: 640px) {
    #cw-panel {
        right: 10px;
        left: 10px;
        width: auto;
    }

    #cw-launcher {
        right: 10px;
        bottom: 75px;
    }
}

#cw-panel .cw-head,
#cw-panel .cw-head-title,
#cw-panel #cw-close {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

#cw-panel .cw-head {
    position: relative;
    z-index: 2;
}

/* Prevent host-page color rules from hiding conversation text. */
#cw-panel .cw-msg,
#cw-panel .cw-msg strong {
    color: var(--cw-ink) !important;
    -webkit-text-fill-color: var(--cw-ink) !important;
    opacity: 1 !important;
}

#cw-panel .cw-msg {
    background-color: #fff !important;
}

    #cw-panel .cw-msg.cw-agent {
        background-color: #ebf5ff !important;
        border-color: #bfdcf6 !important;
    }

/* Give the panel more room when browser zoom reduces viewport height. */
@media (max-height: 700px) {
    #cw-panel {
        top: 10px;
        bottom: 10px;
        max-height: none;
    }
}


#cw-launcher::before {
    content: "\f232";
    font-family: "Font Awesome 6 Brands";
    margin-right: 6px;
}