.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--text-accent);
    color: #fff;
    border: none;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s;
}
.chat-toggle:hover {
    transform: scale(1.05);
}
.chat-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-height: 500px;
    background: var(--bg);
    border: 1px solid var(--control-outline);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    font-size: 14px;
}
.chat-window.open {
    display: flex;
}
.chat-header {
    padding: 12px 16px;
    background: var(--text-accent);
    color: #fff;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}
.chat-messages {
    padding: 12px 16px;
    overflow-y: auto;
    flex: 1;
    max-height: 360px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-messages .msg {
    padding: 6px 10px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
}
.chat-messages .msg.user {
    background: var(--control-bg);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-messages .msg.assistant {
    background: var(--text-accent);
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chat-messages .msg.error {
    background: #ffcccc;
    color: #a00;
    align-self: center;
}
.chat-input-row {
    display: flex;
    padding: 8px 12px;
    border-top: 1px solid var(--control-outline);
    gap: 8px;
}
.chat-input-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--control-outline);
    border-radius: 20px;
    background: var(--control-bg);
    color: var(--text-primary);
    outline: none;
}
.chat-input-row input:focus {
    border-color: var(--text-accent);
}
.chat-input-row button {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: var(--text-accent);
    color: #fff;
    cursor: pointer;
}
.chat-input-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
@media (max-width: 480px) {
    .chat-window {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 80px;
    }
}