/* SaludableScan — estilos */
:root {
  --verde: #1e9e4a;
  --verde-oscuro: #157a38;
  --verde-claro: #e8f6ed;
  --amarillo: #f2b705;
  --amarillo-claro: #fff6d9;
  --rojo: #e23b3b;
  --rojo-claro: #fdeaea;
  --azul: #2f7fd8;
  --azul-claro: #eaf3fd;
  --fondo: #f4f7f5;
  --tarjeta: #ffffff;
  --texto: #1d2a22;
  --gris: #6b7a71;
  --linea: #e4ebe6;
  --radio: 18px;
  --sombra: 0 2px 10px rgba(20, 50, 30, 0.06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--texto);
  background: var(--fondo);
  -webkit-tap-highlight-color: transparent;
}
body.oscuro { background: #0f1a14; }

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}

img { max-width: 100%; }
a { color: var(--verde-oscuro); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
[hidden] { display: none !important; }

.gris { color: var(--gris); }
.chico { font-size: 0.85rem; }
.texto-verde { color: var(--verde); }
.texto-amarillo { color: #c99400; }
.texto-rojo { color: var(--rojo); }
.texto-gris { color: var(--gris); }

/* ---------- Botones ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
.btn-verde { background: var(--verde); color: #fff; }
.btn-verde:active { background: var(--verde-oscuro); }
.btn-borde { background: #fff; color: var(--verde-oscuro); border: 2px solid var(--verde); }
.btn-texto { background: none; color: var(--gris); min-height: 44px; }
.botones { display: grid; gap: 10px; margin-top: 4px; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 8px 8px;
  background: rgba(244, 247, 245, 0.94);
  backdrop-filter: blur(8px);
}
.barra h1 { font-size: 1.05rem; text-align: center; font-weight: 700; }
.btn-atras {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--texto);
  border-radius: 50%;
}

.contenido {
  display: grid;
  gap: 14px;
  padding: 6px 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
}

.tarjeta {
  background: var(--tarjeta);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 18px;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.tarjeta h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }

.franja {
  background: var(--amarillo-claro);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.cargando {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 80px 20px;
  color: var(--gris);
}
.ruedita {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid var(--verde-claro);
  border-top-color: var(--verde);
  animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.mensaje { text-align: center; padding: 28px 20px; gap: 22px; }

.pie {
  text-align: center;
  font-size: 0.8rem;
  color: var(--gris);
  padding: 8px 10px 0;
}

/* ---------- Marcas ✓ ! ✗ ---------- */
.marca {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}
.marca-bien { background: var(--verde); }
.marca-ojo { background: var(--amarillo); }
.marca-mal { background: var(--rojo); }
.marca-gris { background: #b5c0b9; }

/* ---------- Pantalla Escanear ---------- */
.escanear {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  color: #fff;
}
.esc-cabecera { display: flex; align-items: center; gap: 12px; }
.esc-cabecera h1 { font-size: 1.3rem; }
.esc-cabecera p { font-size: 0.9rem; opacity: 0.8; }
.logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--verde);
  display: grid;
  place-items: center;
  color: #fff;
}

.visor {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: 22px;
  overflow: hidden;
  background: #1c2a22;
}
#lector { position: absolute; inset: 0; }
#lector video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.visor-esquinas { position: absolute; inset: 22% 10%; pointer-events: none; }
.visor-esquinas i {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 5px solid #3ddc6f;
}
.visor-esquinas i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.visor-esquinas i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.visor-esquinas i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.visor-esquinas i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }

.visor-estado {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 76%;
  text-align: center;
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.55);
  padding: 14px;
  border-radius: 12px;
  border: 0;
  color: #fff;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.esc-ayuda { text-align: center; font-size: 0.95rem; opacity: 0.92; }

.esc-botones { display: flex; align-items: center; justify-content: space-around; }
.btn-redondo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.btn-disparo {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: transparent;
  padding: 5px;
  cursor: pointer;
}
.btn-disparo span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.btn-disparo.activa span { background: #3ddc6f; animation: latir 1.6s ease-in-out infinite; }
@keyframes latir { 50% { transform: scale(0.85); opacity: 0.75; } }

.esc-manual {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 6px 6px 6px 12px;
}
.esc-manual-icono { opacity: 0.7; display: grid; }
.esc-manual input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  font-size: 16px;
  padding: 10px 0;
  outline: none;
}
.esc-manual input::placeholder { color: rgba(255, 255, 255, 0.6); }
.esc-manual .btn { width: auto; min-height: 44px; padding: 8px 16px; }

/* ---------- Resultado ---------- */
.producto { grid-template-columns: 96px 1fr; align-items: center; gap: 16px; }
.prod-foto {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  background: #f0f3f1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--gris);
}
.prod-foto img { width: 100%; height: 100%; object-fit: contain; }
.prod-datos { display: grid; gap: 2px; min-width: 0; }
.prod-datos h2 { font-size: 1.3rem; overflow-wrap: anywhere; }
.prod-datos p { overflow-wrap: anywhere; }
.etiqueta {
  justify-self: start;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--verde-oscuro);
  background: var(--verde-claro);
  padding: 3px 10px;
  border-radius: 99px;
}

.puntaje { grid-template-columns: auto 1fr; align-items: center; gap: 18px; }
.puntaje-anillo { display: grid; justify-items: center; gap: 4px; }
.nivel { font-weight: 700; }

.anillo { position: relative; }
.anillo-fondo { fill: none; stroke: #edf1ee; stroke-width: 11; }
.anillo-valor { fill: none; stroke-width: 11; stroke-linecap: round; transition: stroke-dasharray 0.8s ease; }
.anillo-verde .anillo-valor { stroke: var(--verde); }
.anillo-amarillo .anillo-valor { stroke: var(--amarillo); }
.anillo-rojo .anillo-valor { stroke: var(--rojo); }
.anillo-gris .anillo-valor { stroke: #b5c0b9; }
.anillo-texto {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 36%;
}
.anillo-texto strong { font-size: 2.3rem; line-height: 1; }
.anillo-texto span { color: var(--gris); font-size: 0.9rem; }

.chips { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.chips li { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 500; }

.avisos { background: var(--azul-claro); box-shadow: none; gap: 10px; }
.avisos p { display: flex; gap: 10px; font-size: 0.9rem; color: #1d4f86; }
.avisos svg { flex: none; margin-top: 1px; }

/* Octógonos */
.octos { display: flex; flex-wrap: wrap; gap: 10px; }
.octo { display: grid; justify-items: center; gap: 4px; }
.octo-borde, .octo-linea, .octo-cuerpo {
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%);
}
.octo-borde { width: 86px; height: 86px; background: #000; padding: 3px; }
.octo-linea { width: 100%; height: 100%; background: #fff; padding: 2px; }
.octo-cuerpo {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
}
.octo-cuerpo small { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; }
.octo-cuerpo b { font-size: 10px; line-height: 1.1; font-weight: 900; }
.octo-estimado { font-size: 0.7rem; color: var(--gris); }
.leyenda {
  background: #000;
  color: #fff;
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  text-align: center;
  padding: 8px 12px;
  border-radius: 4px;
}
.sin-octos { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--verde-oscuro); }

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--verde-oscuro);
  list-style-position: inside;
}
details[open] summary { margin-bottom: 12px; }

.calculo, .motivos { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 0.9rem; }
.calculo li { display: flex; gap: 10px; align-items: flex-start; }
.motivos li { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--linea); }
.motivos li.total { border: 0; font-weight: 700; }

.resumen { color: #3c4a41; }

.termometro { display: grid; gap: 6px; margin-top: 4px; }
.termometro-barra {
  position: relative;
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--rojo) 0%, var(--amarillo) 50%, var(--verde) 100%);
}
.termometro-barra span {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--verde-oscuro);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.termometro-textos { display: flex; justify-content: space-between; font-size: 0.78rem; font-weight: 600; }

.caja-puntaje {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--verde-claro);
  color: var(--verde-oscuro);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
}
.caja-puntaje span { flex: 1; }
.caja-puntaje b { font-size: 1.5rem; }
.caja-puntaje small { font-size: 0.85rem; font-weight: 500; }

.porcion { display: grid; grid-template-columns: 1fr 1fr; }
.porcion div { display: grid; padding: 4px 12px; }
.porcion div + div { border-left: 1px solid var(--linea); }
.porcion span { color: var(--gris); font-size: 0.85rem; }
.porcion b { font-size: 1.15rem; }
.porcion small { color: var(--gris); font-size: 0.75rem; }

.tabla { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tabla td { padding: 8px 0; border-bottom: 1px solid var(--linea); }
.tabla td:last-child { text-align: right; font-weight: 600; }

/* ---------- Ingredientes y aditivos ---------- */
.pestanas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #e9efeb;
  padding: 5px;
  border-radius: 14px;
}
.pestanas button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gris);
  padding: 9px 4px;
  border-radius: 10px;
  cursor: pointer;
}
.pestanas button.activa { background: var(--verde); color: #fff; }

.lista-ingredientes { list-style: none; margin: 0; padding: 0; }
.lista-ingredientes li {
  padding: 10px 0 10px 22px;
  border-bottom: 1px solid var(--linea);
  position: relative;
  font-size: 0.95rem;
}
.lista-ingredientes li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b5c9bc;
}

.lista-aditivos { list-style: none; margin: 0; padding: 0; display: grid; }
.lista-aditivos li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--linea);
}
.lista-aditivos li:last-child { border: 0; }
.lista-aditivos div { display: grid; gap: 2px; }
.lista-aditivos small { color: var(--gris); font-size: 0.8rem; }
.lista-aditivos p { font-size: 0.9rem; color: #3c4a41; }
.riesgo-alto { color: var(--rojo); }
.riesgo-moderado { color: #b98800; }

.caja-info { background: var(--azul-claro); box-shadow: none; color: #1d4f86; }
.caja-info h3 { color: var(--azul); }
.caja-info p { font-size: 0.92rem; }
.referencias { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem !important; }
.referencias .marca { width: 18px; height: 18px; font-size: 11px; }

/* ---------- Formulario ---------- */
.formulario label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 600; }
.formulario small { color: var(--gris); font-weight: 400; }
.formulario input:not([type='radio']):not([type='file']):not([type='checkbox']),
.formulario textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  padding: 12px 14px;
  border: 1.5px solid var(--linea);
  border-radius: 12px;
  background: #fbfdfc;
  color: var(--texto);
}
.formulario input:focus, .formulario textarea:focus { outline: none; border-color: var(--verde); background: #fff; }
.formulario textarea { resize: vertical; }

.opciones { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.opciones legend { font-size: 0.92rem; font-weight: 600; margin-bottom: 8px; padding: 0; }
.opciones label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  padding: 10px 14px;
  border: 1.5px solid var(--linea);
  border-radius: 12px;
  cursor: pointer;
}
.opciones label:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); }
.opciones input { accent-color: var(--verde); margin: 0; }

.grilla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grilla label { align-content: end; }

.foto-carga {
  display: flex !important;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1.5px dashed #b5c9bc;
  border-radius: 14px;
  color: var(--verde-oscuro);
  cursor: pointer;
}
.foto-prev {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #f0f3f1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--gris);
  flex: none;
}
.foto-prev img { width: 100%; height: 100%; object-fit: cover; }

.error {
  background: var(--rojo-claro);
  color: #a32020;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
}

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translate(-50%, 20px);
  width: min(92vw, 440px);
  background: #1d2a22;
  color: #fff;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  .puntaje { grid-template-columns: 1fr; justify-items: center; }
  .grilla { grid-template-columns: 1fr; }
}

.mensaje .centrado { justify-content: center; }
.mensaje p + p { margin-top: -8px; }

.notas { background: var(--amarillo-claro); box-shadow: none; }
.notas div { display: grid; gap: 4px; }
.notas p { font-size: 0.92rem; color: #5c4a00; }

/* ---------- Etapa 2: navegación, listas, perfil y alertas ---------- */
.navegacion {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--linea);
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px);
  backdrop-filter: blur(8px);
}
.navegacion a {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gris);
  text-decoration: none;
}
.navegacion a.activa { color: var(--verde); }
.navegacion-oscura { position: static; transform: none; background: transparent; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-bottom: 0; }
.navegacion-oscura a { color: rgba(255, 255, 255, 0.65); }
.navegacion-oscura a.activa { color: #3ddc6f; }
.con-navegacion { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 90px); }
.escanear { gap: 14px; }

.btn-estrella {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  display: grid;
  place-items: center;
  color: var(--gris);
  cursor: pointer;
}
.btn-estrella.activa { color: var(--amarillo); }

.lista { padding: 6px 14px; gap: 0; }
.fila-producto {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--linea);
  color: var(--texto);
  text-decoration: none;
}
.fila-producto:last-child { border-bottom: 0; }
.fila-foto {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #f0f3f1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--gris);
}
.fila-foto img { width: 100%; height: 100%; object-fit: contain; }
.fila-datos { display: grid; min-width: 0; }
.fila-datos b { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-datos small { color: var(--gris); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pastilla {
  min-width: 42px;
  text-align: center;
  padding: 5px 8px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
}
.pastilla-verde { background: var(--verde); }
.pastilla-amarillo { background: var(--amarillo); }
.pastilla-rojo { background: var(--rojo); }
.pastilla-gris { background: #b5c0b9; }

.vacio { text-align: center; justify-items: center; padding: 30px 20px; }
.vacio-icono { width: 64px; height: 64px; border-radius: 50%; background: var(--verde-claro); color: var(--verde); display: grid; place-items: center; }
.btn-texto.confirmar { color: var(--rojo); font-weight: 700; }

.casillas { display: grid; gap: 8px; }
.casillas label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid var(--linea);
  border-radius: 12px;
  font-weight: 500 !important;
  cursor: pointer;
}
.casillas label:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); }
.casillas input { width: 20px; height: 20px; accent-color: var(--verde); margin: 0; flex: none; }
.botones label.btn { display: flex !important; }

.alertas ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alertas li { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.alertas-rojo { background: var(--rojo-claro); border: 2px solid var(--rojo); box-shadow: none; }
.alertas-rojo h3 { color: #a32020; }
.alertas-amarillo { background: var(--amarillo-claro); border: 2px solid var(--amarillo); box-shadow: none; }
.alertas-amarillo h3 { color: #7a5c00; }
.alertas a { justify-self: start; }
.centrado-texto { text-align: center; line-height: 1.3; }

/* ---------- Etapa 3: comparar ---------- */
.navegacion { grid-template-columns: repeat(5, 1fr); }
.navegacion a { font-size: 0.68rem; }
.comp-ganador {
  background: var(--verde-claro);
  color: var(--verde-oscuro);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
  text-align: center;
}
.comparacion { --columnas: 3; padding: 14px 10px; gap: 0; }
.comp-valores { display: grid; grid-template-columns: repeat(var(--columnas), minmax(0, 1fr)); gap: 6px; }
.comp-cabeza { padding-bottom: 12px; border-bottom: 1px solid var(--linea); }
.comp-producto { position: relative; display: grid; justify-items: center; text-align: center; gap: 3px; min-width: 0; }
.comp-producto b { font-size: 0.9rem; line-height: 1.2; overflow-wrap: anywhere; }
.comp-producto small { font-size: 0.72rem; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.comp-foto { width: 64px; height: 64px; border-radius: 12px; background: #f0f3f1; display: grid; place-items: center; overflow: hidden; color: var(--gris); margin-bottom: 4px; }
.comp-foto img { width: 100%; height: 100%; object-fit: contain; }
.comp-quitar {
  position: absolute;
  top: -4px;
  right: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: #eef2ef;
  color: var(--gris);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.comp-producto .anillo { margin-top: 6px; }
.comp-producto .anillo-texto { padding-top: 32%; }
.comp-producto .anillo-texto strong { font-size: 1.4rem; }
.comp-producto .anillo-texto span { font-size: 0.7rem; }
.comp-nivel { font-size: 0.78rem; font-weight: 700; }
.comp-fila { padding: 10px 0 8px; border-bottom: 1px solid var(--linea); }
.comp-etiqueta { font-size: 0.82rem; font-weight: 600; color: #3c4a41; padding: 0 4px 6px; }
.comp-etiqueta small { color: var(--gris); font-weight: 400; }
.comp-celda { display: grid; justify-items: center; gap: 2px; font-size: 0.85rem; }
.comp-celda small { font-size: 0.68rem; color: var(--gris); }
.comp-numero.mejor { color: var(--verde-oscuro); font-weight: 800; }
.comp-octo {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: #000;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%);
}
.comp-pie { padding-top: 12px; }
.btn-chico { min-height: 40px; padding: 8px 6px; font-size: 0.82rem; border-radius: 10px; }

/* ---------- Etapa 4: pulido ---------- */
.franja-oscura { background: rgba(242, 183, 5, 0.18); color: #ffe08a; }
.sin-dato { color: var(--gris); font-weight: 400; font-size: 0.85em; font-style: italic; }
/* Comparar: anillos alineados aunque los nombres ocupen distintos renglones */
.comp-producto { display: flex; flex-direction: column; align-items: center; }
.comp-producto .anillo { margin-top: auto; }
.comp-producto small.gris { margin-bottom: 6px; }
.comp-nivel { min-height: 2.4em; line-height: 1.2; display: flex; align-items: flex-start; justify-content: center; }

/* ---------- Etapa 5: fotos del envase ---------- */
.botones .btn[disabled] { opacity: 0.45; cursor: default; }
.foto-envase { grid-template-columns: 88px 1fr; align-items: center; gap: 14px; cursor: pointer; }
.foto-envase-vista {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  background: #f0f3f1;
  border: 1.5px dashed #b5c9bc;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--gris);
}
.foto-envase-vista img { width: 100%; height: 100%; object-fit: cover; }
.foto-envase-texto { display: grid; gap: 2px; }
.foto-envase-texto small { color: var(--gris); font-size: 0.82rem; }
.foto-envase-accion { color: var(--verde-oscuro); font-weight: 600; font-size: 0.88rem; margin-top: 4px; }

.aviso-pendientes {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--texto);
  background: var(--amarillo-claro);
  box-shadow: none;
  border: 1.5px solid var(--amarillo);
}
.aviso-pendientes .vacio-icono { width: 48px; height: 48px; background: #fff; color: #b98800; }
.aviso-pendientes span:nth-child(2) { display: grid; }
.aviso-pendientes small { color: #6b5600; font-size: 0.82rem; }
.aviso-pendientes > span:last-child { font-size: 1.8rem; color: #b98800; }

.fila-pendiente { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.fila-pendiente:last-child { border-bottom: 0; }
.fila-acciones { display: grid; gap: 2px; justify-items: stretch; }
.fila-acciones .btn { width: auto; min-height: 34px; }
.btn-texto.confirmar { color: var(--rojo); }

/* Panel con las fotos arriba del formulario (queda fijo al bajar) */
.panel-fotos {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  z-index: 4;
  margin: 0 16px 10px;
  background: #1c2a22;
  border-radius: 16px;
  padding: 8px;
  display: grid;
  gap: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.panel-fotos-pestanas { display: flex; gap: 6px; overflow-x: auto; }
.panel-fotos-pestanas button {
  flex: none;
  border: 0;
  border-radius: 99px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}
.panel-fotos-pestanas button.activa { background: var(--verde); }
.panel-fotos-pestanas .panel-fotos-ocultar { margin-left: auto; background: none; color: rgba(255, 255, 255, 0.7); }
.panel-fotos img { width: 100%; max-height: 28vh; object-fit: contain; border-radius: 10px; background: #000; cursor: zoom-in; }
.panel-fotos small { color: rgba(255, 255, 255, 0.6); font-size: 0.72rem; text-align: center; }
.panel-fotos.oculto img, .panel-fotos.oculto small { display: none; }

/* Visor a pantalla completa */
.visor-foto {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: #fff;
}
.visor-foto-barra { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; font-weight: 600; }
.visor-foto-barra button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.15); color: #fff; display: grid; place-items: center; cursor: pointer; }
.visor-foto-imagen { overflow: auto; display: grid; place-items: center; }
.visor-foto-imagen img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.visor-foto-imagen.acercada { place-items: start; }
.visor-foto-imagen.acercada img { max-width: none; max-height: none; width: 260%; cursor: zoom-out; }
.visor-foto-ayuda { text-align: center; font-size: 0.8rem; opacity: 0.6; padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 10px); }

/* Lectura automática de fotos */
.leer-foto { display: grid; gap: 8px; }
.btn-leer {
  background: linear-gradient(135deg, #e8f6ed, #d9f0e2);
  color: var(--verde-oscuro);
  border: 1.5px solid #a9dbbb;
  min-height: 46px;
  display: flex !important;
  font-weight: 700 !important;
}
.btn-leer.ocupado { opacity: 0.6; pointer-events: none; }
.leer-estado { font-size: 0.86rem; padding: 10px 12px; border-radius: 10px; background: #eef2ef; color: #3c4a41; }
.leer-estado.bien { background: var(--verde-claro); color: var(--verde-oscuro); }
.leer-estado.mal { background: var(--rojo-claro); color: #a32020; }
.formulario input.leido, .formulario textarea.leido { border-color: var(--verde) !important; background: #f1fbf4 !important; }

/* ---------- Formulario con forma de tabla nutricional ---------- */
.sr-solo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tabla-carga { border: 2px solid #2b3a31; border-radius: 12px; overflow: hidden; background: #fff; }
.tabla-carga-porcion {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 4px;
  font-weight: 800;
}
.tabla-carga-porcion input { text-align: right; font-weight: 700; }
.tabla-carga-porcion select {
  font: inherit;
  font-size: 16px;
  padding: 11px 8px;
  border: 1.5px solid var(--linea);
  border-radius: 10px;
  background: #fbfdfc;
}
.tabla-carga-ayuda { padding: 0 12px 8px; font-size: 0.75rem; color: var(--gris); border-bottom: 2px solid #2b3a31; }
.tabla-carga-base { border: 0; margin: 0; padding: 8px 10px; display: flex; gap: 6px; border-bottom: 1.5px solid #2b3a31; background: #f6f8f7; }
.tabla-carga-base label {
  flex: 1;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 8px 4px;
  border-radius: 9px;
  cursor: pointer;
}
.tabla-carga-base label:has(input:checked) { background: var(--verde); color: #fff; }
.tabla-carga-base input { accent-color: #fff; margin: 0; }
.formulario .tabla-carga-fila {
  display: grid !important;
  grid-template-columns: 1fr 128px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 12px;
  border-bottom: 1px solid #d7ddd9;
  font-size: 0.95rem;
  font-weight: 600;
}
.tabla-carga-fila:last-child { border-bottom: 0; }
.tabla-carga-fila.opcional { color: var(--gris); font-weight: 500; }
.tabla-carga-fila small { font-weight: 400; font-size: 0.75rem; color: var(--gris); }
.tabla-carga-fila small.bloque { display: block; }
.tabla-carga-fila .obligatorio { color: var(--rojo); }
.tabla-carga-valor { position: relative; display: block; }
.formulario .tabla-carga-valor input { padding: 10px 40px 10px 10px !important; text-align: right; font-weight: 700 !important; }
.tabla-carga-valor i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 0.82rem; color: var(--gris); pointer-events: none; }
