/* ============================================================
   ESTILOS EMPRESARIALES - SISTEMA DE SOPORTE TI
   ============================================================ */

:root {
    /* Colores principales */
    --primary: #3653BA;
    --primary-dark: #2a3f8f;
    --primary-light: #4a6bdf;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #3b82f6;

    /* Neutros */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Estados */
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --info-bg: #dbeafe;
    --info-text: #1e40af;

    /* Prioridades */
    --urgente-bg: #fee2e2;
    --urgente-text: #991b1b;
    --urgente-border: #ef4444;
    --alta-bg: #fef3c7;
    --alta-text: #92400e;
    --alta-border: #f59e0b;
    --normal-bg: #e0e7ff;
    --normal-text: #3730a3;
    --normal-border: #6366f1;

    /* UI */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --transition: all 0.2s ease;

    /* Semantic aliases */
    --bg-card: #ffffff;
    --bg-hover: #f9fafb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-card);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 83, 186, 0.1);
}

/* Audit fix: select elements inherit form-input styles properly */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Audit fix: focus-visible for keyboard accessibility */
.btn:focus-visible, .form-input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.form-input::placeholder {
    color: var(--gray-400);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

/* Audit fix: removed width:100% — was login-only but bled into all pages */
.btn-primary {
    background: var(--primary);
    color: white;
}

/* Login-specific full-width button */
.login-card .btn-primary {
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-success:hover {
    background: var(--secondary-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--secondary);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info);
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.login-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #111827;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-user {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-transform: capitalize;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.nav-section {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.05em;
    margin-top: 1rem;
}

.nav-section:first-child {
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.65);
    border-radius: var(--radius);
    margin: 0.25rem 0.5rem;
    transition: var(--transition);
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
}

.top-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-content {
    padding: 2rem;
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card-icon.primary { background: var(--info-bg); color: var(--info); }
.stat-card-icon.success { background: var(--success-bg); color: var(--secondary); }
.stat-card-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-card-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-card-icon.info { background: var(--info-bg); color: var(--info); }

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.stat-card-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.stat-card-trend.up { color: var(--secondary); }
.stat-card-trend.down { color: var(--danger); }

/* ============================================================
   TABLAS
   ============================================================ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--gray-50);
}

td {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--gray-700);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 1rem;
    white-space: nowrap;
}

.badge-urgente {
    background: var(--urgente-bg);
    color: var(--urgente-text);
    border: 1px solid var(--urgente-border);
}

.badge-alta {
    background: var(--alta-bg);
    color: var(--alta-text);
    border: 1px solid var(--alta-border);
}

.badge-normal {
    background: var(--normal-bg);
    color: var(--normal-text);
    border: 1px solid var(--normal-border);
}

.badge-detectado { background: var(--gray-100); color: var(--gray-600); }
.badge-en-soporte { background: var(--info-bg); color: var(--info-text); }
.badge-esperando { background: var(--warning-bg); color: var(--warning-text); }
.badge-cerrado { background: var(--success-bg); color: var(--success-text); }

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--gray-500);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--gray-200);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ============================================================
   FILTROS Y BUSCADORES
   ============================================================ */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.filter-select {
    padding: 0.75rem 2rem 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============================================================
   GRÁFICAS (Chart.js container)
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.chart-card-header {
    margin-bottom: 1rem;
}

.chart-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Botón menú hamburguesa (solo móvil) */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--gray-700);
    transition: var(--transition);
    margin-right: 0.5rem;
}

.menu-toggle:hover {
    background: var(--gray-200);
}

@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .menu-toggle {
        display: flex;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    /* Overlay para sidebar en móvil */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-bar-title {
        font-size: 1.25rem;
    }

    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    /* Tablas responsive con scroll horizontal */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Mejorar touch targets en móvil */
    .btn, .nav-item, .filter-select {
        min-height: 44px;
    }

    /* Ajustar sidebar para móvil */
    .sidebar {
        width: 280px;
        transition: transform 0.3s ease;
    }

    .sidebar-user {
        margin-top: 0.5rem;
    }

    /* Modales a pantalla completa en móvil */
    .modal {
        max-width: calc(100% - 2rem);
        max-height: calc(100vh - 2rem);
    }
}

@media (max-width: 480px) {
    .stat-card-value {
        font-size: 1.5rem;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .top-bar-title {
        font-size: 1.1rem;
    }

    .chart-card {
        padding: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    /* Ajustar tarjetas de métricas en 2 columnas */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }

.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-slideIn { animation: slideIn 0.3s ease; }
.animate-pulse { animation: pulse 2s infinite; }

/* Loading spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   TIMELINE COMPONENT (for ticket detail activity)
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding: 8px 0 12px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid var(--bg-card, #fff);
}

.timeline-item.system::before { background: var(--gray-400); }
.timeline-item.internal::before { background: var(--warning); }
.timeline-item.public::before { background: var(--primary); }

.timeline-header {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 3px;
}

.timeline-body {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   TRANSITION UTILITIES
   ============================================================ */
.transition-all { transition: all 0.2s ease; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hover-glow:hover { box-shadow: 0 0 0 4px rgba(54, 83, 186, 0.1); }

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;

    /* Semantic aliases dark */
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;

    --success-bg: #064e3b; --success-text: #6ee7b7;
    --warning-bg: #78350f; --warning-text: #fcd34d;
    --danger-bg: #7f1d1d; --danger-text: #fca5a5;
    --info-bg: #1e3a5f; --info-text: #93c5fd;
    --urgente-bg: #7f1d1d; --urgente-text: #fca5a5; --urgente-border: #ef4444;
    --alta-bg: #78350f; --alta-text: #fcd34d; --alta-border: #f59e0b;
    --normal-bg: #312e81; --normal-text: #c7d2fe; --normal-border: #6366f1;
}
[data-theme="dark"] body { background: var(--gray-50); color: var(--text-primary); }
[data-theme="dark"] .login-card,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .modal,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .table-container,
[data-theme="dark"] .form-input,
[data-theme="dark"] select.form-input { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] .sidebar { background: #0f172a; border-right-color: var(--border); }
[data-theme="dark"] .sidebar-user { border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sidebar-brand { color: #f1f5f9; }
[data-theme="dark"] .top-bar { background: var(--bg-card); border-bottom-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .top-bar-title { color: var(--text-primary); }
[data-theme="dark"] .nav-item { color: rgba(255,255,255,0.6); }
[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
[data-theme="dark"] .nav-item.active { background: var(--primary); color: #fff; }
[data-theme="dark"] .nav-section { color: rgba(255,255,255,0.35); }
[data-theme="dark"] table { color: var(--text-primary); }
[data-theme="dark"] table th { background: var(--gray-200); color: var(--gray-700); }
[data-theme="dark"] table td { border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] table tr:hover { background: var(--bg-hover); }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.7); }
[data-theme="dark"] .modal { color: var(--text-primary); }
[data-theme="dark"] .modal-header { border-color: var(--border); }
[data-theme="dark"] .modal-footer { border-color: var(--border); }
[data-theme="dark"] .page-content { background: transparent; }
[data-theme="dark"] .btn-secondary { background: var(--gray-200); color: var(--gray-700); border-color: var(--gray-300); }
[data-theme="dark"] .btn-outline { color: var(--text-secondary); border-color: var(--border); }
[data-theme="dark"] .alert { border-color: var(--gray-300); background: var(--bg-hover); }
[data-theme="dark"] .text-muted { color: var(--text-secondary) !important; }
[data-theme="dark"] label { color: var(--text-primary); }
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3, [data-theme="dark"] h4 { color: var(--text-primary); }
[data-theme="dark"] code { background: var(--bg-hover); color: var(--info-text); }
[data-theme="dark"] .stat-card-value { color: var(--text-primary); }
[data-theme="dark"] .stat-card-label { color: var(--text-secondary); }
[data-theme="dark"] .stat-card-trend { color: var(--text-secondary); }
[data-theme="dark"] .sidebar-footer .btn { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.15); }

/* Dark mode — ticket page elements */
[data-theme="dark"] .conv-card { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .conv-card-msg { color: var(--text-secondary); }
[data-theme="dark"] .conv-card-time { color: var(--text-secondary); }
[data-theme="dark"] .tabs-bar { border-color: var(--border); }
[data-theme="dark"] .tab-btn { color: var(--text-secondary); }
[data-theme="dark"] .tab-btn.active { color: var(--primary); border-color: var(--primary); }
[data-theme="dark"] .tab-count { background: var(--bg-hover); color: var(--text-secondary); }
[data-theme="dark"] .filters-compact input,
[data-theme="dark"] .filters-compact select { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] .msg-item { background: var(--bg-hover); }
[data-theme="dark"] .bitacora-list li { background: var(--bg-hover); border-color: var(--border); color: var(--text-secondary); }
[data-theme="dark"] .empty-state h3 { color: var(--text-secondary); }
[data-theme="dark"] .badge { border-color: var(--border); }
[data-theme="dark"] .main-content { background: var(--gray-50); }
[data-theme="dark"] .table-title { color: var(--text-primary); }
[data-theme="dark"] .table-header { border-color: var(--border); }
[data-theme="dark"] a { color: var(--primary-light); }

/* Dark mode — action menus & dropdowns */
[data-theme="dark"] .action-dropdown,
[data-theme="dark"] .action-menu .action-dropdown { background: var(--gray-100); border-color: var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
[data-theme="dark"] .action-dropdown-item:hover { background: var(--bg-hover); }
[data-theme="dark"] .combobox-opts { background: var(--gray-100); border-color: var(--border); }
[data-theme="dark"] .combobox-opt:hover { background: var(--bg-hover); }

/* Dark mode — detail panels, info grids & inline backgrounds */
[data-theme="dark"] [style*="background:var(--bg-hover"],
[data-theme="dark"] [style*="background: var(--bg-hover"] { color: var(--text-primary); }
[data-theme="dark"] .num-ticket { background: var(--gray-200); color: var(--primary-light); border-color: var(--border); }
[data-theme="dark"] .chip { background: var(--gray-200); color: var(--text-secondary); }

/* Dark mode — timeline */
[data-theme="dark"] .timeline::before { background: var(--gray-300); }
[data-theme="dark"] .timeline-item::before { border-color: var(--gray-100); }
[data-theme="dark"] .timeline-header strong { color: var(--gray-600); }
[data-theme="dark"] .timeline-body { color: var(--text-primary); }

/* Dark mode — badges */
[data-theme="dark"] .badge-urgente { background: var(--urgente-bg); color: var(--urgente-text); border-color: var(--urgente-border); }
[data-theme="dark"] .badge-alta { background: var(--alta-bg); color: var(--alta-text); border-color: var(--alta-border); }
[data-theme="dark"] .badge-normal { background: var(--normal-bg); color: var(--normal-text); border-color: var(--normal-border); }
[data-theme="dark"] .badge-success { background: var(--success-bg); color: var(--success-text); }
[data-theme="dark"] .badge-danger { background: var(--danger-bg); color: var(--danger-text); }
[data-theme="dark"] .badge-warning { background: var(--warning-bg); color: var(--warning-text); }
[data-theme="dark"] .badge-info { background: var(--info-bg); color: var(--info-text); }

/* Dark mode — estado badges inline (generic badge without modifier) */
[data-theme="dark"] .badge:not([class*="badge-"]) { background: var(--gray-200); color: var(--text-secondary); }
[data-theme="dark"] .estado-badge { border-color: var(--border); }

/* Dark mode — notifications */
[data-theme="dark"] .notif-item { border-color: var(--gray-200); }
[data-theme="dark"] .notif-item:hover { background: var(--bg-hover); }
[data-theme="dark"] .notif-dropdown-header { border-color: var(--gray-300); color: var(--text-primary); }

/* Dark mode — toast */
[data-theme="dark"] .toast { background: var(--gray-100); color: var(--text-primary); border-color: var(--border); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
[data-theme="dark"] .toast-icon.success { background: var(--success-bg); color: var(--success-text); }
[data-theme="dark"] .toast-icon.error { background: var(--danger-bg); color: var(--danger-text); }
[data-theme="dark"] .toast-icon.warning { background: var(--warning-bg); color: var(--warning-text); }
[data-theme="dark"] .toast-icon.info { background: var(--info-bg); color: var(--info-text); }
[data-theme="dark"] .toast-close { color: var(--gray-500); }
[data-theme="dark"] .toast-close:hover { color: var(--gray-700); }

/* Dark mode — dialog */
[data-theme="dark"] .dialog-box { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
[data-theme="dark"] .dialog-title { color: var(--text-primary); }
[data-theme="dark"] .dialog-msg { color: var(--text-secondary); }
[data-theme="dark"] .dialog-icon.confirm { background: var(--info-bg); color: var(--info-text); }
[data-theme="dark"] .dialog-icon.danger { background: var(--danger-bg); color: var(--danger-text); }
[data-theme="dark"] .dialog-icon.prompt { background: var(--warning-bg); color: var(--warning-text); }
[data-theme="dark"] .dialog-input { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }

/* Dark mode — breadcrumbs */
[data-theme="dark"] .breadcrumb { color: var(--gray-500); }
[data-theme="dark"] .breadcrumb a { color: var(--gray-500); }
[data-theme="dark"] .breadcrumb-current { color: var(--gray-600); }
[data-theme="dark"] .breadcrumb-sep { color: var(--gray-400); }

/* Dark mode — kanban details */
[data-theme="dark"] .kanban-column-header { border-color: var(--gray-300); color: var(--text-primary); }
[data-theme="dark"] .kanban-column-count { background: var(--gray-300); color: var(--text-primary); }
[data-theme="dark"] .kanban-card-title { color: var(--text-primary); }

/* Dark mode — combobox wrap */
[data-theme="dark"] .combobox-wrap input { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }

/* Dark mode — charts & reportes */
[data-theme="dark"] .chart-card { background: var(--bg-card); color: var(--text-primary); }
[data-theme="dark"] .chart-card-title { color: var(--text-primary); }

/* Dark mode — textarea & select */
[data-theme="dark"] textarea.form-input { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] select option { background: var(--gray-100); color: var(--text-primary); }

/* Dark mode — placeholder */
[data-theme="dark"] ::placeholder { color: var(--gray-400); opacity: 1; }

/* Dark mode — hr dividers */
[data-theme="dark"] hr { border-color: var(--border); }

/* Dark mode — inline style overrides (common patterns) */
[data-theme="dark"] [style*="border-left:3px solid var(--gray-300)"] { border-left-color: var(--gray-400) !important; }
[data-theme="dark"] [style*="border-left:3px solid var(--secondary"] { border-left-color: var(--secondary) !important; }

/* Dark mode — strong/bold inside data displays */
[data-theme="dark"] [style*="color:var(--gray-500)"] { color: var(--gray-500) !important; }

/* Dark mode — filter bar */
[data-theme="dark"] .search-box input { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }

/* Dark mode — conocimiento / soluciones cards */
[data-theme="dark"] .kb-card,
[data-theme="dark"] .sol-card { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }

/* Dark mode — checklists */
[data-theme="dark"] .checklist-card { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }

/* Dark mode — configuracion sections */
[data-theme="dark"] .config-section,
[data-theme="dark"] .config-card { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }

/* Dark mode — confirm dialog */
[data-theme="dark"] .confirm-dialog { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }

/* ── PENDIENTES BANNER (Usuarios page) ─────────────────────── */
.pendientes-banner-inner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 16px 20px;
}
.pendientes-banner-title { margin: 0; font-size: 15px; color: #92400e; }
.pendientes-card {
    background: var(--bg-card, #fff);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.row-pendiente { background: #fef9c3; }

[data-theme="dark"] .pendientes-banner-inner {
    background: linear-gradient(135deg, var(--warning-bg), #451a03);
    border-color: #b45309;
}
[data-theme="dark"] .pendientes-banner-title { color: var(--warning-text); }
[data-theme="dark"] .pendientes-card {
    background: var(--gray-100);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
[data-theme="dark"] .row-pendiente { background: rgba(120, 53, 15, 0.2); }

/* ── SLA VENCIDO ROW ───────────────────────────────────────── */
.row-sla-vencido { background: #fee2e2; }
[data-theme="dark"] .row-sla-vencido { background: rgba(127, 29, 29, 0.2); }

/* Smooth transition for theme switching */
body, .sidebar, .top-bar, .stat-card, .table-container, .modal,
.form-input, .nav-item, .btn, .conv-card, .kanban-card, .kanban-column {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Dark mode toggle button */
.theme-toggle {
    background: none; border: none; cursor: pointer; font-size: 18px; padding: 6px;
    border-radius: var(--radius-sm); color: var(--gray-500); transition: var(--transition);
}
.theme-toggle:hover { background: var(--gray-200); color: var(--gray-700); }

/* ============================================================
   NOTIFICATION BELL & DROPDOWN
   ============================================================ */
.notif-bell {
    position: relative; cursor: pointer; background: none; border: none;
    font-size: 20px; padding: 6px 8px; border-radius: var(--radius-sm);
    color: var(--gray-500); transition: var(--transition);
}
.notif-bell:hover { background: var(--gray-200); color: var(--gray-700); }
.notif-badge {
    position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
    background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 99px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1;
}
.notif-dropdown {
    position: absolute; top: 100%; right: 0; width: 360px; max-height: 420px;
    background: var(--bg-card); border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200); z-index: 1000; overflow: hidden; display: none;
}
.notif-dropdown.show { display: block; }
[data-theme="dark"] .notif-dropdown { background: var(--gray-100); border-color: var(--gray-300); }
.notif-dropdown-header {
    padding: 12px 16px; font-weight: 600; font-size: 14px;
    border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center;
}
.notif-list { overflow-y: auto; max-height: 360px; }
.notif-item {
    padding: 10px 16px; border-bottom: 1px solid var(--gray-100); cursor: pointer;
    transition: var(--transition); font-size: 13px;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--info-bg); }
.notif-item-title { font-weight: 600; margin-bottom: 2px; }
.notif-item-msg { color: var(--gray-500); font-size: 12px; }
.notif-item-time { color: var(--gray-400); font-size: 11px; margin-top: 2px; }

/* ============================================================
   SEARCH OMNIBOX
   ============================================================ */
.omnibox-container { position: relative; }
.omnibox-input {
    width: 240px; padding: 6px 12px 6px 32px; border: 1px solid var(--gray-200);
    border-radius: var(--radius); font-size: 13px; background: var(--gray-50);
    transition: var(--transition);
}
.omnibox-input:focus { width: 320px; border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(54,83,186,.15); }
[data-theme="dark"] .omnibox-input { background: var(--gray-200); border-color: var(--gray-300); color: var(--gray-800); }
.omnibox-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 14px; pointer-events: none;
}
.omnibox-results {
    position: absolute; top: 100%; left: 0; width: 400px; max-height: 360px;
    background: var(--bg-card); border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200); z-index: 1000; overflow-y: auto; display: none;
}
.omnibox-results.show { display: block; }
[data-theme="dark"] .omnibox-results { background: var(--gray-100); border-color: var(--gray-300); }
.omnibox-section { padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; }
.omnibox-result {
    padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}
.omnibox-result:hover { background: var(--gray-50); }

/* ============================================================
   KANBAN BOARD
   ============================================================ */
.kanban-board {
    display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px;
    min-height: 400px;
}
.kanban-column {
    min-width: 260px; max-width: 300px; flex: 1;
    background: var(--gray-50); border-radius: var(--radius-md);
    border: 1px solid var(--gray-200); display: flex; flex-direction: column;
}
[data-theme="dark"] .kanban-column { background: var(--gray-100); border-color: var(--gray-300); }
.kanban-column-header {
    padding: 10px 12px; font-weight: 600; font-size: 13px;
    border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center;
}
.kanban-column-count {
    background: var(--gray-200); padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700;
}
.kanban-cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 10px 12px;
    box-shadow: var(--shadow-sm); border-left: 3px solid var(--primary);
    cursor: grab; font-size: 13px; transition: var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; }
[data-theme="dark"] .kanban-card { background: var(--gray-200); }
.kanban-card.urgente { border-left-color: var(--danger); }
.kanban-card.alta { border-left-color: var(--warning); }
.kanban-card-title { font-weight: 600; margin-bottom: 4px; }
.kanban-card-meta { color: var(--gray-500); font-size: 11px; display: flex; gap: 8px; flex-wrap: wrap; }
.kanban-card-tk { color: var(--primary); font-weight: 600; font-size: 11px; }

/* ============================================================
   ACTIVITY TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
    width: 2px; background: var(--gray-200);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
    content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px;
    border-radius: 50%; background: var(--primary); border: 2px solid white;
}
.timeline-item.internal::before { background: var(--warning); }
.timeline-item.system::before { background: var(--gray-400); }
.timeline-header { font-size: 12px; color: var(--gray-500); margin-bottom: 2px; }
.timeline-header strong { color: var(--gray-700); }
.timeline-body { font-size: 13px; }

/* ============================================================
   VISUAL ENHANCEMENTS — Premium UI Overhaul
   ============================================================ */

/* ── LOGIN IMPROVEMENTS ─────────────────────────────────────── */
.login-container {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #3653BA 60%, #4a6bdf 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(74, 107, 223, 0.3) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: floatOrb 8s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: floatOrb 10s ease-in-out infinite reverse;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-card {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: cardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .login-card {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    box-shadow: 0 8px 24px rgba(54, 83, 186, 0.4);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(54, 83, 186, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(54, 83, 186, 0.6); }
}

/* ── SIDEBAR ENHANCEMENTS ───────────────────────────────────── */
.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand-icon {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(54, 83, 186, 0.4);
}

.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--primary-light);
    border-radius: 0 4px 4px 0;
    transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(54, 83, 186, 0.2) 0%, rgba(54, 83, 186, 0.05) 100%);
    color: white;
}

.nav-item.active::before {
    height: 70%;
    background: linear-gradient(180deg, var(--primary-light), #8b5cf6);
    box-shadow: 0 0 12px rgba(74, 107, 223, 0.5);
}

.nav-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.nav-item-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
}

.sidebar-user-avatar {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    box-shadow: 0 2px 8px rgba(54, 83, 186, 0.3);
}

/* ── TOP BAR GLASS EFFECT ───────────────────────────────────── */
.top-bar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
}

[data-theme="dark"] .top-bar {
    background: rgba(30, 41, 59, 0.8);
    border-bottom-color: rgba(71, 85, 105, 0.5);
}

/* ── STAT CARDS PREMIUM ─────────────────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
    border-color: transparent;
}

[data-theme="dark"] .stat-card {
    border-color: var(--border);
}

[data-theme="dark"] .stat-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(54, 83, 186, 0.15);
}

.stat-card-icon {
    border-radius: var(--radius-md);
    position: relative;
}

.stat-card-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.75;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .stat-card-value {
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ── BUTTON GRADIENTS & EFFECTS ─────────────────────────────── */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4a6bdf 100%);
    box-shadow: 0 2px 8px rgba(54, 83, 186, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 4px 16px rgba(54, 83, 186, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary) 0%, #34d399 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary) 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #f87171 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-dark) 0%, var(--danger) 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

/* Audit fix: .btn-outline with context-aware colors */
.btn-outline {
    border: 1.5px solid var(--gray-300);
    color: var(--gray-600);
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(54, 83, 186, 0.04);
}

/* Inside sidebar, use light-on-dark variant */
.sidebar .btn-outline {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.sidebar .btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* ── TABLE ZEBRA STRIPING & EFFECTS ─────────────────────────── */
.table-container {
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.3s ease;
}

.table-container:hover {
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .table-container {
    border-color: var(--border);
}

tbody tr:nth-child(even) {
    background: var(--gray-50);
}

[data-theme="dark"] tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
    background: rgba(54, 83, 186, 0.04);
}

[data-theme="dark"] tbody tr:hover {
    background: rgba(54, 83, 186, 0.08);
}

tbody tr {
    transition: all 0.2s ease;
}

/* ── CHART CARDS IMPROVEMENTS ───────────────────────────────── */
.chart-card {
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

[data-theme="dark"] .chart-card {
    border-color: var(--border);
}

.chart-card-title {
    position: relative;
    padding-left: 12px;
}

.chart-card-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, var(--primary), #8b5cf6);
    border-radius: 2px;
}

/* ── MODAL IMPROVEMENTS ─────────────────────────────────────── */
.modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal {
    border: 1px solid var(--gray-200);
}

[data-theme="dark"] .modal {
    border-color: var(--border);
}

.modal-overlay.active .modal {
    animation: modalBounceIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalBounceIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── FORM INPUT ENHANCEMENTS ────────────────────────────────── */
.form-input {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(54, 83, 186, 0.1);
    transform: translateY(-1px);
}

/* ── BADGE IMPROVEMENTS ─────────────────────────────────────── */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
}

.badge-urgente {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.15);
}

.badge-alta {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.15);
}

.badge-normal {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.15);
}

/* ── SKELETON LOADER ────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

.skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 50%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-300) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
}

/* ── STAGGERED ENTRANCE ANIMATIONS ──────────────────────────── */
.animate-enter {
    animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes enterUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.stats-grid .stat-card:nth-child(1) { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both; }
.stats-grid .stat-card:nth-child(2) { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both; }
.stats-grid .stat-card:nth-child(3) { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both; }
.stats-grid .stat-card:nth-child(4) { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both; }

.charts-grid .chart-card:nth-child(1) { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both; }
.charts-grid .chart-card:nth-child(2) { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both; }

.table-container { animation: enterUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both; }

/* Page content fade in */
.page-content {
    animation: fadeIn 0.4s ease both;
}

/* ── SCROLLBAR STYLING ──────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── BREADCRUMBS ────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.breadcrumb a {
    color: var(--gray-400);
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-sep {
    color: var(--gray-300);
    font-size: 0.7rem;
}

.breadcrumb-current {
    color: var(--gray-600);
    font-weight: 500;
}

/* ── NAV BADGE PULSE ────────────────────────────────────────── */
.nav-item-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ── EMPTY STATE IMPROVEMENTS ───────────────────────────────── */
.empty-state {
    animation: fadeIn 0.5s ease both;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--gray-400);
}

[data-theme="dark"] .empty-state-icon {
    background: var(--gray-200);
}

/* ── CONV CARDS ENHANCEMENTS ────────────────────────────────── */
.conv-card {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.conv-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* ── THEME TOGGLE IMPROVEMENTS ──────────────────────────────── */
.theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--gray-200);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* ── NOTIF BELL IMPROVEMENTS ────────────────────────────────── */
.notif-bell {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notif-bell svg {
    width: 18px;
    height: 18px;
}

.notif-bell:hover {
    background: var(--gray-200);
}

.notif-badge {
    animation: badgePulse 2s ease-in-out infinite;
}

/* ── NOTIFICATION DROPDOWN ANIMATION ────────────────────────── */
.notif-dropdown {
    transform: translateY(8px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.notif-dropdown.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ── W-100 UTILITY ──────────────────────────────────────────── */
.w-100 { width: 100%; }

/* ── FILTER SELECT IMPROVEMENT ──────────────────────────────── */
.filter-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* ── SEARCH BOX IMPROVEMENT ─────────────────────────────────── */
.search-box input:focus {
    box-shadow: 0 0 0 4px rgba(54, 83, 186, 0.1);
    transform: translateY(-1px);
}

/* ── OMNIBOX ANIMATION ──────────────────────────────────────── */
.omnibox-input {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.omnibox-results {
    animation: enterUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   U1: SIDEBAR OVERLAY — click fuera para cerrar en móvil
   ============================================================ */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
    opacity: 0;
    transition: opacity .3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* ============================================================
   U2: SKELETON LOADERS — variantes globales adicionales
   ============================================================ */
.skeleton-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.skeleton-title {
    height: 18px;
    width: 60%;
    margin-bottom: 10px;
    border-radius: 4px;
}
.skeleton-badge {
    height: 22px;
    width: 70px;
    border-radius: 12px;
}
.skeleton-table-row {
    height: 44px;
    margin-bottom: 4px;
    border-radius: 6px;
}

/* ============================================================
   U3: PAGE TRANSITION FADE
   ============================================================ */
.main-content {
    animation: pageEnter .35s ease both;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   U4: ACCESSIBILITY — focus-visible + skip-nav
   ============================================================ */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}
.btn:focus-visible, .form-input:focus-visible, .nav-item:focus-visible {
    box-shadow: 0 0 0 3px rgba(54, 83, 186, .25);
}

.skip-nav {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 12px 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: top .2s;
}
.skip-nav:focus {
    top: 0;
}
