:root {
  --bg: #f3faf5;
  --card: #ffffff;
  --ink: #0b4555;
  --muted: #5f7f86;
  --line: #d9ece2;
  --brand: #0b4555;
  --brand-2: #3f9e72;
  --brand-soft: #dff5e6;
  --accent: #f29e4c;
  --accent-soft: #fdebd8;
  --water: #4a9fd8;
  --water-soft: #e1f0fa;
  --radius: 22px;
  --shadow: 0 6px 24px rgba(11, 69, 85, 0.07);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: #e0f0e6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

.app {
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
@media (min-width: 520px) {
  .app { box-shadow: 0 0 60px rgba(0, 0, 0, 0.08); }
}

/* Cabecera */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 20px 12px;
  background: linear-gradient(var(--bg) 75%, rgba(243, 250, 245, 0));
}
.topbar__hello { color: var(--muted); font-size: 14px; font-weight: 500; }
.topbar__title { font-family: var(--serif); font-size: 30px; line-height: 1.1; letter-spacing: -0.5px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--brand); color: white; font-size: 22px;
  display: grid; place-items: center; box-shadow: var(--shadow);
}

.vista { padding: 4px 20px 20px; animation: entra 0.25s ease; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Barra inferior */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 6px 0; border-radius: 14px; transition: 0.2s;
}
.tabbar button span { font-size: 20px; filter: grayscale(1); opacity: 0.6; transition: 0.2s; }
.tabbar button.active { color: var(--brand); background: var(--brand-soft); }
.tabbar button.active span { filter: none; opacity: 1; }

/* Elementos comunes */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.seccion { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 12px; }
.seccion h2 { font-family: var(--serif); font-size: 21px; }
.seccion button, .link { color: var(--brand); font-weight: 600; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: white; font-weight: 600;
  padding: 13px 18px; border-radius: 16px; width: 100%; transition: transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn--ghost { background: var(--brand-soft); color: var(--brand); }
.btn--accent { background: var(--accent); }
.fila { display: flex; gap: 10px; }
.chip {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -20px; padding-inline: 20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.tag { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }

/* Hero inicio */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: white; border-radius: 26px; padding: 20px; position: relative; overflow: hidden;
}
.hero::after {
  content: "🥦"; position: absolute; right: -10px; bottom: -18px; font-size: 110px; opacity: 0.18; transform: rotate(-15deg);
}
.hero__kcal { display: flex; align-items: center; gap: 18px; }
.anillo { width: 92px; height: 92px; flex-shrink: 0; }
.anillo circle { fill: none; stroke-width: 9; }
.anillo .fondo { stroke: rgba(255, 255, 255, 0.22); }
.anillo .valor { stroke: white; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.6s ease; }
.anillo text { fill: white; font-weight: 700; font-size: 20px; text-anchor: middle; }
.hero h3 { font-size: 15px; font-weight: 600; opacity: 0.85; }
.hero .grande { font-family: var(--serif); font-size: 28px; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.macro { background: rgba(255, 255, 255, 0.15); border-radius: 14px; padding: 10px; font-size: 12px; }
.macro b { display: block; font-size: 16px; }

/* Agua */
.agua { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vasos { display: flex; gap: 4px; flex: 1; justify-content: center; }
.vaso { width: 100%; max-width: 24px; height: 30px; border-radius: 4px 4px 8px 8px; border: 2px solid var(--water); background: white; position: relative; overflow: hidden; }
.vaso.lleno::after { content: ""; position: absolute; inset: 30% 0 0; background: var(--water); }
.circle-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--water-soft); color: var(--water); font-size: 22px; font-weight: 700; flex-shrink: 0; }

/* Lista de comidas */
.comida {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border-radius: 18px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.comida__img { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; font-size: 30px; flex-shrink: 0; }
.comida__info { flex: 1; min-width: 0; text-align: left; }
.comida__toma { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand-2); }
.comida__titulo { font-weight: 600; font-size: 15px; line-height: 1.25; }
.comida__info .comida__titulo { display: block; width: 100%; text-align: left; padding: 2px 0; }
.comida__info .comida__titulo + .comida__titulo { font-weight: 500; font-size: 14px; border-top: 1px dashed var(--line); padding-top: 5px; margin-top: 3px; }
.comida.hecha .comida__titulo { text-decoration: line-through; color: var(--muted); }
.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; flex-shrink: 0; font-size: 15px; color: transparent; transition: 0.2s;
}
.check.on { background: var(--brand); border-color: var(--brand); color: white; }

/* Consejo y cita */
.consejo { background: var(--accent-soft); display: flex; gap: 14px; align-items: flex-start; }
.consejo .ico { font-size: 28px; }
.cita { display: flex; align-items: center; gap: 14px; }
.cita__fecha { background: var(--brand-soft); color: var(--brand); border-radius: 16px; padding: 8px 12px; text-align: center; min-width: 62px; }
.cita__fecha b { display: block; font-size: 22px; font-family: var(--serif); }
.cita__fecha span { font-size: 11px; font-weight: 700; text-transform: uppercase; }

/* Selector de días */
.dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.dia { padding: 10px 0; border-radius: 16px; background: var(--card); text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); box-shadow: var(--shadow); }
.dia b { display: block; font-size: 17px; color: var(--ink); }
.dia.active { background: var(--brand); color: rgba(255, 255, 255, 0.8); }
.dia.active b { color: white; }
.dia.hoy:not(.active) { outline: 2px solid var(--brand-soft); }
.nota { background: var(--brand-soft); color: var(--brand); border-radius: 18px; padding: 14px 16px; font-size: 14px; display: flex; gap: 10px; margin-bottom: 16px; }

/* Recetas */
.buscador { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.buscador input { border: 0; outline: 0; flex: 1; background: transparent; font-size: 15px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.receta { background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); text-align: left; position: relative; }
.receta__img { height: 110px; display: grid; place-items: center; font-size: 54px; }
.receta__body { padding: 10px 12px 12px; }
.receta__titulo { font-weight: 700; font-size: 14px; line-height: 1.25; min-height: 35px; }
.receta__meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; }
.fav { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); display: grid; place-items: center; font-size: 15px; }
.vacio { text-align: center; padding: 40px 10px; color: var(--muted); }
.vacio div { font-size: 46px; margin-bottom: 8px; }

/* Hoja inferior (detalle) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 30, 25, 0.45); opacity: 0; pointer-events: none; transition: 0.25s; z-index: 20; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 21;
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 28px 28px 0 0;
  transform: translate(-50%, 100%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.sheet.open { transform: translate(-50%, 0); }
.sheet__hero { height: 200px; display: grid; place-items: center; font-size: 96px; position: relative; }
.sheet__cerrar { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); font-size: 18px; }
.sheet__fav { position: absolute; top: 14px; left: 14px; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); font-size: 18px; }
.sheet__body { padding: 20px; }
.sheet__body h2 { font-family: var(--serif); font-size: 26px; line-height: 1.15; margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.stat { background: var(--card); border-radius: 14px; padding: 10px 6px; text-align: center; font-size: 11px; color: var(--muted); }
.stat b { display: block; color: var(--ink); font-size: 16px; }
.lista-ing li { list-style: none; padding: 10px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; font-size: 15px; }
.lista-ing li::before { content: "•"; color: var(--brand-2); font-weight: 700; }
.pasos li { list-style: none; display: flex; gap: 12px; margin-bottom: 14px; font-size: 15px; line-height: 1.45; }
.pasos li span { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: white; font-weight: 700; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.sheet h3 { font-size: 17px; margin: 20px 0 8px; }

/* Lista de la compra */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .txt { flex: 1; font-size: 15px; }
.item.ok .txt { text-decoration: line-through; color: var(--muted); }
.item .cuenta { font-size: 12px; color: var(--muted); font-weight: 600; }
.item .borrar { color: var(--muted); font-size: 18px; padding: 0 4px; }
.cbox { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: transparent; flex-shrink: 0; }
.item.ok .cbox { background: var(--brand); border-color: var(--brand); color: white; }
.add { display: flex; gap: 8px; }
.add input { flex: 1; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); outline: 0; }
.add input:focus, .campo:focus { border-color: var(--brand-2); }
.add button { width: 48px; border-radius: 14px; background: var(--brand); color: white; font-size: 22px; }
.progreso-barra { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progreso-barra div { height: 100%; background: var(--brand-2); border-radius: 99px; transition: width 0.4s; }

/* Progreso */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: 18px; padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 20px; font-family: var(--serif); }
.kpi span { font-size: 11px; color: var(--muted); font-weight: 600; }
.grafico svg { width: 100%; height: auto; display: block; }
.campo { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); outline: 0; }
label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.racha { display: flex; gap: 6px; justify-content: space-between; }
.racha div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.racha i { display: block; height: 34px; border-radius: 10px; background: var(--line); margin-bottom: 4px; font-style: normal; display: grid; place-items: center; font-size: 14px; }
.racha i.n1 { background: #cdeedd; }
.racha i.n2 { background: #88c9b5; }
.racha i.n3 { background: var(--brand); color: white; }

/* Contacto */
.contacto-head { text-align: center; padding: 28px 20px 8px; }
.contacto-head .avatar { width: 84px; height: 84px; font-size: 40px; margin: 0 auto 12px; }
.contacto-head h2 { font-family: var(--serif); font-size: 24px; }
.acciones { display: grid; gap: 10px; }
.acciones a { text-decoration: none; }

/* Bienvenida */
.bienvenida { padding: 34px 24px; text-align: center; }
.bienvenida .logo { font-size: 64px; margin-bottom: 10px; }
.bienvenida h2 { font-family: var(--serif); font-size: 28px; margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: white; padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 500; transition: 0.25s; z-index: 30; max-width: 90%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Marca */
.logo-top { height: 44px; width: auto; display: block; margin-left: -6px; }
.avatar { background: var(--brand-soft); color: var(--brand); border: 2px solid #88c9b5; }
.hero { background: linear-gradient(135deg, #0b4555 0%, #2f7f75 60%, #3f9e72 100%); }
.hero::after { content: "🌿"; }
.bienvenida img { width: 220px; max-width: 80%; margin-bottom: 10px; }
.contacto-head img { width: 200px; margin-bottom: 6px; }
.topbar { padding-bottom: 6px; background: rgba(243, 250, 245, 0.92); backdrop-filter: blur(14px); }
.logo-top { height: 64px; margin: -6px 0 -6px -10px; }
.encabezado { padding: 4px 20px 12px; }
.error { color: #c2410c; font-size: 14px; margin-top: 10px; min-height: 20px; }
.aviso-plan { text-align: center; }
.aviso-plan div { font-size: 44px; margin-bottom: 6px; }

/* Consentimiento */
.consentimiento { display: flex; gap: 12px; align-items: flex-start; text-align: left; font-size: 14px; line-height: 1.5; background: var(--brand-soft); border-radius: 16px; padding: 14px; margin-top: 16px; cursor: pointer; }
.consentimiento input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; accent-color: var(--brand); }
.consentimiento a { color: var(--brand); font-weight: 600; text-decoration: underline; }
