/* Gestión y Aplicación de Prima x Aplicar
   Extiende el layout compartido de Facturas/Cobros sin introducir otra paleta. */

.pxa-page {
  gap: 10px;
}

.pxa-page > .pxa-tabs {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 2px;
  border-top: 1px solid #edf2f7;
  border-bottom: 1px solid #dbe5f1;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}

.pxa-page > .pxa-tabs .nav-link {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 18px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.pxa-page > .pxa-tabs .nav-link.active {
  font-weight: 800;
}

.pxa-page > .tab-content,
.pxa-page > .tab-content[hidden] {
  display: none !important;
}

.pxa-page > #tab-lista.tab-content.active,
.pxa-page > #tab-trazabilidad.tab-content.active,
.pxa-page > #tab-aprobacion.tab-content.active {
  display: flex !important;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

/* #tab-cobro/#tab-credito ya NO son pestañas propias (fusionadas en la
   única pestaña "Aplicación", #tab-aplicacion) — son divs internos cuya
   visibilidad alterna configurarNavegacionAplicacion() por style.display
   inline según el origen (COB/CRE) del saldo seleccionado. */
.pxa-page > #tab-aplicacion.tab-content.active {
  display: block !important;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 4px 12px;
  border: 0;
  overflow: auto;
  box-sizing: border-box;
}

.pxa-page .facturas-toolbar {
  min-height: 48px;
}

.pxa-workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* En este módulo el host y el panel KRE son el mismo <aside>. Las reglas
   compartidas de Facturas esperan dos elementos anidados, por eso se replica
   explícitamente el contrato para el elemento combinado. El efecto de
   apertura/cierre (transición suave de width/opacity/margin, sin
   display:none) es intencionalmente el MISMO que usa el componente
   compartido .kre-filter-panel.filter-sidebar (crudStyles.css) — el que
   ya usan Facturas y, vía FilterManager, Registro de Cobros — para que
   Prima x Aplicar se sienta igual al resto de la app. */
.pxa-page .facturas-filter-host.kre-filter-panel.filter-sidebar {
  width: 0;
  max-width: 300px;
  height: 100%;
  max-height: none;
  margin-left: -20px;
  opacity: 0;
  border: 1px solid #dbe5f0;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              margin-left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              opacity 0.3s ease,
              border-width 0s linear 0.4s;
}

.pxa-page .facturas-filter-host.kre-filter-panel.filter-sidebar.open {
  width: 300px;
  margin-left: 0;
  opacity: 1;
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              margin-left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              opacity 0.3s ease;
}

.pxa-page .facturas-filter-host.kre-filter-panel.filter-sidebar:not(.open) {
  border-width: 0;
  padding: 0;
}

.pxa-page .facturas-filter-host .sidebar-header {
  min-height: auto;
  padding: 12px;
}

.pxa-page .facturas-filter-host .sidebar-body {
  overflow-y: auto;
  min-height: 0;
}

.pxa-page .facturas-results-card,
.pxa-tab-results {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  height: auto;
}

.pxa-page .facturas-workspace.filters-collapsed .facturas-results-card {
  width: 100%;
  border-radius: 8px;
}

.pxa-page .facturas-table-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
}

.pxa-page .cell-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.25;
}

.pxa-page .cell-main,
.pxa-page .cell-sub {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pxa-page .cell-main { color: #17324d; font-weight: 700; }
.pxa-page .cell-sub { color: #64748b; font-size: 11px; }
.pxa-page .data-value { max-width: none; }

/* Botones contextuales: se conserva el mismo action-trigger de los
   listados de Clientes/Facturas/Cobros. Estas reglas solo evitan que los
   wrappers compactos de Prima x Aplicar recorten el botón al aparecer. */
.pxa-page .pxa-action-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  overflow: visible !important;
  text-overflow: clip;
  white-space: normal;
}

/* Las líneas que combinan etiquetas y disparadores deben conservar el flujo
   de texto original. Solo liberamos el overflow para que el botón contextual
   pueda aparecer encima sin convertir Doc./Póliza/Ramo en ítems flex. */
.pxa-page .pxa-action-line {
  display: block;
  max-width: 100%;
  overflow: visible !important;
  text-overflow: clip;
}

.pxa-page .pxa-action-trigger {
  max-width: 100%;
  vertical-align: middle;
}

.pxa-page .pxa-action-trigger .facturas-trigger-label {
  color: inherit;
  text-decoration: none;
}

.pxa-page .pxa-action-trigger:focus-within .floating-action-button {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.pxa-grid-table td:nth-child(2),
.pxa-trace-table td:nth-child(2),
.pxa-trace-table td:nth-child(3),
.pxa-trace-table td:nth-child(4) {
  overflow: visible;
}

.pxa-grid-table th,
.pxa-grid-table td,
.pxa-application-table th,
.pxa-application-table td,
.pxa-trace-table th,
.pxa-trace-table td,
.pxa-approval-table th,
.pxa-approval-table td {
  max-width: none;
  box-sizing: border-box;
}

.pxa-grid-table {
  min-width: 1260px;
}

.pxa-grid-table th:nth-child(1),
.pxa-grid-table td:nth-child(1) { width: 64px; text-align: center; }
.pxa-grid-table th:nth-child(2),
.pxa-grid-table td:nth-child(2) { width: 270px; }
.pxa-grid-table th:nth-child(3),
.pxa-grid-table td:nth-child(3) { width: 230px; }
.pxa-grid-table th:nth-child(4),
.pxa-grid-table td:nth-child(4) { width: 170px; }
.pxa-grid-table th:nth-child(5),
.pxa-grid-table td:nth-child(5) { width: 210px; text-align: center; }
.pxa-grid-table th:nth-child(6),
.pxa-grid-table td:nth-child(6) { width: 190px; }
.pxa-grid-table th:nth-child(7),
.pxa-grid-table td:nth-child(7) { width: 112px; text-align: center; }

.pxa-grid-table td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.pxa-grid-table thead th:last-child,
.pxa-grid-table tbody td:last-child,
.pxa-approval-table thead th:last-child,
.pxa-approval-table tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 70;
  background: #fff;
  box-shadow: -6px 0 8px -7px rgba(15, 23, 42, .35);
}

.pxa-grid-table thead th:last-child,
.pxa-approval-table thead th:last-child {
  z-index: 90;
  background: #347df5 !important;
}

.pxa-grid-table tbody tr:nth-child(even) td:last-child,
.pxa-approval-table tbody tr:nth-child(even) td:last-child { background: #f8fbff; }
.pxa-grid-table tbody tr:hover td:last-child,
.pxa-approval-table tbody tr:hover td:last-child { background: #eef6ff; }

.pxa-balance-box {
  min-width: 112px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 5px 10px;
  border: 1px solid #19a966;
  border-radius: 6px;
  background: #ecfdf5;
  color: #047857;
  text-align: right;
  box-sizing: border-box;
}

.pxa-balance-box .lbl {
  margin-bottom: 2px;
  color: #059669;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.pxa-balance-box .val {
  color: #047857;
  font-family: Consolas, monospace;
  font-size: 14px;
  font-weight: 800;
}

.pxa-origen-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.pxa-origen-badge.cob { background: #10b981; }
.pxa-origen-badge.cre { background: #dc2626; }

.pxa-transaction-type {
  max-width: 100%;
  color: #64748b;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.pxa-age-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 3px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.pxa-document-total {
  width: 100%;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 10px;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.pxa-document-total strong {
  color: #17324d;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.pxa-team-cell .data-pair {
  grid-template-columns: 34px minmax(0, 1fr);
}

.pxa-team-cell .data-value {
  white-space: normal;
  overflow-wrap: anywhere;
}

.pxa-nav-disabled {
  opacity: .46;
  cursor: not-allowed !important;
  pointer-events: none;
}

.pxa-placeholder {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 3rem;
  color: #64748b;
  text-align: center;
}

.pxa-placeholder i { color: #cbd5e1; font-size: 42px; }
.pxa-placeholder h3 { margin: 0; color: #17324d; }
.pxa-placeholder p { margin: 0; }

.pxa-application-card {
  width: min(100%, 1380px) !important;
  max-width: 1380px !important;
  min-height: min-content;
  margin: 12px auto !important;
  padding: 20px 22px !important;
  overflow: visible;
  box-sizing: border-box;
}

.pxa-application-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e9eef5;
  color: #17324d;
  font-size: 20px;
}

.pxa-context-grid {
  display: grid;
  grid-template-columns: minmax(230px, 2fr) repeat(3, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fafc;
}

.pxa-context-grid .data-pill {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pxa-context-grid .data-pill .label {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pxa-context-grid .data-pill .value {
  overflow-wrap: anywhere;
  color: #17324d;
  font-size: 14px;
  font-weight: 800;
}

.pxa-context-grid .data-pill .value.pxa-saldo-disponible {
  color: #047857;
}

.pxa-required {
  color: #dc2626;
  font-size: 14px;
  font-weight: 900;
}

.pxa-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pxa-form-section {
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.pxa-form-section h4 {
  margin: 0 0 10px;
  color: #1f6feb;
  font-size: 14px;
}

.pxa-form-help {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-left: 3px solid #347df5;
  border-radius: 4px;
  background: #f4f8fd;
  color: #55606d;
  font-size: 12px;
  line-height: 1.45;
}

.pxa-destination-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

#pxaCobroClienteDestino,
#pxaCreditoClienteDestino {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-family: inherit;
  font-weight: 700;
  box-sizing: border-box;
}

.pxa-cross-alert {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f5cf62;
  border-radius: 6px;
  background: #fffbeb;
  color: #8a6200;
  font-size: 12px;
}

.pxa-cross-reason {
  margin-top: 12px;
}

.pxa-cross-reason textarea,
#pxaResolverObservacion {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  box-sizing: border-box;
  resize: vertical;
}

.pxa-application-table-wrap {
  max-height: 330px;
  overflow: auto;
  border: 1px solid #dbe5f0;
  border-radius: 6px;
}

.pxa-application-table {
  min-width: 820px !important;
}

/* Paso 2 — Selección de facturas (checkbox, factura, póliza, vigencia, balance) */
.pxa-application-table[id$="Seleccion"] th:nth-child(1),
.pxa-application-table[id$="Seleccion"] td:nth-child(1) { width: 44px; text-align: center; }
.pxa-application-table[id$="Seleccion"] th:nth-child(2),
.pxa-application-table[id$="Seleccion"] td:nth-child(2) { width: 140px; }
.pxa-application-table[id$="Seleccion"] th:nth-child(3),
.pxa-application-table[id$="Seleccion"] td:nth-child(3) { width: 180px; }
.pxa-application-table[id$="Seleccion"] th:nth-child(4),
.pxa-application-table[id$="Seleccion"] td:nth-child(4) { width: 160px; }
.pxa-application-table[id$="Seleccion"] th:nth-child(5),
.pxa-application-table[id$="Seleccion"] td:nth-child(5) { width: 140px; text-align: right; }

/* Paso 3 — Distribución del monto (factura, vigencia, balance, monto, concepto) */
.pxa-application-table[id$="Distribucion"] th:nth-child(1),
.pxa-application-table[id$="Distribucion"] td:nth-child(1) { width: 140px; }
.pxa-application-table[id$="Distribucion"] th:nth-child(2),
.pxa-application-table[id$="Distribucion"] td:nth-child(2) { width: 160px; }
.pxa-application-table[id$="Distribucion"] th:nth-child(3),
.pxa-application-table[id$="Distribucion"] td:nth-child(3) { width: 120px; text-align: right; }
.pxa-application-table[id$="Distribucion"] th:nth-child(4),
.pxa-application-table[id$="Distribucion"] td:nth-child(4) { width: 150px; text-align: right; }
.pxa-application-table[id$="Distribucion"] th:nth-child(5),
.pxa-application-table[id$="Distribucion"] td:nth-child(5) { width: 220px; }

.pxa-application-table input[type="number"] {
  width: 100%;
  min-width: 100px;
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  text-align: right;
  font-family: Consolas, monospace;
  box-sizing: border-box;
}

.pxa-application-table input[type="text"].pxa-concepto-input {
  width: 100%;
  min-width: 140px;
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 12px;
}

.pxa-agreements-panel {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.pxa-agreements-panel i { margin-top: 2px; color: #94a3b8; }

.pxa-btn-disabled {
  opacity: .55;
  cursor: not-allowed !important;
  pointer-events: none;
}

.pxa-page .total-box {
  min-height: 46px;
  margin: 12px 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #dbe5f0;
  border-radius: 7px;
  background: #f8fafc;
  box-sizing: border-box;
}

.pxa-page .total-box span:first-child { color: #17324d; font-size: 14px; font-weight: 800; }
.pxa-page .total-box-amount { color: #1f6feb; font-family: Consolas, monospace; font-size: 18px; font-weight: 800; }

.pxa-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pxa-secondary-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
}

/* Resalta por un momento la fila recién aplicada al llegar a Trazabilidad
   desde "Registrar Aplicación" — confirma visualmente que la prima se
   aplicó correctamente, en vez de dejar al usuario sin ninguna evidencia
   inmediata del resultado. Se retira via JS (renderTrazabilidad) a los 3s. */
@keyframes pxaDestacarFila {
  0%, 55% { background-color: #d1fae5; }
  100% { background-color: transparent; }
}
.pxa-trace-table tbody tr.pxa-fila-destacada td {
  animation: pxaDestacarFila 3s ease-out forwards;
}

.pxa-trace-table { min-width: 1220px; }
.pxa-trace-table th:nth-child(1), .pxa-trace-table td:nth-child(1) { width: 65px; text-align: center; }
.pxa-trace-table th:nth-child(2), .pxa-trace-table td:nth-child(2) { width: 250px; }
.pxa-trace-table th:nth-child(3), .pxa-trace-table td:nth-child(3) { width: 345px; }
.pxa-trace-table th:nth-child(4), .pxa-trace-table td:nth-child(4) { width: 180px; }
.pxa-trace-table th:nth-child(5), .pxa-trace-table td:nth-child(5) { width: 150px; text-align: center; }
.pxa-trace-table th:nth-child(6), .pxa-trace-table td:nth-child(6) { width: 210px; }

.pxa-trace-policy,
.pxa-cross-date {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.pxa-page .pxa-trace-policy.pxa-single-line {
  white-space: nowrap !important;
}

.pxa-cross-date {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

.pxa-trace-invoice-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
  padding: 5px 7px;
  border-left: 3px solid #347df5;
  border-radius: 4px;
  background: #f1f8ff;
}

.pxa-trace-invoice-item {
  color: #334155;
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pxa-trace-invoice-item em {
  color: #64748b;
  font-style: italic;
  font-weight: 700;
}

/* El pie de esta tabla (totales por moneda) ya NO tiene reglas propias:
   usa exactamente las mismas — .facturas-table tfoot td / tfoot
   tr.facturas-total-usd td en crudStyles.css — que ya usa Lista de Saldos,
   para que el diseño, el negro del total en pesos y el verde del total en
   dólares sean pixel-idénticos entre las dos pestañas (ver
   renderTotalesTrazabilidad en primaXAplicar.js). */

/* Espaciado generoso entre columnas — las columnas angostas (Solicitud,
   Monto, Estatus, Acción) no necesitan mucho ANCHO, pero sí más padding
   para que sus encabezados y su contenido no queden pegados a la columna
   vecina (regresión reportada: "Monto Solicitado" y "Motivo" se veían
   pegados). box-sizing:border-box (regla compartida más arriba) hace que
   el padding se reste del width fijo, no se sume — por eso también se
   ajustaron los anchos. */
.pxa-approval-table { min-width: 1140px; }
.pxa-approval-table th,
.pxa-approval-table td { padding: 12px 16px; }
.pxa-approval-table th:nth-child(1), .pxa-approval-table td:nth-child(1) { width: 100px; text-align: center; }
.pxa-approval-table th:nth-child(2), .pxa-approval-table td:nth-child(2) { width: 260px; white-space: normal; overflow-wrap: anywhere; }
.pxa-approval-table th:nth-child(3), .pxa-approval-table td:nth-child(3) { width: 160px; text-align: center; }
.pxa-approval-table th:nth-child(4), .pxa-approval-table td:nth-child(4) { width: 260px; white-space: normal; overflow-wrap: anywhere; }
.pxa-approval-table th:nth-child(5), .pxa-approval-table td:nth-child(5) { width: 140px; text-align: center; }
.pxa-approval-table th:nth-child(6), .pxa-approval-table td:nth-child(6) { width: 220px; text-align: center; }

.pxa-approval-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.pxa-legacy-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 150px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 0.3rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.15;
}

.pxa-status-filter {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
}

.pxa-status-filter label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.badge-pendiente { background: #f59e0b; color: #fff; }
.status-badge.badge-aprobado { background: #10b981; color: #fff; }
.status-badge.badge-rechazado { background: #dc2626; color: #fff; }

.pxa-cliente-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  background: #fff;
  color: #17324d;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.pxa-cliente-row:last-child { border-bottom: 0; }
.pxa-cliente-row span { color: #64748b; font-size: 12px; }
.pxa-cliente-row:hover,
.pxa-cliente-row:focus-visible { background: #f1f5f9; outline: 2px solid #347df5; outline-offset: -2px; }

.pxa-page .pagination-container {
  min-height: 52px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid #e8eef5;
  background: #fff;
  box-sizing: border-box;
}

.pxa-page .pagination-info { color: #516579; font-size: 12px; font-weight: 700; }
.pxa-page .pagination-controls { display: flex; gap: 5px; }
.pxa-page .page-btn {
  min-width: 31px;
  height: 31px;
  padding: 0 8px;
  border: 1px solid #d4dee9;
  border-radius: 6px;
  background: #fff;
  color: #18314f;
  cursor: pointer;
  font-weight: 800;
}
.pxa-page .page-btn.active { border-color: #2f7df2; background: #2f7df2; color: #fff; }
.pxa-page .page-btn:disabled { color: #a5b1c2; cursor: not-allowed; }

@media (max-width: 1200px) {
  .pxa-body { overflow: auto; }
  .pxa-body #main-content { height: auto; min-height: 100vh; overflow: visible; }
  .pxa-page > #tab-lista.tab-content.active,
  .pxa-page > #tab-trazabilidad.tab-content.active,
  .pxa-page > #tab-aprobacion.tab-content.active { overflow: visible; }
  .pxa-workspace { flex-direction: column; overflow: visible; }
  /* Bajo 1200px el layout pasa de fila (sidebar + tabla lado a lado) a
     columna (sidebar arriba, tabla abajo) — por eso aquí "colapsado" ya no
     puede animarse por width (siempre es 100%). Se anima por max-height en
     su lugar, con el mismo par de curvas/timings que la variante de
     escritorio, para que el efecto se sienta igual en cualquier ancho. */
  .pxa-page .facturas-filter-host.kre-filter-panel.filter-sidebar {
    width: 100%;
    max-width: none;
    height: auto;
    max-height: 0;
    margin-left: 0;
    border-right: 1px solid #dbe5f0;
    border-radius: 8px 8px 0 0;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
                opacity 0.3s ease,
                border-width 0s linear 0.4s;
  }
  .pxa-page .facturas-filter-host.kre-filter-panel.filter-sidebar.open {
    max-height: 3000px;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
                opacity 0.3s ease;
  }
  .pxa-page .facturas-results-card { min-height: 520px; border-radius: 0 0 8px 8px; }
  .pxa-context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .pxa-page > .pxa-tabs .nav-link { min-height: 40px; padding: 8px 12px; }
  .pxa-page .facturas-toolbar,
  .pxa-page .pagination-container { flex-direction: column; align-items: stretch; }
  .pxa-page .facturas-toolbar-left,
  .pxa-page .facturas-toolbar-right { width: 100%; }
  .pxa-page .facturas-toolbar-right .facturas-btn { flex: 1 1 0; }
  .pxa-context-grid { grid-template-columns: 1fr; }
  .pxa-application-card { padding: 14px !important; }
  .pxa-application-title { align-items: flex-start; font-size: 17px; }
  .pxa-destination-row { grid-template-columns: 1fr; }
  .pxa-destination-row .facturas-btn { width: 100%; }
  .pxa-form-actions { flex-direction: column-reverse; align-items: stretch; }
  .pxa-form-actions .facturas-btn { width: 100%; }
  .pxa-status-filter { width: 100%; overflow-x: auto; box-sizing: border-box; }
  .pxa-page .pagination-controls { justify-content: center; flex-wrap: wrap; }
}

@media print {
  .pxa-page > .pxa-tabs,
  .pxa-page .facturas-toolbar,
  .pxa-page .facturas-filter-host,
  .pxa-page .pagination-container { display: none !important; }
}
