:root {
    --bg-app: #09090b;
    --bg-sidebar: rgba(20, 20, 25, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(30, 30, 35, 0.6);
    --glass-hover: rgba(40, 40, 45, 0.8);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --accent: #0ea5e9; /* Sky Blue */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius: 12px;
    --font-main: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

/* Background Effect */
.background-glow {
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 70%);
    top: -200px; left: -200px;
    z-index: -1;
    pointer-events: none;
}

.app-container { display: flex; height: 100%; width: 100%; }

/* --- GLASSMORPHISM UTILS --- */
.glass {
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--glass-border);
}
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
}

/* --- SIDEBAR --- */
.sidebar {
    width: 280px;
    display: flex; flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.brand-section {
    height: 70px; display: flex; align-items: center; padding: 0 24px;
    border-bottom: 1px solid var(--glass-border); gap: 12px;
}
.logo-icon { color: var(--primary); font-size: 22px; }
.logo-text { font-weight: 700; font-size: 18px; letter-spacing: -0.5px; }
.logo-text span { color: var(--primary); }

.sidebar-content { flex: 1; padding: 24px; overflow-y: auto; }

.nav-group { margin-bottom: 32px; }
.nav-group label {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    letter-spacing: 1px; text-transform: uppercase; display: block; 
    margin-bottom: 12px; padding-left: 12px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius);
    color: var(--text-secondary); text-decoration: none;
    font-weight: 500; transition: all 0.2s ease; margin-bottom: 4px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); transform: translateX(2px); }
.nav-item.active { 
    background: rgba(99, 102, 241, 0.15); color: #fff; 
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.nav-item i { width: 20px; text-align: center; }

.highlight-item { color: #fff; }
.nav-badge {
    margin-left: auto; background: var(--primary); color: white;
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
}
.pulse-badge { animation: pulse-soft 2s infinite; }

.site-selector { margin-bottom: 24px; }
.site-selector label { font-size: 10px; color: var(--text-muted); margin-bottom: 6px; display: block; font-weight: 600; padding-left: 4px;}
.custom-select { position: relative; }
.custom-select select {
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border);
    color: var(--text-primary); padding: 10px; border-radius: var(--radius);
    font-size: 13px; appearance: none; cursor: pointer; transition: 0.2s;
}
.custom-select select:hover { border-color: var(--text-secondary); }
.custom-select i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

.status-card {
    display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 30px; position: relative; overflow: hidden;
}
.status-card.connected .status-icon { color: var(--success); }
.status-card.disconnected .status-icon { color: var(--text-muted); }
.status-info .label { font-size: 10px; color: var(--text-muted); display: block; }
.status-info .value { font-size: 12px; font-weight: 600; }
.status-indicator {
    width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
    position: absolute; right: 12px; top: 12px;
}
.status-card.connected .status-indicator { background: var(--success); box-shadow: 0 0 8px var(--success); }

.sidebar-footer { padding: 24px; border-top: 1px solid var(--glass-border); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border: none; color: #fff; padding: 12px; border-radius: var(--radius);
    font-weight: 600; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px;
    font-size: 13px; transition: 0.3s; position: relative; overflow: hidden;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px var(--primary-glow); }
.full-width { width: 100%; }

.system-status { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online { background: var(--success); box-shadow: 0 0 5px var(--success); }

/* --- MAIN --- */
.main-area { flex: 1; display: flex; flex-direction: column; background: transparent; position: relative; z-index: 1; }
.top-header {
    height: 70px; border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center; padding: 0 32px;
}
.header-left h1 { font-size: 20px; font-weight: 600; color: var(--text-primary); }
.breadcrumbs { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.breadcrumbs span:last-child { color: var(--text-secondary); }

.last-update {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px;
    font-size: 12px; color: var(--text-secondary); margin-right: 12px;
}
.btn-icon {
    background: transparent; border: 1px solid var(--glass-border); color: var(--text-secondary);
    width: 36px; height: 36px; border-radius: 8px; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: #fff; }

.content-scroll { flex: 1; overflow-y: auto; padding: 32px; position: relative; }
.dashboard-grid { display: flex; flex-direction: column; gap: 24px; animation: fadeIn 0.5s ease-out; }

/* --- KPIS & CHARTS --- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.card {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius);
    padding: 24px; position: relative; backdrop-filter: blur(10px);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.big-number { font-size: 32px; font-weight: 700; color: var(--text-primary); font-family: var(--font-mono); }
.sub-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.chart-container { position: relative; height: 320px; width: 100%; margin-top: 10px; }

/* --- TABLES --- */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; padding: 14px 20px; color: var(--text-secondary);
    font-weight: 600; border-bottom: 1px solid var(--glass-border); background: rgba(0,0,0,0.2);
    text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px;
}
.data-table td { padding: 14px 20px; border-bottom: 1px solid var(--glass-border); color: var(--text-primary); vertical-align: middle; }
.data-table tr:hover td { background: rgba(255,255,255,0.03); }

/* --- BADGES --- */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border: 1px solid; }
.badge.critical { background: rgba(239, 68, 68, 0.1); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.badge.high { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border-color: rgba(245, 158, 11, 0.2); }
.badge.medium { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }
.badge.success { background: rgba(16, 185, 129, 0.1); color: #34d399; border-color: rgba(16, 185, 129, 0.2); }

/* --- MISSION CARDS --- */
.mission-card {
    background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border); border-radius: var(--radius);
    padding: 20px; display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s ease; cursor: pointer; margin-bottom: 12px;
}
.mission-card:hover { transform: translateX(4px); border-color: var(--primary); background: rgba(99,102,241,0.05); }
.mission-info h4 { font-size: 15px; margin-bottom: 6px; color: var(--text-primary); font-weight: 500; }
.mission-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 12px; align-items: center; margin-top: 8px;}
.mission-meta i { color: var(--primary); }

.btn-secondary {
    background: rgba(255,255,255,0.05); color: var(--text-primary); 
    border: 1px solid var(--glass-border); padding: 8px 16px; 
    border-radius: var(--radius); cursor: pointer; font-size: 12px; font-weight: 500;
    transition: 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* --- MODAL --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
    z-index: 100; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-window {
    width: 600px; max-width: 90%; background: #18181b; 
    border: 1px solid var(--glass-border); border-radius: 16px; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); transform: scale(0.95); transition: transform 0.3s;
}
.modal-overlay.active .modal-window { transform: scale(1); }

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-title i { color: var(--primary); }
.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; line-height: 1.6; color: var(--text-secondary); }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--glass-border); display: flex; justify-content: flex-end; gap: 12px; }

.close-modal { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; transition: color 0.2s; }
.close-modal:hover { color: #fff; }

/* --- LOADER --- */
.loader-overlay { display: none; position: absolute; inset: 0; background: rgba(9,9,11,0.7); backdrop-filter: blur(2px); z-index: 50; align-items: center; justify-content: center; border-radius: var(--radius); }
.loader-content { padding: 24px; display: flex; flex-direction: column; align-items: center; border-radius: 16px; background: #18181b; border: 1px solid var(--glass-border); }
.spinner { 
    width: 40px; height: 40px; border: 3px solid rgba(99,102,241,0.1); 
    border-top-color: var(--primary); border-radius: 50%; 
    animation: spin 1s infinite linear; margin-bottom: 16px; 
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 0% { box-shadow: 0 0 0 0 rgba(99,102,241, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(99,102,241, 0); } 100% { box-shadow: 0 0 0 0 rgba(99,102,241, 0); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- UTILS --- */
.flex-split { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.code-block { background: #000; padding: 16px; border-radius: 8px; font-family: var(--font-mono); font-size: 12px; color: #a5f3fc; border: 1px solid var(--glass-border); margin-top: 16px; white-space: pre-wrap; }
