#qi-chatbot-widget {
    --qi-chatbot-brand: #ff6550;
    --qi-chatbot-brand-dark: #f34f48;
    --qi-chatbot-accent: #00b8a9;
    font-family: inherit;
}

.qi-chatbot-launcher {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 62px;
    height: 62px;
    padding: 0 21px;
    border: 0;
    border-radius: 32px;
    background: linear-gradient(120deg, var(--qi-chatbot-brand), var(--qi-chatbot-brand-dark));
    color: #fff;
    box-shadow: 0 8px 24px rgba(243, 79, 72, .35);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.qi-chatbot-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(243, 79, 72, .42);
}

.qi-chatbot-launcher:focus-visible {
    outline: 3px solid #00b8a9;
    outline-offset: 3px;
}

.qi-chatbot-launcher svg {
    display: block;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.qi-chatbot-launcher[hidden] {
    display: none;
}

.qi-chatbot-panel {
    position: fixed;
    right: 24px;
    bottom: 98px;
    z-index: 16000161;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 32px));
    height: min(590px, calc(100vh - 125px));
    min-height: 360px;
    overflow: hidden;
    border: 1px solid #d5deea;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 36px rgba(20, 45, 80, .24);
}

.qi-chatbot-panel[hidden],
.qi-chatbot-content[hidden] {
    display: none;
}

.qi-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 12px 14px 16px;
    background: linear-gradient(120deg, var(--qi-chatbot-brand), var(--qi-chatbot-brand-dark));
    color: #fff;
}

.qi-chatbot-header strong,
.qi-chatbot-header div:first-child span {
    display: block;
}

.qi-chatbot-header div:first-child span {
    margin-top: 3px;
    font-size: 12px;
    opacity: .9;
}

.qi-chatbot-header-actions {
    display: flex;
    gap: 3px;
}

.qi-chatbot-header-actions button {
    min-width: 29px;
    padding: 5px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}

.qi-chatbot-header-actions button:hover,
.qi-chatbot-header-actions button:focus {
    background: rgba(255, 255, 255, .18);
}

.qi-chatbot-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    background: #f5f8fc;
}

.qi-chatbot-messages {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
}

.qi-chatbot-message {
    width: fit-content;
    max-width: 88%;
    margin: 0 0 11px;
    padding: 10px 12px;
    border-radius: 12px;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.45;
}

.qi-chatbot-message p {
    margin: 0;
    white-space: pre-wrap;
}

.qi-chatbot-message-bot {
    border: 1px solid #e0e7f0;
    border-bottom-left-radius: 3px;
    background: #fff;
    color: #27364a;
}

.qi-chatbot-message-visitor {
    margin-left: auto;
    border-bottom-right-radius: 3px;
    background: var(--qi-chatbot-brand-dark);
    color: #fff;
}

.qi-chatbot-message-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 8px;
}

.qi-chatbot-message-links a {
    color: var(--qi-chatbot-brand-dark);
    font-size: 13px;
    text-decoration: underline;
}

.qi-chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 13px 10px;
}

.qi-chatbot-quick-replies[hidden] {
    display: none;
}

.qi-chatbot-quick-replies button {
    padding: 6px 10px;
    border: 1px solid var(--qi-chatbot-accent);
    border-radius: 18px;
    background: #fff;
    color: #176f70;
    font-size: 12px;
    cursor: pointer;
}

.qi-chatbot-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0 16px 10px;
}

.qi-chatbot-typing[hidden] {
    display: none;
}

.qi-chatbot-typing > span:not(.qi-chatbot-sr-only) {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6984a2;
    animation: qi-chatbot-pulse 1s infinite ease-in-out;
}

.qi-chatbot-typing > span:nth-child(2) {
    animation-delay: .15s;
}

.qi-chatbot-typing > span:nth-child(3) {
    animation-delay: .3s;
}

.qi-chatbot-compose {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e1e7ef;
    background: #fff;
}

.qi-chatbot-compose input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 8px 10px;
    border: 1px solid #ccd6e2;
    border-radius: 7px;
    font-size: 14px;
}

.qi-chatbot-compose button {
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: var(--qi-chatbot-brand-dark);
    color: #fff;
    cursor: pointer;
}

.qi-chatbot-contact {
    padding: 0 12px 10px;
}

.qi-chatbot-contact form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 10px;
    border: 1px solid #dce5ef;
    border-radius: 8px;
    background: #fff;
}

.qi-chatbot-contact label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #41536a;
    font-size: 11px;
}

.qi-chatbot-contact input,
.qi-chatbot-contact textarea {
    width: 100%;
    min-height: 32px;
    padding: 6px;
    border: 1px solid #ccd6e2;
    border-radius: 5px;
    font: inherit;
    font-size: 12px;
}

.qi-chatbot-contact textarea,
.qi-chatbot-contact .qi-chatbot-contact-submit,
.qi-chatbot-contact .qi-chatbot-form-error {
    grid-column: 1 / -1;
}

.qi-chatbot-contact textarea {
    min-height: 60px;
    resize: vertical;
}

.qi-chatbot-contact .qi-chatbot-contact-submit {
    padding: 7px;
    border: 0;
    border-radius: 5px;
    background: var(--qi-chatbot-brand-dark);
    color: #fff;
    cursor: pointer;
}

.qi-chatbot-form-error {
    margin: 0;
    color: #a32323;
    font-size: 12px;
}

.qi-chatbot-history {
    max-height: 160px;
    overflow-y: auto;
    padding: 8px;
    border-bottom: 1px solid #e1e7ef;
    background: #fff;
}

.qi-chatbot-history button {
    display: block;
    width: 100%;
    margin: 0 0 5px;
    padding: 8px;
    border: 1px solid #e1e7ef;
    border-radius: 6px;
    background: #fff;
    color: #27364a;
    text-align: left;
    cursor: pointer;
}

.qi-chatbot-history button span {
    display: block;
    overflow: hidden;
    color: #60738a;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qi-chatbot-history[hidden],
.qi-chatbot-contact[hidden] {
    display: none;
}

.qi-chatbot-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@keyframes qi-chatbot-pulse {
    0%, 80%, 100% { opacity: .35; transform: scale(.8); }
    40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
    .qi-chatbot-launcher {
        right: 16px;
        bottom: 18px;
    }

    .qi-chatbot-panel {
        right: 8px;
        bottom: 12px;
        width: calc(100vw - 32px);
        height: min(650px, calc(100dvh - 24px));
        min-height: min(360px, calc(100dvh - 24px));
    }
}

@media (max-width: 360px) {
    .qi-chatbot-header {
        gap: 4px;
        padding: 10px 8px 10px 10px;
    }

    .qi-chatbot-header strong {
        font-size: 13px;
        white-space: nowrap;
    }

    .qi-chatbot-header div:first-child span {
        display: none;
    }

    .qi-chatbot-header-actions {
        gap: 2px;
    }

    .qi-chatbot-header-actions button {
        min-width: 27px;
        padding: 4px;
        font-size: 10px;
    }

    .qi-chatbot-launcher {
        width: 58px;
        min-width: 58px;
        height: 58px;
        padding: 0;
        border-radius: 50%;
    }

    .qi-chatbot-launcher-label {
        display: none;
    }

}

@media (prefers-reduced-motion: reduce) {
    .qi-chatbot-typing > span:not(.qi-chatbot-sr-only) {
        animation: none;
    }
}
