* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f7f7f7;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* ENCABEZADO PRINCIPAL - Ajustado para iPhone 14 Pro Max */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: white;
  color: #004481;
  font-size: 20px;
  font-weight: 700;
  padding: 20px 10px;
  border-bottom: 2px solid #e0e0e0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.cuentas-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
}


.total-sin-ahorros {
  margin-top: 15px;
  font-size: 13px;
  color: #666;
  text-align: center;
}

.total-sin-ahorros-monto {
  font-size: 20px;
  font-weight: 700;
  color: #004481;
  margin-top: 3px;
}

.divider {
  width: 2px;
  height: 50px;
  background-color: #d1d1d1;
}

.cuenta {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.monto {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-top: 5px;
}

/* ✅ NUEVO: MENÚ FLOTANTE */
.floating-menu {
  position: fixed;
  bottom: 40px;
  right: 20px;
  z-index: 100;
}

.btn-menu-principal {
  width: 70px;
  height: 70px;
  border: none;
  border-radius: 50%;
  font-size: 32px;
  font-weight: bold;
  color: white;
  background-color: #004481;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-menu-principal:active {
  transform: scale(0.92);
}

.btn-menu-principal.active {
  background-color: #cc0000;
  transform: rotate(45deg);
}

.menu-opciones {
  position: absolute;
  bottom: 85px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.menu-opciones.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.btn-float {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  font-size: 28px;
  font-weight: bold;
  color: white;
  background-color: #004481;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-float:active {
  transform: scale(0.92);
}

.btn-float.minus {
  background-color: #cc0000;
}

.btn-float.edit {
  background-color: #ffa500;
}

.btn-float.transfer {
  background-color: #9b59b6;
  font-size: 32px;
}

/* ✅ NUEVO: Botón de refrescar */
.btn-float.refresh {
  background-color: #27ae60;
  font-size: 36px;
}

/* MODAL - Optimizado para móvil */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0,0,0,0.6);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background-color: #fff;
  margin: 30px auto;
  padding: 30px 25px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content h2 {
  text-align: center;
  color: #004481;
  margin: 0 0 25px 0;
  font-size: 28px;
}

.modal-content label {
  display: block;
  margin-top: 15px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 18px;
  color: #333;
}

/* INPUTS OPTIMIZADOS - Font-size 16px evita el zoom automático en iOS */
.modal-content input,
.modal-content select {
  width: 100%;
  padding: 16px 12px;
  border-radius: 12px;
  border: 2px solid #ddd;
  font-size: 16px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background-color: #f9f9f9;
}

.modal-content input:focus,
.modal-content select:focus {
  outline: none;
  border-color: #004481;
  background-color: white;
}

.modal-content select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.modal-buttons button {
  flex: 1;
  padding: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: white;
  font-size: 18px;
  font-weight: 600;
  transition: transform 0.1s;
}

.modal-buttons button:active {
  transform: scale(0.96);
}

#btnGuardarIngreso {
  background-color: #004481;
}

#btnCancelarIngreso {
  background-color: #cc0000;
}

#btnGuardarSalida {
  background-color: #cc0000;
}

#btnCancelarSalida {
  background-color: #666;
}

/* CONTENEDOR DE DOS TABLAS */
.tablas-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 15px;
  padding-bottom: 200px;
}

/* TABLA DE MOVIMIENTOS */
.tabla-container {
  display: flex;
  flex-direction: column;
}

/* Responsive: En móvil las tablas van una debajo de la otra */
@media (max-width: 768px) {
  .tablas-wrapper {
    grid-template-columns: 1fr;
  }
}

.tabla-titulo {
  text-align: center;
  color: #004481;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 15px;
}

.tabla-movimientos {
  background-color: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.movimiento-item {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  gap: 20px;
}

.movimiento-item:active {
  background-color: #f7f7f7;
}

.movimiento-item:last-child {
  border-bottom: none;
}

.movimiento-monto {
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.movimiento-monto.ingreso {
  color: #00a854;
}

.movimiento-monto.salida {
  color: #cc0000;
}

.movimiento-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  flex: 1;
}

.movimiento-detalle {
  font-size: 18px;
  font-weight: 500;
  color: #333;
}

.movimiento-cuenta {
  font-size: 14px;
  font-weight: 500;
  color: #666;
  background-color: #f0f0f0;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-block;
  width: fit-content;
}

.mensaje-vacio {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

/* TABLA DE PENDIENTES */
.tabla-pendientes {
  background-color: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pendiente-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pendiente-descripcion {
  font-size: 17px;
  font-weight: 500;
  color: #333;
}

.pendiente-fecha {
  font-size: 13px;
  color: #666;
}

.pendiente-monto {
  font-size: 20px;
  font-weight: 700;
  color: #cc0000;
}

/* ===== PENDIENTES AGRUPADOS POR CATEGORÍA ===== */
.categoria {
  background-color: white;
  border-radius: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.categoria-header {
  background-color: #004481;
  color: white;
  font-size: 20px;
  font-weight: 600;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.categoria-header .arrow {
  transition: transform 0.2s ease;
}

.categoria-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.categoria-body.open {
  max-height: 1000px;
}

.pendiente-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-top: 1px solid #eee;
}

#selectPendiente {
  width: 100%;
  padding: 16px 12px;
  border-radius: 12px;
  border: 2px solid #ddd;
  font-size: 16px;
  background-color: #f9f9f9;
  margin-bottom: 15px;
}

.btn-cargar-mas {
  background-color: #004481;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s;
  box-shadow: 0 2px 6px rgba(0, 68, 129, 0.3);
}

.btn-cargar-mas:hover {
  background-color: #003366;
}

.btn-cargar-mas:active {
  transform: scale(0.96);
}

/* ✅ NUEVO: Estilos para modal de transferencia */
#btnGuardarTransferencia {
  background-color: #9b59b6;
}

#btnCancelarTransferencia {
  background-color: #666;
}

/* ✅ NUEVO: Indicador visual de transferencia */
.transferencia-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
  font-size: 18px;
  color: #666;
}

.transferencia-visual .flecha {
  font-size: 24px;
  color: #9b59b6;
}

.movimiento-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  gap: 15px;
}

.movimiento-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.movimiento-acciones {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.btn-editar,
.btn-eliminar {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, opacity 0.2s;
}

.btn-editar {
  background-color: #ffa500;
  color: white;
}

.btn-eliminar {
  background-color: #cc0000;
  color: white;
}

.btn-editar:active,
.btn-eliminar:active {
  transform: scale(0.9);
}

/* BOTÓN CONFIGURACIÓN */
.btn-config {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.3);
  font-size: 20px;
  cursor: pointer;
  box-shadow: none;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  opacity: 0.5;
}

.btn-config:active {
  opacity: 1;
  transform: rotate(90deg);
}

.btn-config:active {
  transform: rotate(90deg);
}

/* OPCIONES DE CONFIGURACIÓN */
.config-opciones {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.btn-config-opcion {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 12px;
  background-color: #f0f4f8;
  color: #004481;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s;
}

.btn-config-opcion:active {
  background-color: #004481;
  color: white;
}