:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --ink: #17221c;
  --muted: #6d776f;
  --line: #e5e7df;
  --green: #1f6b4f;
  --green-dark: #174d3b;
  --mint: #dcefe5;
  --warm: #f1e1bb;
  --shadow: 0 18px 50px rgb(27 51 39 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #e8ebe6; color: var(--ink); }
body.sheet-open { overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { position: relative; width: min(100%, 480px); min-height: 100vh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 20px calc(98px + env(safe-area-inset-bottom)); background: var(--bg); overflow: hidden; }
.screen { display: none; animation: enter .24s ease; }
.screen.is-active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: .02em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 7vw, 31px); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 19px; letter-spacing: -.02em; }
.avatar { width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--ink); color: white; font-weight: 750; }
.hero-card { display: grid; grid-template-columns: 128px 1fr; align-items: center; gap: 18px; padding: 20px; border-radius: 26px; background: var(--green); color: white; box-shadow: var(--shadow); }
.ring { --ring-color: #bfe7cf; width: 124px; aspect-ratio: 1; display: grid; place-content: center; text-align: center; border-radius: 50%; background: radial-gradient(circle at center, var(--green) 57%, transparent 58%), conic-gradient(var(--ring-color) var(--progress), rgb(255 255 255 / 20%) 0); }
.ring-value { font-size: 34px; font-weight: 800; line-height: 1; }
.ring-label { margin-top: 5px; font-size: 11px; opacity: .8; }
.ring.is-over { --ring-color: #f2c3ba; }
.hero-copy h2 { font-size: 20px; }
.hero-copy p:last-child { margin-bottom: 0; color: rgb(255 255 255 / 76%); font-size: 13px; line-height: 1.45; }
.status-badge { display: inline-flex; margin-bottom: 12px; padding: 6px 9px; border-radius: 100px; background: rgb(255 255 255 / 14%); font-size: 11px; font-weight: 700; }
.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 18px; }
.macro-grid article { padding: 13px 11px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.macro-grid span, .macro-grid strong { display: block; }
.macro-grid span { color: var(--muted); font-size: 11px; }
.macro-grid strong { margin: 5px 0 9px; font-size: 12px; }
.macro-grid i { display: block; height: 4px; border-radius: 10px; background: linear-gradient(90deg, var(--green) var(--value), var(--line) 0); }
.primary-action, .secondary-action { width: 100%; min-height: 56px; border-radius: 18px; font-weight: 750; }
.primary-action { border: 0; background: var(--ink); color: white; box-shadow: 0 10px 24px rgb(23 34 28 / 16%); }
.secondary-action { margin-top: 9px; border: 1px solid var(--line); background: var(--surface); }
.action-icon { display: inline-grid; width: 27px; height: 27px; margin-right: 7px; place-items: center; border-radius: 50%; background: white; color: var(--ink); }
.section-block { margin-top: 26px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.section-heading h2 { margin: 0; }
.section-heading button { border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 750; }
.streak { padding: 6px 9px; border-radius: 100px; background: var(--warm); font-size: 12px; font-weight: 700; }
.focus-card, .achievement { display: flex; align-items: center; gap: 13px; padding: 16px; border: 1px solid #cfe1d6; border-radius: 20px; background: var(--mint); }
.focus-card { width: 100%; color: inherit; text-align: left; cursor: pointer; }
.focus-card > div { flex: 1; }
.focus-card p, .achievement p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.focus-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--green); color: white; }
.focus-cta { color: var(--green); font-size: 12px; font-weight: 750; }
.focus-card.is-complete { border-color: #8fc5a6; background: #dff2e6; }
.focus-card.is-complete strong { text-decoration: line-through; text-decoration-color: #76a98b; }
.meal-list { display: grid; gap: 9px; }
.meal-card { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.meal-emoji { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; background: #f2f1eb; font-size: 20px; }
.meal-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.meal-card b { font-size: 12px; }
.date-chip { padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); font-size: 12px; font-weight: 750; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; padding: 16px 6px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.summary-strip div { text-align: center; border-right: 1px solid var(--line); }
.summary-strip div:last-child { border-right: 0; }
.summary-strip span, .summary-strip strong { display: block; }
.summary-strip span { color: var(--muted); font-size: 11px; }
.summary-strip strong { margin-top: 5px; font-size: 18px; }
.diary-sections { display: grid; gap: 12px; margin-top: 18px; }
.diary-group { padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.diary-group header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.diary-group h2 { margin: 0; }
.diary-group header span { color: var(--green); font-size: 13px; font-weight: 750; }
.diary-group p { margin: 8px 0; color: var(--muted); font-size: 13px; }
.diary-group button { border: 0; background: transparent; color: var(--green); font-weight: 750; }
.diary-actions { display: flex; gap: 18px; margin-top: 8px; }
.diary-group .diary-actions button { padding: 8px 0; font-size: 12px; }
.diary-group .meal-remove { color: #a2473e; }
.diary-group.is-empty { border-style: dashed; }
.progress-card { padding: 22px; border-radius: 26px; background: var(--ink); color: white; box-shadow: var(--shadow); }
.progress-card > span { color: rgb(255 255 255 / 65%); font-size: 12px; }
.progress-card > strong { display: block; margin: 8px 0 4px; font-size: 34px; }
.progress-card p { color: #b9d7c8; font-size: 13px; }
.chart { height: 105px; display: flex; align-items: end; gap: 10px; margin-top: 25px; }
.chart i { flex: 1; height: var(--height, 30%); min-height: 18%; border-radius: 8px 8px 3px 3px; background: linear-gradient(#9fdbb9, #3c7b5e); transition: height 220ms ease; }
.progress-card footer { display: flex; justify-content: space-between; margin-top: 8px; color: rgb(255 255 255 / 60%); font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.stat-grid span { color: var(--muted); font-size: 11px; }.stat-grid strong { display: block; margin: 8px 0 4px; font-size: 21px; }.stat-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.achievement span { font-size: 28px; }
.reset-demo-action { width: 100%; margin-top: 18px; padding: 12px; border: 0; background: transparent; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 50%; width: min(100%, 480px); display: grid; grid-template-columns: repeat(3, 1fr); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 92%); backdrop-filter: blur(16px); transform: translateX(-50%); }
.bottom-nav button { display: grid; gap: 3px; justify-items: center; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.bottom-nav span { font-size: 22px; line-height: 1; }
.bottom-nav button.is-active { color: var(--green); }
.backdrop { position: fixed; z-index: 30; inset: 0; background: rgb(14 25 19 / 48%); backdrop-filter: blur(2px); }
.bottom-sheet { position: fixed; z-index: 31; left: 50%; bottom: 0; width: min(100%, 480px); padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--surface); box-shadow: 0 -22px 50px rgb(10 20 15 / 18%); transform: translateX(-50%); animation: sheet-up .25s ease; }
@keyframes sheet-up { from { transform: translate(-50%, 100%); } }
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 20px; border-radius: 10px; background: #d6d9d4; }
.sheet-view { display: none; text-align: center; }.sheet-view.is-active { display: block; }.sheet-view > p { color: var(--muted); font-size: 13px; }
.sheet-option { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 11px; margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: white; text-align: left; }
.sheet-option.accent { background: var(--mint); border-color: #c9e0d2; }.sheet-option > span { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: var(--green); color: white; font-size: 22px; }.sheet-option small { display: block; margin-top: 3px; color: var(--muted); }.sheet-option b { font-size: 24px; font-weight: 400; }
.text-button { margin-top: 16px; padding: 10px; border: 0; background: transparent; color: var(--muted); }
.loader { width: 58px; height: 58px; margin: 30px auto 20px; border: 5px solid var(--mint); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.estimate { display: grid; gap: 5px; margin: 18px 0; padding: 16px; border-radius: 18px; background: var(--mint); }.estimate strong { font-size: 24px; }.estimate span { color: var(--muted); font-size: 11px; }
.sheet-view label { display: grid; gap: 8px; margin: 15px 0; color: var(--muted); font-size: 12px; text-align: left; }.sheet-view label span { padding: 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); font-size: 14px; }.sheet-view input, .sheet-view select { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); outline: 0; }.sheet-view input:focus, .sheet-view select:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--mint); }
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); display: flex; width: max-content; max-width: calc(100% - 28px); align-items: center; gap: 14px; padding: 12px 18px; border-radius: 100px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 13px; font-weight: 700; transform: translateX(-50%); }
.toast button { padding: 4px 0; border: 0; background: transparent; color: #bfe7cf; font-weight: 800; }
[hidden] { display: none !important; }

.danger-text { color: #a2473e; }
.form-error { margin: -4px 0 14px !important; padding: 10px 12px; border-radius: 12px; background: #fbe8e5; color: #8c352e !important; text-align: left; }
.meal-card.is-new, .diary-group.is-new { border-color: #9fcbb1; animation: highlight-new .55s ease; }
@keyframes highlight-new { from { background: var(--mint); transform: translateY(6px); } }
@media (max-width: 390px) { .hero-card { grid-template-columns: 105px 1fr; padding: 16px; }.ring { width: 104px; }.ring-value { font-size: 28px; }.macro-grid strong { font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; } }

.service-status { width: fit-content; margin: 0 0 12px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 100px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; }
.service-status[data-state="online"] { border-color: #9fcbb1; background: var(--mint); color: var(--green); }
.service-status[data-state="offline"] { border-color: #e2c6bd; background: #fff4f0; color: #8c4a3e; }
.service-status[data-state="demo"] { background: #f3f1eb; color: var(--muted); }

.photo-privacy, .photo-local-note { margin: 10px 4px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.photo-preview { display: grid; gap: 8px; margin: 4px 0 12px; }
.photo-preview[hidden] { display: none; }
.photo-preview img { width: 100%; height: 154px; object-fit: cover; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.photo-replace { justify-self: center; padding: 7px 10px; border: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 700; }
