/* BASE */

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
}

/* LAYOUT DASHBOARD */

body.app-layout { background: #f5f6fa; }

.app-shell {
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 40;
  display: none;
}

/* SIDEBAR gris no muy oscuro + letras blancas */

.sidebar {
  background: #374151; /* gris medio-oscuro */
  border-right: 1px solid #111827;
  padding: 16px 12px;
  z-index: 45;

  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;

  transform: translateX(-100%);
  transition: transform 0.2s ease;
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.sidebar-logo img {
  width: 165px;
  height: 60px;
  object-fit: contain;
}

.sidebar-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d1d5db;
  margin: 18px 6px 6px;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  font-size: 0.92rem;
  color: #ffffff;
  background: transparent;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.sidebar-nav li a:hover {
  background: #4b5563;
  color: #F57C00;
  transform: translateX(4px);
}

.sidebar-footer {
  margin-top: 30px;
  font-size: 0.78rem;
  color: #9ca3af;
}

/* CONTENT */

.main-content { padding: 18px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.topbar-user {
  font-size: 0.9rem;
  color: #6b7280;
}

/* MOBILE HEADER */

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-header-title {
  font-size: 1rem;
  font-weight: 700;
}

.mobile-header-sub {
  font-size: 0.75rem;
  color: #6b7280;
}

.burger-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.burger-lines,
.burger-lines::before,
.burger-lines::after {
  background: #ffffff;
}

.burger-lines {
  width: 18px;
  height: 2px;
  position: relative;
}

.burger-lines::before,
.burger-lines::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  left: 0;
}

.burger-lines::before { top: -5px; }
.burger-lines::after  { top:  5px; }

body.sidebar-open .sidebar {
  transform: translateX(0);
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

/* CARDS, INPUTS, ALERTS */

.card {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  margin-bottom: 18px;
}

.form-group { margin-bottom: 12px; }

.form-label {
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: #6b7280;
}

.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #111827;
  background: #ffffff;
}

.form-input:focus {
  border-color: #2563eb;
  outline: none;
}

.auth-button {
  padding: 10px 16px;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-button:hover { background: #1e4fcf; }

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}

.alert-error {
  background: #fee2e2;
  color: #b91c1c;
}

/* KPI GRID */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.kpi-card {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.kpi-label {
  font-size: 0.75rem;
  color: #6b7280;
}

.kpi-value {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 4px;
}

.kpi-sub {
  font-size: 0.7rem;
  color: #9ca3af;
}

/* RESPONSIVE DASHBOARD */

@media (min-width: 768px) {
  .mobile-header { display: none; }
  .sidebar-logo { display: flex; }
  .sidebar { transform: none; }
  .main-content {
    margin-left: 260px;
    padding: 24px;
  }
}

@media (max-width: 767px) {
  .mobile-header { display: flex; }
  .main-content { padding: 16px; }
}

/* LOGIN */

body.login-page {
  background: radial-gradient(circle at top, #e0f2fe 0, #f5f6fa 45%, #e5e7eb 100%);
}

body.login-page .sidebar,
body.login-page .sidebar-overlay,
body.login-page .mobile-header {
  display: none !important;
}

body.login-page .main-content {
  margin-left: 0 !important;
  padding: 0 !important;
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  padding: 24px 22px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.login-logo {
  text-align: center;
  margin-bottom: 10px;
}

.login-logo img {
  max-width: 180px;
  height: auto;
}

.login-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.8rem;
  text-align: center;
  color: #6b7280;
  margin-bottom: 14px;
}

.login-footer-text {
  font-size: 0.78rem;
  text-align: center;
  color: #9ca3af;
  margin-top: 10px;
}

.login-card .form-group { margin-bottom: 12px; }

.login-card .auth-button {
  width: 100%;
  margin-top: 4px;
}


/*       cards     */
/* BANNER DASHBOARD */
.dashboard-banner {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 40%, #0f172a 100%);
  color: #ffffff;
}

.dashboard-banner-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dashboard-banner-text {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 10px;
}

.dashboard-banner-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  font-size: 0.75rem;
}

/* TEXTO BIENVENIDA */
.welcome-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.welcome-text {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0;
}

/* TITULO CARD */
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.kpi-card {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.kpi-label {
  font-size: 0.75rem;
  color: #6b7280;
}

.kpi-value {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 4px;
}

.kpi-sub {
  font-size: 0.7rem;
  color: #9ca3af;
}

/*             */

/* css usuarios */
/* GRID FORM USERS */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

/* TABLA B脕SICA */
.tabla-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

.table-basic {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.table-basic th,
.table-basic td {
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.table-basic th {
  text-align: left;
  color: #6b7280;
}


/* scroll table*/
/* Scroll horizontal SOLO para tablas */
.tabla-scroll {
    width: 100%;
    overflow-x: scroll;  /* ← SIEMPRE visible */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
}






.table-basic {
    width: max-content;  /* ← evita que se compacte */
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;  /* Texto más grande */
}

.table-basic th,
.table-basic td {
    padding: 10px 14px;       /* Más espacio */
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;       /* ← No se rompen columnas */
    font-size: 0.9rem;         /* Aumento leve del texto */
}

.table-basic th {
    background: #f0f2f5;       /* Header más visible */
    font-weight: 600;
}

.table-basic tr:hover {
    background: #f9fafb;
}


/* Columna horario: resumen + tooltip */
/* Scroll horizontal SOLO para tablas (visible siempre) */
.tabla-scroll {
    width: 100%;
    overflow-x: scroll;          /* ← barra siempre visible */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
}

/* Horario: resumen + tooltip reutilizable */
.horario-col {
    position: relative;
    white-space: nowrap;
}

.horario-resumen {
    cursor: pointer;
    color: #2563eb;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Tooltip con horario completo */
.horario-tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 4px;
    background: #ffffff;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.2rem;
    max-width: 380px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    z-index: 9999;
    white-space: normal; /* Permite varias líneas */
}

/* Mostrar tooltip al pasar el cursor */
.horario-col:hover .horario-tooltip {
    display: block;
}






/* fin scroll table*/


/* BADGES ROLES Y ESTADO */
.badge-role {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.badge-role-webadmin { background: #fee2e2; color: #b91c1c; }
.badge-role-gerente_general { background: #fef3c7; color: #92400e; }
.badge-role-gerente_rrhh { background: #e0f2fe; color: #1d4ed8; }
.badge-role-contador { background: #ecfdf5; color: #166534; }
.badge-role-asistente { background: #f3e8ff; color: #6b21a8; }

.badge-status {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
}

.badge-status-active {
  background: #dcfce7;
  color: #166534;
}

.badge-status-inactive {
  background: #fee2e2;
  color: #b91c1c;
}

.acciones-link.disabled {
  font-size: 0.7rem;
  color: #9ca3af;
  cursor: default;
}

/* fin css usuarios */

/* empleados css */
/* GRID FORM EMPLEADOS (ya ten铆amos form-grid-2 y 3 en usuarios) */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

/* Contactos de emergencia */
.contacto-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

/* empleados css */


/* css colilla */
/* ========== PAYSTUB LIGHTBOX ========== */
.paystub-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.paystub-modal.open {
  display: flex;
}

.paystub-card {
  background: #ffffff;
  width: 92%;
  max-width: 480px;
  max-height: 90vh;
  border-radius: 16px;
  padding: 16px 18px 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  overflow-y: auto;
  position: relative;
  font-size: 0.8rem;
}

.paystub-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: #6b7280;
}

.paystub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.paystub-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.paystub-periodo {
  font-size: 0.75rem;
  color: #6b7280;
}

.paystub-section {
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
}

.paystub-section:first-of-type {
  border-top: none;
}

.paystub-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.paystub-row span {
  font-size: 0.78rem;
}

.paystub-section-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
}

.paystub-section-cols h4 {
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: #111827;
}

.paystub-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.paystub-item.total {
  font-weight: 600;
  border-top: 1px dashed #e5e7eb;
  padding-top: 4px;
}

.paystub-row.neto {
  font-weight: 700;
  font-size: 0.9rem;
  color: #111827;
}

.paystub-section.extras .paystub-row span {
  font-size: 0.75rem;
  color: #4b5563;
}

.paystub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* Botones secundarios para el modal */
.btn-outline {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-success {
  border-radius: 999px;
  padding: 6px 12px;
  border: none;
  background: #16a34a;
  color: #ffffff;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-warning {
  border-radius: 999px;
  padding: 6px 12px;
  border: none;
  background: #f97316;
  color: #ffffff;
  font-size: 0.78rem;
  cursor: pointer;
}

/* Ajuste para impresi贸n: que la colilla salga limpia */
@media print {
  /* Tamaño y márgenes de la hoja */
  @page {
    size: letter portrait;
    margin: 10mm;
  }

  /* Ocultar todo menos la colilla abierta */
  body {
    background: #ffffff !important;
  }

  body * {
    visibility: hidden;
  }

  .paystub-modal.open,
  .paystub-modal.open * {
    visibility: visible;
  }

  /* Colocar el modal como contenido normal centrado */
  .paystub-modal.open {
    position: static !important;
    inset: auto !important;
    display: block !important;
    padding: 0;
    background: #ffffff !important;
  }

  .paystub-card {
    box-shadow: none !important;
    border-radius: 0 !important;
    max-height: none !important;
    width: 100% !important;
    max-width: 700px !important;
    margin: 0 auto !important;
    /* Escalar un poco para asegurar que quepa en una sola hoja */
    transform: scale(0.9);
    transform-origin: top center;
    page-break-inside: avoid;
  }

  /* Opcional: ajustar un poco tamaños de fuente para impresión */
  .paystub-card,
  .paystub-card * {
    font-size: 0.8rem;
  }
}

/* css colilla */

/* empleados nuevo form*/
/* ========== HORARIO POR DÍA (EMPLEADOS) ========== */
.horario-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.horario-row {
  display: grid;
  grid-template-columns: 80px 1fr 20px 1fr;
  gap: 6px;
  align-items: center;
  font-size: 0.8rem;
  color: #374151;
}

.horario-input {
  font-size: 0.78rem;
  padding: 4px 8px;
}

/* ========== MODAL EMPLEADO (LIGHTBOX) ========== */
.empleado-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 998;
}

.empleado-modal.open {
  display: flex;
}

.empleado-card {
  background: #ffffff;
  width: 92%;
  max-width: 520px;
  max-height: 90vh;
  border-radius: 16px;
  padding: 16px 18px 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  overflow-y: auto;
  position: relative;
  font-size: 0.8rem;
}

.empleado-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: #6b7280;
}

.empleado-header {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.empleado-foto img {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  object-fit: cover;
}

.empleado-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #4b5563;
}

.empleado-info-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.empleado-nombre {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.empleado-cargo {
  font-size: 0.78rem;
  color: #4b5563;
}

.empleado-meta {
  font-size: 0.75rem;
  color: #6b7280;
}

.empleado-section {
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
}

.empleado-section h4 {
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: #111827;
}

.empleado-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.empleado-row span {
  font-size: 0.78rem;
  color: #374151;
}

.empleado-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* Opcional: evitar que la barra de scroll del modal sea muy notoria en móviles */
.empleado-card::-webkit-scrollbar {
  width: 4px;
}
.empleado-card::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

/* No afecta la impresión (no hacemos @media print aquí, solo para colillas) */

/* empleados nuevo form*/

