* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #0f172a;
  color: #e5e7eb;
  padding: 1rem;
  padding-bottom: 90px;

}

.app-container {
  max-width: 1100px;
  margin: 0 auto;
}

.app-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.app-header h1 {
  font-size: 2rem;
  margin-bottom: 0.3rem;
}

.app-header p {
  color: #9ca3af;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: #020617;
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.card .monto {
  font-size: 1.5rem;
  font-weight: 700;
}

.saldo-efectivo .monto {
  color: #22c55e;
}

.saldo-mp .monto {
  color: #38bdf8;
}

.saldo-fijos .monto {
  color: #f97316;
}

.saldo-total {
  font-size: 1.8rem;
  color: #22c55e;
  font-weight: bold;
}

/* Formularios */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


label {
  font-size: 0.85rem;
  color: #cbd5f5;
}

input,
select {
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

input:focus,
select:focus {
  outline: 2px solid #6366f1;
  border-color: transparent;
}

/* Botones */
.btn {
  margin-top: auto;
  padding: 0.45rem 0.9rem;
  border-radius: 0.7rem;
  border: none;
  cursor: pointer;
  background: #1f2937;
  color: #e5e7eb;
  font-weight: 500;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.btn-primary {
  background: #6366f1;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 15px rgba(15, 23, 42, 0.7);
}

.btn-primary:hover {
  background: #4f46e5;
}

/* Tablas */
.table-wrapper {
  margin-top: 0.8rem;
  max-height: 260px;
  overflow: auto;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.filtro-mes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.filtro-mes input[type="month"] {
  background: #020617;
  border-radius: 999px;
  border: 1px solid #1e293b;
  padding: 0.25rem 0.75rem;
  color: #e5e7eb;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  position: sticky;
  top: 0;
  background: #020617;
  z-index: 1;
}

th,
td {
  padding: 0.4rem 0.3rem;
  text-align: left;
  border-bottom: 1px solid rgba(55, 65, 81, 0.7);
}

th {
  font-weight: 600;
  color: #9ca3af;
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.badge-ingreso {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.badge-gasto {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

.badge-efectivo {
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.badge-mp {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}

.badge-mensual {
  background: rgba(234, 179, 8, 0.2); /* amarillo suave */
  color: #fef9c3;
}

.badge-fijo {
  background: rgba(248, 113, 113, 0.25); /* rojizo */
  color: #fee2e2;
}

.saldo-ingreso {
  font-size: 1.6rem;
  font-weight: bold;
  color: #22c55e;
}

/* Botón borrar fijo */
.btn-small {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

/* Footer */
.app-footer {
  position: relative;
  text-align: center;
  margin-top: 18px;
  color: #6b7280;
  font-size: 0.8rem;
  z-index: 0;

}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 0.7rem;
  }

  .card {
    padding: 0.9rem;
  }

  .app-header h1 {
    font-size: 1.6rem;
  }
}

:root{
  --card-bg: rgba(2, 6, 23, .75);
  --card-border: rgba(148, 163, 184, .12);
  --soft: rgba(255,255,255,.06);
}

.card{
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
}

.form-field input,
.form-field select{
  background: rgba(2,6,23,.9);
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: .65rem .85rem;
  color: #e5e7eb;
  outline: none;
  transition: .2s ease;
}

.form-field input:focus,
.form-field select:focus{
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}

.btn-primary{
  border-radius: 14px;
  padding: .8rem 1.1rem;
  box-shadow: 0 10px 30px rgba(99,102,241,.25);
}

/* ===== Mobile: convertir tabla a tarjetas ===== */
@media (max-width: 1024px) {
  .table-wrapper {
    overflow: visible; /* evitamos scroll horizontal feo */
  }

  table thead {
    display: none; /* ocultar encabezados en mobile */
  }

  table, tbody, tr, td {
    display: block;
    width: 100%;
  }

  tbody tr {
    background: rgba(2, 6, 23, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
  }

  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  }

  tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* etiqueta de "campo" (Fecha, Tipo, etc.) usando data-label */
  tbody td::before {
    content: attr(data-label);
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
    flex: 0 0 auto;
  }

  /* el contenido a la derecha */
  tbody td > * {
    margin-left: auto;
    text-align: right;
  }

  /* hacer el botón más cómodo */
  .btn.btn-small {
    padding: 8px 12px;
    border-radius: 12px;
  }
}
/* La card de la tabla que respete el contenido */
.table-wrapper {
  overflow: visible;
}

/* Evita que elementos floten por arriba en iOS */
section.card {
  position: relative;
  z-index: 1;
}

/* En mobile, que las filas/tarjetas no queden pegadas al borde */
@media (max-width: 1024px) {
  tbody tr {
    margin-bottom: 14px;
  }
}

