/* =============================================================================
   Reaplicación de Créditos — CSS propio y acotado, prefijo .rcr-
   =============================================================================
   Copia adaptada de reaplicacionCobros.css (mismo diseño, misma paleta,
   mismos componentes) — solo cambia el prefijo .rcb- -> .rcr- y las clases
   que ya no aplican (balance box de remesa no existía tampoco en Cobros
   como bloque propio, así que no hay nada estructural que quitar aquí).
   Base: crudStyles.css + menu.css + las clases genéricas .facturas-* que ya
   usa toda la app (mismo patrón que control_reclamos.html / prima_x_aplicar).
   ============================================================================= */

.rcr-page { gap: 10px; }

.rcr-page > .rcr-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;
}

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

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

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

.rcr-page > #tab-lista.tab-content.active,
.rcr-page > #tab-aprobacion.tab-content.active,
.rcr-page > #tab-historial.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;
}

.rcr-page > #tab-reaplicar.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;
}

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

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

/* En este módulo el host de filtros y el panel son el mismo <aside>. */
.rcr-page .facturas-filter-host.kre-filter-panel.filter-sidebar {
  width: 0;
  max-width: 320px;
  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 .4s cubic-bezier(.25, .8, .25, 1),
              margin-left .4s cubic-bezier(.25, .8, .25, 1),
              opacity .3s ease,
              border-width 0s linear .4s;
}

.rcr-page .facturas-filter-host.kre-filter-panel.filter-sidebar.open {
  width: 320px;
  margin-left: 0;
  opacity: 1;
  transition: width .4s cubic-bezier(.25, .8, .25, 1),
              margin-left .4s cubic-bezier(.25, .8, .25, 1),
              opacity .3s ease;
}

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

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

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

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

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

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

.rcr-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;
}

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

.rcr-placeholder {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 3rem;
  color: #64748b;
  text-align: center;
}
.rcr-placeholder i { font-size: 2.2rem; color: #94a3b8; }

/* ---------------------------------------------------------------------
   Pestaña 1 — Lista de Créditos Aplicados
   --------------------------------------------------------------------- */
.rcr-grid-table {
  min-width: 1180px;
  table-layout: fixed;
}

.rcr-grid-table th:nth-child(1), .rcr-grid-table td:nth-child(1) { width: 6%; text-align: center; }
.rcr-grid-table th:nth-child(2), .rcr-grid-table td:nth-child(2) { width: 22%; }
.rcr-grid-table th:nth-child(3), .rcr-grid-table td:nth-child(3) { width: 23%; }
.rcr-grid-table th:nth-child(4), .rcr-grid-table td:nth-child(4) { width: 22%; }
.rcr-grid-table th:nth-child(5), .rcr-grid-table td:nth-child(5) { width: 19%; }
.rcr-grid-table th:nth-child(6), .rcr-grid-table td:nth-child(6) { width: 8%; text-align: center; }

.rcr-grid-table tbody td {
  min-width: 0;
  vertical-align: middle;
}

.rcr-payment-cell,
.rcr-chronology-cell,
.rcr-insured-cell,
.rcr-team-list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.25;
}

.rcr-payment-reference,
.rcr-payment-detail,
.rcr-insured-name,
.rcr-insurer-name {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rcr-payment-reference { color: var(--primary-color); font-weight: 700; }
.rcr-payment-detail,
.rcr-insurer-name { color: #64748b; font-size: 11px; }
.rcr-insured-name { color: #17324d; font-weight: 700; }

/* Se reutiliza el botón absoluto de .facturas-table en crudStyles.css.
   No añade alto ni separaciones: cada wrapper sustituye al texto original. */
.rcr-page .rcr-action-trigger {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.rcr-page .rcr-action-label {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: inherit;
}

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

.rcr-page .rcr-grid-table tbody td:nth-child(2),
.rcr-page .rcr-grid-table tbody td:nth-child(4),
.rcr-page .rcr-approval-table tbody td:nth-child(2),
.rcr-page .rcr-approval-table tbody td:nth-child(4),
.rcr-page .rcr-history-table tbody td:nth-child(2),
.rcr-page .rcr-history-table tbody td:nth-child(4) { overflow: visible; }

.rcr-inline-pair {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 4px;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.rcr-inline-pair .data-label,
.rcr-chronology-request .data-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}

.rcr-inline-pair .data-value,
.rcr-chronology-request .data-value {
  min-width: 0;
  max-width: none;
  margin: 0;
  overflow: visible;
  color: #17324d;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rcr-chronology-cell .rcr-inline-pair .data-value { white-space: nowrap; }
.rcr-chronology-cell > .rcr-inline-pair { grid-template-columns: 42px minmax(0, 1fr); }

.rcr-chronology-request {
  display: grid;
  grid-template-columns: max-content max-content max-content max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.rcr-pair-separator { color: #94a3b8; font-size: 10px; }
.rcr-amount-pair { margin-top: 2px; }
.rcr-amount-pair .data-label { text-transform: uppercase; }
.rcr-amount-pair .data-value { font-size: 12px; }

.rcr-team-list .data-label {
  color: #17324d;
  font-weight: 700;
}

.rcr-team-list .rcr-inline-pair { grid-template-columns: 28px minmax(0, 1fr); }

.rcr-team-list .data-value {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.rcr-estado-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  margin-top: 2px;
}
.rcr-estado-badge.disponible { background: #10b981; }
.rcr-estado-badge.pendiente { background: #94a3b8; }
.rcr-estado-badge.aprobado { background: #19a966; }

.rcr-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;
}
.rcr-age-badge.urgente {
  color: #b91c1c;
  border-color: #f5c6cb;
  background: #fdf0f0;
}

.rcr-monto-monospace {
  font-family: 'Consolas', monospace;
  font-weight: 700;
}

.rcr-btn-accion {
  padding: 0.4rem 0.8rem;
  border-radius: 0.3rem;
  font-weight: 700;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
  transition: filter .15s, transform .15s;
}
.rcr-btn-accion:hover:not(:disabled) { filter: brightness(1.08); }
.rcr-btn-accion.solicitar { background: var(--warning-color, #f39c12); }
.rcr-btn-accion.reaplicar { background: var(--success-color, #19a966); }
.rcr-btn-accion.pendiente {
  background: #95a5a6;
  cursor: not-allowed;
  opacity: .85;
}

/* ---------------------------------------------------------------------
   Pestaña 2 — Solicitud / Ejecución
   --------------------------------------------------------------------- */
.rcr-application-card {
  display: block;
  width: min(1400px, calc(100% - 36px));
  max-width: 1400px;
  margin: 14px auto;
  padding: 28px 40px 34px;
  overflow: visible;
  box-sizing: border-box;
}

.rcr-application-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 34px;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
  color: #17324d;
  font-size: 23px;
  line-height: 1.2;
}
.rcr-application-title > i { color: var(--warning-color, #f39c12); }

#rcrFormularioPrincipal { display: flex; flex-direction: column; gap: 20px; }

.rcr-context-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin: 0;
  padding: 17px 20px;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fbfcfd;
}
.rcr-context-grid .data-pill {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rcr-context-grid .data-pill .label {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}
.rcr-context-grid .data-pill .value {
  overflow-wrap: anywhere;
  color: #17324d;
  font-size: 16px;
  font-weight: 800;
}
.rcr-monto-inalterable { color: var(--success-color, #27ae60) !important; }

.rcr-clean-section {
  margin: 0;
  padding: 22px 20px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.rcr-form-section h4 {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
  color: #278fe3;
  font-size: 16px;
}
.rcr-clean-section .form-group { margin: 0; }
.rcr-clean-section .form-label {
  display: block;
  margin: 0 0 7px;
  color: #27384a;
  font-size: 14px;
}
.rcr-clean-section .form-control {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #263442;
  font: inherit;
  box-sizing: border-box;
}
.rcr-clean-section textarea.form-control {
  min-height: 80px;
  resize: vertical;
}
.rcr-clean-section .form-control:focus {
  border-color: var(--primary-color, #347df5);
  outline: 2px solid rgba(52, 125, 245, .14);
  outline-offset: 0;
}
.rcr-clean-section .form-control[readonly] { background: #f1f5f9; color: #475569; }

.rcr-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rcr-main-form-actions {
  justify-content: flex-end;
  margin-top: 0;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}
.rcr-submit-request-btn {
  border-color: var(--warning-color, #f39c12) !important;
  background: var(--warning-color, #f39c12) !important;
  color: #fff !important;
}

.rcr-distribution-lead {
  margin: 0 0 18px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}
.rcr-current-distribution {
  margin-bottom: 18px;
  border: 1px solid #dbe5f0;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.rcr-current-distribution summary {
  padding: 11px 13px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.rcr-current-distribution[open] summary { border-bottom: 1px solid #dbe5f0; }
.rcr-current-distribution .rcr-application-table-wrap { border: 0; border-radius: 0; }
.rcr-form-help {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  color: #64748b;
  font-size: .85rem;
  margin: -.4rem 0 .8rem;
}

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

.rcr-application-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border-color); border-radius: 6px; }
.rcr-application-table { width: 100%; min-width: 1040px; }
.rcr-application-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--primary-color);
  color: #fff;
}
/* .facturas-table (clase base, compartida por toda la app) trunca con "…"
   cualquier th/td más ancho de 220px (crudStyles.css) — pensado para celdas
   cortas típicas, pero corta títulos como "Balance pendiente"/"Monto a
   aplicar"/"Saldo después" en esta tabla de 9 columnas. Como esta tabla ya
   tiene su propio wrapper con scroll horizontal y un min-width generoso,
   se deja que el contenido respire — nada se recorta, el scroll (si hace
   falta) lo resuelve el wrapper, no el ellipsis. */
.rcr-application-table th,
.rcr-application-table td {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: break-word;
}
/* Los valores numéricos/fecha se ven mejor en una sola línea siempre (nunca
   son largos) — solo estas columnas mantienen nowrap. */
.rcr-application-table td[style*="text-align:right"] { white-space: nowrap; }
.rcr-application-table tbody td { vertical-align: middle; }
/* #tblRcrFacturasDestino tiene 9 columnas y, sin anchos explícitos,
   table-layout:auto le dio muy poco espacio a "Monto a aplicar" (su título
   quedaba recortado aunque overflow ya esté en visible arriba — el texto
   simplemente no cabía en la caja). table-layout:fixed + porcentajes fijos
   garantiza que cada columna tenga sitio de sobra siempre. */
#tblRcrFacturasDestino.rcr-application-table { table-layout: fixed; }
#tblRcrFacturasDestino th:nth-child(1), #tblRcrFacturasDestino td:nth-child(1) { width: 4%; }
#tblRcrFacturasDestino th:nth-child(2), #tblRcrFacturasDestino td:nth-child(2) { width: 12%; }
#tblRcrFacturasDestino th:nth-child(3), #tblRcrFacturasDestino td:nth-child(3) { width: 12%; }
#tblRcrFacturasDestino th:nth-child(4), #tblRcrFacturasDestino td:nth-child(4) { width: 11%; }
#tblRcrFacturasDestino th:nth-child(5), #tblRcrFacturasDestino td:nth-child(5) { width: 9%; }
#tblRcrFacturasDestino th:nth-child(6), #tblRcrFacturasDestino td:nth-child(6) { width: 8%; }
#tblRcrFacturasDestino th:nth-child(7), #tblRcrFacturasDestino td:nth-child(7) { width: 14%; }
#tblRcrFacturasDestino th:nth-child(8), #tblRcrFacturasDestino td:nth-child(8) { width: 16%; }
#tblRcrFacturasDestino th:nth-child(9), #tblRcrFacturasDestino td:nth-child(9) { width: 14%; }
.rcr-application-table input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  text-align: right;
  font-family: 'Consolas', monospace;
}
.rcr-application-table tr.rcr-fila-seleccionada { background: #ecfdf5; }
.rcr-application-table tr.rcr-fila-excedida input[type="number"] { border-color: #dc2626; background: #fdf0f0; }

.rcr-resumen-panel {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  background: #f8fafc;
}
.rcr-resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem 1.5rem;
}
.rcr-resumen-item { display: flex; flex-direction: column; gap: 2px; }
.rcr-resumen-item .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; font-weight: 700; }
.rcr-resumen-item .val { font-family: 'Consolas', monospace; font-size: 1.05rem; font-weight: 800; color: #17324d; }

.rcr-resumen-indicador {
  margin-top: .85rem;
  padding: .6rem .85rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.rcr-resumen-indicador.ok { background: #ecfdf5; color: #047857; border: 1px solid #19a966; }
.rcr-resumen-indicador.pendiente { background: #eef2f7; color: #475569; border: 1px solid #cbd5e1; }
.rcr-resumen-indicador.error { background: #fdf0f0; color: #b91c1c; border: 1px solid #f5c6cb; }

.rcr-secondary-btn { background: #fff; color: #555; border: 1px solid #ccc; }
.rcr-secondary-btn:hover { background: #f4f4f4; }

/* ---------------------------------------------------------------------
   Pestaña 3 — Aprobación Gerencial
   --------------------------------------------------------------------- */
.rcr-approval-table {
  width: 100%;
  min-width: 1450px;
  table-layout: fixed;
}

.rcr-approval-table th, .rcr-approval-table td {
  padding: 10px 14px;
}
.rcr-approval-table th:nth-child(1), .rcr-approval-table td:nth-child(1) { width: 6%; text-align: center; }
.rcr-approval-table th:nth-child(2), .rcr-approval-table td:nth-child(2) { width: 22%; }
.rcr-approval-table th:nth-child(3), .rcr-approval-table td:nth-child(3) { width: 23%; }
.rcr-approval-table th:nth-child(4), .rcr-approval-table td:nth-child(4) { width: 19%; }
.rcr-approval-table th:nth-child(5), .rcr-approval-table td:nth-child(5) { width: 14%; }
.rcr-approval-table th:nth-child(6), .rcr-approval-table td:nth-child(6) { width: 230px; text-align: center; }

.rcr-approval-table tbody td {
  min-width: 0;
  vertical-align: middle;
}

.rcr-currency-cell {
  color: #555;
  font-weight: 700;
}

.rcr-approval-document-cell,
.rcr-approval-chronology-cell,
.rcr-approval-insured-cell,
.rcr-approval-team-list {
  min-width: 0;
}

.rcr-approval-document-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.25;
}

.rcr-approval-document-cell .rcr-document-credito {
  grid-template-columns: max-content minmax(0, 1fr);
}

.rcr-approval-chronology-cell .rcr-inline-pair .data-value,
.rcr-approval-chronology-cell .rcr-chronology-request > .data-value:first-of-type {
  white-space: nowrap;
}

.rcr-approval-team-list .data-value,
.rcr-approval-document-cell .data-value {
  overflow-wrap: anywhere;
}

.rcr-manager-action-cell { text-align: center; }

.rcr-manager-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}

.rcr-manager-btn {
  flex: 0 0 auto;
  padding: .35rem .65rem;
  font-size: .78rem;
  white-space: nowrap;
}

.rcr-manager-waiting {
  max-width: 100%;
  justify-content: center;
  margin-inline: auto;
  text-align: center;
  white-space: normal;
}

.rcr-balance-box {
  min-width: 110px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid #19a966;
  border-radius: 6px;
  background: #ecfdf5;
  color: #047857;
  text-align: center;
  box-sizing: border-box;
}
.rcr-balance-box .lbl { margin-bottom: 2px; color: #059669; font-size: 10px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.rcr-balance-box .val { color: #047857; font-family: Consolas, monospace; font-size: 14px; font-weight: 800; }

/* ---------------------------------------------------------------------
   Pestaña 4 — Historial / Trazabilidad
   --------------------------------------------------------------------- */
.rcr-history-table {
  width: 100%;
  min-width: 1400px;
  table-layout: fixed;
}

.rcr-history-table th,
.rcr-history-table td { padding: 10px 14px; }

.rcr-history-table th:nth-child(1), .rcr-history-table td:nth-child(1) { width: 6%; text-align: center; }
.rcr-history-table th:nth-child(2), .rcr-history-table td:nth-child(2) { width: 22%; }
.rcr-history-table th:nth-child(3), .rcr-history-table td:nth-child(3) { width: 23%; }
.rcr-history-table th:nth-child(4), .rcr-history-table td:nth-child(4) { width: 21%; }
.rcr-history-table th:nth-child(5), .rcr-history-table td:nth-child(5) { width: 16%; }
.rcr-history-table th:nth-child(6), .rcr-history-table td:nth-child(6) { width: 160px; text-align: center; }

.rcr-history-table tbody td {
  min-width: 0;
  vertical-align: middle;
}

.rcr-history-table .rcr-currency-cell.usd { color: #07883f; }

.rcr-history-document-cell,
.rcr-history-chronology-cell,
.rcr-history-insured-cell,
.rcr-history-team-list { min-width: 0; }

.rcr-history-document-cell .rcr-document-credito {
  grid-template-columns: max-content minmax(0, 1fr);
}

.rcr-history-chronology-cell .rcr-inline-pair .data-value,
.rcr-history-resolution-row .data-value { white-space: nowrap; }

.rcr-history-resolution-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.rcr-history-resolution-row .rcr-inline-pair { width: auto; }

.rcr-history-team-list .data-value,
.rcr-history-document-cell .data-value { overflow-wrap: anywhere; }

.rcr-history-status-cell { text-align: center; }

.rcr-history-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 11px;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.rcr-history-status-badge.reasentado { background: #19a966; }
.rcr-history-status-badge.rechazado { background: #dc3545; }

/* Resalta por un momento la fila que se acaba de ejecutar, para que el
   usuario la reconozca de inmediato en la tabla (se agrega/quita la clase
   desde JS — ver resaltarFilaHistorial). */
@keyframes rcrDestelloFilaHistorial {
  0%   { background-color: #d1fae5; }
  100% { background-color: transparent; }
}
#rcrHistBody tr.rcr-fila-recien-ejecutada {
  animation: rcrDestelloFilaHistorial 3.2s ease-out;
  box-shadow: inset 3px 0 0 var(--success-color, #27ae60);
}

/* El pie de esta tabla (totales por moneda) usa las MISMAS reglas
   compartidas de crudStyles.css que ya usa Lista de Saldos de Prima x
   Aplicar (.facturas-table tfoot td / tfoot tr.facturas-total-usd td) —
   sin ninguna regla propia — para que el negro del total en pesos y el
   verde del total en dólares salgan pixel-idénticos entre todos los
   módulos hermanos. */

/* ---------------------------------------------------------------------
   Modales de detalle (Aprobación / Historial forense)
   --------------------------------------------------------------------- */
.rcr-modal-detalle { max-width: 720px; }
/* Mismo ancho ampliado que Reaplicación de Cobros — información financiera
   delicada (que se aprueba/rechaza con dinero real de por medio) debe
   leerse grande y claro. Todo el contenido de abajo escala junto con este
   ancho. */
.rcr-modal-resolver { max-width: 1180px; }
#rcrResolverTitulo {
  font-size: 1.55rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Franja de identidad — lo mínimo para confirmar de un vistazo QUÉ se está
   aprobando/rechazando (crédito, cliente, aseguradora, monto), agrupado en
   una tarjeta propia para separarlo visualmente del resto del modal. */
.rcr-resolver-identidad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 1.1rem 0 0;
  padding: 1.15rem 1.4rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.rcr-resolver-id-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rcr-resolver-id-item .data-label {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.rcr-resolver-id-item .data-value {
  color: #17324d;
  font-size: 1.2rem;
  font-weight: 600;
  max-width: none;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.rcr-resolver-id-monto .data-value {
  color: var(--primary-color);
  font-size: 1.5rem;
  font-weight: 800;
}

/* Datos secundarios (referencia, solicitante, fecha) — presentes pero sin
   competir visualmente con la identidad principal ni con la comparación. */
.rcr-resolver-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem 1.5rem;
  margin: .9rem 0 0;
  padding: 0 .1rem;
}
.rcr-resolver-meta-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 1rem;
}
.rcr-resolver-meta-item .data-label {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}
.rcr-resolver-meta-item .data-value {
  color: #475569;
  max-width: none;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.rcr-resolver-section-label {
  display: block;
  margin: 1.6rem 0 .7rem;
  color: var(--primary-color);
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.rcr-resolver-section-label i { margin-right: 7px; }

.rcr-resolver-motivo {
  margin: 1.3rem 0 0;
  padding: 1.1rem 1.3rem;
  background: #fffbea;
  border: 1px solid #f5e3a3;
  border-left: 5px solid #d4a017;
  border-radius: 10px;
}
.rcr-resolver-motivo .rcr-resolver-section-label { margin: 0 0 .4rem; color: #8a6d1a; }
.rcr-resolver-motivo p {
  margin: 0;
  color: #333;
  font-size: 1.12rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.rcr-modal-distribuciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.3rem;
  margin-bottom: 1.3rem;
}
.rcr-resolver-dist-heading { margin-bottom: .8rem; }

.rcr-dist-col {
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.rcr-dist-col h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: .7rem .9rem;
  font-size: 1.05rem;
  line-height: 1.3;
}
.rcr-dist-original h4 { background: #fdf0f0; color: #a12631; }
.rcr-dist-propuesta h4 { background: #eafaf1; color: #157347; }
.rcr-dist-tag {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
}

.rcr-modal-mini-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.rcr-modal-mini-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 1.02rem;
}
/* crudStyles.css (global, compartido por toda la app) trae, dentro de
   @media(max-width:768px): "table, thead, tbody, th, td, tr { display:
   table; width:100% }" — pensada para OTRO módulo, pero por ser un
   selector de etiqueta desnuda alcanza a CUALQUIER tabla del sitio,
   incluida esta. Nunca se toca ese CSS compartido (afectaría otras
   páginas) — en su lugar se reafirma aquí, con selector de clase (más
   específico que la etiqueta desnuda, gana sin necesitar !important), los
   roles reales de tabla para que esta tabla se vea igual en cualquier
   ancho de pantalla. */
.rcr-modal-mini-table { display: table; }
.rcr-modal-mini-table thead { display: table-header-group; }
.rcr-modal-mini-table tbody { display: table-row-group; }
.rcr-modal-mini-table tr { display: table-row; }
.rcr-modal-mini-table th,
.rcr-modal-mini-table td { display: table-cell; }
/* table-layout:fixed reparte el ancho por columna según estos porcentajes,
   sin importar qué tan largo sea el contenido — así una factura o póliza
   con un nombre inusualmente largo se AJUSTA (overflow-wrap) dentro de su
   columna en vez de estirar la tabla o forzar scroll horizontal. */
.rcr-modal-mini-table th:nth-child(1),
.rcr-modal-mini-table td:nth-child(1) { width: 38%; }
.rcr-modal-mini-table th:nth-child(2),
.rcr-modal-mini-table td:nth-child(2) { width: 38%; }
.rcr-modal-mini-table th:nth-child(3),
.rcr-modal-mini-table td:nth-child(3) { width: 24%; }
/* crudStyles.css (global, compartido por toda la app) trae, SIN media
   query, dos reglas de etiqueta desnuda que alcanzan cualquier tabla del
   sitio: "th, td { white-space:nowrap; overflow:hidden; text-overflow:
   ellipsis; max-width:220px; text-align:center; ... }" y, más fuerte
   todavía sobre la 2da columna, "tbody td:nth-child(2) { white-space:
   nowrap; overflow:hidden; text-overflow:ellipsis; text-align:center; }".
   Nunca se tocan esas reglas globales (afectaría el resto del sistema) —
   se sobrescriben aquí, con más especificidad. */
.rcr-modal-mini-table th,
.rcr-modal-mini-table td,
.rcr-modal-mini-table tbody td:nth-child(2) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.rcr-modal-mini-table th {
  background: #f8fafc;
  color: #334155;
  text-align: left;
  padding: 10px 14px;
  font-size: .92rem;
  border-bottom: 2px solid var(--border-color);
}
.rcr-modal-mini-table td,
.rcr-modal-mini-table tbody td:nth-child(2) {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
}
.rcr-modal-mini-table th.rcr-col-monto,
.rcr-modal-mini-table td.rcr-col-monto,
.rcr-modal-mini-table tbody td.rcr-col-monto:nth-child(3) {
  text-align: right;
}
.rcr-modal-mini-table td.rcr-mini-table-vacia {
  text-align: center;
  color: #94a3b8;
  font-style: italic;
}

/* Botones de este modal en particular, un poco más grandes para hacer
   juego con el resto del contenido agrandado (sin tocar .facturas-btn
   global, que usan decenas de otras pantallas). */
.rcr-modal-resolver .form-actions .facturas-btn {
  padding: 11px 20px;
  font-size: 14px;
}

.rcr-resolver-observacion { margin-top: 1.4rem; }
.rcr-resolver-observacion .form-label { font-size: 1.02rem; }
.rcr-resolver-observacion textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1.02rem;
  resize: vertical;
}

.rcr-forense-seccion { margin-bottom: 1.1rem; }
.rcr-forense-seccion h4 { margin: 0 0 .4rem; color: var(--primary-color); font-size: .92rem; }
.rcr-forense-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .4rem 1.5rem;
}

/* ---------------------------------------------------------------------
   Responsive — mismo comportamiento que Reaplicación de Cobros/Prima x
   Aplicar: al ocultar filtros la tabla se expande; en pantallas angostas
   el grid de contexto y el resumen matemático colapsan a una columna.
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .rcr-context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rcr-resumen-grid { grid-template-columns: 1fr 1fr; }
  .rcr-modal-distribuciones { grid-template-columns: 1fr; }
  .rcr-resolver-identidad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rcr-resolver-meta { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
  .rcr-body { overflow: auto; }
  .rcr-body #main-content { height: auto; min-height: 100vh; overflow: visible; }
  .rcr-page > #tab-lista.tab-content.active,
  .rcr-page > #tab-aprobacion.tab-content.active,
  .rcr-page > #tab-historial.tab-content.active { overflow: visible; }
  .rcr-workspace { flex-direction: column; overflow: visible; }
  .rcr-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 .4s cubic-bezier(.25, .8, .25, 1), opacity .3s ease, border-width 0s linear .4s;
  }
  .rcr-page .facturas-filter-host.kre-filter-panel.filter-sidebar.open {
    width: 100%;
    max-height: 3000px;
    transition: max-height .4s cubic-bezier(.25, .8, .25, 1), opacity .3s ease;
  }
  .rcr-page .facturas-results-card { min-height: 520px; border-radius: 0 0 8px 8px; }
}

@media (max-width: 760px) {
  .rcr-page > .rcr-tabs .nav-link { min-height: 40px; padding: 8px 12px; }
  .rcr-page .facturas-toolbar,
  .rcr-page .pagination-container { flex-direction: column; align-items: stretch; }
  .rcr-page .facturas-toolbar-left,
  .rcr-page .facturas-toolbar-right { width: 100%; flex-wrap: wrap; }
  .rcr-page .facturas-toolbar-right .facturas-btn { flex: 1 1 0; }
  .rcr-page .facturas-quick-search { min-width: 0; width: 100%; max-width: none; }
  .rcr-page .pagination-controls { justify-content: center; flex-wrap: wrap; }
  .rcr-application-card { width: 100%; margin: 0; padding: 16px !important; }
  .rcr-application-title { margin-bottom: 20px; font-size: 19px; flex-wrap: wrap; }
  .rcr-context-grid { grid-template-columns: 1fr; gap: 12px; }
  .rcr-clean-section { padding: 16px 14px; }
  .rcr-clean-section h4 { font-size: 14px; }
  .rcr-main-form-actions .facturas-btn { flex: 1 1 100%; justify-content: center; }
}
