:root {
  --bg: #FBF7F0;
  --card: #FFFFFF;
  --ink: #1E2A20;
  --muted: #6B7468;
  --line: #ECE5D8;
  --green: #2F6B3F;
  --green-2: #E6F0E1;
  --green-3: #CFE2C6;
  --orange: #E2703A;
  --orange-2: #FCE9DD;
  --red: #C8463B;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(30, 42, 32, .05), 0 6px 20px rgba(30, 42, 32, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { text-decoration: none; }
h1, h2, h3, p { margin: 0; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
@media (min-width: 600px) {
  body { background: #EFE9DE; }
  .app { background: var(--bg); box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0,0,0,.08); }
}

/* ---------- splash ---------- */
.splash { min-height: 100vh; display: grid; place-items: center; }
.splash-logo { font-size: 64px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- layout ---------- */
.screen { padding: calc(16px + var(--safe-t)) 18px calc(100px + var(--safe-b)); animation: in .25s ease; }
.screen.no-nav { padding-bottom: calc(32px + var(--safe-b)); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hello { color: var(--muted); font-size: 14px; font-weight: 500; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--green-2); display: grid; place-items: center; font-size: 20px; flex: none; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.section-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.section-title .link { color: var(--green); font-weight: 700; font-size: 14px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 16px; font-weight: 700; font-size: 16px; background: var(--green); color: #fff; width: 100%; transition: transform .08s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--green-2); color: var(--green); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.orange { background: var(--orange); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; width: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; background: var(--green-2); color: var(--green); display: grid; place-items: center; font-size: 17px; flex: none; }

/* ---------- inputs ---------- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.input { width: 100%; height: 54px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-size: 17px; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--green); }
.input.code { text-align: center; letter-spacing: .4em; font-size: 26px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px; border-radius: 18px; background: #fff; border: 2px solid var(--line); margin-bottom: 10px; transition: border-color .15s, background .15s; }
.choice.on { border-color: var(--green); background: var(--green-2); }
.choice .emo { font-size: 28px; }
.choice b { display: block; font-size: 16px; }
.choice small { color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 6px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.chip.off { background: #fff; color: var(--muted); text-decoration: line-through; }

.seg { display: flex; background: var(--green-2); border-radius: 14px; padding: 4px; }
.seg button { flex: 1; height: 42px; border-radius: 11px; font-weight: 700; color: var(--green); }
.seg button.on { background: #fff; box-shadow: var(--shadow); }

.switch { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.switch:last-child { border-bottom: 0; }
.toggle { width: 50px; height: 30px; border-radius: 99px; background: #D9D3C7; position: relative; flex: none; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(20px); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: calc(40px + var(--safe-t)) 24px calc(30px + var(--safe-b)); }
.auth-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-badge { width: 84px; height: 84px; border-radius: 26px; background: var(--green); display: grid; place-items: center; font-size: 44px; margin-bottom: 26px; box-shadow: 0 12px 30px rgba(47, 107, 63, .3); }
.auth h1 { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -.03em; margin-bottom: 10px; }
.auth p.lead { color: var(--muted); font-size: 16px; margin-bottom: 28px; }
.err { color: var(--red); font-size: 14px; font-weight: 600; margin: -4px 0 12px; min-height: 1em; }

/* ---------- onboarding ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 26px; }
.progress div { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
.ob h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; line-height: 1.2; }
.ob .lead { color: var(--muted); margin-bottom: 22px; }
.ob-footer { position: sticky; bottom: 0; padding: 16px 0 calc(8px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); display: flex; gap: 10px; }
.ob-footer .btn.ghost { width: auto; }

/* ---------- meta ---------- */
.goal { background: var(--green); color: #fff; border-radius: 24px; padding: 20px; position: relative; overflow: hidden; }
.goal::after { content: "🍱"; position: absolute; right: -8px; bottom: -18px; font-size: 96px; opacity: .1; transform: rotate(-12deg); }
.goal .lbl { font-size: 13px; opacity: .8; font-weight: 600; }
.goal .big { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.goal .big small { font-size: 16px; font-weight: 600; opacity: .8; }
.goal .row3 { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.goal .row3 div { background: rgba(255,255,255,.13); border-radius: 14px; padding: 10px; }
.goal .row3 b { display: block; font-size: 17px; }
.goal .row3 span { font-size: 11.5px; opacity: .85; }

/* ---------- marmita cards ---------- */
.mm { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.mm-head { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; text-align: left; }
.mm-emo { width: 54px; height: 54px; border-radius: 16px; background: var(--orange-2); display: grid; place-items: center; font-size: 28px; flex: none; }
.mm-num { font-size: 11px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: .06em; }
.mm-name { font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.mm-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.mm-body { border-top: 1px dashed var(--line); padding: 12px 14px 14px; display: none; }
.mm.open .mm-body { display: block; }
.mm-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 15px; }
.mm-item b { font-weight: 700; }
.macros { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.macro { font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 99px; background: var(--green-2); color: var(--green); }
.macro.o { background: var(--orange-2); color: var(--orange); }
.mm-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- builder ---------- */
.step-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 20px 0 10px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; background: var(--green-2); color: var(--green); font-weight: 800; font-size: 18px; }
.stepper span { min-width: 58px; text-align: center; font-weight: 700; }
.summary { margin-top: 18px; }
.meter { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.meter div { height: 100%; border-radius: 99px; background: var(--green); transition: width .3s, background .3s; }
.status { font-weight: 700; font-size: 14px; }
.status.ok { color: var(--green); } .status.hi { color: var(--orange); } .status.lo { color: #B08A1E; }

/* ---------- recipes ---------- */
.rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rec { border-radius: var(--radius); padding: 14px; text-align: left; min-height: 172px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); }
.rec .emo { font-size: 46px; line-height: 1; }
.rec b { font-size: 15px; line-height: 1.25; display: block; margin-top: 10px; }
.rec small { color: var(--muted); font-weight: 600; font-size: 12.5px; }

/* ---------- lists ---------- */
.check { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.check:last-child { border-bottom: 0; }
.box { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--green-3); flex: none; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800; transition: all .15s; }
.check.done .box { background: var(--green); border-color: var(--green); }
.check.done .txt { text-decoration: line-through; color: var(--muted); }
.check .qty { white-space: nowrap; font-weight: 700; font-size: 14px; color: var(--green); white-space: nowrap; }
.group-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 4px 4px; }

.steps .stp { display: flex; gap: 14px; padding: 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; width: 100%; text-align: left; }
.stp .n { width: 34px; height: 34px; border-radius: 50%; background: var(--orange-2); color: var(--orange); display: grid; place-items: center; font-weight: 800; flex: none; }
.stp.done .n { background: var(--green); color: #fff; }
.stp.done .ttl, .stp.done p { opacity: .5; }
.stp .ttl { font-weight: 800; display: flex; justify-content: space-between; gap: 8px; }
.stp .ttl small { color: var(--muted); font-weight: 600; white-space: nowrap; }
.stp p { font-size: 14.5px; color: #3E473F; margin-top: 4px; }

.empty { text-align: center; padding: 40px 20px; }
.empty .emo { font-size: 54px; margin-bottom: 10px; }

.banner { display: flex; gap: 12px; align-items: center; background: var(--orange-2); border-radius: 18px; padding: 14px; margin-bottom: 16px; }
.banner .emo { font-size: 26px; }
.banner b { display: block; font-size: 14.5px; }
.banner small { font-size: 13px; color: #6d4a37; }
.demo-bar { background: #1E2A20; color: #fff; font-size: 12.5px; text-align: center; padding: 6px 10px calc(6px); font-weight: 600; }

.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin-top: 22px; padding: 0 10px; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + var(--safe-b)); z-index: 20; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; padding: 6px 0; border-radius: 12px; }
.nav a .i { font-size: 22px; filter: grayscale(1); opacity: .65; transition: all .15s; }
.nav a.on { color: var(--green); }
.nav a.on .i { filter: none; opacity: 1; transform: translateY(-1px); }

/* ---------- sheet / modal ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(20, 28, 22, .45); z-index: 50; animation: fade .2s; display: flex; align-items: flex-end; justify-content: center; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--bg); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet .grab { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.sheet-hero { border-radius: 22px; display: grid; place-items: center; font-size: 76px; height: 150px; margin-bottom: 16px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.ios-steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0; }
.ios-steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.ios-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; font-size: 14px; }

/* ---------- v3: protocolo, treino, progresso ---------- */
.seg a.segl { flex: 1; height: 40px; border-radius: 11px; font-weight: 700; color: var(--green); display: grid; place-items: center; font-size: 14px; }
.seg a.segl.on { background: #fff; box-shadow: var(--shadow); }
.pbar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; margin-top: 12px; position: relative; z-index: 1; }
.pbar div { height: 100%; background: #fff; border-radius: 99px; }

.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats3 .card { padding: 14px 10px; text-align: center; }
.stats3 b { display: block; font-size: 24px; font-weight: 800; }
.stats3 span { font-size: 12px; color: var(--muted); font-weight: 600; }

.grid28 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.q { aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #F1ECE2; color: var(--muted); }
.q.n1, .q.n2 { background: var(--green-3); color: var(--green); }
.q.n3 { background: #6FA77C; color: #fff; }
.q.n4 { background: var(--green); color: #fff; }
.q.fut { background: transparent; border: 1.5px dashed var(--line); }
.q.hj { outline: 2.5px solid var(--orange); outline-offset: 1px; }
.legenda { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legenda span { display: flex; align-items: center; gap: 5px; }
.legenda i.q { width: 14px; height: 14px; border-radius: 4px; aspect-ratio: auto; display: inline-block; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wd { background: #fff; border-radius: 14px; padding: 8px 2px; text-align: center; box-shadow: var(--shadow); }
.wd span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.wd b { font-size: 14px; color: var(--muted); }
.wd.on b { color: var(--green); }
.wd.hj { outline: 2.5px solid var(--orange); }

.exrow { width: 100%; text-align: left; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.exrow b { white-space: nowrap; color: var(--green); font-size: 14px; }

.passos, .evite { margin: 0; padding-left: 22px; }
.passos li, .evite li { margin-bottom: 8px; font-size: 15px; }
.evite li::marker { color: var(--red); }

.ex-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.alvo { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--ink); }
.timer { font-size: 96px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; color: var(--green); margin: 16px 0; font-variant-numeric: tabular-nums; }
.exec-footer { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 16px 0 calc(8px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); margin-top: 12px; }

/* ---------- boneco animado ---------- */
.demo { background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 6px 8px; margin-bottom: 14px; }
svg.boneco { width: 100%; height: auto; display: block; }
.mini { width: 64px; flex: none; background: var(--bg); border-radius: 12px; padding: 2px; }
.exrow { gap: 12px; }
.demo svg.boneco { max-height: 230px; margin: 0 auto; }

/* ---------- módulos extras ---------- */
.subscroll { overflow-x: auto; margin: 0 -18px 0; padding: 0 18px; scrollbar-width: none; }
.subscroll::-webkit-scrollbar { display: none; }
.subscroll .seg { width: max-content; min-width: 100%; }
.subscroll .seg a.segl { padding: 0 14px; white-space: nowrap; flex: none; }
.bloq { filter: blur(1.5px); opacity: .6; text-align: left; pointer-events: none; user-select: none; }

/* ---------- tela inicial: Protocolo 28 Dias ---------- */
.auth.p28 { padding: 0; background: var(--bg); }
.p28-top { position: relative; overflow: hidden; color: #FBF7F0; padding: calc(34px + var(--safe-t)) 24px 54px;
  background: radial-gradient(circle at 85% 20%, #3d8a52 0, #2F6B3F 38%, #173a21 100%); }
.p28-top::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; background: rgba(226,112,58,.22); }
.p28-tag { display: inline-block; background: #FFD34D; color: #1E2A20; font-weight: 800; font-size: 12px; letter-spacing: .08em; padding: 7px 12px; border-radius: 99px; }
.p28-num { display: flex; align-items: center; gap: 12px; font-size: 88px; font-weight: 900; line-height: 1; letter-spacing: -.05em; margin: 18px 0 6px; color: #fff; }
.p28-num small { font-size: 15px; font-weight: 700; letter-spacing: 0; line-height: 1.2; color: #CFE2C6; text-transform: uppercase; }
.p28-top h1 { font-size: 34px; line-height: 1.05; font-weight: 900; letter-spacing: -.035em; margin: 0 0 12px; color: #fff; }
.p28-top h1 em { font-style: normal; color: #FF9A62; }
.p28-top p { color: #E1ECDD; font-size: 15.5px; line-height: 1.45; margin: 0 0 18px; position: relative; z-index: 1; }
.p28-pills { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.p28-pills span { background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.18); padding: 7px 11px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.p28-form { position: relative; z-index: 2; margin: -28px 16px calc(24px + var(--safe-b)); background: var(--card); border-radius: 24px; padding: 22px 20px; box-shadow: 0 14px 40px rgba(30,42,32,.14); }
.p28-form h2 { font-size: 22px; font-weight: 900; letter-spacing: -.02em; margin: 0 0 4px; }
.p28-btn { background: var(--orange); box-shadow: 0 10px 24px rgba(226,112,58,.35); font-weight: 800; }
