/* Compostaje en Casa — hoja de estilos única.
   Diseño móvil primero. Paleta: verde oscuro, verde suave, beige/tierra,
   acento terracota. Sin imágenes externas ni fuentes remotas. */

:root {
  --verde-oscuro: #2f5d3a;
  --verde-medio: #4b8256;
  --verde-suave: #dbe9d5;
  --beige: #f6f1e4;
  --beige-hondo: #ece3cf;
  --tierra: #7a5c3e;
  --terracota: #c05c34;
  --terracota-suave: #f6e0d5;
  --texto: #22301f;
  --texto-tenue: #5c6b57;
  --blanco: #fffdf8;
  --alerta: #b3341f;
  --sombra: 0 2px 10px rgba(47, 93, 58, .12);
  --radio: 14px;
  --barra: 66px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--beige);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.28rem; color: var(--verde-oscuro); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }

/* ---------- cabecera ---------- */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: max(.85rem, env(safe-area-inset-top)) 1rem .85rem;
  background: var(--verde-oscuro);
  color: var(--blanco);
  box-shadow: var(--sombra);
}
.cabecera__titulo { font-size: 1.15rem; margin: 0; font-weight: 650; }
.btn-volver {
  background: rgba(255, 255, 255, .16);
  color: var(--blanco);
  border: 0;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 1.3rem;
  cursor: pointer;
  flex: 0 0 auto;
}

/* ---------- layout ---------- */
.contenido {
  padding: 1rem 1rem calc(var(--barra) + 1.6rem);
  max-width: 640px;
  margin: 0 auto;
  outline: none;
}
.cargando { text-align: center; color: var(--texto-tenue); padding: 2rem 0; }

.tarjeta {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--sombra);
  border: 1px solid rgba(47, 93, 58, .08);
}
.tarjeta--verde { background: var(--verde-suave); border-color: rgba(47, 93, 58, .18); }
.tarjeta--terracota { background: var(--terracota-suave); border-color: rgba(192, 92, 52, .25); }
.tarjeta--beige { background: var(--beige-hondo); }

/* ---------- botones ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  min-height: 56px;
  padding: .9rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid transparent;
  border-radius: var(--radio);
  cursor: pointer;
  margin-bottom: .75rem;
  text-align: center;
  transition: transform .06s ease, filter .12s ease;
}
.btn:active { transform: scale(.985); }
.btn--primario { background: var(--verde-oscuro); color: var(--blanco); }
.btn--secundario { background: var(--blanco); color: var(--verde-oscuro); border-color: var(--verde-medio); }
.btn--terracota { background: var(--terracota); color: #fff; }
.btn--tenue { background: transparent; color: var(--tierra); border-color: rgba(122, 92, 62, .4); min-height: 46px; font-size: .95rem; }
.btn--peligro { background: transparent; color: var(--alerta); border-color: rgba(179, 52, 31, .45); min-height: 44px; font-size: .9rem; width: auto; padding: .45rem .9rem; margin: 0; }
.btn:focus-visible, .nav-btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--terracota);
  outline-offset: 2px;
}

/* ---------- navegación inferior ---------- */
.barra-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  background: var(--blanco);
  border-top: 1px solid rgba(47, 93, 58, .16);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: .72rem;
  color: var(--texto-tenue);
  padding: .5rem .15rem .55rem;
  min-height: var(--barra);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  cursor: pointer;
}
.nav-btn span { font-size: 1.35rem; line-height: 1; }
.nav-btn[aria-current="page"] { color: var(--verde-oscuro); font-weight: 700; }

/* ---------- etiquetas de categoría ---------- */
.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 650;
  padding: .18rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.etiqueta--verde { background: var(--verde-suave); color: #2c5b33; }
.etiqueta--marron { background: #e8dcc6; color: #6b4f2f; }
.etiqueta--neutro { background: #e6e6e0; color: #4d4d47; }
.etiqueta--no_admitido { background: #f7d9d2; color: var(--alerta); }
.etiqueta--desconocida { background: #eee; color: #666; }

/* ---------- formularios ---------- */
label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }
select, input[type="number"], input[type="text"], textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: .75rem;
  border: 2px solid rgba(47, 93, 58, .25);
  border-radius: 12px;
  background: var(--blanco);
  color: var(--texto);
}
textarea { min-height: 88px; resize: vertical; }
.campo { margin-bottom: .9rem; }
.fila { display: flex; gap: .6rem; align-items: flex-end; }
.fila > .campo { flex: 1; margin-bottom: 0; }
.fila > .campo--corto { flex: 0 0 96px; }

/* ---------- lista de mezcla ---------- */
.item-mezcla {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 0;
  border-bottom: 1px solid rgba(47, 93, 58, .12);
}
.item-mezcla:last-child { border-bottom: 0; }
.item-mezcla__texto { flex: 1; min-width: 0; }
.item-mezcla__nombre { font-weight: 600; display: block; word-break: break-word; }
.item-mezcla__meta { font-size: .8rem; color: var(--texto-tenue); }
.contador {
  display: flex; align-items: center; gap: .35rem; flex: 0 0 auto;
}
.contador button {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 2px solid var(--verde-medio);
  background: var(--blanco);
  color: var(--verde-oscuro);
  font-size: 1.2rem; font-weight: 700;
  cursor: pointer;
}
.contador output { min-width: 2.2rem; text-align: center; font-weight: 700; }
.quitar {
  border: 0; background: none; color: var(--alerta);
  font-size: 1.2rem; cursor: pointer; padding: .35rem; flex: 0 0 auto;
}

/* ---------- resultado C:N ---------- */
.resultado { text-align: center; padding: 1.1rem 1rem; }
.resultado__cifra { font-size: 2.5rem; font-weight: 750; color: var(--verde-oscuro); line-height: 1.1; }
.resultado__rango { font-size: .92rem; color: var(--texto-tenue); }
.resultado__clas { font-size: 1.05rem; font-weight: 700; margin-top: .5rem; }
.clas-bajo { color: var(--terracota); }
.clas-equilibrado { color: var(--verde-oscuro); }
.clas-alto { color: var(--tierra); }

.barra-balance {
  display: flex; height: 16px; border-radius: 999px; overflow: hidden;
  background: #e6e6e0; margin: .7rem 0 .35rem;
}
.barra-balance i { display: block; height: 100%; }
.barra-balance .b-verde { background: var(--verde-medio); }
.barra-balance .b-marron { background: var(--tierra); }
.barra-balance .b-neutro { background: #b9b9ae; }

/* ---------- avisos ---------- */
.aviso {
  border-left: 5px solid var(--terracota);
  background: var(--terracota-suave);
  padding: .7rem .85rem;
  border-radius: 10px;
  margin-bottom: .8rem;
  font-size: .93rem;
}
.aviso--alerta { border-color: var(--alerta); background: #f9e2dc; }
.aviso--info { border-color: var(--verde-medio); background: var(--verde-suave); }
.aviso strong { display: block; }

.nota-legal {
  font-size: .85rem;
  color: var(--texto-tenue);
  background: var(--beige-hondo);
  border-radius: 10px;
  padding: .7rem .85rem;
  margin-bottom: 1rem;
}

/* ---------- opciones de diagnóstico ---------- */
.opciones { display: grid; gap: .55rem; }
.opcion {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem .9rem;
  border: 2px solid rgba(47, 93, 58, .22);
  border-radius: 12px;
  background: var(--blanco);
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  text-align: left;
  width: 100%;
  color: var(--texto);
  min-height: 54px;
}
.opcion[aria-pressed="true"] {
  border-color: var(--verde-oscuro);
  background: var(--verde-suave);
  font-weight: 650;
}
.opcion__marca {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--verde-medio); flex: 0 0 auto;
  display: grid; place-items: center; font-size: .8rem; color: var(--verde-oscuro);
}
.opcion[aria-pressed="true"] .opcion__marca { background: var(--verde-oscuro); color: #fff; border-color: var(--verde-oscuro); }
.opcion__texto { display: block; }
.opcion__desc {
  display: block;
  font-size: .82rem;
  font-weight: 400;
  color: var(--texto-tenue);
  margin-top: .12rem;
  line-height: 1.35;
}

/* Procedencia de cada recomendación: base científica u orientación de la app. */
.origen {
  font-size: .78rem;
  color: var(--texto-tenue);
  margin: .5rem 0 0;
  padding-top: .45rem;
  border-top: 1px solid rgba(47, 93, 58, .18);
}

/* ---------- bitácora ---------- */
.registro { position: relative; }
.registro__fecha { font-size: .82rem; color: var(--texto-tenue); font-weight: 600; }
.registro__pie { display: flex; justify-content: flex-end; margin-top: .6rem; }
.lista-simple { margin: .3rem 0 .5rem; padding-left: 1.1rem; }
.lista-simple li { margin-bottom: .18rem; }

/* ---------- fuentes ---------- */
.fuente { border-left: 4px solid var(--verde-medio); padding-left: .75rem; margin-bottom: 1rem; }
.fuente__inst { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--tierra); font-weight: 700; }
.fuente a { color: var(--verde-oscuro); word-break: break-all; }
.dato-tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dato-tabla th, .dato-tabla td { text-align: left; padding: .35rem .3rem; border-bottom: 1px solid rgba(47,93,58,.1); vertical-align: top; }
.dato-tabla th { color: var(--texto-tenue); font-weight: 600; width: 42%; }

/* ---------- avisos flotantes ---------- */
.avisos {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--barra) + 12px);
  z-index: 40;
  width: min(92vw, 420px);
  display: grid; gap: .4rem;
  pointer-events: none;
}
.brindis {
  background: var(--verde-oscuro);
  color: var(--blanco);
  padding: .7rem .9rem;
  border-radius: 12px;
  font-size: .92rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}

/* ---------- diálogo de confirmación ---------- */
dialog {
  border: 0; border-radius: var(--radio); padding: 1.1rem;
  width: min(90vw, 380px); background: var(--blanco); color: var(--texto);
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(34, 48, 31, .55); }
.dialogo__acciones { display: flex; gap: .6rem; margin-top: 1rem; }
.dialogo__acciones .btn { margin-bottom: 0; }

.vacio { text-align: center; color: var(--texto-tenue); padding: 1.5rem .5rem; }
.vacio__emoji { font-size: 2.4rem; display: block; margin-bottom: .4rem; }
.pie-version { text-align: center; font-size: .78rem; color: var(--texto-tenue); margin-top: 1.2rem; }

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