:root {
  --bg: #F4EFE6; --card: #FFFDF9; --ink: #14251B; --muted: #6E7469; --line: #E8E1D5; --soft: #EFE9DE;
  --green: #1F7A4D; --green-2: #2E9A62; --green-soft: #E2EFE5; --dark: #13291D; --dark-2: #1D3A2A;
  --orange: #EE8A2A; --blue: #3B82F6; --purple: #8B5CF6; --red: #D9534F; --yellow: #F2B632;
  --r: 18px; --r-sm: 12px; --shadow: 0 1px 2px rgba(20, 37, 27, .05), 0 6px 18px rgba(20, 37, 27, .05);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; font: 15px/1.45 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; background: var(--bg); }
@media (min-width: 560px) { body { background: #E9E2D5; } #app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(20, 37, 27, .08); } }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 800; } h2 { font-size: 21px; font-weight: 800; } h3 { font-size: 17px; font-weight: 700; } h4 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
img.noimg { background: linear-gradient(135deg, #DCEBDD, #F3E3C8); min-height: 60px; }
.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; } .bold { font-weight: 700; } .green { color: var(--green); }
.center { text-align: center; } .row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 12px; } .gap-s > * + * { margin-top: 6px; }
.hidden { display: none !important; }

/* page */
.page { padding: calc(14px + var(--safe-t)) 18px calc(100px + var(--safe-b)); animation: in .14s ease-out; }
.page.no-nav { padding-bottom: calc(28px + var(--safe-b)); }
@keyframes in { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.top { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 10px; }
.top h2 { flex: 1; text-align: center; font-size: 18px; }
.top .sp { width: 40px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: transparent; }
.iconbtn:active { background: var(--soft); }
.iconbtn.solid { background: var(--card); box-shadow: var(--shadow); }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-head a, .link { color: var(--green); font-weight: 700; font-size: 14px; }

/* cards */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tight { padding: 12px; }
.dark { background: var(--dark); color: #F3F6F1; }
.dark .muted { color: #B6C3B8; }
.soft { background: var(--green-soft); }
.list { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.item:first-child { border-top: 0; }
.item .t { font-weight: 700; } .item .s { color: var(--muted); font-size: 13px; }
.badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.badge.g { background: var(--green-soft); color: var(--green); } .badge.o { background: #FDEBD8; color: var(--orange); }
.badge.b { background: #E1ECFD; color: var(--blue); } .badge.p { background: #EDE6FD; color: var(--purple); } .badge.y { background: #FCF1D6; color: #B7860F; }
.thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 999px; background: var(--dark); color: #fff; font-weight: 700; font-size: 16px; width: 100%; transition: transform .08s; }
.btn:active { transform: scale(.98); }
.btn.sec { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.green { background: var(--green); }
.btn.ghost { background: transparent; color: var(--green); height: 44px; }
.btn.sm { height: 38px; font-size: 14px; padding: 0 16px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 14px; font-weight: 600; white-space: nowrap; }
.pill.on { background: var(--dark); color: #fff; box-shadow: none; }
.pill.light.on { background: var(--green-soft); color: var(--green); box-shadow: inset 0 0 0 1.5px var(--green); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 18px 4px; margin: 0 -18px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); }
.tag.o { background: #FDEBD8; color: #B4600F; } .tag.grey { background: var(--soft); color: var(--muted); }
.seg { display: flex; background: var(--soft); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 36px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--dark); color: #fff; }

/* forms */
label.f { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; outline: none; }
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--green); }
.searchbox { position: relative; } .searchbox .ic { position: absolute; left: 14px; top: 14px; color: var(--muted); } .searchbox .input { padding-left: 44px; border-radius: 999px; }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.toggle { position: relative; width: 50px; height: 30px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: #D5CFC3; transition: .2s; }
.toggle span::after { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--green); } .toggle input:checked + span::after { transform: translateX(20px); }
input[type=range] { width: 100%; accent-color: var(--green); }
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px; background: var(--card); }
.stepper button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.stepper button .ic { width: 18px; height: 18px; }
.stepper b { min-width: 34px; text-align: center; }
.err { color: var(--red); font-weight: 600; font-size: 14px; min-height: 20px; }

/* bottom nav */
nav.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: rgba(255, 253, 249, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); z-index: 20; }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: #8A8F86; padding: 4px 0; }
nav.tabs a.on { color: var(--dark); }
nav.tabs a.on .ic { stroke-width: 2.3; }

/* home */
.hello { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.hello h1 { font-size: 26px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-weight: 800; flex: none; }
.rings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ringbox { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 4px 8px; text-align: center; font-size: 12px; }
.ringbox b { display: block; font-size: 13px; }
.ring { width: 56px; height: 56px; display: block; margin: 0 auto 4px; }
.ring-in { width: 36px; height: 36px; display: grid; place-items: center; }
.ring-in .ic { width: 18px; height: 18px; }
.coachcard { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 8px; border-radius: var(--r); background: var(--dark); color: #fff; overflow: hidden; }
.coachcard img { width: 76px; height: 76px; object-fit: cover; border-radius: 14px; background: #F4EFE6; flex: none; }
.coachcard .t { font-weight: 800; font-size: 15px; } .coachcard .s { font-size: 13px; color: #CFDACF; margin-top: 2px; }
.done-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; flex: none; }
.add-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--line); flex: none; }
.add-dot .ic, .done-dot .ic { width: 18px; height: 18px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r); background: #FCF1D6; }

/* recipes */
.rgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rcard { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; display: block; }
.rcard img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.rcard .b { padding: 10px 11px 12px; }
.rcard .n { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.rcard .m { display: flex; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 5px 0 6px; align-items: center; }
.rcard .m .ic { width: 14px; height: 14px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .rcard { width: 168px; flex: none; scroll-snap-align: start; }
.hero { margin: calc(-14px - var(--safe-t)) -18px 0; position: relative; }
.hero img { width: 100%; aspect-ratio: 4/3.1; object-fit: cover; }
.hero .iconbtn { position: absolute; top: calc(12px + var(--safe-t)); background: rgba(255,255,255,.92); }
.sheetlike { background: var(--bg); border-radius: 24px 24px 0 0; margin: -26px -18px 0; padding: 20px 18px 0; position: relative; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.facts > div { background: var(--card); border-radius: 14px; padding: 10px 4px; text-align: center; font-size: 12px; font-weight: 600; box-shadow: var(--shadow); }
.facts .ic { margin: 0 auto 4px; color: var(--green); }
.ing { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.ing:first-child { border-top: 0; }
.steps { counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; display: grid; place-items: center; font-size: 13px; }

/* meal plan */
.plan-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.plan-row:first-child { border-top: 0; }
.plan-row .dow { width: 38px; font-weight: 800; font-size: 14px; } .plan-row .dow small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.plan-row.today { background: #F6FAF5; }
.tip { display: flex; gap: 10px; align-items: flex-end; }
.tip img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.bubble { background: var(--card); border-radius: 18px 18px 18px 6px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 14px; }

/* shopping */
.shop .item { padding: 11px 14px; }
.shop .item.on .t { text-decoration: line-through; color: var(--muted); }
.cbox { width: 24px; height: 24px; border-radius: 7px; box-shadow: inset 0 0 0 1.8px #C9C2B5; display: grid; place-items: center; flex: none; color: #fff; }
.on .cbox { background: var(--green); box-shadow: none; }
.cbox .ic { width: 16px; height: 16px; }
.cat-h { font-weight: 800; font-size: 15px; margin: 18px 0 8px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.msg { max-width: 82%; padding: 11px 14px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; box-shadow: var(--shadow); }
.msg.coach { background: var(--card); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.user { background: #D7EBDB; border-bottom-right-radius: 6px; align-self: flex-end; }
.msg .tm { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }
.coachrow { display: flex; gap: 8px; align-items: flex-end; }
.coachrow img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: var(--soft); }
.composer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(64px + var(--safe-b)); width: 100%; max-width: 480px; padding: 8px 14px; background: linear-gradient(transparent, var(--bg) 30%); z-index: 15; }
.composer form { display: flex; gap: 8px; align-items: center; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); padding: 5px 5px 5px 16px; }
.composer input { flex: 1; border: 0; outline: 0; background: none; height: 40px; font-size: 16px; }
.composer button { width: 40px; height: 40px; border-radius: 50%; background: var(--dark); color: #fff; display: grid; place-items: center; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #A7AFA4; margin: 0 2px; animation: blink 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .2; } }

/* progress */
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat3 > div { background: var(--card); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.stat3 small { color: var(--muted); font-size: 12px; display: block; } .stat3 b { font-size: 18px; }
.chart { width: 100%; height: 190px; display: block; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.bars div { flex: 1; background: var(--green-soft); border-radius: 8px 8px 4px 4px; position: relative; min-height: 4px; }
.bars div.on { background: var(--green); }
.bars-l { display: flex; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; } .bars-l span { flex: 1; text-align: center; }

/* check-in */
.faces { display: flex; justify-content: space-between; }
.faces button { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.faces button .ic { width: 28px; height: 28px; }
.faces button.on { background: var(--green); color: #fff; }

/* welcome + onboarding */
.welcome { min-height: 100dvh; position: relative; display: flex; flex-direction: column; justify-content: flex-end; color: #fff; overflow: hidden; }
.welcome .bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.welcome::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 25, 18, .55) 0%, rgba(10, 25, 18, 0) 32%, rgba(10, 25, 18, 0) 55%, rgba(10, 25, 18, .35) 100%); z-index: 1; }
.welcome .brand { position: absolute; top: calc(48px + var(--safe-t)); left: 0; right: 0; text-align: center; z-index: 2; }
.welcome .brand h1 { font-size: 64px; font-weight: 900; letter-spacing: .02em; text-shadow: 0 2px 12px rgba(0,0,0,.2); }
.welcome .brand p { font-size: 17px; font-weight: 600; margin-top: 4px; opacity: .95; }
.welcome .panel { position: relative; z-index: 2; margin: 0 16px calc(18px + var(--safe-b)); background: rgba(255, 253, 249, .97); color: var(--ink); border-radius: 26px; padding: 22px 20px 18px; text-align: center; }
.progress { height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; flex: 1; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 9px; transition: width .3s; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice button { background: var(--card); border-radius: 16px; padding: 18px 10px; min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; font-weight: 600; font-size: 14px; box-shadow: inset 0 0 0 1.5px var(--line); }
.choice button .ic { width: 26px; height: 26px; }
.choice button.on { box-shadow: inset 0 0 0 2px var(--green); background: #F2F8F2; }
.choice.list1 { grid-template-columns: 1fr; } .choice.list1 button { min-height: 0; flex-direction: row; justify-content: flex-start; padding: 14px 16px; }
.dows { display: flex; gap: 6px; } .dows button { flex: 1; height: 44px; border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 700; font-size: 13px; }
.dows button.on { background: var(--dark); color: #fff; box-shadow: none; }
.foot { position: sticky; bottom: 0; padding: 14px 0 calc(14px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 25%); margin-top: 18px; }
.cowhead { width: 220px; margin: 6px auto 0; }

/* sheet + toast */
#sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15, 25, 18, .38); opacity: 0; transition: opacity .18s; }
.sheet { position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + var(--safe-b)); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
#sheet.open .sheet-bg { opacity: 1; } #sheet.open .sheet { transform: translate(-50%, 0); }
.grab { width: 40px; height: 5px; border-radius: 9px; background: #D2CBBE; margin: 4px auto 14px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--dark); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; transition: .2s; z-index: 60; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.photo-frame { position: relative; border-radius: 20px; overflow: hidden; background: #222; aspect-ratio: 1; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.legal { font-size: 14.5px; } .legal h3 { margin: 18px 0 6px; } .legal p { margin-bottom: 8px; }
.splash { min-height: 100dvh; display: grid; place-items: center; }
.splash b { font-size: 40px; font-weight: 900; letter-spacing: .03em; }
