.cpts-chatbot {
    --cpts-chat-blue: #1f4f9a;
    --cpts-chat-sky: #6dbee2;
    --cpts-chat-yellow: #f8be3e;
    --cpts-chat-ice: #ecf7fd;
    --cpts-chat-white: #ffffff;
    --cpts-chat-text: #18345c;
    --cpts-chat-muted: #667c99;
    --cpts-chat-border: #d9eaf5;
    --cpts-chat-accent: #ca3d73;
    --cpts-chat-warning: #fff8e8;
    --cpts-chat-radius: 24px;
    --cpts-chat-shadow: 0 24px 64px rgba(31, 79, 154, 0.2);
    --cpts-chat-transition: 180ms cubic-bezier(0.2, 0.72, 0.3, 1);

    position: relative;
    z-index: 99990;
    color: var(--cpts-chat-text);
    font: inherit;
}

.cpts-chatbot *,
.cpts-chatbot *::before,
.cpts-chatbot *::after {
    box-sizing: border-box;
}

.cpts-chatbot button,
.cpts-chatbot a {
    font: inherit;
}

.cpts-chatbot button.cpts-chatbot__trigger,
.cpts-chatbot button.cpts-chatbot__icon-button,
.cpts-chatbot button.cpts-chatbot__choice,
.cpts-chatbot a.cpts-chatbot__choice,
.cpts-chatbot button.cpts-chatbot__footer-button {
    appearance: none;
    -webkit-appearance: none;
}

.cpts-chatbot button.cpts-chatbot__trigger {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 74px;
    padding: 10px 22px 10px 12px;
    border: 1px solid rgba(202, 61, 115, 0.5);
    border-radius: 999px;
    background: var(--cpts-chat-white);
    color: var(--cpts-chat-blue);
    box-shadow: 0 18px 42px rgba(31, 79, 154, 0.18);
    cursor: pointer;
    text-decoration: none;
    transition:
        transform var(--cpts-chat-transition),
        box-shadow var(--cpts-chat-transition),
        border-color var(--cpts-chat-transition),
        background-color var(--cpts-chat-transition);
}

.cpts-chatbot button.cpts-chatbot__trigger:hover {
    transform: translateY(-2px);
    border-color: rgba(202, 61, 115, 0.7);
    box-shadow: 0 22px 48px rgba(31, 79, 154, 0.22);
}

.cpts-chatbot button.cpts-chatbot__trigger:active {
    transform: translateY(0) scale(0.985);
}

.cpts-chatbot__trigger:focus-visible,
.cpts-chatbot__choice:focus-visible,
.cpts-chatbot__icon-button:focus-visible,
.cpts-chatbot__footer-button:focus-visible,
.cpts-chatbot__card--link:focus-visible {
    outline: 3px solid rgba(248, 190, 62, 0.82);
    outline-offset: 2px;
}

.cpts-chatbot__trigger-icon {
    display: inline-grid;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    place-items: center;
    border-radius: 50%;
    background: var(--cpts-chat-yellow);
    color: var(--cpts-chat-blue);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.cpts-chatbot__trigger-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    color: var(--cpts-chat-accent);
}

.cpts-chatbot__panel {
    position: fixed;
    right: 24px;
    bottom: 110px;
    width: min(420px, calc(100vw - 32px));
    height: min(650px, calc(100vh - 142px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(109, 190, 226, 0.34);
    border-radius: var(--cpts-chat-radius);
    background: var(--cpts-chat-white);
    box-shadow: var(--cpts-chat-shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(14px) scale(0.975);
    transform-origin: bottom right;
    transition:
        opacity var(--cpts-chat-transition),
        transform var(--cpts-chat-transition),
        visibility var(--cpts-chat-transition);
}

.cpts-chatbot.is-open .cpts-chatbot__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.cpts-chatbot__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 86px;
    padding: 14px 18px;
    background: var(--cpts-chat-blue);
    color: var(--cpts-chat-white);
}

.cpts-chatbot__header::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--cpts-chat-yellow);
    content: '';
}

.cpts-chatbot__brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 14px;
}

.cpts-chatbot__avatar {
    display: inline-grid;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    place-items: center;
    border-radius: 18px;
    background: var(--cpts-chat-white);
    color: var(--cpts-chat-blue);
}

.cpts-chatbot__title {
    display: block;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.018em;
    color: var(--cpts-chat-white);
}

.cpts-chatbot__subtitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.82);
}

.cpts-chatbot__status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--cpts-chat-yellow);
    box-shadow: 0 0 0 4px rgba(248, 190, 62, 0.16);
}

.cpts-chatbot button.cpts-chatbot__icon-button {
    display: inline-grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    cursor: pointer;
    transition:
        transform var(--cpts-chat-transition),
        background-color var(--cpts-chat-transition),
        border-color var(--cpts-chat-transition),
        color var(--cpts-chat-transition);
}

.cpts-chatbot button.cpts-chatbot__icon-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.42);
    color: #FFFFFF;
}

.cpts-chatbot__messages {
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    padding: 20px 18px;
    background: var(--cpts-chat-ice);
    scrollbar-color: rgba(31, 79, 154, 0.24) transparent;
    scrollbar-width: thin;
}

.cpts-chatbot__turn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    gap: 10px;
    margin-bottom: 15px;
}

.cpts-chatbot__turn--user {
    align-items: flex-end;
}

.cpts-chatbot__turn.is-animated {
    animation: cpts-chat-message-in 180ms cubic-bezier(0.2, 0.72, 0.3, 1) both;
}

.cpts-chatbot__bubble {
    max-width: 92%;
    min-width: 0;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.56;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cpts-chatbot__bubble--bot {
    padding: 14px 15px;
    border: 1px solid rgba(109, 190, 226, 0.28);
    border-bottom-left-radius: 8px;
    background: var(--cpts-chat-white);
    color: var(--cpts-chat-text);
    box-shadow: 0 6px 20px rgba(31, 79, 154, 0.055);
}

.cpts-chatbot__bubble--user {
    padding: 11px 14px;
    border-bottom-right-radius: 8px;
    background: var(--cpts-chat-blue);
    color: var(--cpts-chat-white);
    box-shadow: 0 7px 18px rgba(31, 79, 154, 0.16);
}

.cpts-chatbot__text + .cpts-chatbot__text,
.cpts-chatbot__text + .cpts-chatbot__notice,
.cpts-chatbot__notice + .cpts-chatbot__text,
.cpts-chatbot__cards + .cpts-chatbot__text {
    margin-top: 10px;
}

.cpts-chatbot__notice {
    padding: 11px 12px;
    border: 1px solid rgba(248, 190, 62, 0.72);
    border-radius: 14px;
    background: var(--cpts-chat-warning);
    color: #67501b;
}

.cpts-chatbot__cards {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.cpts-chatbot__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid var(--cpts-chat-border);
    border-radius: 18px;
    background: #f8fcff;
    color: inherit;
    text-decoration: none;
}

.cpts-chatbot__card--link {
    transition:
        transform var(--cpts-chat-transition),
        border-color var(--cpts-chat-transition),
        background-color var(--cpts-chat-transition),
        box-shadow var(--cpts-chat-transition);
}

.cpts-chatbot__card--link:hover {
    transform: translateY(-1px);
    border-color: var(--cpts-chat-sky);
    background: var(--cpts-chat-white);
    box-shadow: 0 7px 18px rgba(31, 79, 154, 0.075);
    color: inherit;
    text-decoration: none;
}

.cpts-chatbot__card-content {
    min-width: 0;
}

.cpts-chatbot__card strong {
    display: block;
    margin-bottom: 3px;
    color: var(--cpts-chat-blue);
    font-size: 13px;
    line-height: 1.35;
}

.cpts-chatbot__card p {
    margin: 0;
    color: var(--cpts-chat-muted);
    font-size: 12px;
    line-height: 1.45;
}

.cpts-chatbot__card-arrow {
    display: inline-grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 10px;
    background: var(--cpts-chat-ice);
    color: var(--cpts-chat-blue);
    font-size: 13px;
    font-weight: 700;
}

.cpts-chatbot__choices {
    display: grid;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 10px;
}

.cpts-chatbot button.cpts-chatbot__choice,
.cpts-chatbot a.cpts-chatbot__choice,
.cpts-chatbot button.cpts-chatbot__footer-button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    border: 1px solid rgba(202, 61, 115, 0.72);
    border-radius: 999px;
    background: var(--cpts-chat-white);
    box-shadow: 0 6px 18px rgba(31, 79, 154, 0.05);
    color: var(--cpts-chat-accent);
    text-decoration: none;
    transition:
        transform var(--cpts-chat-transition),
        border-color var(--cpts-chat-transition),
        box-shadow var(--cpts-chat-transition),
        background-color var(--cpts-chat-transition),
        color var(--cpts-chat-transition);
}

.cpts-chatbot button.cpts-chatbot__choice,
.cpts-chatbot a.cpts-chatbot__choice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 20px;
    text-align: left !important;
    white-space: normal !important;
    line-height: 1.35;
}

.cpts-chatbot__choice-label {
    min-width: 0;
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.cpts-chatbot__choice-icon {
    display: inline-grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    border-radius: 50%;
    background: rgba(31, 79, 154, 0.08);
    color: var(--cpts-chat-blue);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.cpts-chatbot__choice--link .cpts-chatbot__choice-icon {
    font-size: 14px;
}

.cpts-chatbot button.cpts-chatbot__choice:hover:not(:disabled):not(.is-disabled),
.cpts-chatbot a.cpts-chatbot__choice:hover,
.cpts-chatbot button.cpts-chatbot__footer-button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(202, 61, 115, 0.92);
    box-shadow: 0 10px 22px rgba(31, 79, 154, 0.09);
    background: #fffdfd;
    color: var(--cpts-chat-accent);
    text-decoration: none;
}

.cpts-chatbot button.cpts-chatbot__choice:hover:not(:disabled):not(.is-disabled) .cpts-chatbot__choice-icon,
.cpts-chatbot a.cpts-chatbot__choice:hover .cpts-chatbot__choice-icon {
    transform: translateX(1px);
    background: rgba(31, 79, 154, 0.12);
}

.cpts-chatbot button.cpts-chatbot__choice:disabled,
.cpts-chatbot button.cpts-chatbot__choice.is-disabled,
.cpts-chatbot button.cpts-chatbot__footer-button:disabled {
    opacity: 0.46;
    pointer-events: none;
    cursor: default;
    box-shadow: none;
}

.cpts-chatbot button.cpts-chatbot__choice.is-unconfigured {
    border-style: dashed;
    box-shadow: none;
}

.cpts-chatbot button.cpts-chatbot__choice.is-unconfigured .cpts-chatbot__choice-icon {
    font-size: 16px;
}

.cpts-chatbot button.cpts-chatbot__choice.has-error {
    border-color: var(--cpts-chat-yellow);
    background: var(--cpts-chat-warning);
    color: #67501b;
}

.cpts-chatbot button.cpts-chatbot__choice.has-error .cpts-chatbot__choice-icon {
    background: rgba(248, 190, 62, 0.22);
    color: #67501b;
}

.cpts-chatbot__bubble--typing {
    display: inline-flex;
    min-width: 58px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 14px;
}

.cpts-chatbot__typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cpts-chat-sky);
    animation: cpts-chat-typing 900ms ease-in-out infinite;
}

.cpts-chatbot__typing-dot:nth-child(2) {
    animation-delay: 110ms;
}

.cpts-chatbot__typing-dot:nth-child(3) {
    animation-delay: 220ms;
}

.cpts-chatbot__footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border-top: 1px solid var(--cpts-chat-border);
    background: var(--cpts-chat-white);
}

.cpts-chatbot button.cpts-chatbot__footer-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal !important;
}

@keyframes cpts-chat-message-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cpts-chat-typing {
    0%, 60%, 100% {
        opacity: 0.38;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 600px) {
    .cpts-chatbot button.cpts-chatbot__trigger {
        right: 16px;
        bottom: 16px;
        min-height: 70px;
        padding: 8px 18px 8px 10px;
        gap: 12px;
    }

    .cpts-chatbot__trigger-icon {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }

    .cpts-chatbot__panel {
        inset: 10px;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 22px;
        transform-origin: bottom center;
    }

    .cpts-chatbot__header {
        min-height: 82px;
        padding: 14px;
    }

    .cpts-chatbot__avatar {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
        border-radius: 16px;
    }

    .cpts-chatbot__title {
        font-size: 15px;
    }

    .cpts-chatbot__messages {
        padding: 17px 15px;
    }

    .cpts-chatbot__bubble {
        max-width: 96%;
    }

    .cpts-chatbot__footer {
        gap: 10px;
    }

    .cpts-chatbot button.cpts-chatbot__choice,
    .cpts-chatbot a.cpts-chatbot__choice,
    .cpts-chatbot button.cpts-chatbot__footer-button {
        min-height: 50px;
    }
}

@media (max-width: 420px) {
    .cpts-chatbot__footer {
        grid-template-columns: 1fr;
    }

    .cpts-chatbot__choice-label,
    .cpts-chatbot button.cpts-chatbot__footer-button {
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .cpts-chatbot button.cpts-chatbot__trigger {
        width: 72px;
        padding: 8px;
        justify-content: center;
    }

    .cpts-chatbot__trigger-label {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cpts-chatbot__trigger,
    .cpts-chatbot__panel,
    .cpts-chatbot__icon-button,
    .cpts-chatbot__choice,
    .cpts-chatbot__card--link,
    .cpts-chatbot__footer-button,
    .cpts-chatbot__turn.is-animated,
    .cpts-chatbot__typing-dot,
    .cpts-chatbot__choice-icon {
        transition: none;
        animation: none;
    }
}
