* { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    box-sizing: border-box; 
}
code, .mono { 
    font-family: 'JetBrains Mono', monospace; 
}

:root[data-theme="dark"] {
    --bg-primary: #020617;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --bg-elevated: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --border-hover: #334155;
    --accent: #10b981;
    --accent-hover: #059669;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(99, 102, 241, 0.1);
}

:root[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --accent: #10b981;
    --accent-hover: #059669;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
}

body { 
    background: var(--bg-primary); 
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}
.bg-glow {
    position: fixed;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.glass { 
    background: var(--glass-bg); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); 
}
.glass-card { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover { 
    border-color: var(--border-hover);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.gradient-text { 
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 50%, #8b5cf6 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.gradient-emerald { background: linear-gradient(135deg, #10b981, #059669); }
.gradient-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.gradient-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.gradient-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.gradient-rose { background: linear-gradient(135deg, #f43f5e, #e11d48); }

.sidebar-link { 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    position: relative;
    color: var(--text-secondary);
}
.sidebar-link:hover { 
    background: var(--bg-tertiary); 
    color: var(--text-primary);
}
.sidebar-link.active { 
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), transparent);
    color: var(--accent);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #06b6d4);
    opacity: 0;
    transition: opacity 0.3s;
}
.stat-card:hover { 
    transform: translateY(-4px); 
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
.stat-card:hover::before { opacity: 1; }

.btn-primary { 
    background: linear-gradient(135deg, #10b981, #059669);
    transition: all 0.3s ease;
    color: white;
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4); 
}
.btn-danger { 
    background: linear-gradient(135deg, #ef4444, #dc2626); 
    color: white;
    transition: all 0.3s ease; 
}
.btn-danger:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4); 
}
.btn-ghost { 
    background: var(--bg-tertiary); 
    border: 1px solid var(--border-color); 
    color: var(--text-primary);
    transition: all 0.2s ease; 
}
.btn-ghost:hover { 
    background: var(--bg-elevated); 
    border-color: var(--border-hover);
}

.table-row { transition: all 0.2s ease; }
.table-row:hover { background: var(--bg-tertiary); }

input, select, textarea { 
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    outline: none;
}

.fade-in { animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.pulse-dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.2); } }

.modal-overlay { 
    background: rgba(0,0,0,0.7); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-content { 
    animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}
@keyframes modalIn { 
    from { transform: scale(0.9) translateY(20px); opacity: 0; } 
    to { transform: scale(1) translateY(0); opacity: 1; } 
}

.badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 4px;
    padding: 4px 10px; 
    border-radius: 8px; 
    font-size: 11px; 
    font-weight: 600;
    letter-spacing: 0.02em;
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast { 
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
@keyframes toastIn { 
    from { transform: translateX(120%); opacity: 0; } 
    to { transform: translateX(0); opacity: 1; } 
}
.toast.hide {
    animation: toastOut 0.3s ease forwards;
}
@keyframes toastOut {
    to { transform: translateX(120%); opacity: 0; }
}

.command-palette {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
.command-palette.show { display: flex; }
.command-content {
    width: 100%;
    max-width: 600px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}
.command-input {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 16px;
}
.command-input:focus { outline: none; box-shadow: none; }
.command-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}
.command-item {
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.command-item:hover, .command-item.selected {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.command-item i { width: 20px; text-align: center; }

.timeline-item {
    position: relative;
    padding-left: 32px;
    padding-bottom: 24px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 24px;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-secondary);
}

/* System Stats Bars */
.system-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
}
.system-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s ease;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}
.theme-toggle:hover {
    background: var(--bg-elevated);
    color: var(--accent);
    transform: rotate(15deg);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 16px;
    color: var(--text-muted);
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
