:root {
    --bg-dark: #050609;
    --bg-card: rgba(10, 12, 18, 0.6);
    --border-rgba: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.2);
    
    --color-text-primary: #cbd5e1;
    --color-text-secondary: #64748b;
    --color-text-dim: #475569;
    
    --color-mcp: #3b82f6;
    --color-a2a: #8b5cf6;
    --color-openapi: #14b8a6;
    --color-rss: #f97316;
    --color-other: #64748b;
    
    --color-ok: #10b981;
    --color-error: #ef4444;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

/* ── LIGHT THEME ────────────────────────────────────────────────── */
.light-theme {
    --bg-dark: #f0f2f8;
    --bg-card: rgba(255, 255, 255, 0.75);
    --border-rgba: rgba(0, 0, 0, 0.1);
    --border-glow: rgba(99, 102, 241, 0.15);

    --color-text-primary: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-dim: #94a3b8;
}

.light-theme body {
    background-color: var(--bg-dark);
}

.light-theme .sidebar-left {
    background: #e8eaf3;
    border-right-color: rgba(0, 0, 0, 0.08);
}

.light-theme .top-bar,
.light-theme .map-header,
.light-theme .telemetry-tabs,
.light-theme .trace-log-header,
.light-theme .inspector-header {
    background: transparent;
}

.light-theme .glass-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.light-theme .mode-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
    color: #475569;
}

.light-theme .mode-btn.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: #4f46e5;
}

.light-theme .tab-btn {
    color: #64748b;
}

.light-theme .tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
}

.light-theme .cyber-grid-overlay {
    background-image:
        linear-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.025) 1px, transparent 1px);
}

.light-theme .scanline {
    background: rgba(99, 102, 241, 0.03);
}

.light-theme .detail-label { color: #64748b; }
.light-theme .detail-val   { color: #1e293b; }
.light-theme .code-block   { background: rgba(0,0,0,0.05); color: #1e293b; }
.light-theme .meta-tag     { background: rgba(0,0,0,0.06); color: #475569; }
.light-theme .dark-badge   { background: rgba(0,0,0,0.06); color: #475569; }

.light-theme tr:hover { background: rgba(0,0,0,0.03) !important; }
.light-theme .active-row { background: rgba(99,102,241,0.06) !important; }

.light-theme .trace-log-table td { color: #334155; }
.light-theme .timeline-bar { border-top-color: rgba(0,0,0,0.08); }
.light-theme .bottom-metrics-grid { border-top-color: rgba(0,0,0,0.08); }

.light-theme .settings-overlay {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(0,0,0,0.1);
}

/* ── APP TITLE BAR ──────────────────────────────────────────────── */
.app-title-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.app-name {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: #818cf8;
    letter-spacing: 1px;
}

.app-version {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-dim);
    border: 1px solid var(--border-rgba);
    padding: 1px 5px;
    border-radius: 3px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-ok);
    box-shadow: 0 0 6px var(--color-ok);
    animation: pulse 2s ease-in-out infinite;
}

.status-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
}

/* ── THEME BUTTON ───────────────────────────────────────────────── */
.theme-btn {
    background: none;
    border: 1px solid var(--border-rgba);
    border-radius: 6px;
    color: var(--color-text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    border-color: rgba(99, 102, 241, 0.4);
    color: #818cf8;
    background: rgba(99, 102, 241, 0.08);
}

/* ── TOGGLE SWITCH ──────────────────────────────────────────────── */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.08);
    border: 1px solid var(--border-rgba);
    transition: 0.3s;
}

.slider.round { border-radius: 20px; }
.slider.round::before { border-radius: 50%; }

.slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--color-text-dim);
    transition: 0.3s;
}

input:checked + .slider {
    background-color: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

input:checked + .slider::before {
    transform: translateX(16px);
    background-color: #818cf8;
}

/* ── LINK STYLE for inspector interactive items ─────────────────── */
.link-style {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(129, 140, 248, 0.4);
}

.link-style:hover {
    color: #818cf8;
    text-decoration-color: #818cf8;
}

.detail-val.link-style {
    cursor: pointer;
}


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

body {
    background-color: var(--bg-dark);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

/* Background Cyber Grid & Scanline Effect */
.cyber-grid-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.007) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.007) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center center;
    pointer-events: none;
    z-index: 1;
}

.scanline {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: rgba(99, 102, 241, 0.04);
    opacity: 0.8;
    pointer-events: none;
    z-index: 2;
    animation: scan 6s linear infinite;
}

@keyframes scan {
    0% { transform: translateY(-100px); }
    100% { transform: translateY(100vh); }
}

/* Container Structure */
.dashboard-container {
    display: grid;
    grid-template-columns: 56px 1fr;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 3;
}

/* Left Sidebar Navigation */
.sidebar-left {
    background: #07080d;
    border-right: 1px solid var(--border-rgba);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 10;
}

.logo-wrapper {
    margin-bottom: 24px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.5));
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: center;
}

.nav-item {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.nav-item:hover, .nav-item.active {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 0 4px rgba(99, 102, 241, 0.2);
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding: 12px 16px 16px 16px;
    gap: 12px;
}

/* Top Command Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    gap: 16px;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 14px;
    height: 14px;
    color: var(--color-text-secondary);
}

#global-search {
    width: 100%;
    height: 32px;
    background: rgba(10, 11, 14, 0.8);
    border: 1px solid var(--border-rgba);
    border-radius: 6px;
    padding: 0 40px 0 34px;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

#global-search:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

.search-shortcut {
    position: absolute;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-dim);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.01);
}

.mode-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.segmented-mode-switch {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 20px;
    padding: 3px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.segmented-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--color-text-dim);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.segmented-btn:hover {
    color: var(--color-text-primary);
}

.segmented-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(16, 185, 129, 0.15));
    border: 1px solid rgba(52, 211, 153, 0.5);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.3);
}

.segmented-btn.sim.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.25), rgba(219, 39, 119, 0.15));
    border: 1px solid rgba(236, 72, 153, 0.5);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.3);
}

.mode-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 8px #34d399;
    animation: pulse 1.5s ease-in-out infinite;
}

.mode-sim-icon {
    font-size: 0.75rem;
}

/* Dashboard Inner Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    flex: 1;
    gap: 12px;
    min-height: 0; /* Important for flex child scrolling */
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-rgba);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Map Section (Central Panel) */
.map-section {
    position: relative;
}

.map-header {
    height: 48px;
    border-bottom: 1px solid var(--border-rgba);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.title-area h2 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
    text-shadow: none;
}

.badge-live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-ok);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sub-stats {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.sub-stats span {
    color: var(--color-text-primary);
}

.map-toggles {
    display: flex;
    gap: 6px;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-rgba);
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    color: var(--color-text-primary);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-btn.icon-btn {
    font-family: var(--font-sans);
}

/* Globe Viewport */
.globe-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#globeViz {
    width: 100%;
    height: 100%;
}

/* Region Stats Overlay */
.region-stats-overlay {
    position: absolute;
    left: 16px;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 5;
    pointer-events: none;
}

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

.region-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.bg-blue { background-color: var(--color-mcp); }
.bg-teal { background-color: var(--color-openapi); }
.bg-purple { background-color: var(--color-a2a); }
.bg-orange { background-color: var(--color-rss); }
.bg-indigo { background-color: #6366f1; }
.bg-green { background-color: var(--color-ok); }

.region-info {
    display: flex;
    flex-direction: column;
}

.region-name {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
}

.region-val {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

/* Flow Labels Floating Overlay */
.flow-labels-overlay {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 5;
    pointer-events: none;
}

.flow-label-item {
    background: rgba(10, 11, 14, 0.85);
    border: 1px solid var(--border-rgba);
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    flex-direction: column;
    min-width: 100px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.flow-label-item.mcp { border-color: rgba(59, 130, 246, 0.3); }
.flow-label-item.handshake { border-color: rgba(139, 92, 246, 0.3); }
.flow-label-item.api { border-color: rgba(20, 184, 166, 0.3); }
.flow-label-item.rss { border-color: rgba(249, 115, 22, 0.3); }

.flow-name {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--color-text-secondary);
}

.flow-val {
    font-size: 0.75rem;
    font-weight: 700;
}

.mcp .flow-val { color: var(--color-mcp); }
.handshake .flow-val { color: var(--color-a2a); }
.api .flow-val { color: var(--color-openapi); }
.rss .flow-val { color: var(--color-rss); }

/* Globe Controls Overlay */
.globe-zoom-controls {
    position: absolute;
    left: 16px;
    bottom: 16px;
    display: flex;
    align-items: center;
    background: rgba(10, 11, 14, 0.85);
    border: 1px solid var(--border-rgba);
    border-radius: 4px;
    padding: 2px;
    z-index: 5;
}

.zoom-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
}

.zoom-btn:hover {
    color: var(--color-text-primary);
}

.zoom-level {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-primary);
    padding: 0 6px;
}

/* Timeline Scrubber */
.timeline-bar {
    height: 36px;
    border-top: 1px solid var(--border-rgba);
    border-bottom: 1px solid var(--border-rgba);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    background: rgba(5,6,9,0.5);
}

.time-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
}

.timeline-slider-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#timeline-slider {
    width: 100%;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.05);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

#timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #818cf8;
    cursor: pointer;
    box-shadow: 0 0 4px #818cf8;
}

.timeline-playhead {
    position: absolute;
    top: -22px;
    left: 100%;
    transform: translateX(-50%);
    background: #818cf8;
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* Map Footer */
.map-footer {
    height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 12, 18, 0.3);
}

.layers-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.layers-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.layers-icon {
    width: 12px;
    height: 12px;
}

.layer-checkbox-label {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.layer-checkbox-label input {
    display: none;
}

.checkbox-custom {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    background: transparent;
    transition: all 0.2s ease;
}

.layer-checkbox-label input:checked + .checkbox-custom {
    background: currentColor;
}

.checkbox-custom.mcp { color: var(--color-mcp); }
.checkbox-custom.a2a { color: var(--color-a2a); }
.checkbox-custom.openapi { color: var(--color-openapi); }
.checkbox-custom.rss { color: var(--color-rss); }

.auto-scroll-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auto-scroll-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
}

/* Switch Toggle CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 14px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    transition: .3s;
    border: 1px solid var(--border-rgba);
}

.slider:before {
    position: absolute;
    content: "";
    height: 8px;
    width: 8px;
    left: 2px;
    bottom: 2px;
    background-color: var(--color-text-secondary);
    transition: .3s;
}

input:checked + .slider {
    background-color: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

input:checked + .slider:before {
    transform: translateX(10px);
    background-color: #818cf8;
}

.slider.round {
    border-radius: 14px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Telemetry Section (Right Panel) */
.telemetry-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.telemetry-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-rgba);
    height: 40px;
    align-items: center;
    justify-content: space-between;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    height: 100%;
    padding: 0 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--color-text-primary);
}

.tab-btn.active:after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: #818cf8;
    box-shadow: 0 0 6px #818cf8;
}

.tab-actions {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.action-icon-btn svg {
    width: 14px;
    height: 14px;
}

.action-icon-btn:hover {
    color: var(--color-text-primary);
    background: rgba(255,255,255,0.03);
}

/* Event Inspector Card */
.inspector-card {
    height: 380px;
    flex-shrink: 0;
}

.inspector-card.hidden {
    display: none;
}

.inspector-header {
    height: 36px;
    border-bottom: 1px solid var(--border-rgba);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.15);
}

.inspector-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
}

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

.index-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--color-text-dim);
}

.nav-arrow {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
}

.nav-arrow:hover {
    color: var(--color-text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.inspector-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inspector-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.event-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.event-badge.mcp { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); }
.event-badge.handshake { background: rgba(139, 92, 246, 0.12); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.25); }
.event-badge.api { background: rgba(20, 184, 166, 0.12); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.25); }
.event-badge.rss { background: rgba(249, 115, 22, 0.12); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.25); }

.event-timestamp {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--color-text-secondary);
}

.inspector-details-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    line-height: 1.4;
}

.detail-row.vertical {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.detail-label {
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.6rem;
}

.detail-val {
    color: var(--color-text-primary);
}

.link-style {
    color: #818cf8;
    text-decoration: underline;
    cursor: pointer;
}

.badge-ok {
    color: var(--color-ok);
    font-weight: 600;
}

.code-block {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-rgba);
    border-radius: 4px;
    padding: 6px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #a78bfa;
    white-space: pre-wrap;
    word-break: break-all;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.meta-tag {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--color-text-secondary);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-rgba);
    padding: 1px 6px;
    border-radius: 3px;
}

.dark-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Trace Log Card */
.trace-log-card {
    flex: 1;
    min-height: 0;
}

.trace-log-header {
    height: 36px;
    border-bottom: 1px solid var(--border-rgba);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.1);
}

.trace-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-live-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--color-ok);
    box-shadow: 0 0 4px var(--color-ok);
    display: inline-block;
}

.log-live-label {
    font-size: 0.55rem;
    color: var(--color-ok);
    font-weight: 700;
}

.log-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-action-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-rgba);
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.trace-log-viewport {
    flex: 1;
    overflow-y: auto;
}

.trace-log-table {
    width: 100%;
    border-collapse: collapse;
}

.trace-log-table tr {
    border-bottom: 1px solid rgba(255,255,255,0.02);
    cursor: pointer;
}

.trace-log-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.trace-log-table td {
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    vertical-align: middle;
}

.trace-time {
    color: var(--color-text-dim);
    width: 70px;
}

.trace-type {
    width: 90px;
    font-weight: 600;
}

.trace-type.mcp { color: var(--color-mcp); }
.trace-type.handshake { color: var(--color-a2a); }
.trace-type.openapi { color: var(--color-openapi); }
.trace-type.rss { color: var(--color-rss); }

.trace-path {
    color: var(--color-text-primary);
}

.trace-op {
    color: var(--color-text-secondary);
}

.trace-status {
    width: 40px;
    font-weight: 600;
}

.trace-status.ok { color: var(--color-ok); }
.trace-status.err { color: var(--color-error); }

.trace-dur {
    color: var(--color-text-dim);
    width: 60px;
    text-align: right;
}

/* Bottom Metrics Grid */
.bottom-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    height: 120px;
    flex-shrink: 0;
}

.metrics-card {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
}

.metrics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.metrics-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-text-secondary);
}

.metrics-subtext {
    font-size: 0.65rem;
    font-weight: 600;
}

.metrics-subtext.up { color: var(--color-ok); }
.metrics-subtext.down { color: var(--color-error); }

.dim {
    color: var(--color-text-dim);
    font-weight: normal;
}

.metrics-card-body {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    min-height: 0;
}

.large-val {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.unit {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
}

.anomaly-label {
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    margin-right: 4px;
}

.chart-container {
    width: 140px;
    height: 50px;
    position: relative;
}

/* Donut Chart Layout */
.distribution-layout {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.donut-wrapper {
    width: 50px;
    height: 50px;
}

.donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.legend-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.6rem;
    font-family: var(--font-mono);
    line-height: 1.2;
}

.legend-label-col {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-block {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.legend-pct-col {
    color: var(--color-text-secondary);
}

.legend-val-col {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* 3D Map Custom Nodes Styling */
.map-node {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
}

.node-core {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 2;
    transition: opacity 0.5s ease;
}

.node-pulse {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    animation: pingNode 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
    z-index: 1;
}

@keyframes rippleNode {
    0%   { transform: scale(1);   opacity: 0.9; }
    70%  { transform: scale(2.5); opacity: 0; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Header Sources Indicators */
.sources-indicators {
    display: flex;
    gap: 8px;
    align-items: center;
}

.src-dot, .src-badge {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-text-dim);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.src-dot:hover::after, .src-badge:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    font-size: 0.55rem;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 100;
    border: 1px solid var(--border-rgba);
}

/* Active states matching JS classes */
.src-active-nostr { background-color: var(--color-a2a); box-shadow: 0 0 6px var(--color-a2a); }
.src-active-github { background-color: var(--color-mcp); box-shadow: 0 0 6px var(--color-mcp); }
.src-active-bluesky { background-color: var(--color-mcp); box-shadow: 0 0 6px var(--color-mcp); }
.src-active-hn { background-color: var(--color-rss); box-shadow: 0 0 6px var(--color-rss); }
.src-active-hf { background-color: var(--color-openapi); box-shadow: 0 0 6px var(--color-openapi); }
.src-active-wiki { background-color: var(--color-ok); box-shadow: 0 0 6px var(--color-ok); }
.src-active-mastodon { background-color: var(--color-rss); box-shadow: 0 0 6px var(--color-rss); }
.src-active-reddit { background-color: var(--color-rss); box-shadow: 0 0 6px var(--color-rss); }
.src-active-arxiv { background-color: var(--color-a2a); box-shadow: 0 0 6px var(--color-a2a); }
.src-active-stackoverflow { background-color: var(--color-openapi); box-shadow: 0 0 6px var(--color-openapi); }
.src-active-npm { background-color: var(--color-mcp); box-shadow: 0 0 6px var(--color-mcp); }

.src-inactive { background-color: var(--color-text-dim); box-shadow: none; }

/* Settings Overlay */
.settings-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    background: rgba(10, 11, 14, 0.95);
    border: 1px solid var(--border-rgba);
    border-radius: 8px;
    padding: 16px;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-rgba);
    padding-bottom: 8px;
}

.settings-header h3 {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: #818cf8;
}

.settings-header button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
}

.settings-control input[type="range"] {
    width: 100px;
    accent-color: #818cf8;
    background: rgba(255, 255, 255, 0.05);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

.hidden {
    display: none !important;
}

/* ── BOT BADGES AND AUTOMATION MAGENTA NODES ────────────────────── */
.badge-auto {
    background: rgba(236, 72, 153, 0.12);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #f472b6;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}
/* ── FRAMEWORK COMPARISON BARS ──────────────────────────────────── */
.frameworks-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    overflow-y: auto !important;
    max-height: 82px !important;
    padding-right: 4px !important;
    margin-top: 2px !important;
    justify-content: flex-start !important;
}

/* Custom scrollbar for frameworks panel */
.frameworks-layout::-webkit-scrollbar {
    width: 3px;
}
.frameworks-layout::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
.frameworks-layout::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.3);
    border-radius: 2px;
}

.framework-section-tag {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 700;
    color: #818cf8;
    letter-spacing: 1px;
    padding: 3px 0 1px;
    margin-top: 4px;
    border-bottom: 1px dashed rgba(129, 140, 248, 0.2);
}

.framework-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 18px;
}

.framework-label {
    font-family: var(--font-mono);
    font-size: 0.56rem;
    color: var(--color-text-secondary);
    width: 72px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.framework-bar-track {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.03);
    min-width: 40px;
}

.framework-bar-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.framework-bar-fill.mcp {
    background: var(--color-mcp);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.framework-bar-fill.langchain {
    background: var(--color-a2a);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

.framework-bar-fill.crewai {
    background: var(--color-openapi);
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.4);
}

.framework-bar-fill.smolagents {
    background: var(--color-rss);
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
}

.framework-val {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--color-text-primary);
    min-width: 64px;
    text-align: right;
    flex-shrink: 0;
}

/* Light Theme Overrides */
.light-theme .framework-bar-track {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.03);
}
.light-theme .framework-bar-fill {
    box-shadow: none !important;
}

/* ── POI / VIRAL TELEMETRY HIGHLIGHTS ────────────────────────────── */
.poi-label {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: #000000;
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 800;
    padding: 1px 3px;
    border-radius: 2px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
    letter-spacing: 0.5px;
    z-index: 5;
    animation: pulse 1.5s ease-in-out infinite;
}

.inspector-poi-banner {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.inspector-poi-banner .poi-icon {
    color: #f59e0b;
    font-size: 0.8rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.inspector-poi-banner .poi-text {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.5px;
}

/* ── Settings text input & divider ── */
.settings-text-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-rgba);
    border-radius: 6px;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 6px 10px;
    margin-top: 4px;
    outline: none;
    transition: border-color 0.2s;
}
.settings-text-input:focus { border-color: #818cf8; }
.settings-control.vertical { flex-direction: column; align-items: flex-start; }
.settings-divider {
    width: 100%;
    height: 1px;
    background: var(--border-rgba);
    margin: 8px 0;
}

/* ── AI Insights trigger button ── */
.ai-insights-trigger-btn {
    background: linear-gradient(135deg, rgba(129,140,248,0.15), rgba(139,92,246,0.1));
    border: 1px solid rgba(129,140,248,0.35);
    color: #818cf8;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ai-insights-trigger-btn:hover {
    background: rgba(129,140,248,0.25);
    border-color: #818cf8;
    box-shadow: 0 0 8px rgba(129,140,248,0.3);
}
.ai-insights-trigger-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── AI Insights floating panel ── */
.ai-insights-panel {
    position: absolute;
    bottom: 60px;
    left: 12px;
    right: 12px;
    z-index: 120;
    background: rgba(8, 10, 18, 0.94);
    border: 1px solid rgba(129,140,248,0.4);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 24px rgba(129,140,248,0.12);
    overflow: hidden;
    animation: slideUpPanel 0.3s ease;
}
@keyframes slideUpPanel {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(129,140,248,0.2);
    background: rgba(129,140,248,0.06);
}
.ai-insights-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #818cf8;
}
.ai-status-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--color-text-dim);
}
.ai-insights-body {
    padding: 12px 14px;
    max-height: 200px;
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    line-height: 1.65;
    color: var(--color-text-primary);
}
.ai-insights-placeholder {
    color: var(--color-text-dim);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-align: center;
    padding: 16px 0;
}
.ai-insights-body p { margin: 0 0 8px; }
.ai-insights-body strong { color: #818cf8; font-weight: 600; }
.ai-insights-body .insight-section {
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
    border-left: 2px solid rgba(129,140,248,0.4);
    border-radius: 0 4px 4px 0;
    margin-bottom: 8px;
}

/* ── Velocity arrows on framework bars ── */
.framework-velocity {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}
.vel-up   { color: #34d399; }
.vel-down { color: #f87171; }
.vel-flat { color: var(--color-text-dim); }

/* ── Correlation alert badge ── */
.correlation-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 6px;
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: #f59e0b;
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ── Simulation & Focus Button Styles ── */
.sim-btn {
    border-color: rgba(236, 72, 153, 0.4) !important;
    color: #ec4899 !important;
}
.sim-btn.active {
    background: rgba(236, 72, 153, 0.25) !important;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.4) !important;
}

.focus-btn {
    background: rgba(129, 140, 248, 0.12);
    border: 1px solid rgba(129, 140, 248, 0.35);
    color: #818cf8;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 4px;
    transition: all 0.2s ease;
}
.focus-btn:hover {
    background: rgba(129, 140, 248, 0.25);
    border-color: #818cf8;
}

.focus-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(129, 140, 248, 0.1);
    border: 1px dashed rgba(129, 140, 248, 0.4);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: #818cf8;
}
.clear-focus-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
}
.clear-focus-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ── Ecosystem Health Index (EHI) Badges ── */
.ehi-badge {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}
.ehi-high {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #34d399;
}
.ehi-med {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}
.ehi-low {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(245,158,11,0.2); }
    50%       { box-shadow: 0 0 12px rgba(245,158,11,0.5); }
}

/* ── MOBILE & TABLET RESPONSIVE ── */
@media (max-width: 1024px) {
    .main-content {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    .map-section {
        height: 450px;
    }
    .bottom-metrics-row {
        grid-template-columns: 1fr 1fr;
    }
    .flow-labels-overlay {
        display: none;
    }
}

@media (max-width: 640px) {
    .top-bar {
        flex-direction: column;
        height: auto;
        align-items: stretch;
    }
    .bottom-metrics-row {
        grid-template-columns: 1fr;
    }
    .sub-stats {
        display: none;
    }
}
