html, body { height: 100%; margin: 0; font-family: system-ui, sans-serif; }

/* Layout */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 200px;
    background: #1e1e2e;
    color: #cdd6f4;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #cba6f7;
    margin-bottom: 1rem;
}

.sidebar .nav-link {
    color: #a6adc8;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: #313244;
    color: #cdd6f4;
}

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Chat */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 1rem;
}

.message-row {
    display: flex;
}

.message-row.user { justify-content: flex-end; }
.message-row.assistant { justify-content: flex-start; }

.bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-row.user .bubble {
    background: #6c63ff;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-row.assistant .bubble {
    background: #f1f3f5;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}

.bubble-error {
    background: #ffe0e0;
    color: #c0392b;
}

/* Sources */
.sources {
    margin-top: 0.75rem;
    border-top: 1px solid #dee2e6;
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sources-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.05em;
}

.source-doc-link {
    display: inline-block;
    color: #6c63ff;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
}

.source-doc-link:hover { text-decoration: underline; }

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    animation: bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1);   opacity: 1;   }
}

/* Input bar */
.chat-input-bar {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
    background: #fff;
}

.chat-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}

.chat-input:focus { border-color: #6c63ff; }

.send-btn {
    border-radius: 24px;
    padding: 0.6rem 1.5rem;
    background: #6c63ff;
    border-color: #6c63ff;
}

.send-btn:hover:not(:disabled) { background: #574fd6; border-color: #574fd6; }
