/* OxyLean — tema "Metabolic Light". Diseño propio, wellness, US/EU.
   Paleta: off-white aireado + deep teal (calma científica) + mint (energía) + coral (vitalidad). */
:root {
  /* Light "Metabolic" — blanco suavizado (menos glare, más pastel). */
  --bg: #edf1ec; --surface: #f8faf7; --surface-2: #e2e8e2;
  --ink: #1a3d3a; --ink-soft: #5c716d; --line: #dbe2dc;
  --brand: #2ee5a3; --brand-ink: #12b981; --brand-text: #0f2b28; --brand-soft: #d7f2e7;
  --accent: #ff6f61; --accent-btn: #f15f4e; --accent-soft: #ffe1dc;
  --good: #12b981; --warn: #e0a800; --bad: #e5484d;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(26,61,58,.05), 0 8px 28px rgba(26,61,58,.07);
  --maxw: 760px; --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0f1613; --surface: #18221e; --surface-2: #212d28;
  --ink: #e7efeb; --ink-soft: #9db0aa; --line: #29352f;
  --brand: #2ee5a3; --brand-ink: #48e7ac; --brand-text: #05231b; --brand-soft: #143a30;
  --accent: #ff7a6b; --accent-btn: #ff6f61; --accent-soft: #38201c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; line-height: 1.5;
}
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; padding-bottom: 88px; }
.hidden { display: none !important; }

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--ink-soft); } .small { font-size: .85rem; } .center { text-align: center; }
a { color: var(--brand-ink); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

/* Botones — jerarquía clara */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: none; border-radius: var(--radius-sm); padding: .85em 1.2em; font: inherit;
  font-weight: 700; cursor: pointer; transition: transform .06s, filter .15s, background .15s; width: 100%;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: var(--brand-text); }      /* acción principal (mint) */
.btn-primary:hover { filter: brightness(1.04); }
.btn-accent { background: var(--accent-btn); color: #fff; }               /* vitalidad/metabolismo (coral) */
.btn-accent:hover { filter: brightness(1.05); }
.btn-soft { background: var(--surface-2); color: var(--ink); }           /* secundario */
.btn-soft:hover { background: #e6ebe6; }
.btn-inline { width: auto; }
.btn-row { display: flex; gap: .6rem; }
.btn .sub { font-weight: 500; font-size: .75rem; opacity: .8; }

/* Inputs */
label { display: block; font-weight: 600; font-size: .9rem; margin: .9rem 0 .35rem; }
input, select {
  width: 100%; padding: .8em .9em; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Layout / cards */
.view { padding: 20px 18px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-lead { color: var(--ink-soft); font-size: .88rem; margin: 2px 0 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { text-align: center; padding: 8px; }
.stat .num { font-size: 1.9rem; font-weight: 800; color: var(--brand-ink); letter-spacing: -.03em; }
.stat.coral .num { color: var(--accent); }
.stat .lbl { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* Progreso siempre visible */
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.streak-badge {
  background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px;
  padding: 7px 15px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; font-size: .95rem;
}
.milestone-chip { font-size: .85rem; color: var(--ink-soft); text-align: right; }
.reinforce {
  background: var(--brand-soft); color: var(--brand-ink); border-radius: var(--radius);
  padding: 14px 16px; font-weight: 600; margin-bottom: 14px;
}

/* Contador de cesación — tickea con segundos */
.counter { font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.counter b { color: var(--brand-ink); }

/* Timeline fisiológico */
.timeline .node { display: flex; gap: 12px; padding: 9px 0; }
.timeline .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 5px; flex: none;
  background: var(--surface-2); border: 2px solid var(--line); }
.timeline .node.done .dot { background: var(--good); border-color: var(--good); }
.timeline .node.next .dot { border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Banner ventana de compensación */
.comp-banner { background: linear-gradient(135deg, var(--accent), var(--accent-btn)); color: #fff; border: none; }
.comp-banner .num { color: #fff; }

/* Charts */
.chart svg { width: 100%; height: auto; display: block; }
.chart-empty { padding: 20px 0; text-align: center; }

/* KPI cards (dashboard) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; box-shadow: var(--shadow); }
.kpi-lbl { font-size: .68rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 7px; }
.kpi-val { font-size: 1.55rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.kpi-unit { font-size: .72rem; font-weight: 500; color: var(--ink-soft); margin-left: 3px; }
.kpi-sub { font-size: .72rem; color: var(--ink-soft); margin-top: 5px; }
.kpi-delta { font-size: .74rem; font-weight: 600; margin-top: 4px; }

/* Progress bars */
.pbar { margin-bottom: 11px; }
.pbar-top { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 4px; color: var(--ink-soft); }
.pbar-track { background: var(--surface-2); border-radius: 4px; height: 8px; overflow: hidden; }
.pbar-track > i { display: block; height: 100%; border-radius: 4px; transition: width .4s; }

/* Composición (barra segmentada grasa vs agua) */
.split-bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin: 8px 0 6px; }
.split-bar > span { display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: #fff; }
.split-legend { display: flex; gap: 16px; font-size: .78rem; color: var(--ink-soft); }
.dot-sq { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.hourbars { display: flex; align-items: flex-end; gap: 2px; height: 80px; margin-top: 8px; }
.hourbars > i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }

/* Nav inferior */
.nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
  border-top: 1px solid var(--line); z-index: 50; }
.nav-inner { max-width: var(--maxw); margin: 0 auto; width: 100%; display: flex; justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
.nav button { background: none; border: none; color: var(--ink-soft); font: inherit; font-size: .72rem;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 4px 10px; font-weight: 600; }
.nav button.active { color: var(--brand-ink); }
.nav .ico { font-size: 1.3rem; line-height: 1; }

/* Onboarding choice cards */
.choice { text-align: left; padding: 18px; margin-bottom: 12px; cursor: pointer; border: 2px solid var(--line); }
.choice:hover { border-color: var(--brand); }
.choice.featured { border-color: var(--brand); background: var(--brand-soft); }
.choice h3 { margin-bottom: 2px; }
.pill { display: inline-block; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 800;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; letter-spacing: .03em; }

/* Modal + bottom sheet */
.modal-bg, .sheet-bg { position: fixed; inset: 0; background: rgba(15,43,40,.45); display: flex; z-index: 100; }
.modal-bg { align-items: center; justify-content: center; padding: 20px; }
.sheet-bg { align-items: flex-end; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 24px; max-width: 420px; width: 100%; }
.sheet { background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px; width: 100%;
  max-width: var(--maxw); margin: 0 auto; animation: slideup .22s ease; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.modal ul { padding-left: 1.1em; margin: 12px 0; } .modal li { margin: 7px 0; }

/* Respiración guiada (antojo fuerte) */
.breathe-circle { width: 130px; height: 130px; border-radius: 50%; margin: 20px auto 4px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .95rem; text-align: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-ink)); animation: breatheScale 16s ease-in-out infinite; }
@keyframes breatheScale {
  0% { transform: scale(.62); } 25% { transform: scale(1); } 50% { transform: scale(1); }
  75% { transform: scale(.62); } 100% { transform: scale(.62); }
}
.price-row { display: flex; gap: 10px; margin: 16px 0; }
.price { flex: 1; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.price.best { border-color: var(--brand); background: var(--brand-soft); }
.price .amt { font-size: 1.25rem; font-weight: 800; }

/* Chips (disparadores, intensidad) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .9rem; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.intensity { display: flex; gap: 6px; }
.intensity .dot { flex: 1; height: 34px; border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.intensity .dot.on { background: var(--accent); }

/* Toast */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; z-index: 200; box-shadow: var(--shadow); animation: fade .2s; max-width: 90%; text-align: center; }

/* Popup de celebración (resistí / recaída) — grande, arriba, llamativo */
.celebrate-bg { position: fixed; inset: 0; background: rgba(15,43,40,.5); display: flex;
  align-items: flex-start; justify-content: center; padding: 12vh 18px 0; z-index: 150; animation: fade .2s; }
.celebrate { background: var(--surface); border-radius: 22px; padding: 26px 24px; max-width: 360px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(15,43,40,.35); border: 2px solid var(--brand);
  animation: pop .34s cubic-bezier(.2,1.35,.5,1); }
.celebrate.slip { border-color: var(--accent); }
.celebrate .emoji { font-size: 3.1rem; line-height: 1; }
.celebrate h2 { margin: 12px 0 6px; }
.celebrate .benefit { background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px;
  padding: 10px 12px; margin-top: 14px; font-weight: 600; font-size: .92rem; }
.celebrate.slip .benefit { background: var(--accent-soft); color: var(--accent); }
.celebrate .tap { margin-top: 12px; font-size: .78rem; color: var(--ink-soft); }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Popup de LOGRO (más grande y festivo que la celebración de antojo) */
.achv-bg { position: fixed; inset: 0; background: rgba(15,43,40,.6); display: flex; align-items: center;
  justify-content: center; padding: 20px; z-index: 160; animation: fade .2s; }
.achv { background: var(--surface); border-radius: 24px; padding: 30px 26px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: 0 24px 70px rgba(15,43,40,.45); border: 2px solid var(--brand);
  animation: pop .38s cubic-bezier(.2,1.4,.5,1); }
.achv-emoji { font-size: 4.2rem; line-height: 1; animation: bump .5s ease .1s both; }
@keyframes bump { 0% { transform: scale(.4) rotate(-12deg); } 60% { transform: scale(1.18) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
.achv-tag { color: var(--accent); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: .78rem; margin: 10px 0 4px; }
.achv h2 { margin: 4px 0 6px; }

/* Banner de instalación (propio, no el prompt genérico del navegador) */
.install-hint {
  position: fixed; left: 12px; right: 12px; bottom: 88px; z-index: 90; max-width: calc(var(--maxw) - 24px);
  margin: 0 auto; background: var(--surface); border: 1.5px solid var(--brand); border-radius: 16px;
  padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  animation: slideup .25s ease;
}
.install-hint span { font-weight: 600; font-size: .92rem; }

/* Legend (antojos recientes) */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-soft); margin: 6px 0 10px; }

/* "Lo que ganaste" */
.gained-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.gained { text-align: center; padding: 8px 4px; }
.gained-num { font-size: 1.5rem; font-weight: 800; color: var(--brand-ink); letter-spacing: -.02em; line-height: 1.1; }
.gained-u { font-size: .8rem; font-weight: 500; color: var(--ink-soft); }
.gained-lbl { font-size: .66rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; line-height: 1.25; }
.gained-eq { text-align: center; background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px; padding: 10px; margin-top: 10px; font-size: .92rem; }

/* Antojos: hero + reducción + mini stats + lista expandible */
.hero-num { font-size: 2.6rem; font-weight: 800; color: var(--brand-ink); line-height: 1; letter-spacing: -.03em; }
.mini { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.reduce-box { display: flex; align-items: center; gap: 14px; background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; margin: 4px 0; }
.reduce-big { font-size: 2rem; font-weight: 800; color: var(--good); line-height: 1; }
.reduce-lbl { font-weight: 700; color: var(--brand-ink); font-size: .9rem; }
.crav-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.crav-more { margin-top: 4px; }
.crav-more summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; font-size: .85rem; padding: 6px 0; }

/* FAQ / Ayuda */
.faq-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { cursor: pointer; font-weight: 700; font-size: .95rem; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--brand-ink); font-weight: 800; flex-shrink: 0; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin-top: 8px; color: var(--ink-soft); font-size: .88rem; line-height: 1.55; }

/* Food picker (registrar comida sin saber calorías) */
.food-list { max-height: 40vh; overflow-y: auto; margin: 6px 0; border-radius: 10px; }
.food-sub { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin: 8px 2px 4px; }
.food-item { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left;
  background: var(--surface-2); border: none; border-radius: 10px; padding: 11px 14px; margin-bottom: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.food-item:hover { background: var(--brand-soft); }
.food-name { font-weight: 600; font-size: .92rem; }
.food-kcal { font-weight: 700; color: var(--brand-ink); white-space: nowrap; font-size: .9rem; }
.meal-sel { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.meal-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; }
.meal-row-name { flex: 1; font-weight: 600; }
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1rem; cursor: pointer; line-height: 1; }
.qty b { min-width: 16px; text-align: center; }
.meal-del { background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: .9rem; }
.meal-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding: 10px 12px; background: var(--brand-soft); border-radius: 10px; color: var(--brand-ink); }
.meal-empty { text-align: center; padding: 14px 0; }
.meal-custom { display: none; gap: 8px; margin: 8px 0; }
.meal-custom.show { display: flex; }

/* Figura de morfología corporal (progreso) */
.morph { display: flex; align-items: center; gap: 16px; }
.morph svg { flex: none; }
.morph-txt { flex: 1; }

/* Splash / auth */
.splash { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 22px; }
.logo { font-size: 1.6rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.logo .dot { color: var(--accent); }
.lang-toggle { position: absolute; top: 16px; right: 16px; display: flex; gap: 4px; }
.lang-toggle button { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; }
.lang-toggle button.on { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }

@media (min-width: 620px) { h1 { font-size: 2rem; } .view { padding: 28px 24px; } }
