/* ==========================================================
   LISTADOS: PESTAÑAS, TOPINFO, FILTROS Y TABLAS
   Se carga después de style.css y forms.css (usa sus variables --frm-*).
   - Pestañas:  nav#pestanas / #pestanas-doble-nivel  (clase menu, _clases/widgets.php)
   - Topinfo:   div.topinfo > span.saldo               (topinfo(), _clases/widgets.php)
   - Filtros:   form.filtros_                          (clase filtros, _clases/formularios.php)
   - Tablas:    div.table + list.js                    (clase table, _clases/llamadas.php)
   ========================================================== */
:root {
  --lst-panel:        #e9eef5;
  --lst-linea:        #e6ebf1;
  --lst-hover:        #f3f7fe;
  --lst-texto-suave:  #5b6577;
  --lst-verde:        #1e7a52;
}

/* ===== PESTAÑAS ===== */
body #pestanas {
  border-bottom: none;
  padding: 0;
  margin: 0 1%;
  width: 98%;
}
body #pestanas ul {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px;
}
body #pestanas li:first-child { margin-left: 0; }
body #pestanas li a,
body #pestanas li.activo a,
body #pestanas li:hover a {
  float: none;
  margin: 0;
  padding: 10px 12px;
  background-color: #fff;
  border: 1px solid var(--frm-borde);
  border-bottom: none;
  border-radius: 8px 8px 0 0 !important;
  color: var(--lst-texto-suave);
  font-size: 11.5px;
  font-weight: normal;
  letter-spacing: .2px;
  transition: color .15s, background-color .15s;
}
body #pestanas li:hover a {
  color: var(--frm-titulo);
  background-color: var(--frm-acento-fondo);
}
body #pestanas li.activo a {
  margin-top: 0;
  padding: 11px 16px 10px;
  color: var(--lst-verde);
  font-size: 14px;
  font-weight: bold;
  box-shadow: inset 0 -3px 0 var(--lst-verde);
}

/* Pestañas de segundo nivel */
body #pestanas-doble-nivel {
  width: 98%;
  gap: 4px;
  padding: 8px 8px 0;
  background-color: transparent;
}
body #pestanas-doble-nivel ul { gap: 4px; }
body #pestanas-doble-nivel li a,
body #pestanas-doble-nivel li.activo a {
  padding: 8px 12px !important;
  background-color: #fff !important;
  border: 1px solid var(--frm-borde);
  border-radius: 6px;
  color: var(--lst-texto-suave);
  font-size: 11.5px;
}
body #pestanas-doble-nivel li:hover a { color: var(--frm-titulo); background-color: var(--frm-acento-fondo) !important; }
body #pestanas-doble-nivel li.activo a {
  border-color: var(--frm-acento);
  background-color: var(--frm-acento-fondo) !important;
  color: var(--frm-acento);
  font-weight: bold;
}

/* ===== TOPINFO (tarjetas de totales) ===== */
body div.topinfo {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 98%;
  margin: 0 1% 16px;
  padding: 16px;
  box-sizing: border-box;
  background: var(--lst-panel);
  border-radius: 0 10px 10px 10px;
  text-align: left !important;
}
/* Los <div style="clear:both"> separan renglones (sin sumar el gap de su renglón vacío);
   el contenido extra ($data['contenido']) ocupa todo el ancho */
body div.topinfo > :not(.saldo) { flex-basis: 100%; margin: 0; }
body div.topinfo > div[style*="clear"] { height: 0; margin-top: -12px; }
body div.topinfo .saldo {
  float: none;
  width: calc(25% - 9px);
  min-width: 180px;
  margin: 0;
  padding: 14px 16px;
  box-sizing: border-box;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}
body div.topinfo .saldo br { display: none; }
body div.topinfo .saldo b.text {
  text-align: left;
  margin: 0 0 6px;
  color: var(--frm-titulo);
  font-size: 11px;
  letter-spacing: .3px;
}
body div.topinfo .saldo b.valor {
  text-align: left;
  color: var(--frm-titulo) !important;
  font-size: 24px;
  line-height: 1.2;
}
/* Tarjeta TOTAL (clase agregada en topinfoitem(), _clases/widgets.php) */
body div.topinfo .saldo.total b.valor { color: var(--lst-verde) !important; }

/* ===== OPCIONES DE FILTRADO ===== */
body form.filtros_ {
  position: relative;
  box-sizing: border-box;
  width: 98% !important;
  min-width: 0;
  margin: 0 1% 16px;
  padding: 0 20px 16px !important;
  background-color: #fff;
  border: 1px solid var(--frm-borde);
  border-radius: 10px !important;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}
body form.filtros_ h4 {
  margin: 0;
  padding: 16px 0 14px 48px;
  line-height: 24px;
  color: var(--frm-titulo);
  font-size: 15px;
  font-weight: bold;
}
body form.filtros_ .abrircerrar {
  position: absolute;
  top: 12px;
  left: 18px;
  width: 32px;
  height: 32px;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid var(--frm-borde-input);
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M1 7h12' stroke='%23090b41' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center center;
  background-size: 14px 14px;
}
body form.filtros_.closed .abrircerrar {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M7 1v12M1 7h12' stroke='%23090b41' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
body form.filtros_ .abrircerrar:hover { background-color: var(--frm-acento-fondo); }
body form.filtros_.closed {
  max-height: 54px;
  padding-bottom: 0 !important;
}
/* Cerrado: solo título y botón; los campos no asoman por la orilla */
body form.filtros_.closed > :not(h4):not(.abrircerrar) { visibility: hidden; }

/* ===== TARJETA DE LA TABLA ===== */
body div.table {
  width: 98%;
  margin: 0 1% 20px;
  padding: 20px 16px 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}
body div.table > h4 {
  float: left;
  margin: 0 0 14px;
  color: var(--frm-titulo);
  font-size: 24px;
  font-weight: bold;
  line-height: 1.25;
  text-transform: uppercase;
}
/* <small> del título: botones del reporte (DESCARGAR, subir factura...) junto al título */
body div.table > h4 small {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  color: var(--lst-texto-suave);
  font-size: 13px;
  font-weight: normal;
  text-transform: none;
}
body div.table > h4 small .boton {
  float: none;
  display: inline-block;
  margin: -4px 6px 0 0 !important;
  padding: 7px 10px 6px !important;
  font-size: 11px;
  text-transform: uppercase;
}
/* Botones directo en el título (sin <small>, ej. _nomina_new.php): style.css les pone
   float: inherit !important y heredaban el float: left del h4, quedando arriba del texto */
body div.table > h4 > .boton {
  float: none !important;
  display: inline-block;
  vertical-align: middle;
  margin: -4px 0 0 6px !important;
  padding: 7px 10px 6px !important;
  font-size: 11px;
  text-transform: uppercase;
}

/* Info del reporte (ej. "05 de septiembre 2026 al ..."): debajo del título, a la izquierda.
   Ambos flotan a la izquierda para que la barra de búsqueda quede a la derecha del título. */
body div.table > h4:has(+ p.info) { margin-bottom: 2px; }
body div.table > p.info {
  float: left;
  clear: left;
  margin: 0 0 12px;
  padding: 0;
  color: var(--lst-texto-suave);
  font-size: 12.5px;
}
/* Sin datos (_clases/llamadas.php): <p> sin clase con la fecha + "No se encontraron datos".
   Empieza debajo del título en lugar de acomodarse a su lado. */
body div.table > h4:has(+ p:not(.info)) { margin-bottom: 2px; }
body div.table > p:not(.info) {
  clear: left;
  margin: 0;
  padding: 0;
  color: var(--lst-texto-suave);
  font-size: 12.5px;
}
/* trae dos <br> entre la fecha y el mensaje: con uno basta */
body div.table > p:not(.info) br + br { display: none; }
body div.table > p:not(.info) i { display: inline-block; margin-top: 10px; color: var(--lst-texto-suave); }
/* Tablas dentro de formularios/modales: sin la tarjeta (ya están en una) */
body form div.table { box-shadow: none; }
body form div.table > h4 { float: none; }

/* Barra de búsqueda / registros por página (list.js) */
body .cultyvo-filter {
  /* sin float (style.css lo flota a la derecha): un flotante no puede quedar más arriba
     que el flotante anterior (la fecha bajo el título) y la barra bajaba a esa altura.
     Como flex sin float se acomoda junto a los flotantes, arriba, a la altura del título. */
  float: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
}
body input.cultyvo-filter-search {
  width: 190px;
  height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--frm-borde-input);
  border-radius: 6px;
  background-color: #fff;
  color: var(--frm-texto);
  font-size: 13px;
}
body input.cultyvo-filter-search:first-child {
  padding-left: 32px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6577' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center;
  background-size: 15px 15px;
}
body input.cultyvo-filter-search:focus {
  border-color: var(--frm-acento);
  box-shadow: 0 0 0 3px var(--frm-anillo);
}
body .cultyvo-filter-button {
  height: 34px;
  margin: 0;
  padding: 0 14px;
  border-radius: 6px;
  background-color: #eef2f7;
  color: var(--lst-texto-suave);
  font-size: 13px;
  transition: background-color .15s, color .15s;
}
body .cultyvo-filter-button:hover { background-color: #e1e8f1; color: var(--frm-titulo); }
body .cultyvo-filter-button.active {
  background-color: var(--frm-acento);
  color: #fff;
}

/* Paginación */
body ul.cultyvo-paginacion {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  clear: both;
  margin: 4px 0 12px;
  padding: 0;
}
body ul.cultyvo-paginacion li { margin: 0; font-size: 12px; }
body ul.cultyvo-paginacion li .page {
  display: inline-block;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  box-sizing: border-box;
  border: 1px solid var(--frm-borde);
  border-radius: 6px;
  background-color: #fff;
  color: var(--lst-texto-suave);
  line-height: 26px;
  text-align: center;
}
body ul.cultyvo-paginacion li .page:hover {
  border-color: var(--frm-acento);
  color: var(--frm-acento);
}
body ul.cultyvo-paginacion li.active .page {
  border-color: var(--frm-acento);
  background-color: var(--frm-acento-fondo);
  color: var(--frm-acento);
  font-size: 12px;
  font-weight: bold;
}
body ul.cultyvo-paginacion li.disabled .page {
  border-color: transparent;
  background: transparent;
}

/* ===== TABLA ===== */
/* Texto de las celdas en todas las tablas. Especificidad baja a propósito:
   las clases de color de celdas/renglones (red, green, ligas...) siguen ganando. */
body table td { color: #111316; }

body div.table table {
  clear: both;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--lst-linea);
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
}
body div.table table thead th,
body div.table table th {
  padding: 8px 3px;
  background-color: var(--frm-tabla-head);
  border-bottom: 1px solid var(--lst-linea);
  color: var(--frm-subtitulo);
  font-size: 11px;
  font-weight: bold;
}
body div.table table td {
  /* mismas medidas que style.css para que la tabla siga cabiendo */
  padding: 4px 3px;
  border-bottom: 1px solid var(--lst-linea);
  font-size: 11px;
}
body div.table table td + td,
body div.table table th + th { border-left: 1px solid var(--lst-linea); }
body div.table table tbody tr:last-child td { border-bottom: none; }
body div.table table tfoot td {
  background-color: #f8fafc !important;
  font-weight: bold;
}
/* Hover de renglón: azul muy claro (antes azul fuerte) */
body table.trselect tbody tr:hover,
body div.table table tbody tr:hover { background-color: transparent !important; }
body table.trselect tbody tr:hover td,
body div.table table tbody tr:hover td { background-color: var(--lst-hover) !important; }

/* Encabezados ordenables: flecha SVG en lugar de la imagen */
body .cultyvo-filter-sort:hover,
body .cultyvo-filter-sort.desc,
body .cultyvo-filter-sort.asc:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2313235b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 9px 6px;
}
body .cultyvo-filter-sort.asc,
body .cultyvo-filter-sort.desc:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 5l4-4 4 4' fill='none' stroke='%2313235b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 9px 6px;
}
