 /* ==========================================
           SISTEMA DE VARIABLES CSS
        ========================================== */
        :root {
            /* Colores Primarios */
            --primary-100: #EBF5FF;
            --primary-500: #007BFF;
            --primary-700: #0056B3;
            
            /* Colores Neutrales */
            --neutral-50: #F8F9FA;
            --neutral-100: #FFFFFF;
            --neutral-200: #E9ECEF;
            --neutral-400: #6C757D;
            --neutral-700: #343A40;
            --neutral-900: #212529;
            
            /* Colores Semánticos */
            --success: #28A745;
            --warning: #FFC107;
            --error: #DC3545;
            --info: #17A2B8;
            
            /* Tipografía */
            --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            
            /* Espaciado (basado en grid de 4px) */
            --space-xs: 8px;
            --space-sm: 12px;
            --space-md: 16px;
            --space-lg: 24px;
            --space-xl: 32px;
            --space-xxl: 48px;
            --space-xxxl: 64px;
            
            /* Radios de borde */
            --radius-md: 8px;
            --radius-lg: 12px;
            
            /* Sombras */
            --shadow-sm: 0 2px 4px rgba(0, 123, 255, 0.04);
            --shadow-md: 0 4px 12px rgba(0, 123, 255, 0.08);
            --shadow-lg: 0 10px 30px rgba(0, 123, 255, 0.12);
            
            /* Transiciones */
            --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            --transition-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* ==========================================
           RESET Y BASE
        ========================================== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
            font-size: 16px;
            line-height: 1.6;
        }

        body {
            font-family: var(--font-family);
            background-color: var(--neutral-50);
            color: var(--neutral-700);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* ==========================================
           LAYOUT PRINCIPAL CON CSS GRID
        ========================================== */
        .app-container {
            display: grid;
            grid-template-areas: 
                "header header"
                "sidebar main";
            grid-template-columns: 280px 1fr;
            grid-template-rows: 70px 1fr;
            height: 100vh;
            max-width: 1440px;
            margin: 0 auto;
        }

        /* Header */
        .header {
            grid-area: header;
            background: var(--neutral-100);
            border-bottom: 1px solid var(--neutral-200);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 var(--space-lg);
            box-shadow: var(--shadow-sm);
            z-index: 100;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: var(--space-md);
        }

        .header-logo {
            font-size: 24px;
            font-weight: 800;
            color: var(--primary-500);
        }

        .header-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--neutral-700);
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: var(--space-md);
        }

        /* Sidebar */
        .sidebar {
            grid-area: sidebar;
            background: var(--neutral-100);
            border-right: 1px solid var(--neutral-200);
            padding: var(--space-lg);
            overflow-y: auto;
        }

        .nav-menu {
            list-style: none;
        }

        .nav-item {
            margin-bottom: var(--space-xs);
        }

        .nav-link {
            display: flex;
            align-items: center;
            gap: var(--space-sm);
            padding: var(--space-sm) var(--space-md);
            color: var(--neutral-700);
            text-decoration: none;
            border-radius: var(--radius-md);
            transition: var(--transition-fast);
            font-size: 14px;
            font-weight: 500;
        }

        .nav-link:hover,
        .nav-link.active {
            background: var(--primary-100);
            color: var(--primary-500);
        }

        /* Main Content */
        .main-content {
            grid-area: main;
            padding: var(--space-lg);
            overflow-y: auto;
        }

        /* ==========================================
           COMPONENTES DE UI
        ========================================== */
        
        /* Cards de Métrica */
        .metrics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: var(--space-lg);
            margin-bottom: var(--space-xl);
        }

        .metric-card {
            background: var(--neutral-100);
            padding: var(--space-lg);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-md);
            transition: var(--transition-normal);
            cursor: pointer;
        }

        .metric-card:hover {
            transform: translateY(-4px);
            box-shadow: var(--shadow-lg);
        }

        .metric-title {
            font-size: 14px;
            font-weight: 500;
            color: var(--neutral-400);
            margin-bottom: var(--space-sm);
        }

        .metric-value {
            font-size: 32px;
            font-weight: 700;
            color: var(--neutral-900);
            margin-bottom: var(--space-sm);
            line-height: 1.2;
        }

        .metric-change {
            display: inline-flex;
            align-items: center;
            padding: 4px 8px;
            border-radius: 99px;
            font-size: 12px;
            font-weight: 500;
        }

        .metric-change.positive {
            background: rgba(40, 167, 69, 0.1);
            color: var(--success);
        }

        .metric-change.negative {
            background: rgba(220, 53, 69, 0.1);
            color: var(--error);
        }

        /* Botones */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-xs);
            padding: 0 var(--space-lg);
            height: 44px;
            border: none;
            border-radius: var(--radius-md);
            font-family: var(--font-family);
            font-size: 14px;
            font-weight: 600;
            text-decoration: none;
            cursor: pointer;
            transition: var(--transition-fast);
            white-space: nowrap;
        }

        .btn-primary {
            background: var(--primary-500);
            color: var(--neutral-100);
        }

        .btn-primary:hover {
            background: var(--primary-700);
            transform: translateY(-2px);
        }

        .btn-primary:active {
            transform: translateY(0) scale(0.98);
        }

        .btn-secondary {
            background: transparent;
            color: var(--primary-500);
            border: 1px solid var(--primary-500);
        }

        .btn-secondary:hover {
            background: var(--primary-100);
        }

        /* Secciones */
        .section {
            margin-bottom: var(--space-xl);
        }

        .section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: var(--space-lg);
        }

        .section-title {
            font-size: 24px;
            font-weight: 700;
            color: var(--neutral-900);
        }

        /* ==========================================
           TABLAS
        ========================================== */
        .table-container {
            background: var(--neutral-100);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-md);
            overflow: hidden;
        }

        .table-header {
            background: var(--neutral-50);
            padding: var(--space-md) var(--space-lg);
            border-bottom: 1px solid var(--neutral-200);
        }

        .table-header h3 {
            font-size: 18px;
            font-weight: 600;
            color: var(--neutral-900);
        }

        .table {
            width: 100%;
            border-collapse: collapse;
        }

        .table th,
        .table td {
            padding: var(--space-md) var(--space-lg);
            text-align: left;
            border-bottom: 1px solid var(--neutral-200);
        }

        .table th {
            background: var(--neutral-50);
            font-size: 14px;
            font-weight: 600;
            color: var(--neutral-700);
            cursor: pointer;
            user-select: none;
        }

        .table th:hover {
            color: var(--primary-500);
        }

        .table td {
            font-size: 14px;
            font-weight: 400;
        }

        .table tbody tr {
            transition: var(--transition-fast);
        }

        .table tbody tr:hover {
            background: var(--neutral-50);
        }

        /* Status Badges */
        .status-badge {
            display: inline-flex;
            align-items: center;
            padding: 4px 12px;
            border-radius: 99px;
            font-size: 12px;
            font-weight: 500;
            text-transform: uppercase;
        }

        .status-active {
            background: rgba(40, 167, 69, 0.1);
            color: var(--success);
        }

        .status-paused {
            background: rgba(255, 193, 7, 0.1);
            color: var(--warning);
        }

        .status-draft {
            background: rgba(108, 117, 125, 0.1);
            color: var(--neutral-400);
        }

        /* ==========================================
           GRÁFICOS (Canvas API)
        ========================================== */
        .chart-container {
            background: var(--neutral-100);
            padding: var(--space-lg);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-md);
            margin-bottom: var(--space-lg);
        }

        .chart-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--neutral-900);
            margin-bottom: var(--space-lg);
            text-align: center;
        }

        .chart {
            width: 100%;
            height: 300px;
        }

        /* ==========================================
           MODALES
        ========================================== */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(33, 37, 41, 0.5);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: var(--transition-normal);
        }

        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .modal {
            background: var(--neutral-100);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            max-width: 500px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            transform: scale(0.9);
            transition: var(--transition-normal);
        }

        .modal-overlay.active .modal {
            transform: scale(1);
        }

        .modal-header {
            padding: var(--space-xl) var(--space-xl) var(--space-md);
            border-bottom: 1px solid var(--neutral-200);
        }

        .modal-title {
            font-size: 20px;
            font-weight: 600;
            color: var(--neutral-900);
        }

        .modal-body {
            padding: var(--space-xl);
        }

        .modal-footer {
            padding: var(--space-md) var(--space-xl) var(--space-xl);
            border-top: 1px solid var(--neutral-200);
            display: flex;
            gap: var(--space-sm);
            justify-content: flex-end;
        }

        /* ==========================================
           FORMULARIOS
        ========================================== */
        .form-group {
            margin-bottom: var(--space-lg);
        }

        .form-label {
            display: block;
            font-size: 14px;
            font-weight: 500;
            color: var(--neutral-700);
            margin-bottom: var(--space-sm);
        }

        .form-input,
        .form-select,
        .form-textarea {
            width: 100%;
            height: 44px;
            padding: 0 var(--space-md);
            border: 1px solid #CED4DA;
            border-radius: var(--radius-md);
            font-family: var(--font-family);
            font-size: 14px;
            transition: var(--transition-fast);
        }

        .form-input:focus,
        .form-select:focus,
        .form-textarea:focus {
            outline: none;
            border-color: var(--primary-500);
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
        }

        .form-textarea {
            height: auto;
            min-height: 80px;
            resize: vertical;
        }

        /* ==========================================
           NOTIFICACIONES
        ========================================== */
        .notification {
            position: fixed;
            top: var(--space-lg);
            right: var(--space-lg);
            background: var(--neutral-100);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-lg);
            padding: var(--space-md) var(--space-lg);
            max-width: 400px;
            z-index: 2000;
            transform: translateX(100%);
            transition: var(--transition-normal);
            border-left: 4px solid var(--primary-500);
        }

        .notification.show {
            transform: translateX(0);
        }

        .notification.success {
            border-left-color: var(--success);
        }

        .notification.error {
            border-left-color: var(--error);
        }

        .notification.warning {
            border-left-color: var(--warning);
        }

        /* ==========================================
           RESPONSIVE DESIGN
        ========================================== */
        
        /* Tablet */
        @media (max-width: 1024px) {
            .app-container {
                grid-template-areas: 
                    "header"
                    "main";
                grid-template-columns: 1fr;
            }
            
            .sidebar {
                position: fixed;
                top: 70px;
                left: -280px;
                width: 280px;
                height: calc(100vh - 70px);
                z-index: 200;
                transition: var(--transition-normal);
            }
            
            .sidebar.open {
                left: 0;
            }
            
            .metrics-grid {
                grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            }
        }

        /* Mobile */
        @media (max-width: 768px) {
            .app-container {
                grid-template-rows: 60px 1fr;
            }
            
            .header {
                padding: 0 var(--space-md);
                height: 60px;
            }
            
            .header-title {
                display: none;
            }
            
            .main-content {
                padding: var(--space-md);
            }
            
            .metrics-grid {
                grid-template-columns: 1fr;
                gap: var(--space-md);
            }
            
            .section-header {
                flex-direction: column;
                align-items: stretch;
                gap: var(--space-sm);
            }
            
            .table-container {
                overflow-x: auto;
            }
            
            .table {
                min-width: 600px;
            }
        }

        /* ==========================================
           UTILIDADES
        ========================================== */
        .text-center { text-align: center; }
        .text-right { text-align: right; }
        .hidden { display: none; }
        .flex { display: flex; }
        .items-center { align-items: center; }
        .justify-between { justify-content: space-between; }
        .gap-sm { gap: var(--space-sm); }
        .gap-md { gap: var(--space-md); }
        .gap-lg { gap: var(--space-lg); }
        .mb-sm { margin-bottom: var(--space-sm); }
        .mb-md { margin-bottom: var(--space-md); }
        .mb-lg { margin-bottom: var(--space-lg); }