:root {
  --ink: #111114;
  --on-ink: #FFFFFF;
  --muted: #55555C;
  --line: #E6E6EB;
  --ground: #F5F5F7;
  --card: #FFFFFF;
  --soft: #F0F0F4;
  --track: #EDEDF0;
  --protein: #D9534A;
  --carbs: #E08A2E;
  --fat: #3F74E0;
  --plant: #3E9B52;
  --good: #1E6B45;
  --good-bg: #E2F2E8;
  --danger: #B3261E;
  --shadow: 0 2px 10px rgba(17, 17, 20, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F2F2F5; --on-ink: #111114; --muted: #A5A5AF; --line: #2B2B31; --ground: #0F0F12; --card: #1A1A1F;
    --soft: #24242A; --track: #2A2A31; --protein: #F0726A; --carbs: #F2A454; --fat: #7AA2F5; --plant: #6EC480;
    --good: #82D3A6; --good-bg: #173326; --danger: #FF8A80; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #F2F2F5; --on-ink: #111114; --muted: #A5A5AF; --line: #2B2B31; --ground: #0F0F12; --card: #1A1A1F;
  --soft: #24242A; --track: #2A2A31; --protein: #F0726A; --carbs: #F2A454; --fat: #7AA2F5; --plant: #6EC480;
  --good: #82D3A6; --good-bg: #173326; --danger: #FF8A80; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* no automatic text inflation */
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.4 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* pinch zoom allowed for people with poor sight (phone check 2026-10-15); no double-tap zoom, so quick taps all count */
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.view {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 18px calc(env(safe-area-inset-bottom, 0px) + 120px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.top h1 { margin: 0; font-size: 22px; font-weight: 800; flex-grow: 1; text-wrap: balance; }
.brand { letter-spacing: -0.02em; }
h2 { margin: 0 0 8px; font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); font-size: 13px; }
.empty { margin: 0; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--fat); outline-offset: 2px; }
/* The parts the browser draws still carry the palette. */
:root { accent-color: var(--ink); scrollbar-color: var(--track) transparent; }
::selection { background: color-mix(in srgb, var(--fat) 28%, transparent); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
input, textarea { caret-color: var(--fat); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }

.pill { height: 40px; padding: 0 14px; border-radius: 20px; border: none; background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); flex-shrink: 0; }
.dark { background: var(--ink); color: var(--on-ink); }
.link { border: none; background: none; color: var(--muted); font-size: 14px; font-weight: 600; min-height: 44px; }
a.link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.back { width: 44px; height: 44px; margin-left: -10px; border: none; background: none; display: grid; place-items: center; flex-shrink: 0; }
.wide { min-height: 52px; border-radius: 26px; border: none; font-weight: 700; font-size: 16px; width: 100%; }
.danger { background: none; color: var(--danger); }
.streak { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 6px; border: none; background: none; font: inherit; font-size: 16px; color: var(--carbs); }
.streak b { color: var(--ink); }

.daytabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 clamp(10px, 5vw, 22px); margin-top: -4px; }
.daytabs .daytab { white-space: nowrap; }
#home, #progress, #settings { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 170px); } /* last row clears the bar and the + button (on every tab) */
.daytab { position: relative; border: none; background: none; padding: 6px 0 10px; font-size: 16px; font-weight: 700; color: var(--muted); }
.daytab[aria-selected="true"] { color: var(--ink); }
.daytab[aria-selected="true"]::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--ink); }
.calbtn { position: relative; margin-left: auto; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--ink); }
.calbtn input { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; opacity: 0; cursor: pointer; } /* Chrome on Android gives a date box ~150px of its own: kept inside the 44px button so the page is not widened (S20, Kaz, 2026-10-27) */
.tabs { display: flex; gap: 18px; }
.tabs button { border: none; background: none; padding: 0 0 4px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; min-height: 36px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }


.card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }
.big { padding: 20px 22px; border-radius: 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.big .ring { flex-shrink: 1; min-width: 44px; max-width: 28vw; height: auto; }
.huge { font-size: clamp(30px, 12vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.huge.over { color: var(--protein); }
.panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pages { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pages::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; scroll-snap-align: start; }
.pagedots { display: flex; justify-content: center; gap: 6px; margin-top: -4px; }
.pagedots i { width: 6px; height: 6px; border-radius: 3px; background: var(--track); }
.pagedots i.on { background: var(--ink); }
.arc-fib, .arc-sug, .arc-salt { stroke: var(--ink); }
.copybar label { position: relative; display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 22px; background: var(--soft); color: var(--ink); font-size: 13px; font-weight: 700; }
.copybar input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.macro { padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.macro b, .stat b { display: block; font-size: clamp(13px, 4.6vw, 18px); overflow-wrap: anywhere; font-weight: 800; font-variant-numeric: tabular-nums; }
.macro span { font-size: 12px; }
.stat { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; margin-right: 5px; vertical-align: 1px; }
.dot.p { background: var(--protein); } .dot.c { background: var(--carbs); } .dot.f { background: var(--fat); }

.meter-track { stroke: var(--track); } .ticks { stroke: var(--muted); } .needle { stroke: var(--ink); } .hub { fill: var(--ink); }
.ring .arc { stroke: var(--plant); }
.arc-p { stroke: var(--protein); } .arc-c { stroke: var(--carbs); } .arc-f { stroke: var(--fat); }
/* Over target: the calorie, protein, carbs and fat meters and numbers go the red the calorie number goes (Kaz, 2026-10-13) */
svg.over .arc { stroke: var(--protein); } .macro b.over { color: var(--protein); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { min-height: 44px; padding: 0 14px; border-radius: 22px; border: none; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 700; box-shadow: var(--shadow); }
.chips.tight button { min-height: 34px; padding: 0 12px; background: var(--soft); box-shadow: none; }
.chips.tight button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); color: var(--ink); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.item-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.item-kcal { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; border: none; background: var(--soft); color: var(--ink); display: grid; place-items: center; }
button.item { width: 100%; border: none; text-align: left; font: inherit; }
.row-item { display: flex; gap: 8px; align-items: center; }
.row-item > .item { flex-grow: 1; }
.tag { padding: 1px 7px; border-radius: 7px; background: var(--good-bg); color: var(--good); font-size: 11px; font-weight: 700; }

.searchbox { display: flex; gap: 8px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 6px 6px 6px 14px; align-items: center; }
.searchbox input { flex-grow: 1; min-width: 0; border: none; background: transparent; font-size: 16px; outline: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; border: none; margin: 0; padding: 0; min-width: 0; }
.pw { position: relative; display: block; }
.field .pw input { padding-right: 52px; }
.pw-eye { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: none; border-radius: 10px; background: none; color: var(--muted); display: grid; place-items: center; }
.pw-eye .off, .pw-eye[aria-pressed="true"] .on { display: none; }
.pw-eye[aria-pressed="true"] .off { display: block; }
.field legend { padding: 0; margin-bottom: 6px; }
.field input:not([type="radio"]), .field select, .row input { height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; font-weight: 600; width: 100%; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.grow { flex-grow: 1; }
.narrow { max-width: 84px; }
.unit { position: relative; flex: 1; min-width: 0; }
.unit input { padding-right: 38px; }
.unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.seg { display: flex; gap: 6px; background: var(--soft); border-radius: 14px; padding: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.seg label { flex: 1; text-align: center; padding: 12px 8px; border-radius: 11px; font-weight: 700; cursor: pointer; }
.seg.small label { padding: 8px; font-size: 13px; }
.seg input:checked + label { background: var(--card); box-shadow: var(--shadow); }
.seg input:focus-visible + label { outline: 3px solid var(--fat); }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choices label { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-weight: 600; cursor: pointer; }
.choices input { accent-color: var(--ink); width: 18px; height: 18px; }

.plan { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.plan-kcal b { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.plan-macros { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }

.builder { padding: 14px; display: flex; flex-direction: column; gap: 10px; border: 2px solid var(--ink); }
.builder-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.builder-head div { display: flex; flex-direction: column; }
.mini { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.mini li { display: flex; justify-content: space-between; gap: 8px; }

.pad { padding: 18px; }
.checkin { display: flex; flex-direction: column; gap: 8px; }
.checkin b.big-n { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.checkin .row { margin-top: 6px; }
.checkin .row button { flex: 1; min-height: 48px; border-radius: 24px; font-weight: 700; }
.checkin .accept { background: var(--ink); color: var(--on-ink); border: none; }
.checkin .keep { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.meter { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; background: var(--ink); }

/* Cal AI section rhythm: header row outside the card, one segmented bar, then the card */
.roomy { gap: 12px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 14px; }
.sec-head:first-child { margin-top: 0; }
.sec-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.sec-head .muted b { color: var(--ink); font-size: 15px; }
.segbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--soft); border-radius: 12px; padding: 3px; }
.segbar button { border: none; background: none; color: var(--ink); font-size: 14px; font-weight: 600; min-height: 36px; border-radius: 9px; }
.segbar button[aria-pressed="true"] { background: var(--card); font-weight: 800; box-shadow: 0 1px 4px rgba(17, 17, 20, 0.12); }
.stats2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
.stats2 b { display: block; font-size: clamp(16px, 6vw, 24px); overflow-wrap: anywhere; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.weigh { display: flex; flex-direction: column; gap: 10px; }
.weigh-title { font-weight: 700; }
.legend { margin-top: 8px; }

.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); }
.chart .lbl { fill: var(--muted); font-size: 10px; font-family: inherit; }
.chart .pt { fill: var(--muted); opacity: 0.55; }
.chart .trend { stroke: var(--ink); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .last { fill: var(--ink); }
.chart .bt { fill: var(--track); } .chart .bp { fill: var(--protein); } .chart .bc { fill: var(--carbs); } .chart .bf { fill: var(--fat); }
.chart-empty { padding: 26px 0; text-align: center; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; }

.ai-block { gap: 8px; }
.snap-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; font-size: 18px; }
.ai-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ai-row > * { min-height: 52px; border-radius: 16px; border: none; font: inherit; font-size: 13px; font-weight: 700; text-align: center; padding: 6px; }
.log-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.log-more > * { min-height: 48px; border-radius: 16px; border: none; font: inherit; font-size: 13px; font-weight: 700; padding: 6px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.pp-grid figure { margin: 0; position: relative; }
.pp-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; display: block; }
.pp-grid figcaption { font-size: 11px; color: var(--muted); text-align: center; }
.pp-grid button { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border-radius: 14px; border: none; background: rgba(0,0,0,.55); color: #fff; }
.pp-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-compare figure { margin: 0; text-align: center; font-size: 12px; font-weight: 700; }
.pp-compare img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; }
.kit-recipe h2 { margin: 0; }
.kit-ing, .kit-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1 1 0; min-width: 0; min-height: 52px; border-radius: 16px; border: none; font: inherit; font-size: 14px; font-weight: 700; padding: 6px; text-align: center; }
.kit-gallery { display: block; text-align: center; font-size: 14px; font-weight: 600; padding: 8px; margin-top: -4px; }
.kit-size { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } /* two rows of two (Kaz) */
.kit-size button { min-height: 44px; }
.kit-how ol { margin: 6px 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.group-title { margin: 10px 4px -4px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field textarea { border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 12px 14px; font: inherit; font-size: 16px; resize: vertical; }
.ai-item { display: flex; align-items: center; gap: 10px; }
.ai-item .item-main { flex: 1; }
.ai-item input { width: 84px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 10px; font: inherit; font-weight: 700; }
#portion-name, #portion-brand { overflow-wrap: anywhere; }
.weigh .row { flex-wrap: wrap; }
.acct-btn { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: none; border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); font: inherit; font-size: 13px; font-weight: 700; }
.acct-btn.in { padding: 0; width: 44px; justify-content: center; }
.extras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.extras .row { justify-content: space-between; gap: 6px; }
.extras .icon-btn { width: clamp(32px, 10vw, 40px); height: clamp(32px, 10vw, 40px); }
.icon-btn.dark { background: var(--ink); color: var(--on-ink); }
.pre-line { white-space: pre-line; }
.nut summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.nut summary::-webkit-details-marker { display: none; }
.nut p { margin: 10px 0 4px; }
.nut-row { display: flex; gap: 8px; padding: 6px 0; font-size: 14px; }
.nut-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.invite-code { flex: 1; letter-spacing: 2px; }
.pill-dark { min-height: 44px; padding: 0 22px; border: none; border-radius: 22px; background: var(--ink); color: var(--on-ink); font-weight: 700; }
.rem-row > span { color: var(--muted); padding-left: 12px; }
.rem-row .date-small { flex: 0 1 150px; }
.rem-status { margin: 0; padding: 0 16px 12px; }
.or-line { text-align: center; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.date-small { flex: 1 1 130px; min-width: 0; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 4px; font: inherit; font-size: 13px; max-width: 170px; }
.weigh-title.grow { flex-grow: 1; }
.report-body { overflow-x: auto; }
.report .top { flex-wrap: wrap; }
.report table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.report th, .report td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.report th:first-child, .report td:first-child { text-align: left; }
@media print {
  body { background: #fff; color: #000; }
  .noprint, #nav, #open-search { display: none !important; }
  .report { padding: 0; max-width: none; }
}
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 160px); z-index: 3; width: min(440px, calc(100% - 32px)); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px 4px 16px; border-radius: 16px; background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow); }
.toast .link { color: var(--on-ink); text-decoration: underline; }
.toast span { min-width: 0; overflow-wrap: anywhere; } /* a long name with no spaces wraps inside the box (Kaz, 2026-10-21) */
#support .seg { flex-wrap: wrap; }
#support .seg label { flex: 1 1 40%; }
.rowval { min-width: 0; overflow-wrap: anywhere; }
.small { font-size: 12px; }
.badges { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; } /* one row that scrolls sideways */
.badges::-webkit-scrollbar { display: none; }
.badge { flex: 0 0 96px; background: var(--card); border-radius: 16px; padding: 12px 8px; text-align: center; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
.badge b { display: block; font-size: 22px; line-height: 1.2; }
.badge.locked { opacity: 0.4; box-shadow: none; }
.item.picked { outline: 3px solid var(--ink); outline-offset: -3px; }
.list .hour { font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 4px -2px; }
/* On/off switches for settings */
.setrow.switchrow { flex-wrap: nowrap; cursor: pointer; }
.setrow.switchrow > span { flex: 1 1 auto; min-width: 0; }
.switch { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 50px; height: 30px; margin: 0; border-radius: 15px; background: var(--track); position: relative; cursor: pointer; transition: background-color 0.2s ease-out; }
.switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.switch:checked { background: var(--ink); }
.switch:checked::before { transform: translateX(20px); }
.badge svg { display: block; margin: 0 auto 4px; }
.badge:not(.locked) svg { color: var(--carbs); }
@media (prefers-reduced-motion: no-preference) {
  svg .arc { transition: stroke-dasharray 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s; }
  svg .needle { transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .streak.pop { animation: streak-pop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .toast:not([hidden]) { animation: toast-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
}
@keyframes streak-pop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.pick { height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 10px; font: inherit; font-weight: 600; }
.steps { margin: 0; padding-left: 20px; }
.nowrap { white-space: nowrap; }
button.setrow, a.setrow { flex-wrap: nowrap; }
button.setrow > span:first-child, a.setrow > span:first-child { flex: 1 1 auto; min-width: 0; }
/* A row with a value on the right (Subscription, Account): the name keeps its room and the value wraps beside it, never over it (Kaz, 2026-10-21) */
button.setrow:has(.rowval) > span:first-child { flex: 0 0 auto; max-width: 55%; }
button.setrow:has(.rowval) .rowval { flex: 1 1 0; justify-content: flex-end; }
button.setrow:has(.rowval) .rowval > span:first-child { text-align: right; min-width: 0; }
#acct-who { overflow-wrap: anywhere; min-width: 0; text-align: right; }
@media (max-width: 300px) { .report table { font-size: 11px; } .report th, .report td { padding: 5px 2px; } }
.choices label .rec { margin-left: auto; padding: 2px 8px; border-radius: 8px; background: var(--good-bg); color: var(--good); font-size: 12px; white-space: nowrap; }
.warn { margin: 8px 0 0; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--carbs) 16%, var(--card)); color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.45; }
.coach-note { margin: 4px 0; padding: 12px 14px; border-radius: 14px; background: var(--soft); font-size: 14px; line-height: 1.5; white-space: pre-line; }
/* On a computer the app sits in the middle as a phone-sized card, instead of a thin column stuck to the top. */
@media (min-width: 760px) and (pointer: fine) {
  body { background: color-mix(in srgb, var(--ground) 88%, var(--ink)); }
  .view { background: var(--ground); margin: 32px auto; min-height: calc(100vh - 64px); border-radius: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18); }
  .bar { bottom: 32px; border-radius: 0 0 28px 28px; }
  .fab { bottom: 120px; }
}
.choices label { flex-wrap: wrap; }
.choices label:not(:has(.rec)) { flex-wrap: nowrap; } /* only the Recommended tag drops to its own line; the radio stays beside long text */
.choices input { flex: none; }
@media (max-width: 300px) { .sec-head .link { font-size: 12px; } .setrow.switchrow > span { min-width: 45%; } .macro b { font-size: 12px; } }
.price-note { margin: 0; font-weight: 700; }
.trial-note { display: block; width: 100%; margin: 0 0 12px; border: none; text-align: left; font-weight: 700; color: var(--ink); }
.filebtn { position: relative; }
.filebtn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.scan-btn { background: var(--card); color: var(--ink); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; gap: 10px; }
.camera { position: relative; border-radius: 22px; overflow: hidden; background: #1C1C20; aspect-ratio: 3 / 4; max-width: 100%; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.aim { position: absolute; left: 12%; right: 12%; top: 38%; height: 24%; border: 3px solid rgba(255, 255, 255, 0.9); border-radius: 16px; }

.group { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 60px; padding: 8px 18px; font-size: 16px; width: 100%; border: none; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; }
.group > .setrow + .setrow { border-top: 1px solid var(--line); }
button.setrow { cursor: pointer; }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.rowval { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; }
/* Settings → AI this year: the share of the yearly AI budget left (kit/shared/ai-budget.php); no money shown */
.ai-bar { display: block; flex: none; width: 64px; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.ai-bar > i { display: block; height: 100%; background: var(--plant); }
.ai-bar.low > i { background: var(--carbs); }
.setrow { flex-wrap: wrap; }
.setrow .seg { flex-shrink: 0; margin-left: auto; }
.setrow .seg label { padding: 7px 10px; white-space: nowrap; flex: none; }
.note { margin: 0 4px; }
a.setrow { text-decoration: none; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.consent input { width: 22px; height: 22px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--ink); }
#weigh-form .unit input { height: 48px; }
#weigh-form .pill { height: 48px; border-radius: 14px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  padding: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.navbtn { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; min-height: 52px; }
.navbtn[aria-current="page"] { color: var(--ink); font-weight: 800; }
.fab {
  position: fixed; right: max(20px, calc((100% - 480px) / 2 + 20px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 88px); z-index: 2;
  width: 60px; height: 60px; border-radius: 30px; border: none; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; box-shadow: 0 8px 20px rgba(17, 17, 20, 0.28);
}


/* Home: tappable cards (calories card, macro cards) and the macro sheet */
.tap { cursor: pointer; }
.tap:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tap-hint { margin-top: 4px; }
.coach-line { margin: -4px 4px 0; font-size: 14px; }
.sheet-back { position: fixed; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.4); }
.sheet-back[hidden] { display: none; }
.sheet { width: min(440px, 100%); }

/* Home header: the logo in colour (Kaz, 2026-10-11): vine and leaves plant green, tape measure carbs orange, letters ink.
   Split from wordmark.png by tools/logo_colours.py; one file per theme. */
.wordmark { display: block; height: 44px; aspect-ratio: 628 / 201; background: url(wordmark-light.png) no-repeat center / contain; }
:root[data-theme="dark"] .wordmark { background-image: url(wordmark-dark.png); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wordmark { background-image: url(wordmark-dark.png); } }

/* Kaz 2026-10-11: the final Add / Save button is always on screen, no scrolling or closing the keyboard to reach it. */
.sticky-save { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); z-index: 2; box-shadow: 0 6px 18px rgba(17, 17, 20, 0.22); }
.count-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.count-row .grow { flex-grow: 1; }
.count-n { min-width: 2.2ch; text-align: center; font-size: 22px; }

#mine-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
#mine-cats button { flex-shrink: 0; }
#mine-cats button.on { background: var(--ink); color: var(--on-ink); }
.label-btn.dark { background: var(--ink); color: var(--on-ink); }
.code-type summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.ai-food { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding-bottom: 10px; }
.ai-food .item { background: none; box-shadow: none; padding-bottom: 6px; }
.ai-food .count-row { padding: 0 14px; }
/* − weight + Save on one line (the general .weigh .row wraps) */
.weigh .row.weigh-step { flex-wrap: nowrap; gap: 8px; }
.weigh-step #weigh-inputs { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; }
.weigh-step .icon-btn { width: 44px; height: 44px; }
.update-note { margin: 0 0 12px; }
.update-note ul, .update-note ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
/* The move to joscaloriecounter.com (Kaz, 2026-10-12): above everything, in the middle of the screen */
.move-back { z-index: 50; align-items: center; }
.move-title { font-size: 20px; }
.move-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.move-back p { margin: 0; }

/* Phone check 2026-10-15: every tap target at least 44px tall, and every box people type in at least 16px (iPhone zooms in
   on smaller text). Kept together here so the sizes are easy to compare with the other Jo's apps. */
.tabs button, .daytab, .pill, .chips.tight button { min-height: 44px; }
.icon-btn, .extras .icon-btn { width: 44px; height: 44px; border-radius: 22px; }
.setrow .seg label { min-height: 44px; display: flex; align-items: center; justify-content: center; padding: 0 12px; }
.pick, .date-small { height: 44px; font-size: 16px; }
.consent { min-height: 44px; align-items: center; }
.consent input { width: 24px; height: 24px; margin: 0; }
#acct-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
/* Short screens (a phone on its side, or the keyboard up on a small phone): the save button stays in the page instead of
   floating over the box being typed in. */
@media (max-height: 520px) { .sticky-save { position: static; box-shadow: none; } }
.segbar button, .seg.small label { min-height: 44px; }
.seg.small label { display: flex; align-items: center; justify-content: center; }
details > summary { min-height: 44px; display: flex; align-items: center; }
.nut summary { align-items: stretch; } /* keeps its own column layout */
.searchbox input { min-height: 44px; } /* the whole box takes the tap, not just the text line */

/* First name card in Account (2026-10-18): no gap while there is no "Saved." */
#name-status:empty { display: none; }

/* Swipe a logged food left to remove it (Kaz 20 Nov 2026): the red Delete shows behind the food only while it is being dragged */
.list li.swipe { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.swipe-del { position: absolute; inset: 0; border-radius: 16px; background: var(--danger); color: var(--on-ink); font-weight: 800; display: flex; align-items: center; justify-content: flex-end; padding-right: 20px; opacity: 0; pointer-events: none; }
.swipe.swiping .swipe-del { opacity: 1; }
.swipe > .item { position: relative; touch-action: pan-y; }
@media (prefers-reduced-motion: reduce) { .swipe > .item { transition: none !important; } }
/* The Removed + Undo toast lets touches through to the food under it, except on its Undo link (Kaz 20 Nov 2026): a swipe can start under it */
.toast { pointer-events: none; }
.toast button { pointer-events: auto; }
