:root {
    /* Identidad CYH Refinada (Estilo Industrial/SaaS Premium) */
    --primary: #ac2c59;       /* Magenta CYH */
    --primary-light: rgba(172, 44, 89, 0.1);
    --secondary: #222052;     /* Azul CYH */
    --sidebar-bg: #111827;    /* Ultra oscuro para sidebar */
    
    /* Colores de Estado Modernos */
    --success: #22c55e;
    --warning: #facc15;
    --info: #38bdf8;
    --danger: #ef4444;
    
    /* Layout y Superficies */
    --bg-main: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #f3f4f6;
    
    /* Sombras y Bordes (Estilo Imagen Referencia) */
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.03);
    
    /* Tipografía */
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-label: #9ca3af;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR PROFESIONAL --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    padding: 20px 0;
}

.sidebar-header {
    padding: 10px 24px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header img {
    height: 32px;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.5px;
}

.sidebar-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    padding: 20px 24px 8px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-label);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 13px;
}

.menu-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.menu-item.active {
    background: rgba(172, 44, 89, 0.15);
    color: #fff;
    position: relative;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    height: 20px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

/* Perfil al fondo del sidebar */
.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.user-pill {
    background: rgba(255,255,255,0.05);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px 40px;
    max-width: calc(100% - 260px);
}

/* Header con Breadcrumbs */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.badge-outline {
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* --- CARDS PREMIUM --- */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(0,0,0,0.02);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-bottom: 24px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kpi-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

/* Micro barras de progreso */
.mini-progress {
    height: 4px;
    background: #f3f4f6;
    border-radius: 10px;
    width: 100%;
    margin-top: 8px;
}

.mini-progress-bar {
    height: 100%;
    border-radius: 10px;
}

/* --- TABLES --- */
.table-responsive {
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

td {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #f9fafb;
    border-bottom: 1px solid #f9fafb;
}

td:first-child { border-left: 1px solid #f9fafb; border-radius: 10px 0 0 10px; }
td:last-child { border-right: 1px solid #f9fafb; border-radius: 0 10px 10px 0; }

/* --- ALERTAS ESTILO REFERENCIA --- */
.alert-premium {
    border-left: 4px solid var(--danger);
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.alert-title {
    font-weight: 700;
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 4px;
}

/* --- BOTONES --- */
.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

/* --- TABS --- */
.tab-container {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab-item {
    padding: 12px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.tab-item:hover { color: var(--primary); }

.tab-item.active {
    color: var(--primary);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

/* --- FILTERS --- */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-label);
    text-transform: uppercase;
}

.filter-select {
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary);
    cursor: pointer;
    outline: none;
}

/* --- SPARKLINE --- */
.sparkline-container {
    height: 30px;
    width: 80px;
}

/* --- FUNNEL SIM --- */
.funnel-item {
    height: 40px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    border-radius: 4px;
}

/* --- UTILS --- */
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 20px 0; }
    .sidebar-brand, .sidebar-category, .menu-item span, .user-info { display: none; }
    .sidebar-header, .sidebar-footer { justify-content: center; padding: 10px; }
    .menu-item { justify-content: center; padding: 15px 0; }
    .main-content { margin-left: 80px; max-width: calc(100% - 80px); padding: 20px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { left: -260px; transition: all 0.3s ease; }
    .sidebar.active { left: 0; width: 260px; }
    .sidebar.active .sidebar-brand, .sidebar.active .sidebar-category, .sidebar.active .menu-item span, .sidebar.active .user-info { display: block; }
    .main-content { margin-left: 0; max-width: 100%; padding: 15px; padding-top: 70px; }
    .mobile-header { display: flex !important; }
    .dashboard-row { grid-template-columns: 1fr !important; }
    .kpi-grid { grid-template-columns: 1fr; }
    .header-top { flex-direction: column; align-items: flex-start; gap: 15px; }
    .header-actions { width: 100%; display: flex; flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
}

/* Mobile Header Toggle */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--sidebar-bg);
    z-index: 1001;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
}

.menu-toggle {
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}
