.polycc-faq-chat,
.polycc-faq-chat * {
    box-sizing: border-box;
}

.polycc-faq-chat {
    position: fixed;
    right: 24px;
    bottom: 22px;
    z-index: 999990;
    font-family: Montserrat, Arial, sans-serif;
    letter-spacing: 0;
}

.polycc-faq-chat--left {
    right: auto;
    left: 24px;
}

.polycc-faq-launcher {
    position: relative;
    display: grid;
    width: var(--polycc-faq-avatar-size, 72px);
    height: var(--polycc-faq-avatar-size, 72px);
    padding: 3px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--polycc-faq-primary);
    box-shadow: 0 12px 32px rgba(22, 32, 75, .25);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.polycc-faq-launcher:hover,
.polycc-faq-launcher:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 16px 38px rgba(22, 32, 75, .32);
}

.polycc-faq-launcher:focus-visible,
.polycc-faq-panel button:focus-visible,
.polycc-faq-panel textarea:focus-visible {
    outline: 3px solid rgba(74, 104, 230, .35);
    outline-offset: 3px;
}

.polycc-faq-launcher img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 9%;
    background: #eef2fb;
}

.polycc-faq-launcher__status {
    position: absolute;
    right: 1px;
    bottom: 5px;
    width: 15px;
    height: 15px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #9aa7bd;
}

.polycc-faq-chat.has-admin .polycc-faq-launcher__status { background: #39b96f; }
.polycc-faq-chat.has-unread .polycc-faq-launcher__status { background: #ef683a; }
.polycc-faq-chat [hidden] { display: none !important; }
.polycc-faq-live-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; background: #fff; }
.polycc-faq-live-actions button { padding: 6px 10px; border: 1px solid #cdd5ec; border-radius: 5px; color: var(--polycc-faq-primary); background: #f0f3ff; font: 600 11px/1.4 Montserrat, Arial, sans-serif; cursor: pointer; }
.polycc-faq-live-actions button:disabled { opacity: .6; cursor: wait; }
.polycc-faq-live-actions [data-live-notice] { color: #626d87; font-size: 11px; line-height: 1.4; }
.polycc-faq-message__plain { white-space: pre-wrap; }
.polycc-faq-message__sender { display: block; margin-bottom: 5px; color: var(--polycc-faq-primary); font-size: 10px; }
.polycc-faq-message--admin .polycc-faq-message__bubble { border: 1px solid #cdd5ec; background: #eef3ff; }
.polycc-faq-message--system { justify-content: center; }
.polycc-faq-message--system .polycc-faq-message__bubble { max-width: 100%; background: transparent; box-shadow: none; color: #626d87; font-size: 11px; text-align: center; }
@media (max-width: 600px) { .polycc-faq-chat.has-unread:not(.is-open) .polycc-faq-launcher__label { display: block; } }

.polycc-faq-launcher__label {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    width: max-content;
    padding: 8px 11px;
    border-radius: 6px;
    color: #fff;
    background: #19265f;
    box-shadow: 0 6px 18px rgba(20, 28, 61, .16);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-50%);
    pointer-events: none;
}

.polycc-faq-launcher__label::after {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    border: 5px solid transparent;
    border-left-color: #19265f;
    transform: translateY(-50%);
}

.polycc-faq-chat--left .polycc-faq-launcher__label {
    right: auto;
    left: calc(100% + 10px);
}

.polycc-faq-chat--left .polycc-faq-launcher__label::after {
    right: 100%;
    left: auto;
    border-right-color: #19265f;
    border-left-color: transparent;
}

.polycc-faq-panel {
    position: absolute;
    right: 0;
    bottom: calc(var(--polycc-faq-avatar-size, 72px) + 16px);
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 28px));
    height: min(620px, calc(100vh - 130px));
    min-height: 440px;
    overflow: hidden;
    border: 1px solid #dfe4f2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(23, 35, 79, .24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

.polycc-faq-chat--left .polycc-faq-panel {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.polycc-faq-chat.is-open .polycc-faq-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.polycc-faq-chat.is-open .polycc-faq-launcher__label {
    display: none;
}

.polycc-faq-panel__header {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 11px;
    min-height: 84px;
    padding: 12px 13px;
    color: #fff;
    background: var(--polycc-faq-primary);
}

.polycc-faq-panel__avatar {
    display: block;
    width: 58px;
    height: 58px;
    border: 2px solid rgba(255, 255, 255, .8);
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 9%;
    background: #eef2fb;
}

.polycc-faq-panel__identity {
    min-width: 0;
}

.polycc-faq-panel__identity strong,
.polycc-faq-panel__identity span {
    display: block;
}

.polycc-faq-panel__identity strong {
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.polycc-faq-panel__identity span {
    margin-top: 3px;
    color: rgba(255, 255, 255, .82);
    font-size: 11px;
    line-height: 1.3;
}

.polycc-faq-panel__identity i {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #51d88a;
}

.polycc-faq-panel__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    font: 400 27px/1 Arial, sans-serif;
    cursor: pointer;
}

.polycc-faq-panel__close:hover {
    background: rgba(255, 255, 255, .22);
}

.polycc-faq-messages {
    flex: 1;
    min-height: 0;
    padding: 16px 14px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f5f7fc;
    scrollbar-width: thin;
    scrollbar-color: #c6cde2 transparent;
}

.polycc-faq-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}

.polycc-faq-message > img {
    flex: 0 0 34px;
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 9%;
    background: #e6ebf7;
}

.polycc-faq-message__bubble {
    max-width: calc(100% - 50px);
    padding: 10px 12px;
    border-radius: 6px 6px 6px 2px;
    color: #27304f;
    background: #fff;
    box-shadow: 0 2px 8px rgba(29, 42, 88, .08);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.polycc-faq-message__bubble p {
    margin: 0 0 8px;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.polycc-faq-message__bubble p:last-child {
    margin-bottom: 0;
}

.polycc-faq-message__bubble a {
    color: var(--polycc-faq-primary);
    font-weight: 700;
    text-decoration: underline;
}

.polycc-faq-message--user {
    justify-content: flex-end;
}

.polycc-faq-message--user .polycc-faq-message__bubble {
    color: #fff;
    background: var(--polycc-faq-primary);
    border-radius: 6px 6px 2px 6px;
    box-shadow: none;
}

.polycc-faq-message--typing .polycc-faq-message__bubble {
    display: flex;
    gap: 4px;
    padding: 13px 15px;
}

.polycc-faq-message--typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #98a1bd;
    animation: polyccFaqTyping 1s infinite ease-in-out;
}

.polycc-faq-message--typing i:nth-child(2) { animation-delay: .15s; }
.polycc-faq-message--typing i:nth-child(3) { animation-delay: .3s; }

@keyframes polyccFaqTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: .55; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.polycc-faq-suggestions {
    display: grid;
    gap: 7px;
    margin: 2px 0 14px 42px;
}

.polycc-faq-suggestions > span {
    color: #737d9c;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.polycc-faq-suggestions button {
    width: fit-content;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid #cdd5ec;
    border-radius: 5px;
    color: var(--polycc-faq-primary);
    background: #fff;
    font: 600 11px/1.4 Montserrat, Arial, sans-serif;
    text-align: left;
    cursor: pointer;
}

.polycc-faq-suggestions button:hover {
    border-color: var(--polycc-faq-primary);
    background: #f0f3ff;
}

.polycc-faq-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e2e6f1;
    background: #fff;
}

.polycc-faq-form textarea {
    display: block;
    width: 100%;
    min-height: 42px;
    max-height: 104px;
    margin: 0;
    padding: 10px 12px;
    resize: none;
    border: 1px solid #d2d8e7;
    border-radius: 6px;
    color: #242c4a;
    background: #fff;
    font: 400 13px/1.5 Montserrat, Arial, sans-serif;
    box-shadow: none;
}

.polycc-faq-form textarea:focus {
    border-color: var(--polycc-faq-primary);
}

.polycc-faq-form button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    color: #fff;
    background: var(--polycc-faq-primary);
    cursor: pointer;
}

.polycc-faq-form button:disabled {
    opacity: .55;
    cursor: wait;
}

.polycc-faq-panel__note {
    margin: 0;
    padding: 0 12px 8px;
    color: #8b93aa;
    background: #fff;
    font-size: 9px;
    line-height: 1.3;
    text-align: center;
}

@media (max-width: 600px) {
    .polycc-faq-chat,
    .polycc-faq-chat--left {
        right: 12px;
        bottom: 12px;
        left: auto;
    }

    .polycc-faq-launcher {
        width: var(--polycc-faq-avatar-size-mobile, 62px);
        height: var(--polycc-faq-avatar-size-mobile, 62px);
    }

    .polycc-faq-launcher__label {
        display: none;
    }

    .polycc-faq-panel,
    .polycc-faq-chat--left .polycc-faq-panel {
        position: fixed;
        right: 8px;
        bottom: calc(var(--polycc-faq-avatar-size-mobile, 62px) + 20px);
        left: 8px;
        width: auto;
        height: min(620px, calc(100dvh - 94px));
        min-height: 390px;
        transform-origin: bottom right;
    }

    .polycc-faq-panel__header {
        grid-template-columns: 50px minmax(0, 1fr) 36px;
        min-height: 74px;
        padding: 10px 11px;
    }

    .polycc-faq-panel__avatar {
        width: 50px;
        height: 50px;
    }

    .polycc-faq-messages {
        padding: 13px 11px 8px;
    }

    .polycc-faq-message__bubble {
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .polycc-faq-launcher,
    .polycc-faq-panel,
    .polycc-faq-message--typing i {
        transition: none;
        animation: none;
    }
}
