:root {
    --primary: #6366f1;
    /* Indigo base */
    --primary-hover: #4f46e5;
    --secondary: #94a3b8;
    /* Slate text */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Global Neutral Scale */
    --background: #020617;
    /* Blackish Background */
    --card-bg: #0f172a;
    /* Deep Slate Card */
    --sidebar-bg: #030712;
    /* Near black Sidebar */
    --header-bg: rgba(2, 6, 23, 0.8);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-bright: rgba(255, 255, 255, 0.12);

    --sidebar-width: 260px;
    --header-height: 70px;
    --radius: 1rem;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Remove main browser scroller */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
}

/* Global Professional Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--text-main);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    border-right: 1px solid var(--glass-border);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.sidebar-content::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Header stays fixed, body scrolls */
}

.header {
    height: var(--header-height);
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.content-body {
    padding: 2rem;
    flex: 1;
    overflow: auto;
    background-color: var(--background);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: background 0.2s;
    border-radius: 8px;
}

.user-profile:hover {
    background: var(--glass-border);
}

#userAvatar {
    width: 35px;
    height: 35px;
    min-width: 35px;
    min-height: 35px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    border: 2px solid var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

#userNameDisplay {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    line-height: normal;
}

/* Sidebar Styling */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 1.65rem;
    font-weight: 800;
    color: #adebb3;
    /* Pastel Green */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.02em;
}

.brand-text {
    color: #adebb3;
    /* Pastel Green */
    text-transform: uppercase;
}

.logo-icon {
    display: none;
    /* Removed as requested */
}

.sidebar-menu {
    padding: 1.5rem 0;
    list-style: none;
}

.menu-label {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-400);
    letter-spacing: 0.05em;
    opacity: 0.6;
}

.menu-item {
    margin-bottom: 0.15rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--gray-400);
    text-decoration: none;
    transition: all 0.2s;
    gap: 0.75rem;
    border-left: 4px solid transparent;
}

.menu-link.active {
    color: #adebb3;
    background-color: rgba(173, 235, 179, 0.08);
    border-left-color: #adebb3;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(99, 102, 241, 0.1) !important;
    color: var(--primary) !important;
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--secondary);
    font-weight: 500;
}

.stat-info p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables - Compressed for high-density view */
.table-container {
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    width: 100%;
    margin-bottom: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    /* Allow columns to pack tightly */
}

th {
    text-align: left;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--glass-border-bright);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-main);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ensure actions column is always visible but compact */
td:last-child {
    width: 1%;
    white-space: nowrap;
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border-bright);
    border-radius: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade {
    animation: slideIn 0.3s ease-out forwards;
}

/* Online/Offline Status Indicator */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-online {
    background-color: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    position: relative;
}

.status-online::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    left: 0;
    top: 0;
    background-color: var(--success);
    opacity: 0.6;
    animation: pulse 1.5s infinite;
}

.status-offline {
    background-color: var(--gray-400);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Footer Styling */
.app-footer {
    padding: 1.5rem 2rem;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--secondary);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.app-footer p {
    margin: 0;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--glass-border-bright);
    border-radius: var(--radius);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.close-btn:hover {
    color: var(--text-main);
}