:root {
    --primary: #0f172a;
    /* Slate 900 - Premium Dark */
    --primary-light: #334155;
    /* Slate 700 */
    --secondary: #3b82f6;
    /* Blue 500 - Vibrant Action */
    --secondary-hover: #2563eb;
    --accent: #10b981;
    /* Emerald */
    --background: #f1f5f9;
    /* Slate 100 - Clean Canvas */
    --surface: #ffffff;
    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border: #e2e8f0;
    --border-light: rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 16px;
    /* Softer corners */
    --radius-lg: 24px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.08);
    /* Modern diffuse shadow */
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.12);
    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Sarabun', -apple-system, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--secondary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(59, 130, 246, 0.6);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    background: var(--surface);
}

.btn-outline:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: var(--shadow-sm);
}

.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
}

/* Dashboard Grid */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

@media (max-width: 640px) {
    .stat-value {
        font-size: 1.5rem;
    }
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Base Responsive */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    background: var(--surface);
    padding: 1rem;
    z-index: 101;
    box-shadow: var(--shadow-sm);
    justify-content: space-between;
    align-items: center;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    position: relative;
    transition: all 0.3s;
}

.menu-toggle span::before,
.menu-toggle span::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--primary);
    left: 0;
    transition: all 0.3s;
}

.menu-toggle span::before {
    top: -8px;
}

.menu-toggle span::after {
    bottom: -8px;
}

.menu-toggle.active span {
    background: transparent;
}

.menu-toggle.active span::before {
    transform: rotate(45deg);
    top: 0;
}

.menu-toggle.active span::after {
    transform: rotate(-45deg);
    bottom: 0;
}

/* Sidebar & Navigation */
.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--primary);
    color: white;
    padding: 2.5rem 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.sidebar h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    padding-left: 0.5rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.3s ease;
    gap: 0.75rem;
}

.nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Adjust main content for sidebar */
.main-content {
    margin-left: 280px;
    padding: 2.5rem;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-header {
        display: flex;
    }
}

@media (max-width: 640px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    header .flex-center {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .card {
        padding: 1.25rem;
    }

    header h1 {
        font-size: 1.5rem;
    }
}

/* Table Responsiveness */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}