.chatbot {
    position: fixed;
    right: clamp(14px, 3vw, 26px);
    bottom: clamp(14px, 3vw, 26px);
    z-index: 90;
    font-size: 16px;
}

.chatbot__fab {
    position: relative;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-800) 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 28px -8px rgba(16, 35, 107, .55);
    transition: transform .18s ease, box-shadow .18s ease;
}
.chatbot__fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px -8px rgba(16, 35, 107, .6);
}
.chatbot__fab-icon { width: 26px; height: 26px; transition: opacity .15s ease, transform .2s ease; }
.chatbot__fab-icon--close { position: absolute; opacity: 0; transform: rotate(-45deg) scale(.6); }
.chatbot.is-open .chatbot__fab-icon--open { opacity: 0; transform: rotate(45deg) scale(.6); }
.chatbot.is-open .chatbot__fab-icon--close { opacity: 1; transform: rotate(0) scale(1); }

.chatbot__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(340px, calc(100vw - 28px));
    height: min(460px, calc(100vh - 150px));
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--ink-200);
    box-shadow: 0 24px 64px -16px rgba(15, 23, 42, .35);
    overflow: hidden;
}

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

.chatbot__head {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .8rem .95rem;
    background: linear-gradient(120deg, var(--brand-800) 0%, var(--brand-600) 100%);
    color: #fff;
}
.chatbot__avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    flex-shrink: 0;
}
.chatbot__head-text { display: flex; flex-direction: column; min-width: 0; }
.chatbot__head-text strong { font-size: .95rem; line-height: 1.2; }
.chatbot__head-text span { font-size: .72rem; opacity: .85; }
.chatbot__close {
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    opacity: .85;
    transition: opacity .15s ease;
}
.chatbot__close:hover { opacity: 1; }

.chatbot__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    background: var(--ink-50);
    scroll-behavior: smooth;
}
.chatbot__msg {
    max-width: 86%;
    padding: .6rem .8rem;
    font-size: .875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chatbot__msg--user {
    align-self: flex-end;
    background: var(--brand-600);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}
.chatbot__msg--bot {
    align-self: flex-start;
    background: #fff;
    color: var(--ink-800);
    border: 1px solid var(--ink-200);
    border-radius: 14px 14px 14px 4px;
}
.chatbot__msg--error {
    align-self: center;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: .8rem;
    border-radius: 10px;
}

.chatbot__typing {
    align-self: flex-start;
    display: inline-flex;
    gap: .3rem;
    padding: .7rem .85rem;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 14px 14px 14px 4px;
}
.chatbot__typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-400);
    animation: chatbot-blink 1.2s infinite;
}
.chatbot__typing i:nth-child(2) { animation-delay: .2s; }
.chatbot__typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chatbot-blink {
    0%, 70%, 100% { opacity: .3; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-3px); }
}

.chatbot__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .55rem .9rem;
    background: var(--ink-50);
    border-top: 1px solid var(--ink-100);
}
.chatbot__chip {
    border: 1px solid var(--brand-200);
    background: var(--brand-50);
    color: var(--brand-700);
    font-size: .74rem;
    font-weight: 600;
    font-family: inherit;
    padding: .35rem .6rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    text-align: left;
}
.chatbot__chip:hover { background: var(--brand-100); border-color: var(--brand-300); }

.chatbot__form {
    display: flex;
    gap: .5rem;
    padding: .7rem .9rem;
    background: #fff;
    border-top: 1px solid var(--ink-200);
}
.chatbot__input {
    flex: 1;
    height: 42px;
    padding: 0 .8rem;
    border: 1px solid var(--ink-200);
    border-radius: 0;
    font-size: .9rem;
    font-family: inherit;
    color: var(--ink-800);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.chatbot__input:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(30, 63, 166, .12);
}
.chatbot__send {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    background: var(--accent-500);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease;
}
.chatbot__send:hover { background: var(--accent-600); transform: translateY(-1px); }
.chatbot__send:disabled { background: var(--ink-300); cursor: not-allowed; transform: none; }
.chatbot__send .icon { transform: rotate(90deg); }

@media (max-width: 480px) {
    .chatbot__panel {
        position: fixed;
        right: 10px;
        left: 10px;
        bottom: 84px;
        width: auto;
        height: min(66vh, 460px);
    }
    .chatbot__suggestions { display: none; }
}
