/* --- Variáveis Globais e Estilos Base --- */
:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e6f2ff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #212529;
    --muted: #6c757d;
    --light: #f8f9fa;
    --white: #ffffff;
    --line: #dee2e6;
    --bg: #f8f9fa;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    font-size: 15px;
}

body.login-active {
    background-color: var(--light);
}



/* ESTAS SON LAS NUEVAS REGLAS CORREGIDAS */
:root {
    /* ... tus otras variables ... */
    --sidebar-width: 260px; /* <--- Variable para el ancho del menú */
}

.app-layout {
  display: grid;
  /* Usa la variable para definir la rejilla */
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.3s ease; /* Anima el cambio de la rejilla */
}

.sidebar {
  background-color: #111827;
  /* ... otros estilos ... */
  width: var(--sidebar-width); /* El ancho ahora es dinámico */
  transition: width 0.3s ease; /* Anima el cambio de ancho */
}

.sidebar h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: #9ca3af;
  transition: var(--transition);
  font-weight: 500;
}

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

.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-link span {
    flex-grow: 1;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--light);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

#currentUserDisplay {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}


.user-info i {
    font-size: 1.5rem;
}

.logout-btn {
    color: var(--muted);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger);
    transform: scale(1.1);
}


.main-content {
  grid-column: 2 / 3;
  padding: 2rem;
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.5s ease-out; }

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

/* --- Componentes Reutilizáveis --- */
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.page-header h2 { display: flex; align-items: center; gap: 1rem; font-size: 2rem; margin: 0; }
.toolbar { display: flex; gap: 1rem; flex-wrap: wrap; }
/* --- Botones Mejorados --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px; /* Radio más sutil y moderno */
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease-in-out; /* Transición más rápida */
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 15px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Sombra sutil */
}

.btn:hover {
    transform: translateY(-2px); /* Efecto de elevación */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Sombra más pronunciada */
}

.btn:active {
    transform: translateY(0px); /* Botón presionado */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn:disabled { 
    opacity: 0.6; 
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.btn.secondary { 
    background-color: var(--primary-light); 
    color: var(--primary); 
}
.btn.secondary:hover {
    background-color: #d1e6ff;
}

/* --- Estilo Mejorado para Botones 'Ghost' (ahora más visibles) --- */
.btn.ghost { 
    background-color: var(--white); /* Fondo sólido blanco */
    color: var(--muted);           /* Texto gris oscuro para buen contraste */
    border-color: var(--line);     /* Borde gris claro definido */
    box-shadow: var(--shadow);     /* Sombra sutil para darle profundidad */
}

.btn.ghost:hover {
    background-color: var(--light); /* Fondo ligeramente más oscuro al pasar el mouse */
    border-color: #ced4da;          /* Borde más oscuro para resaltar */
    color: var(--dark);             /* Texto negro para máxima legibilidad */
}

.btn.danger { 
    background-color: var(--danger); 
    color: var(--white); 
    border-color: var(--danger); 
}
.btn.danger:hover {
    background-color: #c82333;
    border-color: #c82333;
}

.btn.success { 
    background-color: var(--success); 
    color: var(--white); 
    border-color: var(--success); 
}
.btn.success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-sm { 
    padding: 6px 16px; 
    font-size: 14px; 
}

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 2rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 14px; }
input, select, textarea { width: 100%; padding: 10px 15px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
.input-group { position: relative; margin-bottom: 1.25rem; }
.input-group i { position: absolute; left: 15px; top: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line); }
thead { background-color: var(--light); }
th { font-weight: 600; font-size: 14px; }
.text-right { text-align: right; }
.table-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }
.table-container { overflow-x: auto; }
.badge { padding: 4px 10px; border-radius: 50px; font-size: 12px; font-weight: 600; }
.badge-success { background-color: #e9f7ef; color: #28a745; }
.badge-danger { background-color: #fceeee; color: #dc3545; }
.grid { display: grid; gap: 1.5rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.hr { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.items-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
}
.item-card {
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--light);
  margin-bottom: 0.5rem;
}
.item-card:hover {
  background-color: var(--primary-light);
}

/* --- Estilos de Páginas Específicas --- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; }
.stat-card .stat-label { color: var(--muted); font-size: 0.9rem; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); gap: 1.5rem; }

/* --- Modais --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  width: 90%;
  max-width: 650px;
  box-shadow: 0 15px 50px rgba(0,0,0,0.2);
  animation: fadeIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--muted);
}
.modal-body {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 1rem; /* Espaço para a barra de rolagem */
  margin-right: -1rem;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}
#modalDetallesNomina {
  z-index: 1003;
}

#modalXmlViewer {
    z-index: 1001; 
}

/* --- Estilos para Notificaciones (Toasts) --- */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}


/* --- Estilos para Notificaciones (Toasts) --- */
.notification-container{
  position:fixed; top:20px; right:20px; z-index:9999; display:flex; flex-direction:column; gap:10px;
}

/* Base: que sea legible aun sin variante */
.toast{
  display:flex; align-items:center; gap:1rem;
  padding:1rem 1.5rem; border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,.15);
  background:#111827;              /* fondo oscuro por defecto */
  color:#fff;                       /* texto claro por defecto */
  min-width:320px; opacity:0; transform:translateX(100%); animation:slideIn .5s forwards;
}
.toast-icon{ font-size:1.5rem; color:inherit; }
.toast-message{ flex:1; font-weight:600; }
.toast-close-btn{
  background:none; border:none; color:inherit; opacity:.8; font-size:1.25rem; cursor:pointer; transition:opacity .3s;
}
.toast-close-btn:hover{ opacity:1; }

/* Variantes: ponen fondo y (si hace falta) color */
.toast.success{ background:#28a745; color:#fff; }   /* éxito */
.toast.error{   background:#dc3545; color:#fff; }   /* error */
.toast.info{    background:#17a2b8; color:#fff; }   /* info  */
.toast.warning{ background:#ffc107; color:#000; }   /* opcional: warning */

/* Animaciones */
@keyframes slideIn{ to{ opacity:1; transform:translateX(0) } }
.toast.fade-out{ animation:fadeOut .5s forwards; }
@keyframes fadeOut{ to{ opacity:0; transform:scale(.9) } }


.toast-icon {
    font-size: 1.5rem;
    color: var(--white); /* Añadir también por seguridad, aunque hereda de .toast */
}

.toast-message {
    flex-grow: 1;
    font-weight: 500;
}

.toast-close-btn {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    font-size: 1.25rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
    color: var(--white); /* Añadir también por seguridad, aunque hereda de .toast */
}

.toast-close-btn:hover {
    opacity: 1;
}

.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

.toast.info {
    background-color: #17a2b8; /* Este es el color azul de información que ya tienes definido */
}

/* --- Estilos para la tabla de Pre-Liquidación Mejorada --- */
.summary-cell {
    line-height: 1.3;
}
.summary-cell strong {
    font-size: 1.1em;
    display: block;
}
.summary-cell small {
    color: var(--muted);
    font-size: 0.8em;
}

/* --- Estilos para Botones de Ícono en Tablas --- */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%; /* Hace el botón circular */
    border: 1px solid var(--line);
    background-color: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
    transform: scale(1.1);
}

/* --- Estilos para el Modal de Confirmación --- */
.confirm-icon {
    font-size: 3rem;
    color: var(--warning);
    margin-bottom: 1rem;
}

/* --- Estilos para Navegación por Pestañas --- */
.tabs-nav {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
}

.tabs-nav a {
    position: relative;
    padding: 0.75rem 0.25rem;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    transition: color 0.3s ease;
}

.tabs-nav a:hover {
    color: var(--dark);
}

.tabs-nav a.active {
    color: var(--primary);
    font-weight: 600;
}

/* El subrayado azul de la pestaña activa */
.tabs-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* --- Estilos para las Vistas de Pestañas de Reportes --- */
.toggle-view {
    display: none; /* Oculta todas las vistas por defecto */
}

.toggle-view.active {
    display: block; /* Muestra solo la que está activa */
}

/* --- Estilos para Asistente por Pasos (Wizard) --- */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}
.wizard-nav .step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-weight: 500;
}
.wizard-nav .step strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--light);
    border: 1px solid var(--line);
    color: var(--muted);
}
.wizard-nav .step.active {
    color: var(--primary);
}
.wizard-nav .step.active strong {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.wizard-nav .step-line {
    flex-grow: 1;
    height: 2px;
    background-color: var(--line);
    margin: 0 1rem;
}
.wizard-step {
    display: none;
}
.wizard-step.active {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

/* --- Estilos para Pestañas de Nómina --- */
#nomina-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
}
#nomina-tabs a {
    position: relative;
    padding: 0.75rem 0.25rem;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    transition: color 0.3s ease;
    cursor: not-allowed; /* No se puede hacer clic directamente */
}
#nomina-tabs a.active {
    color: var(--primary);
    font-weight: 600;
}
#nomina-tabs a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}
#nomina-tabs a.completed {
    cursor: pointer; /* Se puede volver a una pestaña completada */
    color: #28a745;
}

/* --- Estilo para filas de tabla interactivas --- */
.data-table tbody tr[data-id] {
    cursor: pointer;
}
.data-table tbody tr[data-id]:hover {
    background-color: var(--primary-light);
}

/* ====== Ajustes finos de botones (no rompe estructura) ====== */
/* 1) Variables de tamaño para controlarlo rápido */
:root {
  --btn-radius: 8px;          /* ya usas 8px; lo dejamos aquí centralizado */
  --btn-pad-y: 8px;           /* ↓ más compacto que los 10px actuales */
  --btn-pad-x: 18px;          /* ↓ más compacto que 24px */
  --btn-font: 14px;           /* ↓ de 15px a 14px */
  --btn-gap: 6px;             /* ↓ espacio entre icono y texto */
  --btn-shadow: 0 2px 6px rgba(0,0,0,0.08);
  --btn-shadow-hover: 0 6px 12px rgba(0,0,0,0.12);
  --ring: 0 0 0 3px rgba(0, 123, 255, .25); /* anillo de foco accesible */
}

/* 2) Compacta el botón base sin cambiar tus clases */
.btn {
  padding: var(--btn-pad-y) var(--btn-pad-x) !important;
  font-size: var(--btn-font) !important;
  border-radius: var(--btn-radius) !important;
  gap: var(--btn-gap) !important;
  box-shadow: 0 0 0 rgba(58, 43, 43, 0); /* base sin sombra */
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}

/* 3) Hover/active más sutil (tu CSS movía 2px; lo hago 1px) */
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--btn-shadow-hover);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--btn-shadow);
}

/* 4) Accesibilidad: foco claro con keyboard */
.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* 5) Estados disabled consistentes */
.btn:disabled {
  opacity: .6;
  transform: none;
  box-shadow: none !important;
  cursor: not-allowed;
}

/* 6) Variantes de tamaño reutilizables (manteniendo .btn-sm existente) */
.btn-xs { padding: 4px 10px !important; font-size: 12px !important; }
.btn-sm { padding: 6px 14px !important; font-size: 13px !important; } /* más pequeño que el que tienes */
.btn-md { padding: 8px 18px !important; font-size: 14px !important; }  /* nuevo tamaño medio */
.btn-lg { padding: 10px 22px !important; font-size: 15px !important; } /* por si los necesitas más grandes */

/* 7) Variantes visuales adicionales sin romper las tuyas */
.btn.ghost { 
  background: transparent !important;
  color: var(--dark) !important;
  border-color: transparent !important;
}
.btn.ghost:hover { 
  background: rgba(0,0,0,.04) !important; 
}

.btn.soft-primary {
  background: var(--primary-light) !important;
  color: var(--primary-dark) !important;
  border-color: transparent !important;
}
.btn.soft-primary:hover {
  background: #d9eaff !important; /* un pelín más oscuro que --primary-light */
}

/* 8) Botón solo icono (para acciones compactas) */
.btn-icon {
  width: 36px; height: 36px;
  padding: 0 !important;
  display: inline-grid; place-items: center;
}
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn-icon.btn-lg { width: 42px; height: 42px; }

/* 9) Grupo de botones (espaciado y bordes coherentes) */
.btn-group { display: inline-flex; gap: 8px; }
.btn-group .btn { border-radius: var(--btn-radius); }

/* 10) Respeto preferencia de usuario: reducir animaciones si procede */
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover { transform: none; }
}

/* ===== Mejoras de validación y tooltips ===== */
.required-label::after {
  content: " *";
  color: #dc2626; /* rojo */
  font-weight: 700;
  margin-left: 2px;
}

.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220,38,38,.15);
}

.error-hint {
  font-size: 12px;
  color: #b91c1c;
  margin-top: 4px;
}

[data-tooltip] {
  position: relative;
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 50;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  min-width: 180px;
  max-width: 320px;
  padding: 8px 10px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  line-height: 1.25;
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(0,0,0,.18);
  white-space: normal;
}
[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 4px);
  border: 6px solid transparent;
  border-top-color: #111827;
}

/* Botones reportes (si ya tienes estilos .btn, esto solo compacta) */
.btn.report {
  padding: 6px 12px !important;
  font-size: 13px !important;
}

/* --- Estilos para Botón con Loader --- */
.btn.loading {
    position: relative;
    color: transparent !important; /* Oculta el texto original */
    pointer-events: none; /* Deshabilita clics mientras carga */
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Estilos para Controles de Paginación --- */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--line);
}
.pagination-info {
    font-size: 0.9rem;
    color: var(--muted);
}
/* --- Ajuste de Prioridad para confirmacion Liquidacion --- */
#modalConfirmacion {
  z-index: 2000; /* Un valor alto para asegurar que siempre esté encima de otros modales */
}

/* --- Estilos para Menú Colapsable --- */

/* Contenedor del logo y el botón */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-wrapper {
    display: inline-block;
    transition: width 0.3s ease;
}

.logo-full {
    width: 150px;
    height: auto;
    display: block;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.logo-icon {
    width: 32px;
    height: 32px;
    display: none; /* Oculto por defecto */
    transition: opacity 0.3s ease;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- ESTADO COLAPSADO --- */
body.sidebar-collapsed {
    --sidebar-width: 80px; /* Simplemente cambiamos la variable */
}

body.sidebar-collapsed .sidebar:hover {
    width: 260px; /* Ancho del menú expandido al pasar el mouse */
    z-index: 100; /* <-- AÑADE ESTA LÍNEA */
}

body.sidebar-collapsed .sidebar .nav-link span,
body.sidebar-collapsed .sidebar .sidebar-footer .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
}

body.sidebar-collapsed .sidebar:hover .nav-link span,
body.sidebar-collapsed .sidebar:hover .sidebar-footer .user-info {
    opacity: 1;
    width: auto;
    transition-delay: 0.15s;
}

/* ELIMINAMOS los margin-left y width del .main-content porque ya no son necesarios */

/* Adaptación del logo */
body.sidebar-collapsed .sidebar .logo-full {
    opacity: 0;
    width: 0;
}

body.sidebar-collapsed .sidebar .logo-icon {
    display: block;
    opacity: 1;
}

body.sidebar-collapsed .sidebar:hover .logo-full {
    opacity: 1;
    width: 150px;
    transition-delay: 0.15s;
}

body.sidebar-collapsed .sidebar:hover .logo-icon {
    opacity: 0;
    width: 0;
}

/* Rotación del botón */
body.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* --- Ajustes para Iconos en Menú Colapsado --- */

/* --- Ajustes para Iconos en Menú Colapsado --- */

body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center; /* <-- ESTA ES LA LÍNEA CLAVE */
}

body.sidebar-collapsed .sidebar .nav-link i {
    font-size: 1.5rem;
    margin: 0; /* Asegura que no haya márgenes extra */
}

/* --- Refinamiento de Interfaz para Nómina --- */

/* Sombra y borde sutil para el menú */
.sidebar {
    border-right: 1px solid var(--line);
}

/* Tarjetas más limpias */
.card {
    border: none;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Inputs y Selects más modernos */
input, select, textarea {
    background-color: var(--white);
    border: 1px solid var(--line);
    transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Efecto de "levitación" para los botones del dashboard */
.dashboard-grid .stat-card {
    transition: var(--transition);
}
.dashboard-grid .stat-card:hover {
    transform: scale(1.03);
    z-index: 10;
}

/* Mejor contraste en el menú activo */
.nav-link.active {
    background-color: var(--primary);
    color: var(--white);
}

/* Animación sutil para el ícono del menú colapsado */
body.sidebar-collapsed .sidebar .nav-link i {
    transition: transform 0.2s ease;
}
body.sidebar-collapsed .sidebar .nav-link:hover i {
    transform: scale(1.1);
}

/* --- Estilos para el enlace de "Olvidé mi contraseña" --- */
.forgot-password-link {
    display: block;
    text-align: right;
    margin-top: -10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
}
.forgot-password-link:hover {
    text-decoration: underline;
}

/* --- Mejoras de Diseño para Modales de Confirmación --- */
/* Estilo general para todos los modales de confirmación */
.modal-overlay[id*="Confirm"],
.modal-overlay[id*="Recontratacion"] {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.modal-box.card {
    border: none;
    box-shadow: var(--shadow-lg);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    animation: popIn 0.5s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Estilo específico para el modal de recontratación */
#modalRecontratacion .modal-footer {
    border-top: none;
    padding-top: 0;
}

#modalRecontratacion .btn {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    width: 100%;
    transition: var(--transition);
}

#modalRecontratacion .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* --- Estilos para el Dropdown de Perfil --- */
.header-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-dropdown {
    position: relative;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    background-color: var(--white);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: var(--transition);
}

.profile-info:hover,
.profile-dropdown:focus-within .profile-info {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.profile-info i.fa-user-circle {
    font-size: 1.5rem;
    color: var(--muted);
}

.profile-info span {
    font-weight: 600;
    color: var(--dark);
}

.profile-info i.fa-chevron-down {
    font-size: 0.75rem;
    color: var(--muted);
    transition: var(--transition);
}

.profile-dropdown:focus-within .profile-info i.fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 100;
}

.profile-dropdown:focus-within .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
}

.dropdown-menu a:hover {
    background-color: var(--light);
}

.dropdown-menu a i {
    width: 20px;
    text-align: center;
    color: var(--muted);
}

/* Make logout red */
.dropdown-menu a#logout-button:hover {
    background-color: #fee2e2;
    color: #991b1b;
}
.dropdown-menu a#logout-button:hover i {
    color: #991b1b;
}

/* --- Estilo para Recomendación de Tamaño de Imagen --- */
.image-upload-recommendation {
    font-size: 0.8rem;
    color: var(--muted);
    background-color: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    margin-top: 0.75rem;
    display: inline-block;
}

/* --- Estilos para Botones con Expansión al Pasar el Mouse --- */

.btn-icon-expand {
    width: 44px; /* Ancho inicial solo para el icono y el padding */
    padding-left: 12px;
    padding-right: 12px;
    overflow: hidden;
    white-space: nowrap;
    justify-content: flex-start; /* Alinear contenido a la izquierda */
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-expand .btn-text {
    opacity: 0;
    width: 0;
    transition: opacity 0.2s ease, width 0.2s ease;
    margin-left: 8px; /* Espacio entre el icono y el texto */
}

/* Efecto al pasar el mouse */
.btn-icon-expand:hover {
    width: 210px; /* Ancho expandido para mostrar el texto completo */
}

.btn-icon-expand:hover .btn-text {
    opacity: 1;
    width: auto; /* Permite que el texto ocupe su espacio natural */
    transition-delay: 0.1s; /* Pequeño retraso para que el texto aparezca después de la expansión */
}

/* --- Estilos para Validación de Inputs --- */
.input-error-mensaje {
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 8px;
}

.input-error {
    outline: 2px solid var(--danger) !important;
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
}

/* === Sticky header para tablas con scroll === */
.table-container { position: relative; overflow: auto; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

/* Sticky header */
.table-container { position: relative; overflow: auto; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

/* Alinear números a la derecha en tablas */
.data-table td.text-right,
.data-table th.text-right { text-align: right; }


/* === Badges de acciones (Auditoría) === */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1;
  background: var(--badge-bg, #eaf2ff);
  color: var(--badge-fg, #0b57d0);
  border: 1px solid transparent;
}

.badge-success {  /* generada / creada */
  --badge-bg: #e9f8ef;
  --badge-fg: #1b7f42;
  border-color: #bfe8cf;
}

.badge-danger {   /* eliminada / borrada */
  --badge-bg: #fdecec;
  --badge-fg: #b42318;
  border-color: #f5b5b3;
}

.badge-info {     /* actualizada */
  --badge-bg: #eaf2ff;
  --badge-fg: #0b57d0;
  border-color: #bad1ff;
}

.badge-warning {  /* error / fallida / rechazada */
  --badge-bg: #fff7e6;
  --badge-fg: #b54708;
  border-color: #ffe0a3;
}

.badge-neutral {  /* otras */
  --badge-bg: #f2f4f7;
  --badge-fg: #344054;
  border-color: #e4e7ec;
}

/* ===== Footer moderno ===== */
.app-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -6px 18px rgba(0,0,0,0.06);
  font-size: .95rem;
}

.app-footer .made-by a {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color .2s ease, border-color .2s ease, opacity .2s ease;
  opacity: .9;
}

.app-footer .made-by a:hover {
  color: #0b57d0;          /* azul bonito al hover */
  border-color: #0b57d0;
  opacity: 1;
}

.app-footer .version {
  font-variant-numeric: tabular-nums;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 600;
}

/* Modo oscuro (si lo usas por clase o media query) */
@media (prefers-color-scheme: dark) {
  .app-footer {
    background: rgba(17,24,39,0.6);
    border-top-color: rgba(255,255,255,0.08);
    box-shadow: 0 -6px 18px rgba(0,0,0,0.4);
  }
  .app-footer .version {
    color: #e5e7eb;
    background: #0b1220;
    border-color: #1f2937;
  }
  .app-footer .made-by a:hover {
    color: #60a5fa;
    border-color: #60a5fa;
  }
}

/* Opcional: hacerlo "sticky" al fondo con layouts de una sola columna */
html, body { height: 100%; }
body.app-has-sticky-footer {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
body.app-has-sticky-footer main,
body.app-has-sticky-footer .main {
  flex: 1 0 auto;   /* el contenido ocupa el alto y empuja el footer al fondo */
}

/* --- Estilo para la Barra de Perfil Fija en la parte superior --- */

/* Nota: La clase .page-header (que ya tiene flex) se usa como base en el HTML */
#global-header-bar {
    /* Forzar alineación de los elementos a la derecha */
    justify-content: flex-end; 
    
    /* El page-header normal tiene margin-bottom: 2rem. Lo reducimos para no separar 
       la barra de usuario de la primera página. */
    margin-bottom: 0; 
    
    /* Añadir algo de relleno para darle espacio al dropdown */
    padding-bottom: 1rem;
    padding-top: 0.5rem; 

    /* Si quieres que se vea FÍJO y no se mueva con el scroll de la página: */
    position: sticky;
    top: 0;
    z-index: 50; /* Asegura que esté por encima de otros elementos */
    background: var(--light); /* Fondo blanco para que no flote sobre el contenido */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); /* Sombra sutil para darle profundidad */
}

/* Ajuste necesario para que el contenido de las páginas empiece por debajo de la barra */
.main-content {
    /* El padding top actual (2rem) debe ser suficiente, pero si el contenido queda oculto,
       podrías necesitar agregar un margen extra a la primera sección (dashboard). */
}

/* --- Layout da Tela de Login COMPACTO --- */
#login-wall {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: var(--light);
    display: flex; /* Usamos flexbox para centrar */
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
}

.login-form-side {
    padding: 2rem;
    display: contents; /* Desaparece el contenedor para que la tarjeta sea el elemento principal */
}

.compact-login-card {
    /* Estilos generales de la tarjeta */
    display: flex;
    max-width: 800px; /* Ancho máximo similar al de la imagen */
    width: 90%;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); /* Sombra más pronunciada */
    overflow: hidden;
}

.login-image-side {
    /* Lado izquierdo (Bienvenida) */
    flex: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--white);
    min-height: 450px; /* Asegura un alto mínimo para móviles */
}

/* Oscurecer un poco la imagen de fondo */
.login-image-side::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.side-content {
    z-index: 2;
    padding: 2rem;
    text-align: left;
}

.side-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.side-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}


.login-form-content {
    /* Lado derecho (Formulario) */
    width: 380px; /* Ancho fijo para el formulario (similar a la imagen) */
    flex-shrink: 0;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-box {
    width: 100%;
    text-align: center;
}

/* El login-logo-img no se usa en este diseño, pero lo ocultamos */
.login-logo-img {
    display: none;
}

.login-input {
    /* Ajuste para eliminar el padding extra del icono que ya no existe */
    padding-left: 15px; 
}

/* Media Query para móvil (oculta la imagen y centra la tarjeta) */
@media (max-width: 850px) {
    .compact-login-card {
        max-width: 380px;
    }
    .login-image-side {
        display: none; /* Oculta la imagen en pantallas pequeñas */
    }
    .login-form-content {
        width: 100%;
        padding: 2rem;
    }
}
/* FIN DE LOS ESTILOS DE LOGIN */