/* ==========================================================================
   MANGO CARE ADMIN - PROFESSIONAL DESIGN SYSTEM
   Primary: #005343 (Deep Forest Green)
   Secondary: #D4AF37 (Warm Gold)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */

:root {
    /* Primary Colors - Deep Forest Green */
    --primary-50: #e6f2ef;
    --primary-100: #ccdfdb;
    --primary-200: #99bfb7;
    --primary-300: #669f93;
    --primary-400: #337f6f;
    --primary-500: #005343;
    /* Main primary */
    --primary-600: #004235;
    --primary-700: #003227;
    --primary-800: #00211a;
    --primary-900: #00110c;

    /* Secondary Colors - Warm Gold */
    --secondary-50: #fbf7e9;
    --secondary-100: #f5e9c4;
    --secondary-200: #eedb9f;
    --secondary-300: #e8cd79;
    --secondary-400: #e1bf54;
    --secondary-500: #D4AF37;
    /* Main secondary */
    --secondary-600: #b8942e;
    --secondary-700: #9c7925;
    --secondary-800: #805e1c;
    --secondary-900: #644313;

    /* Neutral Colors - Sophisticated Grays */
    --neutral-50: #fafafa;
    --neutral-100: #f5f5f5;
    --neutral-200: #e8e8e8;
    --neutral-300: #d6d6d6;
    --neutral-400: #b8b8b8;
    --neutral-500: #8f8f8f;
    --neutral-600: #666666;
    --neutral-700: #4d4d4d;
    --neutral-800: #333333;
    --neutral-900: #1a1a1a;

    /* Semantic Colors */
    --success-50: #ecfdf5;
    --success-500: #10b981;
    --success-600: #059669;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Background & Surface */
    --bg-primary: var(--neutral-50);
    --bg-secondary: #ffffff;
    --surface-white: #ffffff;
    --surface-light: var(--neutral-50);
    --surface-dark: var(--neutral-800);

    /* Text Colors */
    --text-primary: var(--neutral-900);
    --text-secondary: var(--neutral-700);
    --text-tertiary: var(--neutral-500);
    --text-disabled: var(--neutral-400);
    --text-inverse: #ffffff;

    /* Border Colors */
    --border-light: var(--neutral-200);
    --border-medium: var(--neutral-300);
    --border-focus: var(--primary-500);

    /* Spacing System - 4px base */
    --space-1: 0.25rem;
    /* 4px */
    --space-2: 0.5rem;
    /* 8px */
    --space-3: 0.75rem;
    /* 12px */
    --space-4: 1rem;
    /* 16px */
    --space-5: 1.25rem;
    /* 20px */
    --space-6: 1.5rem;
    /* 24px */
    --space-8: 2rem;
    /* 32px */
    --space-10: 2.5rem;
    /* 40px */
    --space-12: 3rem;
    /* 48px */
    --space-16: 4rem;
    /* 64px */

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */

    /* Font Weights */
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Border Radius */
    --radius-xs: 0.25rem;
    /* 4px */
    --radius-sm: 0.375rem;
    /* 6px */
    --radius-md: 0.5rem;
    /* 8px */
    --radius-lg: 0.75rem;
    /* 12px */
    --radius-xl: 1rem;
    /* 16px */
    --radius-2xl: 1.5rem;
    /* 24px */
    --radius-full: 9999px;

    /* Layout */
    --sidebar-width: 280px;
    --header-height: 72px;
    --container-max-width: 1440px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: var(--font-size-base);
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(145deg, var(--primary-700), var(--primary-500));
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(212, 175, 55, 0.15) 0%, transparent 40%);
    z-index: 1;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%);
    animation: spin 60s linear infinite;
    z-index: 1;
}

.login-container {
    width: min(440px, 90%);
    z-index: 2;
    animation: slideUp 0.6s var(--transition-bounce);
}

.login-box {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-2xl);
    padding: var(--space-12) var(--space-8);
    box-shadow: var(--shadow-2xl);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--secondary-500), var(--primary-500));
    background-size: 200% 100%;
    animation: pulse 3s infinite;
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-header .logo {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-medium);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */

.form-group {
    margin-bottom: var(--space-5);
    animation: slideInLeft 0.4s ease-out;
    animation-fill-mode: both;
}

.form-group:nth-child(1) {
    animation-delay: 0.1s;
}

.form-group:nth-child(2) {
    animation-delay: 0.2s;
}

.form-group:nth-child(3) {
    animation-delay: 0.3s;
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: var(--transition-fast);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    background: var(--surface-white);
    color: var(--text-primary);
    font-family: inherit;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--primary-300);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-50);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* =========================================
   PERMANENT REAL-TIME SPRAY PANEL
========================================= */
.permanent-spray-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 380px;
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 71, 55, 0.2);
    border-top: 6px solid var(--secondary-color);
    z-index: 99999;
    padding: 1rem;
    transition: all 0.3s ease;
}

.permanent-spray-panel.collapsed {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-top: none;
    background: var(--primary-color);
    color: white;
}

.permanent-spray-panel.collapsed h3 {
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.permanent-spray-panel.collapsed .panel-title-text,
.permanent-spray-panel.collapsed #permanentSprayContent {
    display: none !important;
}

.permanent-spray-panel.collapsed i.fa-calendar-alt {
    font-size: 1.5rem;
    margin: 0;
}

.permanent-spray-panel h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s ease;
}

.spray-item {
    background: var(--light-color);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 8px;
    border-left: 4px solid var(--warning-color);
}

.spray-item.completed {
    border-left: 4px solid var(--success-color);
}

.spray-item strong {
    color: var(--primary-color);
}

.spray-item small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInCard {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 4px 6px -2px rgba(0, 83, 67, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -4px rgba(0, 83, 67, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-500), var(--secondary-600));
    color: white;
    box-shadow: 0 4px 6px -2px rgba(212, 175, 55, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-600), var(--secondary-700));
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -4px rgba(212, 175, 55, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-500), var(--success-600));
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -4px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -4px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -4px rgba(245, 158, 11, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
    color: var(--primary-500);
    transform: translateY(-2px);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-size-base);
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-equal {
    min-width: 95px;
    width: 95px;
    min-height: 36px;
    height: 36px;
    padding: var(--space-1) var(--space-2);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: var(--z-fixed);
    border-bottom: 1px solid var(--border-light);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    height: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.logo {
    font-size: var(--font-size-xl);
    font-weight: var(--font-bold);
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
}

.sidebar-toggle:hover {
    background: var(--primary-50);
}

.sidebar-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transition: var(--transition-base);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-semibold);
    font-size: var(--font-size-base);
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: var(--font-semibold);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.user-role {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--surface-white);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    transition: transform var(--transition-base);
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-md);
}

.sidebar-nav {
    padding: var(--space-4) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-base);
    margin: var(--space-1) var(--space-2);
    border-radius: var(--radius-lg);
    position: relative;
}

.nav-item:hover {
    background: var(--primary-50);
    color: var(--primary-500);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-50), rgba(212, 175, 55, 0.1));
    color: var(--primary-500);
    font-weight: var(--font-medium);
    border-left: 3px solid var(--primary-500);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-500);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-icon {
    font-size: var(--font-size-xl);
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: var(--font-size-sm);
    font-weight: var(--font-medium);
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */

.main-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + var(--space-6)) var(--space-6) var(--space-6);
    min-height: calc(100vh - var(--header-height));
    transition: margin-left var(--transition-base);
}

.page-header {
    margin-bottom: var(--space-6);
    animation: slideInLeft 0.4s ease-out;
}

.page-header h1 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
    max-width: 600px;
}

/* --------------------------------------------------------------------------
   Statistics Grid
   -------------------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-500), var(--secondary-500));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.stat-icon {
    font-size: var(--font-size-4xl);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-50), rgba(212, 175, 55, 0.1));
    border-radius: var(--radius-lg);
    color: var(--primary-500);
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    line-height: 1;
}

.stat-info p {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-medium);
    margin: 0;
}

.stat-info small {
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    display: block;
    margin-top: var(--space-1);
}

/* --------------------------------------------------------------------------
   Charts Grid
   -------------------------------------------------------------------------- */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.chart-card {
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition-base);
    animation: scaleIn 0.4s ease-out;
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-100);
}

.chart-card h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-card canvas {
    max-height: 300px;
    width: 100% !important;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition-base);
    animation: scaleIn 0.4s ease-out;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-100);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--neutral-50);
}

.card-header h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: var(--space-6);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--surface-white);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

.table thead {
    background: var(--neutral-50);
}

.table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--primary-50);
    cursor: pointer;
}

.text-center {
    text-align: center;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-medium);
    line-height: 1;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-50);
    color: var(--success-600);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: var(--warning-50);
    color: var(--warning-600);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: var(--danger-50);
    color: var(--danger-600);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: var(--info-50);
    color: var(--info-600);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary-600);
    border: 1px solid rgba(0, 83, 67, 0.2);
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-left: 4px solid;
    animation: slideInLeft 0.3s ease-out;
}

.alert-success {
    background: var(--success-50);
    color: var(--success-600);
    border-left-color: var(--success-500);
}

.alert-error {
    background: var(--danger-50);
    color: var(--danger-600);
    border-left-color: var(--danger-500);
}

.alert-info {
    background: var(--info-50);
    color: var(--info-600);
    border-left-color: var(--info-500);
}

.alert-warning {
    background: var(--warning-50);
    color: var(--warning-600);
    border-left-color: var(--warning-500);
}

/* --------------------------------------------------------------------------
   Action Buttons Group
   -------------------------------------------------------------------------- */

.action-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

/* --------------------------------------------------------------------------
   Filter Section
   -------------------------------------------------------------------------- */

.filter-section {
    background: var(--surface-white);
    padding: var(--space-5);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    align-items: flex-end;
    border: 1px solid var(--border-light);
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* --------------------------------------------------------------------------
   QR Code Styles
   -------------------------------------------------------------------------- */

.qr-code-container {
    text-align: center;
    padding: var(--space-6);
    background: var(--surface-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-5);
    border: 1px solid var(--border-light);
}

.qr-code-image {
    max-width: 280px;
    width: 100%;
    height: auto;
    margin: var(--space-4) auto;
    display: block;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.qr-code-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-2);
    color: var(--text-primary);
    font-weight: var(--font-semibold);
}

.empty-state p {
    font-size: var(--font-size-sm);
    max-width: 400px;
    margin: 0 auto;
    color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Loading Spinner
   -------------------------------------------------------------------------- */

.spinner {
    border: 3px solid var(--border-light);
    border-top: 3px solid var(--primary-500);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: var(--space-6) auto;
}

/* --------------------------------------------------------------------------
   Modern Scrollbar
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-400);
    border-radius: var(--radius-full);
    border: 2px solid var(--neutral-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-500);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-400) var(--neutral-100);
}

/* --------------------------------------------------------------------------
   Tooltip
   -------------------------------------------------------------------------- */

[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-1) var(--space-2);
    background: var(--neutral-800);
    color: white;
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: var(--z-tooltip);
    margin-bottom: var(--space-1);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Status Indicators
   -------------------------------------------------------------------------- */

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: var(--space-1);
}

.status-indicator.active {
    background: var(--success-500);
    box-shadow: 0 0 0 2px var(--success-50);
}

.status-indicator.inactive {
    background: var(--text-tertiary);
    box-shadow: 0 0 0 2px var(--neutral-100);
}

.status-indicator.pending {
    background: var(--warning-500);
    box-shadow: 0 0 0 2px var(--warning-50);
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--surface-white);
    margin: 5% auto;
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    width: min(500px, 90%);
    box-shadow: var(--shadow-2xl);
    position: relative;
    animation: slideUp 0.3s var(--transition-bounce);
}

.modal-content h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.modal-close {
    position: absolute;
    right: var(--space-4);
    top: var(--space-4);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--neutral-100);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */

.qr-print-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    page-break-inside: avoid;
}

.qr-code-image-print {
    max-width: 350px;
    max-height: 350px;
    width: auto;
    height: auto;
    margin: 0 auto var(--space-4);
    display: block;
    object-fit: contain;
    page-break-inside: avoid;
}

.qr-print-details {
    text-align: center;
    margin-top: var(--space-4);
    page-break-inside: avoid;
}

.qr-print-text {
    font-size: var(--font-size-base);
    margin: var(--space-2) 0;
    color: #000;
    font-weight: var(--font-medium);
    line-height: 1.4;
    page-break-inside: avoid;
}

@media print {
    body * {
        visibility: hidden;
    }

    #printQRContainer,
    #printQRContainer * {
        visibility: visible;
    }

    #printQRContainer {
        position: fixed;
        inset: 0;
        display: block !important;
        margin: 0;
        padding: 0;
    }

    @page {
        margin: 15mm;
        size: A4 portrait;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    .qr-print-container {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        padding: 10mm;
        margin: 0;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        page-break-inside: avoid !important;
        box-sizing: border-box;
        overflow: hidden;
    }

    .qr-code-image-print {
        max-width: calc(100% - 40mm);
        max-height: calc(100vh - 100mm);
        width: auto;
        height: auto;
        object-fit: contain;
        margin: 0 auto 15px;
        page-break-inside: avoid !important;
        display: block;
    }

    .qr-print-details {
        max-width: 100%;
        page-break-inside: avoid !important;
    }

    .qr-print-text {
        font-size: var(--font-size-sm);
        margin: var(--space-1) 0;
        page-break-inside: avoid !important;
    }

    header,
    .sidebar,
    .main-content,
    .card,
    .action-buttons,
    .modal,
    .alert,
    nav,
    footer,
    .page-header,
    .charts-grid {
        display: none !important;
        visibility: hidden !important;
    }

    * {
        page-break-inside: avoid;
    }

    html,
    body {
        overflow: hidden;
        width: 100%;
        height: 100%;
    }
}

/* --------------------------------------------------------------------------
   Text Utilities
   -------------------------------------------------------------------------- */

.text-muted {
    color: var(--text-tertiary);
}

.text-primary {
    color: var(--primary-500);
}

.text-secondary {
    color: var(--secondary-500);
}

.text-success {
    color: var(--success-500);
}

.text-danger {
    color: var(--danger-500);
}

.text-warning {
    color: var(--warning-500);
}

.text-info {
    color: var(--info-500);
}

.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-base {
    font-size: var(--font-size-base);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.text-xl {
    font-size: var(--font-size-xl);
}

.font-light {
    font-weight: var(--font-light);
}

.font-regular {
    font-weight: var(--font-regular);
}

.font-medium {
    font-weight: var(--font-medium);
}

.font-semibold {
    font-weight: var(--font-semibold);
}

.font-bold {
    font-weight: var(--font-bold);
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: var(--z-modal);
        box-shadow: var(--shadow-2xl);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: calc(var(--header-height) + var(--space-5)) var(--space-5) var(--space-5);
    }

    .sidebar-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-section {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .table {
        font-size: var(--font-size-xs);
    }

    .table th,
    .table td {
        padding: var(--space-2) var(--space-3);
    }

    .user-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: calc(var(--header-height) + var(--space-4)) var(--space-4) var(--space-4);
    }

    .page-header h1 {
        font-size: var(--font-size-2xl);
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-5);
    }

    .header-content {
        padding: 0 var(--space-4);
    }

    .login-box {
        padding: var(--space-8) var(--space-5);
    }

    .btn-equal {
        min-width: 80px;
        width: 80px;
    }

    .card-header {
        flex-direction: column;
        gap: var(--space-2);
        text-align: center;
    }

    .action-buttons {
        justify-content: center;
    }
}

/* --------------------------------------------------------------------------
   Custom Global Modals (Professional Tree Registration)
   -------------------------------------------------------------------------- */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal-container {
    background: var(--surface-white);
    width: 90%;
    max-width: 450px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--space-8);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-top: 5px solid var(--primary-500);
}

.custom-modal-overlay.active .custom-modal-container {
    transform: translateY(0);
}

.custom-modal-header {
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.custom-modal-header i {
    font-size: 1.5rem;
    color: var(--primary-500);
}

.custom-modal-header h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-bold);
    color: var(--primary-500);
    margin: 0;
}

.custom-modal-body {
    margin-bottom: var(--space-6);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.custom-modal-input-container {
    margin-top: var(--space-4);
}

.custom-modal-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
}

.custom-modal-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--primary-50);
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.custom-modal-btn {
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.custom-modal-btn-confirm {
    background: var(--primary-500);
    color: white;
}

.custom-modal-btn-confirm:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
}

.custom-modal-btn-cancel {
    background: var(--neutral-100);
    color: var(--text-secondary);
}

.custom-modal-btn-cancel:hover {
    background: var(--neutral-200);
}