.chat-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease 0.2s;
}
.ai-morph-capsule.open .chat-container { opacity: 1; }

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-msg {
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
    border-radius: 16px;
}
.chat-msg p { margin: 0 0 0.4em; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: 0.2em 0 0.4em 1.2em; padding: 0; }
.chat-msg li { margin-bottom: 0.2em; }
.chat-msg.user {
    align-self: flex-end;
    max-width: 80%;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.6rem 0.9rem;
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
    align-self: flex-start;
    max-width: 90%;
    padding: 0.6rem 0;
    border-bottom-left-radius: 4px;
}

.chat-cursor {
    display: inline-block;
    margin-left: 1px;
    color: var(--text-muted);
    animation: chat-blink 1s step-end infinite;
}
@keyframes chat-blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

.chat-thinking { display: inline-flex; gap: 4px; align-items: center; }
.chat-thinking span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: chat-pulse 1.2s infinite ease-in-out;
}
.chat-thinking span:nth-child(2) { animation-delay: 0.15s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-pulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.9); }
    30% { opacity: 1; transform: scale(1.1); }
}

.chat-suggestions {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.25rem 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.chat-suggestions::-webkit-scrollbar { display: none; }
.chat-suggestions.hidden { display: none; }

.chat-chip {
    flex-shrink: 0;
    padding: 0.5rem 0.8rem;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
    font: inherit;
    font-size: 0.8rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
}
.chat-chip:hover { background: rgba(0, 0, 0, 0.08); }

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-main);
    max-height: calc(1.4em * 4);
    padding: 0.35rem 0;
}
#chat-input::placeholder { color: var(--text-muted); }

#chat-send {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
#chat-send:disabled { opacity: 0.3; cursor: not-allowed; }
#chat-send:not(:disabled):hover { transform: scale(1.05); }

.chat-error {
    margin: 0 1rem 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    border-radius: 10px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.chat-error[hidden] { display: none; }
#chat-error-dismiss {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}
