/* ==========================================================================
   1. VARIABLES Y CONFIGURACIÓN GLOBAL
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta de Colores Corporativa */
    --bg-main: #f4f7f6; 
    --sidebar-bg: #0b132b; 
    --primary: #3b82f6; 
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b; 
    --inactivo: #475569;
    
    /* Textos y Bordes */
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', sans-serif; 
}

body { 
    background: var(--bg-main); 
    color: var(--text-dark); 
    height: 100vh; 
    width: 100vw; 
    overflow: hidden; 
}

/* ==========================================================================
   2. SCROLLBAR PREMIUM Y UTILIDADES
   ========================================================================== */
::-webkit-scrollbar { 
    width: 8px; 
    height: 8px; 
}

::-webkit-scrollbar-track { 
    background: transparent; 
}

::-webkit-scrollbar-thumb { 
    background: #cbd5e1; 
    border-radius: 10px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: #94a3b8; 
}

.hidden { display: none !important; visibility: hidden !important; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.fw-bold { font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.justify-center { justify-content: center; }
.border-radius { border-radius: 12px; } /* Ajustado a 12px para diseño premium */

/* ==========================================================================
   3. NOTIFICACIONES (TOASTS)
   ========================================================================== */
.toast-container { 
    position: fixed; 
    top: 20px; 
    right: 20px; 
    z-index: 9999; 
    display: flex; 
    flex-direction: column; 
    gap: 12px;
}

.toast { 
    background: white; 
    color: var(--text-dark); 
    padding: 1rem 1.5rem; 
    border-radius: 16px; /* Más redondo */
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.1); /* Sombra difuminada */
    display: flex; 
    align-items: center; 
    gap: 12px; 
    font-weight: 600; 
    font-size: 0.95rem; 
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
    border-left: 5px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.fade-out { animation: fadeOut 0.3s ease forwards; }

@keyframes slideInRight { 
    from { transform: translateX(100%); opacity: 0; } 
    to { transform: translateX(0); opacity: 1; } 
}

@keyframes fadeOut { 
    to { opacity: 0; transform: translateY(-10px); } 
}

/* ==========================================================================
   4. MODALES Y FORMULARIOS (DISEÑO PREMIUM SOFT)
   ========================================================================== */
.login-overlay, .modal-overlay { 
    position: fixed; 
    inset: 0; 
    background: rgba(11, 19, 43, 0.5); /* Más transparente */
    backdrop-filter: blur(8px); /* Desenfoque estilo Apple */
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 1000; 
    padding: 1rem;
}

.login-card { 
    background: white; 
    padding: 3.5rem 3rem; 
    border-radius: 24px; /* Bordes premium */
    width: 100%; 
    max-width: 420px; 
    text-align: center; 
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15); /* Sombra profunda y suave */
    border: 1px solid rgba(255,255,255,0.5);
}

.login-logo { width: 75px; margin-bottom: 1.5rem; }
.login-card h2 { color: var(--sidebar-bg); margin-bottom: 0.5rem; font-weight: 800; font-size: 1.8rem; letter-spacing: -0.5px;}
.login-card p { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 0.95rem;}

.modal-card { 
    background: white; 
    padding: 0; /* Controlamos el padding por secciones para que el footer y header lleguen al borde */
    border-radius: 24px; 
    width: 100%; 
    max-width: 850px; 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15); 
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.5);
}

@keyframes scaleIn { 
    from { transform: scale(0.95) translateY(10px); opacity: 0; } 
    to { transform: scale(1) translateY(0); opacity: 1; } 
}

.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1.5rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9; 
}

.modal-header h2 { 
    font-size: 1.4rem; 
    color: var(--sidebar-bg); 
    font-weight: 800;
    letter-spacing: -0.3px;
}

.close-btn { 
    background: #f8fafc; 
    border: none; 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    font-size: 1.1rem; 
    color: var(--text-muted); 
    cursor: pointer; 
    transition: 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-btn:hover { 
    background: #fee2e2; 
    color: var(--danger); 
    transform: rotate(90deg); /* Pequeño efecto dinámico */
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;}

.modal-footer { 
    display: flex; 
    justify-content: flex-end; 
    gap: 1rem; 
    background: #ffffff; 
    border-top: 1px solid #f1f5f9; 
    padding: 1.5rem 2rem; 
}

.training-modal-card {
    max-width: 960px;
}

.training-modal-header {
    padding: 1.6rem 1.9rem;
}

.training-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.95rem;
}

.training-modal-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.training-modal-header h2 {
    margin: 0;
}

.training-modal-subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.training-modal-body {
    background: linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
    padding: 1.8rem 1.9rem 1.9rem;
}

.training-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.training-employee-name {
    margin: 0;
    color: var(--sidebar-bg);
    font-size: 1.05rem;
}

.training-employee-caption {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.training-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    gap: 0.65rem;
    min-width: min(100%, 420px);
}

.training-summary-card {
    border: 1px solid #dbe6f5;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.7rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 74px;
}

.training-summary-card strong {
    color: var(--sidebar-bg);
    font-size: 1.15rem;
    line-height: 1.1;
}

.training-summary-card span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.training-summary-alert {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.16);
}

.training-composer {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(160px, 0.9fr)) minmax(0, 1fr) auto;
    gap: 0.8rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.training-field,
.training-upload-trigger {
    min-height: 58px;
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.training-field:hover,
.training-upload-trigger:hover {
    border-color: #bfd0e8;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.training-field:focus-within,
.training-upload-trigger:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.training-field-icon {
    color: #6b7a90;
    flex-shrink: 0;
}

.training-input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    color: var(--sidebar-bg);
    font-size: 0.96rem;
    font-weight: 600;
    min-width: 0;
}

.training-input::placeholder {
    color: #8a98ab;
    font-weight: 500;
}

.training-upload-trigger {
    cursor: pointer;
    justify-content: flex-start;
    min-width: 0;
    color: var(--sidebar-bg);
    font-weight: 700;
}

.training-upload-trigger span:last-of-type {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.training-submit-btn {
    min-width: 128px;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.18);
}

.training-submit-btn[disabled] {
    opacity: 0.72;
    cursor: wait;
}

.training-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.training-legend-item {
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.training-dot {
    font-size: 0.62rem;
}

.training-dot-ok {
    color: #10b981;
}

.training-dot-warn {
    color: #f59e0b;
}

.training-dot-danger {
    color: #ef4444;
}

.training-list {
    display: grid;
    gap: 0.95rem;
}

.training-section {
    border: 1px solid #d7e1ef;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
}

.training-section-header {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid #dfe7f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(248, 250, 252, 0.9);
}

.training-section-title {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--sidebar-bg);
    font-weight: 800;
}

.training-section-title i {
    color: var(--primary);
}

.training-section-count {
    min-width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edf3ff;
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 800;
}

.training-section-body {
    display: grid;
    gap: 0.8rem;
    padding: 0.9rem;
}

.training-record-card {
    border: 1px solid #dfe7f3;
    border-radius: 8px;
    background: #ffffff;
    padding: 1rem 1rem 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.training-record-card:hover {
    border-color: #c7d6ea;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.training-record-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.training-record-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.training-record-title {
    color: var(--sidebar-bg);
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.2;
}

.training-record-link {
    text-decoration: none;
}

.training-record-link:hover {
    color: var(--primary);
}

.training-link-btn {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.training-record-chip {
    min-height: 30px;
    border-radius: 999px;
    padding: 0 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.79rem;
    font-weight: 800;
    text-decoration: none;
}

.training-record-chip-ok {
    background: rgba(16, 185, 129, 0.12);
    color: #0f9a6d;
}

.training-record-chip-warn {
    background: rgba(245, 158, 11, 0.13);
    color: #c96f00;
}

.training-record-chip-danger {
    background: rgba(239, 68, 68, 0.11);
    color: #d03333;
}

.training-record-chip-muted,
.training-record-chip-neutral {
    background: #eef3fb;
    color: #516277;
}

.training-record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1rem;
    margin-top: 0.7rem;
    color: #66768b;
    font-size: 0.86rem;
}

.training-record-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
}

.training-record-docs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.85rem;
}

.training-doc-link {
    min-height: 32px;
    border-radius: 999px;
    padding: 0 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #edf3ff;
    color: #2554d8;
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
}

.training-doc-link::before {
    content: "\f15b";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.training-doc-link:hover {
    background: #dfe9ff;
}

.training-record-delete {
    flex-shrink: 0;
}

.training-empty-state {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
    padding: 1rem;
}

.training-empty-state i {
    font-size: 1.2rem;
    color: #9babc1;
}

@media (max-width: 1024px) {
    .training-heading-row {
        flex-direction: column;
    }

    .training-summary {
        width: 100%;
        min-width: 0;
    }

    .training-composer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .training-submit-btn {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .training-modal-body {
        padding: 1.2rem;
    }

    .training-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .training-composer {
        grid-template-columns: 1fr;
    }

    .training-record-title-row {
        flex-direction: column;
    }

    .training-record-delete {
        align-self: flex-end;
    }

    .training-record-meta {
        flex-direction: column;
        gap: 0.55rem;
    }
}

.messenger-docs-panel {
    border: 1px solid #d9e3f2;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    padding: 1.25rem;
}

.messenger-docs-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.messenger-docs-intro h4 {
    margin: 0;
    color: var(--sidebar-bg);
    font-size: 1rem;
}

.messenger-docs-intro p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.messenger-docs-badge {
    min-height: 30px;
    padding: 0 0.8rem;
    border-radius: 999px;
    background: #edf3ff;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.messenger-doc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.messenger-doc-card {
    border: 1px solid #dbe5f2;
    border-radius: 12px;
    background: #ffffff;
    padding: 1rem;
    display: grid;
    gap: 0.8rem;
}

.messenger-doc-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: flex-start;
}

.messenger-doc-card-title {
    color: var(--sidebar-bg);
    font-size: 0.96rem;
    font-weight: 800;
    margin: 0;
}

.messenger-doc-card-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0.3rem 0 0;
    line-height: 1.45;
}

.messenger-doc-count {
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #f3f6fb;
    color: #61748a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
}

.messenger-doc-upload {
    min-height: 42px;
    border-radius: 10px;
    border: 1px dashed #bdd0ea;
    background: #f8fbff;
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0 0.9rem;
    text-decoration: none;
}

.messenger-doc-upload:hover {
    background: #eef5ff;
}

.messenger-doc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.messenger-doc-pill {
    min-height: 34px;
    border-radius: 999px;
    background: #eff4fb;
    color: #45607d;
    padding: 0 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.messenger-doc-pill.pending {
    background: #fff5e8;
    color: #b86300;
}

.messenger-doc-empty {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
}

.document-viewer-card {
    max-width: 1080px;
    width: min(96vw, 1080px);
}

.document-viewer-header {
    gap: 1rem;
}

.document-viewer-header h2 {
    margin: 0;
}

.document-viewer-subtitle {
    margin: 0.3rem 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.document-viewer-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.document-toolbar-btn {
    min-height: 38px;
}

.document-viewer-body {
    background: #eef3fb;
    padding: 1rem;
    min-height: min(78vh, 820px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-frame,
.document-image-frame {
    width: 100%;
    height: min(74vh, 780px);
    border: none;
    border-radius: 12px;
    background: #ffffff;
}

.document-image-frame {
    object-fit: contain;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.document-viewer-empty {
    display: grid;
    gap: 0.8rem;
    justify-items: center;
    text-align: center;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .messenger-doc-grid {
        grid-template-columns: 1fr;
    }

    .document-viewer-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .document-viewer-toolbar {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .messenger-docs-intro {
        flex-direction: column;
    }

    .document-viewer-body {
        padding: 0.75rem;
        min-height: 68vh;
    }
}

/* Secciones Internas del Formulario (Tarjetas flotantes) */
.form-section { 
    background: #ffffff; 
    border: 1px solid #e2e8f0; 
    border-radius: 16px; 
    padding: 1.5rem; 
    margin-bottom: 1.5rem; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: 0.2s;
}

.form-section:hover { 
    border-color: #cbd5e1; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.form-section-title { 
    font-size: 0.9rem; 
    font-weight: 800; 
    color: var(--sidebar-bg); 
    margin-bottom: 1.5rem; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

/* Inputs y Controles */
.input-group { margin-bottom: 0.5rem; text-align: left;}

.input-group label { 
    display: block; 
    font-size: 0.75rem; 
    font-weight: 700; 
    color: var(--text-muted); 
    margin-bottom: 8px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

.input-group input, 
.input-group select, 
.input-group textarea { 
    width: 100%; 
    padding: 0.85rem 1.2rem; 
    border: 1px solid #e2e8f0; 
    border-radius: 12px; /* Más redondeados */
    outline: none; 
    background: #f8fafc; 
    font-size: 0.95rem; 
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.input-group input:hover, 
.input-group select:hover, 
.input-group textarea:hover { 
    background: #f1f5f9; 
}

.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus { 
    border-color: var(--primary); 
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); /* Halo de enfoque suave */
}

.error-msg { 
    background: #fef2f2; 
    color: var(--danger); 
    padding: 10px; 
    border-radius: 8px; 
    margin-top: 1rem; 
    font-size: 0.85rem; 
    font-weight: 600;
}

.checkbox-group { 
    background: #f8fafc; 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    padding: 1.2rem; 
    display: flex; 
    gap: 20px; 
    align-items: center; 
}

.checkbox-group label { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-weight: 600; 
    font-size: 0.9rem; 
    cursor: pointer;
    color: var(--text-dark);
}

.checkbox-group input[type="checkbox"] { 
    width: 18px; 
    height: 18px; 
    cursor: pointer; 
    accent-color: var(--primary);
    border-radius: 4px;
}

/* ==========================================================================
   5. BOTONES GLOBALES PREMIUM
   ========================================================================== */
.btn-primary { 
    background: var(--primary); 
    color: white; 
    border: none; 
    padding: 0.85rem 1.8rem; 
    border-radius: 12px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 0.95rem; 
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover { 
    background: var(--primary-hover); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.35);
}

.btn-secondary { 
    background: #ffffff; 
    color: var(--text-dark); 
    border: 1px solid var(--border); 
    padding: 0.85rem 1.8rem; 
    border-radius: 12px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    font-size: 0.95rem;
    display: inline-flex; 
    align-items: center; 
    gap: 8px;
}

.btn-secondary:hover { 
    background: #f8fafc; 
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-danger { 
    background: var(--danger); 
    color: white; 
    border: none; 
    padding: 0.85rem 1.8rem; 
    border-radius: 12px; 
    font-weight: 700; 
    cursor: pointer; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
    transition: all 0.2s ease;
}

.btn-danger:hover { 
    background: #dc2626; 
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   6. ESTRUCTURA PRINCIPAL (SIDEBAR Y MAIN)
   ========================================================================== */
#app-container { 
    display: flex; 
    flex-direction: row; 
    height: 100vh; 
    width: 100vw;
}

.sidebar { 
    width: 260px; 
    flex-shrink: 0; 
    background: var(--sidebar-bg); 
    color: white; 
    display: flex; 
    flex-direction: column; 
    padding: 2rem 1rem; 
    z-index: 20;
}

.brand { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 3rem; 
    padding: 0 10px;
}

.brand-logo { width: 36px; }

.brand h2 { 
    font-size: 1.5rem; 
    font-weight: 800; 
    letter-spacing: 0.5px;
}

.menu { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}

.menu-label { 
    font-size: 0.7rem; 
    font-weight: 800; 
    color: #64748b; 
    letter-spacing: 1.2px; 
    margin-bottom: 0.5rem; 
    padding-left: 15px; 
    margin-top: 1rem;
}

.tab-btn { 
    background: none; 
    border: none; 
    color: #cbd5e1; 
    text-align: left; 
    padding: 0.9rem 15px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-size: 0.95rem; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    transition: all 0.2s ease; 
    font-weight: 600;
}

.tab-btn i { 
    width: 20px; 
    text-align: center; 
    opacity: 0.7;
}

.tab-btn:hover { 
    background: rgba(255,255,255,0.08); 
    color: white; 
}

.tab-btn:hover i { opacity: 1; }

.tab-btn.active { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.tab-btn.active i { opacity: 1; }

.sidebar-footer { 
    padding-top: 1.5rem; 
    border-top: 1px solid rgba(255,255,255,0.1); 
}

.btn-logout { 
    background: transparent; 
    border: 1px solid rgba(255,255,255,0.15); 
    color: #cbd5e1; 
    width: 100%; 
    padding: 0.85rem; 
    border-radius: 12px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
    transition: 0.2s; 
    font-weight: 600;
}

.btn-logout:hover { 
    background: rgba(255,255,255,0.1); 
    color: white; 
    border-color: rgba(255,255,255,0.4);
}

.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    min-width: 0;
}

.topbar { 
    height: 80px; 
    background: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(10px);
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 2.5rem; 
    border-bottom: 1px solid var(--border); 
    flex-shrink: 0;
}

.search-container { position: relative; width: 450px; }

.search-container i { 
    position: absolute; 
    left: 1.2rem; 
    top: 50%; 
    transform: translateY(-50%); 
    color: var(--text-muted); 
}

.search-container input { 
    width: 100%; 
    padding: 0.85rem 1rem 0.85rem 3rem; 
    border: 1px solid var(--border); 
    border-radius: 20px; 
    outline: none; 
    background: #f8fafc; 
    font-size: 0.95rem; 
    font-weight: 500;
    transition: 0.2s;
}

.search-container input:focus { 
    border-color: var(--primary); 
    background: white; 
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.user-profile { display: flex; align-items: center; gap: 1rem; cursor: pointer;}
.user-info { text-align: right; line-height: 1.3; }
.user-info span { display: block; font-size: 0.95rem; font-weight: 700; }
.user-info small { font-weight: 600; color: var(--primary); }

.avatar { 
    width: 42px; 
    height: 42px; 
    background: #e2e8f0; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--sidebar-bg); 
    font-size: 1.2rem; 
    font-weight: bold;
}

/* ==========================================================================
   7. VISTAS Y CONTENIDO CENTRAL
   ========================================================================== */
.views-container { 
    padding: 2.5rem; 
    overflow-y: auto; 
    flex: 1; 
    background: var(--bg-main);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page-title { font-size: 1.8rem; font-weight: 800; color: var(--sidebar-bg); letter-spacing: -0.5px;}

.filter-select { 
    padding: 0.75rem 1.2rem; 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    outline: none; 
    font-size: 0.95rem; 
    font-weight: 600; 
    background: white;
}

/* Dashboards KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }

.kpi-card { 
    background: var(--card-bg); 
    padding: 2rem; 
    border-radius: 20px; 
    border: 1px solid var(--border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); 
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}

.kpi-card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); 
}

.kpi-info h3 { font-size: 0.85rem; color: var(--text-muted); font-weight: 800; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.5px;}
.kpi-info h2 { font-size: 2.8rem; color: var(--sidebar-bg); font-weight: 800; line-height: 1;}
.kpi-icon { font-size: 3.5rem; color: #f1f5f9; }

/* ==========================================================================
   8. TABLAS DE DATOS PREMIUM
   ========================================================================== */
.card-table { 
    background: var(--card-bg); 
    border-radius: 20px; 
    border: 1px solid var(--border); 
    padding: 1.5rem; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.table-responsive { overflow-x: auto; width: 100%; border-radius: 12px;}

.enterprise-table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0; 
    text-align: left; 
    min-width: 800px; 
}

.enterprise-table th { 
    background: #f8fafc; 
    padding: 1.5rem 1.5rem; 
    border-bottom: 1px solid var(--border); 
    color: var(--text-muted); 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    font-weight: 800;
}

.enterprise-table th:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px;}
.enterprise-table th:last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px;}

.enterprise-table td { 
    padding: 1.2rem 1.5rem; 
    border-bottom: 1px solid #f1f5f9; 
    font-size: 0.95rem; 
    color: var(--text-dark); 
    vertical-align: middle; 
    transition: 0.2s ease;
}

.enterprise-table tr:hover td { background: #f8fafc; }
.enterprise-table tr:last-child td { border-bottom: none; }

.badge { 
    padding: 0.4rem 1rem; 
    border-radius: 20px; 
    font-size: 0.75rem; 
    font-weight: 800; 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    letter-spacing: 0.3px;
}
.badge.blue { background: #eff6ff; color: #1d4ed8; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.orange { background: #fff7ed; color: #c2410c; }
.badge.dark { background: #e2e8f0; color: #334155; }
.badge.red { background: #fef2f2; color: #b91c1c; }

/* Botones de Acción dentro de Tablas */
.action-btn { 
    background: white; 
    border: 1px solid var(--border); 
    color: var(--text-muted); 
    cursor: pointer; 
    width: 38px; 
    height: 38px; 
    border-radius: 10px; 
    font-size: 1.1rem; 
    transition: all 0.2s ease; 
    margin-left: 6px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
}
.action-btn:hover { 
    background: #f8fafc; 
    color: var(--primary); 
    border-color: var(--primary); 
    transform: translateY(-2px); 
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}
.action-btn.delete:hover { 
    color: var(--danger); 
    background: #fef2f2; 
    border-color: #fca5a5; 
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.15);
}
.action-btn.baja:hover { 
    color: var(--warning); 
    background: #fffbeb; 
    border-color: #fcd34d; 
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.15);
}

/* ==========================================================================
   9. AUDIT FEED (HISTÓRICO PREMIUM)
   ========================================================================== */
.audit-table td { padding: 1.5rem; }
.audit-date { display: flex; flex-direction: column; gap: 5px; }
.audit-date .day { font-weight: 800; color: var(--sidebar-bg); font-size: 0.95rem; }
.audit-date .time { font-size: 0.85rem; color: var(--text-muted); font-weight: 600;}

.audit-user { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-weight: 800; 
    font-size: 1.1rem; 
    color: var(--sidebar-bg); 
    margin-bottom: 6px; 
}

.audit-operator { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    font-weight: 600; 
}

.audit-reason { 
    background: #fffbeb; 
    border-left: 4px solid var(--warning); 
    padding: 12px 16px; 
    border-radius: 8px; 
    font-size: 0.9rem; 
    margin-top: 12px; 
    color: #b45309; 
    line-height: 1.5; 
    font-weight: 600; 
}
.audit-reason.red { 
    background: #fef2f2; 
    border-left-color: var(--danger); 
    color: #991b1b; 
}

/* ==========================================================================
   10. RESPONSIVIDAD MÓVIL (MOBILE FIRST)
   ========================================================================== */
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr !important; }
    .topbar { padding: 0 1rem; }
    .search-container { width: 100%; max-width: 200px; }
    
    .sidebar { 
        position: absolute; 
        height: 100%; 
        transform: translateX(-100%); 
        transition: 0.3s; 
        box-shadow: 4px 0 10px rgba(0,0,0,0.1); 
    }
    .sidebar:hover { transform: translateX(0); }
    
    .table-responsive table, .table-responsive thead, .table-responsive tbody, .table-responsive tr, .table-responsive td { display: block; width: 100%; }
    .table-responsive thead { display: none; }
    .table-responsive tr { margin-bottom: 1rem; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 1rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
    .table-responsive td { text-align: right; padding: 0.5rem 0; border-bottom: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; }
    .table-responsive td:last-child { border-bottom: none; justify-content: flex-end; }
}

#app-version { 
    text-align: left;
    margin-top: 2px;
    color: #94a3b8;
}

/* ==========================================================================
   11. COMPONENTES PREMIUM (SELECTOR INVENTARIO)
   ========================================================================== */
.custom-dropdown { 
    margin-top: 8px; 
    border-radius: 12px !important; 
    border: 1px solid #e2e8f0 !important;
}

.dropdown-item { 
    padding: 12px 15px; 
    cursor: pointer; 
    border-bottom: 1px solid #f1f5f9; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    transition: 0.2s ease; 
}

.dropdown-item:hover { 
    background: #eff6ff; 
    padding-left: 20px; /* Efecto deslizamiento Apple */
}

.selected-chip { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    background: #f8fafc; 
    border: 1px solid var(--primary); 
    padding: 12px 15px; 
    border-radius: 12px; 
    margin-bottom: 10px; 
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); 
}

/* ==========================================================================
   12. PULIDO OPERATIVO GLOBAL + ATS + VISTA 360
   ========================================================================== */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title-block {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.section-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: var(--primary);
    flex-shrink: 0;
    font-size: 1.25rem;
}

.section-kicker {
    margin: 0 0 4px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.toolbar-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 1.2rem;
}

.field-shell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field-shell:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.field-shell i {
    color: var(--primary);
    font-size: 1rem;
}

.field-shell span {
    display: block;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.field-shell input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    font-weight: 650;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.metric-tile {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    min-height: 92px;
}

.metric-tile span {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 800;
}

.metric-tile strong {
    display: block;
    color: var(--sidebar-bg);
    font-size: 2rem;
    line-height: 1;
    margin-top: 0.55rem;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    display: block;
    color: #cbd5e1;
    font-size: 2rem;
    margin-bottom: 0.8rem;
}

.ats-row-open td {
    background: #ffffff;
}

.ats-row-closed td {
    background: #f8fafc;
    color: #64748b;
}

.ats-title {
    color: var(--sidebar-bg);
    font-size: 1rem;
    font-weight: 800;
}

.ats-notes {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile360-card {
    max-width: 1040px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.profile360-body {
    background: var(--bg-main);
    padding: 1.5rem;
    overflow: auto;
}

.profile360-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.profile360-summary {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.4rem;
}

.profile360-name {
    margin: 0;
    color: var(--sidebar-bg);
    font-size: 1.65rem;
    letter-spacing: -0.02em;
}

.profile360-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.profile360-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.profile360-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
}

.profile360-section h3 {
    margin: 0 0 0.9rem;
    color: var(--sidebar-bg);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kv-list {
    display: grid;
    gap: 0.65rem;
}

.kv-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

.kv-list span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.kv-list strong {
    color: var(--text-dark);
    text-align: right;
    font-size: 0.9rem;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.profile360-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.profile360-doc-btn {
    border: 0;
    cursor: pointer;
    font: inherit;
}

@media (max-width: 900px) {
    .section-head,
    .profile360-hero {
        grid-template-columns: 1fr;
        display: grid;
    }

    .profile360-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   13. SISTEMA VISUAL UNIFICADO - SHADCN STYLE SIN BUILD STEP
   ========================================================================== */
body {
    background: #f6f8fb;
}

.views-container {
    padding: 2rem;
    background: #f6f8fb;
}

.tab-content.active {
    width: 100%;
    max-width: 1640px;
    margin: 0 auto;
}

.page-header {
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header > div:first-child {
    min-width: 0;
}

.page-title {
    font-size: 1.55rem;
    line-height: 1.15;
    letter-spacing: 0;
}

.page-header .text-muted {
    display: block;
    margin-top: 0.25rem;
    color: #667085;
    font-size: 0.88rem;
    line-height: 1.45;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    min-height: 40px;
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    gap: 0.5rem;
    box-shadow: none;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: translateY(-1px);
}

.filter-select,
.input-group input,
.input-group select,
.input-group textarea {
    min-height: 40px;
    border-radius: var(--radius-md);
    background: #fbfdff;
}

.multi-check {
    position: relative;
}

.multi-check-trigger {
    width: 100%;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fbfdff;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 650;
    cursor: pointer;
}

.multi-check-trigger:hover,
.multi-check-trigger:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.multi-check-menu {
    position: absolute;
    z-index: 80;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.55rem;
    border: 1px solid #dbe3ee;
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.multi-check-group {
    padding: 0.55rem 0.55rem 0.35rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.multi-check-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.62rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
}

.multi-check-option:hover {
    background: #f1f5f9;
}

.multi-check-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}

.kpi-grid {
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.kpi-card {
    min-height: 112px;
    border-radius: var(--radius-lg);
    border-color: #dbe3ee;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.kpi-clickable {
    cursor: pointer;
}

.kpi-clickable:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 14px 32px rgba(15, 23, 42, 0.08);
}

.dashboard-personnel-card {
    max-width: 1100px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.dashboard-personnel-body {
    padding: 1.5rem;
    background: var(--bg-main);
    overflow: auto;
}


.kpi-info h3 {
    font-size: 0.72rem;
    color: #5b6b82;
    letter-spacing: 0.05em;
    margin-bottom: 0.65rem;
}

.kpi-info h2 {
    font-size: 2.15rem;
    letter-spacing: -0.02em;
}

.kpi-icon {
    font-size: 2.4rem;
    opacity: 0.18;
}

.card-table {
    border-radius: var(--radius-lg);
    border-color: #dbe3ee;
    box-shadow: var(--shadow-soft);
}

.table-responsive {
    border-radius: var(--radius-md);
}

.enterprise-table {
    border-spacing: 0;
}

.enterprise-table th {
    background: #f3f6fa;
    padding: 0.95rem 1.25rem;
    color: #5b6b82;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.enterprise-table td {
    padding: 1rem 1.25rem;
}

.enterprise-table tr:hover td {
    background: #f8fafc;
}

.badge {
    border-radius: 999px;
    padding: 0.32rem 0.72rem;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
}

.search-container {
    height: 44px;
    border-radius: 999px;
    box-shadow: none;
    border: 1px solid #dbe3ee;
}

.topbar {
    height: 72px;
    border-bottom-color: #dbe3ee;
}

.sidebar {
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.06);
}

.tab-btn {
    border-radius: var(--radius-md);
}

.ats-workspace .page-header {
    display: flex;
    align-items: center;
}

#ofertas.tab-content {
    flex: 1;
    overflow-y: auto;
    background: #f6f8fb;
    padding: 2rem;
    min-height: calc(100vh - 72px);
    padding-bottom: 4rem;
}

#ofertas.tab-content > * {
    width: 100%;
    max-width: 1640px;
    margin-left: auto;
    margin-right: auto;
}

.ats-workspace .kpi-grid {
    grid-template-columns: repeat(3, minmax(190px, 1fr)) !important;
}

.ats-workspace .card-table {
    padding: 1.25rem;
    overflow: visible;
}

.ats-workspace .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

.ats-workspace .enterprise-table td {
    height: auto;
    min-height: 72px;
}

.ats-workspace .ats-filters {
    display: grid;
    grid-template-columns: minmax(170px, 0.8fr) minmax(170px, 0.8fr) minmax(260px, 1.4fr);
    gap: 0.9rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
}

.ats-workspace .ats-title {
    font-size: 0.98rem;
    letter-spacing: 0;
}

.ats-workspace .ats-notes {
    max-width: 520px;
}

.ats-workspace .ats-date-line {
    color: var(--text-dark);
    font-size: 0.82rem;
    line-height: 1.55;
    white-space: nowrap;
}

.ats-workspace .ats-date-line b {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ats-workspace .ats-days-detail {
    font-size: 0.76rem;
    margin-top: 0.35rem;
}

.ats-workspace .ats-row-closed td {
    background: #fbfcfe;
}

.ats-workspace .btn-primary,
.ats-workspace .btn-secondary {
    min-height: 36px;
    padding: 0.5rem 0.85rem !important;
}

@media (max-width: 1100px) {
    .ats-workspace .ats-filters {
        grid-template-columns: 1fr;
    }

    .ats-workspace .kpi-grid {
        grid-template-columns: 1fr !important;
    }
}


/* ==========================================================================
   12. CONSISTENCIA VISUAL FASE 2
   ========================================================================== */
button, input, select, textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(59, 130, 246, 0.85) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.form-section,
.messenger-doc-card,
.modal-card,
.login-card,
.dashboard-card,
.stats-card,
.panel-card,
.content-card {
    box-shadow: var(--shadow-soft);
}

.table-container,
.dashboard-table,
.panel-card,
.form-section,
.messenger-doc-card {
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.action-btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: translateY(-1px);
}

#lista-alertas li {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#lista-alertas li:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.page-title,
.modal-header h2,
.form-section-title {
    letter-spacing: -0.02em;
}


/* ======================================================================
   Centro RRHH Operativo
   ====================================================================== */
.rrhh-header { align-items: flex-start; gap: 1rem; }
.rrhh-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.rrhh-kpi-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 0.35rem;
    border-left: 4px solid var(--primary);
}
.rrhh-kpi-card span,
.action-summary-card span {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.rrhh-kpi-card strong { font-size: 2.25rem; color: var(--sidebar-bg); line-height: 1; }
.rrhh-kpi-card small { color: var(--text-muted); font-weight: 600; }
.rrhh-kpi-card.vacation { border-left-color: #0d9488; }
.rrhh-kpi-card.medical { border-left-color: var(--warning); }
.rrhh-kpi-card.exit { border-left-color: var(--inactivo); }
.rrhh-kpi-card.risk { border-left-color: var(--danger); }
.rrhh-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.rrhh-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: var(--shadow-soft);
    min-height: 360px;
}
.rrhh-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.rrhh-panel-head.compact { margin-bottom: 1.2rem; }
.rrhh-panel-head h2 { margin: 0; color: var(--sidebar-bg); font-size: 1.1rem; font-weight: 800; }
.rrhh-panel-head p { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.25rem; line-height: 1.4; }
.rrhh-panel-head > i {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: var(--primary);
    border: 1px solid var(--border);
}
.rrhh-panel-vacation .rrhh-panel-head > i { color: #0d9488; background: #f0fdfa; }
.rrhh-panel-medical .rrhh-panel-head > i { color: #b45309; background: #fffbeb; }
.rrhh-panel-exit .rrhh-panel-head > i { color: #334155; background: #f1f5f9; }
.rrhh-list-state { display: grid; gap: 0.75rem; }
.rrhh-person-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    background: #fbfdff;
}
.rrhh-person-main b { display: block; color: var(--sidebar-bg); font-size: 0.95rem; }
.rrhh-person-main span,
.rrhh-person-main small,
.rrhh-person-meta small { display: block; color: var(--text-muted); font-size: 0.76rem; margin-top: 0.22rem; }
.rrhh-person-main small { line-height: 1.35; }
.rrhh-person-meta { text-align: right; min-width: 128px; }
.rrhh-row-actions { white-space: nowrap; }
.rrhh-empty {
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.55rem;
    padding: 2rem;
    color: var(--text-muted);
    text-align: center;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
}
.rrhh-empty.compact { min-height: 120px; }
.rrhh-empty i { font-size: 1.8rem; color: #94a3b8; }
.rrhh-empty b { color: var(--sidebar-bg); }
.rrhh-audit-panel { margin-bottom: 2rem; }
.rrhh-audit-feed { display: grid; gap: 0.65rem; }
.rrhh-audit-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    background: #fff;
}
.rrhh-audit-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    background: #eff6ff;
}
.rrhh-audit-row b { display: block; color: var(--sidebar-bg); font-size: 0.92rem; }
.rrhh-audit-row small { display: block; color: var(--text-muted); margin-top: 0.2rem; }
.rrhh-audit-row time { color: var(--text-muted); font-size: 0.8rem; font-weight: 700; }
.action-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.2rem;
}
.action-summary-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
}
.action-summary-card b { display: block; margin: 0.25rem 0; color: var(--sidebar-bg); font-size: 0.95rem; }
.action-summary-card small { color: var(--text-muted); font-size: 0.72rem; line-height: 1.35; }
.dl-chip-editor {
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    padding: 0.45rem 0.6rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    cursor: text;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.dl-chip-editor:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.dl-chip-list { display: contents; }
.dl-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.78rem;
    font-weight: 800;
}
.dl-chip button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.dl-chip-input {
    flex: 1 1 150px;
    min-width: 150px;
    border: 0 !important;
    background: transparent !important;
    outline: none !important;
    padding: 0.45rem 0.3rem !important;
    height: auto !important;
}
.field-help {
    display: block;
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}
.pending-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}
.pending-kpi-card {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}
.pending-kpi-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.pending-kpi-card strong {
    display: block;
    color: var(--sidebar-bg);
    font-size: 2rem;
    line-height: 1;
    margin: 0.45rem 0 0.35rem;
}
.pending-kpi-card small {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}
.pending-kpi-card.danger { border-left-color: var(--danger); }
.pending-kpi-card.material { border-left-color: #0d9488; }
.pending-kpi-card.access { border-left-color: #7c3aed; }
.pending-control-bar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 190px 180px auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
}
.pending-search-box {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}
.pending-search-box i { color: var(--text-muted); }
.pending-search-box input,
.pending-control-bar select {
    width: 100%;
    min-height: 42px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--sidebar-bg);
    font-weight: 700;
    font-size: 0.85rem;
}
.pending-control-bar select {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 0.8rem;
    background: #f8fafc;
}
.pending-count-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}
.pending-exit-table .enterprise-table td { vertical-align: top; }
.pending-row.pending-critical td { background: #fffafa; }
.pending-employee-cell {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
    min-width: 230px;
}
.pending-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d4ed8;
    background: #eff6ff;
    font-weight: 900;
}
.pending-employee-cell b,
.pending-date-cell b {
    display: block;
    color: var(--sidebar-bg);
    font-size: 0.92rem;
}
.pending-employee-cell small,
.pending-date-cell small,
.pending-risk-cell small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.76rem;
}
.pending-tag {
    display: inline-flex;
    margin-top: 0.45rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 800;
}
.pending-check-group {
    display: grid;
    gap: 0.45rem;
    min-width: 260px;
}
.pending-check-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 30px;
    gap: 0.55rem;
    align-items: center;
    padding: 0.55rem;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    background: #fff;
}
.pending-check-item b {
    display: block;
    color: var(--sidebar-bg);
    font-size: 0.82rem;
    line-height: 1.25;
}
.pending-check-item small {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 0.15rem;
}
.pending-check-icon,
.pending-mini-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pending-check-icon.material { color: #0f766e; background: #ccfbf1; }
.pending-check-icon.access { color: #7c3aed; background: #f3e8ff; }
.pending-mini-btn {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.pending-mini-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}
.pending-check-empty {
    padding: 0.7rem;
    border-radius: 12px;
    background: #f0fdf4;
    color: #047857;
    font-size: 0.78rem;
    font-weight: 800;
}
.pending-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 900;
}
.pending-risk-badge.critical { background: #fef2f2; color: #b91c1c; }
.pending-risk-badge.warning { background: #fff7ed; color: #c2410c; }
.pending-risk-badge.recent { background: #eff6ff; color: #1d4ed8; }
.pending-risk-badge.unknown { background: #f1f5f9; color: #475569; }
.pending-actions-cell {
    white-space: nowrap;
    text-align: right;
}
.pending-empty-state {
    padding: 4rem !important;
    color: #059669;
    background: #ecfdf5;
    text-align: center;
}
.pending-empty-state i {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 0.9rem;
    opacity: 0.8;
}
.pending-empty-state b,
.pending-empty-state span { display: block; }
.pending-empty-state span {
    color: #047857;
    margin-top: 0.4rem;
}
@media (max-width: 1200px) {
    .rrhh-board { grid-template-columns: 1fr; }
    .rrhh-panel { min-height: auto; }
    .action-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pending-control-bar { grid-template-columns: 1fr 1fr; }
    .pending-count-label { text-align: left; }
}
@media (max-width: 760px) {
    .rrhh-person-row { grid-template-columns: 1fr; }
    .rrhh-person-meta { text-align: left; }
    .action-summary-grid { grid-template-columns: 1fr; }
    .pending-kpi-grid,
    .pending-control-bar { grid-template-columns: 1fr; }
    .pending-check-group { min-width: 0; }
}
