:root {
  color-scheme: light;
  font-family: "Instrument Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #202c23;
  background: #f7f7ef;
  --surface: #fffefa;
  --line: #e3e7db;
  --muted: #526257;
  --green: #234b3b;
  --soft: #e7eee4;
  --lime: #dff099;
  --warn: #775122;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled { opacity: .48; cursor: default; }
a { color: var(--green); text-underline-offset: .16em; }
:focus-visible { outline: 3px solid #6a8d45; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 4vw, 2.35rem); line-height: 1.15; letter-spacing: -.045em; }
h2 { font-size: 1.08rem; }
small, .small { font-size: .85rem; line-height: 1.55; }
.muted { color: var(--muted); line-height: 1.65; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.shell { max-width: 1070px; margin: auto; padding: 0 30px 110px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 82px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong { display: block; font-size: 1.1rem; }
.brand small { color: var(--muted); }
.mark { width: 43px; height: 43px; border-radius: 14px; background: var(--green); color: var(--lime); display: grid; place-items: center; font-weight: 750; font-size: 1.17rem; }
.profile-switch select { min-height: 42px; padding: 0 11px; border-radius: 24px; border: 1px solid #d7ded2; background: var(--surface); color: var(--green); font-weight: 700; }
.heading { min-height: 90px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.date-picker { display: flex; align-items: center; gap: 2px; border-radius: 14px; border: 1px solid var(--line); padding: 1px 3px; background: var(--surface); }
.date-picker input { background: transparent; color: inherit; border: 0; padding: 0 3px; width: 124px; min-width: 0; min-height: 38px; font-size: .86rem; }
.icon-btn { border: 0; background: transparent; color: var(--green); border-radius: 10px; width: 38px; height: 40px; font-size: 1.4rem; padding: 0; line-height: 1; }
.icon-btn:hover { background: var(--soft); }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .95fr); gap: 16px; align-items: start; }
.column { display: grid; gap: 14px; min-width: 0; }
.card { padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.card-title small { color: var(--muted); }
.hero { color: #fffefa; padding: 21px; border-radius: 22px; background: var(--green); }
.hero-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.hero-top p { color: #dbe5db; font-size: .83rem; line-height: 1.5; margin-top: 5px; }
.hero-btn { flex: 0 0 auto; color: inherit; background: #ffffff12; border: 1px solid #ffffff60; border-radius: 10px; padding: 7px 10px; min-height: 40px; font-size: .82rem; font-weight: 650; }
.hero-btn:hover { background: #ffffff25; }
.energy-number { display: flex; gap: 8px; align-items: baseline; margin: 17px 0 12px; }
.energy-number strong { font-size: clamp(2.8rem, 9vw, 4.2rem); line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.energy-number span { color: #dbe5db; font-size: .9rem; }
.energy-track { height: 8px; border-radius: 20px; background: #ffffff35; overflow: hidden; }
.energy-track span { display: block; width: 0; height: 100%; border-radius: 20px; background: var(--lime); transition: width .2s ease; }
.energy-foot { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 16px; }
.energy-foot > div { display: grid; gap: 3px; }
.energy-foot > div + div { border-left: 1px solid #ffffff3b; padding-left: 11px; }
.energy-foot small { color: #dbe5db; }
.energy-foot strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.energy-foot > div:last-child strong { color: var(--lime); }
.macros table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 6px; }
.macros th, .macros td { text-align: right; padding: 10px 3px; border-bottom: 1px solid var(--line); font-size: .86rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.macros th:first-child { text-align: left; width: 27%; }
.macros thead th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.macros tbody tr:last-child > * { border-bottom: 0; }
.nutrient-shortcuts { margin-top: 7px; }
.nutrient-shortcuts .button { flex: 1 1 130px; }
.macro-over { color: #87381d; }
.count { color: var(--muted); background: var(--soft); padding: 2px 6px; margin-left: 3px; border-radius: 20px; font-size: .75rem; vertical-align: 1px; }
.button { border: 1px solid transparent; border-radius: 12px; min-height: 44px; padding: 9px 14px; font-weight: 680; line-height: 1.3; }
.button.primary { color: #fffefa; background: var(--green); }
.button.primary:hover { background: #173d2e; }
.button.secondary { color: var(--green); background: var(--soft); border-color: #dce6d9; }
.button.secondary:hover { background: #dce8d9; }
.button.compact { padding-inline: 11px; font-size: .88rem; }
.empty { min-height: 116px; border: 1px dashed #d9e1d3; display: grid; align-content: center; justify-items: center; gap: 4px; text-align: center; color: var(--muted); padding: 16px 8px; border-radius: 13px; line-height: 1.55; }
.empty strong { color: var(--green); font-size: .95rem; }
.list-row, .result-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child, .result-line:last-of-type { border-bottom: 0; }
.list-main { min-width: 0; display: grid; gap: 3px; overflow-wrap: anywhere; }
.list-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 3px; }
.list-actions strong { margin-right: 3px; font-size: .89rem; text-align: right; }
.link-btn { color: var(--green); background: transparent; padding: 5px 7px; border: 0; min-height: 40px; border-radius: 8px; font-size: .83rem; }
.link-btn:hover { background: var(--soft); }
.food-shortcuts, .saved-foods, .actions { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { min-height: 38px; max-width: 100%; overflow-wrap: anywhere; border: 1px solid #dbe5d8; background: var(--soft); color: var(--green); border-radius: 18px; padding: 5px 10px; font-size: .82rem; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid #ead9b5; border-radius: 14px; background: #fbf1da; color: #603f1b; font-size: .9rem; }
.notice strong, .notice small { display: block; }
.notice button { color: #5b3e1b; background: #f5e7c5; border-color: #e9d5ae; flex: 0 0 auto; }
.form-grid { display: grid; gap: 12px; }
.form-row { display: flex; align-items: end; gap: 9px; }
.form-row .button { flex: 0 0 auto; font-size: .85rem; }
.grow { flex: 1 1 0; }
.field { display: grid; gap: 5px; color: #34463a; font-size: .85rem; font-weight: 650; min-width: 0; }
.field input, .field select { min-height: 44px; max-width: 100%; width: 100%; border: 1px solid #d5dfd3; border-radius: 10px; color: #202c23; background: #fff; padding: 8px 9px; font-size: 1rem; font-weight: 450; }
.field input[type=date] { min-width: 0; }
.field input::placeholder { color: #65716a; opacity: 1; }
.macro-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.batch-results { gap: 0; }
.batch-results .result-line { min-height: 57px; }
.batch-results p { margin-top: 9px; }
.result-line strong { color: var(--green); overflow-wrap: anywhere; }
.source-notes { color: var(--muted); font-size: .85rem; margin-top: 20px; line-height: 1.65; }
.source-notes p { margin-top: 5px; }
.nav { display: flex; position: fixed; z-index: 2; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(410px, calc(100% - 24px)); padding: 5px; background: #fffefaf7; border: 1px solid #dce4d9; border-radius: 19px; box-shadow: 0 8px 28px #253c2b18; }
.nav button { flex: 1; min-height: 48px; display: grid; place-content: center; gap: 1px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-size: .8rem; }
.nav button span { line-height: 1.1; font-size: 1.15rem; }
.nav button[aria-current] { color: var(--green); background: var(--soft); font-weight: 700; }
dialog { width: min(520px, calc(100% - 22px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0 18px 18px; border: 1px solid var(--line); background: var(--surface); border-radius: 19px; color: inherit; box-shadow: 0 16px 56px #12201834; }
dialog::backdrop { background: #15251bc2; }
.dialog-heading { position: sticky; top: 0; background: var(--surface); z-index: 1; display: flex; justify-content: space-between; align-items: center; min-height: 60px; gap: 10px; }
.close { font-size: 1.5rem; }
.tabs { display: flex; border: 1px solid var(--line); border-radius: 11px; padding: 3px; background: #f5f7f1; margin-bottom: 12px; }
.tabs button { min-height: 38px; flex: 1; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.tabs button[aria-pressed=true] { background: var(--green); color: #fff; font-weight: 650; }
.food-options { max-height: 166px; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 3px; }
.food-options.nutrient-options { max-height: 260px; }
.food-option { text-align: left; min-height: 48px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line); color: var(--green); background: #fff; overflow-wrap: anywhere; }
.food-option small { display: block; color: var(--muted); font-size: .75rem; }
.food-option[aria-pressed=true] { border-color: #6b8666; background: var(--soft); }
.checkbox { display: flex; align-items: center; gap: 6px; min-height: 36px; font-size: .87rem; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--green); }
.error { color: #8e3021; }
.toast { z-index: 3; position: fixed; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 68px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 9px 13px; border-radius: 12px; background: #203d30; color: white; font-size: .88rem; box-shadow: 0 4px 15px #0002; }
@media (max-width: 700px) {
  .shell { padding-inline: 14px; }
  .topbar { min-height: 65px; }
  .heading { min-height: 71px; }
  .dashboard { grid-template-columns: 1fr; gap: 12px; }
  .column { gap: 12px; }
  .hero { padding: 16px 17px; }
  .card { padding: 14px 15px; }
  .energy-number { margin: 14px 0 11px; }
  .energy-foot { margin-top: 12px; }
  .macros th, .macros td { padding-block: 8px; }
}
@media (max-width: 370px) {
  .shell { padding-inline: 10px; }
  .date-picker input { width: 109px; font-size: .8rem; }
  .date-picker .icon-btn { width: 31px; }
  .list-actions { gap: 0; }
  .link-btn { padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
