/* MiPlan · paleta propia: crema, verde petróleo y los colores del plato
   (verduras = verde, proteína = coral, almidones = trigo, fruta = frutilla, grasas = oliva).
   "--plum" es el tono fuerte de la marca (títulos y botones principales). */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/figtree-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url(../fonts/figtree-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Josefin Sans'; font-style: normal; font-weight: 100 700; font-display: swap; src: url(../fonts/josefin-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Josefin Sans'; font-style: normal; font-weight: 100 700; font-display: swap; src: url(../fonts/josefin-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #eef0ea;
  --ink: #1e2a28;
  --ink-2: #566663;
  --ink-3: #8a9894;
  --line: #e0e4dc;
  --brand: #2b6f68;
  --brand-ink: #ffffff;
  --plum: #1d4f48;
  --lav: #e2efea;
  --prot: #d1553f;
  --carb: #d4962a;
  --verd: #4f9a45;
  --fruta: #c2457a;
  --grasa: #8d8a2c;
  --ok: #2f8a5b;
  --ok-bg: #e2f2e8;
  --warn: #b5720f;
  --warn-bg: #fbf0db;
  --bad: #c2412e;
  --bad-bg: #f8e2de;
  --hero-a: #1d4f48;
  --hero-b: #2b6f68;
  --shadow: 0 1px 2px rgba(30, 42, 40, .05), 0 6px 18px rgba(30, 42, 40, .06);
  --r: 18px;
  --r-sm: 12px;
  --tab-h: 64px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Josefin Sans', 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121816; --surface: #1b2321; --surface-2: #24302d; --ink: #edf3f0; --ink-2: #aebbb6; --ink-3: #7f8d88;
    --line: #2f3b37; --brand: #7cc4b6; --brand-ink: #10201d; --plum: #cfe9e2; --lav: #1f3531;
    --prot: #ec7a64; --carb: #e8b45a; --verd: #8cc56f; --fruta: #e57aa5; --grasa: #c5c25a;
    --ok: #5cc28a; --ok-bg: #1b3328; --warn: #f0b45a; --warn-bg: #3a2e1a; --bad: #ec7a64; --bad-bg: #3b2420;
    --hero-a: #173a35; --hero-b: #245a53;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121816; --surface: #1b2321; --surface-2: #24302d; --ink: #edf3f0; --ink-2: #aebbb6; --ink-3: #7f8d88;
  --line: #2f3b37; --brand: #7cc4b6; --brand-ink: #10201d; --plum: #cfe9e2; --lav: #1f3531;
  --prot: #ec7a64; --carb: #e8b45a; --verd: #8cc56f; --fruta: #e57aa5; --grasa: #c5c25a;
  --ok: #5cc28a; --ok-bg: #1b3328; --warn: #f0b45a; --warn-bg: #3a2e1a; --bad: #ec7a64; --bad-bg: #3b2420;
  --hero-a: #173a35; --hero-b: #245a53;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
}
body.locked { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- barra superior y pestañas ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.brand { display: flex; align-items: center; gap: 8px; font: 600 15px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--plum); }
.brand-dot { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--verd) 0 50%, var(--prot) 0 75%, var(--carb) 0); box-shadow: inset 0 0 0 4px var(--bg); outline: 1.5px solid var(--line); }
.view { max-width: 560px; margin: 0 auto; padding: 4px 16px 24px; }

/* ---------- aviso de demo y crédito ---------- */
.demo-bar { max-width: 528px; margin: 2px auto 0; padding: 7px 12px; border-radius: 14px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }
.demo-bar b { display: inline-block; margin-right: 4px; padding: 0 7px; border-radius: 999px; background: var(--plum); color: var(--bg); font-size: 10.5px; line-height: 17px; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }
.demo-reset { display: inline; font-size: 12.5px; font-weight: 700; color: var(--plum); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
@media (max-width: 559px) { .demo-bar { margin-left: 16px; margin-right: 16px; } }
.credito { max-width: 560px; margin: 0 auto; padding: 4px 16px 8px; text-align: center; color: var(--ink-3); font-size: 12px; letter-spacing: .02em; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.tabs button.on { color: var(--plum); }
.tabs button.on svg { stroke-width: 2.2; }
.tabs button.on::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

/* ---------- comunes ---------- */
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); flex: none; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 999px; font-weight: 600; font-size: 15px; transition: transform .12s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--plum); color: var(--bg); }
.btn.soft { background: var(--lav); color: var(--plum); }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--surface); border-radius: var(--r); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.card-t { font: 600 13px/1.2 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--brand); margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.card-head .card-t { margin-bottom: 0; }
.count { font-weight: 700; color: var(--ink-2); font-size: 14px; }
.hint { color: var(--ink-2); font-size: 14px; margin: -4px 0 12px; }
.fine { color: var(--ink-3); font-size: 12.5px; margin-top: 12px; }
.center { text-align: center; }
.pad { padding: 18px 8px 8px; }
.empty { color: var(--ink-3); font-size: 14px; padding: 6px 0; }
.pill { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--plum); color: var(--bg); padding: 3px 8px; border-radius: 999px; }
.page-head { padding: 10px 2px 2px; }
.page-head h1, .hero h1 { font: 300 32px/1.1 var(--display); color: var(--plum); letter-spacing: -.01em; }
.page-head h1 { margin-bottom: 14px; }
.page-head .hint { margin: 10px 4px 0; }
.date-lbl { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; flex: 1; }
.date-lbl b { font-size: 15px; }
.date-lbl span { font-size: 13px; color: var(--ink-2); }

/* ---------- HOY ---------- */
.hero { padding: 6px 2px 0; }
.date-nav, .week-nav { display: flex; align-items: center; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.week-nav.sm { box-shadow: none; background: var(--surface-2); margin: 4px 0 12px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 4px; }
.sub { color: var(--ink-2); margin-top: 6px; }
.streak { margin-top: 8px; font-weight: 600; font-size: 14px; color: var(--warn); }
.ring-wrap { position: relative; width: 74px; height: 74px; flex: none; }
.ring { width: 74px; height: 74px; transform: rotate(-90deg); }
.ring circle { stroke: var(--line); transition: stroke .4s; }
.ring circle.on:nth-child(1) { stroke: var(--carb); }
.ring circle.on:nth-child(2) { stroke: var(--verd); }
.ring circle.on:nth-child(3) { stroke: var(--prot); }
.ring circle.on:nth-child(4) { stroke: var(--brand); }
.ring-wrap b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; color: var(--plum); }

.tip { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--lav); color: var(--plum); font-size: 14.5px; }
.install { display: flex; align-items: center; gap: 10px; }
.install > div { flex: 1; display: flex; flex-direction: column; }
.install small { color: var(--ink-2); font-size: 13px; }

.meals { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.meal {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px 12px 14px; border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow); position: relative; transition: transform .12s;
}
.meal:active { transform: scale(.985); }
.meal.next { box-shadow: var(--shadow), inset 0 0 0 2px var(--brand); }
.meal.done .meal-dish { color: var(--ink-2); }
.meal-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--surface-2); flex: none; }
.meal.done .meal-ico { background: var(--ok-bg); }
.meal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meal-top { display: flex; align-items: center; gap: 8px; }
.meal-top b { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.meal-top small { color: var(--ink-3); font-size: 12.5px; }
.meal-dish { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.parts { display: flex; gap: 5px; margin-top: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.prot { background: var(--prot); }
.dot.grasa { background: var(--grasa); }
.dot.verd { background: var(--verd); }
.dot.carb { background: var(--carb); }
.dot.fruta { background: var(--fruta); }
.dot.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); opacity: .6; }
.thumb { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; flex: none; background: var(--surface-2); display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.lg { width: 84px; height: 84px; }
.tick { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; flex: none; }
.tick svg { width: 18px; height: 18px; stroke-width: 2.6; }
.tick.sm { width: 22px; height: 22px; }
.tick.sm svg { width: 13px; height: 13px; }
.go { color: var(--ink-3); }
.snack { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 14px; border-radius: var(--r); border: 1.5px dashed var(--line); color: var(--ink-2); }
.snack-ico { width: 44px; text-align: center; font-size: 18px; opacity: .8; }
.snack > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.snack b { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.snack small { font-size: 13px; color: var(--ink-3); }
.snack-plus { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.snack-plus svg { width: 16px; height: 16px; }

.chks { display: flex; flex-direction: column; gap: 8px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); text-align: left; transition: background .2s; }
.chk > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.chk b { font-size: 15px; line-height: 1.25; }
.chk small { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.chk-e { font-size: 22px; width: 28px; text-align: center; }
.chk.on { background: var(--ok-bg); }
.chk.big { width: 100%; padding: 12px; }
.chk.big b { font-size: 15px; }
.box { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--ink-3); flex: none; color: transparent; transition: all .15s; }
.box svg { width: 15px; height: 15px; stroke-width: 3; }
.on > .box { background: var(--ok); box-shadow: none; color: #fff; }
.row2 { display: flex; gap: 10px; margin-top: 10px; align-items: flex-start; }
.row2 .fld:first-child { width: 96px; flex: none; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=number], input[type=time], input[type=date], input[type=search], textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); outline: none; font-size: 16px;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, textarea:focus { border-color: var(--brand); }
.mt { margin-top: 10px; }
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: var(--r-sm); background: var(--surface-2); }
.mood span { font-size: 26px; filter: grayscale(.6); opacity: .75; transition: all .15s; }
.mood small { font-size: 10.5px; color: var(--ink-2); }
.mood.on { background: var(--lav); box-shadow: inset 0 0 0 2px var(--brand); }
.mood.on span { filter: none; opacity: 1; transform: scale(1.12); }
.tm-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-list li { display: flex; gap: 10px; align-items: baseline; font-size: 15px; }
.tm-list li span { width: 22px; text-align: center; }

/* ---------- SEMANA ---------- */
.wk-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.wk-actions .btn { flex: 1; min-width: 140px; }
.week { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.wk-day { background: var(--surface); border-radius: var(--r); padding: 6px 6px 8px; box-shadow: var(--shadow); scroll-margin: 80px; }
.wk-day.today { box-shadow: var(--shadow), inset 0 0 0 2px var(--brand); }
.wk-day.past { opacity: .78; }
.wk-day header { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px; }
.wk-day header b { font: 600 16px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--plum); }
.wk-day header > span { color: var(--ink-3); font-size: 13px; }
.wk-n { margin-left: auto; color: var(--ok) !important; font-weight: 600; }
.wk-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); }
.wk-row:active { background: var(--surface-2); }
.wk-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 15px; flex: none; }
.wk-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14.5px; font-weight: 500; line-height: 1.3; }
.wk-comi { font-style: normal; font-size: 12.5px; color: var(--ok); font-weight: 600; }
.wk-txt small { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- COMPRAS ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 4px; border-radius: 999px; gap: 4px; }
.seg button { min-height: 40px; border-radius: 999px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); text-align: center; transition: background .2s; }
.seg button.on { background: var(--surface); color: var(--plum); box-shadow: var(--shadow); }
.seg.sm button { min-height: 36px; font-size: 14px; }
.per { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.per .chip:first-of-type { margin-left: 4px; }
.chips, .extras { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.extras { margin: 12px 0 2px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); text-align: center; }
.chip.on { background: var(--plum); color: var(--bg); box-shadow: none; }
.per .chip { min-width: 40px; padding: 0 10px; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 6px; transition: width .3s; }
.list { display: flex; flex-direction: column; }
.grp h3 { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 16px 0 4px; }
.li-wrap { display: flex; align-items: center; }
.li { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.li-wrap .li { flex: 1; }
.li-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li-t b { font-weight: 500; font-size: 15px; }
.li-t small { font-size: 12px; color: var(--ink-3); }
.li.on .li-t b { text-decoration: line-through; color: var(--ink-3); }
.qty { font-weight: 700; font-size: 14px; color: var(--plum); white-space: nowrap; }
.li.on .qty { color: var(--ink-3); }
.li.dsp .li-t b { text-decoration: none; color: var(--ink); }
.state { font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.li.warn .state { background: var(--warn-bg); color: var(--warn); }
.okmsg { margin-top: 12px; text-align: center; font-weight: 600; color: var(--ok); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-btn { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; font-weight: 500; }
.pill-btn.on { background: var(--plum); color: var(--bg); }
.pill-btn.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.add-row { display: flex; gap: 8px; margin-top: 14px; }
.add-row input { flex: 1; }
.add-row .btn { min-height: 44px; }

/* ---------- MIS PLATOS ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--surface); border-radius: var(--r-sm); padding: 12px 8px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stats b { font: 600 26px/1 var(--display); color: var(--plum); }
.stats small { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.g-day h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 20px 2px 8px; }
.g-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph span { position: absolute; left: 6px; bottom: 6px; right: 6px; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.ph.rota::after, .thumb.rota::after { content: '📷'; position: absolute; inset: 0; display: grid; place-items: center; opacity: .4; }
.empty-state { text-align: center; padding: 32px 20px 12px; color: var(--ink-2); }
.empty-state span { font-size: 40px; }
.empty-state p { margin-top: 8px; font-size: 15px; }
.envio .wk-actions { margin-top: 4px; }
.med-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.med-f, .med-v { display: flex; flex-direction: column; min-width: 0; }
.med-f { width: 128px; flex: none; }
.med-row small { color: var(--ink-3); font-size: 12px; line-height: 1.3; }
.med-v { flex: 1; }
.med-v b { color: var(--plum); font-size: 15px; }
.chart { margin: 4px 0 12px; }
.chart-h { display: flex; justify-content: space-between; font-size: 13px; }
.chart-h .down { color: var(--ok); font-weight: 700; }
.chart-h .up { color: var(--ink-2); font-weight: 700; }
.chart svg { width: 100%; height: 70px; }
.chart polyline { fill: none; stroke-width: 2.5; }
.chart .c1 polyline, .chart .c1 circle { stroke: var(--brand); }
.chart .c2 polyline, .chart .c2 circle { stroke: var(--prot); }
.chart .c3 polyline, .chart .c3 circle { stroke: var(--carb); }
.chart-h small { font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.chart circle { fill: var(--surface); stroke-width: 2.5; }

/* ---------- GUÍA ---------- */
.plan-card { background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); color: #fff; }
.plan-card small { font: 600 12px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.plan-card .obj { font-size: 17px; font-weight: 500; margin-top: 10px; line-height: 1.4; }
.plan-card .fine { color: rgba(255, 255, 255, .8); }
.plan-card .firma { margin-top: 12px; font-size: 13px; opacity: .9; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); }
.search input { border: 0; background: transparent; padding-left: 0; }
.food { margin-top: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); border-left: 4px solid var(--ok); }
.food b { display: block; margin-top: 6px; }
.food p { font-size: 14px; color: var(--ink-2); }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.food.aveces { border-color: var(--carb); } .food.aveces .badge { background: var(--warn-bg); color: var(--warn); }
.food.ocasional { border-color: var(--brand); } .food.ocasional .badge { background: var(--lav); color: var(--plum); }
.food.evitar { border-color: var(--bad); } .food.evitar .badge { background: var(--bad-bg); color: var(--bad); }
.formula { display: flex; align-items: stretch; gap: 6px; margin-bottom: 12px; }
.mas { align-self: center; font-weight: 700; color: var(--ink-3); }
.f-part { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--r-sm); background: var(--surface-2); border-top: 3px solid; min-width: 0; }
.f-part b { font-size: 13.5px; }
.f-part small { font-size: 11.5px; color: var(--ink-2); line-height: 1.25; }
.f-part.prot { border-color: var(--prot); } .f-part.prot b { color: var(--prot); }
.f-part.grasa { border-color: var(--grasa); } .f-part.grasa b { color: var(--grasa); }
.f-part.verd { border-color: var(--verd); } .f-part.verd b { color: var(--verd); }
.f-part.carb { border-color: var(--carb); } .f-part.carb b { color: var(--warn); }
.f-part.fruta { border-color: var(--fruta); } .f-part.fruta b { color: var(--fruta); }
.bebida { font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.exs { display: flex; flex-direction: column; gap: 6px; }
.ex { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 14.5px; font-weight: 500; }
.ex span { font-size: 18px; }
.ex svg { margin-left: auto; width: 18px; height: 18px; color: var(--ink-3); }
.recs { margin: 0; padding: 0; list-style: none; counter-reset: r; display: flex; flex-direction: column; gap: 12px; }
.recs li { counter-increment: r; display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; }
.recs li::before { content: counter(r); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--lav); color: var(--plum); font-weight: 700; font-size: 13px; }
.recs b { font-size: 15px; }
.recs span { font-size: 14px; color: var(--ink-2); }
.lins { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.lins li { display: flex; flex-direction: column; }
.lins span { font-size: 14px; color: var(--ink-2); }
.acc { border-top: 1px solid var(--line); }
.acc:first-of-type { border-top: 0; }
.acc summary { list-style: none; padding: 12px 0; font-weight: 600; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: '+'; font-size: 20px; color: var(--ink-3); font-weight: 400; }
.acc[open] summary::after { content: '–'; }
.acc p { font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.acc p b { color: var(--ink); }

/* ---------- hoja inferior ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(10, 22, 20, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .22s; }
.sheet.on { opacity: 1; pointer-events: auto; }
.sh-panel { width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; background: var(--bg); border-radius: 24px 24px 0 0; display: flex; flex-direction: column; transform: translateY(30px); transition: transform .26s cubic-bezier(.2, .9, .3, 1); }
.sheet.on .sh-panel { transform: none; }
.sh-grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 8px auto 0; flex: none; }
.sh-body { overflow-y: auto; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.sh-head { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0 10px; }
.sh-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); font-size: 24px; flex: none; box-shadow: var(--shadow); }
.sh-head h2 { font-size: 20px; line-height: 1.25; margin-top: 2px; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.desc { color: var(--ink-2); font-size: 15px; margin-bottom: 12px; }
.recipe { background: var(--surface); border-radius: var(--r-sm); padding: 0 12px; margin-bottom: 12px; border: 0; }
.ings { list-style: none; margin: 0 0 8px; padding: 0; }
.ings li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.ings li:last-child { border-bottom: 0; }
.ings b { white-space: nowrap; color: var(--plum); font-size: 14px; }
.ings b.soft { color: var(--ink-3); font-weight: 500; }
.ptip { font-size: 14px; color: var(--ink-2); padding: 8px 0 12px; }
.link { color: var(--brand); font-weight: 600; font-size: 14.5px; padding: 4px 0; }
.sh-t { font-size: 15px; margin: 20px 0 10px; }
.sh-t small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.fotos { display: flex; gap: 8px; flex-wrap: wrap; }
.add-foto { width: 84px; height: 84px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--surface); border: 1.5px dashed var(--brand); color: var(--brand); font-size: 12px; font-weight: 600; }
.add-foto svg { width: 26px; height: 26px; }
.hambre { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hambre button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: var(--r-sm); background: var(--surface); text-align: center; box-shadow: inset 0 0 0 1.5px var(--line); }
.hambre b { font: 600 22px/1 var(--display); color: var(--plum); }
.hambre small { font-size: 11px; color: var(--ink-2); line-height: 1.2; }
.hambre button.on { background: var(--plum); box-shadow: none; }
.hambre button.on b, .hambre button.on small { color: var(--bg); }
.partes { display: flex; gap: 8px; flex-wrap: wrap; }
.parte { display: flex; align-items: center; gap: 8px; padding: 9px 14px 9px 10px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: 14px; }
.parte.on.prot { box-shadow: inset 0 0 0 2px var(--prot); } .parte.on.prot .box { background: var(--prot); }
.parte.on.grasa { box-shadow: inset 0 0 0 2px var(--grasa); } .parte.on.grasa .box { background: var(--grasa); }
.parte.on.verd { box-shadow: inset 0 0 0 2px var(--verd); } .parte.on.verd .box { background: var(--verd); }
.parte.on.carb { box-shadow: inset 0 0 0 2px var(--carb); } .parte.on.carb .box { background: var(--carb); }
.parte.on.fruta { box-shadow: inset 0 0 0 2px var(--fruta); } .parte.on.fruta .box { background: var(--fruta); }
.sh-foot { display: flex; gap: 10px; margin-top: 22px; position: sticky; bottom: 0; padding: 10px 0 2px; background: linear-gradient(transparent, var(--bg) 30%); }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-sm); background: var(--surface); text-align: left; box-shadow: var(--shadow); }
.opt > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.opt b { font-size: 15px; }
.opt small { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.opt.on { box-shadow: inset 0 0 0 2px var(--brand); }
.opt-e { font-size: 24px; width: 34px; text-align: center; flex: none; }
.viewer { border-radius: var(--r); overflow: hidden; background: var(--surface-2); margin-bottom: 12px; }
.viewer img { width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.li-link { display: block; width: 100%; padding: 14px 4px; border-bottom: 1px solid var(--line); font-weight: 500; text-align: left; }
.li-link.danger { color: var(--bad); }
.form .btn { margin-top: 18px; }

/* ---------- diálogo, toast, bienvenida, confeti ---------- */
.dlg { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 22, 20, .5); }
.dlg.on { display: flex; }
.dlg-card { background: var(--bg); border-radius: 22px; padding: 20px; max-width: 380px; width: 100%; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.dlg-card h3 { font-size: 18px; }
.dlg-card p { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.dlg-btns { display: flex; gap: 10px; margin-top: 18px; }
.dlg-btns .btn { flex: 1; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); z-index: 80; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px; transition: all .25s; max-width: calc(100% - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.bienvenida { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(circle at 30% 20%, var(--bv-a), transparent 55%), radial-gradient(circle at 80% 80%, var(--bv-b), transparent 50%), var(--bg); overflow-y: auto; }
:root { --bv-a: #d9eee4; --bv-b: #f4e6cc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bv-a: #17362f; --bv-b: #33291a; } }
:root[data-theme="dark"] { --bv-a: #17362f; --bv-b: #33291a; }
.bienvenida.on { display: flex; animation: aparece .5s ease; }
.bv-card { max-width: 420px; width: 100%; text-align: center; margin: auto; }
.bv-plate { position: relative; width: 120px; height: 120px; margin: 0 auto 18px; }
.bv-plate .ring { width: 120px; height: 120px; }
.bv-logo { position: absolute; inset: 34px; border-radius: 50%; background: conic-gradient(var(--verd) 0 50%, var(--prot) 0 75%, var(--carb) 0); box-shadow: inset 0 0 0 7px var(--bg); animation: gira 1.2s cubic-bezier(.2, .9, .3, 1); }
.bv-card small { font: 600 13px/1 var(--display); letter-spacing: .3em; text-transform: uppercase; color: var(--brand); }
.bv-card h1 { font: 300 56px/1.05 var(--display); color: var(--plum); margin: 6px 0 14px; }
.bv-card > p { font-size: 17px; color: var(--ink); line-height: 1.5; }
.bv-card > p.bv-demo { margin-top: 12px; font-size: 14px; color: var(--ink-2); background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; box-shadow: var(--shadow); }
.bv-card ul { list-style: none; padding: 0; margin: 22px 0 24px; text-align: left; background: var(--surface); border-radius: var(--r); padding: 6px 16px; box-shadow: var(--shadow); }
.bv-card li { display: grid; grid-template-columns: 88px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); line-height: 1.35; }
.bv-card li:last-child { border-bottom: 0; }
.bv-card li b { color: var(--plum); }
@media (max-height: 900px) {
  .bv-plate, .bv-plate .ring { width: 96px; height: 96px; }
  .bv-plate { margin-bottom: 14px; }
  .bv-logo { inset: 27px; box-shadow: inset 0 0 0 6px var(--bg); }
  .bv-card h1 { font-size: 48px; margin: 4px 0 10px; }
  .bv-card > p { font-size: 16px; }
  .bv-card > p.bv-demo { font-size: 13.5px; }
  .bv-card ul { margin: 14px 0 16px; }
}
@keyframes aparece { from { opacity: 0; transform: scale(.98); } }
@keyframes gira { from { transform: rotate(-120deg) scale(.6); opacity: 0; } }
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confeti i { position: absolute; top: -12px; width: 8px; height: 13px; border-radius: 2px; animation: cae linear forwards; }
@keyframes cae { to { top: 105%; transform: rotate(720deg) translateX(40px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- impresión (informe para la nutri) ---------- */
.print { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { padding: 0; background: #fff; color: #222; }
  body > *:not(.print) { display: none !important; }
  .print { display: block !important; font: 11pt/1.35 var(--font); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print header { border-bottom: 2px solid #2b6f68; padding-bottom: 6px; margin-bottom: 10px; }
  .print h1 { font: 600 18pt/1.2 var(--display); color: #1d4f48; }
  .print header p { color: #555; font-size: 9.5pt; margin-top: 2px; }
  .print footer { margin-top: 10px; padding-top: 6px; border-top: 1px solid #ddd; color: #888; font-size: 8pt; text-align: center; }
  .p-dia { break-inside: avoid; margin-bottom: 14px; }
  .p-dia h2 { font-size: 12pt; color: #1d4f48; margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
  .p-dia.vacio p { color: #999; font-size: 9.5pt; }
  .p-dia table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .p-dia th { background: #c6efce; text-align: left; padding: 4px 6px; border: 1px dashed #888; }
  .p-dia td { padding: 4px 6px; border: 1px dashed #aaa; vertical-align: top; }
  .p-dia td.c { text-align: center; }
  .p-extra { font-size: 9.5pt; color: #444; margin-top: 4px; }
  .p-fotos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
  .p-fotos figure { margin: 0; width: 31%; }
  .p-fotos img { width: 100%; height: 42mm; object-fit: cover; border-radius: 4px; display: block; }
  .p-fotos figcaption { font-size: 8pt; color: #666; text-align: center; }
}

@media (min-width: 600px) {
  .page-head h1, .hero h1 { font-size: 36px; }
}

/* En la compu: la app queda como una columna centrada y las pestañas flotan abajo */
@media (min-width: 760px) {
  body { padding-bottom: calc(var(--tab-h) + 40px); }
  .topbar { padding-left: max(16px, calc((100% - 560px) / 2)); padding-right: max(16px, calc((100% - 560px) / 2)); }
  .tabs { left: 50%; right: auto; bottom: 16px; width: 560px; transform: translateX(-50%); height: var(--tab-h); padding-bottom: 0; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
  .tabs button.on::before { top: 0; }
  .sh-panel { border-radius: 24px; margin-bottom: 16px; max-height: calc(100dvh - 32px); }
  .toast { top: 16px; }
}

/* Compu ancha: cada pantalla se acomoda en columnas */
@media (min-width: 1100px) {
  .view, .credito { max-width: 1112px; }
  .demo-bar { max-width: 1080px; }
  .topbar { padding-left: max(16px, calc((100% - 1080px) / 2)); padding-right: max(16px, calc((100% - 1080px) / 2)); }
  .page-head .week-nav, .page-head .seg, .page-head > .hint, .stats { max-width: 560px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .cols > .col:last-child { padding-top: 8px; }
  .week { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .wk-actions { max-width: 560px; }
  .grps { columns: 2; column-gap: 40px; }
  .grp { break-inside: avoid; }
  .grp:first-child h3 { margin-top: 8px; }
  .g-manana { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: auto auto 1fr; grid-template-areas: "menu lista" "desp lista" ". lista"; column-gap: 28px; align-items: start; }
  .a-menu { grid-area: menu; } .a-lista { grid-area: lista; } .a-desp { grid-area: desp; }
  .cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 18px; align-items: start; }
  .g-platos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-rows: auto auto auto 1fr; grid-template-areas: "nutri gal" "med gal" "backup gal" ". gal"; column-gap: 28px; align-items: start; }
  .g-platos > .envio { grid-area: nutri; } .gal { grid-area: gal; } .med-card { grid-area: med; } .backup-card { grid-area: backup; }
  .gal .g-day:first-child h3 { margin-top: 16px; }
  .g-grid { grid-template-columns: repeat(4, 1fr); }
  .guia { columns: 2; column-gap: 24px; }
  .guia > .card { break-inside: avoid; display: inline-block; width: 100%; }
}
