/* Layout: recovery logbook — one calm column; day header, four nutrient gauges,
   time-ordered feed; primary actions sit in thumb reach above the tab bar. */
:root {
  --bg: #F4F6F2;
  --surface: #FFFFFF;
  --surface-2: #EBEFE8;
  --ink: #18211D;
  --muted: #5C6963;
  --line: #DCE2D9;
  --accent: #1E6B57;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEEE6;
  --kcal: #B9581A;
  --protein: #74479B;
  --water: #2867A8;
  --fluid: #1F7E80;
  --warn: #9A6400;
  --warn-soft: #FBF0D9;
  --bad: #B42318;
  --bad-soft: #FCE8E6;
  --ok: #2D7A3E;
  --shadow: 0 1px 2px rgba(24, 33, 29, .06), 0 4px 16px rgba(24, 33, 29, .06);

  --f-display: "Anuphan", "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Thai", "Noto Sans Thai", "Sukhumvit Set", system-ui, sans-serif;

  --r-s: 10px;
  --r-m: 16px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513; --surface: #182019; --surface-2: #212B25; --ink: #E7EEE9; --muted: #9AA9A1; --line: #2B3730;
    --accent: #63C3A5; --accent-ink: #0D201A; --accent-soft: #1D3A31;
    --kcal: #F09A5E; --protein: #BE98E2; --water: #78B0EA; --fluid: #5FC6C4;
    --warn: #E8B54F; --warn-soft: #3A2E15; --bad: #F2847A; --bad-soft: #3E1D1A; --ok: #7CCB8D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101513; --surface: #182019; --surface-2: #212B25; --ink: #E7EEE9; --muted: #9AA9A1; --line: #2B3730;
  --accent: #63C3A5; --accent-ink: #0D201A; --accent-soft: #1D3A31;
  --kcal: #F09A5E; --protein: #BE98E2; --water: #78B0EA; --fluid: #5FC6C4;
  --warn: #E8B54F; --warn-soft: #3A2E15; --bad: #F2847A; --bad-soft: #3E1D1A; --ok: #7CCB8D;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.25; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.boot { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }

/* ---------- shell ---------- */
.shell { max-width: 560px; margin: 0 auto; min-height: 100%; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: calc(env(safe-area-inset-top, 0px) + 12px) calc(var(--tab-h) + var(--safe-b) + 96px); }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-s); font-size: 14px; margin-bottom: 12px; }
.banner.demo { background: var(--accent-soft); color: var(--ink); }
.banner.warn { background: var(--warn-soft); color: var(--ink); }
.banner.bad { background: var(--bad-soft); color: var(--ink); }
.banner .grow { flex: 1; min-width: 0; }
.banner button { flex: none; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tab-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: 12px; font-weight: 500; min-height: 44px; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); }

/* ---------- day header ---------- */
.dayhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.dayhead .eyebrow { font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.dayhead h1 { font-size: 26px; font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.daynav { display: flex; gap: 6px; flex: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; padding: 0; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn:disabled { opacity: .35; cursor: default; }
.datepick { position: relative; overflow: hidden; }
.datepick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- gauges ---------- */
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.gauge { background: var(--surface); border-radius: var(--r-m); padding: 12px 14px 14px; box-shadow: var(--shadow); min-width: 0; }
.gauge .lbl { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.gauge .lbl b { font-weight: 600; color: var(--c); }
.gauge .val { font-family: var(--f-display); font-size: 30px; font-weight: 700; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.gauge .val small { font-family: var(--f-body); font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.gauge .bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.gauge .sub { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 18px; }
.gauge .sub .warnword { color: var(--warn); font-weight: 600; }
.g-kcal { --c: var(--kcal); } .g-protein { --c: var(--protein); } .g-water { --c: var(--water); } .g-fluid { --c: var(--fluid); }

/* ---------- quick actions ---------- */
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 20px 0 8px; }
.section-title h2 { font-size: 17px; font-weight: 600; }
.section-title .meta { font-size: 13px; color: var(--muted); }
.water-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ink); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: transparent; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.water { color: var(--water); padding: 0 6px; }
.btn.water small { font-weight: 500; color: var(--muted); }
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.favs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.favs::-webkit-scrollbar { display: none; }
.fav { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 12px; min-height: 52px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); text-align: left; max-width: 220px; }
.fav b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 196px; }
.fav span { font-size: 12px; color: var(--muted); }

.fab-row { position: fixed; z-index: 19; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); display: flex; justify-content: center;
  gap: 10px; pointer-events: none; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.fab-row > * { pointer-events: auto; }
.fab { min-height: 56px; padding: 0 24px; border-radius: 999px; font-size: 17px; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.fab-cam { min-height: 56px; padding: 0 18px; border-radius: 999px; font-size: 16px; background: var(--surface); color: var(--accent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.fab-cam svg { width: 22px; height: 22px; }

/* ---------- photo ---------- */
.photo-wrap { border-radius: var(--r-m); overflow: hidden; background: var(--surface-2); margin-bottom: 12px; max-height: 34vh; display: grid; place-items: center; }
.photo-prev { display: block; width: 100%; max-height: 34vh; object-fit: contain; }
.analyzing { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 10px; }
.analyzing b { display: block; font-family: var(--f-display); font-size: 17px; }
.analyzing span { font-size: 13px; color: var(--muted); }
.spin { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 12px); display: flex; gap: 10px; align-items: center;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 15px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.busy .spin { width: 18px; height: 18px; border-width: 2.5px; border-color: color-mix(in srgb, var(--bg) 30%, transparent); border-top-color: var(--bg); }
.ph-item { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.ph-item.off { opacity: .55; }
.ph-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ph-top .chip { flex: none; font-size: 12px; }
.ph-name { min-height: 40px !important; padding: 6px 10px !important; font-weight: 600; flex: 1; min-width: 0; }
.qty-unit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 4px; }
.ph-item .grid3 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
.qty-unit input, .qty-unit select { min-height: 44px !important; padding: 6px 8px !important; font-size: 15px !important; }
.ph-item .field input { min-height: 44px; padding: 6px 10px; }
.ph-item .field > span { font-size: 12px; }
.ph-eaten { margin: 0; font-size: 13px; color: var(--accent); font-weight: 500; }

/* ---------- consent / onboarding ---------- */
.onboard { max-width: 480px; }
.consent-item { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.consent-item b { font-family: var(--f-display); font-size: 15px; }
.consent-item span { color: var(--muted); }
.check a { color: var(--accent); }

/* ---------- feed ---------- */
.feed { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); overflow: hidden; }
.item { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line);
  width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; min-height: 56px; }
.item:first-child { border-top: 0; }
.item .t { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .n { min-width: 0; }
.item .n b { display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.item .n span { font-size: 13px; color: var(--muted); }
.item .v { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .v .k { color: var(--kcal); font-weight: 600; }
.item .v .p { color: var(--protein); display: block; font-size: 13px; }
.item .v .w { color: var(--water); font-weight: 600; }
.item.symptom { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.item.symptom .n b { color: var(--warn); }
.item.weight .n b { color: var(--ink); }
.item.pending { background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }
.item.deleted .n b { text-decoration: line-through; color: var(--muted); }
.unknown { color: var(--warn); font-weight: 600; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-family: var(--f-display); font-size: 17px; margin-bottom: 4px; }

/* ---------- sheet ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(10, 16, 13, .45); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 560px; max-height: calc(100% - env(safe-area-inset-top, 0px) - 12px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 22px 22px 0 0; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: 8px calc(var(--safe-b) + 20px); animation: rise .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; position: sticky; top: -8px;
  background: var(--bg); padding: 8px 0; z-index: 2; }
.sheet-head h2 { font-size: 20px; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 14px; font-weight: 500; color: var(--muted); }
.field > span em { font-style: normal; color: var(--bad); }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; }
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field .hint { font-size: 12px; color: var(--muted); }
.field.invalid input { border-color: var(--bad); }
.field .err { font-size: 13px; color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stepper { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.stepper button { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 600; }
.stepper input { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.results { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); overflow: hidden; max-height: 46vh; overflow-y: auto; }
.result { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; min-height: 56px;
  border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.result:first-child { border-top: 0; }
.result b { font-weight: 600; display: block; }
.result span { font-size: 13px; color: var(--muted); }
.result .star { color: var(--kcal); }
.selected-food { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-m);
  background: var(--accent-soft); }
.selected-food b { display: block; }
.selected-food span { font-size: 13px; color: var(--muted); }
.preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--shadow); }
.preview div { text-align: center; min-width: 0; }
.preview b { display: block; font-family: var(--f-display); font-size: 22px; font-variant-numeric: tabular-nums; }
.preview span { font-size: 12px; color: var(--muted); }
.preview .k b { color: var(--kcal); } .preview .p b { color: var(--protein); } .preview .f b { color: var(--fluid); }
.savebar { display: flex; flex-direction: column; gap: 8px; position: sticky; bottom: calc(-20px - var(--safe-b)); background: var(--bg);
  padding: 10px 0 calc(var(--safe-b) + 4px); margin-top: 6px; }
.savebar .row { display: flex; gap: 8px; }
.savebar .row .btn.primary { flex: 1; }
.status { font-size: 14px; min-height: 20px; }
.status.saving { color: var(--muted); } .status.failed { color: var(--bad); } .status.saved { color: var(--ok); }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 15px; }
.check input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.check > span { min-width: 0; line-height: 1.5; }
.range { width: 100%; accent-color: var(--warn); height: 32px; }
.sevscale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.care { padding: 12px 14px; border-radius: var(--r-s); background: var(--bad-soft); font-size: 14px; }
.care b { color: var(--bad); }

/* ---------- toast ---------- */
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 84px);
  background: var(--ink); color: var(--bg); padding: 10px 14px 10px 16px; border-radius: 14px; display: flex; gap: 12px; align-items: center;
  font-size: 15px; max-width: calc(100% - 32px); box-shadow: var(--shadow); animation: rise .2s ease-out; }
.toast button { background: none; border: 0; color: var(--accent-soft); font-weight: 700; min-height: 36px; padding: 0 6px; }

/* ---------- cards / settings ---------- */
.card { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 14px; }
.card + .card { margin-top: 10px; }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.card p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .n { min-width: 0; }
.list-row .n b { display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.list-row .n span { font-size: 13px; color: var(--muted); }
.list-row .acts { display: flex; gap: 6px; flex: none; }
.disclaimer { font-size: 13px; color: var(--muted); margin-top: 18px; line-height: 1.6; }
.table-wrap { overflow-x: auto; }
table.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mini th, table.mini td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.mini td.r, table.mini th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- history strip ---------- */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.strip button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 60px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--muted); }
.strip button b { font-family: var(--f-display); font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.strip button i { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.strip button i.has { background: var(--accent); }
.strip button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.strip button[aria-pressed="true"] b { color: var(--accent-ink); }
.strip button[aria-pressed="true"] i.has { background: var(--accent-ink); }
.totals-line { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin-bottom: 10px; }
.totals-line span b { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; padding: 0 14px 12px 76px; flex-wrap: wrap; }

/* ---------- charts ---------- */
.chart { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 14px 14px 8px; }
.chart + .chart { margin-top: 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.chart-head h3 { font-size: 16px; font-weight: 600; }
.chart-head .big { font-family: var(--f-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c); }
.chart-head .big small { font-family: var(--f-body); font-size: 13px; color: var(--muted); font-weight: 500; }
.chart .note { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg text { fill: var(--muted); font-family: var(--f-body); font-size: 11px; }
.chart svg .grid { stroke: var(--line); stroke-width: 1; }
.chart svg .target { stroke: var(--muted); stroke-dasharray: 4 4; stroke-width: 1.2; }
.chart svg .barfill { fill: var(--c); }
.chart svg .barfill.partial { fill: color-mix(in srgb, var(--c) 45%, transparent); }
.chart svg .lineplot { fill: none; stroke: var(--c); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart svg .area { fill: color-mix(in srgb, var(--c) 14%, transparent); }
.chart svg .dot { fill: var(--surface); stroke: var(--c); stroke-width: 2; }
.chart svg .dot.last { fill: var(--c); }
.chart svg .miss { fill: var(--surface-2); }
.c-kcal { --c: var(--kcal); } .c-protein { --c: var(--protein); } .c-water { --c: var(--water); } .c-weight { --c: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: calc(env(safe-area-inset-top, 0px) + 48px) 48px; }
.auth .mark { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 18px; }
.auth h1 { font-size: 30px; font-weight: 700; margin-bottom: 6px; }
.auth p { color: var(--muted); margin: 0 0 22px; }
.otp { letter-spacing: .4em; text-align: center; font-size: 24px !important; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (min-width: 520px) {
  .gauge .val { font-size: 34px; }
}
@media (max-width: 360px) {
  .gauge .val { font-size: 25px; }
  .water-row { gap: 6px; }
  .item { grid-template-columns: 44px 1fr auto; }
}
