:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #8b5cf6;
    --bg-dark: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --sidebar-width: 260px;
    --header-height: 80px;
    --glass-blur: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Layout */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
}

.main-layout {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 3rem;
    letter-spacing: -0.5px;
}

/* Nav */
.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.5rem;
}

.nav-item i { font-size: 1.25rem; }

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

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 141, 0.3);
}

/* Header */
header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

/* Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover { transform: translateY(-5px); }
.stat-card h3 { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 1rem; }
.stat-value { font-size: 2.5rem; font-weight: 800; }

.content-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 24px;
    margin-bottom: 2rem;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.field-label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.875rem; }
.input-field {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--primary); }

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: scale(1.02); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; }

/* Tables/Lists */
.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.item-node {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
}
.badge-blue { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--sidebar-bg);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
}

/* Logs */
.log-viewer {
    background: #000;
    color: #4ade80;
    font-family: 'Fira Code', monospace;
    padding: 1.5rem;
    border-radius: 12px;
    height: 400px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}
.log-line { margin-bottom: 4px; }
.log-error { color: var(--danger); }
.log-warn { color: var(--warning); }
.log-info { color: var(--info); }

/* History List */
.history-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
.history-action { font-weight: 600; color: var(--primary); min-width: 120px; }
.history-time { color: var(--text-muted); font-size: 0.8rem; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 1.5rem 0.5rem; }
    .sidebar span { display: none; }
    .main-layout { margin-left: 80px; }
    .logo { justify-content: center; }
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* User Card System */
.user-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.user-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.user-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}
.user-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}
.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}
.user-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.user-card-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.user-card-row i { color: var(--primary); width: 16px; text-align: center; }

.user-card-footer {
    margin-top: 0.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.user-login-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.user-info-rows {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.user-nickname {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}
.user-city-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-block;
}

.user-id-badge {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.6rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}