/* =====================================
   TRANSACCIONES CSS AISLADO - TRX
   Vista crítica / financiera / robusta
===================================== */

/* =========================
   LAYOUT
========================= */
.trx-layout{
  padding:20px;
  width:100%;
  box-sizing:border-box;
}

/* =========================
   HEADER
========================= */
.trx-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:22px;
}

.trx-header h2{
  margin:0;
  font-size:34px;
  font-weight:700;
  color:#111827;
}

/* =========================
   BOTONES
========================= */
.trx-btn{
  border:none;
  border-radius:10px;
  height:44px;
  padding:0 18px;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
  transition:.2s ease;
  white-space:nowrap;
}

.trx-btn:hover{
  transform:translateY(-1px);
}

.trx-btn-primary{
  background:#2f56a6;
  color:#fff;
}

.trx-btn-primary:hover{
  background:#24468a;
}

.trx-btn-danger{
  background:#ea4335;
  color:#fff;
}

.trx-btn-danger:hover{
  background:#cf3528;
}

.trx-btn-light{
  background:#eef2f7;
  color:#111827;
}

.trx-btn-light:hover{
  background:#dde5ef;
}

/* =========================
   CARDS
========================= */
.trx-cards{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:18px;
  margin-bottom:22px;
}

.trx-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px 20px;
  position:relative;
  box-shadow:0 2px 8px rgba(0,0,0,.04);
}

.trx-card::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:5px;
  border-radius:14px 0 0 14px;
}

.trx-fechas::before{ background:#3b82f6; }
.trx-ingreso::before{ background:#16a34a; }
.trx-egreso::before{ background:#e74c3c; }
.trx-utilidad::before{ background:#f39c12; }

.trx-card h3{
  margin:0 0 8px;
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.4px;
  color:#6b7280;
}

.trx-card p{
  margin:0;
  font-size:24px;
  font-weight:800;
  color:#111827;
}

/* =========================
   FILTROS
========================= */
.trx-filters-box{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px;
  margin-bottom:22px;
}

.trx-filters-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  align-items:end;
}

.trx-group{
  display:flex;
  flex-direction:column;
}

.trx-group label{
  font-size:12px;
  font-weight:600;
  color:#6b7280;
  margin-bottom:6px;
}

.trx-group input,
.trx-group select,
.trx-group textarea{
  width:100%;
  min-height:44px;
  padding:10px 14px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:14px;
  background:#fff;
  box-sizing:border-box;
}

.trx-group textarea{
  min-height:100px;
  resize:vertical;
}

.trx-group input:focus,
.trx-group select:focus,
.trx-group textarea:focus{
  outline:none;
  border-color:#2f56a6;
  box-shadow:0 0 0 3px rgba(47,86,166,.12);
}

/* =========================
   TABLA
========================= */
.trx-table-card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:16px;
}

.trx-table-scroll{
  width:100%;
  max-height:620px;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}

.trx-table-scroll::-webkit-scrollbar{
  width:10px;
  height:10px;
}

.trx-table-scroll::-webkit-scrollbar-thumb{
  background:#c7ced8;
  border-radius:20px;
}

.trx-table{
  width:max-content;
  min-width:100%;
  border-collapse:collapse;
}

.trx-table th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f3f4f6;
  color:#111827;
  font-size:13px;
  font-weight:700;
  text-align:left;
  padding:12px 14px;
  white-space:nowrap;
}

.trx-table td{
  padding:12px 14px;
  font-size:14px;
  border-bottom:1px solid #f1f1f1;
  white-space:nowrap;
  vertical-align:middle;
}

.trx-table tbody tr:hover{
  background:#fafafa;
}

/* valor columna */
.trx-table td:nth-child(8){
  font-weight:700;
}

/* =========================
   BADGES
========================= */
.badge{
  display:inline-block;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}

.badge.ingreso{
  background:#e8f5e9;
  color:#2e7d32;
}

.badge.egreso{
  background:#fdeaea;
  color:#c62828;
}

.badge.operacional{
  background:#ede9fe;
  color:#6d28d9;
}

.badge.conductor{
  background:#e0f2fe;
  color:#0369a1;
}

/* =========================
   MODAL
========================= */
.trx-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:999;
}

.hidden{
  display:none !important;
}

.trx-modal-box{
  background:#fff;
  width:min(94vw,620px);
  max-height:92vh;
  overflow-y:auto;
  border-radius:16px;
  padding:24px;
  box-shadow:0 20px 50px rgba(0,0,0,.18);
}

.trx-modal-box::-webkit-scrollbar{
  width:8px;
}

.trx-modal-box::-webkit-scrollbar-thumb{
  background:#d1d5db;
  border-radius:20px;
}

.trx-modal-box h3{
  margin:0 0 18px;
  font-size:24px;
  color:#111827;
}

/* =========================
   FORM MODAL
========================= */
.trx-form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  margin-top:16px;
}

.trx-full{
  grid-column:span 2;
}

.trx-modal-actions{
  margin-top:18px;
  display:flex;
}

.trx-modal-actions .trx-btn{
  width:100%;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width:1200px){

  .trx-cards{
    grid-template-columns:repeat(2,1fr);
  }

  .trx-filters-grid{
    grid-template-columns:repeat(3,1fr);
  }
}

@media (max-width:768px){

  .trx-layout{
    padding:14px;
  }

  .trx-header{
    flex-direction:column;
    align-items:stretch;
  }

  .trx-header h2{
    font-size:28px;
  }

  .trx-header .trx-btn,
  .trx-btn{
    width:100%;
  }

  .trx-cards{
    grid-template-columns:1fr;
  }

  .trx-filters-grid{
    grid-template-columns:1fr;
  }

  .trx-form-grid{
    grid-template-columns:1fr;
  }

  .trx-full{
    grid-column:span 1;
  }

  .trx-table{
    min-width:980px;
  }
}

@media (max-width:480px){

  .trx-header h2{
    font-size:24px;
  }

  .trx-card,
  .trx-filters-box,
  .trx-table-card,
  .trx-modal-box{
    padding:14px;
  }

  .trx-card p{
    font-size:20px;
  }
}

/* =====================================
   AJUSTE COMPACTO TRANSACCIONES
   AGREGAR AL FINAL
===================================== */

/* layout */
.trx-layout{
  padding:14px !important;
}

/* header */
.trx-header{
  gap:12px !important;
  margin-bottom:14px !important;
}

.trx-header h2{
  font-size:28px !important;
}

/* botones */
.trx-btn{
  height:34px !important;
  padding:0 14px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* =========================
   CARDS MÁS PEQUEÑAS
========================= */
.trx-cards{
  gap:10px !important;
  margin-bottom:14px !important;
  grid-template-columns:repeat(4,1fr) !important;
}

.trx-card{
  padding:12px 14px !important;
  border-radius:12px !important;
}

.trx-card::before{
  width:4px !important;
}

.trx-card h3{
  font-size:10px !important;
  margin-bottom:4px !important;
}

.trx-card p{
  font-size:18px !important;
  line-height:1.2 !important;
}

/* =========================
   FILTROS MÁS COMPACTOS
========================= */
.trx-filters-box{
  padding:14px !important;
  margin-bottom:14px !important;
}

.trx-filters-grid{
  grid-template-columns:
    1fr      /* desde */
    1fr      /* hasta */
    1.2fr    /* tipo */
    .9fr     /* estado/accion */
    !important;

  gap:8px !important;
}

.trx-group label{
  font-size:11px !important;
  margin-bottom:4px !important;
}

.trx-group input,
.trx-group select,
.trx-group textarea{
  min-height:34px !important;
  height:34px !important;
  padding:0 10px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

.trx-group textarea{
  min-height:80px !important;
  padding:10px !important;
}

.trx-filters-grid .trx-btn{
  width:100% !important;
}

/* =========================
   TABLA MÁS COMPACTA
========================= */
.trx-table-card{
  padding:12px !important;
}

.trx-table-scroll{
  max-height:560px !important;
}

.trx-table th{
  font-size:12px !important;
  padding:10px 12px !important;
}

.trx-table td{
  font-size:12px !important;
  padding:10px 12px !important;
}

/* badges */
.badge{
  font-size:11px !important;
  padding:4px 8px !important;
}

/* =========================
   MODAL MÁS COMPACTO
========================= */
.trx-modal-box{
  padding:18px !important;
}

.trx-modal-box h3{
  font-size:22px !important;
}

.trx-form-grid{
  gap:12px !important;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width:1300px){

  .trx-cards{
    grid-template-columns:repeat(2,1fr) !important;
  }

  .trx-filters-grid{
    grid-template-columns:repeat(2,1fr) !important;
  }
}

@media (max-width:768px){

  .trx-cards{
    grid-template-columns:1fr !important;
  }

  .trx-filters-grid{
    grid-template-columns:1fr !important;
  }

  .trx-btn{
    width:100% !important;
  }
}

/* =====================================
   TRANSACCIONES - FILTROS EN 6 COLUMNAS
   AGREGAR / REEMPLAZAR AL FINAL
===================================== */

/* escritorio grande */
.trx-filters-grid{
  grid-template-columns:repeat(6,1fr) !important;
  gap:8px !important;
}

/* laptop */
@media (max-width:1400px){

  .trx-filters-grid{
    grid-template-columns:repeat(3,1fr) !important;
  }
}

/* tablet */
@media (max-width:1024px){

  .trx-filters-grid{
    grid-template-columns:repeat(2,1fr) !important;
  }
}

/* móvil */
@media (max-width:768px){

  .trx-filters-grid{
    grid-template-columns:1fr !important;
  }
}

#buscarManifiesto {
  width: 100%;
  margin-bottom: 8px;
}

#manifiesto {
  width: 100%;
  min-height: 180px;
}

.trx-autocomplete {
  position: relative;
}

.trx-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;

  background: white;
  border: 1px solid #dcdfe6;
  border-radius: 12px;

  margin-top: 6px;

  max-height: 240px;
  overflow-y: auto;

  z-index: 9999;

  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.trx-autocomplete-item {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;

  border-bottom: 1px solid #f1f1f1;
}

.trx-autocomplete-item:hover {
  background: #f5f7fb;
}

.trx-autocomplete-empty {
  padding: 14px;
  color: #888;
}

.hidden {
  display: none !important;
}

/* =========================
   INLINE EDIT
========================= */

.trx-table td input,
.trx-table td select{
  width:100%;
  min-width:0;
  height:30px;
  padding:0 8px;
  border:1px solid #d1d5db;
  border-radius:7px;
  background:#fff;
  font-size:12px;
  color:#111827;
  box-sizing:border-box;
}

.trx-table td input:focus,
.trx-table td select:focus{
  outline:none;
  border-color:#2f56a6;
  box-shadow:0 0 0 3px rgba(47,86,166,.12);
}

.trx-table td input[type="date"]{
  min-width:118px;
}

.acciones{
  white-space:nowrap;
}

.btn-icon{
  border:none;
  background:none;
  cursor:pointer;
  font-size:15px;
  margin-right:8px;
}

.btn-icon.editar{
  color:#2f56a6;
}

.btn-icon.eliminar{
  color:#e74c3c;
}

.btn-icon.guardar{
  color:#16a34a;
}

/* =========================
   INLINE EDIT COMPACTO
========================= */

.trx-table td{
  padding:8px 10px !important;
}

.trx-table td:nth-child(1){
  min-width:125px;
}

.trx-table td:nth-child(4){
  min-width:140px;
}

.trx-table td:nth-child(8){
  min-width:120px;
}

.trx-table td:nth-child(9){
  min-width:160px;
}

.trx-table .btn-icon{
  font-size:13px;
  margin-right:4px;
}

.trx-table .acciones{
  min-width:60px;
  text-align:center;
}

/* =========================
   BOTONES DE PERIODO
========================= */

#btnEsteMes{
  background:#2f56a6 !important;
  color:#fff !important;
  border:none !important;
}

#btnEsteMes:hover{
  background:#24468a !important;
}

#btnMesAnterior{
  background:#eef2f7 !important;
  color:#111827 !important;
}

#btnMesAnterior:hover{
  background:#dde5ef !important;
}