/* Prototipo de nutrición: misma marca que app.eatandfit.cl y gym.eatandfit.cl (columna móvil oscura) */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/fuentes/barlow-latin-400-normal.woff") format("woff"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fuentes/barlow-latin-600-normal.woff") format("woff"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("/fuentes/barlow-condensed-latin-700-normal.woff") format("woff"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("/fuentes/barlow-condensed-latin-800-normal.woff") format("woff"); }

:root {
  --bg: #17111c;
  --bg-2: #1f1726;
  --surface: #2a1f33;
  --surface-2: #33263e;
  --line: #3d2f48;
  --text: #f4eff6;
  --muted: #b8abc1;
  --green: #5fbf4a;
  --green-ink: #0f1a0c;
  --red: #e03a2f;
  --gold: #e9b949;
  --purple: #b06cc4;
  --prot: #7f9bff;
  --carb: #ee9a3a;
  --gras: #b06cc4;
  --radius: 14px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(ellipse 90% 40% at 70% 0%, #2f1f3a 0%, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; letter-spacing: .01em; text-wrap: balance; }
h1 { font-size: 30px; text-transform: uppercase; }
h2 { font-size: 24px; text-transform: uppercase; }
h3 { font-size: 19px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.chico { font-size: 14px; }
.eyebrow { font: 700 13px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.pila > * + * { margin-top: 12px; }
.pila-lg > * + * { margin-top: 20px; }
.fila { display: flex; align-items: center; gap: 10px; }
.entre { justify-content: space-between; }

.contenedor { width: 100%; max-width: 560px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main.contenedor { padding-top: 16px; padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }

/* Barra superior */
.barra { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.barra .contenedor { display: flex; align-items: center; gap: 12px; min-height: 54px; }
.barra img { width: 34px; height: 34px; border-radius: 8px; }
.barra .marca { font: 800 20px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.barra .marca span { color: var(--green); }
.barra .der { margin-left: auto; }
.prototipo { font: 700 11px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); border-radius: 999px; padding: 4px 8px; }

/* Tarjetas y botones */
.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; cursor: pointer; text-decoration: none; }
.boton.primario { background: var(--green); border-color: var(--green); color: var(--green-ink); font-weight: 700; }
.boton.peligro { color: #ff8a80; }
.boton.ancho { width: 100%; }
.boton:disabled { opacity: .55; cursor: default; }
.enlace { background: none; border: 0; padding: 0; color: var(--green); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icono { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; font-size: 18px; line-height: 1; }
.icono:disabled { opacity: .35; cursor: default; }

/* Formularios */
label.campo { display: block; }
label.campo > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2);
}
textarea { min-height: 72px; resize: vertical; }
.grilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--green); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 15px; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--green) 22%, var(--surface)); border-color: var(--green); color: var(--text); }
.chip.pregunta { border-style: dashed; text-align: left; line-height: 1.3; padding: 8px 14px; }

/* Navegación del día */
.dia-nav { display: flex; align-items: center; gap: 10px; }
.dia-nav h1 { flex: 1; text-align: center; font-size: 24px; }

/* Anillo de calorías */
.resumen-dia { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.anillo { position: relative; width: 150px; height: 150px; }
.anillo svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anillo .centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.anillo .centro strong { font: 800 34px/1 var(--display); }
.anillo .centro small { color: var(--muted); font-size: 13px; }
.macros { display: grid; gap: 10px; }
.macro .fila { font-size: 14px; }
.macro .fila b { font-weight: 600; }
.barra-macro { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 4px; }
.barra-macro i { display: block; height: 100%; border-radius: 999px; }
.mensaje-dia { margin-top: 14px; font-weight: 600; }

/* Semana */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.semana button { background: none; border: 0; padding: 0; cursor: pointer; display: grid; gap: 4px; justify-items: center; color: var(--muted); font-size: 12px; }
.semana .col { width: 100%; height: 56px; border-radius: 8px; background: var(--bg-2); display: flex; align-items: flex-end; overflow: hidden; }
.semana .col i { display: block; width: 100%; background: color-mix(in srgb, var(--green) 70%, transparent); border-radius: 8px 8px 0 0; }
.semana button[aria-current="true"] { color: var(--text); font-weight: 700; }
.semana button[aria-current="true"] .col { outline: 2px solid var(--green); outline-offset: 1px; }

/* Comidas */
.momento-titulo { font: 700 14px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.comida { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.comida + .comida { margin-top: 8px; }
.comida img, .comida .sin-foto { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 24px; }
.comida .info { flex: 1; min-width: 0; }
.comida .info b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comida .kcal { font: 700 20px/1 var(--display); white-space: nowrap; }
.vacio { text-align: center; padding: 28px 12px; color: var(--muted); }

/* Botones fijos abajo */
.separado { margin-top: 14px; }
.acciones .galeria-link { display: block; margin-top: 6px; text-align: center; }
.acciones { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--bg) 30%); }
.acciones .contenedor { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.acciones .boton { min-height: 54px; font-size: 17px; }

/* Revisión de una lectura */
.foto-lectura { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius); display: block; background: var(--surface); }
.cargando { display: grid; place-items: center; gap: 12px; padding: 30px 0; text-align: center; }
.girador { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--green); animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .girador { animation-duration: 3s; } }
.item { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.item + .item { margin-top: 8px; }
.item .cab { display: flex; gap: 8px; align-items: center; }
.item .cab input { flex: 1; min-height: 40px; font-weight: 600; background: transparent; border-color: transparent; padding: 6px 8px; }
.item .cab input:focus { border-color: var(--line); background: var(--surface); }
.item .quitar { width: 36px; height: 36px; font-size: 16px; }
.item .controles { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.item .gramos { display: flex; align-items: center; gap: 6px; }
.item .gramos input { width: 84px; min-height: 38px; text-align: right; }
.item .porciones { display: flex; gap: 6px; }
.item .porciones .chip { min-height: 34px; padding: 0 10px; font-size: 14px; }
.item .kcal-item { margin-left: auto; font: 700 18px/1 var(--display); white-space: nowrap; }
.baja-confianza { font-size: 13px; color: var(--gold); margin-top: 6px; }
.total-lectura { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 4px 0; border-top: 1px solid var(--line); }
.total-lectura strong { font: 800 28px/1 var(--display); }
.aviso { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); font-size: 15px; }
.error { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--red) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); }

/* Hoja inferior (detalle de una comida) */
.velo { position: fixed; inset: 0; z-index: 40; background: rgba(10, 6, 14, .7); display: flex; align-items: flex-end; justify-content: center; }
.hoja { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
.lista-items { list-style: none; padding: 0; margin: 0; }
.lista-items li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Panel */
.tabla-uso { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-uso th, .tabla-uso td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tabla-uso th:first-child, .tabla-uso td:first-child { text-align: left; }
.persona .datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; font-size: 14px; }
.persona .datos b { display: block; font: 700 20px/1.1 var(--display); }
.persona.inactiva { opacity: .6; }
.estado { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); }
.estado.si { background: color-mix(in srgb, var(--green) 25%, var(--surface)); }
.enlace-nuevo { word-break: break-all; font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px dashed var(--green); }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.galeria figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 13px; }
.galeria img, .galeria .sin-foto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: grid; place-items: center; background: var(--surface-2); font-size: 28px; }
.galeria figcaption { padding: 8px; line-height: 1.35; }
.marca-ajuste { color: var(--gold); }

@media (max-width: 380px) {
  .resumen-dia { grid-template-columns: 1fr; justify-items: center; }
  .macros { width: 100%; }
}
