:root {
    --bg-0: #05070a; --bg-1: #0a0d14; --bg-2: #101624; --bg-3: #161e30;
    --accent: #6366f1; --accent-glow: rgba(99, 102, 241, 0.3);
    --text-p: #f1f5f9; --text-s: #94a3b8; --text-m: #64748b;
    --border: rgba(99, 102, 241, 0.15); --glass: rgba(10, 13, 20, 0.8);
    --font: 'Inter', sans-serif; --header: 'Space Grotesk', sans-serif;
    --green: #10b981; --red: #ef4444; --orange: #f59e0b;
}

/* ─── Deep Editor Modal ─── */
#doc-view {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 7, 10, 0.8); backdrop-filter: blur(12px);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; padding: 40px;
}
.doc-container {
    width: 100%; max-width: 800px; max-height: 90vh;
    background: var(--bg-1); border: 1px solid var(--border);
    border-radius: 24px; padding: 40px; position: relative;
    overflow-y: auto; box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.close-doc {
    position: absolute; top: 24px; right: 24px; font-size: 24px;
    color: var(--text-m); cursor: pointer; transition: 0.2s;
}
.close-doc:hover { color: var(--red); transform: scale(1.1); }
.doc-title { font-family: var(--header); font-size: 24px; font-weight: 800; margin-bottom: 30px; }
.doc-section { margin-bottom: 24px; }
.doc-section h3 { font-size: 14px; color: var(--accent); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }

/* ─── Theme Engine ─── */
body.theme-vibrant {
    --accent: #f43f5e; --bg-1: #110b10; --border: rgba(244, 63, 94, 0.2);
}
body.theme-sleek {
    --bg-1: rgba(10, 13, 20, 0.4); --glass: blur(20px); --border: rgba(255,255,255,0.05);
}

body {
    background: var(--bg-0); color: var(--text-p); font-family: var(--font);
    margin: 0; display: flex; height: 100vh; overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
    width: 300px; background: var(--bg-1); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 24px; flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
    z-index: 100; backdrop-filter: var(--glass);
}
.sidebar-divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Collapsed States */
.sidebar.collapsed { width: 70px; padding: 24px 12px; }
.sidebar.collapsed .logo span, .sidebar.collapsed .nav-item span, 
.sidebar.collapsed .chat-container, .sidebar.collapsed .chat-input,
.sidebar.collapsed .sidebar-divider, .sidebar.collapsed .nav-section { display: none; }
.sidebar.collapsed .logo { justify-content: center; margin-bottom: 30px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }

/* Hyper Visual Cards */
.heatmap-card { position: relative; min-height: 250px; background: url('https://upload.wikimedia.org/wikipedia/commons/e/ec/World_map_blank_without_borders.svg') center/contain no-repeat; opacity: 0.3; }
.heatmap-dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.5; } 100% { transform: scale(1); opacity: 1; } }

.roadmap-item { position: relative; padding-left: 20px; border-left: 2px solid var(--bg-3); margin-bottom: 12px; font-size: 12px; }
.roadmap-item::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg-3); border: 2px solid var(--accent); }
.roadmap-item.completed { border-left-color: var(--green); }
.roadmap-item.completed::before { background: var(--green); }

.integration-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.integration-btn { padding: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); cursor: pointer; text-align: center; transition: 0.2s; font-size: 14px; }
.integration-btn:hover { background: var(--bg-3); border-color: var(--accent); transform: translateY(-2px); }

/* (Existing Toggle, Logo, Nav-item, Main, Header, Content, Chat styles follow) */
.sidebar-toggle {
    position: absolute; top: 24px; right: -12px; width: 24px; height: 24px;
    background: var(--accent); border-radius: 50%; display: flex; align-items: center;
    justify-content: center; color: #fff; cursor: pointer; z-index: 101;
    border: 2px solid var(--bg-0); transition: transform 0.3s;
}
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

.logo { 
    display: flex; align-items: center; gap: 12px; font-family: var(--header);
    font-size: 18px; font-weight: 800; margin-bottom: 30px; white-space: nowrap;
}
.logo i { color: var(--accent); font-size: 24px; }

.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    border-radius: 12px; color: var(--text-s); font-weight: 600; font-size: 13px;
    transition: all 0.2s; cursor: pointer; margin-bottom: 4px; white-space: nowrap;
}
.nav-item:hover, .nav-item.active { background: var(--bg-2); color: var(--text-p); }
.nav-item.active i { color: var(--accent); }

.main { flex: 1; display: flex; flex-direction: column; background: var(--bg-0); position: relative; min-width: 0; }
.header {
    height: 72px; padding: 0 40px; display: flex; align-items: center; 
    justify-content: space-between; border-bottom: 1px solid var(--border);
}
.content { flex: 1; padding: 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 32px; }

.chat-container { flex: 1; min-height: 200px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; margin-bottom: 10px; }
.chat-msg { padding: 10px; border-radius: 10px; background: var(--bg-2); font-size: 12px; line-height: 1.4; border: 1px solid var(--border); }
.chat-msg.user { background: var(--bg-3); border-color: var(--accent); }
.chat-input { background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px; padding: 10px; color: #fff; width: 100%; outline: none; font-size: 12px; }

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

@media (max-width: 1200px) { 
    .intel-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .mermaid-card { grid-column: span 2; }
}
