.site-chat {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 120;
}

.site-chat__toggle {
    border: 0;
    border-radius: 999px;
    min-height: 58px;
    padding: 0 20px 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #0f63b8 0%, #268be2 100%);
    color: #fff;
    box-shadow: 0 18px 34px rgba(15, 99, 184, 0.28);
    font-size: 15px;
    font-weight: 700;
}

.site-chat--open .site-chat__toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.site-chat__toggle-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.18);
}

.site-chat__panel {
    width: min(380px, calc(100vw - 24px));
    margin-top: 12px;
    margin-left: auto;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f6faff 100%);
    border: 1px solid rgba(193, 215, 244, 0.96);
    box-shadow: 0 24px 52px rgba(14, 53, 111, 0.18);
    position: relative;
}

.site-chat__panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

.site-chat__head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    background: linear-gradient(135deg, #10356b 0%, #166fc4 100%);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.site-chat__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-chat__back {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    flex: 0 0 36px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.site-chat__back[hidden] {
    display: none !important;
}

.site-chat__brand-logo,
.site-chat__powered-logo {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: block;
    object-fit: contain;
    background: rgba(255,255,255,.14);
    padding: 4px;
    flex: 0 0 36px;
}

.site-chat__brand strong,
.site-chat__brand span {
    display: block;
}

.site-chat__brand strong {
    font-size: 15px;
    line-height: 1.2;
}

.site-chat__brand span {
    font-size: 12px;
    opacity: .84;
}

.site-chat__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 28px;
    line-height: 1;
}

.site-chat__body {
    padding: 16px;
}

.site-chat__body--compact .site-chat__messages:empty {
    display: none;
}

.site-chat__messages {
    display: grid;
    gap: 10px;
    max-height: 280px;
    overflow: auto;
    padding-right: 8px;
    margin-right: -2px;
    margin-bottom: 2px;
    scrollbar-width: thin;
    scrollbar-color: #c8d7ef transparent;
}

.site-chat__messages::-webkit-scrollbar {
    width: 6px;
}

.site-chat__messages::-webkit-scrollbar-track {
    background: transparent;
}

.site-chat__messages::-webkit-scrollbar-thumb {
    background: #c8d7ef;
    border-radius: 999px;
}

.site-chat__bubble {
    max-width: 88%;
    border-radius: 18px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.site-chat__bubble--system {
    background: #edf6ff;
    color: #123b76;
}

.site-chat__bubble--visitor {
    background: #10356b;
    color: #fff;
    margin-left: auto;
}

.site-chat__bubble--admin {
    background: #ffffff;
    border: 1px solid #dbe7f9;
    color: #173153;
}

.site-chat__typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 18px;
    background: #edf6ff;
    width: fit-content;
}

.site-chat__typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5e83b5;
    animation: siteChatTyping 1.1s infinite ease-in-out;
}

.site-chat__typing span:nth-child(2) { animation-delay: .15s; }
.site-chat__typing span:nth-child(3) { animation-delay: .3s; }

@keyframes siteChatTyping {
    0%, 80%, 100% { transform: scale(.6); opacity: .5; }
    40% { transform: scale(1); opacity: 1; }
}

.site-chat__attachment {
    display: block;
    margin-top: 10px;
    max-width: 100%;
    border-radius: 14px;
}

.site-chat__attachment-link {
    display: block;
    margin-top: 10px;
    cursor: zoom-in;
}

.site-chat__image-modal {
    position: absolute;
    inset: 0;
    z-index: 30;
}

.site-chat__image-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 25, 56, 0.72);
    backdrop-filter: blur(2px);
}

.site-chat__image-dialog {
    position: absolute;
    inset: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 24px 48px rgba(6, 22, 54, 0.28);
}

.site-chat__image-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 99, 184, 0.92);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.site-chat__image-full {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
}

.site-chat__capture {
    margin-top: 14px;
}

.site-chat__prechat {
    display: grid;
    gap: 12px;
}

.site-chat__prechat-copy {
    padding: 4px 2px 2px;
}

.site-chat__prechat-copy strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    color: #173153;
}

.site-chat__intro-bubble {
    margin-bottom: 12px;
    padding: 14px 16px;
    border-radius: 22px;
    background: #edf6ff;
    color: #204d82;
    line-height: 1.65;
}

.site-chat__start {
    display: grid;
    gap: 12px;
}

.site-chat__start-copy {
    padding: 4px 2px 2px;
}

.site-chat__start-copy {
    display: grid;
    gap: 4px;
}

.site-chat__start-copy strong {
    font-size: 14px;
    line-height: 1.25;
    color: #173153;
}

.site-chat__start-copy span {
    font-size: 12px;
    line-height: 1.5;
    color: #6f83a3;
}

.site-chat__start {
    display: grid;
    gap: 9px;
}

.site-chat__choice {
    width: 100%;
    border: 1px solid #d6e4fb;
    border-radius: 20px;
    background: #fff;
    padding: 15px 16px;
    text-align: left;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    gap: 12px;
    color: #173153;
    align-items: center;
}

.site-chat__choice-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef5ff;
    color: #17559f;
    font-size: 17px;
}

.site-chat__choice--whatsapp .site-chat__choice-icon {
    background: rgba(37, 211, 102, 0.12);
    color: #1aa34a;
}

.site-chat__choice-content {
    display: grid;
    gap: 4px;
}

.site-chat__choice-title {
    font-size: 14px;
    font-weight: 700;
}

.site-chat__choice-text {
    font-size: 12px;
    line-height: 1.5;
    color: #6f83a3;
}

.site-chat__choice--primary {
    align-items: center;
    background: #eef5ff;
}

.site-chat__choice-arrow {
    color: #1c74d8;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-chat__nav {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    justify-content: center;
    gap: 14px;
    padding-top: 6px;
}

.site-chat__nav-item {
    width: 56px;
    height: 56px;
    border: 1px solid #d6e4fb;
    border-radius: 18px;
    background: #fff;
    color: #6f83a3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.site-chat__nav-item i {
    font-size: 20px;
}

.site-chat__nav-item span {
    display: none;
}

.site-chat__nav-item.is-active,
.site-chat__nav-item:hover {
    color: #17559f;
    background: #eef5ff;
}

.site-chat__capture-flow {
    display: grid;
}

.site-chat__prechat[hidden],
.site-chat__capture-flow[hidden],
.site-chat__composer[hidden],
.site-chat__start[hidden] {
    display: none !important;
}

.site-chat__prechat {
    margin-bottom: 14px;
}

.site-chat__fields {
    display: grid;
    gap: 10px;
}

.site-chat__fields input,
.site-chat__composer textarea {
    width: 100%;
    border: 1px solid #d6e4fb;
    border-radius: 16px;
    background: #fff;
    outline: none;
    font: inherit;
    color: #173153;
}

.site-chat__fields input {
    min-height: 46px;
    padding: 0 14px;
}

.site-chat__check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #173153;
    font-size: 13px;
    line-height: 1.45;
}

.site-chat__check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #1b75d6;
}

.site-chat__profile-submit {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #1669ca, #2594f2);
    color: #fff;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 14px 32px rgba(37, 117, 214, 0.22);
}

.site-chat__composer {
    margin-top: 14px;
    position: relative;
    border-top: 1px solid #dfe9f7;
    padding-top: 14px;
}

.site-chat__composer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.72);
}

.site-chat__composer textarea {
    min-height: 26px;
    max-height: 104px;
    padding: 0;
    resize: none;
    overflow-y: hidden;
    line-height: 1.55;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.site-chat__composer textarea:focus {
    border: 0;
    box-shadow: none;
    outline: none;
}

.site-chat__composer textarea {
    scrollbar-width: thin;
    scrollbar-color: #c5d8f6 transparent;
}

.site-chat__composer textarea::-webkit-scrollbar {
    width: 4px;
}

.site-chat__composer textarea::-webkit-scrollbar-track {
    background: transparent;
}

.site-chat__composer textarea::-webkit-scrollbar-thumb {
    background: #c5d8f6;
    border-radius: 999px;
}

.site-chat__preview {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #d6e4fb;
    border-radius: 14px;
    background: #f8fbff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: #173153;
}

.site-chat__preview button {
    border: 0;
    background: transparent;
    color: #17559f;
}

.site-chat__actions {
    display: grid;
    grid-template-columns: 1fr 42px 42px 64px;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e8effa;
    align-items: center;
}

.site-chat__actions-left,
.site-chat__actions-right {
    display: contents;
}

.site-chat__wa,
.site-chat__send {
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.site-chat__wa {
    border: 1px solid #cde0fb;
    background: #fff;
    color: #17559f;
    gap: 8px;
}

.site-chat__tool {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: #eef5ff;
    color: #17559f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.site-chat__send {
    border: 0;
    background: linear-gradient(135deg, #0f63b8 0%, #268be2 100%);
    color: #fff;
    min-width: 0;
    width: 64px;
    padding: 0;
}

.site-chat__send-icon {
    font-size: 22px;
    line-height: 1;
    transform: translateX(1px);
}

.site-chat__tool--emoji {
    font-size: 20px;
}

.site-chat__emoji-picker {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 12px);
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border-radius: 18px;
    background: #f7fbff;
    border: 1px solid #dce9fb;
    box-shadow: 0 18px 34px rgba(14, 53, 111, 0.16);
    max-height: 220px;
    overflow-y: auto;
}

.site-chat__emoji-picker button {
    border: 0;
    background: #fff;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 18px;
    line-height: 1;
}

.site-chat__footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    font-size: 11px;
    color: #6f83a3;
}

.site-chat__powered {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.site-chat__powered span,
.site-chat__limit {
    white-space: nowrap;
}

.site-chat__powered-logo {
    width: 18px;
    height: 18px;
    padding: 2px;
    border-radius: 8px;
}

.site-chat__help {
    margin: 8px 2px 0;
    font-size: 12px;
    line-height: 1.5;
    color: #6f83a3;
    min-height: 18px;
}

@media (max-width: 767px) {
    .site-chat {
        right: 8px;
        bottom: 8px;
        top: 72px;
        left: 8px;
        display: flex;
        justify-content: flex-end;
        align-items: flex-end;
        pointer-events: none;
    }

    .site-chat > * {
        pointer-events: auto;
    }

    .site-chat__toggle {
        min-height: 52px;
        padding: 0 16px 0 14px;
        margin-left: auto;
    }

    .site-chat__toggle-label {
        display: none;
    }

    .site-chat__panel {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 84px);
        display: flex;
        flex-direction: column;
    }

    .site-chat__body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .site-chat__actions {
        grid-template-columns: 40px 40px 58px;
        gap: 8px;
    }

    .site-chat__wa,
    .site-chat__send {
        min-height: 42px;
        padding: 0 12px;
        font-size: 13px;
    }

    .site-chat__send {
        width: 58px;
    }

    .site-chat__tool {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .site-chat__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .site-chat__choice {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 14px;
    }

    .site-chat__choice-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .site-chat__composer textarea {
        min-height: 28px;
        max-height: 96px;
    }

    .site-chat__powered,
    .site-chat__limit {
        white-space: normal;
        line-height: 1.35;
    }

    .site-chat__emoji-picker {
        left: 0;
        right: 0;
        bottom: 104px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        max-height: 200px;
    }
}

.site-chat__actions-left:empty { display:none; }
.site-chat__actions { grid-template-columns: 42px 42px 64px; justify-content: end; }

@media (max-width: 767px) {
    .site-chat__nav {
        gap: 8px;
    }
    .site-chat__nav-item {
        min-height: 58px;
        border-radius: 16px;
        font-size: 11px;
    }
    .site-chat__choice--primary {
        grid-template-columns: 40px minmax(0, 1fr) 16px;
    }
}
