:root {
    --bg-color: #060913;
    --sidebar-bg: #0b0f1e;
    --card-bg: rgba(13, 19, 36, 0.65);
    --card-bg-solid: #0d1324;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-cyan: #00f0ff;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-red: #f43f5e;
    --accent-amber: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow-cyan: rgba(0, 240, 255, 0.25);
    --border-glow-blue: rgba(59, 130, 246, 0.25);
    --font-family: 'Outfit', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==========================================
   0. LOGIN PORTAL OVERLAY
   ========================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 6, 14, 0.9);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at center, rgba(0, 240, 255, 0.08) 0%, transparent 60%),
        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: 100% 100%, 30px 30px, 30px 30px;
}

.login-card {
    background: rgba(13, 19, 36, 0.85);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.15), var(--card-shadow);
    backdrop-filter: blur(8px);
    animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    font-size: 3rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.4));
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-header h2 span {
    color: var(--accent-cyan);
    font-weight: 300;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s;
    font-family: var(--font-family);
}

.login-form input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.login-role-select {
    margin-bottom: 1.75rem;
}

.role-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.role-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.role-option:hover {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
}

.role-option.active {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.login-error-msg {
    color: var(--accent-red);
    font-size: 0.8rem;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    padding: 0.6rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-login {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 0.9rem;
    border-radius: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}


/* ==========================================
   1. SIDEBAR
   ========================================== */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-left: 0.5rem;
}

.logo-icon {
    font-size: 1.75rem;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.3));
}

.sidebar-header h2 {
    font-size: 1.35rem;
    font-weight: 800;
}

.sidebar-header span {
    font-weight: 300;
    color: var(--text-secondary);
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-info h3 {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-info p {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    margin-top: 0.15rem;
    font-weight: 500;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-logout:hover {
    color: var(--accent-red);
    background: rgba(244, 63, 94, 0.1);
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.sidebar-nav li.active a {
    background-image: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(0, 240, 255, 0.05));
    color: var(--accent-cyan);
    border-left: 3px solid var(--accent-cyan);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.sidebar-footer {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    padding-top: 1rem;
}

.soc-badge {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 240, 255, 0.2);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.65rem;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.1);
}


/* ==========================================
   2. MAIN CONTENT & TOPBAR
   ========================================== */
.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    height: 100vh;
}

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

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.header-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--accent-green);
    font-weight: 700;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

.pulse {
    width: 6px;
    height: 6px;
    background-color: var(--accent-green);
    border-radius: 50%;
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn {
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    font-family: var(--font-family);
}

.btn-primary {
    background-color: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
    box-shadow: 0 0 12px var(--border-glow-blue);
}

.btn-success {
    background-color: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}


/* ==========================================
   3. METRICS GRID
   ========================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.08);
}

.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.metric-icon.blue { background-color: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.metric-icon.green { background-color: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.metric-icon.purple { background-color: rgba(139, 92, 246, 0.12); color: var(--accent-purple); }
.metric-icon.red { background-color: rgba(244, 63, 94, 0.12); color: var(--accent-red); }

.metric-data h3 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-data p {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 0.15rem;
    color: var(--text-primary);
}


/* ==========================================
   4. DASHBOARD LAYOUT & PANELS
   ========================================== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 2.8fr 1.2fr;
    gap: 1.25rem;
}

.dashboard-main-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1.7fr 1.1fr;
    gap: 1.25rem;
}

.chart-card {
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(8px);
}

.chart-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    position: relative;
    height: 240px;
    width: 100%;
}

/* Alert panel */
.alert-panel {
    display: flex;
    flex-direction: column;
    height: 310px;
}

.alert-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-right: 0.25rem;
}

.alert-item {
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    border-left: 3px solid transparent;
    background: rgba(255, 255, 255, 0.015);
}

.alert-item.info {
    border-left-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.alert-item.warning {
    border-left-color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.05);
    animation: alertPulse 3s infinite;
}

.alert-item.danger {
    border-left-color: var(--accent-red);
    background: rgba(244, 63, 94, 0.06);
}

@keyframes alertPulse {
    0% { box-shadow: inset 0 0 0 0 rgba(245, 158, 11, 0.05); }
    50% { box-shadow: inset 0 0 10px 0 rgba(245, 158, 11, 0.08); }
    100% { box-shadow: inset 0 0 0 0 rgba(245, 158, 11, 0.05); }
}

.alert-time {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.2rem;
}

.alert-text {
    font-weight: 500;
    line-height: 1.3;
}

.alert-ip {
    display: block;
    margin-top: 0.2rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.65rem;
}

/* Quick server status list */
.quick-server-status {
    height: calc(100% - 310px - 1.25rem);
    display: flex;
    flex-direction: column;
}

.quick-server-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}

.quick-server-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.quick-server-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.quick-server-stats {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.75rem;
}


/* ==========================================
   5. TABLES & AUDIT VIEW
   ========================================== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.audit-table th {
    background-color: rgba(0, 0, 0, 0.25);
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.audit-table td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.audit-table tbody tr {
    transition: background-color 0.2s;
}

.audit-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.badge {
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-relay { background-color: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.25); }
.badge-register { background-color: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-offline { background-color: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.25); }

.btn-small {
    background-color: transparent;
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-small:hover {
    background-color: var(--accent-cyan);
    color: var(--bg-color);
    border-color: var(--accent-cyan);
}

.btn-small.btn-detail {
    color: #818cf8; /* Soft Indigo */
    border-color: rgba(129, 140, 248, 0.3);
}

.btn-small.btn-detail:hover {
    background-color: #818cf8;
    color: var(--bg-color);
    border-color: #818cf8;
}

.btn-activity {
    background-color: rgba(0, 240, 255, 0.05);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 240, 255, 0.25);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-activity:hover {
    background-color: var(--accent-cyan);
    color: var(--bg-color);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.text-emerald { color: var(--accent-green) }
.text-rose { color: var(--accent-red) }
.text-indigo { color: #a5b4fc }
.text-muted { color: var(--text-secondary) }
.font-semibold { font-weight: 600 }


/* ==========================================
   6. FILTER PANEL & PAGINATION
   ========================================== */
.filter-panel {
    display: flex;
    gap: 1.25rem;
    background-color: var(--card-bg);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.filter-group input, .filter-group select {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem;
    border-radius: 6px;
    font-family: var(--font-family);
    outline: none;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.filter-group input:focus, .filter-group select:focus {
    border-color: var(--accent-cyan);
}

.pagination-footer {
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

.pagination-footer span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}


/* ==========================================
   7. ADMIN PANEL GRID & CRUD FORMS
   ========================================== */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 1.25rem;
}

.admin-form-card {
    height: fit-content;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.admin-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.admin-form label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.admin-form input, .admin-form select {
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    outline: none;
    font-family: var(--font-family);
    font-size: 0.85rem;
    transition: all 0.3s;
}

.admin-form input:focus, .admin-form select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

.form-actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.table-compact th {
    padding: 0.6rem 0.85rem;
    font-size: 0.7rem;
}

.table-compact td {
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
}


/* ==========================================
   8. SERVERS & SETTINGS MONITOR
   ========================================== */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.server-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.server-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.12);
}

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

.server-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    text-transform: uppercase;
}

.server-status.online {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.server-stats {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-bar-container {
    width: 100%;
    height: 5px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background-color: var(--accent-blue);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-bar.green { background-color: var(--accent-green); }
.stat-bar.purple { background-color: var(--accent-purple); }

.server-footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.6rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
}

.footer-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.footer-item span:first-child {
    color: var(--text-secondary);
    font-size: 0.65rem;
}

.footer-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}


/* ==========================================
   9. MODALS & DETAILED ACTIVITY DRAWER
   ========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 6, 14, 0.85);
    backdrop-filter: blur(6px);
}

.modal-content {
    background-color: var(--card-bg-solid);
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: loginFadeIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.close {
    color: var(--text-secondary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: white;
}

.modal-body pre {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

/* Slide-over drawer */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer.active {
    visibility: visible;
    opacity: 1;
}

.drawer-content {
    position: absolute;
    top: 0;
    right: -460px;
    width: 460px;
    height: 100%;
    background-color: var(--card-bg-solid);
    border-left: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.active .drawer-content {
    right: 0;
}

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

.drawer-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
}

.drawer-close:hover {
    color: white;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.drawer-profile-summary {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.drawer-avatar {
    width: 48px;
    height: 48px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.drawer-details h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.drawer-device-meta {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--text-secondary);
}

/* Timeline component inside drawer */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-badge {
    position: absolute;
    left: -28px;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--bg-color);
    box-shadow: 0 0 0 3px var(--card-bg-solid);
}

.timeline-panel {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    position: relative;
    transition: transform 0.2s;
}

.timeline-panel:hover {
    transform: translateX(3px);
    border-color: rgba(255, 255, 255, 0.15);
}

.timeline-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
}

.timeline-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.timeline-body p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.35;
}


/* ==========================================
   10. TOAST NOTIFICATIONS (POPUP)
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100000;
    max-width: 360px;
    width: 100%;
}

.toast {
    background: #0b0f1e;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    position: relative;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.info { border-left: 4px solid var(--accent-blue); }
.toast.warning { border-left: 4px solid var(--accent-amber); }
.toast.error { border-left: 4px solid var(--accent-red); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(30px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.toast-icon {
    font-size: 1.2rem;
    margin-top: 0.15rem;
}

.toast.success .toast-icon { color: var(--accent-green); }
.toast.info .toast-icon { color: var(--accent-blue); }
.toast.warning .toast-icon { color: var(--accent-amber); }
.toast.error .toast-icon { color: var(--accent-red); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: block;
    color: var(--text-secondary);
}

.toast-message {
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.15rem;
    color: var(--text-primary);
    line-height: 1.35;
}

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

.toast-close:hover {
    color: white;
}


/* ==========================================
   11. RESPONSIVE DESIGN & UTILS
   ========================================== */
.peer-status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.peer-status-badge.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.peer-status-badge.offline {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

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

.peer-status-badge.online .peer-status-dot {
    background-color: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

.peer-status-badge.offline .peer-status-dot {
    background-color: var(--accent-red);
}

.tab-view {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease;
}

.tab-view.active {
    display: flex;
}

.sidebar-nav li {
    cursor: pointer;
}

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

@media (max-width: 1200px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .quick-server-status {
        height: auto;
    }
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
    }
    .sidebar-header {
        margin-bottom: 1rem;
    }
    .profile-card {
        margin-bottom: 1rem;
    }
    .filter-panel {
        flex-direction: column;
        gap: 0.75rem;
    }
    .drawer-content {
        width: 100%;
        right: -100%;
    }
}

/* Forzar visibilidad y estilo del icono del calendario en tema oscuro */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
