/* =========================================================
   Mi bebé come · Diseño «la cocina de mamá»
   Fuente única: docs/DESIGN_SYSTEM.md (v1.2). Un solo tema claro.
   ========================================================= */
:root {
  /* Neutros */
  --papel: #FBF6EE; --superficie: #FFFDF9; --superficie-2: #F3EBDF; --linea: #E8DDCC;
  --tinta: #2E2620; --tinta-2: #5E534A; --tinta-3: #7A6E63;
  /* Acento terracota */
  --acento: #B9512C; --acento-hover: #A34724; --acento-suave: #F7E4D9; --acento-tinta: #9C3F1F; --sobre-acento: #FFFFFF;
  /* Apoyo y avisos */
  --hoja: #3D6E45; --hoja-suave: #E3EFDF; --aviso: #80550F; --aviso-suave: #FBEFD6; --no: #9E3A31; --no-suave: #F8E2DE;
  /* Ilustración del plato (mientras no hay fotos) */
  --mesa: #EADBC6; --mesa-linea: #E2CFB6; --plato: #FFFDF9; --plato-2: #F6EFE3; --cuchara: #D9C3A2;
  /* Letras */
  --f-titulo: "Fraunces", Georgia, serif;
  --f-texto: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Espacios, radios y sombras */
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 20px; --e6: 24px; --e7: 32px; --e8: 40px; --e9: 56px;
  --r-s: 10px; --r-m: 16px; --r-l: 20px; --r-xl: 28px; --r-pill: 999px;
  --sombra-1: 0 1px 2px rgba(46,38,32,.06); --sombra-2: 0 10px 30px rgba(46,38,32,.12);
  --curva: cubic-bezier(.2,.8,.2,1);
  --foco: 3px solid rgba(185,81,44,.4);
  color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--papel); color: var(--tinta); }
body { font-family: var(--f-texto); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
h1, h2, .display { font-family: var(--f-titulo); font-weight: 600; margin: 0; text-wrap: balance; font-variation-settings: "SOFT" 100; }
.display { font-size: 32px; line-height: 1.1; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 800; margin: 0; }
@media (max-width: 399px) { .display { font-size: 28px; } h1 { font-size: 25px; } }
p { margin: 0; }
ul, ol { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acento-tinta); }
img { max-width: 100%; }
:focus-visible { outline: var(--foco); outline-offset: 2px; border-radius: 12px; }
.hidden, [hidden] { display: none !important; }
.etiqueta { font-size: 12px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.meta { font-size: 14px; line-height: 1.35; font-weight: 700; font-variant-numeric: tabular-nums; }
.muted { color: var(--tinta-2); }
.ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.s { width: 18px; height: 18px; }
.nuevo-tag { display: none; }

/* ---------- Estructura ---------- */
.app { min-height: 100vh; }
main {
  max-width: 1040px; margin: 0 auto; min-width: 0;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
@media (min-width: 400px) { main { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); } }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.cab-sec, .section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head { margin: 32px 0 14px; }
.cab-sec a, .section-head a { font-weight: 800; font-size: 15px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.pagina-cab { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.pagina-cab p { color: var(--tinta-2); }

/* ---------- Menú: abajo en el celular, a la izquierda en la PC ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--superficie); box-shadow: var(--sombra-2); border-radius: 22px 22px 0 0;
  padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: 6px 2px; border-radius: 14px;
  font-size: 11.5px; font-weight: 700; line-height: 1.15; text-align: center; text-decoration: none; color: var(--tinta-2);
}
.nav a.activo { color: var(--acento-tinta); background: var(--acento-suave); }
.nav a.activo .ico { stroke: var(--acento); }
.nav .largo, .nav .marca { display: none; }
@media (max-width: 359px) { .nav a { font-size: 10.5px; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: var(--r-pill);
  background: var(--acento); color: var(--sobre-acento); font-weight: 800; font-size: 16px; text-decoration: none; text-align: center; line-height: 1.2;
  transition: transform .16s var(--curva), background .16s;
}
.btn:hover { background: var(--acento-hover); }
.btn:active { transform: scale(.98); }
.btn.sec, .btn.ghost { background: var(--superficie-2); color: var(--tinta); }
.btn.sec:hover, .btn.ghost:hover { background: var(--linea); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--linea); }
.btn.ghost:hover { background: var(--superficie-2); }
.btn.peq { min-height: 48px; padding: 0 18px; font-size: 15px; }
.btn.full { width: 100%; }
.btn.hecho { background: var(--hoja); color: var(--sobre-acento); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-ico, .icon-btn {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--superficie); color: var(--tinta); box-shadow: var(--sombra-1); text-decoration: none;
}
.btn-ico[aria-pressed="true"] .ico { fill: var(--acento); stroke: var(--acento); }
.botones { display: flex; flex-wrap: wrap; gap: 10px; }
.botones .btn { flex: 1 1 auto; }

/* ---------- Chips de datos y filtros ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; min-height: 32px;
  border-radius: var(--r-pill); background: var(--superficie-2); color: var(--tinta); font-size: 14px; font-weight: 700;
}
.chip.etapa, .badge.etapa { background: var(--acento-suave); color: var(--acento-tinta); }
.chip.alerg, .badge.alerg { background: var(--aviso-suave); color: var(--aviso); }
.chip.hierro { background: var(--hoja-suave); color: var(--hoja); }
.filtro-fila { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 4px; margin-inline: -4px; scrollbar-width: none; }
.filtro-fila::-webkit-scrollbar { display: none; }
.filtro {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: var(--r-pill); border: 1px solid var(--linea); background: var(--superficie);
  font-weight: 700; font-size: 15px; color: var(--tinta); text-decoration: none; white-space: nowrap;
}
.filtro[aria-pressed="true"], .filtro.on { background: var(--acento-suave); border-color: var(--acento-suave); color: var(--acento-tinta); }

/* ---------- Campos ---------- */
.input, select.input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--r-m);
  border: 1px solid var(--linea); background: var(--superficie); outline: none;
}
.input:focus { outline: var(--foco); outline-offset: 2px; }
.search { width: 100%; min-height: 52px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid var(--linea); background: var(--superficie); outline: none; }
.search:focus { outline: var(--foco); outline-offset: 2px; }
label.lbl { display: block; font-weight: 800; font-size: 15px; margin: 16px 0 6px; }
.buscador {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 18px;
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r-pill); color: var(--tinta-3);
}
.buscador input { flex: 1; min-width: 0; height: 50px; border: 0; background: none; outline: none; font-size: 16px; color: var(--tinta); }
.buscador:focus-within { outline: var(--foco); outline-offset: 2px; }

/* ---------- Tarjetas y bloques ---------- */
.card, .tarjeta {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r-l); padding: 20px;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.avisob { display: flex; gap: 12px; align-items: flex-start; background: var(--aviso-suave); border-radius: var(--r-m); padding: 14px 16px; font-weight: 600; }
.avisob .ico { color: var(--aviso); }
.avisob strong { color: var(--aviso); }
.avisob.no { background: var(--no-suave); }
.avisob.no .ico, .avisob.no strong { color: var(--no); }
.avisob a { font-weight: 800; }
.consejo { background: var(--superficie-2); border-radius: var(--r-m); padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; }
.consejo .ico { color: var(--acento-tinta); margin-top: 2px; }
.consejo.verde { background: var(--hoja-suave); }
.consejo.verde .ico, .consejo.verde strong { color: var(--hoja); }
.dato { display: flex; gap: 10px; align-items: flex-start; color: var(--tinta-2); font-weight: 600; font-size: 15px; }
.dato .ico { color: var(--tinta-3); }
.aviso { color: var(--tinta-2); font-size: 13px; line-height: 1.45; font-weight: 600; border-top: 1px solid var(--linea); padding-top: 16px; margin-top: 32px; text-align: center; }
.vacio { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 32px 16px; color: var(--tinta-2); }
.vacio .ico { width: 64px; height: 64px; stroke-width: 1.4; color: var(--tinta-3); }

/* ---------- Ilustración del plato ---------- */
.foto { position: relative; aspect-ratio: 4/3; max-width: 100%; border-radius: var(--r-l); overflow: hidden; background: var(--mesa); }
.foto svg, .foto img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* ---------- Inicio ---------- */
.hero { display: flex; flex-direction: column; gap: 8px; }
.marca-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.marca-txt { font-family: var(--f-titulo); font-weight: 700; font-size: 20px; color: var(--acento-tinta); }
.hero .edad { color: var(--tinta-2); font-weight: 600; }
.hero .edad a { font-weight: 800; }
.cta {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 84px; padding: 18px 20px; text-align: left;
  background: var(--acento); color: var(--sobre-acento); border-radius: var(--r-l);
  transition: transform .16s var(--curva), background .16s;
}
.cta:hover { background: var(--acento-hover); }
.cta:active { transform: scale(.99); }
.cta .circ { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,253,249,.18); display: grid; place-items: center; flex: none; }
.cta b { display: block; font-size: 19px; line-height: 1.25; }
.cta small { font-size: 14px; font-weight: 600; opacity: .92; }
.rapidos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rapido {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 104px; padding: 16px;
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r-l);
  text-decoration: none; color: var(--tinta); font-weight: 800; font-size: 16px; line-height: 1.25;
}
.rapido .circ { width: 40px; height: 40px; border-radius: 50%; background: var(--acento-suave); color: var(--acento-tinta); display: grid; place-items: center; }
.rapido.av .circ { background: var(--aviso-suave); color: var(--aviso); }
.tip-dia { display: flex; gap: 12px; align-items: flex-start; background: var(--hoja-suave); border-radius: var(--r-l); padding: 16px 18px; }
.tip-dia .ico { color: var(--hoja); margin-top: 2px; }
.tip-dia strong { color: var(--hoja); }
.install-banner { display: flex; align-items: center; gap: 12px; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r-l); padding: 12px 14px; }
.install-banner .ico { color: var(--acento-tinta); }
.install-banner p { flex: 1; font-weight: 700; font-size: 15px; }

/* ---------- Tarjeta de receta ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
.rcard { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; text-decoration: none; color: var(--tinta); }
.rcard .foto { border-radius: var(--r-m); }
.rcard .fav { position: absolute; top: 8px; right: 8px; }
.rcard h3 { margin-top: 4px; font-size: 16px; }
.rcard .meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--tinta-2); }
.rcard .meta.s { color: var(--tinta-3); font-weight: 600; }
.rcard .rayo { color: var(--acento-tinta); display: inline-flex; }
.contador { color: var(--tinta-2); margin-bottom: 12px; }

/* ---------- Recetas ---------- */
.filtros { display: flex; flex-direction: column; gap: 10px; }
.sin-alerg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sin-alerg label { font-weight: 700; color: var(--tinta-2); font-size: 15px; }
.sin-alerg select { min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--linea); background: var(--superficie); font-weight: 700; }

/* ---------- Receta ---------- */
.receta-top { display: flex; flex-direction: column; gap: 20px; }
.receta-top > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.receta-foto { position: relative; }
.receta-foto .flot { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; }
.receta-cab { display: flex; flex-direction: column; gap: 12px; }
.aporta { display: flex; flex-direction: column; gap: 12px; background: var(--hoja-suave); border-radius: var(--r-l); padding: 18px; }
.aporta-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.validada { font-size: 12px; font-weight: 800; color: var(--hoja); background: var(--superficie); padding: 4px 10px; border-radius: var(--r-pill); }
.nutris { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nutri { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 12px 8px; text-align: center; background: var(--superficie); border-radius: var(--r-m); color: var(--hoja); }
.nutri span { font-weight: 800; font-size: 14px; line-height: 1.2; color: var(--tinta); overflow-wrap: anywhere; }
.combina { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid rgba(61,110,69,.2); padding-top: 12px; }
.combina .ico { color: var(--hoja); margin-top: 1px; }
.fuente { font-size: 13px; color: var(--tinta-2); font-weight: 600; }
.det-grid { display: grid; gap: 16px; }
.ings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ings li + li { border-top: 1px solid var(--linea); }
.ing { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 6px 0; cursor: pointer; }
.ing input { position: absolute; opacity: 0; pointer-events: none; }
.caja { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 2px solid var(--tinta-3); transition: background .16s, border-color .16s; }
.caja .ico { width: 18px; height: 18px; stroke: var(--sobre-acento); stroke-width: 2.6; opacity: 0; }
.ing input:checked + .caja { background: var(--hoja); border-color: var(--hoja); }
.ing input:checked + .caja .ico { opacity: 1; }
.ing input:focus-visible + .caja { outline: var(--foco); outline-offset: 2px; }
.pasos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: p; }
.pasos li { display: flex; gap: 14px; font-size: 17px; line-height: 1.45; font-weight: 600; }
.pasos li::before {
  counter-increment: p; content: counter(p); flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--acento); color: var(--sobre-acento); font-size: 14px; font-weight: 800;
}

/* ---------- Modo cocinar ---------- */
.cocinar {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--papel);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(16px, env(safe-area-inset-left, 0px));
}
.coc-in { flex: 1; display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 640px; min-height: 0; margin: 0 auto; }
.coc-top { display: flex; align-items: center; gap: 12px; }
.coc-top .tit { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra { height: 6px; border-radius: 6px; background: var(--superficie-2); overflow: hidden; }
.barra i { display: block; height: 100%; width: 0; background: var(--acento); border-radius: 6px; transition: width .28s var(--curva); }
.coc-cuerpo { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px; min-height: 0; overflow: auto; padding-block: 8px; }
.coc-num { color: var(--acento-tinta); }
.coc-paso { font-size: 26px; line-height: 1.35; font-weight: 700; }
@media (max-width: 399px) { .coc-paso { font-size: 23px; } }
.timer { display: flex; align-items: center; gap: 12px; align-self: flex-start; max-width: 100%; padding: 8px 8px 8px 20px; background: var(--superficie); border-radius: var(--r-pill); box-shadow: var(--sombra-2); }
.timer .reloj { font-family: var(--f-titulo); font-size: 28px; font-variant-numeric: tabular-nums; min-width: 4.2ch; }
.timer .btn { min-height: 48px; padding: 0 18px; font-size: 15px; }
.timer.fin { background: var(--hoja-suave); }
.timer.fin .reloj { color: var(--hoja); }
.coc-nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; }
.coc-nav .btn { min-height: 64px; font-size: 18px; }
.wake { display: flex; align-items: center; gap: 6px; min-height: 18px; font-size: 13px; font-weight: 600; color: var(--tinta-2); }
.fin-coc { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.fin-coc .circ { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--hoja-suave); color: var(--hoja); }
body.cocinando { overflow: hidden; }

/* ---------- Plan ---------- */
.plan { display: grid; gap: 12px; }
.dia { gap: 8px; padding: 16px; }
.dia h3 { margin-bottom: 4px; }
.slot {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 6px 6px 12px; text-align: left;
  background: var(--papel); border-radius: var(--r-m); cursor: pointer;
}
.slot .tipo { width: 78px; flex: none; color: var(--tinta-3); }
.slot .nom { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; line-height: 1.3; }
.slot.vacio-slot .nom { color: var(--acento-tinta); font-weight: 700; }
.slot .x { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--tinta-3); }
.slot .x:hover { background: var(--superficie-2); }

/* ---------- Lista de compras ---------- */
.lista ul { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; border-top: 1px solid var(--linea); }
.lista li .ing { flex: 1; min-width: 0; }
.lista li.hecho .txt { text-decoration: line-through; color: var(--tinta-3); }
.lista small { color: var(--tinta-3); font-weight: 600; }
.lista .x { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--tinta-3); }
.add-row { display: flex; gap: 8px; }
.add-row .btn { width: 52px; padding: 0; flex: none; }

/* ---------- Guía ---------- */
.tabla { display: grid; gap: 14px; }
.etapa-card ul, .lista-puntos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.etapa-card .cab-etapa { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lista-simple { list-style: none; padding: 0; margin: 0; }
.lista-simple li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--linea); }
.lista-simple li:first-child { border-top: 0; padding-top: 0; }
.lista-simple li .ico { margin-top: 2px; }
.lista-simple li b { display: block; }
.lista-simple .no .ico { color: var(--no); }
.lista-simple .cui .ico { color: var(--aviso); }
.alerg-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--linea); }
.alerg-row .n { flex-basis: 100%; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.alerg-row input[type=date], .alerg-row select { flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border-radius: var(--r-m); border: 1px solid var(--linea); background: var(--superficie); }
@media (min-width: 640px) { .alerg-row .n { flex: 1; flex-basis: auto; } .alerg-row input[type=date], .alerg-row select { flex: none; } }
.estado-ok { color: var(--hoja); display: inline-flex; }
.estado-reac { color: var(--no); display: inline-flex; }

/* ---------- ¿Puede comerlo? ---------- */
.foto-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.foto-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 120px; padding: 20px 10px;
  border-radius: var(--r-l); text-align: center; font-weight: 800; cursor: pointer;
  background: var(--superficie); border: 1px solid var(--linea); color: var(--tinta);
}
.foto-btn .circ { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--acento-suave); color: var(--acento-tinta); }
.foto-btn.prin { background: var(--acento); border-color: var(--acento); color: var(--sobre-acento); }
.foto-btn.prin .circ { background: rgba(255,253,249,.18); color: var(--sobre-acento); }
.foto-btn:focus-within { outline: var(--foco); outline-offset: 2px; }
.sugs { display: flex; flex-direction: column; gap: 8px; }
.sug { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; text-align: left; font-weight: 700; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r-m); }
.sug .ico { color: var(--tinta-3); }
.foto-prev { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--r-l); }
.food-res { display: grid; gap: 12px; }
.food-head { display: flex; align-items: center; gap: 12px; }
.food-head small { display: block; color: var(--tinta-3); font-weight: 600; }
.verdict { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 8px 16px; border-radius: var(--r-pill); font-weight: 800; font-size: 17px; }
.v-si.verdict { background: var(--hoja-suave); color: var(--hoja); }
.v-cuidado.verdict { background: var(--aviso-suave); color: var(--aviso); }
.v-no.verdict { background: var(--no-suave); color: var(--no); }
.v-espera.verdict { background: var(--superficie-2); color: var(--tinta-2); }
.food-card { border-top-width: 6px; }
.food-card.v-si { border-top-color: var(--hoja); }
.food-card.v-cuidado { border-top-color: #C99A3E; }
.food-card.v-no { border-top-color: var(--no); }
.food-card.v-espera { border-top-color: var(--tinta-3); }
.mini-rec { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; text-decoration: none; }
.analizando { align-items: center; text-align: center; padding: 26px; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--acento-suave); border-top-color: var(--acento); animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- Hoja que sube desde abajo ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(46,38,32,.45); animation: velo .24s var(--curva); }
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; display: flex; flex-direction: column; gap: 14px;
  background: var(--superficie); border-radius: var(--r-xl) var(--r-xl) 0 0; animation: sube .24s var(--curva);
  padding: 20px max(20px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
.hoja-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hoja-cab .btn-ico { box-shadow: none; background: var(--superficie-2); }
@keyframes sube { from { transform: translateY(40px); opacity: .6; } }
@keyframes velo { from { opacity: 0; } }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px; text-align: left; border-radius: var(--r-m); }
.pick:hover { background: var(--papel); }
.pick .mini { width: 64px; flex: none; border-radius: var(--r-s); }
.pick small { color: var(--tinta-3); font-weight: 600; font-size: 14px; }

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: var(--r-m);
  background: var(--tinta); color: var(--papel); font-weight: 700; font-size: 15px; text-align: center; box-shadow: var(--sombra-2);
}

/* ---------- Pantalla del código ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; background: var(--papel); }
.gate .card { width: 100%; max-width: 420px; padding: 32px 24px; text-align: center; gap: 10px; }
.gate .marca-txt { font-size: 30px; }
.gate .lbl { text-align: left; }
.error { min-height: 1.4em; color: var(--no); font-weight: 700; font-size: 15px; }

/* ---------- Tableta y PC ---------- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rapidos { grid-template-columns: repeat(4, 1fr); }
  .modal-bg { align-items: center; }
  .modal { border-radius: var(--r-xl); }
}
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .nav {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
    padding: 28px 16px; border-radius: 0; box-shadow: none; border-right: 1px solid var(--linea);
  }
  .nav .marca { display: block; padding: 0 12px 20px; font-family: var(--f-titulo); font-size: 22px; font-weight: 700; color: var(--acento-tinta); }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 10px 14px; font-size: 16px; }
  .nav .corto { display: none; }
  .nav .largo { display: inline; }
  .shell { grid-column: 2; min-width: 0; }
  main { padding: 32px 40px 48px; }
  .hero .marca-txt { visibility: hidden; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .det-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; }
  .receta-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .plan, .tabla, .food-res { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .food-res > p { grid-column: 1 / -1; }
  .toast { bottom: 32px; left: calc(50% + 120px); }
}

/* ---------- Imprimir ---------- */
@media print {
  .nav, .no-print, .receta-foto .flot, .btn, .toast { display: none !important; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .receta-top { display: block; }
  .foto { display: none; }
  .tarjeta { break-inside: avoid; }
}

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