:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #f1f5f9;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --sidebar-width: 260px;
    --header-height: 60px;
}

* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

body {
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 2.5rem;
    width: calc(100% - var(--sidebar-width));
    max-width: none;
}

.main-content>* {
    max-width: 100%;
}

/* Mobile Navbar - Hidden on Desktop */
.mobile-navbar {
    display: none;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    padding: 0 1.25rem;
    align-items: center;
    justify-content: space-between;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.overlay.overlay-active {
    display: block;
}

/* UI Elements */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--accent);
}

.btn-error {
    background: #fee2e2;
    color: var(--error);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s;
    gap: 0.75rem;
}

.nav-link:hover,
.nav-link.active {
    background: var(--accent);
    color: var(--primary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.stat-card {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    background: var(--accent);
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: #ecfdf5;
    color: #059669;
}

.badge-error {
    background: #fef2f2;
    color: #dc2626;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Utility Classes */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

/* ============================================
   RESPONSIVE DESIGN - Mobile & Tablet
   ============================================ */

@media (max-width: 1400px) {

    /* Adjust stats grid for medium screens */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {

    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
    }

    /* Show sidebar when open class is added */
    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    }

    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
        padding-top: calc(var(--header-height) + 1.5rem);
    }

    /* Show mobile navbar */
    .mobile-navbar {
        display: flex !important;
    }

    /* Stack grids on mobile */
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr !important;
    }

    /* Stats grid mobile optimization */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 640px) {

    /* Further mobile optimizations */
    .main-content {
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
    }

    .stat-card {
        padding: 1.25rem;
    }

    th,
    td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}