:root {
  --bg: #F2EFE7;
  --surface: #FBFAF6;
  --surface-2: #ECE8DD;
  --ink: #16150F;
  --ink-2: #3A3830;
  --muted: #7A766B;
  --line: #E2DDD0;
  --line-strong: #D3CDBE;
  --pro: #C0573E;
  --carb: #CF962A;
  --fat: #4D7884;
  --good: #3F6B4F;
  --on-ink: #F2EFE7;
  --radius: 22px;
  --radius-sm: 14px;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F0F0D; --surface: #181814; --surface-2: #22211C; --ink: #F2EFE7; --ink-2: #CFCBC0;
    --muted: #8E8A7F; --line: #2B2A24; --line-strong: #3A3830; --pro: #D9694F; --carb: #E2AC45;
    --fat: #6E9AA6; --good: #7FA88A; --on-ink: #0F0F0D; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F0F0D; --surface: #181814; --surface-2: #22211C; --ink: #F2EFE7; --ink-2: #CFCBC0;
  --muted: #8E8A7F; --line: #2B2A24; --line-strong: #3A3830; --pro: #D9694F; --carb: #E2AC45;
  --fat: #6E9AA6; --good: #7FA88A; --on-ink: #0F0F0D; color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45;
  font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Layout */
.app { min-height: 100dvh; }
.main { max-width: 600px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) 18px calc(env(safe-area-inset-bottom) + 120px); outline: none; }
.main > * { animation: rise .45s var(--ease) both; }
.main > *:nth-child(2) { animation-delay: .03s; } .main > *:nth-child(3) { animation-delay: .06s; }
.main > *:nth-child(4) { animation-delay: .09s; } .main > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.nav {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 20;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px; width: min(420px, calc(100% - 28px));
}
.brand { display: none; }
.nav-items { display: flex; align-items: center; justify-content: space-between; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 6px; border-radius: 999px; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; transition: color .2s; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--ink); }
.nav-btn.scan { flex: 0 0 auto; width: 54px; height: 54px; margin: 0 4px; padding: 0; justify-content: center; background: var(--ink); color: var(--on-ink); transition: transform .2s var(--ease); }
.nav-btn.scan:active { transform: scale(.94); }
.nav-btn.scan span { display: none; }

.wide-grid > * + *, .stack > * + * { margin-top: 12px; }

@media (min-width: 980px) {
  .wide-grid > * + *, .stack > * + *, .wide-grid .card + .card { margin-top: 0; }
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .nav { position: sticky; top: 0; left: auto; bottom: auto; transform: none; height: 100dvh; width: auto; border-radius: 0; border: 0; border-right: 1px solid var(--line); padding: 32px 18px; background: var(--bg); backdrop-filter: none; }
  .brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 30px; letter-spacing: -.01em; padding: 0 10px 34px; }
  .brand-mark { width: 28px; height: 28px; }
  .nav-items { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-btn { flex-direction: row; gap: 12px; padding: 11px 12px; font-size: 14.5px; border-radius: 12px; }
  .nav-btn:hover { color: var(--ink); background: var(--surface-2); }
  .nav-btn.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
  .nav-btn.scan { width: auto; height: auto; margin: 14px 0; padding: 13px 12px; border-radius: 12px; justify-content: flex-start; }
  .nav-btn.scan:hover { background: var(--ink-2); color: var(--on-ink); }
  .nav-btn.scan span { display: inline; }
  .main { max-width: 1040px; padding: 44px 48px 80px; margin: 0; }
  .wide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .wide-grid > .stack { display: grid; gap: 16px; }
}

/* Type */
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.display { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: 1; letter-spacing: -.015em; }
.display em, .h2 em { font-style: italic; }
.h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.05; letter-spacing: -.01em; }
.h3 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
p.lede { color: var(--ink-2); font-size: 15.5px; max-width: 56ch; }

/* Header */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.top .eyebrow { margin-bottom: 8px; }
.datenav { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: background .2s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 2px 12px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.ink { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.card.ink .muted { color: color-mix(in srgb, var(--on-ink) 60%, transparent); }
.stack-sm > * + * { margin-top: 10px; }

/* Hero ring */
.hero { display: grid; gap: 22px; padding: 24px 22px 22px; }
.ring-row { display: flex; align-items: center; gap: 22px; }
.ring { position: relative; width: 168px; height: 168px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: var(--ink); transition: stroke-dashoffset 1s var(--ease), stroke .3s; }
.ring.over .bar { stroke: var(--pro); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center .big { font-family: var(--serif); font-size: 50px; line-height: .9; letter-spacing: -.02em; }
.ring-center .lbl { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ring-stats { display: grid; gap: 14px; flex: 1; }
.ring-stats div { display: grid; gap: 2px; }
.ring-stats .v { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.ring-stats .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.macro .top-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 9px; }
.macro .name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.macro .name i { width: 7px; height: 7px; border-radius: 99px; background: var(--c); display: inline-block; }
.macro .amt { font-size: 12.5px; color: var(--muted); }
.macro .amt b { color: var(--ink); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.bar-track { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--c); border-radius: 99px; transition: width 1s var(--ease); }
.macro .left { font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.p { --c: var(--pro); } .c { --c: var(--carb); } .f { --c: var(--fat); }

/* Coach */
.coach { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.coach-mark { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; background: color-mix(in srgb, var(--on-ink) 12%, transparent); font-family: var(--serif); font-style: italic; font-size: 18px; }
.coach .eyebrow { color: color-mix(in srgb, var(--on-ink) 55%, transparent); margin-bottom: 4px; }
.coach p { font-size: 14.5px; line-height: 1.5; }
.coach .fit { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--on-ink) 8%, transparent); }
.coach .fit b { display: block; font-weight: 600; font-size: 14px; }
.coach .fit span { font-size: 12px; opacity: .65; }

/* Meal slots */
.slot { padding: 6px 0; }
.slot-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 10px; }
.slot-head .h3 { display: flex; align-items: baseline; gap: 10px; }
.slot-head .h3 span { font-weight: 500; color: var(--muted); font-size: 13px; }
.add-btn { width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); transition: background .2s, transform .2s var(--ease); }
.add-btn:hover { background: var(--line); }
.add-btn:active { transform: scale(.92); }
.add-btn svg { width: 16px; height: 16px; }
.entry { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 10px 18px; transition: background .15s; }
.entry:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.thumb { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-family: var(--serif); font-size: 20px; color: var(--ink-2); }
.thumb.p { background: color-mix(in srgb, var(--pro) 16%, var(--surface)); color: var(--pro); }
.thumb.c { background: color-mix(in srgb, var(--carb) 18%, var(--surface)); color: color-mix(in srgb, var(--carb) 80%, var(--ink)); }
.thumb.f { background: color-mix(in srgb, var(--fat) 16%, var(--surface)); color: var(--fat); }
.entry .meta { flex: 1; min-width: 0; }
.entry .name { font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.entry .kcal { font-size: 14px; font-weight: 600; text-align: right; }
.entry .kcal small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.slot-empty { padding: 0 18px 12px; font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 0 18px; }

/* Week */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; margin-top: 16px; }
.week .day { display: grid; grid-template-rows: 1fr auto; gap: 8px; height: 100%; text-align: center; }
.week .col { position: relative; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.week .col i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); border-radius: 8px; transition: height .8s var(--ease); }
.week .col i.over { background: var(--pro); }
.week .col .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed color-mix(in srgb, var(--ink) 35%, transparent); }
.week .day span { font-size: 11px; color: var(--muted); font-weight: 500; }
.week .day.sel span { color: var(--ink); font-weight: 700; }
.week-stats { display: flex; gap: 22px; }
.week-stats div { display: grid; }
.week-stats b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 600; font-size: 14.5px; letter-spacing: -.005em; background: var(--ink); color: var(--on-ink); transition: transform .15s var(--ease), opacity .2s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.ghost:hover { background: var(--line); }
.btn.line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn.light { background: var(--on-ink); color: var(--ink); }
.btn.danger { background: transparent; color: var(--pro); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pro) 40%, transparent); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.link { color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }

/* Chips & segmented */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 36px; padding: 0 15px; border-radius: 999px; font-size: 13.5px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); transition: all .2s; }
.chip:hover { border-color: var(--line-strong); }
.chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.seg { display: flex; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.seg button { flex: 1; height: 38px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: all .2s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px var(--line); }

/* Forms */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.input, .select, .textarea { width: 100%; height: 48px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); outline: none; transition: border-color .2s, box-shadow .2s; font-size: 15px; }
.textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%237A766B' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.unit-input { position: relative; }
.unit-input .input { padding-right: 34px; }
.unit-input em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }
.macro-input .input { border-left: 3px solid var(--c); }
.range { width: 100%; accent-color: var(--ink); }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 15, 13, .38); animation: fade .25s ease both; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 22px); animation: up .35s var(--ease) both; overscroll-behavior: contain; }
.sheet::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 9px; background: var(--line-strong); margin: 0 auto 16px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
@media (min-width: 640px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 26px; padding: 26px 26px 26px; }
  .sheet::before { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option { display: grid; gap: 10px; text-align: left; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); transition: border-color .2s, transform .15s var(--ease); }
.option:hover { border-color: var(--line-strong); }
.option:active { transform: scale(.98); }
.option svg { width: 22px; height: 22px; }
.option b { font-weight: 600; font-size: 14.5px; display: block; }
.option span { font-size: 12px; color: var(--muted); }

.list-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .meta { flex: 1; min-width: 0; }
.list-row .name { font-weight: 500; font-size: 14.5px; }
.list-row .sub { font-size: 12px; color: var(--muted); }
.list-row .right { font-weight: 600; font-size: 14px; text-align: right; }

.stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.stepper button { width: 44px; height: 44px; display: grid; place-items: center; }
.stepper button svg { width: 16px; height: 16px; }
.stepper .val { min-width: 56px; text-align: center; font-weight: 600; }

.summary { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 8px; padding: 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.summary div { display: grid; gap: 1px; }
.summary b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.summary span { font-size: 11px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 5px; }
.summary span i { width: 6px; height: 6px; border-radius: 9px; background: var(--c); }
.summary .kc b { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1; }

/* Scan */
.drop { position: relative; display: grid; place-items: center; text-align: center; gap: 14px; padding: 38px 22px; border-radius: var(--radius); border: 1.5px dashed var(--line-strong); background: var(--surface); transition: border-color .2s, background .2s; }
.drop.drag { border-color: var(--ink); background: var(--surface-2); }
.drop .plate-art { width: 92px; height: 92px; }
.drop .btn-row { width: 100%; max-width: 360px; }
.photo { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; background: rgba(15,15,13,.55); color: #fff; backdrop-filter: blur(8px); }
.photo .x svg { width: 16px; height: 16px; }
.photo.scanning::after { content: ''; position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(180deg, transparent, rgba(255,255,255,.28), transparent); animation: sweep 1.8s ease-in-out infinite; }
.photo.scanning img { filter: saturate(.8) brightness(.92); }
@keyframes sweep { to { top: 100%; } }
.scan-status { position: absolute; left: 12px; bottom: 12px; padding: 8px 14px; border-radius: 99px; background: rgba(15,15,13,.62); color: #fff; font-size: 13px; font-weight: 500; backdrop-filter: blur(8px); display: flex; align-items: center; gap: 8px; }
.dot-pulse { width: 7px; height: 7px; border-radius: 99px; background: #fff; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 9px; background: currentColor; }
.pill.high { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.pill.medium { color: color-mix(in srgb, var(--carb) 85%, var(--ink)); background: color-mix(in srgb, var(--carb) 15%, transparent); }
.pill.low { color: var(--pro); background: color-mix(in srgb, var(--pro) 13%, transparent); }
.item-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: center; }
.item-row:last-child { border-bottom: 0; }
.item-row .name { font-weight: 500; }
.item-row .sub { font-size: 12px; color: var(--muted); grid-column: 1; }
.item-row .ctrl { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 8px; }
.gram-input { width: 76px; height: 38px; text-align: right; padding: 0 26px 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; font-weight: 600; font-size: 14px; }
.gram-input:focus { border-color: var(--ink); }
.gram-wrap { position: relative; }
.gram-wrap em { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }
.mini-x { width: 30px; height: 30px; border-radius: 99px; display: grid; place-items: center; color: var(--muted); }
.mini-x:hover { background: var(--surface-2); color: var(--ink); }
.mini-x svg { width: 14px; height: 14px; }
.note { font-size: 13px; color: var(--ink-2); padding: 12px 14px; background: var(--bg); border-radius: 14px; border: 1px solid var(--line); }
.note b { font-weight: 600; }
.notice { display: grid; gap: 10px; }

/* Meals */
.meal-card { display: grid; gap: 12px; text-align: left; width: 100%; }
.meal-card .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.recipe .kc { flex: 0 0 auto; white-space: nowrap; }
.meal-card .kc, .recipe .kc { font-family: var(--serif); font-size: 28px; line-height: 1; }
.meal-card .kc small, .recipe .kc small { font-family: var(--sans); font-size: 12px; color: var(--muted); margin-left: 3px; }
.macro-line { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.macro-line b { color: var(--ink); font-weight: 600; }
.macro-line span { display: inline-flex; align-items: center; gap: 6px; }
.macro-line i { width: 6px; height: 6px; border-radius: 9px; background: var(--c); }
.split-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; gap: 2px; }
.split-bar i { background: var(--c); }
.meal-actions { display: flex; gap: 8px; }
.empty { text-align: center; padding: 44px 20px; display: grid; gap: 10px; justify-items: center; }
.empty .plate-art { width: 72px; height: 72px; margin-bottom: 6px; }
.ing-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ing-row .sub { font-size: 12px; color: var(--muted); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 40px; }
.results { margin-top: 6px; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 0 12px; }
.results:empty { display: none; }
.custom-ing { padding: 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); display: grid; gap: 10px; }

/* Guide */
.goal-hero { display: grid; gap: 16px; }
.goal-hero .rule { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
.goal-hero .rule b { font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1; font-weight: 400; }
.split-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.split-legend b { color: var(--ink); }
.split-legend span { display: inline-flex; gap: 6px; align-items: center; }
.split-legend i { width: 7px; height: 7px; border-radius: 9px; background: var(--c); }
.food-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.food-tile { padding: 12px 13px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); display: grid; gap: 4px; text-align: left; transition: border-color .2s; }
.food-tile:hover { border-color: var(--line-strong); }
.food-tile .name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.food-tile .m { font-size: 11.5px; color: var(--muted); }
.food-tile .metric { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.food-tile .metric b { font-size: 15px; }
.limit-list { display: grid; gap: 10px; }
.limit-list li { list-style: none; display: grid; grid-template-columns: 16px 1fr; gap: 10px; font-size: 14px; color: var(--ink-2); }
.limit-list li::before { content: ''; width: 10px; height: 1.5px; background: var(--pro); margin-top: 10px; }
.tips { counter-reset: tip; display: grid; gap: 14px; }
.tips li { list-style: none; counter-increment: tip; display: grid; grid-template-columns: 30px 1fr; gap: 8px; font-size: 14px; }
.tips li::before { content: counter(tip, decimal-leading-zero); font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.1; color: var(--muted); }
.recipe { display: grid; gap: 14px; }
.recipe .ings { display: grid; gap: 6px; }
.recipe .ings div { display: flex; justify-content: space-between; font-size: 13.5px; border-bottom: 1px dotted var(--line-strong); padding-bottom: 6px; }
.recipe .ings div span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.recipe .method { font-size: 13.5px; color: var(--ink-2); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 6px 10px; cursor: pointer; white-space: nowrap; user-select: none; }
.table th:first-child { text-align: left; padding-left: 0; }
.table th.on { color: var(--ink); }
.table td { text-align: right; padding: 11px 6px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table td:first-child { text-align: left; padding-left: 0; font-weight: 500; }
.table td:first-child small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.table tr { cursor: pointer; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }

/* Profile */
.kv { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.calc-result { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.calc-result div { padding: 12px 6px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.calc-result b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.calc-result span { font-size: 11px; color: var(--muted); font-weight: 500; }
.calc-result .kc { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.calc-result .kc span { color: color-mix(in srgb, var(--on-ink) 60%, transparent); }

/* Barcode */
.viewfinder { position: relative; border-radius: var(--radius); overflow: hidden; background: #0d0d0b; aspect-ratio: 3 / 4; max-height: 62dvh; width: 100%; }
@media (min-width: 640px) { .viewfinder { aspect-ratio: 4 / 3; } }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vf-frame { position: absolute; left: 50%; top: 46%; width: min(78%, 360px); aspect-ratio: 16 / 9; transform: translate(-50%, -50%); box-shadow: 0 0 0 100vmax rgba(10, 10, 8, .45); border-radius: 18px; }
.vf-frame i { position: absolute; width: 26px; height: 26px; border: 3px solid #fff; }
.vf-frame i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.vf-frame i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.vf-frame i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.vf-frame i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }
.vf-line { position: absolute; left: 8%; right: 8%; height: 2px; top: 50%; background: var(--pro); border-radius: 2px; animation: vfline 1.6s ease-in-out infinite alternate; }
@keyframes vfline { from { top: 18%; } to { top: 82%; } }
.vf-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #fff; font-size: 13.5px; font-weight: 500; }
.viewfinder .x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 99px; display: grid; place-items: center; background: rgba(15,15,13,.55); color: #fff; backdrop-filter: blur(8px); }
.viewfinder .x svg { width: 16px; height: 16px; }
.bc-manual { display: flex; gap: 8px; }
.bc-manual .input { flex: 1; min-width: 0; letter-spacing: .04em; }
.product-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.product-head img, .product-head .thumb { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: 0 0 auto; }
.product-head .h2 { font-size: 24px; }

/* Health score */
:root { --s-excellent: #1F8A4C; --s-good: #6AAE3A; --s-poor: #E2862C; --s-bad: #D2463C; }
:root[data-theme="dark"] { --s-excellent: #3DB36F; --s-good: #8CCB5C; --s-poor: #F0A04B; --s-bad: #E8675C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s-excellent: #3DB36F; --s-good: #8CCB5C; --s-poor: #F0A04B; --s-bad: #E8675C; } }
.s-excellent { --s: var(--s-excellent); } .s-good { --s: var(--s-good); } .s-poor { --s: var(--s-poor); } .s-bad { --s: var(--s-bad); }
.score-ring { position: relative; flex: 0 0 auto; display: grid; place-items: center; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring .trk { stroke: color-mix(in srgb, var(--s) 16%, transparent); }
.score-ring .arc { stroke: var(--s); }
.score-ring b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--s); }
.health-card { border-radius: var(--radius); padding: 18px; background: color-mix(in srgb, var(--s) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--s) 28%, var(--line)); }
.health-top { display: flex; align-items: center; gap: 16px; }
.health-top .h2 { color: var(--s); margin-top: 2px; }
.hbadges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.nutri, .nova { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.nutri b, .nova b { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 5px; color: #fff; font-size: 11px; }
.nutri.n-a b { background: #038141; } .nutri.n-b b { background: #85BB2F; } .nutri.n-c b { background: #E5A800; } .nutri.n-d b { background: #EE8100; } .nutri.n-e b { background: #E63E11; }
.nova.n1 b { background: #00AA00; } .nova.n2 b { background: #E5A800; } .nova.n3 b { background: #EE8100; } .nova.n4 b { background: #E63E11; }
.hparts { display: grid; gap: 8px; margin-top: 16px; }
.hpart { display: grid; grid-template-columns: 112px 1fr 48px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.hpart b { text-align: right; color: var(--ink); font-size: 13px; }
.hpart b small { color: var(--muted); font-weight: 500; }
.hpart-bar { height: 5px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.hpart-bar i { display: block; height: 100%; border-radius: 9px; background: var(--s); }
.health-details .hgroup { padding-top: 6px; }
.health-details .hgroup + .hgroup { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.hrow { display: flex; gap: 12px; padding: 10px 0; }
.hrow + .hrow { border-top: 1px dashed var(--line); }
.hrow .meta { flex: 1; min-width: 0; }
.hrow b { font-size: 14px; font-weight: 600; }
.hico { width: 10px; height: 10px; border-radius: 99px; margin-top: 5px; flex: 0 0 auto; }
.t-good .hico { background: var(--s-excellent); } .t-warn .hico { background: var(--s-poor); } .t-bad .hico { background: var(--s-bad); }
.hmeter { position: relative; height: 5px; margin-top: 8px; border-radius: 9px; overflow: hidden; }
.hmeter span { position: absolute; top: 0; bottom: 0; }
.hmeter span:nth-child(1) { background: color-mix(in srgb, var(--s-excellent) 55%, transparent); }
.hmeter span:nth-child(2) { background: color-mix(in srgb, var(--s-poor) 55%, transparent); }
.hmeter span:nth-child(3) { background: color-mix(in srgb, var(--s-bad) 55%, transparent); }
.hmeter.inv span:nth-child(1) { background: color-mix(in srgb, var(--s-poor) 45%, transparent); }
.hmeter.inv span:nth-child(2), .hmeter.inv span:nth-child(3) { background: color-mix(in srgb, var(--s-excellent) 55%, transparent); }
.hmeter i { position: absolute; top: -1px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.additive { border-top: 1px dashed var(--line); padding: 10px 0; }
.hgroup .additive:first-of-type { border-top: 0; }
.additive summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-size: 14px; }
.additive summary::-webkit-details-marker { display: none; }
.additive summary .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.additive p { margin: 6px 0 0 20px; }
.rdot { width: 10px; height: 10px; border-radius: 99px; flex: 0 0 auto; background: var(--line-strong); }
.r-high .rdot { background: var(--s-bad); } .r-moderate .rdot { background: var(--s-poor); } .r-limited .rdot { background: #E5C100; } .r-none .rdot { background: var(--s-excellent); }
.rlabel { color: var(--muted); white-space: nowrap; }
.r-high .rlabel { color: var(--s-bad); font-weight: 600; } .r-moderate .rlabel { color: var(--s-poor); font-weight: 600; }
details.ingr summary { cursor: pointer; }
.sdot { display: inline-grid; place-items: center; min-width: 24px; height: 17px; padding: 0 5px; margin-right: 6px; border-radius: 99px; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--s); vertical-align: 1px; }

/* Account */
.gbtn { background: #fff; color: #1f1f1f; box-shadow: inset 0 0 0 1px #dadce0; font-weight: 600; }
.gbtn:hover { background: #f8f9fa; }
.gbtn.block { width: 100%; }
.acct { display: flex; align-items: center; gap: 14px; }
.acct img, .acct .thumb { width: 48px; height: 48px; border-radius: 99px; object-fit: cover; flex: 0 0 auto; }
.acct .meta { min-width: 0; }
.acct .meta p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-between.wrap { flex-wrap: wrap; }
.row-between.wrap > div { flex: 1 1 240px; }

/* History */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-grid .card { margin: 0; }
.stat { display: grid; gap: 4px; padding: 16px 18px; }
.stat b { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.hist-chart { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 170px; margin-top: 18px; }
.hist-chart.dense { gap: 1.5px; }
.hist-chart .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed color-mix(in srgb, var(--ink) 30%, transparent); pointer-events: none; }
.hist-chart .goal span { position: absolute; right: 0; top: -18px; font-size: 10.5px; color: var(--muted); background: var(--surface); padding-left: 4px; }
.hbar { flex: 1; height: 100%; display: flex; align-items: flex-end; padding: 0; min-width: 0; border-radius: 4px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.hbar:hover { background: var(--surface-2); }
.hbar i { display: block; width: 100%; background: var(--ink); border-radius: 4px; transition: height .8s var(--ease); }
.hbar i.over { background: var(--pro); }
.dense .hbar, .dense .hbar i { border-radius: 2px; }
.hist-month { padding: 18px 18px 6px; }
.day-row { display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; padding: 14px 18px; border-top: 1px solid var(--line); transition: background .15s; }
.hist-month + .day-row { border-top: 0; }
.day-row:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.day-row .meta { flex: 1; min-width: 0; }
.day-row .sub { font-size: 12px; color: var(--muted); }
.day-date { width: 40px; flex: 0 0 auto; display: grid; justify-items: center; }
.day-date b { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1; }
.day-date span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; background: var(--ink); color: var(--on-ink); padding: 12px 18px; border-radius: 99px; font-size: 14px; font-weight: 500; transition: all .35s var(--ease); white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 980px) { .toast { bottom: 32px; left: calc(50% + 124px); } }

.spin { width: 18px; height: 18px; border-radius: 99px; border: 2px solid currentColor; border-right-color: transparent; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

@media (max-width: 420px) {
  .display { font-size: 36px; }
  .ring { width: 148px; height: 148px; }
  .ring-center .big { font-size: 42px; }
  .ring-row { gap: 18px; }
  .macros { gap: 10px; }
  .summary { grid-template-columns: 1.2fr 1fr 1fr 1fr; padding: 12px; }
  .summary b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
