/* Colores y letra en un solo lugar: cambiarlos acá cambia toda la app. */
:root {
  --fondo: #F4F1EA;
  --superficie: #FFFFFF;
  --tinta: #1B2A30;
  --tinta-suave: #33474D;
  --apagado: #5B6B70;
  --borde: #D6CFC0;
  --linea: #ECE7DC;
  --principal: #165E6B;
  --principal-oscuro: #0E434D;
  --principal-claro: #DDEBEC;
  --gasto: #A84A1F;
  --alerta-fondo: #F6E3D8;
  --alerta-texto: #6E2F12;
  --neutro: #EFEBE2;
  --letra: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--tinta);
  font-family: var(--letra);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(32px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1 { font-size: 26px; font-weight: 700; margin: 0; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 700; margin: 0; }
p { margin: 0; }
.apagado { color: var(--apagado); font-size: 14px; }
.chico { font-size: 13px; }
.centro { text-align: center; }
.crece { flex-grow: 1; }

/* Logo provisorio: dos olas */
.logo, .logo-grande {
  display: inline-block;
  background: var(--principal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none'%3E%3Cpath d='M6 18c6-5 12-5 18 0s12 5 18 0' stroke='white' stroke-width='3.5' stroke-linecap='round'/%3E%3Cpath d='M6 30c6-5 12-5 18 0s12 5 18 0' stroke='white' stroke-opacity='.6' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 62% no-repeat;
}
.logo { width: 64px; height: 64px; border-radius: 18px; }
.logo-grande { width: 84px; height: 84px; border-radius: 24px; }
.marca { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 32px; }
.marca .nombre { font-size: 26px; font-weight: 700; }

.cargando { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--apagado); }

/* Formularios */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label { font-size: 14px; color: var(--apagado); }
input {
  font: inherit;
  font-size: 16px;
  min-height: 52px;
  width: 100%;
  padding: 0 14px;
  border: 2px solid var(--borde);
  border-radius: 14px;
  background: var(--superficie);
  color: var(--tinta);
}
input:focus { outline: none; border-color: var(--principal); }
input.grande { font-size: 22px; font-weight: 700; }
input.pin { font-size: 24px; letter-spacing: 0.5em; text-align: center; }

/* Botones */
button, .boton {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  text-decoration: none;
}
.boton {
  min-height: 56px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}
.boton.principal { background: var(--principal); color: #fff; }
.boton.principal:active { background: var(--principal-oscuro); }
.boton.secundario { background: var(--superficie); color: var(--principal); border: 2px solid var(--principal); }
.boton.texto { min-height: 44px; font-size: 15px; color: var(--principal); }
.boton.texto.apagado { color: var(--tinta-suave); font-weight: 500; }
.boton:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 3px solid var(--principal); outline-offset: 2px; }

.fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dos-columnas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Avisos */
.aviso { border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.aviso.error { background: var(--alerta-fondo); color: var(--alerta-texto); }
.aviso.ok { background: var(--principal-claro); color: var(--principal-oscuro); }
.aviso.info { background: var(--neutro); color: var(--tinta-suave); }

/* Pasos de la primera vez */
.barra-pasos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.barra-pasos span { height: 6px; border-radius: 3px; background: var(--borde); }
.barra-pasos span.hecho { background: var(--principal); }

/* Inicio */
.encabezado { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.encabezado .negocio { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; color: var(--apagado); }
.encabezado .fecha { font-size: 24px; font-weight: 700; }
.circulo {
  width: 48px; height: 48px; border-radius: 24px;
  background: var(--superficie); color: var(--tinta-suave);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.saldo {
  background: var(--principal); color: #fff;
  border-radius: 20px; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.saldo .monto { font-size: 34px; font-weight: 700; letter-spacing: -0.01em; }
.saldo .ojo { background: rgba(255,255,255,0.16); color: #fff; }
.saldo .desglose { display: flex; gap: 24px; font-size: 13px; }
.saldo .desglose span { display: flex; flex-direction: column; gap: 2px; }
.saldo .desglose strong { font-size: 16px; }
.tarjeta { background: var(--superficie); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pronto { color: var(--apagado); font-size: 14px; }

.vista, form { display: flex; flex-direction: column; gap: 16px; }
.vista { flex-grow: 1; }
form { flex-grow: 1; }
.marca + .crece { min-height: 24px; }


/* Parte 2: registrar y movimientos */
.etiqueta { font-size: 14px; color: var(--apagado); }
.enlace-izq { justify-content: flex-start; padding: 0; align-self: flex-start; }
.grande-accion { min-height: 84px; border-radius: 16px; justify-content: flex-start; align-items: flex-end; padding: 16px; font-size: 16px; text-align: left; }
.grande-accion.gasto { background: var(--gasto); color: #fff; }
.grande-accion.ingreso { background: var(--superficie); color: var(--principal); border: 2px solid var(--principal); }
.boton.principal.gasto { background: var(--gasto); }
.boton.principal.ajuste { background: var(--tinta); }

.lista-movs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mov { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--linea); }
.mov:first-child { border-top: none; }
.mov-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mov-titulo { font-weight: 500; overflow-wrap: anywhere; }
.mov-monto { font-weight: 700; white-space: nowrap; }
.mov-monto.entra { color: var(--principal); }
.mov-monto.sale { color: var(--gasto); }
.mov-monto.neutro { color: var(--apagado); }

.solapas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #E6E0D3; border-radius: 14px; padding: 4px; }
.solapa { min-height: 44px; border-radius: 10px; font-weight: 700; color: var(--tinta-suave); }
.solapa[aria-selected="true"].gasto { background: var(--gasto); color: #fff; }
.solapa[aria-selected="true"].ingreso { background: var(--principal); color: #fff; }
.solapa[aria-selected="true"].ajuste { background: var(--tinta); color: #fff; }

.monto-grande { display: flex; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--tinta); padding-bottom: 4px; }
.monto-grande span { font-size: 30px; font-weight: 700; }
.monto-grande input { border: none; background: transparent; font-size: 38px; font-weight: 700; padding: 0; min-height: 56px; border-radius: 0; }
.monto-grande input:focus { outline: none; }
.monto-grande:focus-within { border-color: var(--principal); }

.columna { display: flex; flex-direction: column; gap: 8px; }
.opcion-grande {
  min-height: 56px; border-radius: 14px; border: 2px solid var(--borde); background: var(--superficie);
  font-weight: 700; font-size: 15px; padding: 8px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
}
.columna .opcion-grande { align-items: flex-start; text-align: left; }
.opcion-grande .chico { font-weight: 400; }
.opcion-grande[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }

.buscador { background: var(--superficie); border: 2px solid var(--principal); border-radius: 14px; overflow: hidden; }
.buscador input { border: none; border-radius: 0; }
.opciones { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; }
.opcion { min-height: 46px; text-align: left; padding: 0 14px; border-top: 1px solid var(--linea); }
.opcion.crear { background: #F2F8F8; color: var(--principal); font-weight: 700; }
.opcion-vacia { padding: 12px 14px; border-top: 1px solid var(--linea); }
.elegido { display: flex; justify-content: space-between; align-items: center; background: var(--superficie); border: 2px solid var(--principal); border-radius: 14px; padding: 4px 6px 4px 14px; }

.menu { display: flex; flex-direction: column; gap: 10px; }
.item-menu { background: var(--superficie); border-radius: 16px; min-height: 72px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; text-align: left; }
.item-menu > span { display: flex; flex-direction: column; gap: 2px; }
.error-form:empty { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .vista { animation: aparecer 0.18s ease-out; }
  @keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
