.delayed-chatbot {
    --delayed-chatbot-bottom-offset: 0px;
    position: fixed;
    right: 24px;
    bottom: calc(24px + var(--delayed-chatbot-bottom-offset) + env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
    z-index: 1100;
    font-family: var(--font-family-base);
    transition: bottom 260ms ease;
}

.delayed-chatbot * {
    box-sizing: border-box;
}

.delayed-chatbot__toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 16px 38px rgba(54, 0, 181, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition);
}

.delayed-chatbot__toggle:hover,
.delayed-chatbot__toggle:focus-visible {
    background: var(--color-link-hover);
    transform: translateY(-2px);
}

.delayed-chatbot__toggle svg {
    width: 26px;
    height: 26px;
}

.delayed-chatbot__panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(380px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 120px));
    max-width: calc(100vw - 16px);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-white);
    box-shadow: 0 22px 70px rgba(26, 14, 103, 0.24);
    display: none;
    overflow: hidden;
    transition: bottom 260ms ease;
}

.delayed-chatbot.is-open .delayed-chatbot__panel {
    display: flex;
    flex-direction: column;
}

.delayed-chatbot__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border);
    background: #FAFAFF;
}

.delayed-chatbot__identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.delayed-chatbot__mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.delayed-chatbot__mark svg {
    width: 18px;
    height: 18px;
}

.delayed-chatbot__title {
    margin: 0;
    color: var(--color-title);
    font-size: 15px;
    font-weight: 700;
    line-height: 20px;
}

.delayed-chatbot__subtitle {
    margin: 0;
    color: var(--color-placeholder);
    font-size: 12px;
    line-height: 17px;
}

.delayed-chatbot__actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.delayed-chatbot__menu-wrap {
    position: relative;
}

.delayed-chatbot__menu-button,
.delayed-chatbot__close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-title);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.delayed-chatbot__menu-button:hover,
.delayed-chatbot__menu-button:focus-visible,
.delayed-chatbot__close:hover,
.delayed-chatbot__close:focus-visible {
    background: rgba(54, 0, 181, 0.08);
}

.delayed-chatbot__menu-button svg,
.delayed-chatbot__close svg {
    width: 18px;
    height: 18px;
}

.delayed-chatbot__menu {
    position: absolute;
    top: 40px;
    right: 0;
    min-width: 210px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-xs);
    background: var(--color-white);
    box-shadow: 0 14px 36px rgba(26, 14, 103, 0.18);
    z-index: 2;
}

.delayed-chatbot__menu-item {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text);
    display: flex;
    align-items: center;
    font-family: var(--font-family-base);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.delayed-chatbot__menu-item:hover,
.delayed-chatbot__menu-item:focus-visible {
    background: #FAFAFF;
    color: var(--color-primary);
}

.delayed-chatbot__messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: linear-gradient(180deg, #fff 0%, #FAFAFF 100%);
}

.delayed-chatbot__message {
    max-width: 92%;
    margin: 0 0 12px;
    padding: 11px 13px;
    border-radius: var(--border-radius-xs);
    color: var(--color-text);
    font-size: 14px;
    line-height: 20px;
}

.delayed-chatbot__message--bot {
    background: var(--color-white);
    border: 1px solid var(--color-border);
}

.delayed-chatbot__message--user {
    margin-left: auto;
    background: var(--color-primary);
    color: var(--color-white);
}

.delayed-chatbot__message p {
    margin: 0;
}

.delayed-chatbot__sources {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.delayed-chatbot__source {
    display: block;
    padding: 9px 10px;
    border-radius: var(--border-radius-xs);
    background: #FAFAFF;
    color: var(--color-title);
    text-decoration: none;
    font-size: 12px;
    line-height: 17px;
}

.delayed-chatbot__source:hover {
    color: var(--color-primary);
}

.delayed-chatbot__source span {
    display: block;
    color: var(--color-placeholder);
    font-weight: 400;
    margin-top: 3px;
}

.delayed-chatbot__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    margin-top: 10px;
    padding: 0 14px;
    border-radius: var(--border-radius-xs);
    background: var(--color-secondary);
    color: var(--color-white) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.delayed-chatbot__typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.delayed-chatbot__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-border-2);
    animation: delayed-chatbot-pulse 1s infinite ease-in-out;
}

.delayed-chatbot__typing span:nth-child(2) {
    animation-delay: .15s;
}

.delayed-chatbot__typing span:nth-child(3) {
    animation-delay: .3s;
}

.delayed-chatbot__form {
    display: flex;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid var(--color-border);
    background: var(--color-white);
}

.delayed-chatbot__input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 90px;
    resize: none;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-xs);
    padding: 10px 12px;
    color: var(--color-text);
    font-family: var(--font-family-base);
    font-size: 14px;
    line-height: 20px;
}

.delayed-chatbot__input:focus {
    outline: 2px solid rgba(54, 0, 181, 0.18);
    border-color: var(--color-primary);
}

.delayed-chatbot__send {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--border-radius-xs);
    background: var(--color-primary);
    color: var(--color-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.delayed-chatbot__send:disabled {
    opacity: .55;
    cursor: wait;
}

.delayed-chatbot__send svg {
    width: 18px;
    height: 18px;
}

.delayed-chatbot__disclaimer {
    margin: 0;
    padding: 0 14px 12px;
    color: var(--color-placeholder);
    background: var(--color-white);
    font-size: 11px;
    line-height: 16px;
}

@keyframes delayed-chatbot-pulse {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: .45;
    }
    40% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

@media (max-width: 767px) {
    html {
        overflow-x: hidden;
    }

    html.delayed-chatbot-open,
    body.delayed-chatbot-open {
        overflow-x: hidden;
    }

    .delayed-chatbot {
        right: 16px;
        bottom: calc(16px + var(--delayed-chatbot-bottom-offset) + env(safe-area-inset-bottom));
    }

    .delayed-chatbot__panel {
        position: fixed;
        right: 8px;
        bottom: calc(86px + var(--delayed-chatbot-bottom-offset) + env(safe-area-inset-bottom));
        left: 8px;
        width: auto;
        height: min(620px, calc(100svh - 112px - var(--delayed-chatbot-bottom-offset) - env(safe-area-inset-bottom)));
        max-height: calc(100svh - 112px - var(--delayed-chatbot-bottom-offset) - env(safe-area-inset-bottom));
        max-width: none;
    }

    .delayed-chatbot__input {
        font-size: 16px;
    }
}
