.assistant-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    font-family: Arial, Helvetica, sans-serif;
}

.assistant-toggle {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--gold), var(--gold-deep));
    color: var(--navy);
    box-shadow: 0 14px 34px rgba(8, 36, 92, .28);
    cursor: pointer;
}

.assistant-toggle i {
    font-size: 29px;
}

.assistant-greeting {
    position: absolute;
    right: 72px;
    bottom: 8px;
    width: min(285px, calc(100vw - 104px));
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--ink);
    box-shadow: 0 14px 34px rgba(8, 36, 92, .18);
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translateX(8px) scale(.98);
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
    visibility: hidden;
}

.assistant-greeting::after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: 18px;
    width: 14px;
    height: 14px;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: var(--white);
    transform: rotate(45deg);
}

.assistant-greeting.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    visibility: visible;
}

.assistant-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(360px, calc(100vw - 34px));
    max-height: min(560px, calc(100vh - 120px));
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
    visibility: hidden;
}

.assistant-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--navy);
    color: var(--white);
}

.assistant-header strong,
.assistant-header span {
    display: block;
}

.assistant-header span {
    margin-top: 2px;
    color: rgba(255, 255, 255, .74);
    font-size: 12px;
}

.assistant-close {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 50%;
    background: transparent;
    color: var(--white);
    cursor: pointer;
}

.assistant-messages {
    display: grid;
    gap: 10px;
    align-content: start;
    min-height: 280px;
    max-height: 360px;
    padding: 16px;
    overflow-y: auto;
    background: var(--surface);
}

.assistant-message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--white);
    font-size: 14px;
    line-height: 1.45;
}

.assistant-message.user {
    justify-self: end;
    background: var(--royal);
    color: var(--white);
}

.assistant-message.pending {
    color: var(--muted);
}

.assistant-form {
    display: grid;
    grid-template-columns: 1fr 44px;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: var(--white);
}

.assistant-form input {
    min-height: 44px;
}

.assistant-form button {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius);
    background: var(--gold);
    color: var(--navy);
    cursor: pointer;
}

.assistant-form button i {
    font-size: 22px;
}

@media (max-width: 620px) {
    .assistant-widget {
        right: 14px;
        bottom: 14px;
    }

    .assistant-greeting {
        right: 68px;
        width: min(260px, calc(100vw - 98px));
    }
}
