/* Lista Compra — estilos base (mobile-first, claro y oscuro) */

:root {
  --fondo: #F6F7F4;
  --superficie: #FFFFFF;
  --texto: #1B1F1D;
  --texto-suave: #5C6661;
  --borde: #E1E5E0;
  --acento: #1F8A5B;
  --acento-texto: #FFFFFF;
  --acento-suave: #E3F3EA;
  --aviso: #B25E09;
  --aviso-suave: #FCEFD9;
  --radio: 16px;
  --toque: 48px;               /* tamaño mínimo de cualquier zona táctil */
  --barra-alto: 64px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #12161A;
    --superficie: #1C2227;
    --texto: #ECEFEA;
    --texto-suave: #A3ADA7;
    --borde: #2C353B;
    --acento: #4CC38A;
    --acento-texto: #0B1A12;
    --acento-suave: #1B3329;
    --aviso: #F0B25A;
    --aviso-suave: #3A2C14;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fondo);
  color: var(--texto);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Respeta el notch y la barra inferior del iPhone */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           calc(var(--barra-alto) + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

h1, h2, h3, p, dl, dd, ol { margin: 0; }

/* ---------- Cabecera ---------- */
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
}
.cabecera h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; }

.chip {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.chip[data-estado="ok"]    { background: var(--acento-suave); color: var(--acento); }
.chip[data-estado="aviso"] { background: var(--aviso-suave);  color: var(--aviso); }

/* ---------- Contenido ---------- */
main { padding: 8px 16px 24px; max-width: 640px; margin: 0 auto; }

.titulo-seccion { font-size: 1.05rem; margin: 8px 4px 10px; color: var(--texto-suave); font-weight: 650; }

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 16px;
  margin-bottom: 16px;
}
.tarjeta h3 { font-size: 1.05rem; margin-bottom: 8px; }
.tarjeta ol { padding-left: 1.3em; color: var(--texto-suave); }
.tarjeta li + li { margin-top: 4px; }

.datos { padding: 4px 16px; }
.datos > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: var(--toque);
  padding: 8px 0;
}
.datos > div + div { border-top: 1px solid var(--borde); }
.datos dt { color: var(--texto-suave); flex: none; }
.datos dd { text-align: right; font-weight: 600; }

.vacio {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 14vh 16px 0;
}
.vacio img { border-radius: 22px; }
.vacio h2 { font-size: 1.25rem; }
.vacio p  { color: var(--texto-suave); max-width: 32ch; }

/* ---------- Botones y avisos ---------- */
.boton {
  min-height: var(--toque);
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--acento);
  color: var(--acento-texto);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.boton-pequeno { min-height: 40px; padding: 0 14px; flex: none; }
.boton:active { transform: scale(0.97); }

.aviso {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 16px 8px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--radio);
  background: var(--acento-suave);
}
[hidden] { display: none !important; }

/* ---------- Barra de navegación inferior ---------- */
.barra {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--superficie);
  border-top: 1px solid var(--borde);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.barra button {
  flex: 1;
  height: var(--barra-alto);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--texto-suave);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.barra svg {
  width: 26px; height: 26px;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.barra button[aria-current="page"] { color: var(--acento); }

.pie { text-align: center; color: var(--texto-suave); font-size: 0.8rem; padding-bottom: 12px; }

:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
