/* Pausa — minimalista, tranquilo, sin rojos. Oscuro por defecto si el sistema lo pide. */
:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #e9e6df;
  --ink: #1b2026;
  --muted: #5d6873;
  --line: rgba(27, 32, 38, 0.1);
  --accent: #2f7d63;
  --on-accent: #ffffff;
  --accent-soft: rgba(47, 125, 99, 0.12);
  --amber: #8a5a12;
  --amber-soft: rgba(181, 128, 40, 0.14);
  --ring: #1b2026;
  --radius: 16px;
  --radius-sm: 10px;
  --space: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151a;
    --surface: #1a2027;
    --surface-2: #232b34;
    --ink: #e9edf0;
    --muted: #9aa6b2;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #7cc4a8;
    --on-accent: #0e1a15;
    --accent-soft: rgba(124, 196, 168, 0.14);
    --amber: #e0b465;
    --amber-soft: rgba(224, 180, 101, 0.14);
    --ring: #e9edf0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 20px) var(--space) calc(96px + env(safe-area-inset-bottom));
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stack > * + * { margin-top: var(--space); }
.stack-sm > * + * { margin-top: 8px; }

/* Encabezado de sección */
.top { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; min-height: 48px; }
.top h1 { flex: 1; }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.soft { background: var(--accent-soft); border-color: transparent; }
.card.warn { background: var(--amber-soft); border-color: transparent; }

/* Saldo de la semana */
.saldo { text-align: center; padding: 28px 20px; }
.saldo .valor { font-size: clamp(2.75rem, 14vw, 3.75rem); font-weight: 650; line-height: 1.05; margin: 6px 0 4px; }
.saldo.bajo .valor { color: var(--amber); }

/* Botones */
button, .btn {
  font: inherit; color: inherit; cursor: pointer; border: 0; background: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: var(--radius-sm);
  text-decoration: none; transition: transform 120ms ease, background-color 160ms ease, opacity 160ms ease;
  -webkit-user-select: none; user-select: none;
}
button:active, .btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { opacity: 0.92; }
.btn-secondary { background: var(--surface-2); color: var(--ink); font-weight: 500; }
.btn-ghost { color: var(--muted); padding-inline: 12px; }
.btn-big { width: 100%; min-height: 64px; font-size: 1.125rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Opciones grandes (tipo, monto, categoría) */
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcion {
  min-height: 64px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 1.0625rem; font-weight: 500;
}
.opcion[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* Formularios */
label { display: block; font-weight: 500; margin-bottom: 6px; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 48px;
}
textarea { min-height: 120px; resize: vertical; }
input.monto { font-size: 1.5rem; font-weight: 600; }
.error { color: var(--amber); font-size: 0.9375rem; margin-top: 6px; }
.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.interruptor input { width: 24px; height: 24px; min-height: 0; accent-color: var(--accent); }

/* Listas */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.lista li:last-child { border-bottom: 0; }
.lista .grow { flex: 1; min-width: 0; }
.lista .sub { color: var(--muted); font-size: 0.875rem; }
.lista input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; accent-color: var(--accent); flex: none; }

/* Reloj del freno */
.reloj { font-size: clamp(4rem, 22vw, 5.5rem); font-weight: 600; text-align: center; line-height: 1; margin: 12px 0; }
.anillo { display: block; margin: 0 auto; }
.anillo circle { fill: none; stroke-width: 8; }
.anillo .fondo { stroke: var(--surface-2); }
.anillo .avance { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* Barra inferior */
nav.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.barra ul { display: flex; max-width: 480px; margin: 0 auto; padding: 0; list-style: none; }
nav.barra li { flex: 1; }
nav.barra a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 500;
}
nav.barra a[aria-current="page"] { color: var(--accent); }
nav.barra svg, .icono { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Gráfico */
.grafico { width: 100%; height: auto; display: block; }
.grafico .barra-g { fill: var(--muted); opacity: 0.45; }
.grafico .barra-g.actual { fill: var(--accent); opacity: 1; }
.grafico text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

.aviso { margin-bottom: var(--space); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
