/* FitCore PWA — design tokens + layout. Mobile-first, tema oscuro con acento verde
   (mismo lenguaje visual que el plan y la vista imprimible de dietas del worker). */
:root {
  --bg: #0A0F0D;
  --bg2: #111816;
  --card: #161D1A;
  --card2: #1C2520;
  --input: #1E2723;
  --line: #263029;
  --ink: #E4ECE6;
  --muted: #8FA398;
  --accent: #16A34A;
  --accent-light: #34D399;
  --accent-alpha: rgba(22,163,74,.15);
  --warn: #E8A34C;
  --danger: #EF4444;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-light); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
.hidden { display: none !important; }

/* ── Layout general de la app ── */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 76px; }
.view { padding: 1.1rem 1rem 1.5rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem .5rem; position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.topbar .brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand .fit { color: var(--ink); } .brand .core { color: var(--accent); }
.plan-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .22rem .55rem; border-radius: 999px; background: var(--accent-alpha); color: var(--accent-light);
}
.plan-badge.free { background: var(--card2); color: var(--muted); }

/* ── Tabs inferiores ── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: var(--bg2); border-top: 1px solid var(--line);
  display: flex; max-width: 480px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar button {
  flex: 1; background: none; border: 0; padding: .6rem 0 .5rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  color: var(--muted); font-size: .68rem; font-weight: 600;
}
.tabbar button .ic { font-size: 1.25rem; }
.tabbar button.active { color: var(--accent-light); }

/* ── Cards ── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: .8rem;
}
.card h3 { font-size: .95rem; margin-bottom: .5rem; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 10px; padding: .7rem 1.1rem; font-weight: 700; font-size: .88rem;
  cursor: pointer; text-decoration: none; width: 100%;
}
.btn-primary { background: var(--accent); color: #06210F; }
.btn-primary:active { background: var(--accent-light); }
.btn-secondary { background: var(--card2); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost { background: none; color: var(--accent-light); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(239,68,68,.35); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-sm { padding: .4rem .7rem; font-size: .78rem; width: auto; }

/* ── Formularios ── */
.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .3rem; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--input); border: 1px solid var(--line); border-radius: 10px;
  padding: .65rem .8rem; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.chip-group { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  border: 1px solid var(--line); background: var(--input); border-radius: 999px;
  padding: .4rem .8rem; font-size: .8rem; cursor: pointer; color: var(--muted);
}
.chip.active { background: var(--accent-alpha); border-color: var(--accent); color: var(--accent-light); font-weight: 700; }

/* ── Toast / mensajes ── */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card2); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem 1.1rem; font-size: .85rem; opacity: 0; pointer-events: none; transition: .2s;
  max-width: 90%; text-align: center; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: rgba(239,68,68,.4); color: #FCA5A5; }

/* ── KPIs / anillos ── */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0; }
.kpi { background: var(--card2); border-radius: 10px; padding: .55rem; text-align: center; }
.kpi b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .68rem; color: var(--muted); }

/* ── Comidas / ejercicios ── */
.comida { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.comida:last-child { border-bottom: 0; }
.comida-head { display: flex; justify-content: space-between; font-weight: 700; font-size: .88rem; text-transform: capitalize; }
.item-row { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); padding: .15rem 0; }
.ej-card { display: flex; gap: .7rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.ej-card:last-child { border-bottom: 0; }
.ej-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--card2); flex-shrink: 0; }
.ej-info b { display: block; font-size: .86rem; }
.ej-info span { font-size: .75rem; color: var(--muted); }
.dia-pill {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: .2rem .55rem;
  border-radius: 999px; margin-bottom: .5rem;
}
.dia-pill.pesado { background: rgba(232,163,76,.15); color: var(--warn); }
.dia-pill.ligero { background: var(--accent-alpha); color: var(--accent-light); }
.dia-pill.descanso { background: var(--card2); color: var(--muted); }

/* ── Auth / onboarding ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; font-size: 1.7rem; font-weight: 800; }
.step-dots { display: flex; gap: .35rem; justify-content: center; margin-bottom: 1.2rem; }
.step-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.step-dots span.active { background: var(--accent); width: 20px; border-radius: 4px; }
.legal-note { font-size: .72rem; color: var(--muted); text-align: center; margin-top: 1rem; line-height: 1.5; }
.legal-note a { color: var(--accent-light); }

.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #06210F; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state .ic { font-size: 2.2rem; margin-bottom: .5rem; display: block; }

.disclaimer {
  font-size: .72rem; color: var(--muted); background: var(--card2); border-radius: 10px;
  padding: .6rem .8rem; margin-top: .8rem; line-height: 1.5;
}
