/* =========================================================
   ESTILOS ENTERPRISE - MÓDULO DE REMESAS Y LIQUIDACIONES
   ========================================================= */

:root {
  --remesas-primary: #1e6ecb;
  --remesas-primary-dark: #093052;
  --remesas-primary-hover: #155ec0;
  --remesas-navy: #0f2942;
  --remesas-slate: #334155;
  --remesas-muted: #64748b;
  --remesas-border: #e2e8f0;
  --remesas-border-light: #edf2f7;
  --remesas-bg-subtle: #f8fafc;
  --remesas-card-bg: #ffffff;
  --remesas-success: #10b981;
  --remesas-success-dark: #047857;
  --remesas-danger: #ef4444;
  --remesas-danger-dark: #b91c1c;
  --remesas-warning: #f59e0b;
}

/* 1. CONTENEDOR PRINCIPAL Y HEADER */
.remesas-body #main-content,
#main-content {
  box-sizing: border-box;
}

.remesas-container {
  max-width: 1680px;
  margin: 0 auto;
  background-color: var(--remesas-card-bg);
  padding: 24px 30px;
  border-radius: 16px;
  border: 1px solid var(--remesas-border);
  box-shadow: 0 4px 20px -2px rgba(15, 34, 58, 0.05);
  min-height: 84vh;
  box-sizing: border-box;
}

/* Header superior del módulo */
.remesas-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--remesas-border);
  flex-wrap: wrap;
}

.remesas-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.remesas-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--remesas-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.remesas-page-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--remesas-navy);
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  padding: 0;
}

.remesas-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #093052 0%, #1e6ecb 100%);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(9, 48, 82, 0.18);
  flex-shrink: 0;
}

.remesas-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--remesas-muted);
}

.remesas-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--remesas-bg-subtle);
  border: 1px solid var(--remesas-border);
  border-radius: 8px;
  color: var(--remesas-slate);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.remesas-back-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--remesas-primary);
  transform: translateX(-2px);
}

/* 2. PESTAÑAS (NAV-TABS) */
.remesas-container .nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--remesas-border);
  margin-bottom: 20px;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}

.remesas-container .nav-item {
  margin: 0;
}

.remesas-container .nav-link {
  padding: 11px 20px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--remesas-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.remesas-container .nav-link i {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.remesas-container .nav-link:hover {
  color: var(--remesas-primary);
  background: #f8fafc;
}

.remesas-container .nav-link.active {
  color: var(--remesas-primary);
  border-bottom-color: var(--remesas-primary);
  background: #f0f7ff;
  font-weight: 700;
}

.remesas-container .nav-link.active i {
  color: var(--remesas-primary);
}

/* 3. TOOLBARS Y CONTENEDORES DE CONTROL */
.remesas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: #f8fafc;
  padding: 10px 16px;
  border: 1px solid var(--remesas-border);
  border-radius: 10px;
  flex-wrap: wrap;
}

.remesas-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.remesas-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid var(--remesas-border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--remesas-slate);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.remesas-counter-badge i {
  color: var(--remesas-primary);
  font-size: 13px;
}

/* 4. BOTONES ESTILIZADOS */
.btn-remesas-primary,
.remesas-container .btn-primary {
  padding: 8px 16px;
  background: linear-gradient(135deg, #1e6ecb 0%, #175bb0 100%);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(30, 110, 203, 0.25);
  transition: all 0.2s ease;
}

.btn-remesas-primary:hover:not(:disabled),
.remesas-container .btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1860b4 0%, #124d96 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(30, 110, 203, 0.35);
}

.btn-remesas-secondary,
.remesas-container .btn-secondary {
  padding: 8px 16px;
  background: #ffffff;
  color: var(--remesas-slate);
  border: 1px solid var(--remesas-border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-remesas-secondary:hover:not(:disabled),
.remesas-container .btn-secondary:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--remesas-navy);
}

.btn-remesas-success,
#btnProcesarRemesa {
  padding: 9px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.32);
  transition: all 0.2s ease;
}

.btn-remesas-success:hover:not(:disabled),
#btnProcesarRemesa:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.42);
}

.remesas-container .btn:disabled,
.remesas-container .btn[disabled] {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
  pointer-events: none !important;
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  border-color: #cbd5e1 !important;
}

/* 5. FILTRO LATERAL (SIDEBAR DE FILTROS EN TAB 1) */
.primas-layout {
  display: flex;
  align-items: flex-start;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
}

.filter-sidebar {
  width: 0;
  opacity: 0;
  overflow: hidden;
  background-color: #ffffff;
  border: 0;
  border-radius: 12px;
  transition: width 0.3s cubic-bezier(0.2, 0, 0, 1), opacity 0.25s ease, margin-right 0.3s ease;
  padding: 0;
  margin-right: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

.filter-sidebar.open {
  width: 310px;
  opacity: 1;
  border: 1px solid var(--remesas-border);
  box-shadow: 0 4px 16px rgba(15, 34, 58, 0.06);
  padding: 16px;
  margin-right: 20px;
  max-height: 76vh;
  overflow-y: auto;
}

.filter-sidebar::-webkit-scrollbar {
  width: 4px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.filter-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--remesas-border);
}

.filter-sidebar-header h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--remesas-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-sidebar-body .form-group {
  margin-bottom: 12px;
}

.filter-sidebar-body label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--remesas-navy);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-sidebar .form-control {
  width: 100%;
  height: 36px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid var(--remesas-border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--remesas-navy);
  font-family: inherit;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.filter-sidebar .form-control:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--remesas-primary);
  box-shadow: 0 0 0 3px rgba(30, 110, 203, 0.14);
}

.btn-filter-search {
  width: 100%;
  height: 40px;
  background: linear-gradient(135deg, #1e6ecb 0%, #175bb0 100%);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 3px 8px rgba(30, 110, 203, 0.28);
  margin-top: 14px;
  transition: all 0.2s ease;
}

.btn-filter-search:hover {
  background: linear-gradient(135deg, #1860b4 0%, #124d96 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(30, 110, 203, 0.38);
}

.data-area {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

/* 6. TABLAS DE DATOS ENTERPRISE (.table-k) */
.remesas-table-card {
  border: 1px solid var(--remesas-border);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 34, 58, 0.03);
  width: 100%;
  box-sizing: border-box;
}

.table-k {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  margin: 0;
}

.table-k thead th {
  background: #347df5 !important;
  color: #ffffff !important;
  font-size: 12.5px;
  font-weight: 700;
  padding: 11px 14px;
  text-align: left;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #2368db;
  vertical-align: middle;
  white-space: nowrap;
}

.table-k tbody tr {
  transition: background-color 0.15s ease;
}

.table-k tbody tr:hover {
  background-color: #f1f8fe !important;
}

.table-k tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--remesas-border-light);
  color: var(--remesas-slate);
  vertical-align: middle;
  line-height: 1.4;
}

.table-k tbody tr:last-child td {
  border-bottom: none;
}

.table-k tfoot tr td {
  border-top: 2px solid var(--remesas-border);
  background: #f8fafc;
  vertical-align: middle;
}

/* Clases de alineación estrictas */
.text-right,
.table-k th.text-right,
.table-k td.text-right {
  text-align: right !important;
}

.text-center,
.table-k th.text-center,
.table-k td.text-center {
  text-align: center !important;
}

.text-left,
.table-k th.text-left,
.table-k td.text-left {
  text-align: left !important;
}

.font-bold {
  font-weight: 700 !important;
}

/* Checkbox personalizado centrado */
.table-k input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0 auto;
  display: block;
  cursor: pointer;
  accent-color: var(--remesas-primary);
}

.btn-action {
  background: #ffffff;
  border: 1px solid var(--remesas-border);
  color: var(--remesas-primary);
  border-radius: 7px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.18s ease;
}

.btn-action:hover:not(:disabled) {
  background: #eef5ff;
  border-color: #bcd6f8;
  color: #124d96;
  transform: scale(1.08);
}

.remesas-actions-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Badges de estado */
.badge-success {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-danger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-moneda {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* 7. PAGINACIÓN */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid var(--remesas-border);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--remesas-slate);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: #ffffff;
  border: 1px solid var(--remesas-border);
  border-radius: 6px;
  color: var(--remesas-navy);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.page-btn:hover:not(.active):not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.page-btn.active {
  background: var(--remesas-primary);
  color: #ffffff;
  border-color: var(--remesas-primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 8. HEADER DE CONTEXTO (PESTAÑA 2 — REGISTRO DE ENVÍO) */
.context-header {
  background: linear-gradient(135deg, #f0f7ff 0%, #e5f1fd 100%);
  border: 1px solid #c8e1fb;
  border-left: 5px solid var(--remesas-primary);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.context-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--remesas-navy);
}

.context-subtitle {
  font-size: 12.5px;
  color: var(--remesas-slate);
  margin-top: 3px;
}

/* 9. MODALES DE CONFIRMACIÓN Y MENSAJES */
#modalConfirmarRemesa,
#modalMensajeRemesa {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.60);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#modalConfirmarRemesa.oculto,
#modalMensajeRemesa.oculto {
  display: none !important;
}

.remesas-modal-dialog {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 45px rgba(15, 34, 58, 0.28);
  border: 1px solid var(--remesas-border);
  text-align: center;
  box-sizing: border-box;
  animation: remesasModalZoom 0.2s ease forwards;
}

.remesas-modal-icon-danger {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #ef233c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.remesas-modal-icon-info {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #347df5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.remesas-modal-icon-success {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.remesas-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--remesas-navy, #0f2942);
  line-height: 1.4;
}

.remesas-modal-subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.remesas-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.btn-modal-cancel {
  padding: 9px 18px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-modal-cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-modal-danger {
  padding: 9px 20px;
  background: linear-gradient(135deg, #ef233c 0%, #d90429 100%);
  color: #ffffff;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(239, 35, 60, 0.3);
  transition: all 0.18s ease;
}

.btn-modal-danger:hover {
  background: linear-gradient(135deg, #d90429 0%, #b8001f 100%);
  box-shadow: 0 5px 12px rgba(239, 35, 60, 0.4);
  transform: translateY(-1px);
}

.btn-modal-primary {
  padding: 9px 22px;
  background: linear-gradient(135deg, #347df5 0%, #1e6ecb 100%);
  color: #ffffff;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(30, 110, 203, 0.3);
  transition: all 0.18s ease;
}

.btn-modal-primary:hover {
  background: linear-gradient(135deg, #1e6ecb 0%, #175bb0 100%);
  transform: translateY(-1px);
}

.btn-modal-success {
  padding: 9px 22px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.3);
  transition: all 0.18s ease;
}

.btn-modal-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 5px 12px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

@keyframes remesasModalZoom {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* 10. ESTILOS DE RECIBO / IMPRESIÓN */
.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px 16px 50px;
  box-sizing: border-box;
}

.hoja-recibo-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  width: 100%;
  max-width: 8.5in;
  margin: 0 auto;
  position: relative;
}

/* La hoja en pantalla ya es una carta (8.5 x 11 pulgadas) con los mismos
   márgenes laterales que tendrá al imprimir, para que lo que se ve en el
   modal sea lo que sale en el papel. */
.hoja-recibo {
  background: #ffffff;
  width: 8.5in;
  max-width: 100%;
  min-height: 11in;
  padding: 0.55in 0.6in;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-family: 'Times New Roman', Times, serif;
  color: #000;
  position: relative;
  box-sizing: border-box;
}

/* En ventanas angostas la hoja conserva su tamaño carta y el modal se desplaza
   en horizontal, en vez de comprimir el recibo hasta romper columnas y membrete. */
@media screen and (max-width: 900px) {
  #modalRecibo {
    overflow-x: auto;
    justify-content: flex-start;
  }

  #modalRecibo .hoja-recibo-wrapper {
    flex: 0 0 auto;
    width: 8.5in;
    margin: 0 auto;
  }

  #modalRecibo .hoja-recibo {
    width: 8.5in;
    max-width: none;
  }
}

/* ---- Contenido del recibo ---------------------------------------------
   crudStyles.css da estilo a cualquier <table>, <th> y <td> de la aplicación
   (sombra, esquinas redondeadas, rayado de filas, tamaño de letra de 14px,
   texto sin saltos de línea, etc.). Un documento formal no debe heredar nada
   de eso, así que se restablece aquí, solo dentro del recibo. */
#printBody {
  color: #000;
  font-size: 12px;
  line-height: 1.35;
}

#printBody table {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  background: transparent;
  text-align: left;
}

/* En ventanas angostas (<= 768px) crudStyles.css convierte TODAS las tablas en bloques de ancho
   completo; en el recibo eso apilaría las columnas una sobre otra. */
#printBody table {
  display: table;
}

#printBody thead {
  display: table-header-group;
}

#printBody tbody,
#printBody tfoot {
  display: table-row-group;
}

#printBody tr {
  display: table-row;
  width: auto;
}

#printBody th,
#printBody td {
  display: table-cell;
  width: auto;
}

#printBody tr,
#printBody tr:nth-child(even),
#printBody tbody tr:hover {
  background: transparent;
  cursor: auto;
  transition: none;
}

#printBody th,
#printBody td {
  font-size: inherit;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  border-bottom: 0;
}

/* Tabla exterior: solo existe para repetir un margen superior e inferior en
   TODAS las páginas. La hoja se imprime con @page { margin: 0 } (único modo
   de que el navegador no imprima fecha, título y dirección web en las
   esquinas), y los encabezados/pies de tabla se repiten en cada página. */
#printBody table.rem-paginas {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
}

#printBody td.rem-margen-pagina,
#printBody td.rem-cuerpo-pagina {
  padding: 0;
  border: 0;
  background: transparent;
  white-space: normal;
  text-align: left;
  vertical-align: top;
}

#printBody td.rem-margen-pagina {
  height: 0;
}

/* Membrete */
#printBody .rem-encabezado {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

#printBody .rem-empresa {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

#printBody .rem-empresa-datos {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
}

#printBody .rem-empresa-nombre {
  font-weight: bold;
  font-size: 18px;
  line-height: 1.2;
  text-transform: uppercase;
  margin-bottom: 2px;
}

#printBody .rem-remesa {
  flex: 0 0 2.1in;
  width: 2.1in;
  min-width: 0;
  text-align: right;
}

#printBody .rem-remesa-caja {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 1.5in;
  border: 1px solid #000;
  padding: 7px 10px;
  text-align: center;
}

#printBody .rem-remesa-etiqueta {
  font-size: 10px;
}

#printBody .rem-remesa-numero {
  font-weight: bold;
  font-size: 14px;
  overflow-wrap: anywhere;
}

#printBody .rem-remesa-dato {
  margin-top: 6px;
  overflow-wrap: anywhere;
}

#printBody .rem-remesa-impresion {
  margin-top: 6px;
  font-size: 11px;
}

#printBody .rem-regla {
  height: 0;
  margin: 12px 0;
  border: 0;
  border-top: 2px solid #000;
}

#printBody .rem-titulo {
  margin: 0 0 12px;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  text-decoration: underline;
}

#printBody .rem-datos {
  padding: 6px 0;
  border-top: 1px dotted #777;
  border-bottom: 1px dotted #777;
}

#printBody .rem-dato {
  display: flex;
  gap: 12px;
  padding: 3px 0;
}

#printBody .rem-dato-etiqueta {
  flex: 0 0 2.1in;
}

#printBody .rem-dato-valor {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

#printBody .rem-intro {
  margin-top: 10px;
}

/* Detalle: el encabezado se repite en cada página y el TOTAL GENERAL sale
   una sola vez, al final (un <tfoot> normal se repetiría en cada página). */
#printBody .remesa-recibo-detalle thead {
  display: table-header-group;
}

#printBody .remesa-recibo-detalle tfoot {
  display: table-row-group;
}

#printBody .remesa-recibo-detalle tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Los importes nunca se parten en dos líneas y llevan aire a la derecha para no pegarse a la columna siguiente */
#printBody .remesa-recibo-detalle .text-right {
  padding-right: 10px !important;
  white-space: nowrap !important;
}

/* Resumen por forma de pago */
#printBody .rem-bloque {
  break-inside: avoid;
  page-break-inside: avoid;
}

#printBody .rem-resumen-contenedor {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

#printBody table.rem-resumen {
  width: 4.4in;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

#printBody .rem-resumen th {
  font-size: 11px;
  white-space: nowrap;
  overflow-wrap: normal;
}

#printBody .rem-resumen th,
#printBody .rem-resumen td {
  padding: 6px 4px;
  border: 1px solid #999;
  background: #fff;
  color: #000;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

#printBody .rem-resumen td {
  text-align: right;
  white-space: nowrap;
}

#printBody .rem-resumen th.rem-resumen-titulo {
  background: #eee;
}

/* Notas y firmas: nunca se separan de página */
#printBody .rem-cierre {
  margin-top: 16px;
}

#printBody .rem-nota-linea {
  height: 24px;
  border-bottom: 1px solid #999;
}

#printBody .rem-firmas {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

#printBody .rem-firma {
  width: 40%;
  text-align: center;
}

/* Espacio sobre la línea: aquí va la firma digital del usuario (o queda libre para firmar a mano) */
#printBody .rem-firma-espacio {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 66px;
  padding-bottom: 2px;
  box-sizing: border-box;
}

#printBody .rem-firma-titulo {
  padding-top: 6px;
  border-top: 1px solid #000;
  font-weight: bold;
}

#printBody .rem-firma-nombre {
  margin-top: 12px;
  overflow-wrap: anywhere;
}

/* ---- Impresión ----------------------------------------------------------
   Documento formal en carta vertical (8.5 x 11 pulgadas), sin ninguna
   decoración de pantalla (sombra, esquinas, fondo oscuro del modal) y sin el
   texto que el navegador agrega en las esquinas (fecha, título de la página y
   dirección web). Esas esquinas solo desaparecen con margen de página 0; los
   márgenes reales los da la hoja (laterales) y la tabla exterior (arriba y
   abajo, repetidos en cada página). Este @page va después del de crudStyles.css
   (A3 horizontal) y por eso es el que manda en esta pantalla. */
@page {
  size: 8.5in 11in;
  margin: 0;
}

@media print {
  html,
  body.remesas-body {
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  /* Solo el recibo: el resto de la pantalla (menú, pestañas, tablas) se
     retira del flujo para que no genere páginas en blanco. */
  body.remesas-body > *:not(#modalRecibo) {
    display: none !important;
  }

  body.remesas-body #modalRecibo {
    position: static !important;
    display: block !important;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: none;
    backdrop-filter: none;
  }

  body.remesas-body .acciones-modal-recibo {
    display: none !important;
  }

  body.remesas-body .hoja-recibo-wrapper {
    display: block;
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
  }

  body.remesas-body .hoja-recibo {
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0 0.6in;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: none;
  }

  #printBody td.rem-margen-pagina {
    height: 0.55in;
  }
}

.acciones-modal-recibo {
  position: absolute;
  top: 10px;
  right: -55px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acciones-modal-recibo .btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

@media (max-width: 1024px) {
  .acciones-modal-recibo {
    position: fixed;
    top: 16px;
    right: 16px;
    flex-direction: row;
    z-index: 10000;
  }
}

/* Responsividad general */
@media (max-width: 960px) {
  .remesas-container {
    padding: 16px;
  }
  
  .primas-layout {
    flex-direction: column;
  }
  
  .filter-sidebar.open {
    width: 100%;
    max-height: none;
    margin-right: 0;
    margin-bottom: 16px;
  }
}
