/* ============================================================
   SAP AI Agent — Modern Dark Design System
   Refined dark theme with gold accents, glassmorphism,
   smooth animations, and production-level polish
   ============================================================ */

:root {
    /* Background layers */
    --bg-primary: #0D0F14;
    --bg-surface: #141720;
    --bg-elevated: #1C2030;
    --bg-hover: #252A3A;
    --bg-active: #333A4D;

    /* Borders */
    --border-faint: rgba(255,255,255,0.03);
    --border-subtle: rgba(255,255,255,0.06);
    --border-default: rgba(255,255,255,0.09);
    --border-strong: rgba(255,255,255,0.15);
    --border-focus: #F0B90B;

    /* Accent — Warm Gold */
    --accent: #F0B90B;
    --accent-hover: #FFD43B;
    --accent-active: #D4A20A;
    --accent-glow: rgba(240,185,11,0.12);
    --accent-glow-strong: rgba(240,185,11,0.25);
    --accent-glass: rgba(240,185,11,0.06);
    --accent-text: #F5C842;

    /* Text */
    --text-primary: #F0F1F5;
    --text-secondary: #9198A8;
    --text-muted: #5C6378;
    --text-accent: #F5C842;

    /* Semantic */
    --success: #10B981;
    --success-bg: rgba(16,185,129,0.1);
    --success-border: rgba(16,185,129,0.2);
    --error: #EF4444;
    --error-bg: rgba(239,68,68,0.08);
    --error-border: rgba(239,68,68,0.2);
    --warning: #F59E0B;
    --info: #3B82F6;

    /* User bubble */
    --user-bubble-from: #F0B90B;
    --user-bubble-to: #D4A20A;
    --user-bubble-text: #0D0F14;

    /* Assistant bubble */
    --assistant-bubble: #1C2030;
    --assistant-bubble-border: rgba(255,255,255,0.07);
    --assistant-bubble-text: #F0F1F5;

    /* Radius scale */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-pill: 50px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 40px rgba(240,185,11,0.08);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.2), 0 0 1px rgba(255,255,255,0.05);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Typography */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;

    /* Spacing */
    --header-height: 60px;
}

/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%; overflow: hidden;
    font-family: var(--font-body);
    font-size: 16px; line-height: 1.6;
    background: var(--bg-primary); color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === App Shell === */
.app {
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    position: relative;
}

/* === App Body — Sidebar + Main === */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 10;
}
.main-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* ============================================================
   Ambient Background — Subtle golden glow
   ============================================================ */
.ambient {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.ambient-orb {
    position: absolute; border-radius: 50%; filter: blur(160px); opacity: 0.15;
    animation: orbFloat 30s ease-in-out infinite alternate;
}
.ambient-orb--gold {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(240,185,11,0.15), transparent 70%);
    top: -10%; right: -5%;
}
.ambient-orb--warm {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(212,162,10,0.08), transparent 70%);
    bottom: -15%; left: -8%;
    animation-delay: -15s;
}
@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.03); }
    66% { transform: translate(-15px, 10px) scale(1.06); }
    100% { transform: translate(20px, -15px) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
    .ambient-orb { animation: none; }
    .message, .welcome, .suggestion { animation: none !important; }
}

/* ============================================================
   Header
   ============================================================ */
.header {
    position: relative; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: var(--header-height);
    background: rgba(20,23,32,0.85);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    transition: background var(--duration-fast) ease;
}
/* Gold accent line at bottom */
.header::after {
    content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent 5%, var(--accent) 50%, transparent 95%);
    opacity: 0.2;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }

.logo-icon {
    width: 36px; height: 36px; position: relative;
    background: linear-gradient(135deg, var(--accent), var(--accent-active));
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 20px rgba(240,185,11,0.15),
                inset 0 1px 0 rgba(255,255,255,0.15);
    transition: transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration-fast) ease;
}
.logo-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 0 28px rgba(240,185,11,0.25),
                inset 0 1px 0 rgba(255,255,255,0.2);
}
.logo-icon svg { width: 18px; height: 18px; color: #0D0F14; }

.logo-text {
    font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
    letter-spacing: -0.5px; color: var(--text-primary);
}
.logo-text span { color: var(--accent); }

.logo-badge {
    font-family: var(--font-mono); font-size: 0.58rem; font-weight: 600;
    padding: 3px 9px; background: var(--accent-glass);
    color: var(--accent); border: 1px solid rgba(240,185,11,0.15);
    border-radius: var(--radius-pill); letter-spacing: 0.8px; text-transform: uppercase;
}

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

.control-group {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); padding: 0 12px; height: 40px;
    transition: border-color var(--duration-fast) ease,
                box-shadow var(--duration-fast) ease;
}
.control-group:hover {
    border-color: var(--border-default);
    box-shadow: 0 0 0 1px var(--border-default);
}

.control-label {
    font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
    color: var(--text-muted); white-space: nowrap; text-transform: uppercase;
    letter-spacing: 1px;
}

/* Select */
select {
    -webkit-appearance: none; appearance: none;
    background: transparent; border: none;
    color: var(--text-primary); font-size: 0.82rem;
    font-family: var(--font-body); font-weight: 600;
    cursor: pointer; padding: 4px 20px 4px 4px; outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%239198A8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 4px center;
    transition: color var(--duration-fast) ease;
}
select:focus { color: var(--accent); }
select option { background: var(--bg-elevated); color: var(--text-primary); }

/* Toggle switch */
.toggle-wrapper {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.toggle {
    position: relative; width: 40px; height: 22px;
    background: var(--bg-hover); border: 1px solid var(--border-default);
    border-radius: var(--radius-pill); transition: all var(--duration-fast) ease;
}
.toggle.active {
    background: var(--accent); border-color: var(--accent);
    box-shadow: 0 0 12px rgba(240,185,11,0.2);
}
.toggle::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: var(--text-secondary); border-radius: 50%;
    transition: all var(--duration-normal) var(--ease-spring);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle.active::after {
    transform: translateX(18px);
    background: #0D0F14;
}
.toggle-text {
    font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-user-select: none; user-select: none;
}

/* New Chat button */
.btn-new-chat {
    display: flex; align-items: center; gap: 6px;
    padding: 0 16px; height: 40px; background: transparent;
    border: 1px solid rgba(240,185,11,0.3); border-radius: var(--radius-pill);
    color: var(--accent); font-family: var(--font-body);
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    transition: all var(--duration-fast) ease;
    position: relative;
    overflow: hidden;
}
.btn-new-chat::before {
    content: ''; position: absolute; inset: 0;
    background: var(--accent); opacity: 0;
    transition: opacity var(--duration-fast) ease;
}
.btn-new-chat:hover::before { opacity: 1; }
.btn-new-chat:hover { color: #0D0F14; border-color: var(--accent); }
.btn-new-chat span, .btn-new-chat svg { position: relative; z-index: 1; }
.btn-new-chat svg { width: 15px; height: 15px; }

/* Navigation buttons */
.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--duration-fast) ease;
    cursor: pointer;
}
.btn-nav:hover {
    border-color: rgba(240,185,11,0.3);
    color: var(--accent);
    background: var(--accent-glass);
}
.btn-nav svg {
    width: 15px; height: 15px;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: 280px;
    background: rgba(20,23,32,0.9);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 300ms var(--ease-out),
                opacity 300ms var(--ease-out);
    overflow: hidden;
}
.sidebar--collapsed {
    width: 0;
    border-right: none;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    margin-bottom: 2px;
    position: relative;
}
.sidebar-item:hover {
    background: var(--bg-hover);
}
.sidebar-item.active {
    background: var(--accent-glass);
    border: 1px solid rgba(240,185,11,0.12);
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.sidebar-item-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}
.sidebar-item-title {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.sidebar-item-date {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.sidebar-item-delete {
    opacity: 0;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    flex-shrink: 0;
}
.sidebar-item-delete svg {
    width: 14px;
    height: 14px;
}
.sidebar-item:hover .sidebar-item-delete {
    opacity: 1;
}
.sidebar-item-delete:hover {
    background: var(--error-bg);
    color: var(--error);
}
.sidebar-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.sidebar-backdrop {
    display: none;
}

/* Sidebar toggle button */
.btn-sidebar-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    flex-shrink: 0;
}
.btn-sidebar-toggle svg {
    width: 20px;
    height: 20px;
}
.btn-sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 30;
        box-shadow: 8px 0 32px rgba(0,0,0,0.4);
    }
    .sidebar--collapsed {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 25;
        background: rgba(0,0,0,0.6);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }
}

/* ============================================================
   Chat Area
   ============================================================ */
.chat-area {
    position: relative; z-index: 10;
    flex: 1; overflow-y: auto;
    padding: 32px 24px;
    display: flex; flex-direction: column; gap: 20px;
    scroll-behavior: smooth;
}

/* ============================================================
   Welcome Screen
   ============================================================ */
.welcome {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 24px; text-align: center; padding: 40px 20px;
    animation: welcomeFadeIn 0.7s var(--ease-out);
}
@keyframes welcomeFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-icon {
    width: 80px; height: 80px; position: relative;
    background: linear-gradient(135deg, var(--accent), var(--accent-active));
    border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 60px rgba(240,185,11,0.15),
                0 8px 32px rgba(240,185,11,0.1);
    animation: welcomeIconPulse 3s ease-in-out infinite;
}
@keyframes welcomeIconPulse {
    0%, 100% { box-shadow: 0 0 60px rgba(240,185,11,0.15), 0 8px 32px rgba(240,185,11,0.1); }
    50% { box-shadow: 0 0 80px rgba(240,185,11,0.2), 0 8px 40px rgba(240,185,11,0.15); }
}
.welcome-icon svg { width: 36px; height: 36px; color: #0D0F14; }

.welcome h2 {
    font-family: var(--font-display); font-size: 1.8rem; font-weight: 700;
    letter-spacing: -0.5px; color: var(--text-primary);
    line-height: 1.2;
}
.welcome p {
    font-size: 0.94rem; color: var(--text-secondary);
    max-width: 480px; line-height: 1.7;
}

.suggestions {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; max-width: 620px; width: 100%; margin-top: 8px;
}
.suggestion {
    padding: 16px 18px; background: var(--bg-elevated);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
    color: var(--text-secondary); font-size: 0.84rem;
    font-family: var(--font-body); font-weight: 500; cursor: pointer;
    transition: all var(--duration-fast) ease;
    text-align: left; line-height: 1.5;
    position: relative;
    overflow: hidden;
}
.suggestion::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-glass), transparent);
    opacity: 0;
    transition: opacity var(--duration-fast) ease;
}
.suggestion:hover {
    border-color: rgba(240,185,11,0.2);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}
.suggestion:hover::before { opacity: 1; }

/* AI Suggestion Buttons (inside assistant messages) */
.message-bubble .suggest-button {
    display: inline-block;
    margin: 4px 4px 4px 0;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    color: var(--text-accent);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    line-height: 1.4;
    max-width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.message-bubble .suggest-button:hover {
    background: var(--accent-glass);
    border-color: rgba(240,185,11,0.3);
    color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(240,185,11,0.1);
}
.message-bubble .suggest-button:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ============================================================
   Messages
   ============================================================ */
.message {
    display: flex; gap: 12px; max-width: 800px;
    width: 100%; margin: 0 auto;
    animation: messageSlideIn 0.35s var(--ease-out);
}
@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user { flex-direction: row-reverse; }

/* Avatar */
.message-avatar {
    width: 34px; height: 34px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
    transition: transform var(--duration-fast) var(--ease-spring);
}
.message-avatar:hover { transform: scale(1.08); }
.message-avatar svg { width: 16px; height: 16px; }

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--accent), var(--accent-active));
    box-shadow: 0 0 12px rgba(240,185,11,0.12);
}
.message.user .message-avatar svg { color: #0D0F14; }

.message.assistant .message-avatar {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}
.message.assistant .message-avatar svg { color: var(--accent); }

.message.error .message-avatar {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
}
.message.error .message-avatar svg { color: var(--error); }

/* Bubble */
.message-content { flex: 1; min-width: 0; }

.message-bubble {
    padding: 14px 18px; border-radius: var(--radius-lg);
    line-height: 1.7; font-size: 0.9rem;
    word-wrap: break-word; overflow-wrap: break-word;
    transition: box-shadow var(--duration-fast) ease;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--user-bubble-from), var(--user-bubble-to));
    color: var(--user-bubble-text);
    border-bottom-right-radius: var(--radius-xs);
    box-shadow: 0 2px 8px rgba(240,185,11,0.15);
    font-weight: 500;
}

.message.assistant .message-bubble {
    background: var(--assistant-bubble);
    border: 1px solid var(--assistant-bubble-border);
    color: var(--assistant-bubble-text);
    border-bottom-left-radius: var(--radius-xs);
    transition: border-color var(--duration-fast) ease,
                box-shadow var(--duration-fast) ease;
}
.message.assistant .message-bubble:hover {
    border-color: var(--border-default);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.message.error .message-bubble {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #FF8A8A;
    border-radius: var(--radius-lg);
}

/* Meta */
.message-meta {
    display: flex; align-items: center; gap: 6px;
    margin-top: 8px; font-size: 0.62rem;
    color: var(--text-muted);
}
.message.user .message-meta { justify-content: flex-end; }

.meta-badge {
    font-family: var(--font-mono); font-size: 0.58rem; font-weight: 600;
    padding: 2px 8px; background: var(--bg-elevated);
    border: 1px solid var(--border-faint); border-radius: var(--radius-pill);
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Tool calls */
.tool-calls {
    max-width: 800px; width: 100%; margin: 4px auto 0;
    display: flex; flex-wrap: wrap; gap: 4px;
}
.tool-call {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; background: var(--accent-glass);
    border: 1px solid rgba(240,185,11,0.12); border-radius: var(--radius-pill);
    font-family: var(--font-mono); font-size: 0.62rem; font-weight: 600;
    color: var(--accent);
    animation: toolCallFadeIn 0.3s var(--ease-out);
}
@keyframes toolCallFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.tool-call svg { width: 11px; height: 11px; }

/* Typing indicator */
.typing-indicator { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.typing-dot {
    width: 8px; height: 8px; background: var(--accent);
    border-radius: 50%; opacity: 0.3;
    animation: typingPulse 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.3; }
    40% { transform: scale(1.15); opacity: 1; }
}

/* Streaming cursor */
.streaming-cursor::after {
    content: ''; display: inline-block;
    width: 2px; height: 1.1em; background: var(--accent);
    margin-left: 2px; vertical-align: text-bottom;
    animation: cursorBlink 1s step-end infinite;
    box-shadow: 0 0 6px rgba(240,185,11,0.4);
}
@keyframes cursorBlink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* ============================================================
   Markdown Content Styles
   ============================================================ */
.message-bubble p { margin: 6px 0; }
.message-bubble p:first-child { margin-top: 0; }
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble strong { font-weight: 600; color: var(--text-accent); }

.message-bubble code {
    font-family: var(--font-mono); font-size: 0.82em;
    background: rgba(240,185,11,0.06); padding: 2px 7px;
    border-radius: var(--radius-xs); color: var(--accent);
    border: 1px solid rgba(240,185,11,0.08);
}

.message-bubble pre {
    background: var(--bg-primary); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); padding: 16px 18px;
    margin: 12px 0; overflow-x: auto; position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}
.message-bubble pre code {
    background: none; padding: 0; border: none;
    color: var(--text-primary); font-size: 0.8rem; line-height: 1.7;
}

.message-bubble ul, .message-bubble ol { margin: 8px 0; padding-left: 22px; }
.message-bubble li { margin: 4px 0; }
.message-bubble li::marker { color: var(--accent); }

.message-bubble blockquote {
    border-left: 3px solid var(--accent); padding-left: 14px;
    margin: 12px 0; color: var(--text-secondary);
    font-style: italic;
}

.message-bubble table { border-collapse: collapse; margin: 12px 0; width: 100%; }

/* Scrollable table wrapper */
.message-bubble .table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
.message-bubble .table-scroll table {
    width: max-content;
    min-width: 600px;
    margin: 0;
    border-collapse: collapse;
}
.message-bubble .table-scroll th,
.message-bubble .table-scroll td {
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-wrap: normal !important;
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    text-align: left;
    font-size: 0.82rem;
}
.message-bubble th, .message-bubble td {
    border: 1px solid var(--border-subtle); padding: 8px 12px;
    text-align: left; font-size: 0.82rem;
}
.message-bubble th {
    background: var(--bg-elevated); font-weight: 600;
    color: var(--text-accent);
}

.message-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.message-bubble hr { border: none; border-top: 1px solid var(--border-subtle); margin: 16px 0; }

.message-bubble h1, .message-bubble h2, .message-bubble h3,
.message-bubble h4, .message-bubble h5, .message-bubble h6 {
    font-family: var(--font-display); margin: 18px 0 8px;
    color: var(--text-primary); font-weight: 700;
}
.message-bubble h1 { font-size: 1.3rem; }
.message-bubble h2 { font-size: 1.15rem; }
.message-bubble h3 { font-size: 1.05rem; }

/* ============================================================
   Input Area
   ============================================================ */
.input-area {
    position: relative; z-index: 20;
    padding: 12px 24px 14px;
    background: rgba(20,23,32,0.85);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.input-wrapper {
    max-width: 800px; margin: 0 auto;
    display: flex; align-items: flex-end; gap: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    padding: 6px 6px 6px 6px;
    transition: border-color var(--duration-fast) ease,
                box-shadow var(--duration-fast) ease,
                background var(--duration-fast) ease;
}
.input-wrapper:focus-within,
.input-wrapper--focused {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
    background: var(--bg-hover);
}

/* Action buttons left/right */
.input-actions {
    display: flex; align-items: center; gap: 2px;
    padding-bottom: 2px;
    flex-shrink: 0;
}
.input-actions--left { padding-right: 4px; }
.input-actions--right { padding-left: 4px; }

.btn-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; border-radius: var(--radius-md);
    color: var(--text-muted); cursor: pointer;
    transition: all var(--duration-fast) ease;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-active);
}
.btn-icon--clear:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* Hidden file input */
.file-input-hidden { display: none; }

/* Textarea */
.input-wrapper textarea {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text-primary); font-size: 0.9rem;
    font-family: var(--font-body); font-weight: 500; line-height: 1.5;
    resize: none; max-height: 140px; padding: 8px 4px;
    min-height: 36px;
}
.input-wrapper textarea::placeholder { color: var(--text-muted); }

/* Send button — Pill CTA */
.btn-send {
    width: 42px; height: 42px; min-width: 42px; min-height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-active);
    border: none; border-radius: var(--radius-pill);
    color: var(--text-muted); cursor: pointer; flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-spring);
}
.btn-send svg { width: 18px; height: 18px; }
.btn-send:hover:not(:disabled) {
    background: var(--bg-hover);
    transform: scale(1.05);
}
.btn-send--active {
    background: var(--accent) !important;
    color: #0D0F14 !important;
    box-shadow: rgba(240,185,11,0.25) 0px 4px 16px 0px;
}
.btn-send--active:hover:not(:disabled) {
    background: var(--accent-hover) !important;
    box-shadow: rgba(240,185,11,0.35) 0px 6px 20px 0px;
    transform: scale(1.08);
}
.btn-send:disabled { cursor: not-allowed; opacity: 0.5; }
.btn-send.loading svg { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* File chips */
.file-chips {
    max-width: 800px; margin: 8px auto 0;
    display: flex; flex-wrap: wrap; gap: 6px;
}
.file-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px 5px 10px;
    background: var(--accent-glass);
    border: 1px solid rgba(240,185,11,0.12);
    border-radius: var(--radius-pill);
    font-size: 0.72rem; color: var(--text-secondary);
    animation: chipIn 0.25s var(--ease-spring);
}
@keyframes chipIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}
.file-chip svg { width: 12px; height: 12px; color: var(--accent); flex-shrink: 0; }
.file-chip-name {
    max-width: 120px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-weight: 500;
}
.file-chip-size { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.62rem; }
.file-chip-remove {
    width: 16px; height: 16px; display: flex; align-items: center;
    justify-content: center; background: none; border: none;
    color: var(--text-muted); cursor: pointer; font-size: 0.85rem;
    line-height: 1; border-radius: 50%;
    transition: all var(--duration-fast) ease;
    margin-left: 2px;
}
.file-chip-remove:hover {
    color: var(--error); background: var(--error-bg);
}

/* Footer: hint + char counter */
.input-footer {
    max-width: 800px; margin: 6px auto 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8px;
}
.input-hint {
    font-family: var(--font-mono);
    font-size: 0.58rem; font-weight: 500; color: var(--text-muted);
    letter-spacing: 0.3px;
}
.char-counter {
    font-family: var(--font-mono);
    font-size: 0.58rem; font-weight: 500; color: var(--text-muted);
    letter-spacing: 0.2px; opacity: 0;
    transition: opacity var(--duration-fast) ease;
}
.input-wrapper--has-text .char-counter,
.input-wrapper:focus-within .char-counter { opacity: 1; }
.char-counter--warn { color: var(--warning); }
.char-counter--over { color: var(--error); font-weight: 600; }

/* ============================================================
   Status Bar
   ============================================================ */
.status-bar {
    position: relative; z-index: 20;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 6px 24px; background: rgba(20,23,32,0.7);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-faint);
    font-family: var(--font-mono); font-size: 0.58rem; font-weight: 500;
    color: var(--text-muted); flex-shrink: 0;
    letter-spacing: 0.3px;
}
.status-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px rgba(16,185,129,0.3);
    transition: background var(--duration-fast) ease;
}
.status-dot.error {
    background: var(--error);
    box-shadow: 0 0 6px rgba(239,68,68,0.3);
}
.status-dot.loading {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(245,158,11,0.3);
    animation: statusPulse 1.5s ease-in-out infinite;
}
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .header { padding: 0 16px; flex-wrap: wrap; gap: 8px; height: auto; min-height: var(--header-height); padding-top: 12px; padding-bottom: 12px; }
    .logo-badge { display: none; }
    .header-right { width: 100%; justify-content: space-between; }
    .suggestions { grid-template-columns: 1fr; }
    .chat-area { padding: 16px 12px; }
    .input-area { padding: 10px 12px 14px; }
    .btn-new-chat span { display: none; }
}
@media (max-width: 480px) {
    .control-label { display: none; }
    .toggle-text { display: none; }
    .suggestions { grid-template-columns: 1fr; }
}

/* ============================================================
   Focus & Accessibility
   ============================================================ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================
   Dashboard — Analytics Page
   ============================================================ */

.dashboard-app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
}

/* --- Dashboard Header --- */
.dash-header {
    height: var(--header-height);
    background: rgba(20,23,32,0.85);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 30;
}
.dash-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.2;
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-user-select: none;
    user-select: none;
}
.dash-refresh-toggle .toggle {
    width: 32px;
    height: 18px;
    border-radius: 9px;
    background: var(--bg-active);
    position: relative;
    transition: background var(--duration-fast) ease;
    border: 1px solid var(--border-subtle);
}
.dash-refresh-toggle .toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-spring);
}
.dash-refresh-toggle.active .toggle {
    background: var(--accent);
    border-color: var(--accent);
}
.dash-refresh-toggle.active .toggle::after {
    left: 16px;
    background: var(--bg-primary);
}

/* --- Dashboard Content --- */
.dash-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 28px;
    flex: 1;
}

/* --- KPI Grid --- */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.dash-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color var(--duration-fast) ease,
                box-shadow var(--duration-fast) ease,
                transform var(--duration-fast) ease;
}
.dash-card:hover {
    border-color: rgba(240, 185, 11, 0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.dash-kpi-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.dash-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--accent-glass);
    border: 1px solid rgba(240, 185, 11, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
}
.dash-kpi-icon svg {
    width: 18px;
    height: 18px;
}

.dash-kpi-body {
    min-width: 0;
}

.dash-kpi-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-kpi-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
}

/* --- Charts Grid --- */
.dash-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.dash-chart-card {
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.dash-chart-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-chart-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
}

.dash-chart-wrap {
    flex: 1;
    position: relative;
    min-height: 250px;
}

/* --- Error Panel --- */
.dash-error-panel {
    margin-bottom: 28px;
}

.dash-error-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--error);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-error-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--error);
    border-radius: 2px;
}

.dash-error-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-error-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-fast) ease;
}
.dash-error-row:hover {
    border-color: var(--error-border);
}

.dash-error-tool {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
}

.dash-error-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.dash-error-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--error), #FF6B6B);
    border-radius: 3px;
    transition: width var(--duration-normal) ease;
}

.dash-error-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-error-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--error);
    white-space: nowrap;
}

.dash-error-msg {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Section Title --- */
.dash-section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-section-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
}

/* --- Table --- */
.dash-table-wrap {
    overflow-x: auto;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.dash-table thead {
    background: var(--bg-elevated);
}

.dash-table th {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}

.dash-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-faint);
    color: var(--text-primary);
    white-space: nowrap;
}

.dash-table tbody tr {
    transition: background var(--duration-fast) ease;
}

.dash-table tbody tr:hover {
    background: var(--bg-hover);
}

.dash-table tbody tr.dash-clickable-row {
    cursor: pointer;
}

.dash-table tbody tr.dash-clickable-row:hover {
    background: var(--accent-glass);
}

/* --- Badges --- */
.dash-badge {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.dash-badge--user {
    background: rgba(240, 185, 11, 0.1);
    color: #F0B90B;
}

.dash-badge--assistant {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.dash-badge--provider {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-faint);
}

/* --- Skeleton Loading --- */
.dash-skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: dash-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes dash-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dash-skeleton-card {
    height: 100px;
    border-radius: var(--radius-lg);
}

.dash-skeleton-chart {
    height: 320px;
    border-radius: var(--radius-lg);
}

/* --- Empty State --- */
.dash-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.dash-empty-icon {
    margin-bottom: 12px;
    opacity: 0.3;
}
.dash-empty-icon svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

/* --- Cost Bar --- */
.dash-cost-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-cost-bar-fill {
    height: 6px;
    background: var(--accent);
    border-radius: 3px;
    min-width: 2px;
    transition: width var(--duration-normal) ease;
}

/* --- Top Conversations --- */
.dash-top-conv {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-top-conv-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}
.dash-top-conv-row:hover {
    border-color: rgba(240, 185, 11, 0.12);
    background: var(--accent-glass);
    transform: translateX(4px);
}

.dash-top-conv-rank {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
    min-width: 28px;
    text-align: center;
}

.dash-top-conv-info {
    flex: 1;
    min-width: 0;
}

.dash-top-conv-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-top-conv-meta {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.dash-top-conv-cost {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
    white-space: nowrap;
}

/* --- Message Highlight Animation --- */
.message--highlight {
    animation: msg-highlight-pulse 3s ease-out;
}

@keyframes msg-highlight-pulse {
    0% {
        box-shadow: 0 0 0 2px rgba(240, 185, 11, 0.6);
        background: rgba(240, 185, 11, 0.08);
    }
    100% {
        box-shadow: 0 0 0 2px transparent;
        background: transparent;
    }
}

/* --- Dashboard Responsive --- */
@media (max-width: 1024px) {
    .dash-charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-content { padding: 16px; }
    .dash-header { padding: 0 16px; }
    .dash-table { font-size: 0.76rem; }
    .dash-table th, .dash-table td { padding: 8px 10px; }
}
@media (max-width: 480px) {
    .dash-kpi-grid { grid-template-columns: 1fr; }
    .dash-kpi-value { font-size: 1.3rem; }
}

/* ============================================================
   Documents Page
   ============================================================ */

.docs-app {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
}

.docs-content {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
    overflow-y: auto;
}

/* --- Upload Zone --- */
.docs-upload-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-2xl);
    padding: 52px 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    background: var(--bg-surface);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.docs-upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-glass), transparent);
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

.docs-upload-zone:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}
.docs-upload-zone:hover::before { opacity: 1; }

.docs-upload-zone--dragover {
    border-color: var(--accent);
    background: rgba(240, 185, 11, 0.06);
    box-shadow: 0 0 50px rgba(240, 185, 11, 0.12);
    transform: scale(1.01);
}

.docs-upload-zone--uploading {
    border-color: var(--accent);
    pointer-events: none;
    opacity: 0.8;
}

.docs-upload-icon, .docs-upload-spinner {
    position: relative;
    z-index: 1;
}
.docs-upload-icon svg {
    width: 48px;
    height: 48px;
    color: var(--accent);
    margin-bottom: 16px;
    opacity: 0.8;
}

.docs-upload-spinner svg {
    width: 36px;
    height: 36px;
    color: var(--accent);
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.docs-upload-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.docs-upload-text strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--text-primary);
}

.docs-upload-text span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* --- Alerts --- */
.docs-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.84rem;
    animation: chipIn 0.25s var(--ease-spring);
}

.docs-alert svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.docs-alert--error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #FF8A8A;
}

.docs-alert--success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
}

.docs-alert span {
    flex: 1;
}

.docs-alert button {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--duration-fast) ease;
    padding: 0 4px;
}

.docs-alert button:hover {
    opacity: 1;
}

/* --- Stats Row --- */
.docs-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.docs-stat {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    text-align: center;
    transition: border-color var(--duration-fast) ease,
                transform var(--duration-fast) ease;
}
.docs-stat:hover {
    border-color: rgba(240,185,11,0.1);
    transform: translateY(-2px);
}

.docs-stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.docs-stat-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Files Grid --- */
.docs-files-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
}

.docs-file-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    transition: all var(--duration-fast) ease;
    animation: messageSlideIn 0.35s var(--ease-out);
}

.docs-file-card:hover {
    border-color: rgba(240, 185, 11, 0.12);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

/* File icon */
.docs-file-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.docs-file-icon svg {
    width: 20px;
    height: 20px;
}

.docs-file-icon--pdf {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.docs-file-icon--text {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: var(--success);
}

/* File info */
.docs-file-info {
    flex: 1;
    min-width: 0;
}

.docs-file-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.docs-file-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
}

.docs-file-sep {
    opacity: 0.4;
}

.docs-file-hash {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-top: 2px;
    opacity: 0.5;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* File actions */
.docs-file-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.docs-file-status {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.docs-file-status--ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.docs-file-status--empty {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.docs-file-delete {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}

.docs-file-delete svg {
    width: 16px;
    height: 16px;
}

.docs-file-delete:hover {
    color: var(--error);
    background: var(--error-bg);
    border-color: var(--error-border);
}

/* --- Empty State --- */
.docs-empty {
    text-align: center;
    padding: 64px 24px;
    animation: welcomeFadeIn 0.5s var(--ease-out);
}

.docs-empty-icon {
    margin-bottom: 16px;
    opacity: 0.2;
}

.docs-empty-icon svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
}

.docs-empty h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.docs-empty p {
    font-size: 0.88rem;
    color: var(--text-muted);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- Loading --- */
.docs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 64px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.docs-loading-spinner svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
    animation: spin 1s linear infinite;
}

/* --- Documents Page Responsive --- */
@media (max-width: 768px) {
    .docs-content { padding: 20px 16px; }
    .docs-upload-zone { padding: 32px 20px; }
    .docs-file-card { padding: 12px 14px; gap: 12px; }
    .docs-file-hash { display: none; }
    .docs-stats-row { gap: 10px; }
    .docs-stat { padding: 12px 14px; }
    .dash-header-right .btn-nav span { display: none; }
}
