/* ═══════════════════════════════════════════════════════
   Finzilla — Design System with Theme Support
   ═══════════════════════════════════════════════════════ */

/* ── Theme: Dark (default) ──────────────────────────── */
:root,
[data-theme="dark"] {
    --bg: #0f1117;
    --bg-surface: #161b22;
    --bg-elevated: #1c2333;
    --bg-hover: #21283b;
    --border: rgba(128, 128, 128, 0.15);
    --border-accent: rgba(99, 102, 241, 0.3);

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-bg: rgba(99, 102, 241, 0.08);

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --ag-theme: ag-theme-quartz-dark;

    color-scheme: dark;
}

/* ── Theme: Light ───────────────────────────────────── */
[data-theme="light"] {
    --bg: #f8f9fb;
    --bg-surface: #ffffff;
    --bg-elevated: #f0f2f5;
    --bg-hover: #e8eaef;
    --border: rgba(0, 0, 0, 0.1);
    --border-accent: rgba(99, 102, 241, 0.25);

    --text-primary: #1a1d23;
    --text-secondary: #555d6b;
    --text-muted: #8891a0;

    --accent: #4f46e5;
    --accent-hover: #6366f1;
    --accent-bg: rgba(79, 70, 229, 0.06);

    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;

    --shadow: 0 1px 3px rgba(0,0,0,0.08);

    color-scheme: light;
}

/* ── System theme (auto-detect) ─────────────────────── */
@media (prefers-color-scheme: light) {
    [data-theme="system"] {
        --bg: #f8f9fb;
        --bg-surface: #ffffff;
        --bg-elevated: #f0f2f5;
        --bg-hover: #e8eaef;
        --border: rgba(0, 0, 0, 0.1);
        --border-accent: rgba(99, 102, 241, 0.25);

        --text-primary: #1a1d23;
        --text-secondary: #555d6b;
        --text-muted: #8891a0;

        --accent: #4f46e5;
        --accent-hover: #6366f1;
        --accent-bg: rgba(79, 70, 229, 0.06);

        --success: #16a34a;
        --error: #dc2626;
        --warning: #d97706;

        --shadow: 0 1px 3px rgba(0,0,0,0.08);

        color-scheme: light;
    }
}

@media (prefers-color-scheme: dark) {
    [data-theme="system"] {
        --bg: #0f1117;
        --bg-surface: #161b22;
        --bg-elevated: #1c2333;
        --bg-hover: #21283b;
        --border: rgba(128, 128, 128, 0.15);
        --border-accent: rgba(99, 102, 241, 0.3);

        --text-primary: #e6edf3;
        --text-secondary: #8b949e;
        --text-muted: #6e7681;

        --accent: #6366f1;
        --accent-hover: #818cf8;
        --accent-bg: rgba(99, 102, 241, 0.08);

        --success: #22c55e;
        --error: #ef4444;
        --warning: #f59e0b;

        --shadow: 0 1px 3px rgba(0,0,0,0.4);

        color-scheme: dark;
    }
}

/* Spacing tokens */
:root {
    --sidebar-width: 300px;
    --radius: 10px;
    --radius-sm: 6px;
}

/* ═══════════ RESET & BASE ═══════════ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    transition: background 0.2s, color 0.2s;
}

/* ═══════════ LAYOUT ═══════════ */

.app-layout {
    display: flex;
    height: 100vh;
}

/* ═══════════ SIDEBAR ═══════════ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 16px;
    gap: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.version-badge {
    font-size: 0.65rem;
    background: var(--accent-bg);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-accent);
    font-weight: 600;
}

.sidebar-section {
    padding: 8px 0;
}

.section-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

/* Session List */
.session-list { display: flex; flex-direction: column; gap: 2px; }

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s;
    gap: 8px;
}

.session-item:hover { background: var(--bg-hover); }
.session-item.active {
    background: var(--accent-bg);
    border: 1px solid var(--border-accent);
}

.session-title {
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.session-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.source-select {
    width: 100%;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.source-select.sm { padding: 4px 8px; font-size: 0.78rem; }

.source-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    overflow: hidden;
}

.source-panel summary {
    padding: 8px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

.source-panel summary:hover { background: var(--bg-hover); }

.source-panel form,
.source-panel .feedback {
    padding: 8px 12px;
}

.file-input {
    width: 100%;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.text-input {
    width: 100%;
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 0.82rem;
    font-family: inherit;
    margin-bottom: 8px;
}

.text-input:focus { outline: none; border-color: var(--accent); }

/* ── Multi-Source List ───────────────────────────────── */
.source-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.15s;
}

.source-item:hover { background: var(--bg-hover); }

.source-item.active {
    background: var(--accent-bg);
    border-color: var(--border-accent);
}

.source-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.source-checkbox {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.source-icon { font-size: 0.9rem; flex-shrink: 0; }

.source-name {
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-rename-input {
    flex: 1;
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}

.source-rename-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.source-item:hover .source-rename-btn { opacity: 0.6; }
.source-rename-btn:hover { opacity: 1 !important; }

/* Schema source groups */
.schema-source-group {
    margin-bottom: 8px;
}

.schema-source-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.schema-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 4px 6px;
    font-style: italic;
}

/* Schema Browser */
.schema-browser {
    max-height: 300px;
    overflow-y: auto;
}

.schema-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    overflow: hidden;
}

.schema-table summary {
    padding: 6px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.schema-table summary:hover { background: var(--bg-hover); }

.col-count { color: var(--text-muted); font-size: 0.75rem; font-weight: 400; }

.schema-cols {
    padding: 4px 10px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.col-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(128, 128, 128, 0.08);
    border-radius: 3px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Cascadia Code', monospace;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 2px;
    border: 1px solid var(--border);
}

.theme-btn {
    flex: 1;
    padding: 4px 0;
    font-size: 0.7rem;
    font-family: inherit;
    font-weight: 500;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.theme-btn:hover { color: var(--text-secondary); }
.theme-btn.active {
    background: var(--accent);
    color: white;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

/* ═══════════ MAIN CONTENT ═══════════ */

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

.data-overview {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.metrics-row {
    display: flex;
    gap: 12px;
}

.metric-card {
    background: linear-gradient(135deg, var(--accent-bg), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--border-accent);
    border-radius: var(--radius);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-hover);
}

.metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Quick Actions */
.quick-actions {
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.quick-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.quick-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ═══════════ CHAT ═══════════ */

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

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

.msg-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.55;
}

.user-msg .msg-bubble {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 3px;
}

.assistant-msg .msg-bubble {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-bottom-left-radius: 3px;
    transition: background 0.2s;
}

.error-bubble {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: var(--error) !important;
}

.result-bubble {
    max-width: 95%;
    width: 100%;
}

.result-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

/* Code Block */
.code-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: pre-wrap;
    color: var(--text-secondary);
    margin: 8px 0;
}

/* ═══════════ AG GRID ═══════════ */

.grid-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0 6px;
    gap: 10px;
}

.grid-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.grid-toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.grid-search {
    width: 200px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 0.78rem;
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.grid-search:focus {
    outline: none;
    border-color: var(--accent);
    width: 260px;
}

.grid-search::placeholder {
    color: var(--text-muted);
}

.grid-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.grid-tool-btn {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 4px 10px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.grid-tool-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.grid-wrapper {
    position: relative;
}

/* Native fullscreen mode */
.grid-wrapper:fullscreen {
    background: var(--bg);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.grid-wrapper:fullscreen .grid-toolbar {
    flex-shrink: 0;
    margin-bottom: 8px;
}

.grid-footer {
    padding: 4px 2px;
}

.grid-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Quick suggestion buttons below results */
.quick-suggestions {
    display: flex;
    gap: 6px;
    padding: 8px 0 2px;
    flex-wrap: wrap;
}

.btn-xs {
    padding: 3px 10px;
    font-size: 0.72rem;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.btn-xs:hover {
    opacity: 1;
}

/* AG Grid theme overrides — works for both quartz and quartz-dark */
.ag-theme-quartz-dark,
.ag-theme-quartz {
    --ag-background-color: var(--bg-surface) !important;
    --ag-header-background-color: var(--bg-elevated) !important;
    --ag-odd-row-background-color: var(--bg) !important;
    --ag-row-hover-color: var(--bg-hover) !important;
    --ag-border-color: var(--border) !important;
    --ag-foreground-color: var(--text-primary) !important;
    --ag-data-color: var(--text-primary) !important;
    --ag-secondary-foreground-color: var(--text-secondary) !important;
    --ag-font-family: 'Inter', -apple-system, sans-serif !important;
    --ag-font-size: 13px !important;
    --ag-row-height: 36px !important;
    --ag-header-height: 40px !important;
    --ag-header-foreground-color: var(--text-secondary) !important;
    --ag-cell-horizontal-padding: 14px !important;
    --ag-header-column-resize-handle-color: var(--accent) !important;
    --ag-input-focus-border-color: var(--accent) !important;
    --ag-range-selection-border-color: var(--accent) !important;
    --ag-selected-row-background-color: var(--accent-bg) !important;

    border-radius: var(--radius);
    overflow: hidden;
    margin: 4px 0 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* Filter popup input styling */
.ag-theme-quartz-dark .ag-filter-body-wrapper input,
.ag-theme-quartz .ag-filter-body-wrapper input {
    background: var(--bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    padding: 4px 8px !important;
}

.ag-theme-quartz-dark .ag-filter-body-wrapper input:focus,
.ag-theme-quartz .ag-filter-body-wrapper input:focus {
    border-color: var(--accent) !important;
    outline: none !important;
}

/* Header styling */
.ag-theme-quartz-dark .ag-header-cell,
.ag-theme-quartz .ag-header-cell {
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
}

/* Pagination styling */
.ag-theme-quartz-dark .ag-paging-panel,
.ag-theme-quartz .ag-paging-panel {
    border-top: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    font-size: 12px !important;
}

/* Charts */
.chart-container {
    width: 100%;
    min-height: 350px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 8px 0;
}

/* ═══════════ CHAT INPUT ═══════════ */

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    transition: background 0.2s;
}

.chat-input {
    flex: 1;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input::placeholder { color: var(--text-muted); }

/* ═══════════ BUTTONS ═══════════ */

.btn {
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 10px 20px;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-ghost {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.send-btn { white-space: nowrap; }

.feedback {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ═══════════ THINKING / STREAMING ═══════════ */

.thinking { display: flex; align-items: center; gap: 8px; }

.stream-bubble { display: flex; flex-direction: column; gap: 8px; }
.stream-header { display: flex; align-items: center; gap: 8px; }
.stream-code {
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.75rem;
    transition: max-height 0.2s ease;
}

.thinking-dots span {
    animation: blink 1.4s infinite;
    font-size: 1.5rem;
    line-height: 1;
}

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

@keyframes blink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

.thinking-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════ DETAILS / SUMMARY ═══════════ */

details summary {
    list-style: none;
    user-select: none;
}

details summary::-webkit-details-marker { display: none; }

details summary::before {
    content: '▸ ';
    font-size: 0.7rem;
    color: var(--text-muted);
}

details[open] summary::before {
    content: '▾ ';
}

/* ═══════════ SCROLLBAR ═══════════ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, 0.4); }

/* ═══════════ AUTH MODAL ═══════════ */

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 0 0 1px var(--border-accent),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: authSlideIn 0.35s ease-out;
}

@keyframes authSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-tabs {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 3px;
}

.auth-tab {
    flex: 1;
    padding: 8px 0;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover { color: var(--text-secondary); }

.auth-tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-input {
    width: 100%;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.auth-input::placeholder { color: var(--text-muted); }

.auth-submit {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--error);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    text-align: center;
}

.auth-switch {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 16px;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.auth-switch a:hover { color: var(--accent-hover); }

/* User info in sidebar */
.user-info-row {
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.user-email {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}
