/* ==========================================
   IVENMEX DASHBOARD - BASE GLOBAL
   v19.0 - Con estilos para cotizaciones y deudas
   ========================================== */

/* ==========================================
   1. VARIABLES GLOBALES
========================================== */
:root {
    --md-primary: #0B218B;
    --md-primary-dark: #081A6B;
    --md-primary-light: #1A3BA8;
    --md-secondary: #FFF200;
    --md-secondary-dark: #F5E600;
    --md-accent: #E84C3D;
    --md-success: #27AE60;
    --md-warning: #F39C12;
    --md-danger: #EF4444;
    --md-info: #3498DB;

    --md-white: #FFFFFF;
    --md-gray-light: #F8F9FA;
    --md-gray: #F1F3F5;
    --md-gray-dark: #E1E4E8;
    --md-text: #1A1A1A;
    --md-text-secondary: #6B7280;
    --md-text-muted: #9CA3AF;

    --md-radius-sm: 6px;
    --md-radius-md: 8px;
    --md-radius-lg: 10px;
    --md-radius-xl: 12px;
    --md-elevation-1: 0 1px 3px rgba(0, 0, 0, 0.08);
    --md-elevation-2: 0 2px 6px rgba(0, 0, 0, 0.1);
    --md-elevation-3: 0 4px 12px rgba(0, 0, 0, 0.12);
    --md-elevation-4: 0 8px 24px rgba(0, 0, 0, 0.15);

    --md-space-xs: 4px;
    --md-space-sm: 8px;
    --md-space-md: 12px;
    --md-space-lg: 16px;
    --md-space-xl: 24px;

    --md-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --md-font-display: 'Genos', 'Inter', sans-serif;

    --tv-toolbar-h: 56px;
    --tv-avatars-h: 200px;
    --tv-kpi-h: 200px;
    --tv-gap: 10px;
    --tv-padding: 10px;
    --card-min: 120px;
    --grid-gap: 12px;
}

/* ==========================================
   2. RESET Y BASE
========================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--md-font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--md-text);
    background: var(--md-gray);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; overflow-x: hidden; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    position: fixed;
    top: 8px;
    left: 8px;
    width: auto;
    height: auto;
    padding: 8px 16px;
    margin: 0;
    clip: auto;
    background: var(--md-primary);
    color: white;
    border-radius: var(--md-radius-md);
    z-index: 9999;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--md-gray); border-radius: 5px; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--md-primary), var(--md-primary-dark));
    border-radius: 5px;
    border: 2px solid var(--md-gray);
}
::-webkit-scrollbar-thumb:hover { background: var(--md-primary-dark); }
* { scrollbar-width: thin; scrollbar-color: var(--md-primary) var(--md-gray); }

/* ==========================================
   3. LOADER INICIAL
========================================== */
#ivx-loader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0B218B 0%, #081A6B 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loader-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--md-radius-xl);
    padding: 32px 40px;
    text-align: center;
    box-shadow: var(--md-elevation-4);
    max-width: 420px;
    width: 90%;
}

.loader-logo { height: 60px; margin-bottom: 16px; }

.loader-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--md-gray-dark);
    border-top-color: var(--md-primary);
    border-radius: 50%;
    margin: 16px auto;
    animation: spin 0.8s linear infinite;
}

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

.loader-title {
    font-family: var(--md-font-display);
    font-size: 28px;
    font-weight: 800;
    color: var(--md-primary);
    margin: 8px 0 4px;
    letter-spacing: 2px;
}

.loader-subtitle {
    font-size: 13px;
    color: var(--md-text-secondary);
    margin: 0;
}

#error-container { margin-top: 16px; }

/* ==========================================
   4. LOADING OVERLAY
========================================== */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    gap: 16px;
}

#loading-overlay.hidden { display: none; }

.md-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-gray-dark);
    border-top-color: var(--md-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.md-loading-text {
    font-family: var(--md-font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--md-primary);
    letter-spacing: 2px;
}

/* ==========================================
   5. TOASTS
========================================== */
.md-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.md-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--md-white);
    border-radius: var(--md-radius-md);
    padding: 12px 16px;
    box-shadow: var(--md-elevation-3);
    border-left: 4px solid var(--md-primary);
    min-width: 280px;
    max-width: 380px;
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.md-toast.success { border-left-color: var(--md-success); }
.md-toast.error { border-left-color: var(--md-danger); }
.md-toast.warning { border-left-color: var(--md-warning); }
.md-toast.info { border-left-color: var(--md-info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.md-toast.success .toast-icon { color: var(--md-success); }
.md-toast.error .toast-icon { color: var(--md-danger); }
.md-toast.warning .toast-icon { color: var(--md-warning); }
.md-toast.info .toast-icon { color: var(--md-info); }

.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.toast-message { font-size: 12px; color: var(--md-text-secondary); }

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--md-text-muted);
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
}

/* ==========================================
   6. TOOLBAR
========================================== */
.md-toolbar {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--md-elevation-1);
    margin-bottom: 0;
}

.md-toolbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--md-text);
}

.md-toolbar-brand img { height: 40px; width: auto; }

.md-toolbar-brand .brand-text {
    font-family: var(--md-font-display);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--md-primary);
}

.md-toolbar-actions { display: flex; align-items: center; gap: 12px; }

.md-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--md-gray);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--md-text);
    border: 1px solid var(--md-gray-dark);
}

.md-chip i { color: var(--md-primary); font-size: 12px; }

.realtime-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: #F0FDF4;
    color: #16A34A;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid #BBF7D0;
}

.realtime-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22C55E;
    animation: pulseDot 1.8s ease-in-out infinite;
}

.realtime-indicator.offline {
    background: #FEF2F2;
    color: #DC2626;
    border-color: #FECACA;
}
.realtime-indicator.offline::before { background: #EF4444; animation: none; }

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ==========================================
   7. BOTONES
========================================== */
.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--md-radius-md);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.md-btn:hover { transform: translateY(-1px); box-shadow: var(--md-elevation-2); }
.md-btn:active { transform: translateY(0); }

.md-btn-primary { background: var(--md-primary); color: white; }
.md-btn-primary:hover { background: var(--md-primary-dark); }

.md-btn-secondary { background: var(--md-secondary); color: var(--md-text); }
.md-btn-secondary:hover { background: var(--md-secondary-dark); }

.md-btn-outline {
    background: transparent;
    color: var(--md-primary);
    border: 1px solid var(--md-primary);
}
.md-btn-outline:hover { background: var(--md-primary); color: white; }

.md-btn-text {
    background: transparent;
    color: var(--md-primary);
    padding: 6px 10px;
}
.md-btn-text:hover { background: var(--md-gray); box-shadow: none; }

.md-btn-sm { padding: 5px 10px; font-size: 12px; }

/* ==========================================
   8. CARDS / KPIs
========================================== */
.md-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 0;
}

.md-card {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    padding: 20px;
    box-shadow: var(--md-elevation-1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.md-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--md-primary);
}

.md-card.primary::before { background: var(--md-primary); }
.md-card.warning::before { background: var(--md-warning); }
.md-card.success::before { background: var(--md-success); }
.md-card.danger::before { background: var(--md-danger); }

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

.card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--md-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
    background: var(--md-gray);
    color: var(--md-primary);
}

.md-card.warning .card-icon { background: #FEF3C7; color: var(--md-warning); }
.md-card.success .card-icon { background: #D1FAE5; color: var(--md-success); }
.md-card.danger .card-icon { background: #FEE2E2; color: var(--md-danger); }

.card-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--md-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.card-value {
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
    color: var(--md-text);
    margin-bottom: 6px;
}

.card-change { font-size: 12px; font-weight: 600; color: var(--md-text-secondary); }
.card-change.up { color: var(--md-success); }
.card-change.down { color: var(--md-danger); }

/* ==========================================
   9. BADGES
========================================== */
.md-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--md-gray);
    color: var(--md-text-secondary);
}

.md-badge.primary { background: #DBEAFE; color: var(--md-primary); }
.md-badge.success { background: #D1FAE5; color: #065F46; }
.md-badge.warning { background: #FEF3C7; color: #92400E; }
.md-badge.danger { background: #FEE2E2; color: #991B1B; }
.md-badge.default { background: var(--md-gray); color: var(--md-text-secondary); }

.total-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--md-primary);
    color: white;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

/* ==========================================
   10. SECCIÓN EMPLEADOS (AVATARES)
========================================== */
.empleados-section {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    padding: 16px;
    box-shadow: var(--md-elevation-1);
}

.empleados-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--md-gray-dark);
}

.empleados-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--md-text);
}

.empleados-title i { color: var(--md-primary); font-size: 18px; }

.empleados-stats { display: flex; align-items: center; gap: 16px; }

.empleados-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--md-text-secondary);
}

.empleados-stat i { font-size: 12px; }
.empleados-stat.pendiente i { color: var(--md-warning); }
.empleados-stat.proceso i { color: var(--md-info); }
.empleados-stat.listo i { color: var(--md-success); }
.empleados-stat .stat-value { font-weight: 800; color: var(--md-text); font-size: 15px; }

.empleados-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.empleado-avatar-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--md-gray-light);
    border-radius: var(--md-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    overflow: hidden;
}

.empleado-avatar-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-gradient, linear-gradient(90deg, #6366F1, #8B5CF6));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.empleado-avatar-card:hover {
    background: var(--md-white);
    border-color: var(--md-gray-dark);
    transform: translateY(-2px);
    box-shadow: var(--md-elevation-2);
}

.empleado-avatar-card:hover::before { opacity: 1; }

.avatar-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: white;
    background: var(--card-gradient, linear-gradient(135deg, #6366F1, #8B5CF6));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.avatar-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--md-text);
    text-align: center;
    line-height: 1.2;
}

.empleado-cargo {
    font-size: 10px;
    color: var(--md-text-secondary);
    text-align: center;
    line-height: 1.2;
}

.avatar-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--md-warning);
    color: white;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--md-white);
    z-index: 2;
}

.avatar-badge.listo { background: var(--md-success); }
.avatar-badge.pendiente { background: var(--md-warning); }

.empleado-progress {
    width: 100%;
    height: 4px;
    background: var(--md-gray-dark);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.empleado-progress-fill {
    height: 100%;
    background: var(--card-gradient, linear-gradient(90deg, #6366F1, #8B5CF6));
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ==========================================
   11. TABLAS
========================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--md-radius-md);
    border: 1px solid var(--md-gray-dark);
}

.table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 0; }

.table th, .table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--md-gray-dark);
    font-size: 12px;
    line-height: 1.35;
}

.table thead th {
    background: var(--md-gray);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--md-text-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: var(--md-gray-light); }
.table tbody tr.clickable-row { cursor: pointer; }

.empleados-tabla-section {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    padding: 16px;
    box-shadow: var(--md-elevation-1);
    display: flex;
    flex-direction: column;
}

.empleados-tabla-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--md-gray-dark);
}

.empleados-tabla-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--md-text);
}

.empleados-tabla-title i { color: var(--md-primary); }

.empleados-tabla-tools { display: flex; align-items: center; gap: 8px; }

.empleados-tabla-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--md-gray);
    border-radius: var(--md-radius-md);
    border: 1px solid var(--md-gray-dark);
}

.empleados-tabla-search i { color: var(--md-text-muted); font-size: 12px; }

.empleados-tabla-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 12px;
    font-family: inherit;
    width: 140px;
    color: var(--md-text);
}

.empleados-tabla-wrapper {
    flex: 1;
    overflow: auto;
    border-radius: var(--md-radius-md);
    border: 1px solid var(--md-gray-dark);
}

.empleados-tabla { width: 100%; border-collapse: collapse; font-size: 12px; }

.empleados-tabla thead th {
    background: var(--md-gray);
    padding: 8px 10px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--md-text-secondary);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}

.empleados-tabla thead th.sortable { cursor: pointer; user-select: none; transition: color 0.15s ease; }
.empleados-tabla thead th.sortable:hover { color: var(--md-primary); }
.empleados-tabla thead th.sortable.asc::after { content: ' ▲'; font-size: 8px; }
.empleados-tabla thead th.sortable.desc::after { content: ' ▼'; font-size: 8px; }

.empleados-tabla td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--md-gray-dark);
    vertical-align: middle;
}

.empleados-tabla tbody tr { cursor: pointer; transition: background 0.15s ease; }
.empleados-tabla tbody tr:hover { background: var(--md-gray-light); }

.emp-cell { display: flex; align-items: center; gap: 8px; }

.emp-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.emp-info { display: flex; flex-direction: column; min-width: 0; }

.emp-nombre {
    font-size: 12px;
    font-weight: 700;
    color: var(--md-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-email {
    font-size: 10px;
    color: var(--md-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-cargo { font-size: 10px; color: var(--md-text-secondary); }

.emp-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--md-radius-sm);
    font-size: 11px;
    font-weight: 800;
    background: var(--md-gray);
    color: var(--md-text);
}

.emp-num.pendiente { background: #FEF3C7; color: #92400E; }
.emp-num.proceso { background: #DBEAFE; color: #1E40AF; }
.emp-num.listo { background: #D1FAE5; color: #065F46; }
.emp-num.retraso { background: #FEE2E2; color: #991B1B; }

.emp-tasa { display: flex; align-items: center; gap: 6px; }

.emp-tasa-bar {
    width: 36px;
    height: 4px;
    background: var(--md-gray-dark);
    border-radius: 999px;
    overflow: hidden;
}

.emp-tasa-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.emp-tasa-bar span.success { background: var(--md-success); }
.emp-tasa-bar span.primary { background: var(--md-primary); }
.emp-tasa-bar span.warning { background: var(--md-warning); }
.emp-tasa-bar span.danger { background: var(--md-danger); }
.emp-tasa-bar span.default { background: var(--md-text-muted); }

.emp-tasa-txt { font-size: 11px; font-weight: 700; min-width: 28px; }

.emp-carga {
    width: 60px;
    height: 6px;
    background: var(--md-gray-dark);
    border-radius: 999px;
    overflow: hidden;
}

.emp-carga span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--md-primary), var(--md-primary-light));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.emp-estado { font-size: 10px; padding: 2px 8px; }
.emp-acciones { display: flex; gap: 4px; }

.emp-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--md-radius-sm);
    border: 1px solid var(--md-gray-dark);
    background: var(--md-white);
    color: var(--md-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
}

.emp-btn:hover { background: var(--md-primary); color: white; border-color: var(--md-primary); }

.tabla-loading, .tabla-empty {
    text-align: center;
    padding: 30px;
    color: var(--md-text-secondary);
    font-size: 13px;
}

.tabla-loading i, .tabla-empty i {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--md-primary);
}

/* ==========================================
   12. SECCIÓN PEDIDOS URGENTES
========================================== */
.urgentes-section {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    padding: 16px;
    box-shadow: var(--md-elevation-1);
    display: flex;
    flex-direction: column;
}

.urgentes-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--md-text);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.urgentes-section h3 i { color: var(--md-danger); }
.urgentes-section .table-responsive { flex: 1; overflow: auto; }
.urgentes-section .table th:last-child,
.urgentes-section .table td:last-child { text-align: right; }

/* ==========================================
   13. MODALES
========================================== */
.modal-content.md-modal-content {
    border: none;
    border-radius: var(--md-radius-xl);
    box-shadow: var(--md-elevation-4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 92vh;
}

.modal-header {
    padding: 14px 18px;
    background: var(--md-gray-light);
    border-bottom: 1px solid var(--md-gray-dark);
}

.modal-header .modal-title { font-size: 15px; font-weight: 700; color: var(--md-text); }
.modal-body { padding: 18px; font-size: 13px; overflow-y: auto; }

.modal-footer {
    padding: 12px 18px;
    background: var(--md-gray-light);
    border-top: 1px solid var(--md-gray-dark);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.md-form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.md-form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--md-gray-dark);
    border-radius: var(--md-radius-md);
    background: var(--md-white);
    color: var(--md-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.md-form-control:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 3px rgba(11, 33, 139, 0.1);
}

.md-form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.detail-card {
    background: var(--md-gray-light);
    border: 1px solid var(--md-gray-dark);
    border-radius: var(--md-radius-md);
    padding: 12px;
    margin-bottom: 10px;
}

.detail-card .detail-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--md-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-card .detail-value { font-size: 13px; color: var(--md-text); font-weight: 600; }

.avatar-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    font-weight: 800;
}

.profile-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    background: var(--md-gray-light);
    border-radius: var(--md-radius-md);
    margin-bottom: 12px;
}

.info-item { font-size: 13px; color: var(--md-text); }
.info-item .label { font-weight: 700; color: var(--md-text-secondary); }

.stats-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }

.stat {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.stat.completadas { background: #D1FAE5; color: #065F46; }
.stat.proceso { background: #DBEAFE; color: #1E40AF; }
.stat.pendientes { background: #FEF3C7; color: #92400E; }

.tareas-empleado-modal { width: 100%; border-collapse: collapse; font-size: 12px; }

.tareas-empleado-modal th {
    padding: 8px 10px;
    background: var(--md-gray);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--md-text-secondary);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}

.tareas-empleado-modal td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--md-gray-dark);
}

.status-select {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--md-radius-sm);
    border: 1px solid var(--md-gray-dark);
    background: var(--md-white);
    cursor: pointer;
    font-family: inherit;
}

.status-select.status-pendiente { background: #FEF3C7; color: #92400E; border-color: #FCD34D; }
.status-select.status-en_progreso { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; }
.status-select.status-notificado { background: #E0E7FF; color: #3730A3; border-color: #A5B4FC; }
.status-select.status-completado { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }

.status-badge-sm {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--md-radius-sm);
    background: var(--md-gray);
    color: var(--md-text-secondary);
}

.status-badge-sm.completado { background: #D1FAE5; color: #065F46; }

/* ==========================================
   14. EMPTY STATE
========================================== */
.md-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--md-text-secondary);
}

.md-empty .empty-icon {
    font-size: 36px;
    color: var(--md-text-muted);
    margin-bottom: 8px;
    display: block;
}

.md-empty .empty-title { font-size: 13px; font-weight: 600; }

/* ==========================================
   15. PROGRESS BAR
========================================== */
.md-progress {
    height: 8px;
    background: var(--md-gray-dark);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.progress-fill.success { background: var(--md-success); }
.progress-fill.primary { background: var(--md-primary); }
.progress-fill.warning { background: var(--md-warning); }
.progress-fill.danger { background: var(--md-danger); }
.progress-fill.default { background: var(--md-text-muted); }

/* ==========================================
   16. GRÁFICOS Y EFICIENCIA
========================================== */
.charts-section .card {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-elevation-1);
    border: none;
}

.charts-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--md-text);
    margin: 0 0 12px 0;
}

#doughnut-chart {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    margin: 12px auto;
    background: conic-gradient(#EEEEEE 0% 100%);
    box-shadow: inset 0 0 0 20px var(--md-white), var(--md-elevation-1);
}

#doughnut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--md-text-secondary);
}

.legend-item .color-box { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.bar-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.bar-label {
    min-width: 120px;
    font-size: 12px;
    font-weight: 600;
    color: var(--md-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--md-gray);
    border-radius: var(--md-radius-sm);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    border-radius: var(--md-radius-sm);
    transition: width 0.5s ease;
    white-space: nowrap;
}

.eficiencia-section {
    background: var(--md-white);
    border-radius: var(--md-radius-lg);
    padding: 16px;
    box-shadow: var(--md-elevation-1);
}

/* ==========================================
   17. UTILIDADES
========================================== */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.me-2 { margin-right: 8px; }
.ms-2 { margin-left: 8px; }
.p-3 { padding: 12px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }

/* ==========================================
   18. MODAL DE EMPLEADO - TABLA ALARGADA PARA TV
   ========================================== */
.modal-dialog.modal-empleado-tv {
    max-width: 95vw;
    width: 95vw;
    margin: 1.75rem auto;
}

.modal-dialog.modal-empleado-tv .modal-content {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.empleado-modal-header {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--md-primary), var(--md-primary-light));
    color: white;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.empleado-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.empleado-modal-header .avatar-lg {
    width: 42px;
    height: 42px;
    font-size: 16px;
    margin-right: 0;
    flex-shrink: 0;
}

.empleado-modal-title-info { display: flex; flex-direction: column; min-width: 0; }

.empleado-modal-header .modal-title {
    font-size: 16px;
    font-weight: 800;
    color: white;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empleado-modal-subtitle { font-size: 12px; opacity: 0.85; font-weight: 500; }

.empleado-modal-stats { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.empleado-modal-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.empleado-modal-stat-pill.success { background: rgba(39, 174, 96, 0.9); }
.empleado-modal-stat-pill.info { background: rgba(52, 152, 219, 0.9); }
.empleado-modal-stat-pill.warning { background: rgba(243, 156, 18, 0.9); }
.empleado-modal-stat-pill.danger { background: rgba(239, 68, 68, 0.9); }
.empleado-modal-stat-pill i { font-size: 10px; }

.empleado-modal-header .btn-close {
    filter: invert(1) brightness(200%);
    opacity: 0.85;
    margin: 0;
}
.empleado-modal-header .btn-close:hover { opacity: 1; }

.empleado-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    background: var(--md-gray-light);
}

.tabla-tareas-empleado {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--md-white);
}

.tabla-tareas-empleado thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--md-primary);
    color: white;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--md-primary-dark);
}

.tabla-tareas-empleado tbody tr {
    border-bottom: 1px solid var(--md-gray-dark);
    transition: background 0.15s ease;
}

.tabla-tareas-empleado tbody tr:hover { background: #F5F7FF; }
.tabla-tareas-empleado tbody tr:last-child { border-bottom: none; }

.tabla-tareas-empleado td {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--md-text);
    vertical-align: middle;
    line-height: 1.35;
}

.tabla-tareas-empleado td.col-id {
    font-weight: 800;
    color: var(--md-primary);
    white-space: nowrap;
    width: 60px;
}

.tabla-tareas-empleado td.col-fecha {
    white-space: nowrap;
    font-size: 11px;
    color: var(--md-text-secondary);
    width: 90px;
}

.tabla-tareas-empleado td.col-tipo {
    font-weight: 700;
    color: var(--md-text);
    white-space: nowrap;
    width: 130px;
}

.tabla-tareas-empleado td.col-tarea {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabla-tareas-empleado td.col-cliente {
    font-weight: 600;
    color: var(--md-text);
    white-space: nowrap;
    width: 150px;
}

.tabla-tareas-empleado td.col-estado { width: 140px; }
.tabla-tareas-empleado td.col-acciones { width: 60px; text-align: right; white-space: nowrap; }

.tabla-tareas-empleado .status-select {
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--md-gray-dark);
    background: var(--md-white);
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    max-width: 130px;
}

.tabla-tareas-empleado .status-select.status-pendiente {
    background: #FEF3C7; color: #92400E; border-color: #FCD34D;
}
.tabla-tareas-empleado .status-select.status-notificado {
    background: #E0E7FF; color: #3730A3; border-color: #A5B4FC;
}
.tabla-tareas-empleado .status-select.status-en_progreso {
    background: #DBEAFE; color: #1E40AF; border-color: #93C5FD;
}
.tabla-tareas-empleado .status-select.status-completado {
    background: #D1FAE5; color: #065F46; border-color: #6EE7B7;
}

.tabla-tareas-empleado .badge-prioridad {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tabla-tareas-empleado .badge-prioridad.urgente { background: #FEE2E2; color: #991B1B; }
.tabla-tareas-empleado .badge-prioridad.normal { background: var(--md-gray); color: var(--md-text-secondary); }
.tabla-tareas-empleado .badge-prioridad.baja { background: #F0F9FF; color: #075985; }

.tabla-tareas-empleado .btn-tabla-accion {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--md-gray-dark);
    background: var(--md-white);
    color: var(--md-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
}

.tabla-tareas-empleado .btn-tabla-accion:hover {
    background: var(--md-primary);
    color: white;
    border-color: var(--md-primary);
}

.empleado-modal-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--md-text-secondary);
}

.empleado-modal-empty i {
    font-size: 48px;
    color: var(--md-text-muted);
    margin-bottom: 12px;
    display: block;
}

.empleado-modal-empty h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--md-text);
    margin: 0 0 6px;
}

.empleado-modal-empty p { font-size: 12px; margin: 0; }

.empleado-modal-footer {
    padding: 10px 16px;
    background: var(--md-white);
    border-top: 1px solid var(--md-gray-dark);
    justify-content: space-between;
    align-items: center;
}

/* ==========================================
   19. RESPONSIVE MODAL EMPLEADO EN TV
   ========================================== */
@media (max-height: 800px) {
    .modal-dialog.modal-empleado-tv {
        max-width: 98vw;
        width: 98vw;
        margin: 0.5rem auto;
    }
    .modal-dialog.modal-empleado-tv .modal-content { max-height: 95vh; }
    .empleado-modal-header { padding: 6px 12px; gap: 10px; }
    .empleado-modal-header .avatar-lg { width: 34px; height: 34px; font-size: 13px; }
    .empleado-modal-header .modal-title { font-size: 13px; }
    .empleado-modal-subtitle { font-size: 10px; }
    .empleado-modal-stat-pill { padding: 3px 8px; font-size: 9.5px; }

    .tabla-tareas-empleado { font-size: 10.5px; }
    .tabla-tareas-empleado thead th { padding: 6px 8px; font-size: 8.5px; }
    .tabla-tareas-empleado td { padding: 6px 8px; font-size: 10.5px; }
    .tabla-tareas-empleado td.col-id { width: 45px; font-size: 10px; }
    .tabla-tareas-empleado td.col-fecha { width: 70px; font-size: 9.5px; }
    .tabla-tareas-empleado td.col-tipo { width: 100px; font-size: 10px; }
    .tabla-tareas-empleado td.col-tarea { max-width: 200px; font-size: 10px; }
    .tabla-tareas-empleado td.col-cliente { width: 110px; font-size: 10px; }
    .tabla-tareas-empleado .status-select { padding: 3px 6px; font-size: 9.5px; max-width: 110px; }
    .tabla-tareas-empleado .btn-tabla-accion { width: 24px; height: 24px; font-size: 9px; }

    .empleado-modal-footer { padding: 6px 12px; }
}

@media (max-height: 700px) {
    .empleado-modal-header { padding: 5px 10px; }
    .empleado-modal-stat-pill { padding: 2px 6px; font-size: 9px; }
    .tabla-tareas-empleado { font-size: 10px; }
    .tabla-tareas-empleado thead th { padding: 5px 6px; font-size: 8px; }
    .tabla-tareas-empleado td { padding: 5px 6px; font-size: 10px; }
}

/* ==========================================
   20. NUEVOS ESTILOS PARA COTIZACIONES Y DEUDAS
   ========================================== */
.file-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--md-gray-light);
    border: 1px solid var(--md-gray-dark);
    color: var(--md-text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
    margin-right: 4px;
}

.file-action-btn:hover {
    background: var(--md-primary);
    border-color: var(--md-primary);
    transform: scale(1.05);
}

.file-action-btn.pdf:hover { background: #DC2626; border-color: #DC2626; color: white; }
.file-action-btn.docx:hover { background: #2563EB; border-color: #2563EB; color: white; }

/* Badge estados cotización */
.cotizacion-estado-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cotizacion-estado-badge.emitida { background: #E5E7EB; color: #374151; }
.cotizacion-estado-badge.aceptada { background: #D1FAE5; color: #065F46; }
.cotizacion-estado-badge.rechazada { background: #FEE2E2; color: #991B1B; }
.cotizacion-estado-badge.vencida { background: #FEF3C7; color: #92400E; }
.cotizacion-estado-badge.convertida { background: #DBEAFE; color: #1E40AF; }

/* Filtros de deuda */
.deudas-filtro-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--md-gray);
    color: var(--md-text-secondary);
    border: 1px solid var(--md-gray-dark);
    cursor: pointer;
    transition: all 0.15s ease;
}

.deudas-filtro-badge:hover { background: var(--md-primary); color: white; border-color: var(--md-primary); }
.deudas-filtro-badge.active { background: var(--md-primary); color: white; border-color: var(--md-primary); }

/* Resumen de deuda por cliente (en modal detalle) */
.deuda-detalle-header {
    background: linear-gradient(135deg, var(--md-primary), var(--md-primary-light));
    color: white;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 14px;
}

.deuda-detalle-header h3 {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 4px;
}

.deuda-detalle-header p {
    font-size: 12px;
    margin: 0;
    opacity: 0.9;
}

.deuda-detalle-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.deuda-detalle-stat {
    background: var(--md-white);
    border: 1px solid var(--md-gray-dark);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.deuda-detalle-stat .label {
    font-size: 10px;
    color: var(--md-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 700;
    margin-bottom: 4px;
}

.deuda-detalle-stat .value {
    font-size: 18px;
    font-weight: 800;
    color: var(--md-text);
}

.deuda-detalle-stat .value.danger { color: var(--md-danger); }
.deuda-detalle-stat .value.success { color: var(--md-success); }
.deuda-detalle-stat .value.warning { color: var(--md-warning); }

/* Botón registrar deuda */
.btn-registrar-deuda {
    background: linear-gradient(135deg, #0B218B, #1A3BA8);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-registrar-deuda:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 33, 139, 0.3);
}

/* ==========================================
   21. REDUCIR MOVIMIENTO
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    .md-card:hover,
    .empleado-avatar-card:hover,
    .empleado-avatar-card:hover .avatar-circle,
    .panel-highlight {
        animation: none;
        transform: none;
    }
}
