/* ============ Forja · estilos ============ */
:root {
  --bg: #0b0d10;
  --card: #14171c;
  --card-2: #1b1f26;
  --line: #262b34;
  --text: #f2f4f7;
  --muted: #8b93a1;
  --faint: #5b6270;
  --accent: #c8ff3d;
  --accent-ink: #0b0d10;
  --accent-soft: rgba(200, 255, 61, .12);
  --protein: #5ab0ff;
  --carbs: #ffb547;
  --fat: #ff7ab6;
  --ok: #4ade80;
  --warn: #ffb547;
  --danger: #ff5d5d;
  --radius: 22px;
  --radius-sm: 14px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-num: "SF Pro Rounded", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea { -webkit-user-select: text; user-select: text; }
a { color: inherit; text-decoration: none; }
svg { fill: currentColor; }

/* ---------- Layout ---------- */
.view {
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 2px 18px; }
.topbar h1 { font-size: 28px; line-height: 1.1; margin: 0; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.topbar .sub::first-letter { text-transform: uppercase; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; padding: 8px 0; }

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spacer { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card.tap:active { transform: scale(.985); background: var(--card-2); }
.card.hero { background: linear-gradient(160deg, #1d2410 0%, var(--card) 55%); border-color: #2c3a12; }
.card-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.card-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big-num { font-family: var(--font-num); font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.unit { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 20px; width: 100%;
  border: 0; border-radius: 16px;
  background: var(--card-2); color: var(--text);
  font-size: 17px; font-weight: 700;
  cursor: pointer; transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.97); opacity: .85; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: rgba(255, 93, 93, .12); color: var(--danger); }
.btn.sm { min-height: 42px; font-size: 15px; padding: 0 14px; width: auto; border-radius: 12px; }
.btn svg { width: 22px; height: 22px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; color: var(--muted);
}
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Progreso ---------- */
.week-dots { display: flex; gap: 6px; margin: 14px 0 16px; }
.week-dots span { flex: 1; height: 8px; border-radius: 99px; background: var(--line); }
.week-dots span.on { background: var(--accent); }

.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.bar.over > i { background: var(--danger); }
.macro { display: grid; gap: 6px; }
.macro-head { display: flex; justify-content: space-between; font-size: 14px; }
.macro-head b { font-family: var(--font-num); }

.ring { position: relative; width: 116px; height: 116px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .val { stroke: var(--accent); transition: stroke-dashoffset .6s ease; }
.ring.over .val { stroke: var(--danger); }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center b { font-family: var(--font-num); font-size: 24px; font-weight: 800; line-height: 1; }
.ring .center small { color: var(--muted); font-size: 11px; margin-top: 3px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--card-2); }
.pill.ok { color: var(--ok); background: rgba(74, 222, 128, .1); }
.pill.warn { color: var(--warn); background: rgba(255, 181, 71, .1); }
.pill.bad { color: var(--danger); background: rgba(255, 93, 93, .1); }
.pill.accent { color: var(--accent); background: var(--accent-soft); }

/* ---------- Acceso a la IA ---------- */
.ai-cta {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
}
.ai-cta:active { transform: scale(.98); }
.ai-cta svg { width: 28px; height: 28px; flex: none; }
.ai-cta b { font-size: 17px; display: block; }
.ai-cta small { font-size: 13px; opacity: .7; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px; padding: 12px 14px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
  font-size: 17px; outline: none; -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--accent); }
.input.big { font-family: var(--font-num); font-size: 34px; font-weight: 800; text-align: center; min-height: 72px; }
.hint { font-size: 13px; color: var(--faint); }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 4px 8px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item:active { background: var(--card-2); }

/* ---------- Estado vacío ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .emoji { font-size: 44px; margin-bottom: 8px; }
.empty h2 { color: var(--text); margin: 6px 0; font-size: 22px; }

/* ---------- Barra de pestañas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 6px var(--safe-bottom);
  background: rgba(11, 13, 16, .88);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: grid; justify-items: center; gap: 2px; color: var(--faint); font-size: 11px; font-weight: 600; padding: 6px 0; }
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.active { color: var(--accent); }
.tabbar .ai-bubble {
  width: 58px; height: 58px; border-radius: 20px; margin-top: -22px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(200, 255, 61, .25), 0 0 0 5px var(--bg);
}
.tabbar .ai-bubble svg { width: 30px; height: 30px; }
.tabbar a.tab-ai.active .ai-bubble { box-shadow: 0 8px 30px rgba(200, 255, 61, .45), 0 0 0 5px var(--bg); }

/* ---------- Hoja inferior (modal) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .15s ease-out;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--card); border-radius: 26px 26px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 10px 18px calc(18px + var(--safe-bottom));
  animation: up .22s cubic-bezier(.2, .9, .3, 1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 14px; font-size: 22px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Chat ---------- */
.chat-view { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 96px); }
.msgs { display: grid; gap: 10px; }
.msg { display: flex; flex-direction: column; gap: 8px; }
.msg.user { align-items: flex-end; }
.msg.ai { align-items: flex-start; }
.bubble {
  max-width: 86%; padding: 11px 14px; border-radius: 20px; font-size: 16px; line-height: 1.45;
  -webkit-user-select: text; user-select: text; word-wrap: break-word;
}
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; font-weight: 500; }
.msg.user .bubble img { display: block; max-width: 220px; border-radius: 12px; margin-bottom: 6px; }
.msg.ai .bubble { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.error { border-color: rgba(255, 93, 93, .4) !important; color: #ffb1b1; }
.bubble.typing { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.bubble.typing span:nth-child(2) { animation-delay: .2s; }
.bubble.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 10px 14px; border-radius: 99px; font-size: 14px; font-weight: 600;
}
.chip:active { background: var(--card-2); }

.proposal {
  width: 100%; background: var(--card); border: 1px solid #3a4a17; border-radius: 18px; padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(200, 255, 61, .06);
}
.proposal.done { border-color: var(--line); opacity: .85; }
.prop-head { font-weight: 800; font-size: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prop-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.prop-main { flex: 1; min-width: 0; }
.prop-name { font-weight: 600; font-size: 15px; }
.prop-macros { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.prop-total { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.input.grams { width: 74px; min-height: 42px; padding: 8px; text-align: center; font-size: 17px; font-weight: 700; border-radius: 12px; }
.x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--card-2); color: var(--muted); font-size: 20px; line-height: 1; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(255, 181, 71, .14); color: var(--warn); }
.meal-select {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  font-weight: 700; font-size: 15px; -webkit-appearance: none; appearance: none;
}

.composer {
  position: fixed; left: 0; right: 0; z-index: 15;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 10px 12px; background: rgba(11, 13, 16, .94);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; max-width: 560px; margin: 0 auto; }
.composer textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 140px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; font-size: 16px; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.composer .icon-btn { width: 46px; height: 46px; border-radius: 50%; flex: none; }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.send svg { width: 22px; height: 22px; }
.img-preview { position: relative; max-width: 560px; margin: 0 auto 8px; }
.img-preview img { height: 72px; border-radius: 12px; }
.img-preview .x { position: absolute; top: -6px; left: 62px; }

/* ---------- Comida ---------- */
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 20px; }
.meal-block { padding: 0; overflow: hidden; }
.meal-block.now { border-color: #3a4a17; }
.meal-block.now h3::after { content: ' · ahora'; color: var(--accent); font-size: 13px; font-weight: 600; }
.meal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.meal-head h3 { margin: 0; font-size: 17px; }
.meal-head .muted { font-size: 13px; }
.entry { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.entry:active { background: var(--card-2); }
.entry .name { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .meta { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.entry .kcal { font-family: var(--font-num); font-weight: 700; }
.add-row { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.add-row .btn { min-height: 44px; font-size: 15px; }
.seg { display: flex; background: var(--card-2); border-radius: 14px; padding: 4px; gap: 4px; margin: 12px 0; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 10px; border-radius: 10px; font-size: 14px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 0 var(--line); }
.food-list { max-height: 52dvh; overflow-y: auto; margin: 0 -4px; }
.food-item { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.food-item:active { background: var(--card-2); }
.food-item .name { flex: 1; min-width: 0; font-weight: 600; }
.food-item .meta { font-size: 12.5px; color: var(--muted); }
.portion-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.macro-preview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin: 12px 0; }
.macro-preview div { background: var(--card-2); border-radius: 12px; padding: 10px 4px; }
.macro-preview b { display: block; font-family: var(--font-num); font-size: 20px; }
.macro-preview small { color: var(--muted); font-size: 11px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 8px; position: relative; }
.week-bars .col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-bars .area { height: 120px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.week-bars small { height: 18px; line-height: 18px; text-transform: capitalize; }
.week-bars .b { width: 100%; max-width: 30px; border-radius: 8px 8px 4px 4px; background: var(--accent); min-height: 3px; }
.week-bars .b.over { background: var(--danger); }
.week-bars .b.none { background: var(--line); }
.week-bars small { font-size: 11px; color: var(--muted); }
.week-bars .target-line { position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; border-top: 1.5px dashed var(--muted); }

/* ---------- Gimnasio ---------- */
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 15px; padding: 12px 0 0; width: 100%; text-align: center; }
.tile { display: grid; gap: 2px; padding: 16px; }
.tile span { font-size: 24px; }
.tile b { font-size: 17px; }
.tile small { color: var(--muted); font-size: 13px; }
.ex-card { padding: 16px 14px; }
.ex-card.complete { border-color: #3a4a17; }
.ex-head { display: flex; align-items: flex-start; gap: 10px; }
.ex-name { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.ex-head .icon-btn { font-size: 22px; font-weight: 800; width: 40px; height: 40px; }
.last { font-size: 13px; color: var(--muted); margin-top: 8px; }
.last b { color: var(--text); font-weight: 600; }
.set-head, .set { display: grid; grid-template-columns: 26px 1fr 1fr 52px 52px; gap: 8px; align-items: center; }
.set-head { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin: 12px 0 4px; text-align: center; }
.set { padding: 5px 0; }
.set-n { color: var(--muted); font-weight: 700; text-align: center; }
.set-in { min-height: 50px; padding: 8px; text-align: center; font-size: 20px; font-weight: 800; font-family: var(--font-num); }
.rir { height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); color: var(--muted); font-weight: 700; font-size: 14px; }
.check { height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); color: var(--faint); display: grid; place-items: center; }
.check svg { width: 26px; height: 26px; }
.set.done .check { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.set.done .set-in { border-color: #3a4a17; color: var(--accent); }
.vol-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.vol-row:last-of-type { border-bottom: 0; }
.vol-bar { position: relative; height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.vol-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--accent); }
.vol-band { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, .08); border-left: 1px dashed var(--muted); border-right: 1px dashed var(--muted); }

/* Temporizador de descanso */
.rest-bar {
  position: fixed; left: 10px; right: 10px; z-index: 30;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  max-width: 540px; margin: 0 auto;
  background: #1d2410; border: 1px solid #3a4a17; border-radius: 20px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transform: translateY(calc(100% + var(--tabbar-h) + var(--safe-bottom) + 20px)); visibility: hidden;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1), visibility 0s .25s;
}
.rest-bar.show { transform: none; visibility: visible; transition: transform .25s cubic-bezier(.2, .9, .3, 1); }
.rest-bar.over { background: var(--accent); }
.rest-bar.over * { color: var(--accent-ink) !important; }
.rest-progress { height: 4px; background: rgba(255, 255, 255, .08); }
.rest-progress i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.rest-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.rest-row button { min-width: 52px; height: 46px; border-radius: 14px; border: 0; background: rgba(255, 255, 255, .08); color: var(--text); font-weight: 800; font-size: 16px; }
.rest-row .skip { background: var(--accent); color: var(--accent-ink); padding: 0 14px; }
.rest-time { flex: 1; text-align: center; }
.rest-time small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.rest-time b { font-family: var(--font-num); font-size: 30px; font-weight: 800; line-height: 1; }

/* Gráficos */
.chart-wrap { position: relative; margin-top: 6px; }
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 10px; font-family: var(--font); }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .band { fill: rgba(74, 222, 128, .08); }
.chart .avg-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-tip {
  position: absolute; top: -6px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); border-radius: 10px; padding: 5px 9px;
  font-size: 12px; white-space: nowrap; pointer-events: none; display: grid; text-align: center;
}
.chart-tip b { font-size: 14px; }
.chart-empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* ---------- Cuerpo ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.measure { display: grid; justify-items: center; gap: 2px; background: var(--card-2); border-radius: 14px; padding: 12px 6px; }
.measure small { color: var(--muted); font-size: 12px; font-weight: 600; }
.measure b { font-family: var(--font-num); font-size: 24px; }
.measure span { font-size: 12px; font-weight: 700; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--card-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; background: rgba(0, 0, 0, .6); padding: 2px 6px; border-radius: 6px; }
.photo-full { width: 100%; border-radius: var(--radius); display: block; }
.compare { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; touch-action: pan-y; }
.compare > img { width: 100%; display: block; }
.compare-before { position: absolute; inset: 0 auto 0 0; overflow: hidden; }
.compare-before img { height: 100%; object-fit: cover; display: block; max-width: none; }
.compare-line { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--accent); pointer-events: none; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: ew-resize; }
.compare .tag-l, .compare .tag-r { position: absolute; top: 10px; font-size: 12px; font-weight: 800; background: rgba(0, 0, 0, .65); padding: 3px 8px; border-radius: 8px; pointer-events: none; }
.compare .tag-l { left: 10px; }
.compare .tag-r { right: 10px; }
.side { margin: 0; }
.side img { width: 100%; border-radius: 14px; display: block; }
.side figcaption { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------- Plan de comidas ---------- */
.plan-title { margin: 4px 0 10px; font-size: 20px; letter-spacing: -.01em; }
.plan-items { display: grid; gap: 2px; }
.plan-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.plan-item:last-child { border-bottom: 0; }
.plan-item b { font-family: var(--font-num); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.prot { background: var(--protein); }
.dot.carb { background: var(--carbs); }
.plan-total { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.opt-nav { display: flex; align-items: center; gap: 6px; }
.opt-nav button { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 20px; }
.opt-nav span { font-size: 13px; color: var(--muted); font-weight: 700; min-width: 30px; text-align: center; }
.opt-pick { text-align: left; width: 100%; color: var(--text); }
.opt-pick.on { border-color: var(--accent); }
.shop input { width: 22px; height: 22px; accent-color: var(--accent); }
.shop input:checked ~ span, .shop input:checked ~ b { text-decoration: line-through; color: var(--faint); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 15px;
  padding: 12px 18px; border-radius: 99px; max-width: 90vw; text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
