/* =====================================
   CATEGORIA GASTOS CSS AISLADO - TTX
   Mantiene badges, tabla, modal y filtros
===================================== */

/* =========================
   BADGES TIPO
========================= */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* INGRESO */
.badge.ingreso {
  background: #B1F2C0;
  color: #ffffff;
}

/* EGRESO */
.badge.egreso {
  background: #EDC8B4;
  color: #ffffff;
}

/* OPERACIONAL */
.badge.operacional {
  background: #a855f7;
  color: #ffffff;
}

/* CONDUCTOR */
.badge.conductor {
  background: #3b82f6;
  color: #ffffff;
}

/* =========================
   LAYOUT
========================= */
.ttx-layout {
  display: block;
}

.ttx-main {
  width: 100%;
  min-width: 0;
}

/* =========================
   HEADER
========================= */
.ttx-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.ttx-header h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  color: #111827;
}

/* =========================
   BOTONES
========================= */
.ttx-btn {
  border: none;
  border-radius: 10px;
  height: 44px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: 0.2s ease;
}

.ttx-btn:hover {
  transform: translateY(-1px);
}

.ttx-btn-primary {
  background: #2f56a6;
  color: white;
}

.ttx-btn-primary:hover {
  background: #24468a;
}

.ttx-btn-danger {
  background: #ea4335;
  color: white;
}

.ttx-btn-danger:hover {
  background: #cf3528;
}

/* icon buttons de tabla */
.ttx-btn-icon,
.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #555;
  padding: 4px;
}

.ttx-btn-icon:hover,
.btn-icon:hover {
  color: #1976d2;
}

.btn-save {
  color: #2e7d32;
}

/* =========================
   FILTROS
========================= */
.ttx-filters-box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}

.ttx-filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}

.ttx-field {
  display: flex;
  flex-direction: column;
}

.ttx-field label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}

.ttx-field input,
.ttx-field select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 14px;
  background: white;
  box-sizing: border-box;
}

.ttx-field input:focus,
.ttx-field select:focus {
  outline: none;
  border-color: #2f56a6;
  box-shadow: 0 0 0 3px rgba(47,86,166,0.12);
}

.ttx-filter-action {
  display: flex;
  align-items: end;
}

/* =========================
   TABLA
========================= */
.ttx-table-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.ttx-table-scroll {
  width: 100%;
  max-height: 560px;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ttx-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.ttx-table-scroll::-webkit-scrollbar-thumb {
  background: #c7ced8;
  border-radius: 20px;
}

.ttx-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.ttx-table th {
  background: #f3f4f6;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
}

.ttx-table td {
  font-size: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f1f1;
  vertical-align: middle;
}

.ttx-table tbody tr:hover {
  background: #fafafa;
}

/* columnas centradas tipo / estado / acciones */
.ttx-table th:nth-child(3),
.ttx-table th:nth-child(4),
.ttx-table th:nth-child(5),
.ttx-table td:nth-child(3),
.ttx-table td:nth-child(4),
.ttx-table td:nth-child(5) {
  text-align: center;
}

/* =========================
   MODAL
========================= */
.ttx-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.hidden {
  display: none !important;
}

.ttx-modal-box {
  background: white;
  width: min(92vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
}

.ttx-modal-box::-webkit-scrollbar {
  width: 8px;
}

.ttx-modal-box::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 20px;
}

.ttx-modal-box h3 {
  margin: 0 0 18px;
  font-size: 24px;
  color: #111827;
}

/* =========================
   FORM MODAL
========================= */
.ttx-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ttx-full {
  grid-column: span 2;
}

.ttx-modal-actions {
  grid-column: span 2;
  display: flex;
  margin-top: 8px;
}

.ttx-modal-actions .ttx-btn {
  width: 100%;
}

/* errores */
.input-error,
.ttx-form-grid input.error,
.ttx-form-grid select.error {
  border-color: #dc2626 !important;
  background: #fff5f5;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  .ttx-table {
    min-width: 760px;
  }
}

@media (max-width: 768px) {
  .ttx-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ttx-header h2 {
    font-size: 28px;
  }

  .ttx-header .ttx-btn {
    width: 100%;
  }

  .ttx-filters-grid {
    grid-template-columns: 1fr;
  }

  .ttx-filter-action {
    display: block;
  }

  .ttx-btn {
    width: 100%;
  }

  .ttx-form-grid {
    grid-template-columns: 1fr;
  }

  .ttx-full,
  .ttx-modal-actions {
    grid-column: span 1;
  }
}

@media (max-width: 480px) {
  .ttx-header h2 {
    font-size: 24px;
  }

  .ttx-filters-box,
  .ttx-table-card,
  .ttx-modal-box {
    padding: 14px;
  }
}

/* =====================================
   TIPO TRANSACCIONES INLINE EDIT ONLY
   Solo cuando se edita inline
===================================== */

.ttx-table td input,
.ttx-table td select{
  width:100%;
  height:36px;
  padding:0 12px;
  border:1px solid #d1d5db;
  border-radius:8px;
  background:#fff;
  font-size:13px;
  color:#111827;
  box-sizing:border-box;
  transition:.2s ease;
}

/* focus elegante */
.ttx-table td input:focus,
.ttx-table td select:focus{
  outline:none;
  border-color:#2f56a6;
  box-shadow:0 0 0 3px rgba(47,86,166,.12);
}

/* selects inline */
.ttx-table td select{
  min-width:130px;
}

/* =====================================
   AJUSTE COMPACTO TIPO TRANSACCION
   AGREGAR AL FINAL
===================================== */

/* layout */
.ttx-layout{
  padding:14px !important;
}

/* header */
.ttx-header{
  margin-bottom:14px !important;
}

.ttx-header h2{
  font-size:28px !important;
}

/* botones */
.ttx-btn{
  height:34px !important;
  padding:0 14px !important;
  font-size:12px !important;
  border-radius:9px !important;
}

/* icon buttons tabla */
.ttx-btn-icon,
.btn-icon{
  font-size:13px !important;
  padding:3px !important;
}

/* =========================
   FILTROS MÁS COMPACTOS
========================= */
.ttx-filters-box{
  padding:14px !important;
  margin-bottom:14px !important;
}

.ttx-filters-grid{
  grid-template-columns:
    1.2fr   /* nombre */
    1fr     /* tipo */
    .9fr    /* estado */
    .8fr    /* limpiar */
    !important;

  gap:8px !important;
}

.ttx-field label{
  font-size:11px !important;
  margin-bottom:4px !important;
}

.ttx-field input,
.ttx-field select{
  height:34px !important;
  font-size:12px !important;
  padding:0 10px !important;
  border-radius:9px !important;
}

.ttx-filter-action .ttx-btn{
  width:100% !important;
}

/* =========================
   TABLA MÁS PEQUEÑA
========================= */
.ttx-table-card{
  padding:12px !important;
}

.ttx-table th{
  font-size:12px !important;
  padding:10px 12px !important;
}

.ttx-table td{
  font-size:12px !important;
  padding:10px 12px !important;
}

/* badges compactos */
.badge{
  font-size:11px !important;
  padding:4px 8px !important;
}

/* =========================
   INLINE EDIT MÁS PEQUEÑO
========================= */
.ttx-table td input,
.ttx-table td select{
  height:28px !important;
  min-height:28px !important;
  padding:0 6px !important;
  font-size:11px !important;
  border-radius:7px !important;
}

.ttx-table td select{
  min-width:115px !important;
}

/* =========================
   MODAL MÁS COMPACTO
========================= */
.ttx-modal-box{
  padding:18px !important;
}

.ttx-modal-box h3{
  font-size:22px !important;
}

.ttx-form-grid{
  gap:12px !important;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width:1100px){

  .ttx-filters-grid{
    grid-template-columns:repeat(2,1fr) !important;
  }
}

@media (max-width:768px){

  .ttx-filters-grid{
    grid-template-columns:1fr !important;
  }

  .ttx-btn{
    width:100% !important;
  }
}