:root {
  --cielo-1: #3f5f73;
  --cielo-2: #5e7d90;
  --cielo-3: #a9bdc8;
  --fondo: #eef2f4;
  --vidrio: rgba(255, 255, 255, 0.78);
  --vidrio-borde: rgba(255, 255, 255, 0.9);
  --linea: #dfe6ea;
  --texto: #0f1c24;
  --suave: #566771;
  --tenue: #8797a1;
  --acento: #3f5f73;
  --acento-2: #6b8ba0;
  --barra: #2c7fb8;
  --positivo: #1b7450;
  --error: #b3261e;
  --ambar: #7c4a00;
  --ambar-fondo: #ffe9c7;
  --rojo-fondo: #ffdfda;
  --sombra: 0 10px 30px rgba(35, 60, 75, 0.1);
}

* { box-sizing: border-box; }

html { background: var(--fondo); }

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, var(--cielo-1) 0, var(--cielo-2) 96px, var(--cielo-3) 190px, var(--fondo) 340px)
    no-repeat var(--fondo);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

body.con-menu { padding-bottom: 112px; }

a { color: var(--acento); }

h1, h2 { font-weight: 600; letter-spacing: -0.02em; }
h1 { margin: 0; font-size: 22px; line-height: 1.2; }
h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 16px; }

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.contenido { max-width: 520px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 16px; }

.suave { color: var(--suave); }
.sin-margen { margin: 0; }
.centrada { text-align: center; }
.nota { margin: 8px 0 14px; color: var(--suave); font-size: 14px; }
.ayuda-superior { margin: 0 0 14px; }

.tarjeta {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 22px;
  background: var(--vidrio);
  box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.saludo { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: #fff; }
.saludo small { display: block; font-size: 13px; }
.saludo strong { font-size: 17px; font-weight: 600; }

.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.avatar-grande { width: 46px; height: 46px; border: 2px solid rgba(255, 255, 255, 0.75); font-size: 18px; }
.c0 { background: #3f5f73; }
.c1 { background: #7a5c86; }
.c2 { background: #2f7468; }
.c3 { background: #9a5b3d; }

.balance { padding: 10px 0 18px; text-align: center; }
.balance p { margin: 0; }
.balance-rotulo { font-size: 15px; font-weight: 500; }

.balance-monto {
  margin: 4px 0;
  font-size: 46px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.balance .centavos { color: rgba(15, 28, 36, 0.55); }
.centavos { color: var(--tenue); font-weight: 500; }

.limite {
  display: inline-block;
  margin-top: 8px !important;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--vidrio);
  font-size: 13px;
  font-weight: 500;
}

.limite-cerca { background: var(--ambar-fondo); color: var(--ambar); }
.limite-pasado { background: var(--rojo-fondo); color: var(--error); }

.acciones { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }

.pildora {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 99px;
  background: var(--vidrio);
  box-shadow: var(--sombra);
  color: var(--texto);
  font-weight: 500;
  text-decoration: none;
}

.mas-redondo, .boton {
  border: 0;
  background: linear-gradient(145deg, var(--acento-2), var(--acento));
  color: #fff;
  cursor: pointer;
}

.mas-redondo {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(63, 95, 115, 0.35);
}

.metricas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.metrica { display: block; color: var(--texto); text-decoration: none; }
.metrica-titulo { display: block; margin-bottom: 18px; font-weight: 500; }
.metrica-titulo small { display: block; color: var(--suave); font-size: 12px; font-weight: 400; }
.metrica strong { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; overflow-wrap: anywhere; }

.nota-cuenta h2 { margin-bottom: 6px; font-size: 15px; }
.nota-cuenta p { margin: 0; color: var(--suave); font-size: 14px; }

.titulo-lista { justify-content: space-between; margin: 18px 2px 10px; }
.titulo-lista a { color: var(--suave); font-size: 13px; font-weight: 400; }

.movimientos { margin: 0; padding: 0; list-style: none; }

.movimiento {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 20px;
  background: var(--vidrio);
}

.movimiento-info { flex: 1; min-width: 0; }
.movimiento-info strong { display: block; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.movimiento-info small, .movimiento-monto small { color: var(--suave); font-size: 12px; }
.movimiento-monto { flex: none; font-size: 15px; font-weight: 600; text-align: right; }
.movimiento-monto small { display: block; font-weight: 400; }
.positivo { color: var(--positivo); }
.en-linea { display: inline; }

.vacio { padding: 24px 0; color: var(--suave); text-align: center; }

.aviso {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--sombra);
  color: var(--positivo);
  font-size: 14px;
}

.aviso-error { color: var(--error); }
.aviso-info { color: var(--suave); }

.campo { margin-bottom: 12px; }

.campo label, .copiar label {
  display: block;
  margin-bottom: 4px;
  color: var(--suave);
  font-size: 13px;
}

input:not([type="hidden"]):not([type="checkbox"]), select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--linea);
  border-radius: 14px;
  background: #fff;
  color: var(--texto);
  font: inherit;
  font-size: 16px;
}

input[type="file"] { padding: 11px; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--acento); }

.ayuda { margin-top: 4px; color: var(--suave); font-size: 12px; }
.ayuda ul { margin: 0; padding-left: 18px; }
.error { margin: 4px 0 0; color: var(--error); font-size: 13px; }

.boton, .boton-sec, .boton-texto {
  display: inline-block;
  font: inherit;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.boton { min-height: 52px; padding: 14px 20px; border-radius: 99px; font-weight: 600; }
.ancho { display: block; width: 100%; }

.boton-sec {
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid var(--linea);
  border-radius: 99px;
  background: #fff;
  color: var(--texto);
  font-weight: 500;
}

.boton-texto {
  padding: 0;
  border: 0;
  background: none;
  color: var(--suave);
  font-size: 12px;
  letter-spacing: inherit;
  text-decoration: underline;
}

.peligro { display: block; margin: 8px auto; color: var(--error); font-size: 15px; }

:focus-visible { outline: 3px solid #e2a42b; outline-offset: 2px; }

.encabezado { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 18px; color: #fff; }

.redondo {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  cursor: pointer;
}

.negocios { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }

.pastilla {
  padding: 6px 14px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 99px;
  background: var(--vidrio);
  color: var(--texto);
  font-size: 14px;
  text-decoration: none;
}

.pastilla.activa { border-color: var(--acento); background: var(--acento); color: #fff; }

.paso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--acento);
  color: #fff;
  font-size: 13px;
}

.oscuro { font-size: 40px; }

.copiar { margin-bottom: 12px; }
.copiar-fila { display: flex; gap: 8px; }
.copiar-fila input { flex: 1; min-width: 0; }

.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.filtros .campo { margin: 0; }
.filtros select { padding-right: 6px; padding-left: 10px; font-size: 15px; }

.grafico { display: flex; gap: 2px; height: 170px; }

.columna {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  border-radius: 8px;
}

.columna-area {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-end;
  justify-content: center;
  margin-top: 26px;
  border-bottom: 1px solid var(--linea);
}

.columna-barra {
  display: block;
  width: 26px;
  border-radius: 4px 4px 0 0;
  background: var(--barra);
}

.columna-valor {
  position: absolute;
  left: 0;
  right: 0;
  padding-bottom: 4px;
  color: var(--texto);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.columna-tip {
  position: absolute;
  z-index: 2;
  top: -26px;
  left: 50%;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--texto);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
}

.columna:hover .columna-tip, .columna:focus .columna-tip { opacity: 1; }
.columna:first-child .columna-tip { left: 0; transform: none; }
.columna:last-child .columna-tip { right: 0; left: auto; transform: none; }

.columna-etiqueta { padding-top: 6px; color: var(--suave); font-size: 12px; text-align: center; }

.tabla-datos { margin-top: 12px; }
.tabla-datos summary { color: var(--suave); cursor: pointer; font-size: 13px; }
.tabla-datos table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 14px; }
.tabla-datos th, .tabla-datos td { padding: 6px 0; border-bottom: 1px solid var(--linea); text-align: left; }
.tabla-datos th:last-child, .tabla-datos td:last-child { text-align: right; }

.por-persona, .lista-ajustes { margin: 0 0 12px; padding: 0; list-style: none; }

.por-persona li, .lista-ajustes li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--linea);
}

.por-persona { margin: 0; }
.por-persona li:last-child { border-bottom: 0; }
.por-persona strong { font-weight: 600; }
.lista-ajustes small { display: block; color: var(--suave); font-size: 13px; }

.perfil { display: flex; align-items: center; gap: 12px; }
.perfil .avatar { border-color: #fff; }
.perfil strong { display: block; font-weight: 600; }
.perfil small { color: var(--suave); }

.mas { margin-bottom: 14px; }
.mas summary { margin-bottom: 10px; color: var(--acento); cursor: pointer; font-size: 14px; }

.hoja {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  margin: auto auto 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 28px 28px 0 0;
  background: #fff;
  color: var(--texto);
}

.hoja::backdrop { background: rgba(25, 42, 53, 0.45); }

.hoja-cabecera { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hoja-cabecera h2 { margin: 0; font-size: 18px; }
.hoja-cabecera .redondo { border-color: var(--linea); background: var(--fondo); }

.acceso { padding-top: 7vh; }
.acceso h1 { font-size: 24px; }
.acceso .suave { margin: 6px 0 16px; }

.logo {
  display: block;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--acento-2), var(--acento));
}

.menu {
  position: fixed;
  z-index: 4;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  max-width: 496px;
  margin: 0 auto;
  padding: 6px;
  border: 1px solid var(--vidrio-borde);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 30px rgba(35, 60, 75, 0.18);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.menu a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: 20px;
  color: var(--suave);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.menu a.activo { background: var(--acento); color: #fff; }

@media (max-width: 370px) {
  .balance-monto { font-size: 38px; }
}
