:root {
    /* Color Palette - Vibrant & Modern */
    --primary-color: #6366f1;
    /* Indigo */
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    /* Pink */
    --success-color: #10b981;
    /* Emerald */
    --warning-color: #f59e0b;
    /* Amber */
    --danger-color: #ef4444;
    /* Red */
    --background-dark: #0f172a;
    /* Slate 900 */
    --background-card: #1e293b;
    /* Slate 800 */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-neon: 0 0 15px rgba(99, 102, 241, 0.3);
    --transition-fast: 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--background-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glassmorphism Cards */
.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-main);
    font-size: 0.95rem;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Layout - Sidebar & Main Content */
.sidebar {
    width: 280px;
    background-color: var(--background-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    gap: 0.75rem;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.5rem 0 0.5rem 1rem;
    font-weight: 700;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--background-card);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-info .stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.stat-info .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Login/Public Layout */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: radial-gradient(circle at top right, var(--background-card), var(--background-dark));
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.auth-logo {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* Hide elements utility */
.hidden {
    display: none !important;
}

/* Hamburger button: only visible on tablet/mobile */
.mobile-only {
    display: none;
}

/* =============================================
   RESPONSIVE — Tablet (768 - 1024px)
   ============================================= */
@media (max-width: 1024px) and (min-width: 769px) {
    .mobile-only {
        display: inline-flex;
    }

    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        padding: 1.5rem 2rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================
   RESPONSIVE — Mobile (≤ 768px)
   ============================================= */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    /* Sidebar: hidden off-canvas, slides in when .open */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
        overflow-y: auto;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
    }

    /* Main content fills full width */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
    }

    /* Header */
    .top-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .user-profile {
        width: 100%;
        justify-content: space-between;
    }

    /* Hamburger button: always visible on mobile */
    .mobile-only {
        display: inline-flex;
    }

    /* Title sizing */
    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    /* Dashboard stats: single column */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Stat values smaller on mobile */
    .stat-info .stat-value {
        font-size: 1.8rem;
    }

    /* ---- Tables: horizontal scroll ---- */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.85rem;
    }

    /* ---- Forms: collapse 2-col grids to 1 ---- */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Search bar full width */
    #searchClientInput {
        width: 100% !important;
    }

    /* Buttons smaller on mobile */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }

    /* Glass cards: tighter padding */
    .glass-card {
        padding: 1rem;
    }

    /* QR in dashboard: hide preview, show only button */
    #qrPreview {
        display: none;
    }
}