/* =============================================================================
   Gastos del Hogar — estilos. Fuente de verdad: docs/diseno/direccion-visual.md
   Menos es más: sin cards, sin sombras, sin radios. Tamaño y aire.
   ============================================================================= */
:root {
  --papel: #EEE8DD; --tinta: #1E1D1B; --tinta-suave: #6E6A62;
  --linea: #D9D2C5; --acento: #E5552B; --ambar: #B9862A;
  --fuente: "Archivo", system-ui, sans-serif;
  --heroe: clamp(72px, 24vw, 128px);
  --e1: 4px; --e2: 8px; --e3: 16px; --e4: 24px; --e5: 40px; --e6: 64px;
  --margen: 20px; --ancho-max: 480px; --filete: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papel: #171614; --tinta: #ECE6DA; --tinta-suave: #9A958B;
    --linea: #2E2C29; --acento: #F0663C; --ambar: #D4A24A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papel: #171614; --tinta: #ECE6DA; --tinta-suave: #9A958B;
  --linea: #2E2C29; --acento: #F0663C; --ambar: #D4A24A;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--papel); color: var(--tinta);
  font-family: var(--fuente); font-size: 16px; line-height: 1.4;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; background: none; border: 0; border-radius: 0; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ---- Hoja ---------------------------------------------------------------- */
.hoja {
  max-width: var(--ancho-max); margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: max(var(--e4), env(safe-area-inset-top)) var(--margen) 0;
}
.contenido { flex: 1; }

/* ---- Vocabulario --------------------------------------------------------- */
.etiqueta { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--tinta-suave); }
.filete { height: var(--filete); width: 40%; background: var(--tinta); }
.heroe { font-size: var(--heroe); font-weight: 800; font-stretch: 75%; letter-spacing: -.03em; line-height: .85; overflow-wrap: anywhere; }
.heroe sup { font-size: .32em; font-weight: 700; letter-spacing: 0; vertical-align: top; position: relative; top: .25em; margin-left: .06em; }
.suave { color: var(--tinta-suave); }
.chico { font-size: 14px; }
.seccion { margin-top: var(--e5); }
.seccion > .filete { margin-bottom: var(--e3); }
.bloque-heroe { margin-top: var(--e5); }
.bloque-heroe > .etiqueta:first-child { display: block; margin-bottom: var(--e2); }
.bloque-heroe > .etiqueta:last-child { display: block; margin-top: var(--e3); }

/* ---- Navegación (arriba, texto plano) ------------------------------------ */
.nav { display: flex; justify-content: space-between; gap: var(--e3); }
.nav a { padding-bottom: 6px; }
.nav a[aria-current="page"] { color: var(--tinta); box-shadow: inset 0 -3px 0 var(--tinta); }

/* ---- Filas y listas ------------------------------------------------------ */
.fila {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--e3);
  padding: 14px 0; border-bottom: 1px solid var(--linea); width: 100%; text-align: left;
}
.fila .izq { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .der { flex-shrink: 0; }
.fila .sub { display: block; font-size: 13px; color: var(--tinta-suave); margin-top: 2px; }

/* ---- Presupuesto --------------------------------------------------------- */
.presu { padding: 14px 0 12px; border-bottom: 1px solid var(--linea); }
.presu .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: var(--e3); }
.presu .cifra { font-size: 14px; color: var(--tinta-suave); white-space: nowrap; }
.presu .cifra b { color: var(--tinta); font-weight: 600; }
.barra { height: 3px; background: var(--linea); }
.barra i { display: block; height: 100%; background: var(--tinta); max-width: 100%; }
.ambar .barra i { background: var(--ambar); }
.rojo .barra i { background: var(--acento); }
/* El texto del estado va en tinta (AA); el color solo en el cuadradito y la barra */
.estado { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-left: var(--e2); }
.estado::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; }
.ambar .estado::before { background: var(--ambar); }
.rojo .estado::before { background: var(--acento); }

/* ---- Botones ------------------------------------------------------------- */
.primario {
  display: block; width: 100%;
  background: var(--acento); color: #1E1D1B;
  font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  padding: 20px; text-align: center;
}
.primario:disabled { opacity: .5; cursor: default; }
.secundario { text-decoration: underline; text-underline-offset: 3px; padding: 10px 0; }
.pie {
  position: sticky; bottom: 0; background: var(--papel);
  padding: var(--e3) 0 max(var(--e4), env(safe-area-inset-bottom)); margin-top: var(--e5);
}

/* ---- Formularios --------------------------------------------------------- */
.campo { padding: 14px 0; border-bottom: 1px solid var(--linea); }
.campo > .etiqueta { display: block; margin-bottom: 6px; }
.campo input, .campo select { width: 100%; padding: 4px 0; min-height: 32px; }
.campo input::placeholder { color: var(--tinta-suave); opacity: .6; }
input.heroe { width: 100%; padding: 0; caret-color: var(--acento); }
input.heroe:focus-visible { outline: none; }   /* el cursor naranja ya marca el foco */
input.heroe::placeholder { color: var(--linea); opacity: 1; }
.selector { display: flex; gap: 6px var(--e4); flex-wrap: wrap; }
.selector button { color: var(--tinta-suave); padding: 6px 0; min-height: 44px; }
.selector button[aria-pressed="true"] { color: var(--tinta); box-shadow: inset 0 -3px 0 var(--tinta); }
.en-linea { display: flex; gap: var(--e3); align-items: center; }
.en-linea input { flex: 1; min-width: 0; }

/* ---- Estadísticas -------------------------------------------------------- */
.grafico { display: flex; align-items: flex-end; gap: 6px; height: 160px; margin-top: var(--e3); }
.grafico .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.grafico .bar { background: var(--tinta); min-height: 1px; }
.grafico .previo { position: absolute; left: -3px; right: -3px; height: 0; border-top: 2px solid var(--tinta-suave); z-index: 1; }
.grafico-ejes { display: flex; gap: 6px; margin-top: 6px; }
.grafico-ejes span { flex: 1; text-align: center; font-size: 10px; letter-spacing: .08em; color: var(--tinta-suave); text-transform: uppercase; }

/* ---- Aviso (toast mínimo) ------------------------------------------------ */
.aviso {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom)); max-width: calc(var(--ancho-max) - 2 * var(--margen));
  width: calc(100% - 2 * var(--margen));
  background: var(--tinta); color: var(--papel); padding: 12px 16px; font-size: 14px;
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.aviso.visible { opacity: 1; }

.vacio { padding: var(--e4) 0; color: var(--tinta-suave); }
.oculto { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
