.ai-agent {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1040;
    font-family: Roboto, Arial, sans-serif;
}

.ai-agent__toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: #505b80;
    color: #fff;
    box-shadow: 0 8px 24px rgba(40, 48, 72, .24);
    font-weight: 600;
}

.ai-agent__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    display: flex;
    flex-direction: column;
    width: 360px;
    max-height: calc(100vh - 96px);
    max-width: calc(100vw - 28px);
    background: #fff;
    border: 1px solid #d9deea;
    border-radius: 8px;
    box-shadow: 0 16px 40px rgba(40, 48, 72, .22);
    overflow: hidden;
}

.ai-agent__head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #f1f3f9;
    border-bottom: 1px solid #d9deea;
}

.ai-agent__title {
    color: #30384f;
    font-size: 16px;
    font-weight: 600;
}

.ai-agent__status {
    color: #738491;
    font-size: 12px;
    line-height: 16px;
}

.ai-agent__close {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: #505b80;
    font-size: 28px;
    line-height: 28px;
}

.ai-agent__accordion {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.ai-agent__section {
    border-bottom: 1px solid #d9deea;
}

.ai-agent__section--open {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.ai-agent__section-toggle {
    width: 100%;
    border: 0;
    background: #fff;
    color: #30384f;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    padding: 9px 12px;
    text-align: left;
}

.ai-agent__section-toggle:after {
    content: "+";
    float: right;
    color: #738491;
}

.ai-agent__section--open .ai-agent__section-toggle:after {
    content: "−";
}

.ai-agent__section-body {
    display: none;
    min-height: 0;
}

.ai-agent__section--open .ai-agent__section-body {
    display: block;
    flex: 1;
    overflow-y: auto;
}

.ai-agent__messages {
    padding: 12px;
    background: #fff;
}

.ai-agent__message {
    width: fit-content;
    max-width: 88%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 20px;
    white-space: pre-wrap;
}

.ai-agent__message--assistant {
    background: #f1f3f9;
    color: #30384f;
}

.ai-agent__message--user {
    margin-left: auto;
    background: #fc7b59;
    color: #fff;
}

.ai-agent__message--thinking {
    display: flex;
    gap: 4px;
    align-items: center;
    min-width: 44px;
    min-height: 20px;
}

.ai-agent__message--thinking span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #738491;
    animation: ai-agent-thinking 1s infinite ease-in-out;
}

.ai-agent__message--thinking span:nth-child(2) {
    animation-delay: .15s;
}

.ai-agent__message--thinking span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes ai-agent-thinking {
    0%, 80%, 100% {
        opacity: .35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.ai-agent__summary {
    margin: 0 12px 12px;
    padding: 10px;
    border: 1px solid #d9deea;
    border-radius: 8px;
    color: #30384f;
    font-size: 13px;
    line-height: 19px;
}

.ai-agent__actions {
    flex-shrink: 0;
    padding: 10px 12px;
}

.ai-agent__submit,
.ai-agent__reset,
.ai-agent__send {
    border: 0;
    border-radius: 4px;
    background: #fc7b59;
    color: #fff;
    font-size: 14px;
    line-height: 20px;
    padding: 8px 12px;
}

.ai-agent__submit {
    width: 100%;
}

.ai-agent__reset {
    width: 100%;
    margin-top: 8px;
    background: #f1f3f9;
    color: #30384f;
}

.ai-agent__form {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #d9deea;
}

.ai-agent__input {
    flex: 1;
    min-height: 40px;
    max-height: 96px;
    resize: vertical;
    border: 1px solid #d9deea;
    border-radius: 4px;
    padding: 8px;
    font-size: 14px;
    line-height: 20px;
}

@media (max-width: 575px) {
    .ai-agent {
        right: 10px;
        bottom: 10px;
    }

    .ai-agent__panel {
        right: -4px;
        bottom: 66px;
        max-height: calc(100vh - 82px);
    }
}
