/* ================================================
   CGA RH Web — Corporate Refined Theme
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --azul-principal: #1f56c3;
  --azul-oscuro: #152d5e;
  --azul-hover: #1a4494;
  --celeste: #7dd3fc;
  --naranja: #f97316;
  --naranja-hover: #ea580c;
  --negro: #0f172a;
  --blanco: #ffffff;
  --gris: #64748b;
  --gris-claro: #f1f5f9;
  --gris-borde: #e2e8f0;
  --gris-texto: #475569;
  --exito: #059669;
  --peligro: #dc2626;
  --advertencia: #d97706;
  --info: #0284c7;
  --sombra-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --sombra-md: 0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --sombra-lg: 0 10px 25px rgba(15,23,42,0.1), 0 4px 10px rgba(15,23,42,0.05);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================
   BASE
   ================================================ */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--negro);
  background-color: #f8fafc;
  letter-spacing: -0.01em;
}

/* ================================================
   TIPOGRAFIA
   ================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--negro);
  letter-spacing: -0.02em;
}

h4 { font-size: 1.35rem; }

.text-muted { color: var(--gris) !important; }

/* ================================================
   FOCUS GLOBAL
   ================================================ */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(31, 86, 195, 0.15);
}

/* ================================================
   NAVBAR
   ================================================ */
.navbar-cga {
  background: linear-gradient(135deg, var(--azul-principal) 0%, var(--azul-oscuro) 100%);
  padding: 0;
  box-shadow: 0 2px 12px rgba(15,23,42,0.15);
  position: relative;
  z-index: 100;
}

.navbar-cga .navbar-brand {
  color: var(--blanco);
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0.65rem 1rem;
  letter-spacing: -0.02em;
}

.navbar-cga .navbar-brand:hover {
  color: var(--celeste);
}

.navbar-cga .nav-link {
  color: rgba(255,255,255,0.85);
  padding: 0.7rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
}

.navbar-cga .nav-link:hover,
.navbar-cga .nav-link:focus {
  background-color: rgba(255,255,255,0.1);
  color: var(--blanco);
}

.navbar-cga .nav-link.active-link {
  background-color: rgba(255,255,255,0.15);
  color: var(--blanco);
}

/* Linea naranja inferior en hover — solo links sin dropdown */
.navbar-cga .navbar-nav > .nav-item > .nav-link:not(.dropdown-toggle)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--naranja);
  border-radius: 3px 3px 0 0;
  transition: width var(--transition);
}

.navbar-cga .navbar-nav > .nav-item > .nav-link:not(.dropdown-toggle):hover::after,
.navbar-cga .navbar-nav > .nav-item > .nav-link:not(.dropdown-toggle).active-link::after {
  width: 70%;
}

.navbar-info {
  color: var(--blanco);
  font-size: 0.8rem;
  padding-right: 0.5rem;
}

/* Dropdown menus */
.navbar-cga .dropdown-menu {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--sombra-lg);
  padding: 0.5rem;
  margin-top: 2px;
  animation: dropIn 0.15s ease-out;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.navbar-cga .dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 450;
  color: var(--negro);
  transition: all var(--transition);
}

.navbar-cga .dropdown-item:hover,
.navbar-cga .dropdown-item:focus {
  background-color: var(--gris-claro);
  color: var(--azul-principal);
}

.navbar-cga .dropdown-item i {
  color: var(--gris);
  transition: color var(--transition);
}

.navbar-cga .dropdown-item:hover i {
  color: var(--azul-principal);
}

.navbar-cga .dropdown-item.active,
.navbar-cga .dropdown-item:active {
  background-color: var(--azul-principal);
  color: var(--blanco);
}

.navbar-cga .dropdown-item.active i,
.navbar-cga .dropdown-item:active i {
  color: var(--blanco);
}

.navbar-cga .dropdown-divider {
  margin: 0.35rem 0;
  border-color: var(--gris-borde);
}

/* Navbar toggler para mobile */
.navbar-cga .navbar-toggler {
  border-color: rgba(255,255,255,0.3);
  padding: 0.35rem 0.65rem;
}

.navbar-cga .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Responsive navbar */
@media (max-width: 991.98px) {
  .navbar-cga .navbar-collapse {
    background: var(--azul-oscuro);
    padding: 0.75rem;
    margin-top: 0.5rem;
    border-radius: var(--radius);
  }

  .navbar-cga .nav-link {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
  }

  .navbar-cga .nav-link::after { display: none; }

  .navbar-info {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 0.5rem;
  }

  .navbar-info > div { text-align: left !important; }

  .navbar-cga .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin-top: 0;
    background-color: rgba(0, 0, 0, 0.2);
    box-shadow: none;
    animation: none;
    padding: 0.25rem 0.5rem;
  }

  .navbar-cga .dropdown-menu.dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
  }

  .navbar-cga .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
  }

  .navbar-cga .dropdown-item:hover,
  .navbar-cga .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
  }

  .navbar-cga .dropdown-item.active {
    background-color: var(--naranja);
    color: white;
  }

  .navbar-cga .dropdown-item i { color: rgba(255,255,255,0.5); }
  .navbar-cga .dropdown-item:hover i { color: white; }

  .navbar-cga .dropdown-header { color: rgba(255, 255, 255, 0.5); }
  .navbar-cga .dropdown-divider { border-color: rgba(255, 255, 255, 0.08); }
}

@media (max-width: 576px) {
  .navbar-cga { padding: 0.35rem 0.5rem; }
  .navbar-cga .navbar-brand { font-size: 1rem; }
  .navbar-info { font-size: 0.7rem; }

  /* Header en 2 filas: fila1 = Menu/Inicio + admin ; fila2 = info de empresa/periodo */
  .navbar-cga .container-fluid {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }
  /* botones compactos */
  .navbar-cga .hamburguesa-flotante,
  .btn-home,
  .header-usuario-link { height: 46px; }
  .navbar-cga .hamburguesa-flotante { width: 48px; }

  /* la info de empresa/periodo baja a su propia fila, ancho completo */
  .header-info {
    order: 99;
    flex: 1 0 100%;
    height: auto;
    padding: 0.35rem 0.6rem;
  }
  .header-info-linea1 { font-size: 0.82rem; }
  .header-info-linea2 { font-size: 0.74rem; }
  .header-info-linea1 span,
  .header-info-linea2 span { white-space: normal; }
  /* las fechas "De: ... al ..." pueden envolver sin romper */
  .header-info-linea2 { flex-wrap: wrap; }

  /* admin pegado a la derecha en la fila 1 */
  .header-usuario { margin-left: auto; }

  /* Dropdown de empresas: centrado, SOLIDO (no transparente) y sin salirse */
  #empresasDropdown {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 92vw !important;
    max-width: 360px !important;
    max-height: 70vh;
    overflow-y: auto;
    background: #1e3a8a !important;          /* azul CGA solido, nada transparente */
    border: 1px solid rgba(255,255,255,0.25) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55) !important;
    border-radius: 10px !important;
    z-index: 4000 !important;
  }
  #empresasDropdown .dropdown-item {
    white-space: normal;              /* nombres largos envuelven, no se cortan */
    word-break: break-word;
  }
}

/* ================================================
   MENU LATERAL FLOTANTE (hamburguesa + flyout)
   ================================================ */
/* Boton hamburguesa con logo CGA + label "Menu", mismo tamano que header info */
.navbar-cga .hamburguesa-flotante {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 56px;
  height: 56px;
  padding: 4px 0;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  margin-right: 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
}
.navbar-cga .hamburguesa-flotante:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.05);
}
.navbar-cga .hamburguesa-flotante:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
  outline: none;
}
.hamburguesa-logo {
  height: 28px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
  transition: transform var(--transition);
}
.navbar-cga .hamburguesa-flotante:hover .hamburguesa-logo {
  transform: rotate(-5deg);
}
.hamburguesa-label {
  color: rgba(255,255,255,0.9);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

/* Boton casita: ir al inicio (con label "Inicio") */
.navbar-cga .btn-home {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 56px;
  height: 56px;
  padding: 4px 0;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  margin-right: 0.5rem;
  font-size: 1.3rem;
  text-decoration: none;
  transition: all var(--transition);
}
.btn-home-label {
  color: rgba(255,255,255,0.9);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}
.navbar-cga .btn-home:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
  color: var(--blanco);
  transform: scale(1.05);
}
.navbar-cga .btn-home:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
  outline: none;
}

/* ========== Header info empresa/periodo grande ========== */
.header-info {
  color: var(--blanco);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  transition: background var(--transition);
  height: 56px;
  display: flex;
  align-items: center;
}
.dropdown.header-info:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  cursor: pointer;
}
.header-info-link {
  text-decoration: none;
  color: inherit !important;
  display: block;
}
.header-info-link.dropdown-toggle::after {
  display: none; /* Quitamos el chevron, ya hay hover visible */
}
.header-info-bloque {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.25;
  text-align: left;
}
.header-info-linea1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-start;
  white-space: nowrap;
}
.header-info-linea1 i {
  font-size: 1.15rem;
  color: #fff;
}
.header-info-linea2 {
  font-size: 0.98rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-start;
  white-space: nowrap;
}
.header-info-linea2 i {
  font-size: 1.05rem;
  color: #fff;
  opacity: 0.85;
}
.header-sep {
  opacity: 0.5;
  margin: 0 0.15rem;
}

/* Responsive: header info se compacta en pantallas chicas */
@media (max-width: 768px) {
  .header-info-linea1 { font-size: 0.9rem; }
  .header-info-linea2 { font-size: 0.85rem; }
  .header-info-linea1 span,
  .header-info-linea2 span {
    white-space: normal;
  }
}

/* Bloque usuario: mismo estilo y tamano que header-info */
.header-usuario {
  color: var(--blanco);
}
.header-usuario-link {
  text-decoration: none;
  color: var(--blanco) !important;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background var(--transition), border-color var(--transition);
  height: 56px;
}
.header-usuario-link:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
}
.header-usuario-link i {
  font-size: 1.5rem;
  color: #fff;
}
.header-usuario-link.dropdown-toggle::after {
  margin-left: 0.25rem;
  opacity: 0.7;
}

/* Backdrop oscuro detras del panel */
.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(2px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.menu-backdrop.activo {
  opacity: 1;
  visibility: visible;
}

/* Panel lateral principal */
.menu-lateral {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 320px;
  background: linear-gradient(180deg, var(--azul-principal) 0%, var(--azul-oscuro) 100%);
  box-shadow: 4px 0 24px rgba(15,23,42,0.35);
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.menu-lateral.activo {
  transform: translateX(0);
}

.menu-lateral-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.15);
}
.menu-lateral-titulo {
  color: var(--blanco);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  flex: 1;
}
.menu-lateral-cerrar {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--blanco);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.menu-lateral-cerrar:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.45);
}

/* La lista de items dentro del panel se scrollea si no cabe */
.menu-lateral .navbar-nav {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 0.5rem 0 !important;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  margin: 0 !important;
  list-style: none !important;
  min-height: 0; /* importante en flex para que overflow funcione */
}
/* Items principales del panel lateral */
.menu-lateral .nav-item {
  width: 100%;
  display: block !important;
  flex: none !important;
}
.menu-lateral .nav-item > li,
.menu-lateral .dropdown-menu > li {
  display: block !important;
  width: 100%;
}
.menu-lateral .nav-item .nav-link {
  color: rgba(255,255,255,0.9);
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  display: flex;
  align-items: center;
  border-left: 3px solid transparent;
}
.menu-lateral .nav-item .nav-link:hover,
.menu-lateral .nav-item .nav-link.active-flyout {
  background: rgba(255,255,255,0.1);
  color: var(--blanco);
  border-left-color: var(--naranja);
}
/* Quitar la lineita naranja inferior (era para horizontal) */
.menu-lateral .nav-item .nav-link::after { display: none !important; }
/* Indicador de chevron a la derecha para los items con submenu */
.menu-lateral .nav-item .dropdown-toggle::after {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(-45deg);
  -webkit-transform: rotate(-45deg);
  margin-left: auto;
  vertical-align: middle;
  border-radius: 1px;
  opacity: 0.7;
}

/* ========== ACORDEON VERTICAL ========== */
/* Cada submenu (.dropdown-menu) se expande inline debajo del item padre */
.menu-lateral .dropdown-menu {
  position: static !important;
  width: 100% !important;
  max-width: 100% !important;
  background: rgba(0,0,0,0.18) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: none !important;
  opacity: 1;
  transform: none !important;
  transition: none;
  overflow: visible !important;
  inset: auto !important;
  float: none !important;
  animation: none !important;
}
.menu-lateral .dropdown-menu.flyout-abierto {
  display: block !important;
}
.menu-lateral .dropdown-menu::-webkit-scrollbar { width: 10px; }
.menu-lateral .dropdown-menu::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
}
.menu-lateral .dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.35);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.menu-lateral .dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.55);
  background-clip: padding-box;
}
.menu-lateral .navbar-nav::-webkit-scrollbar { width: 10px; }
.menu-lateral .navbar-nav::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
}
.menu-lateral .navbar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.35);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.menu-lateral .navbar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.55);
  background-clip: padding-box;
}

/* Items dentro del acordeon (nivel 2) */
.menu-lateral .dropdown-menu .dropdown-item {
  color: rgba(255,255,255,0.88);
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  font-size: 0.85rem;
  border-radius: 0;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  white-space: normal;
  line-height: 1.3;
}
/* Submenu anidado (nivel 3): mas indent y fondo mas oscuro */
.menu-lateral .dropdown-menu .dropdown-menu {
  background: rgba(0,0,0,0.28) !important;
}
.menu-lateral .dropdown-menu .dropdown-menu .dropdown-item {
  padding-left: 3.25rem;
  font-size: 0.82rem;
}
/* Submenu anidado nivel 4+ */
.menu-lateral .dropdown-menu .dropdown-menu .dropdown-menu {
  background: rgba(0,0,0,0.38) !important;
}
.menu-lateral .dropdown-menu .dropdown-menu .dropdown-menu .dropdown-item {
  padding-left: 4.25rem;
}
.menu-lateral .dropdown-menu .dropdown-item:hover,
.menu-lateral .dropdown-menu .dropdown-item:focus,
.menu-lateral .dropdown-menu .dropdown-item.active-flyout {
  background: rgba(255,255,255,0.12);
  color: var(--blanco);
  border-left-color: var(--naranja);
}
.menu-lateral .dropdown-menu .dropdown-item i {
  color: rgba(255,255,255,0.6);
  margin-right: 0.5rem;
}
.menu-lateral .dropdown-menu .dropdown-item:hover i,
.menu-lateral .dropdown-menu .dropdown-item.active-flyout i {
  color: var(--naranja);
}
.menu-lateral .dropdown-menu .dropdown-divider {
  border-color: rgba(255,255,255,0.1);
  margin: 0.3rem 0.5rem;
}
.menu-lateral .dropdown-menu .dropdown-toggle::after {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(-45deg);
  -webkit-transform: rotate(-45deg);
  margin-left: auto;
  opacity: 0.6;
  transition: transform 0.2s ease;
}
/* Cuando el toggle esta activo (submenu abierto), rotar chevron 45deg mas */
.menu-lateral .dropdown-toggle.active-flyout::after {
  transform: rotate(45deg);
}

/* Items "pending" tambien funcionan dentro del acordeon */
.menu-lateral .dropdown-item.menu-pending {
  opacity: 0.6;
}
.menu-lateral .dropdown-item.menu-pending::after {
  content: " 🚧";
  font-size: 11px;
  opacity: 0.7;
  border: none !important;
  transform: none !important;
  padding: 0 !important;
  margin: 0 0 0 4px !important;
}

/* En lugar de la linea horizontal naranja del navbar viejo */
.menu-lateral .nav-link {
  position: relative;
}

/* navbar-cga ahora siempre horizontal con info, sin items */
.navbar-cga .container-fluid {
  align-items: center;
}

/* Atajos visibles cuando hace foco en hamburguesa */
.hamburguesa-flotante::after {
  content: "Alt+B";
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--negro);
  color: var(--blanco);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 200;
}
.hamburguesa-flotante:hover::after,
.hamburguesa-flotante:focus::after {
  opacity: 1;
}

/* Responsive: el panel ocupa todo el ancho en moviles */
@media (max-width: 480px) {
  .menu-lateral {
    width: 100vw !important;
    max-width: 320px;
  }
}

/* ================================================
   CONTENIDO PRINCIPAL
   ================================================ */
.content-wrapper {
  flex: 1;
  background: linear-gradient(180deg, #eef2f7 0%, #f8fafc 300px);
  min-height: calc(100vh - 120px);
}

.content-wrapper .container-fluid {
  max-width: 1920px;
  padding: 1.25rem 1.5rem;
}

/* ================================================
   CARDS
   ================================================ */
.card {
  border: 1px solid var(--gris-borde);
  border-radius: var(--radius);
  box-shadow: var(--sombra-sm);
  transition: box-shadow var(--transition);
  background: var(--blanco);
}

.card:hover {
  box-shadow: var(--sombra-md);
}

.card-header {
  background-color: var(--blanco);
  border-bottom: 1px solid var(--gris-borde);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  letter-spacing: -0.01em;
}

.card-header.bg-primary {
  background: linear-gradient(135deg, var(--azul-principal), var(--azul-oscuro)) !important;
  border-bottom: none;
}

.card-footer {
  background-color: #fafbfc;
  border-top: 1px solid var(--gris-borde);
  font-size: 0.8rem;
}

/* ================================================
   KPI CARDS (Dashboard)
   ================================================ */
.kpi-card {
  border: 1px solid var(--gris-borde);
  border-radius: var(--radius);
  box-shadow: var(--sombra-sm);
  transition: all var(--transition);
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sombra-lg);
}

.kpi-card h2 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.kpi-card h6 {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.35rem;
}

.kpi-primary { border-left: 4px solid var(--azul-principal); }
.kpi-success { border-left: 4px solid var(--exito); }
.kpi-danger { border-left: 4px solid var(--peligro); }
.kpi-warning { border-left: 4px solid var(--advertencia); }
.kpi-secondary { border-left: 4px solid var(--gris); }
.kpi-info { border-left: 4px solid var(--info); }

/* ================================================
   TABLAS
   ================================================ */
.table {
  font-size: 0.875rem;
  margin-bottom: 0;
}

.table > thead {
  position: relative;
}

.table-dark > th,
.table-dark {
  background-color: var(--azul-oscuro) !important;
  color: rgba(255,255,255,0.95);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  padding: 0.65rem 0.75rem;
  white-space: nowrap;
}

.table > tbody > tr > td {
  padding: 0.55rem 0.75rem;
  vertical-align: middle;
  border-color: var(--gris-borde);
  color: var(--gris-texto);
}

.table > tbody > tr > td strong {
  color: var(--negro);
  font-weight: 600;
}

/* Striped: bootstrap nativo para tablas simples */
.table-striped > tbody > tr:nth-of-type(odd) > td {
  background-color: #f8fafc;
}

/* Striped manual para tablas con filas de detalle/edicion expandible */
tr.fila-master > td {
  background-color: var(--blanco) !important;
}
tr.fila-master.stripe > td {
  background-color: #f8fafc !important;
}

.table-hover > tbody > tr:hover > td {
  background-color: #eef4ff !important;
}

/* Sub-tablas (detalle dentro de filas expandibles) */
.table-bordered {
  border-color: var(--gris-borde);
}

.table-bordered > tbody > tr > td {
  padding: 0.55rem 1.5rem !important;
}

.table-bordered > thead > tr > th {
  padding: 0.55rem 1.5rem !important;
}

.table-light > th,
.table-light {
  background-color: var(--azul-oscuro) !important;
  color: rgba(255,255,255,0.95) !important;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ================================================
   FORMULARIOS
   ================================================ */
.form-control {
  border: 1px solid var(--gris-borde);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--negro);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--azul-principal);
  box-shadow: 0 0 0 3px rgba(31, 86, 195, 0.1);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control-sm {
  font-size: 0.8125rem;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
}

.form-label {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--gris-texto);
  margin-bottom: 0.25rem;
}

.form-label-sm { font-size: 0.75rem; }

/* ================================================
   BOTONES
   ================================================ */
.btn {
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  letter-spacing: -0.01em;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--azul-principal), var(--azul-hover));
  border: none;
  box-shadow: 0 2px 4px rgba(31, 86, 195, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--azul-hover), var(--azul-oscuro));
  box-shadow: 0 4px 8px rgba(31, 86, 195, 0.3);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--exito), #047857);
  border: none;
}

.btn-danger {
  background: linear-gradient(135deg, var(--peligro), #b91c1c);
  border: none;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, var(--advertencia));
  border: none;
  color: var(--blanco);
}

.btn-warning:hover { color: var(--blanco); }

.btn-secondary {
  background: var(--gris-claro);
  border: 1px solid var(--gris-borde);
  color: var(--gris-texto);
}

.btn-secondary:hover {
  background: var(--gris-borde);
  color: var(--negro);
}

.btn-outline-secondary {
  border-color: var(--gris-borde);
  color: var(--gris-texto);
}

.btn-outline-warning {
  border-color: var(--advertencia);
  color: var(--advertencia);
}

.btn-outline-warning:hover {
  background-color: var(--advertencia);
  color: var(--blanco);
}

.btn-outline-danger {
  border-color: var(--peligro);
  color: var(--peligro);
}

.btn-outline-danger:hover {
  background-color: var(--peligro);
  color: var(--blanco);
}

/* ================================================
   ALERTAS
   ================================================ */
.alert {
  border-radius: var(--radius);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
}

.alert-success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border-left: 4px solid var(--exito);
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2, #fecaca);
  color: #991b1b;
  border-left: 4px solid var(--peligro);
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
  border-left: 4px solid var(--advertencia);
}

.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  border-left: 4px solid var(--info);
}

/* ================================================
   TABS
   ================================================ */
.dashboard-tabs {
  border-bottom: 2px solid var(--gris-borde);
}

.dashboard-tabs .nav-link {
  border: none;
  color: var(--gris);
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.dashboard-tabs .nav-link:hover {
  color: var(--azul-principal);
  border-bottom-color: var(--gris-borde);
}

.dashboard-tabs .nav-link.active {
  color: var(--azul-principal);
  background-color: transparent;
  border-bottom-color: var(--azul-principal);
  font-weight: 600;
}

/* Nav tabs en cards (sub-tabs) */
.nav-tabs {
  border-bottom: 2px solid var(--gris-borde);
}

.nav-tabs .nav-link {
  border: none;
  color: var(--gris);
  font-size: 0.8125rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.nav-tabs .nav-link:hover {
  color: var(--azul-principal);
  border-color: transparent;
  border-bottom-color: var(--gris-borde);
}

.nav-tabs .nav-link.active {
  color: var(--azul-principal);
  font-weight: 600;
  border-color: transparent;
  border-bottom-color: var(--azul-principal);
  background: transparent;
}

/* ================================================
   MODALES
   ================================================ */
.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--sombra-lg);
}

.modal-header {
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1.25rem;
}

/* ================================================
   BADGES
   ================================================ */
.badge {
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 0.3em 0.65em;
  border-radius: 5px;
}

/* ================================================
   BREADCRUMBS / PAGE HEADERS
   ================================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--gris-borde);
}

.page-header h4 {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-header h4 i {
  color: var(--azul-principal);
  font-size: 1.1em;
}

/* ================================================
   DROPDOWNS SUBMENU
   ================================================ */
.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -1px;
  display: none;
}

.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

.dropdown-submenu > a.dropdown-toggle::after {
  display: inline-block;
  margin-left: auto;
  vertical-align: middle;
  content: "";
  border-top: 0.3em solid transparent;
  border-right: 0;
  border-bottom: 0.3em solid transparent;
  border-left: 0.3em solid;
  float: right;
  margin-top: 0.5em;
}

.dropdown-submenu > a.dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 991.98px) {
  .dropdown-submenu > .dropdown-menu {
    position: static;
    left: 0;
    margin-left: 1rem;
    border: none;
    box-shadow: none;
    background-color: #f8f9fa;
  }

  .dropdown-submenu > a.dropdown-toggle::after {
    border-left: 0;
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    float: none;
    margin-left: 0.5em;
  }
}

/* ================================================
   FOOTER
   ================================================ */
.footer-cga {
  background-color: var(--blanco);
  color: var(--gris);
  padding: 0.5rem 0;
  font-size: 0.72rem;
  flex-shrink: 0;
  border-top: 1px solid var(--gris-borde);
  letter-spacing: 0.01em;
}

/* ================================================
   LOADING OVERLAY
   ================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: #0f172a;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  overflow: hidden;
}

/* Contenedor del logo: ancho RESPONSIVO para que NO se salga en movil */
.loading-content {
  position: relative;
  width: min(560px, 80vw);
  height: calc(min(560px, 80vw) / 1.5);
}

/* Logo base tenue (silueta de fondo) */
.loading-logo-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.15;
}

/* Logo que se llena de abajo hacia arriba: fill recto y simple, sin olas.
   El nivel lo controla --fill (0..1), que el JS sube acompañando la carga. */
.loading-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  --fill: 0;
  clip-path: inset(calc((1 - var(--fill)) * 100%) 0 0 0);
  transition: clip-path 0.5s ease-out;
}

/* Puntitos de carga */
.loading-dots {
  display: flex;
  gap: 8px;
}
.loading-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3b82f6;
  animation: cga-dot 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cga-rise {
    0.00% { clip-path: polygon(0.0% 106.00%, 8.3% 109.65%, 16.7% 108.98%, 25.0% 104.79%, 33.3% 102.03%, 41.7% 103.97%, 50.0% 108.31%, 58.3% 109.92%, 66.7% 106.89%, 75.0% 102.80%, 83.3% 102.50%, 91.7% 106.33%, 100.0% 109.77%, 100% 100%, 0% 100%); }
    2.27% { clip-path: polygon(0.0% 108.75%, 8.3% 108.94%, 16.7% 105.06%, 25.0% 101.69%, 33.3% 102.81%, 41.7% 107.11%, 50.0% 109.49%, 58.3% 107.14%, 66.7% 102.84%, 75.0% 101.68%, 83.3% 105.03%, 91.7% 108.93%, 100.0% 108.76%, 100% 100%, 0% 100%); }
    4.55% { clip-path: polygon(0.0% 107.83%, 8.3% 104.41%, 16.7% 100.56%, 25.0% 100.83%, 33.3% 104.90%, 41.7% 107.96%, 50.0% 106.38%, 58.3% 102.04%, 66.7% 100.07%, 75.0% 102.80%, 83.3% 107.01%, 91.7% 107.71%, 100.0% 104.08%, 100% 100%, 0% 100%); }
    6.82% { clip-path: polygon(0.0% 102.92%, 8.3% 98.74%, 16.7% 98.15%, 25.0% 101.84%, 33.3% 105.45%, 41.7% 104.71%, 50.0% 100.49%, 58.3% 97.79%, 66.7% 99.79%, 75.0% 104.14%, 83.3% 105.68%, 91.7% 102.60%, 100.0% 98.53%, 100% 100%, 0% 100%); }
    9.09% { clip-path: polygon(0.0% 96.34%, 8.3% 94.90%, 16.7% 98.06%, 25.0% 102.08%, 33.3% 102.20%, 41.7% 98.28%, 50.0% 94.96%, 58.3% 96.16%, 66.7% 100.46%, 75.0% 102.78%, 83.3% 100.37%, 91.7% 96.08%, 100.0% 94.99%, 100% 100%, 0% 100%); }
    11.36% { clip-path: polygon(0.0% 91.20%, 8.3% 93.70%, 16.7% 97.98%, 25.0% 98.96%, 33.3% 95.50%, 41.7% 91.68%, 50.0% 92.03%, 58.3% 96.13%, 66.7% 99.13%, 75.0% 97.48%, 83.3% 93.14%, 91.7% 91.23%, 100.0% 94.02%, 100% 100%, 0% 100%); }
    13.64% { clip-path: polygon(0.0% 88.93%, 8.3% 93.28%, 16.7% 95.09%, 25.0% 92.22%, 33.3% 88.06%, 41.7% 87.54%, 50.0% 91.27%, 58.3% 94.84%, 66.7% 94.02%, 75.0% 89.79%, 83.3% 87.14%, 91.7% 89.22%, 100.0% 93.55%, 100% 100%, 0% 100%); }
    15.91% { clip-path: polygon(0.0% 88.13%, 8.3% 90.69%, 16.7% 88.52%, 25.0% 84.20%, 33.3% 82.82%, 41.7% 86.03%, 50.0% 90.03%, 58.3% 90.08%, 66.7% 86.13%, 75.0% 82.85%, 83.3% 84.12%, 91.7% 88.44%, 100.0% 90.69%, 100% 100%, 0% 100%); }
    18.18% { clip-path: polygon(0.0% 85.87%, 8.3% 84.50%, 16.7% 80.17%, 25.0% 78.01%, 33.3% 80.57%, 41.7% 84.83%, 50.0% 85.74%, 58.3% 82.23%, 66.7% 78.45%, 75.0% 78.87%, 83.3% 82.99%, 91.7% 85.94%, 100.0% 84.23%, 100% 100%, 0% 100%); }
    20.45% { clip-path: polygon(0.0% 80.24%, 8.3% 76.08%, 16.7% 73.21%, 25.0% 75.02%, 33.3% 79.37%, 41.7% 81.12%, 50.0% 78.19%, 58.3% 74.06%, 66.7% 73.60%, 75.0% 77.37%, 83.3% 80.90%, 91.7% 80.01%, 100.0% 75.76%, 100% 100%, 0% 100%); }
    22.73% { clip-path: polygon(0.0% 72.01%, 8.3% 68.54%, 16.7% 69.53%, 25.0% 73.80%, 33.3% 76.30%, 41.7% 74.08%, 50.0% 69.75%, 58.3% 68.45%, 66.7% 71.71%, 75.0% 75.67%, 83.3% 75.65%, 91.7% 71.67%, 100.0% 68.44%, 100% 100%, 0% 100%); }
    25.00% { clip-path: polygon(0.0% 64.11%, 8.3% 64.24%, 16.7% 68.26%, 25.0% 71.42%, 33.3% 69.98%, 41.7% 65.64%, 50.0% 63.54%, 58.3% 66.16%, 66.7% 70.40%, 75.0% 71.25%, 83.3% 67.70%, 91.7% 63.95%, 100.0% 64.44%, 100% 100%, 0% 100%); }
    27.27% { clip-path: polygon(0.0% 59.28%, 8.3% 62.89%, 16.7% 66.58%, 25.0% 65.98%, 33.3% 61.81%, 41.7% 58.99%, 50.0% 60.87%, 58.3% 65.22%, 66.7% 66.89%, 75.0% 63.91%, 83.3% 59.80%, 91.7% 59.43%, 100.0% 63.23%, 100% 100%, 0% 100%); }
    29.55% { clip-path: polygon(0.0% 57.84%, 8.3% 61.91%, 16.7% 62.18%, 25.0% 58.33%, 33.3% 54.91%, 41.7% 55.97%, 50.0% 60.26%, 58.3% 62.70%, 66.7% 60.41%, 75.0% 56.10%, 83.3% 54.86%, 91.7% 58.17%, 100.0% 62.10%, 100% 100%, 0% 100%); }
    31.82% { clip-path: polygon(0.0% 57.55%, 8.3% 58.67%, 16.7% 55.30%, 25.0% 51.42%, 33.3% 51.62%, 41.7% 55.67%, 50.0% 58.77%, 58.3% 57.26%, 66.7% 52.92%, 75.0% 50.88%, 83.3% 53.56%, 91.7% 57.79%, 100.0% 58.56%, 100% 100%, 0% 100%); }
    34.09% { clip-path: polygon(0.0% 55.56%, 8.3% 52.79%, 16.7% 48.60%, 25.0% 47.93%, 33.3% 51.58%, 41.7% 55.23%, 50.0% 54.56%, 58.3% 50.37%, 66.7% 47.61%, 75.0% 49.55%, 83.3% 53.90%, 91.7% 55.50%, 100.0% 52.47%, 100% 100%, 0% 100%); }
    36.36% { clip-path: polygon(0.0% 50.90%, 8.3% 46.56%, 16.7% 45.05%, 25.0% 48.16%, 33.3% 52.21%, 41.7% 52.40%, 50.0% 48.52%, 58.3% 45.14%, 66.7% 46.28%, 75.0% 50.57%, 83.3% 52.95%, 91.7% 50.60%, 100.0% 46.30%, 100% 100%, 0% 100%); }
    38.64% { clip-path: polygon(0.0% 45.38%, 8.3% 43.09%, 16.7% 45.54%, 25.0% 49.82%, 33.3% 50.88%, 41.7% 47.46%, 50.0% 43.61%, 58.3% 43.88%, 66.7% 47.96%, 75.0% 51.01%, 83.3% 49.43%, 91.7% 45.09%, 100.0% 43.11%, 100% 100%, 0% 100%); }
    40.91% { clip-path: polygon(0.0% 42.18%, 8.3% 43.86%, 16.7% 48.21%, 25.0% 50.09%, 33.3% 47.27%, 41.7% 43.09%, 50.0% 42.50%, 58.3% 46.19%, 66.7% 49.80%, 75.0% 49.06%, 83.3% 44.84%, 91.7% 42.14%, 100.0% 44.15%, 100% 100%, 0% 100%); }
    43.18% { clip-path: polygon(0.0% 43.98%, 8.3% 48.22%, 16.7% 50.84%, 25.0% 48.74%, 33.3% 44.40%, 41.7% 42.96%, 50.0% 46.12%, 58.3% 50.14%, 66.7% 50.27%, 75.0% 46.35%, 83.3% 43.02%, 91.7% 44.23%, 100.0% 48.53%, 100% 100%, 0% 100%); }
    45.45% { clip-path: polygon(0.0% 50.55%, 8.3% 53.81%, 16.7% 52.50%, 25.0% 48.18%, 33.3% 45.96%, 41.7% 48.46%, 50.0% 52.73%, 58.3% 53.72%, 66.7% 50.25%, 75.0% 46.43%, 83.3% 46.78%, 91.7% 50.88%, 100.0% 53.88%, 100% 100%, 0% 100%); }
    47.73% { clip-path: polygon(0.0% 51.62%, 8.3% 51.17%, 16.7% 47.03%, 25.0% 44.11%, 33.3% 45.86%, 41.7% 50.21%, 50.0% 52.01%, 58.3% 49.14%, 66.7% 44.99%, 75.0% 44.46%, 83.3% 48.19%, 91.7% 51.76%, 100.0% 50.95%, 100% 100%, 0% 100%); }
    50.00% { clip-path: polygon(0.0% 46.30%, 8.3% 42.52%, 16.7% 39.01%, 25.0% 39.93%, 33.3% 44.19%, 41.7% 46.75%, 50.0% 44.58%, 58.3% 40.25%, 66.7% 38.88%, 75.0% 42.09%, 83.3% 46.08%, 91.7% 46.13%, 100.0% 42.18%, 100% 100%, 0% 100%); }
    52.27% { clip-path: polygon(0.0% 39.06%, 8.3% 35.11%, 16.7% 35.17%, 25.0% 39.16%, 33.3% 42.37%, 41.7% 40.99%, 50.0% 36.66%, 58.3% 34.50%, 66.7% 37.06%, 75.0% 41.32%, 83.3% 42.23%, 91.7% 38.73%, 100.0% 34.94%, 100% 100%, 0% 100%); }
    54.55% { clip-path: polygon(0.0% 35.97%, 8.3% 35.16%, 16.7% 38.73%, 25.0% 42.46%, 33.3% 41.93%, 41.7% 37.77%, 50.0% 34.90%, 58.3% 36.72%, 66.7% 41.07%, 75.0% 42.81%, 83.3% 39.88%, 91.7% 35.75%, 100.0% 35.30%, 100% 100%, 0% 100%); }
    56.82% { clip-path: polygon(0.0% 39.61%, 8.3% 42.62%, 16.7% 46.72%, 25.0% 47.06%, 33.3% 43.24%, 41.7% 39.78%, 50.0% 40.77%, 58.3% 45.04%, 66.7% 47.54%, 75.0% 45.31%, 83.3% 40.99%, 91.7% 39.69%, 100.0% 42.95%, 100% 100%, 0% 100%); }
    59.09% { clip-path: polygon(0.0% 46.93%, 8.3% 51.24%, 16.7% 52.43%, 25.0% 49.10%, 33.3% 45.19%, 41.7% 45.32%, 50.0% 49.34%, 58.3% 52.50%, 66.7% 51.05%, 75.0% 46.72%, 83.3% 44.62%, 91.7% 47.24%, 100.0% 51.48%, 100% 100%, 0% 100%); }
    61.36% { clip-path: polygon(0.0% 51.78%, 8.3% 53.78%, 16.7% 51.08%, 25.0% 46.86%, 33.3% 46.13%, 41.7% 49.74%, 50.0% 53.43%, 58.3% 52.83%, 66.7% 48.65%, 75.0% 45.84%, 83.3% 47.72%, 91.7% 52.06%, 100.0% 53.74%, 100% 100%, 0% 100%); }
    63.64% { clip-path: polygon(0.0% 50.10%, 8.3% 48.13%, 16.7% 43.78%, 25.0% 42.21%, 33.3% 45.27%, 41.7% 49.34%, 50.0% 49.61%, 58.3% 45.75%, 66.7% 42.34%, 75.0% 43.40%, 83.3% 47.68%, 91.7% 50.12%, 100.0% 47.83%, 100% 100%, 0% 100%); }
    65.91% { clip-path: polygon(0.0% 43.31%, 8.3% 39.01%, 16.7% 36.66%, 25.0% 39.04%, 33.3% 43.34%, 41.7% 44.47%, 50.0% 41.09%, 58.3% 37.21%, 66.7% 37.41%, 75.0% 41.46%, 83.3% 44.56%, 91.7% 43.05%, 100.0% 38.71%, 100% 100%, 0% 100%); }
    68.18% { clip-path: polygon(0.0% 37.11%, 8.3% 34.08%, 16.7% 35.69%, 25.0% 40.04%, 33.3% 41.98%, 41.7% 39.21%, 50.0% 35.02%, 58.3% 34.35%, 66.7% 38.01%, 75.0% 41.65%, 83.3% 40.98%, 91.7% 36.78%, 100.0% 34.03%, 100% 100%, 0% 100%); }
    70.45% { clip-path: polygon(0.0% 36.69%, 8.3% 37.47%, 16.7% 41.69%, 25.0% 44.37%, 33.3% 42.33%, 41.7% 37.98%, 50.0% 36.48%, 58.3% 39.59%, 66.7% 43.64%, 75.0% 43.83%, 83.3% 39.95%, 91.7% 36.57%, 100.0% 37.71%, 100% 100%, 0% 100%); }
    72.73% { clip-path: polygon(0.0% 40.28%, 8.3% 44.22%, 16.7% 47.52%, 25.0% 46.28%, 33.3% 41.97%, 41.7% 39.68%, 50.0% 42.13%, 58.3% 46.41%, 66.7% 47.47%, 75.0% 44.04%, 83.3% 40.19%, 91.7% 40.47%, 100.0% 44.55%, 100% 100%, 0% 100%); }
    75.00% { clip-path: polygon(0.0% 38.85%, 8.3% 42.64%, 16.7% 42.26%, 25.0% 38.15%, 33.3% 35.17%, 41.7% 36.85%, 50.0% 41.20%, 58.3% 43.08%, 66.7% 40.26%, 75.0% 36.08%, 83.3% 35.49%, 91.7% 39.18%, 100.0% 42.79%, 100% 100%, 0% 100%); }
    77.27% { clip-path: polygon(0.0% 33.62%, 8.3% 34.10%, 16.7% 30.36%, 25.0% 26.81%, 33.3% 27.66%, 41.7% 31.90%, 50.0% 34.52%, 58.3% 32.41%, 66.7% 28.08%, 75.0% 26.64%, 83.3% 29.80%, 91.7% 33.82%, 100.0% 33.94%, 100% 100%, 0% 100%); }
    79.55% { clip-path: polygon(0.0% 23.62%, 8.3% 20.38%, 16.7% 16.41%, 25.0% 16.39%, 33.3% 20.36%, 41.7% 23.61%, 50.0% 22.30%, 58.3% 17.98%, 66.7% 15.76%, 75.0% 18.26%, 83.3% 22.53%, 91.7% 23.52%, 100.0% 20.05%, 100% 100%, 0% 100%); }
    81.82% { clip-path: polygon(0.0% 10.02%, 8.3% 5.77%, 16.7% 4.89%, 25.0% 8.43%, 33.3% 12.19%, 41.7% 11.73%, 50.0% 7.60%, 58.3% 4.67%, 66.7% 6.42%, 75.0% 10.77%, 83.3% 12.58%, 91.7% 9.70%, 100.0% 5.55%, 100% 100%, 0% 100%); }
    84.09% { clip-path: polygon(0.0% -3.29%, 8.3% -5.00%, 16.7% -2.04%, 25.0% 2.08%, 33.3% 2.49%, 41.7% -1.29%, 50.0% -4.80%, 58.3% -3.87%, 66.7% 0.38%, 75.0% 2.94%, 83.3% 0.77%, 91.7% -3.56%, 100.0% -4.93%, 100% 100%, 0% 100%); }
    86.36% { clip-path: polygon(0.0% -11.45%, 8.3% -9.19%, 16.7% -4.87%, 25.0% -3.61%, 33.3% -6.89%, 41.7% -10.84%, 50.0% -10.78%, 58.3% -6.78%, 66.7% -3.58%, 75.0% -4.95%, 83.3% -9.28%, 91.7% -11.44%, 100.0% -8.88%, 100% 100%, 0% 100%); }
    88.64% { clip-path: polygon(0.0% -11.42%, 8.3% -7.08%, 16.7% -5.01%, 25.0% -7.66%, 33.3% -11.90%, 41.7% -12.70%, 50.0% -9.13%, 58.3% -5.40%, 66.7% -5.93%, 75.0% -10.09%, 83.3% -12.96%, 91.7% -11.14%, 100.0% -6.79%, 100% 100%, 0% 100%); }
    90.91% { clip-path: polygon(0.0% -7.81%, 8.3% -5.03%, 16.7% -6.94%, 25.0% -11.29%, 33.3% -12.93%, 41.7% -9.92%, 50.0% -5.82%, 58.3% -5.48%, 66.7% -9.30%, 75.0% -12.76%, 83.3% -11.77%, 91.7% -7.50%, 100.0% -5.00%, 100% 100%, 0% 100%); }
    93.18% { clip-path: polygon(0.0% -5.20%, 8.3% -6.30%, 16.7% -10.59%, 25.0% -13.00%, 33.3% -10.68%, 41.7% -6.37%, 50.0% -5.18%, 58.3% -8.51%, 66.7% -12.42%, 75.0% -12.29%, 83.3% -8.27%, 91.7% -5.11%, 100.0% -6.56%, 100% 100%, 0% 100%); }
    95.45% { clip-path: polygon(0.0% -5.77%, 8.3% -9.83%, 16.7% -12.91%, 25.0% -11.36%, 33.3% -7.02%, 41.7% -5.02%, 50.0% -7.73%, 58.3% -11.94%, 66.7% -12.68%, 75.0% -9.06%, 83.3% -5.37%, 91.7% -5.98%, 100.0% -10.16%, 100% 100%, 0% 100%); }
    97.73% { clip-path: polygon(0.0% -9.04%, 8.3% -12.67%, 16.7% -11.96%, 25.0% -7.75%, 33.3% -5.02%, 41.7% -7.00%, 50.0% -11.34%, 58.3% -12.92%, 66.7% -9.86%, 75.0% -5.78%, 83.3% -5.52%, 91.7% -9.37%, 100.0% -12.79%, 100% 100%, 0% 100%); }
    100.00% { clip-path: polygon(0.0% -12.28%, 8.3% -12.43%, 16.7% -8.53%, 25.0% -5.18%, 33.3% -6.35%, 41.7% -10.65%, 50.0% -13.00%, 58.3% -10.61%, 66.7% -6.32%, 75.0% -5.20%, 83.3% -8.57%, 91.7% -12.46%, 100.0% -12.25%, 100% 100%, 0% 100%); }
  }
  @keyframes cga-fade { 0%, 88% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes cga-dot {
    0%, 80%, 100% { opacity: .2; transform: translateY(0); }
    40%           { opacity: 1;  transform: translateY(-4px); }
  }

}

/* ================================================
   BOTON SOPORTE FLOTANTE
   ================================================ */
.btn-soporte-flotante {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--azul-principal), var(--azul-oscuro));
  color: white !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(31, 86, 195, 0.35);
  transition: all 0.3s ease;
  z-index: 999;
  text-decoration: none !important;
  border: none;
}

.btn-soporte-flotante i {
  font-size: 1.5rem;
  line-height: 1;
  color: white !important;
  animation: none;
}

.btn-soporte-flotante:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(31, 86, 195, 0.4);
  color: white;
}

.btn-soporte-flotante:active {
  transform: translateY(0);
}

/* ================================================
   SCROLLBAR PERSONALIZADO
   ================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gris-claro); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ================================================
   UTILIDADES ADICIONALES
   ================================================ */
.bg-light { background-color: var(--gris-claro) !important; }

/* Headers sorteables en sub-tablas */
.sortable-sub {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition);
}

.sortable-sub:hover {
  background-color: rgba(255,255,255,0.1) !important;
}

/* Fila expandible - borde azul lateral */
.detalle-area > td > div {
  border-left: 4px solid var(--azul-principal) !important;
}

/* Chevron de expansion con transicion */
.fila-area td:first-child i {
  transition: transform var(--transition);
}

.fila-area td:first-child i.bi-chevron-down {
  transform: rotate(0deg);
}

/* Animacion suave para filas de detalle */
.detalle-area td {
  padding: 0 !important;
}

.detalle-area .bg-light {
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   SELECCION DE TEXTO
   ================================================ */
::selection {
  background-color: rgba(31, 86, 195, 0.15);
  color: var(--negro);
}

/* ================================================
   MOBILE CARDS — patron de Centinela (2026-05-07)
   No usa data-label ni transformacion de tablas.
   En el Razor se renderean DOS bloques:
   - Tabla con clase d-none d-md-block (visible solo desktop)
   - Cards con clase d-md-none (visible solo mobile)
   Aqui solo definimos el estilo de la card.
   ================================================ */
.mobile-card {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-left: 4px solid var(--azul-principal);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--sombra-sm);
  transition: box-shadow var(--transition);
  text-align: left; /* anular cualquier text-align: center heredado */
  overflow-wrap: break-word;     /* texto largo no desborda */
  max-width: 100%;               /* la card nunca excede el ancho de pantalla */
}

.mobile-card:hover {
  box-shadow: var(--sombra-md);
}

/* Forzar layout de las filas internas (titulo + checkbox) */
.mobile-card > .d-flex.justify-content-between {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  width: 100%;
}

.mobile-card > .d-flex.justify-content-between > div:first-child {
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
}

.mobile-card > .d-flex.justify-content-between > input[type="checkbox"] {
  flex: 0 0 auto;
  margin-left: 0.5rem;
}

.mobile-card .mobile-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gris);
}

.mobile-card .mobile-value {
  font-size: 0.9rem;
  color: var(--negro);
  font-weight: 500;
}

/* Etiqueta del campo arriba de su valor (ej. "ÁREA" chiquito, luego "1" grande).
   La etiqueta va en .mobile-campo-label; el valor en .mobile-titulo/.mobile-subtitulo. */
.mobile-card .mobile-campo-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gris);
  line-height: 1.2;
  margin-top: 0.35rem;
}
.mobile-card .mobile-campo-label:first-child { margin-top: 0; }

/* ================================================
   Card de KARDEX: estructura de lectura como la tabla.
   Empleado / Razon / fechas / ---- / datos en grid 2 cols / comentario.
   ================================================ */
.kx-card .kx-emp-row { font-size: 0.85rem; color: #475569; }
.kx-card .kx-emp-row .emp-link { color: var(--azul-principal, #1e40af); cursor: pointer; }
.kx-card .kx-razon {
  font-size: 0.95rem; font-weight: 700; color: var(--negro, #0f172a);
  line-height: 1.25; margin-top: 2px;
}
.kx-card .kx-razon .text-muted { font-weight: 600; font-size: 0.8rem; }
.kx-card .kx-fechas { font-size: 0.85rem; color: #334155; margin-top: 4px; }
/* separador antes del grid de datos */
.kx-card .kx-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--gris-borde, #e2e8f0);
}
.kx-card .kx-dato { font-size: 0.84rem; color: #0f172a; }
.kx-card .kx-dato .text-muted { font-size: 0.78rem; }
.kx-card .kx-coment {
  font-size: 0.84rem; color: #475569; margin-top: 8px; word-break: break-word;
}

/* ================================================
   FILTROS COLAPSABLES (movil) — el boton y la card que se oculta.
   El boton .filtros-toggle solo se ve en movil; en desktop oculto.
   La card .filtros-card se colapsa con .filtros-colapsada (solo movil).
   ================================================ */
.filtros-toggle { display: none; }
@media (max-width: 767.98px) {
  .filtros-toggle {
    display: inline-flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    margin-bottom: 0.6rem;
    padding: 0.55rem;
    font-weight: 600;
  }
  .filtros-toggle.abierto .filtros-chevron { transform: rotate(180deg); }
  .filtros-chevron { transition: transform 0.2s ease; }
  /* card de filtros colapsada: se oculta en movil */
  .filtros-card.filtros-colapsada { display: none !important; }

  /* En la card de filtros, TODOS los controles ocupan el ancho completo (parejos).
     El .qs-btn trae max-width:220px de quickselector.css -> lo anulamos aqui.
     Aplica global a catalogos y RH sin tocar cada vista. */
  .filtros-card .form-control,
  .filtros-card .form-select,
  .filtros-card .quick-selector,
  .filtros-card .quick-selector .qs-btn {
    width: 100% !important;
    max-width: none !important;
  }
  /* contenedor del Empleado (input numero + QS lupa al lado): en movil se APILA
     -> el input arriba y el boton/QS "Buscar" abajo, cada uno a todo el ancho. */
  .filtros-card .d-flex:has(> .quick-selector) {
    flex-direction: column;
    align-items: stretch;
  }
  .filtros-card .d-flex:has(> .quick-selector) > .form-control,
  .filtros-card .d-flex:has(> .quick-selector) > .quick-selector,
  .filtros-card .d-flex:has(> .quick-selector) > .quick-selector .qs-btn {
    width: 100% !important;
    max-width: none !important;
  }
}

.mobile-card .mobile-titulo {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--azul-principal);
  text-align: left;
  line-height: 1.2;
}

/* Nombre/descripcion: lo protagonista, grande y oscuro */
.mobile-card .mobile-subtitulo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--negro);
  text-align: left;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

/* Campo de dato LARGO mostrado como linea (email, texto largo) con su etiqueta encima */
.mobile-card .mobile-dato-linea {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--negro);
  text-align: left;
  line-height: 1.3;
  word-break: break-word;
}

/* Badges de datos (Breve, Ingles...): pildora clara con etiqueta y valor diferenciados */
.mobile-card .badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  background: var(--gris-claro, #f1f5f9) !important;
  border: 1px solid var(--gris-borde) !important;
  color: var(--negro) !important;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  /* permitir que el texto largo (direcciones, etc.) haga wrap y NO desborde la card */
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}
.mobile-card .badge .text-muted {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}
/* separador entre el nombre y los datos */
.mobile-card > .d-flex.gap-2.flex-wrap {
  border-top: 1px solid var(--gris-borde);
  padding-top: 0.6rem;
  margin-top: 0.2rem;
}

/* Boton Detalle (expandir sub-tabla): solo visible en movil */
@media (min-width: 768px) {
  .btn-expand { display: none !important; }
}

/* ================================================
   PAGINACION: estilo base (flex horizontal en desktop)
   .pag-info = "1-10 de 140 | [10] /pag"
   .pag-nav  = "[<<] [<] [1] /14 [>] [>>]"
   ================================================ */
.pag-info, .pag-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
/* la pagina actual de texto (inyectada por JS) solo se ve en movil */
.pag-actual-movil { display: none; }

/* ================================================
   MOBILE: ordenar barras superiores (botones + paginacion)
   Aplica a la tabla padre y a las sub-tablas
   ================================================ */
@media (max-width: 767.98px) {

  /* Cabecera del card: apilar en columna (botones arriba, paginacion abajo) */
  .card-header.d-flex.justify-content-between {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  /* Grupo de botones (Nueva, Borrar, Excel, PDF): grid parejo de 2 columnas.
     Especificidad extra (.card-header.d-flex) para ganarle al .d-flex de
     Bootstrap, que carga DESPUES de site.css y tambien usa !important.
     Se EXCLUYE .pag-info: hay card-headers cuyo primer hijo es la paginacion
     (no botones) -ej. Reporteador-, y ahi el grid rompia el ocultamiento. */
  .card-header.d-flex > div:first-child:not(.pag-info):not(.pag-nav),
  .card-header > div:first-child.d-flex:not(.pag-info):not(.pag-nav) {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem !important;
    width: 100%;
  }
  /* cada boton o btn-group ocupa una celda y se estira completo */
  .card-header > div:first-child > .btn,
  .card-header > div:first-child > .btn-group {
    width: 100%;
    min-width: 0;
  }
  .card-header > div:first-child > .btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.4rem;
  }
  /* dentro del btn-group (Excel/PDF + su flechita) el boton principal manda */
  .card-header > div:first-child > .btn-group > .btn:not(.dropdown-toggle-split) {
    flex: 1 1 auto;
    font-size: 0.85rem;
    padding: 0.5rem 0.4rem;
  }
  .card-header > div:first-child > .btn-group > .dropdown-toggle-split {
    flex: 0 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
    min-width: 44px;   /* area tactil minima recomendada para el dedo */
  }
  /* agrandar la flechita (caret) del split */
  .card-header > div:first-child > .btn-group > .dropdown-toggle-split::after {
    transform: scale(1.5);
  }
  /* el boton "Limpiar" (oculto por defecto) ocupa fila completa si aparece */
  #btnLimpiarSel { grid-column: 1 / -1; }

  /* Contenedor de paginacion en mobile: la nav ocupa TODO el ancho */
  .card-header > div:last-child {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: stretch !important;
    gap: 0.3rem !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    border-top: 1px dashed var(--gris-borde);
    padding-top: 0.5rem;
  }
  /* la barra de navegacion crece a todo el ancho disponible */
  .card-header > div:last-child > .pag-nav { flex: 1; width: 100%; min-width: 0; }

  /* El card-footer suele duplicar el paginador (ya esta arriba en el header).
     En movil lo apilamos y contenemos para que NO desborde la pantalla. */
  .card-footer.d-flex.justify-content-between {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem;
  }
  .card-footer.d-flex.justify-content-between > div {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }
  .card-footer .btn-group-sm { min-width: 0; }

  /* Ocultar el separador "|" en mobile */
  .card-header > div:last-child > span.text-muted { display: none; }

  /* Ocultar TODO el bloque info (rango "1-10 de 141" + items por pag) */
  .pag-info { display: none !important; }

  /* navegacion: botones largos que llenan el ancho y son faciles de presionar */
  .pag-nav {
    justify-content: space-between !important;
    flex-wrap: nowrap;
    gap: 0.4rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* cada grupo de flechas (izq y der) se reparte el espacio */
  .pag-nav .btn-group-sm {
    flex: 1;
    min-width: 0;
    display: flex;
  }
  .pag-nav .btn-group-sm > .btn {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.4rem;
    font-size: 1.05rem;
  }
  /* "ir a pagina exacta" oculto: en su lugar el texto de pagina actual (.pag-actual-movil) */
  .pag-nav input[type="number"] { display: none; }
  .pag-actual-movil {
    display: inline-block;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 0 0.3rem;
    white-space: nowrap;
  }

  /* ===== SUB-TABLAS: barra superior (Nueva/Borrar/Excel/PDF + paginacion) =====
     GLOBAL e independiente de la estructura: una barra de sub-tabla es cualquier
     div.d-flex.justify-content-between que CONTENGA un contenedor de paginacion
     con id "*Paginacion-*". Asi cubre tanto las que estan en tabs (.tab-pane)
     como las de detalle directo (Categorias, etc.). Usa :has(). */
  .d-flex.justify-content-between:has(> [id*="Paginacion-"]) {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  /* Grupo de botones: grid parejo de 2 columnas (igual que la tabla principal) */
  .d-flex.justify-content-between:has(> [id*="Paginacion-"]) > div:first-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem !important;
    width: 100%;
  }
  .d-flex.justify-content-between:has(> [id*="Paginacion-"]) > div:first-child > .btn,
  .d-flex.justify-content-between:has(> [id*="Paginacion-"]) > div:first-child > .btn-group {
    width: 100%;
    min-width: 0;
    font-size: 0.85rem;
    padding: 0.5rem 0.4rem;
  }
  /* el boton "Limpiar" oculto no debe dejar hueco: ocupa fila completa si aparece */
  .d-flex.justify-content-between:has(> [id*="Paginacion-"]) > div:first-child > [id*="BtnLimpiar"] {
    grid-column: 1 / -1;
  }

  /* Separador visual entre botones y paginacion */
  .d-flex.justify-content-between:has(> [id*="Paginacion-"]) > div:last-child {
    border-top: 1px dashed var(--gris-borde);
    padding-top: 0.4rem;
  }

  /* Contenedor de paginacion: la nav a todo el ancho (cualquier prefijo) */
  [id*="Paginacion-"] {
    display: flex !important;
    flex-direction: row !important;
    justify-content: stretch !important;
    align-items: center !important;
    gap: 0.4rem !important;
    width: 100%;
  }
  [id*="Paginacion-"] > .pag-nav {
    flex: 1;
    width: 100%;
  }

  /* ===== FORM INLINE de "Nuevo" en sub-tablas (GLOBAL, mobile) =====
     Cualquier form inline de sub-tabla tiene id "*Form-*". En movil sus
     columnas (col-*) se aplastan; aqui las forzamos a apilar 2 por fila
     y la fila de botones a ocupar el ancho completo. Cubre todas las
     sub-tablas sin tocar cada vista. */
  [id*="Form-"] > .row > [class*="col-"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
  /* la columna que contiene los botones Guardar/Cancelar: ancho completo abajo */
  [id*="Form-"] > .row > [class*="col-"]:has(> .btn),
  [id*="Form-"] > .row > [class*="col-"]:has(.btn-primary) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    display: flex;
    gap: 0.4rem;
    margin-top: 0.3rem;
  }
  [id*="Form-"] > .row > [class*="col-"]:has(> .btn) > .btn,
  [id*="Form-"] > .row > [class*="col-"]:has(.btn-primary) > .btn {
    flex: 1;
  }
}

/* ================================================
   Submenu dropend - posicionamiento
   ================================================ */
.dropend > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-left: 0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ================================================
   Tablas - Columnas auto-ajustadas al contenido (patron Centinela)
   ================================================
   La tabla ocupa el 100% del card. Las columnas se autoajustan al
   contenido y se compactan a la izquierda. La ULTIMA columna (th/td)
   crece para tomar el sobrante asi llena hasta el borde derecho del card
   y no se ve cortada la tabla.
   ================================================ */
.card .table th {
    white-space: nowrap;
    padding-left: 12px;
    padding-right: 12px;
    width: 1px;
}

.card .table td {
    padding-left: 12px;
    padding-right: 12px;
    white-space: nowrap;
    width: 1px;
}

/* Ultima columna: se estira hasta el borde derecho. */
.card .table thead tr th:last-child,
.card .table tbody tr td:last-child {
    width: auto;
}

/* Columna auxiliar (spacer): absorbe el sobrante en tablas con pocas columnas
   para que la ultima columna real NO se estire y su dato quede pegado a ella.
   Se usa agregando <th class="col-spacer"></th> y <td class="col-spacer"></td>
   al final de cada fila. Vacia, sin padding, ocupa el espacio restante. */
.card .table th.col-spacer,
.card .table td.col-spacer {
    width: auto;
    padding: 0;
    border: 0;
}

/* Columna que puede partirse en lineas si el contenido es muy largo. */
.card .table th.col-stretch,
.card .table td.col-stretch {
    white-space: normal;
    max-width: 400px;
}

/* Textos largos - truncar y mostrar tooltip */
.cell-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    color: inherit;
}

.cell-truncate:hover {
    text-decoration: underline;
    color: var(--azul-principal);
}

/* ================================================
   Boton EDITAR (lapicito) -> azul celeste GLOBAL
   ================================================
   En todo el sistema el boton de editar es un .btn.btn-warning con un
   icono bi-pencil dentro. Lo pintamos azul #3b82f6 (mismo de ModSalario
   Individual) sin tocar las vistas: usamos :has() para detectar el lapiz.
   No afecta a otros btn-warning (alertas, etc.) que no llevan bi-pencil. */
.btn.btn-warning:has(.bi-pencil),
.btn.btn-warning:has(.bi-pencil-fill) {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #fff !important;
}
.btn.btn-warning:has(.bi-pencil):hover,
.btn.btn-warning:has(.bi-pencil-fill):hover {
    background: #2f6fd6 !important;
    border-color: #2f6fd6 !important;
    color: #fff !important;
}

/* ================================================
   Boton flotante "volver arriba" (global).
   Aparece cuando bajas y te detienes; se oculta al scrollear.
   Se coloca arriba del FAB de soporte (bottom:20px) para no encimarse.
   ================================================ */
.btn-scroll-top {
    position: fixed;
    right: 20px;
    bottom: 84px;                 /* arriba del FAB de soporte */
    z-index: 1039;                /* debajo de modales (1050+) y del FAB soporte (1040) */
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--azul-principal, #1e3a8a);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    cursor: pointer;
    /* oculto por default: sin desplazamiento y sin eventos */
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}
.btn-scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.btn-scroll-top:hover { background: #2f6fd6; }
/* Con un modal abierto lo escondemos (el modal manda) */
body.modal-open .btn-scroll-top { display: none !important; }

/* ================================================
   Control de "Ordenar" GLOBAL para cards moviles (sort-global.js / CardSort).
   Dropdown de campo + boton de direccion. Solo visible en movil (d-md-none).
   ================================================ */
.cardsort-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--gris-borde, #e2e8f0);
}
.cardsort-control .cardsort-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gris, #64748b);
    margin: 0;
    white-space: nowrap;
}
/* Select y boton mas grandes para usarse comodo con el dedo en movil */
.cardsort-control .cardsort-select {
    flex: 1;
    min-width: 0;
    height: 2.6rem;
    font-size: 1rem;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
}
.cardsort-control .cardsort-dir {
    flex: 0 0 auto;
    height: 2.6rem;
    width: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
