:root {
    --ia-primary: #2563eb;
    --ia-primary-dark: #1d4ed8;
    --ia-sidebar-bg: #0f172a;
    --ia-sidebar-text: #94a3b8;
    --ia-sidebar-active: #1e293b;
    --ia-bg: #f1f5f9;
    --ia-border: #e2e8f0;
}

body {
    font-family: "Inter", system-ui, sans-serif;
    background: var(--ia-bg);
    color: #0f172a;
}

/* Login */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.login-brand-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: var(--ia-primary);
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

/* App shell */
.app-wrapper {
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--ia-sidebar-bg);
    color: var(--ia-sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-mark {
    width: 36px;
    height: 36px;
    background: var(--ia-primary);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.sidebar-brand-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
}

.sidebar-brand-version {
    font-size: 0.75rem;
    color: var(--ia-sidebar-text);
}

.sidebar-nav {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--ia-sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: var(--ia-sidebar-active);
    color: #fff;
}

.sidebar-link.active {
    background: var(--ia-primary);
    color: #fff;
}

.main-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--ia-border);
    padding: 0.75rem 1.25rem;
    min-height: 56px;
}

.content-area {
    padding: 1.25rem;
    flex: 1;
}

.messages-container {
    margin-bottom: 1rem;
}

.ollama-status-badge {
    font-weight: 500;
    font-size: 0.75rem;
}

/* Chat */
.chat-layout {
    background: #fff;
    border: 1px solid var(--ia-border);
    border-radius: 12px;
    overflow: hidden;
    min-height: calc(100vh - 140px);
}

.chat-sidebar {
    width: 260px;
    border-right: 1px solid var(--ia-border);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--ia-border);
}

.chat-conversation-list {
    overflow-y: auto;
    flex: 1;
}

.chat-conversation-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ia-border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.chat-conversation-item:hover {
    background: #eef2ff;
}

.chat-conversation-item.active {
    background: #dbeafe;
    border-left: 3px solid var(--ia-primary);
}

.chat-conversation-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conversation-date {
    font-size: 0.75rem;
    color: #64748b;
}

.chat-main {
    min-width: 0;
}

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

.chat-message {
    max-width: 85%;
}

.chat-message--user {
    align-self: flex-end;
}

.chat-message--assistant {
    align-self: flex-start;
}

.chat-message-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.chat-message--user .chat-message-content {
    background: var(--ia-primary);
    color: #fff;
    border-radius: 12px 12px 4px 12px;
    padding: 0.75rem 1rem;
}

.chat-message--assistant .chat-message-content {
    background: #f1f5f9;
    border-radius: 12px 12px 12px 4px;
    padding: 0.75rem 1rem;
}

.chat-empty {
    text-align: center;
    margin: auto;
    padding: 2rem;
}

.chat-composer {
    border-top: 1px solid var(--ia-border);
    padding: 1rem;
    background: #fff;
}

.chat-input {
    resize: none;
    border-radius: 8px 0 0 8px !important;
}

.chat-composer .btn {
    border-radius: 0 8px 8px 0 !important;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .chat-sidebar {
        width: 200px;
    }
}
