:root {
    --bg-deep: #020617;
    --bg-side: #030712;
    --bg-glass: rgba(15, 23, 42, 0.6);
    --bg-surface: rgba(30, 41, 59, 0.4);

    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #f43f5e;

    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --text-muted: #64748b;

    --border: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.15);

    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* Layering Effects */
.crt-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 9999;
}

.ambient-glow {
    position: fixed;
    top: 0;
    right: 0;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-name {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-dim);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.2);
}

.nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sidebar-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.status-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    border-radius: var(--radius-md);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--error);
}

.status-dot.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        transform: scale(1.2);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(1);
    }
}

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

.status-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 800;
}

.status-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--success);
}

/* Workspace */
.app-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent 800px);
}

.workspace-header {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.header-search input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 30px;
    color: white;
    width: 320px;
    font-family: inherit;
    transition: 0.3s;
}

.header-search input:focus {
    width: 400px;
    outline: none;
    border-color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    width: 24px;
    height: 24px;
}

.icon-btn svg {
    fill: currentColor;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    border-left: 1px solid var(--border);
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dim);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

/* Tabs */
.workspace-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.content-tab {
    display: none;
    flex-direction: column;
    gap: 2rem;
}

.content-tab.active {
    display: flex;
    animation: tabFade 0.3s ease;
}

@keyframes tabFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Action Button */
.action-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
}

.action-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* Toasts */
.toast-stack {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20000;
}

.toast {
    background: var(--bg-side);
    border: 1px solid var(--border-bright);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border-left: 4px solid var(--accent);
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.fade-out {
    opacity: 0 !important;
    transform: translateX(20px) !important;
    transition: 0.4s;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-deep);
    border: 1px solid var(--border-bright);
    width: 90%;
    max-width: 1000px;
    height: 80%;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    background: #000;
}

/* Responsiveness */
@media (max-width: 900px) {
    .app-sidebar {
        width: 80px;
        padding: 2rem 0.5rem;
        align-items: center;
    }

    .brand-name,
    .nav-btn span,
    .status-info {
        display: none;
    }

    .nav-btn {
        justify-content: center;
        width: 50px;
        height: 50px;
        padding: 0;
    }
}

.modal-card.mini {
    max-width: 500px;
    height: auto;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 20000;
    min-width: 180px;
    overflow: hidden;
}

.menu-item {
    padding: 10px 15px;
    font-size: 0.85rem;
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}

.menu-item:hover {
    background: var(--accent);
    color: white;
}

.menu-item.border-top {
    border-top: 1px solid #333;
}

.menu-item span {
    font-size: 1rem;
}