:root {
    --assistant-ink: #151411;
    --assistant-paper: #f5f1e9;
    --assistant-gold: #c9973c;
    --assistant-line: rgba(21, 20, 17, .12);
}

.fabtn.chatbot {
    position: relative;
    background: var(--assistant-gold);
    color: #151411;
}

.fabtn.chatbot::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #3bad68;
}

.alpha-chat {
    position: fixed;
    right: 18px;
    bottom: 82px;
    z-index: 10010;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    width: min(390px, calc(100vw - 36px));
    height: min(570px, calc(100dvh - 110px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 18px 18px 8px 18px;
    background: var(--assistant-paper);
    box-shadow: 0 28px 80px rgba(35, 27, 15, .28), 0 2px 12px rgba(35, 27, 15, .12);
    color: var(--assistant-ink);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.975);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.alpha-chat.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.alpha-chat__header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px 54px 16px 18px;
    background: #171612;
    color: #fff;
}

.alpha-chat__identity {
    display: grid;
    width: 38px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(201, 151, 60, .58);
    color: var(--assistant-gold);
    font-size: 1.25rem;
    font-weight: 900;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.alpha-chat__title {
    margin: 0 0 3px;
    color: #fff;
    font-size: .94rem;
    font-weight: 750;
    letter-spacing: -.01em;
}

.alpha-chat__presence {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: rgba(255, 255, 255, .62);
    font-size: .68rem;
}

.alpha-chat__presence span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #47b976;
    box-shadow: 0 0 0 3px rgba(71, 185, 118, .14);
}

.alpha-chat__close {
    position: absolute;
    top: 17px;
    right: 16px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .78);
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.alpha-chat__close:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.alpha-chat__close:active { transform: scale(.96); }

.alpha-chat__messages {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 9px;
    overflow-y: auto;
    padding: 20px 18px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(21, 20, 17, .18) transparent;
}

.alpha-chat__message {
    max-width: 84%;
    padding: 11px 13px;
    font-size: .82rem;
    line-height: 1.5;
    text-wrap: pretty;
    animation: alphaMessageIn .2s ease both;
}

.alpha-chat__message--bot {
    align-self: flex-start;
    border-radius: 4px 14px 14px 14px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(21, 20, 17, .06);
}

.alpha-chat__message--user {
    align-self: flex-end;
    border-radius: 14px 4px 14px 14px;
    background: #22201b;
    color: #fff;
}

.alpha-chat__message--summary {
    border-left: 3px solid var(--assistant-gold);
}

.alpha-chat__options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 18px 17px;
}

.alpha-chat__options[hidden] { display: none; }

.alpha-chat__options button,
.alpha-chat__action {
    border: 1px solid var(--assistant-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .7);
    color: #39352d;
    padding: 8px 11px;
    font: inherit;
    font-size: .72rem;
    font-weight: 650;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.alpha-chat__options button:hover,
.alpha-chat__action:hover { border-color: rgba(201, 151, 60, .7); background: #fff; }
.alpha-chat__options button:active,
.alpha-chat__action:active { transform: scale(.98); }

.alpha-chat__composer {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 42px;
    gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid var(--assistant-line);
    background: rgba(255, 255, 255, .62);
}

.alpha-chat__composer[hidden] { display: none; }

.alpha-chat__composer input {
    min-width: 0;
    height: 42px;
    border: 1px solid rgba(21, 20, 17, .16);
    border-radius: 8px;
    background: #fff;
    padding: 0 12px;
    color: var(--assistant-ink);
    font: inherit;
    font-size: .82rem;
    outline: none;
}

.alpha-chat__composer input:focus {
    border-color: var(--assistant-gold);
    box-shadow: 0 0 0 3px rgba(201, 151, 60, .13);
}

.alpha-chat__composer > button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: var(--assistant-gold);
    color: #171612;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.alpha-chat__composer > button:hover { background: #d4a64c; }
.alpha-chat__composer > button:active { transform: translateY(1px); }

.alpha-chat__error {
    grid-column: 1 / -1;
    min-height: 0;
    margin: -1px 2px 0;
    color: #a33b2f;
    font-size: .68rem;
}

.alpha-chat__footer {
    padding: 9px 14px 10px;
    border-top: 1px solid rgba(21, 20, 17, .08);
    background: rgba(255, 255, 255, .42);
    color: #7c756a;
    font-size: .61rem;
    line-height: 1.4;
    text-align: center;
}

.alpha-chat__footer i { margin-right: 4px; color: #8a806f; }

.alpha-chat__actions {
    display: grid;
    gap: 7px;
    width: 100%;
    margin-top: 2px;
}

.alpha-chat__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border-radius: 7px;
    padding: 11px 13px;
}

.alpha-chat__action--primary {
    border-color: #171612;
    background: #171612;
    color: #fff;
}

.alpha-chat__action--primary:hover { border-color: #2b2923; background: #2b2923; }

.alpha-chat button:focus-visible,
.alpha-chat input:focus-visible,
.fabtn.chatbot:focus-visible {
    outline: 3px solid rgba(201, 151, 60, .42);
    outline-offset: 3px;
}

@keyframes alphaMessageIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .alpha-chat {
        right: 12px;
        bottom: 76px;
        left: 12px;
        width: auto;
        height: min(560px, calc(100dvh - 94px));
        border-radius: 16px 16px 6px 16px;
    }

    .alpha-chat__header { padding-top: 14px; padding-bottom: 14px; }
    .alpha-chat__close { top: 14px; }
    .alpha-chat__messages { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .alpha-chat,
    .alpha-chat__message { transition: none; animation: none; }
}
