/* C11 composition. Functional legacy controls inherit tokens from tokens.css. */
html { font: calc(16px * var(--scale))/1.5 var(--font); }
body { background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
h1, h2, h3, .wordmark, .brand { font-family: var(--font); overflow-wrap: anywhere; }
h1 { font-size: var(--display); line-height: 1.12; font-weight: 700; letter-spacing: -.03em; }
h2, .section-head h2, .card h2 { font-size: var(--title); line-height: 1.28; font-weight: 600; letter-spacing: -.02em; }
h3 { font-size: var(--body); line-height: 1.4; }
p, li { font-weight: 400; }
p { overflow-wrap: break-word; }
button { transition: transform 120ms, background 120ms, color 120ms; }
button:active:not(:disabled) { transform: scale(.985); }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { color: var(--bg); background: var(--text); }
.eyebrow { font-size: var(--label); line-height: 1.4; letter-spacing: .01em; text-transform: none; font-weight: 500; }
.help, .muted { font-size: var(--label); line-height: 1.5; color: var(--text-2); }
.data-label { font-size: var(--label); color: var(--text-2); }
.side, .desktop-nav, .daily-foot { display: none; }
.shell { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 var(--s-5) calc(96px + env(safe-area-inset-bottom)); }
main, .layout, .content-main, .aside { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: var(--s-4); }
.appbar { position: sticky; top: 0; z-index: 15; height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); margin: 0 calc(-1 * var(--s-5)) var(--s-6); padding-inline: var(--s-5); border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); }
.appbar .mobile-logo { display: block; font: 700 18px/1 var(--font); letter-spacing: -.04em; text-decoration: none; }
.mobile-logo span { color: var(--energy); }
.appbar .row { gap: var(--s-2); }
.icon-btn, .profile-button { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; min-width: 40px; border: 0; border-radius: var(--r-pill); padding: 0; background: var(--surface-2); color: var(--text); }
.appbar .icon-btn { background: transparent; }
.icon-btn:hover, .profile-button:hover { background: var(--surface-3); }
.screen-head { margin: 0 0 var(--s-2); gap: var(--s-3); align-items: center; }
.screen-head h1 { font-size: var(--display); }
.screen-head p { margin-top: var(--s-2); font-size: var(--label); }
.card { min-width: 0; padding: var(--s-5); border: 0; border-radius: var(--r-lg); background: var(--surface-1); box-shadow: var(--elev-1); }
.card p + p { margin-top: var(--s-3); }
.card > .btn { margin-top: var(--s-4); }
.card .row.wrap { margin-top: var(--s-3); }
.section-head { flex-wrap: wrap; margin-bottom: var(--s-4); gap: var(--s-3); align-items: center; }
.section-head .text-btn { font-size: var(--label); }
.section-head .row { gap: var(--s-3); }
.btn, .btn.small { min-height: 48px; padding: var(--s-3) var(--s-5); border: 0; border-radius: var(--r-md); background: var(--action); color: var(--action-text); font-size: var(--body-s); font-weight: 600; gap: var(--s-2); }
.btn.secondary, .btn.outline { border: 0; background: var(--action-2); color: var(--text); }
.btn.coral { background: var(--action); color: var(--action-text); }
.btn:hover { filter: brightness(.94); }
.btn:active:not(:disabled) { filter: brightness(.86); }
.btn.secondary:active, .btn.outline:active, .icon-btn:active, .step-button:active { background: var(--surface-3); }
.text-btn { min-height: 44px; padding-inline: var(--s-1); font-size: var(--label); color: var(--text); }
.pill, .pill.mint, .pill.lilac, .pill.coral { background: var(--surface-2); color: var(--text-2); border: 0; border-radius: var(--r-pill); padding: var(--s-2) var(--s-3); font-size: var(--caption); }
.pill.lilac svg { color: var(--sleep); }
.week-wrap { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: 1; min-width: 0; gap: var(--s-1); }
.day-chip { height: 64px; min-height: 64px; min-width: 0; padding: var(--s-2) 0 var(--s-1); gap: 0; background: var(--surface-1); border: 0; border-radius: var(--r-md); justify-content: center; }
.day-chip .dow { font-size: 12px; line-height: 16px; color: var(--text-3); }
.day-chip .num { font-size: 18px; line-height: 24px; font-weight: 600; }
.day-chip .day-mark { width: 4px; height: 4px; display: block; margin-top: var(--s-1); background: transparent; border-radius: var(--r-pill); }
.day-chip.today .day-mark { background: currentColor; }
.day-chip.active { color: var(--bg); background: var(--text); border: 0; }
.day-chip.active .dow { color: var(--bg); opacity: 1; }
.day-chip.today:not(.active) { border: 0; box-shadow: 0 0 0 1px var(--hairline-str) inset; }
.week-calendar { width: 40px; min-width: 40px; background: transparent; }
.meal-hero { padding: 0; border: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-1); box-shadow: var(--elev-1); }
.meal-hero .hero-photo { position: relative; display: block; width: 100%; height: auto; aspect-ratio: 4/3; padding: 0; border-radius: 0; overflow: hidden; background: var(--surface-2); color: var(--photo-text); text-align: left; }
.meal-hero .hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.media-frame { position: relative; display: block; width: 100%; height: 100%; isolation: isolate; overflow: hidden; background: var(--surface-2); }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-frame[data-media-state=loading]::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, var(--surface-3) 48%, transparent 76%); background-size: 240% 100%; animation: media-loading 1.2s ease-in-out infinite; }
.media-frame[data-media-state=loading] img, .media-frame[data-media-state=error] img { visibility: hidden; }
.media-status { position: absolute; inset: 0; display: none; align-content: center; justify-items: center; gap: var(--s-2); color: var(--text-2); font-size: var(--caption); }
.media-frame[data-media-state=error] .media-status { display: grid; }
.meal-art .media-status span { display: none; }
@keyframes media-loading { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.hero-caption::before { content: ''; position: absolute; inset: -16px -56px -16px calc(-1 * var(--caption-inset)); z-index: -1; background: linear-gradient(transparent, var(--photo-caption-shade) 16px, var(--photo-shade)); pointer-events: none; }
.hero-day.pill { position: absolute; top: var(--s-3); right: var(--s-3); z-index: 2; max-width: calc(100% - 24px); background: var(--glass); color: var(--photo-text); box-shadow: 0 0 0 1px var(--glass-line) inset; backdrop-filter: blur(12px); }
.hero-caption { --caption-inset: var(--s-5); display: grid; gap: var(--s-2); position: absolute; isolation: isolate; z-index: 2; bottom: var(--s-4); left: var(--caption-inset); right: 56px; text-shadow: 0 1px 3px var(--scene-shadow); }
.hero-time { font-size: var(--label); font-weight: 500; }
.hero-title { font-size: var(--title); font-weight: 600; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: break-word; }
.hero-recipe { position: absolute; z-index: 2; right: var(--s-3); bottom: var(--s-4); width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-pill); background: var(--glass); color: var(--photo-text); box-shadow: 0 0 0 1px var(--glass-line) inset; }
.meal-hero .hero-actions { display: flex; flex-direction: row; flex-wrap: nowrap; gap: var(--s-2); padding: var(--s-3); margin: 0; width: 100%; }
.meal-hero .hero-actions .btn { min-height: 48px; font-size: var(--body-s); padding: var(--s-3); border-radius: var(--r-md); }
.meal-hero .hero-actions .btn:first-child { flex: 1; }
.meal-hero .portion-button { width: 48px; flex: none; }
.dayring { background: radial-gradient(ellipse at 12% 38%, var(--instrument-light), transparent 68%), var(--surface-1); }
.dayring .section-head { margin-bottom: var(--s-3); }
.dayring-body { display: grid; grid-template-columns: 144px minmax(0, 1fr); align-items: center; gap: var(--s-4); }
.ring { width: 144px; aspect-ratio: 1; position: relative; --ring-color: var(--energy); background: radial-gradient(circle, var(--instrument-light) 0, transparent 65%); }
.ring svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ring-track, .ring-value, .ring-overflow { fill: none; stroke-width: 10; stroke: var(--surface-2); }
.ring-value, .ring-overflow { stroke: var(--ring-color); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 72px 72px; }
.ring-overflow { stroke-width: 4; }
.ring-target { stroke: var(--text); stroke-width: 1; opacity: .6; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-1); }
.ring-center strong { font-size: 44px; line-height: 1.1; font-weight: 700; letter-spacing: -.04em; }
.ring-center strong.compact-number { font-size: 36px; letter-spacing: -.06em; }
.ring-center small { color: var(--text-2); font-size: var(--caption); }
.ring-center > svg { width: 28px; height: 28px; }
.day-macros { display: grid; gap: var(--s-5); min-width: 0; }
.macro-bar { --bar-color: var(--text-2); min-width: 0; }
.macro-protein { --bar-color: var(--protein); }
.macro-fat { --bar-color: var(--text-2); }
.macro-carbs { --bar-color: var(--text-3); }
.macro-bar > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--s-1); margin-bottom: var(--s-2); font-size: var(--label); line-height: 1.4; }
.macro-bar b { font-weight: 600; }
.macro-bar small { font-size: var(--caption); color: var(--text-2); font-weight: 400; }
.macro-track { height: 6px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.macro-track i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--bar-color); }
.ring-hint { color: var(--text-2); font-size: var(--label); margin-top: var(--s-3); }
.plan-caption { color: var(--text-2); font-size: var(--caption); line-height: 1.5; border-top: 1px solid var(--hairline-str); padding-top: var(--s-3); margin-top: var(--s-4); }
.meal-list { gap: 0; }
.meal-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 40px; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-radius: 0; border-bottom: 1px solid var(--hairline-str); background: transparent; }
.meal-row:last-child { border-bottom: 0; }
.meal-art { width: 56px; height: 56px; border-radius: var(--r-md); }
.meal-title { font-size: var(--body-s); overflow-wrap: break-word; }
.meal-title b { font-weight: 500; line-height: 1.4; }
.meal-title small, .meal-title span { font-size: var(--caption); line-height: 1.4; }
.meal-row.eaten { opacity: 1; }
.meal-row.eaten .meal-art img { filter: brightness(.6); }
.check-btn { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; background: var(--surface-2); border-radius: var(--r-pill); }
.check-btn.done { background: var(--surface-2); border: 0; color: var(--ok); }
.module-label { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-5) 0 var(--s-2); font-size: var(--label); }
.add-meal { width: 100%; border: 0; background: var(--surface-2); border-radius: var(--r-md); min-height: 48px; padding: var(--s-3); margin-top: var(--s-3); font-size: var(--label); }
.day-completeness { display: grid; gap: var(--s-1); margin-top: var(--s-4); }
.day-completeness .text-btn { justify-content: flex-start; }
.mini-icon { width: 40px; height: 40px; background: var(--surface-2); border-radius: var(--r-sm); }
.water-icon { color: var(--water); }
.sleep-icon { color: var(--sleep); }
.training-icon { color: var(--training); }
.water-body { display: grid; grid-template-columns: 104px minmax(0,1fr); gap: var(--s-5); align-items: center; }
.ring-water { width: 104px; --ring-color: var(--water); }
.ring-water .ring-center { color: var(--water); }
.water-number { margin: 0; font-family: var(--font); line-height: 1.1; font-size: var(--metric-xl); letter-spacing: -.03em; }
.water-number strong { font-weight: 700; }
.water-number span { font-size: 60%; font-weight: 500; color: var(--text-2); }
.water-reading > .help { margin-top: var(--s-1); }
.water-stepper { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); margin-top: var(--s-3); padding: var(--s-1); background: var(--surface-2); border-radius: var(--r-md); }
.water-stepper > span { font-size: var(--caption); white-space: nowrap; }
.step-button { display: grid; place-items: center; width: 36px; min-width: 36px; height: 40px; border-radius: var(--r-sm); padding: 0; }
.water-note { margin-top: var(--s-4); color: var(--text-2); font-size: var(--caption); line-height: 1.5; }
.sleep-card { background: var(--surface-1); color: var(--text); }
.sleep-card p { font-size: var(--body-s); }
.sleep-card p.help { font-size: var(--label); color: var(--text-2); }
.sleep-card .text-btn { color: var(--text); }
.sleep-time { font: 700 var(--metric-l)/1.2 var(--font); letter-spacing: -.03em; margin: var(--s-5) 0 var(--s-3); }
.activity-card { gap: var(--s-4); }
.activity-card .btn { font-size: var(--body-s); margin-top: 0; }
.overview { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-rows: 1fr; gap: var(--s-3); }
.overview > :first-child { grid-column: 1 / -1; }
.metric-card { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; padding: var(--s-5); border: 0; border-radius: var(--r-lg); background: var(--surface-1); box-shadow: var(--elev-1); }
.metric-card span { color: var(--text-2); font-size: var(--label); }
.metric-card strong { font: 700 var(--metric-l)/1.2 var(--font); overflow-wrap: break-word; letter-spacing: -.02em; }
.metric-word strong { font-size: 1.125rem; overflow-wrap: normal; }
.metric-card small { display: block; min-height: 2.7em; margin-top: auto; font-size: var(--caption); line-height: 1.35; color: var(--text-3); }
.toolbar { margin: 0; gap: var(--s-3); }
.search { min-width: 0; }
.filters, .chips { display: flex; flex-wrap: nowrap; gap: var(--s-2); max-width: 100%; overflow: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scroll-snap-type: x mandatory; scroll-padding-inline: var(--s-2); padding: var(--s-2); margin: var(--s-3) 0 var(--s-4); mask-image: linear-gradient(to right, transparent var(--rail-start, 0px), black calc(var(--rail-start, 0px) + 4px), black calc(var(--rail-end, 100%) - 4px), transparent var(--rail-end, 100%)); }
.filters:has(:focus-visible), .chips:has(:focus-visible) { mask-image: none; }
.filter { white-space: nowrap; flex: none; scroll-snap-align: start; min-height: 44px; border: 0; border-radius: var(--r-pill); padding: var(--s-3) var(--s-4); background: var(--surface-2); font-size: var(--label); }
.filter.active { background: var(--text); color: var(--bg); }
.segmented { display: flex; gap: var(--s-1); padding: var(--s-1); background: var(--surface-2); border-radius: var(--r-md); }
.segmented button { flex: 1; min-width: 0; min-height: 44px; padding: var(--s-2); border-radius: var(--r-sm); font-size: var(--label); }
.segmented .selected { background: var(--surface-1); box-shadow: var(--elev-1); font-weight: 600; }
.recipe-grid { grid-template-columns: 1fr; gap: var(--s-4); }
.recipe-card { border-radius: var(--r-lg); background: var(--surface-1); box-shadow: var(--elev-1); }
.recipe-card .recipe-image { height: auto; aspect-ratio: 16/9; flex: none; }
.recipe-body { padding: var(--s-5); gap: var(--s-3); }
.recipe-body h2 { font-size: var(--title); line-height: 1.3; }
.recipe-meta { font-size: var(--label); gap: var(--s-4); }
.recipe-card .fav { width: 36px; height: 36px; top: var(--s-3); right: var(--s-3); padding: 0; border-radius: var(--r-pill); color: var(--photo-text); background: var(--glass); box-shadow: 0 0 0 1px var(--glass-line) inset; backdrop-filter: blur(12px); }
.recipe-card .fav[aria-pressed=true] { color: var(--photo-text); }
.fav.active svg { fill: currentColor; }
.recipe-detail-photo { position: relative; width: 100%; aspect-ratio: 4/3; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.recipe-detail-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.macro-strip { gap: var(--s-2); }
.macro-strip span { background: var(--surface-2); border-radius: var(--r-sm); font-size: var(--label); padding: var(--s-2); }
.ingredient-list { gap: 0; }
.ingredient-list li { align-items: flex-start; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--hairline-str); }
.ingredient-list li > :last-child { white-space: nowrap; font-size: var(--label); }
.ingredient-list small { display: block; font-size: var(--caption); color: var(--text-2); }
.sheet-body .recipe-steps { list-style: none; counter-reset: recipe-step; padding: 0; display: grid; gap: var(--s-5); margin-block: 0; }
.recipe-steps > li { counter-increment: recipe-step; position: relative; padding-left: var(--s-8); font-size: var(--body-s); line-height: 1.5; }
.recipe-steps > li::before { content: counter(recipe-step); position: absolute; left: 0; top: 0; color: var(--text-3); font-size: var(--title); line-height: 1.1; font-weight: 600; }
.empty { padding: var(--s-6) var(--s-4); border: 0; background: var(--surface-2); border-radius: var(--r-md); color: var(--text-2); font-size: var(--body); line-height: 1.5; gap: var(--s-3); }
.empty svg { color: var(--text-3); }
.empty > p { font-size: var(--body); font-weight: 400; }
.empty .btn { margin-top: var(--s-1); background: var(--surface-1); color: var(--text); }
.card > .empty { background: transparent; padding: var(--s-4) 0; }
.chart-box { min-width: 0; overflow: visible; }
.chart { max-width: 100%; min-height: 140px; }
.chart .curve { stroke: var(--text); stroke-width: 2; }
.chart .gridline { stroke: var(--hairline-str); }
.chart circle { fill: var(--text); stroke: var(--surface-1); }
.chart text { fill: var(--text-3); font: 12px var(--font); }
.chart-frame { margin-top: var(--s-4); }
.chart-scale, .chart-dates { font-size: var(--caption); line-height: 1.35; color: var(--text-3); }
.chart-dates { display: flex; justify-content: space-between; gap: var(--s-3); }
.chart-frame .chart { display: block; height: 144px; min-height: 0; width: 100%; }
.chart-caption { font-size: var(--caption); margin-top: var(--s-3); }
.table-scroll { max-width: 100%; overflow: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: var(--label); }
.table-scroll td, .table-scroll th { padding: var(--s-3); text-align: left; border-bottom: 1px solid var(--hairline-str); min-width: 90px; }
.table-scroll td:first-child, .table-scroll th:first-child { position: sticky; left: 0; background: var(--surface-1); }
.advice { padding: var(--s-5); border: 0; border-radius: var(--r-md); background: var(--surface-2); margin-block: var(--s-4); gap: var(--s-3); }
.advice-heading { display: flex; align-items: center; gap: var(--s-3); }
.advice-heading h3 { font-size: var(--body); font-weight: 600; }
.status-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-2); }
.status-maintain { color: var(--ok); }
.status-review { color: var(--warn); }
.recommendation > p { font-size: var(--body-s); line-height: 1.5; }
.photo-grid { gap: var(--s-3); }
.photo-grid button { padding: 0; text-align: left; }
.photo-grid img { width: 100%; border-radius: var(--r-md); }
.photo-grid button > .media-frame { aspect-ratio: 3/4; height: auto; border-radius: var(--r-md); }
.photo-grid button > span:not(.media-frame) { font-size: var(--caption); display: block; margin-top: var(--s-2); }
.photo-grid .media-status { margin: 0; }
.weight-value, .expense-total { font: 700 var(--metric-xl)/1.1 var(--font); letter-spacing: -.03em; margin: var(--s-4) 0; }
.weight-value small { font-size: 60%; font-weight: 500; color: var(--text-2); }
.routine-hero { position: relative; padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface-1); box-shadow: var(--elev-1); overflow: hidden; }
.routine-hero h2 { font-size: var(--display); line-height: 1.15; }
.routine-hero p { font-size: var(--body-s); color: var(--text-2); margin-top: var(--s-3); }
.routine-stage { position: relative; margin: var(--s-4) calc(-1 * var(--s-5)) calc(-1 * var(--s-5)); padding: var(--s-2) var(--s-4) var(--s-4); background: radial-gradient(ellipse at 50% 56%, var(--surface-3), transparent 70%); }
.routine-stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 38%, var(--surface-1) 83%); }
.routine-hero img { width: 100%; height: 224px; object-fit: contain; }
.routine-summary { padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); }
.routine-steps ol { display: grid; gap: var(--s-6); counter-reset: prep; list-style: none; padding: 0; margin: var(--s-6) 0; }
.routine-steps li { position: relative; padding-left: var(--s-8); counter-increment: prep; }
.routine-steps li::before { content: counter(prep); position: absolute; top: 0; left: 0; color: var(--text-3); font-size: var(--title); font-weight: 700; line-height: 1.1; }
.routine-steps li p { margin-top: var(--s-2); font-size: var(--body-s); color: var(--text-2); }
.batch summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 44px; padding: 0; }
.batch summary::after { content: '⌄'; flex: none; color: var(--text-3); font-size: var(--title); }
.batch summary b { min-width: 0; font-size: var(--body-s); font-weight: 600; }
.batch summary span { font-size: var(--caption); color: var(--text-2); flex: none; margin-left: auto; }
.batch[open] summary { margin-bottom: var(--s-4); }
.shopping-row { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; padding: var(--s-4) 0; border-bottom: 1px solid var(--hairline-str); }
.shopping-row:first-child { padding-top: 0; }
.shopping-row:last-child { border-bottom: 0; padding-bottom: 0; }
.shopping-row > div { min-width: 0; }
.shopping-row b { font-weight: 500; font-size: var(--body-s); }
.shopping-row small { display: block; color: var(--text-2); font-size: var(--caption); margin-top: var(--s-1); }
.shopping-row p { font-size: var(--label); margin-top: var(--s-2); }
.shopping-row .text-btn { display: flex; flex-direction: column; flex: none; width: 64px; max-width: none; padding: var(--s-2) 0; font-size: var(--caption); white-space: normal; line-height: 1.35; border-radius: var(--r-sm); background: var(--surface-2); }
.guide-list { padding-top: 0; padding-bottom: 0; }
.guide-link { display: flex; align-items: center; width: 100%; gap: var(--s-3); padding: var(--s-5) 0; text-align: left; border-bottom: 1px solid var(--hairline-str); }
.guide-link:last-child { border-bottom: 0; }
.guide-link > span { display: grid; gap: var(--s-2); flex: 1; min-width: 0; }
.guide-link small { font-size: var(--caption); color: var(--text-2); }
.guide-link b { font-size: var(--body); line-height: 1.4; font-weight: 500; }
.guide-link > svg { color: var(--text-3); }
.guide-feature { display: grid; grid-template-columns: minmax(0,1fr) 80px; gap: var(--s-4); align-items: center; width: 100%; text-align: left; }
.guide-feature h2 { margin-top: var(--s-2); }
.guide-feature .object-icon { width: 80px; height: 80px; }
.medication-card h2 { margin: var(--s-2) 0; }
.medication-card .dose-state { font-weight: 600; margin-top: var(--s-5); }
.med-info { background: var(--surface-2); }
.med-info details { margin-top: var(--s-2); }
.med-info > .med-summary { font-size: var(--body-s); color: var(--text-2); line-height: 1.45; }
.med-info details p { margin-top: var(--s-3); font-size: var(--body-s); line-height: 1.5; }
.med-info summary { color: var(--text); font-size: var(--label); min-height: 44px; align-content: center; }
.list-button { min-width: 0; gap: var(--s-3); padding: var(--s-4) 0; }
.list-button .grow { min-width: 0; }
.list-button b { overflow-wrap: break-word; }
.list-button small { font-size: var(--caption); }
.plan-targets { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--s-4); margin-block: var(--s-5); }
.plan-targets strong { display: block; font-size: var(--metric-l); font-weight: 700; letter-spacing: -.03em; }
.plan-targets small { font-size: var(--label); color: var(--text-2); }
.health-note { background: var(--surface-2); padding: var(--s-4); border-radius: var(--r-md); }
.health-record { display: grid; gap: var(--s-2); }
.health-record + .health-record { border-top: 1px solid var(--hairline-str); padding-top: var(--s-5); }
.health-record small { color: var(--text-2); font-size: var(--caption); }
.tabbar { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); position: fixed; bottom: 0; left: 50%; right: auto; transform: translateX(-50%); width: 100%; max-width: 480px; padding: var(--s-1) var(--s-2) calc(var(--s-1) + env(safe-area-inset-bottom)); gap: 0; z-index: 20; background: color-mix(in srgb, var(--surface-1) 92%, transparent); backdrop-filter: blur(16px) saturate(1.4); border-top: 1px solid var(--hairline-str); }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; gap: 2px; width: auto; min-width: 0; height: 56px; min-height: 56px; padding: 2px 0; border: 0; border-radius: var(--r-sm); font: 500 11px/16px var(--font); color: var(--text-3); }
.tabbar button.active { color: var(--text); background: var(--surface-2); }
.tabbar button span { max-width: 100%; white-space: nowrap; }
.tabbar button svg, .tabbar button.active svg { width: 26px; height: 26px; padding: 0; margin: 3px 0; background: transparent; box-shadow: none; border-radius: 0; }
.tabbar .object-icon { width: 32px; height: 32px; object-fit: contain; }
.tabbar button:not(.active) .object-icon { opacity: .78; }
.object-icon { display: block; width: 32px; height: 32px; object-fit: contain; flex: none; }
.section-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--s-3); }
.section-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-3); padding: var(--s-3) var(--s-1); min-width: 0; min-height: 104px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--caption); }
.section-tile[aria-current=page] { box-shadow: 0 0 0 1px var(--text-2) inset; background: var(--surface-3); }
.section-tile .object-icon { width: 48px; height: 48px; }
.section-shortcuts { display: grid; gap: var(--s-2); }
.section-shortcuts button { justify-content: flex-start; text-align: left; }
.intro { display: grid; gap: var(--s-5); padding: var(--s-5) 0 var(--s-6); text-align: center; justify-items: center; }
.intro-symbol { width: 100%; height: 216px; display: grid; place-items: center; background: radial-gradient(ellipse at center, var(--surface-3), transparent 65%); }
.intro-symbol .object-icon { width: 172px; height: 172px; }
.intro > p:not(.help) { max-width: 290px; color: var(--text-2); }
.intro h1 { font-size: var(--display); }
.onboarding-question { font-size: var(--title); font-weight: 500; line-height: 1.35; }
.phase-options { padding: 0; margin: 0; border: 0; display: grid; gap: var(--s-3); }
.phase-options label { display: block; position: relative; }
.phase-options input { position: absolute; top: 50%; left: var(--s-5); width: 1px; height: 1px; opacity: 0; }
.phase-options label > span { display: flex; align-items: center; gap: var(--s-3); min-height: 64px; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); }
.phase-options b { flex: 1; font-size: var(--body-s); font-weight: 500; }
.phase-options span > svg:last-child { opacity: 0; }
.phase-options input:checked + span { background: var(--text); color: var(--bg); }
.phase-options input:checked + span > svg:last-child { opacity: 1; }
.phase-options input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.onboarding-name { color: var(--text-2); font-size: var(--label); }
dialog { width: calc(100% - 24px); max-width: 480px; max-height: 92dvh; margin: auto; padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface-1); color: var(--text); box-shadow: var(--elev-2); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(5px); }
dialog::before { content: ''; display: block; flex: none; width: 36px; height: 4px; border-radius: var(--r-pill); background: var(--hairline-str); margin: var(--s-2) auto 0; }
.sheet-head { flex: none; padding: var(--s-4) var(--s-5); gap: var(--s-3); }
.sheet-head h2 { min-width: 0; font-size: var(--title); line-height: 1.28; overflow-wrap: break-word; white-space: normal; }
.sheet-head .icon-btn { background: var(--surface-2); }
.sheet-body { min-height: 0; flex: 1 1 auto; max-height: calc(92dvh - 92px); padding: 0 var(--s-5) calc(var(--s-6) + env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; display: grid; gap: var(--s-5); grid-auto-rows: max-content; align-content: start; }
.sheet-body form { gap: var(--s-4); }
.sheet-body label { font-size: var(--label); }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { min-height: 48px; padding: var(--s-3) var(--s-4); border: 1px solid var(--hairline-str); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font-size: var(--body); }
.search input { padding-left: 48px; }
.check-label { display: flex; align-items: flex-start; gap: var(--s-3); }
.check-label input { flex: none; min-height: 20px; }
.sheet-body details label { margin-top: var(--s-3); }
.form-footer { position: sticky; bottom: calc(-1 * var(--s-6)); padding: var(--s-3) 0 var(--s-1); background: var(--surface-1); margin-top: var(--s-1); }
.form-error, :root[data-theme=dark] .form-error, .danger-btn { color: var(--error); }
.lesson h3 { margin-top: var(--s-6); }
.lesson p, .lesson li { font-size: var(--body-s); line-height: 1.6; }
.lesson a { overflow-wrap: anywhere; }
.source-links { margin-top: var(--s-6); }
.source-links a { display: block; font-size: var(--label); padding: var(--s-2) 0; }
.month-grid { gap: var(--s-1); }
.month-day { min-height: 64px; border-radius: var(--r-sm); padding: var(--s-2) var(--s-1); border: 0; background: var(--surface-2); align-items: center; }
.month-day strong { font-size: var(--body); }
.month-day small { font-size: var(--caption); }
.month-day.selected { background: var(--text); color: var(--bg); }
.month-controls { flex-wrap: wrap; gap: var(--s-3); }
.month-controls h2 { font-size: var(--title); }
.local-preview-note { background: var(--surface-2); color: var(--text-2); font-size: 12px; padding: var(--s-2) var(--s-4); }
#toast { left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); min-width: 0; width: max-content; max-width: calc(100vw - 32px); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); font-size: var(--label); line-height: 1.5; box-shadow: var(--elev-2); transition: opacity 160ms, transform 160ms; }
.pwa-update { width: min(440px,calc(100% - 32px)); border: 0; border-radius: var(--r-md); background: var(--surface-2); box-shadow: var(--elev-2); }

@media (max-width: 360px) {
  .shell { padding-inline: var(--s-4); }
  .appbar { margin-inline: calc(-1 * var(--s-4)); padding-inline: var(--s-4); }
  .card { padding: var(--s-4); }
  .dayring-body { grid-template-columns: 124px minmax(0,1fr); gap: var(--s-3); }
  .dayring .ring { width: 124px; }
  .dayring .ring-center strong { font-size: 38px; }
  .dayring .ring-center strong.compact-number { font-size: 28px; }
  .day-macros { gap: var(--s-3); }
  .water-body { grid-template-columns: 88px minmax(0,1fr); gap: var(--s-4); }
  .water-body .ring { width: 88px; }
  .water-number { font-size: 36px; }
  .hero-caption { --caption-inset: var(--s-4); }
  .hero-title { font-size: 1.25rem; }
  .meal-row { gap: var(--s-2); grid-template-columns: 48px minmax(0,1fr) 40px; }
  .meal-art { width: 48px; height: 56px; }
  .batch summary { flex-wrap: wrap; }
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .sheet-body, .sheet-head { padding-inline: var(--s-4); }
}

:root[data-large-text=true] .overview { grid-template-columns: 1fr; }
:root[data-large-text=true] .dayring-body { grid-template-columns: 1fr; justify-items: center; }
:root[data-large-text=true] .day-macros { width: 100%; }
:root[data-large-text=true] .ring-center small { font-size: 14px; }
:root[data-large-text=true] .day-chip { border-radius: var(--r-md); }
:root[data-large-text=true] .week { gap: var(--s-1); }
:root[data-large-text=true] .meal-hero .hero-photo { aspect-ratio: auto; max-height: none; overflow: visible; }
:root[data-large-text=true] .meal-hero .hero-photo > .media-frame { height: 220px; }
:root[data-large-text=true] .meal-hero .hero-photo img { height: 220px; }
:root[data-large-text=true] .hero-caption::before { display: none; }
:root[data-large-text=true] .hero-caption { position: static; color: var(--text); padding: var(--s-4); text-shadow: none; }
:root[data-large-text=true] .routine-hero h2 { font-size: var(--title); }
:root[data-large-text=true] .hero-recipe { top: 168px; bottom: auto; }
:root[data-large-text=true] .hero-title { font-size: var(--title); }
:root[data-large-text=true] .water-body { grid-template-columns: 1fr; }
:root[data-large-text=true] .water-body .ring { display: none; }
:root[data-large-text=true] .water-number { font-size: var(--metric-xl); }
:root[data-large-text=true] .meal-row { grid-template-columns: 40px minmax(0,1fr) 40px; }
:root[data-large-text=true] .meal-art { width: 40px; height: 48px; }
:root[data-large-text=true] .shopping-row { flex-wrap: wrap; align-items: flex-start; }
:root[data-large-text=true] .shopping-row .text-btn { width: auto; flex-direction: row; padding-inline: var(--s-3); }
:root[data-large-text=true] .batch summary { flex-wrap: wrap; }
:root[data-large-text=true] .section-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
:root[data-large-text=true] .tabbar button { min-width: 0; font-size: 11px; }
:root[data-large-text=true] .guide-feature { grid-template-columns: 1fr; }
:root[data-large-text=true] .guide-feature .object-icon { display: none; }
:root[data-large-text=true] .guide-feature h2 { font-size: var(--body); }
:root[data-large-text=true] .sheet-head h2 { font-size: 1rem; }
:root[data-input=keyboard] button { transition: none; }
:root[data-input=keyboard] dialog[open] { animation: none; }
:root[data-input=keyboard] .media-frame::after { animation: none; }
:root[data-input=keyboard] button:active:not(:disabled) { transform: none; }

@media (prefers-reduced-motion: reduce) {
  button, #toast, dialog[open] { transition: none; animation: none; }
  button:active:not(:disabled) { transform: none; }
  .media-frame[data-media-state=loading]::after { animation: none; }
}
