/* Paleta y tipografías luisdev (Recursos/Colores/paleta-luisdev.md). Pilar finanzas = mint; peach solo en el CTA. */
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url(fonts/space-grotesk-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --ink: #0f1117;
  --surface: #171a23;
  --surface-2: #20242f;
  --line: #2c3140;
  --text: #eceaf4;
  --muted: #9a9db2;
  --lavender: #b4a7f5;
  --mint: #8fd9b6;
  --peach: #f4b896;
  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

*, ::before, ::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(60rem 30rem at 85% -10%, color-mix(in oklab, var(--mint) 14%, transparent), transparent 70%),
    radial-gradient(50rem 25rem at -10% 0%, color-mix(in oklab, var(--lavender) 12%, transparent), transparent 70%),
    var(--ink);
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.6 'Inter', ui-sans-serif, system-ui, sans-serif;
}

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.9rem, 7vw, 2.5rem); margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.3rem; display: flex; align-items: center; gap: 0.6rem; }
h3 { font-size: 1.05rem; margin-top: 1.5rem; }
p { margin: 0.75rem 0 0; }
a { color: var(--lavender); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--lavender); outline-offset: 3px; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.logo { font-family: var(--mono); font-weight: 500; color: var(--lavender); text-decoration: none; display: inline-block; padding: 12px 0; }
.logo span { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .logo span { animation: none; } }
.eyebrow { font-family: var(--mono); font-size: 14px; color: var(--mint); margin-top: 1rem; }
.muted, .hint, .legend, .foot { color: var(--muted); }
.hint, .legend { font-size: 15px; }

.card {
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  margin-top: 16px;
}
.num {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  font-family: var(--mono); font-size: 15px;
  color: var(--mint); background: color-mix(in oklab, var(--mint) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--mint) 30%, transparent);
}

/* Campos: 16px para que el iPhone no haga zoom; 48px de alto para el pulgar. */
label { display: block; font-weight: 600; font-size: 15px; margin-top: 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid label, .fila label { margin-top: 12px; }
.span2 { grid-column: span 2; }
@media (min-width: 520px) { .grid { grid-template-columns: 1.4fr 1fr 1fr; } .span2 { grid-column: auto; } }
.field {
  display: flex; align-items: center;
  margin-top: 6px; min-height: 48px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.field:focus-within { border-color: var(--lavender); }
.field:has([aria-invalid]) { border-style: dashed; border-color: var(--muted); }
.affix { color: var(--muted); font-weight: 400; padding: 0 12px; font-family: var(--mono); font-size: 15px; }
.field .affix:first-child { padding-right: 0; }
.field .affix:last-child { padding-left: 0; }
input, textarea {
  font: inherit; font-weight: 400; font-size: 16px; color: var(--text);
  background: transparent; border: 0; outline: none;
  width: 100%; min-width: 0; padding: 12px;
}
.field input { min-height: 46px; }
.nombre input { margin-top: 6px; min-height: 48px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.nombre input:focus { border-color: var(--lavender); }
input::placeholder { color: color-mix(in oklab, var(--muted) 70%, transparent); }
.error { color: var(--text); font-size: 15px; border-left: 3px solid var(--muted); padding-left: 10px; }

/* Resultados */
.res { margin: 16px 0 0; display: grid; gap: 8px; }
.res div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.res dt { color: var(--muted); }
.res dd { margin: 0; font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.res .total { border-bottom: 0; }
.res .total dt { color: var(--text); font-weight: 600; }
.res .total dd { font-family: var(--display); font-weight: 700; font-size: 1.6rem; color: var(--mint); }
.bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin-top: 4px; }
.bar span { flex-basis: 0; transition: flex-grow 0.3s ease; }
#barCapital { background: var(--lavender); }
#barCosto { background: var(--mint); }
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.legend span { white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.capital { background: var(--lavender); }
.dot.costo { background: var(--mint); }
.ahorro:not(:empty) {
  font-family: var(--display); font-weight: 700; font-size: 1.25rem;
  color: var(--mint); margin-top: 16px; padding: 14px 16px; border-radius: 14px;
  background: color-mix(in oklab, var(--mint) 10%, transparent);
  border: 1px solid color-mix(in oklab, var(--mint) 30%, transparent);
}

/* Deudas */
.fila {
  display: grid; grid-template-columns: 1fr 1fr 48px; gap: 0 12px;
  padding: 4px 0 16px; border-bottom: 1px solid var(--line);
}
.fila .nombre { grid-column: 1 / 3; }
.fila .tcea { grid-column: 2 / 4; }
.quitar {
  align-self: end; height: 48px; width: 48px;
  font-size: 24px; line-height: 1; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.orden { margin: 8px 0 0; padding-left: 1.4rem; display: grid; gap: 6px; }
.orden b {
  display: inline-block; margin-left: 8px;
  font-family: var(--mono); font-weight: 500; font-size: 13px;
  color: var(--ink); background: var(--mint); border-radius: 99px; padding: 0 8px;
}
textarea {
  display: block; margin-top: 12px; resize: vertical;
  background: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--mono); font-size: 14px; line-height: 1.55; color: var(--text);
}
.aviso { font-weight: 600; }
.tips { margin: 12px 0 0; padding-left: 1.2rem; display: grid; gap: 10px; }

/* Botones */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 48px; margin-top: 12px; padding: 0 20px;
  font: inherit; font-weight: 600; text-decoration: none;
  color: var(--ink); background: var(--lavender);
  border: 1px solid var(--lavender); border-radius: 99px; cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { color: var(--text); background: transparent; border-color: var(--line); }
.btn.peach { background: var(--peach); border-color: var(--peach); }
@media (hover: hover) {
  .btn.ghost:hover, .quitar:hover { background: var(--surface-2); }
  .btn:not(.ghost):not(:disabled):hover { filter: brightness(1.06); }
}
.cta { text-align: center; }
.cta h2 { justify-content: center; }

.foot { font-size: 14px; text-align: center; padding: 24px 8px 8px; }
.foot a { font-family: var(--mono); }
