:root {
  --bg: #f2f1ec;
  --card: #ffffff;
  --ink: #1d1c1a;
  --ink-2: #6b6862;
  --ink-3: #716d66;
  --line: #e6e4dd;
  --fill: #eceae4;
  --accent: #1f7a4d;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1e9;
  --over: #d8572a;
  --warn: #8a5200;
  --warn-soft: #fbefd9;
  --danger: #c8372d;
  --p: #3b6fe0;
  --c: #d99a17;
  --f: #c2557a;
  --shadow: 0 1px 2px rgb(30 25 15 / 0.05);
  --toast-bg: #1d1c1a;
  --toast-ink: #f2f1ec;
  --toast-action: #7fd8a6;
  --radius: 16px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0c;
    --card: #1b1b19;
    --ink: #f1efe9;
    --ink-2: #a8a49b;
    --ink-3: #9b978f;
    --line: #2c2b28;
    --fill: #2a2926;
    --accent: #47b67c;
    --accent-ink: #0b1a12;
    --accent-soft: #17301f;
    --over: #f07a4c;
    --warn: #e7a83f;
    --warn-soft: #33270f;
    --danger: #f0675c;
    --p: #6d95f2;
    --c: #e9b23e;
    --f: #e07a9d;
    --shadow: none;
    --toast-bg: #f1efe9;
    --toast-ink: #1d1c1a;
    --toast-action: #1a6a42;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
body.has-sheet { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 30px; letter-spacing: -0.02em; }
h3, .card h2, .food-head h2 { font-size: 17px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

#main {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 8px) 16px calc(var(--tabbar-h) + var(--safe-b) + 16px);
  outline: none;
}
.spacer { height: 8px; }
.muted { color: var(--ink-2); }
.warn-text { color: var(--warn) !important; }
small { font-size: 12px; }

/* ---- top bar ---- */
.topbar { display: flex; align-items: center; gap: 4px; min-height: 52px; margin-bottom: 8px; }
.topbar h1 { padding: 6px 2px; }
.topbar .end { margin-left: auto; }
.date-pick { position: relative; flex: 1; text-align: center; font-weight: 650; font-size: 18px; padding: 8px 0; }
.date-pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; -webkit-appearance: none; appearance: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink);
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { background: var(--fill); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small svg { width: 20px; height: 20px; }

/* ---- cards ---- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.inset { background: var(--bg); box-shadow: none; }
.card > h3, .card > h2 { margin-bottom: 8px; }
.card-head, .tracker-head, .meal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-head h2, .tracker-head h2, .meal-head h2 { flex: 1; }
.notice { background: var(--accent-soft); }
.notice p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.hint { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; }
.hint.center, .center { text-align: center; }
.empty { color: var(--ink-2); font-size: 15px; padding: 10px 0; margin: 0; }

/* ---- summary ---- */
.summary { display: flex; align-items: center; gap: 18px; }
.ring-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring-bg { stroke: var(--fill); }
.ring-fg { stroke: var(--accent); transition: stroke-dashoffset 0.4s ease; }
.ring.over .ring-fg { stroke: var(--over); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 13px; color: var(--ink-2); margin-top: -2px; }
.equation { flex: 1; margin: 0; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.equation div { display: flex; justify-content: space-between; }
.equation dt { color: var(--ink-2); }
.equation dd { margin: 0; font-weight: 550; }
.eq-total { border-top: 1px solid var(--line); padding-top: 5px; margin-top: 2px; }
.eq-total dt { color: var(--ink); font-weight: 600; }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.macros .link { grid-column: 1 / -1; justify-self: start; }
.macro-top { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-2); }
.macro-top span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.macro-top b { font-size: 17px; }
.macro-left { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.m-p .bar i, .split .m-p { background: var(--p); }
.m-c .bar i, .split .m-c { background: var(--c); }
.m-f .bar i, .split .m-f { background: var(--f); }
.bar.thin { height: 4px; margin-top: 4px; }
.bar.limit i { background: var(--ink-3); }
.bar.bad i { background: var(--over); }

/* ---- rows ---- */
.row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; border: 0; background: none;
  text-align: left; border-top: 1px solid var(--line); min-height: 52px;
}
.meal-head + .row, .tracker-head + .row, .list-h + .row, .list-h + .row-wrap .row, .card.list > .row-wrap:first-of-type .row { border-top: 0; }
.row:active { background: var(--fill); }
.row.static:active { background: none; }
.row.danger .row-title { color: var(--danger); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-sub { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-kcal { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 550; }
.row-wrap { display: flex; align-items: center; gap: 6px; }
.row-wrap .row { flex: 1; min-width: 0; }
.row-wrap + .row-wrap .row { border-top: 1px solid var(--line); }
.quick {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.quick svg { width: 20px; height: 20px; stroke-width: 2.4; }
.quick.remove { background: var(--fill); color: var(--ink-2); }
.add-row {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; color: var(--accent);
  font-weight: 600; padding: 10px 0 2px; border-top: 1px solid var(--line);
}
.meal-head + .add-row, .tracker-head + .add-row, .empty + .add-row { border-top: 0; }
.add-row svg { width: 20px; height: 20px; stroke-width: 2.4; }
.list-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); margin: 16px 0 2px; font-weight: 600; }
.list-h small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.list-foot { padding: 16px 0 8px; }
.quickcal { border-top: 0; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 650; padding: 1px 6px; border-radius: 6px; margin-right: 6px;
  vertical-align: 1px; background: var(--fill); color: var(--ink-2);
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 0; background: var(--fill); color: var(--ink); font-weight: 600;
}
.btn:active { filter: brightness(0.94); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 15px; border-radius: 10px; }
.btn.small svg { width: 18px; height: 18px; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn:disabled { opacity: 0.45; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 8px 0; }
.link.small { font-size: 15px; }
.link.block { display: block; width: 100%; text-align: center; margin-top: 4px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---- trackers ---- */
.cups { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.cup { width: 22px; height: 28px; border-radius: 3px 3px 7px 7px; border: 2px solid var(--line); }
.cup.full { background: #4aa3df; border-color: #4aa3df; }

/* ---- segmented ---- */
.seg { display: flex; background: var(--fill); border-radius: 11px; padding: 3px; margin-bottom: 12px; gap: 2px; }
.seg button {
  flex: 1; border: 0; background: none; border-radius: 9px; padding: 7px 4px; font-size: 15px; font-weight: 550; color: var(--ink-2);
}
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.seg.small button { font-size: 14px; padding: 6px 2px; }

/* ---- stats ---- */
.stats { display: flex; gap: 8px; margin-top: 10px; }
.stats div { flex: 1; display: flex; flex-direction: column; }
.stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--ink-2); }
.key::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: currentColor; }
.key.m-p::before { background: var(--p); }
.key.m-c::before { background: var(--c); }
.key.m-f::before { background: var(--f); }
.split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--fill); }
.kv { margin: 0; display: grid; gap: 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.kv div:first-child { border-top: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; }
.micro { padding: 7px 0; }
.micro-top { display: flex; justify-content: space-between; font-size: 15px; font-variant-numeric: tabular-nums; }
.micro-top small { color: var(--ink-3); }
details summary { color: var(--accent); font-weight: 600; padding: 10px 0 4px; cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

/* ---- charts ---- */
.chart { width: 100%; height: auto; display: block; margin: 4px 0; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 10px; stroke: none; }
.chart .cbar { fill: var(--accent); stroke: none; }
.chart .cbar.over { fill: var(--over); }
.chart .target { stroke: var(--ink-2); stroke-dasharray: 4 4; stroke-width: 1.2; }
.chart .trend { stroke: var(--accent); stroke-width: 2.5; }
.chart .dot { fill: var(--card); stroke: var(--accent); stroke-width: 1.6; }

/* ---- tab bar ---- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; align-items: flex-start;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 4px var(--safe-b);
  background: color-mix(in srgb, var(--card) 88%, transparent); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
}
#tabbar button {
  flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none;
  color: var(--ink-3); font-size: 11px; font-weight: 550; padding: 2px 0;
}
#tabbar button svg { width: 26px; height: 26px; }
#tabbar button[aria-current="page"] { color: var(--accent); }
#tabbar .tab-add { flex: none; width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); justify-content: center; margin: -2px 6px 0; }
#tabbar .tab-add svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---- sheets ---- */
#sheets { position: relative; z-index: 20; }
.sheet {
  position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open { transform: none; }
.sheet.compact { top: auto; max-height: 75vh; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.25); }
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 8px) 12px 8px; border-bottom: 1px solid var(--line); background: var(--card);
}
.sheet.compact .sheet-head { padding-top: 10px; border-radius: 16px 16px 0 0; }
.sheet-head h2 { font-size: 17px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.sheet-head .link { justify-self: start; font-weight: 500; font-size: 17px; }
.head-right { justify-self: end; }
.sheet-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px calc(var(--safe-b) + 88px);
  width: 100%; max-width: 640px; margin: 0 auto;
}
.actions { display: flex; flex-direction: column; }
.action { border: 0; background: var(--card); padding: 15px 16px; text-align: left; font-size: 17px; border-top: 1px solid var(--line); }
.action:first-child { border-radius: 12px 12px 0 0; border-top: 0; }
.action:last-child { border-radius: 0 0 12px 12px; }
.action:only-child { border-radius: 12px; }
.action.danger { color: var(--danger); }
.action:active { background: var(--fill); }

/* ---- forms ---- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { position: relative; display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .manual-code input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  font-size: 17px; -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 20px; padding-right: 36px;
}
.field input:focus, .field select:focus, .search-field:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.field input.has-unit { padding-right: 52px; }
.field .unit { position: absolute; right: 12px; top: 33px; color: var(--ink-3); font-size: 15px; pointer-events: none; }
.field.check { flex-direction: row; align-items: center; gap: 10px; font-size: 16px; }
.field.check input { width: 22px; height: 22px; min-height: 0; padding: 0; flex: none; -webkit-appearance: checkbox; appearance: auto; accent-color: var(--accent); }
.field input[type="date"] { min-height: 46px; display: block; }

/* ---- add food ---- */
.searchbar { display: flex; gap: 8px; position: sticky; top: -12px; margin: -12px -16px 0; padding: 12px 16px 10px; background: var(--bg); z-index: 2; }
.search-field { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 12px; padding: 0 12px; border: 1px solid var(--line); }
.search-field svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.search-field input { flex: 1; border: 0; background: none; min-height: 44px; font-size: 17px; outline: none; -webkit-appearance: none; }
.icon-btn.scan { width: 46px; height: 46px; background: var(--accent); color: var(--accent-ink); }
.results .row-wrap .row { border-top: 1px solid var(--line); }
.results .list-h + .row-wrap .row, .results .seg + .row-wrap .row, .results .quickcal + .row-wrap .row, .results .row-btns + .row-wrap .row { border-top: 0; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- food detail ---- */
.food-head h2 { font-size: 22px; line-height: 1.25; }
.food-head p { margin: 4px 0 0; }
.amount { display: flex; gap: 10px; margin-top: 16px; }
.amount .field:first-child { width: 96px; flex: none; }
.amount .grow { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; margin: 10px 0 14px; }
.chip { flex: 1; min-height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.chip:active { background: var(--fill); }
.meal-seg { margin-bottom: 10px; }
.nutri { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-top: 4px; }
.big-kcal { display: flex; align-items: baseline; gap: 8px; }
.big-kcal b { font-size: 38px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big-kcal span { color: var(--ink-2); }
.macro-trio { display: flex; gap: 10px; margin-top: 10px; }
.macro-trio div { flex: 1; border-left: 3px solid; padding-left: 8px; display: flex; flex-direction: column; }
.macro-trio .m-p { border-color: var(--p); }
.macro-trio .m-c { border-color: var(--c); }
.macro-trio .m-f { border-color: var(--f); }
.macro-trio span { font-size: 12px; color: var(--ink-2); }
.kv-row { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; font-variant-numeric: tabular-nums; }
.star svg { width: 24px; height: 24px; }
.star.on { color: #e8a317; }
.star.on svg { fill: currentColor; }

/* ---- scanner ---- */
.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 55vh; width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 10%; right: 10%; top: 36%; height: 28%; border: 3px solid rgb(255 255 255 / 0.9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.35); }
.scan-status { text-align: center; margin: 12px 0; min-height: 22px; }
.manual-code { display: flex; gap: 8px; }
.manual-code input { flex: 1; }
.center-msg { text-align: center; padding: 20px 4px; }

/* ---- toast ---- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); transform: translate(-50%, 20px); z-index: 40;
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-ink); font-size: 15px; opacity: 0; pointer-events: none; transition: 0.22s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#toast button { border: 0; background: none; color: var(--toast-action); font-weight: 700; padding: 0; }
body.has-sheet #toast { bottom: calc(var(--safe-b) + 16px); }
.more-fields .form { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .sheet, #toast, .ring-fg { transition: none; }
}

/* ---- notification settings ---- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row span { display: flex; flex-direction: column; }
.switch-row small { color: var(--ink-2); font-size: 13px; }
input[role="switch"] {
  -webkit-appearance: none; appearance: none; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill);
  position: relative; transition: background 0.2s; margin: 0;
}
input[role="switch"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.2); transition: transform 0.2s;
}
input[role="switch"]:checked { background: var(--accent); }
input[role="switch"]:checked::after { transform: translateX(20px); }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; }
.field.inline label { font-size: 16px; font-weight: 400; color: var(--ink); }
.field.inline input, .field.inline select { width: auto; min-width: 130px; min-height: 38px; padding: 6px 10px; font-size: 16px; }
.field.inline select { padding-right: 32px; }
.notif-form .card { margin-bottom: 0; }

/* ---- gestures ---- */
.swipe { position: relative; overflow: hidden; }
.swipe-bg {
  position: absolute; inset: 0 0 0 auto; width: 100%; display: flex; align-items: center; justify-content: flex-end; padding-right: 18px;
  background: var(--danger); color: #fff; font-weight: 650; opacity: 0;
}
.swipe > .row { position: relative; background: var(--card); will-change: transform; }
.swipe.dragging > .row { transition: none; }
.swipe > .row.settle { transition: transform 0.22s ease; }
#main { touch-action: pan-y; }
html, button, input, select { touch-action: manipulation; }
.sheet-head { touch-action: none; }
.day-slide { animation: day-in 0.22s ease; }
.day-slide.from-left { animation-name: day-in-left; }
@keyframes day-in { from { transform: translateX(24px); opacity: 0.4; } }
@keyframes day-in-left { from { transform: translateX(-24px); opacity: 0.4; } }
.field textarea {
  font: inherit; font-size: 17px;
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  font-size: 17px; resize: vertical; -webkit-appearance: none; appearance: none;
}
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.meal-head + .swipe .row { border-top: 0; }
.describe-row .row-title { color: var(--accent); font-weight: 600; }
.hint a { color: var(--accent); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.photo-scan { margin: 0 0 12px; }

.torch {
  position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgb(0 0 0 / 0.55); color: #fff;
}
.torch svg { width: 22px; height: 22px; }
.torch[aria-pressed="true"] { background: #fff; color: #111; }

.goal-row { margin-bottom: 8px; padding: 12px 14px; }
.goal-head { display: flex; flex-direction: column; margin-bottom: 8px; }
.goal-head small { font-size: 13px; }
.goal-inputs { display: flex; gap: 8px; align-items: center; }
.goal-inputs select, .goal-amt input {
  min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 16px;
  padding: 8px 10px; -webkit-appearance: none; appearance: none;
}
.goal-inputs select { flex: 1; min-width: 0; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
.goal-amt { display: flex; align-items: center; gap: 6px; flex: 1; }
.goal-amt[hidden] { display: none; }
.goal-amt input { width: 100%; min-width: 0; }
.goal-amt span { color: var(--ink-2); font-size: 15px; }
