/* Fonts are bundled (no outside calls, so they work offline): DM Sans for text, Bricolage Grotesque for titles and big numbers. */
@font-face { font-family: "DM Sans"; src: url("fonts/dm-sans-latin.woff2") format("woff2"); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
:root {
  --ink: #12201a; --muted: #4c5d54; --paper: #f2f6f3; --card: #fff; --line: #cfdad2;
  --green: #16a34a; --amber: #d99a00; --red: #ef4444;
  --kcal: #ff7a2f; --prot: #16a34a; --carb: #3b82f6; --fat: #ec4899; --fibre: #d99a00; --weight: #8b5cf6;
  --bar-h: 118px;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Bricolage Grotesque", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --r-s: 12px; --r-m: 20px; --r-l: 28px; --r-xl: 36px;
  --sel: #14532d; --on-sel: #fff; --send: #14532d;
  --primary: #14532d; --primary-c: #cdeed9; --on-primary-c: #0b3320; --warn: #8a4b00; --warn-c: #fdebc8; --surface-2: #e8efe9;
  --ok-bg: #dcfce7; --ok-fg: #166534; --warn-bg: #fef3c7; --warn-fg: #92400e; --bad-bg: #fee2e2; --bad-fg: #991b1b;
  --info-bg: #e8f1ff; --info-fg: #1e3a8a; --banner-bg: #fff7e6; --banner-fg: #92400e;
  --green-t: #15803d; --red-t: #b91c1c; --amber-t: #b45309; --future: #b4bac4; --faint: #8b95a5; --sel-track: rgba(255,255,255,.35);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #edf3ee; --muted: #a3b3a9; --paper: #0e1511; --card: #17201b; --line: #34423a;
  --sel: #9fe3b8; --on-sel: #06210f; --send: #2e7d4f;
  --primary: #9fe3b8; --primary-c: #1f4a32; --on-primary-c: #d3f5e0; --warn: #fbd38d; --warn-c: #4a3510; --surface-2: #222d27;
  --ok-bg: #14532d; --ok-fg: #bbf7d0; --warn-bg: #713f12; --warn-fg: #fde68a; --bad-bg: #7f1d1d; --bad-fg: #fecaca;
  --info-bg: #17284a; --info-fg: #bfd6ff; --banner-bg: #3a2a0c; --banner-fg: #fde68a;
  --green-t: #4ade80; --red-t: #f87171; --amber-t: #fbbf24; --future: #5a6372; --faint: #7c8696; --sel-track: rgba(0,0,0,.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --ink: #edf3ee; --muted: #a3b3a9; --paper: #0e1511; --card: #17201b; --line: #34423a;
    --sel: #9fe3b8; --on-sel: #06210f; --send: #2e7d4f;
    --primary: #9fe3b8; --primary-c: #1f4a32; --on-primary-c: #d3f5e0; --warn: #fbd38d; --warn-c: #4a3510; --surface-2: #222d27;
    --ok-bg: #14532d; --ok-fg: #bbf7d0; --warn-bg: #713f12; --warn-fg: #fde68a; --bad-bg: #7f1d1d; --bad-fg: #fecaca;
    --info-bg: #17284a; --info-fg: #bfd6ff; --banner-bg: #3a2a0c; --banner-fg: #fde68a;
    --green-t: #4ade80; --red-t: #f87171; --amber-t: #fbbf24; --future: #5a6372; --faint: #7c8696; --sel-track: rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.4 var(--font-body); }
body { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 24px); }
#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 10px) 16px 16px; }
#top { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 2px; }
#top h1 { margin: 0; font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
button { font: inherit; color: inherit; cursor: pointer; }
#gear { background: none; border: 0; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; color: var(--ink); }

h3.sec { margin: 20px 6px 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.card { background: var(--card); border-radius: var(--r-l); padding: 14px 16px; margin-top: 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .bold { font-weight: 700; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 0 16px; min-height: 48px; display: inline-flex; align-items: center; border-radius: 24px; font-size: 14px; font-weight: 500; }
.chip.on { background: var(--sel); border-color: var(--sel); color: var(--on-sel); font-weight: 700; }
.btn { width: 100%; margin-top: 8px; padding: 12px; min-height: 48px; border: 0; border-radius: 24px; background: var(--surface-2); font-size: 15px; font-weight: 500; }
.btn.primary { background: var(--sel); color: var(--on-sel); }
.field { display: block; margin-top: 10px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=search], input[type=number], input[type=password], textarea { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); caret-color: var(--green); }

.banner { background: var(--banner-bg); color: var(--banner-fg); border-radius: 16px; padding: 12px 14px; margin-top: 10px; font-size: 13px; }
.banner.info { background: var(--info-bg); color: var(--info-fg); }

/* day summary */
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.rings.small3 { grid-template-columns: repeat(3, 1fr); margin-top: 6px; }
.ring { text-align: center; }
.ring svg { width: 100%; max-width: 150px; height: auto; display: block; margin: 0 auto; }
.rings.small3 .ring svg { max-width: 100px; }
.ring .lbl { font-weight: 700; font-size: 14px; margin-top: 2px; }
.ring .left { font-size: 12px; color: var(--muted); }
.ring .left.over { color: var(--red); }
.barline { margin: 8px 0 4px; }
.barline .top { display: flex; justify-content: space-between; font-size: 13px; }
.bar { height: 9px; border-radius: 5px; background: var(--line); margin-top: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 5px; }

/* calendar */
.calnav { display: flex; align-items: center; justify-content: space-between; }
.calnav button { background: none; border: 0; font-size: 26px; padding: 0 12px; }
.calnav b { font-size: 16px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 6px; }
.cal .wd { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal .day { position: relative; height: 52px; border: 0; background: none; border-radius: 12px; text-align: center; padding-top: 5px; }
.cal .day .n { font-size: 14px; }
.cal .day.today { box-shadow: inset 0 0 0 1.5px var(--ink); font-weight: 700; }
.cal .day.sel { background: var(--sel); color: var(--on-sel); }
.cal .day.future .n { color: var(--future); }
.cal .dot { width: 6px; height: 6px; border-radius: 3px; margin: 3px auto 0; }
.cal .pb { width: 50%; height: 3px; border-radius: 2px; background: var(--line); margin: 3px auto 0; overflow: hidden; }
.cal .day.sel .pb { background: var(--sel-track); }
.cal .pb > i { display: block; height: 100%; background: var(--faint); }
.cal .day.sel .pb > i { background: var(--on-sel); }
.cal .pb > i.hit { background: var(--green) !important; }

.entry { border-top: 1px solid var(--line); padding: 8px 0 2px; margin-top: 8px; }
.entry .meal { font-size: 11px; font-weight: 700; color: var(--muted); }

canvas.chart { width: 100%; height: 200px; display: block; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.stats b { display: block; font-size: 15px; } .stats span { font-size: 10.5px; color: var(--muted); }

.item { border-bottom: 1px solid var(--line); padding: 10px 0 6px; }
.badge { padding: 3px 10px; border-radius: 10px; font-weight: 700; font-size: 12.5px; }

.bubbles { display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 16px; font-size: 14px; background: var(--paper); align-self: flex-start; white-space: pre-wrap; }
.bubble.me { background: var(--ok-bg); color: var(--ok-fg); align-self: flex-end; }
.bubble.err { background: var(--bad-bg); color: var(--bad-fg); }

/* bottom bar */
#voicebar { position: fixed; left: 0; right: 0; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); background: var(--card); padding: 8px 20px; font-size: 13px; font-weight: 700; border-top: 1px solid var(--line); z-index: 5; }
#bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--card); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--line); }
#bar textarea { flex: 1 0 100%; min-height: 46px; resize: none; border-radius: 22px; background: var(--paper); border: 0; max-height: 110px; padding: 11px 16px; font-size: 16px; color: var(--ink); caret-color: var(--green); }
.round { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; flex: none; }
.round.green { background: var(--send); } .round.ink { background: var(--send); } .round.red { background: var(--red); } .round.amber { background: #f59e0b; }

/* settings panel */
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
#panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(92vw, 400px); background: var(--paper); z-index: 21; transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; border-radius: var(--r-l) 0 0 var(--r-l); padding-top: env(safe-area-inset-top); }
#panel.open { transform: none; }
#panelhead { display: flex; align-items: center; gap: 4px; padding: 14px 8px 8px; }
#panelhead h2 { flex: 1; margin: 0; font-size: 20px; }
#panelhead button { background: none; border: 0; font-size: 22px; padding: 6px 14px; }
#panelback { font-size: 30px !important; padding-bottom: 2px !important; }
#panelbody { flex: 1; overflow-y: auto; padding: 0 14px calc(24px + env(safe-area-inset-bottom)); }
.menurow { display: flex; align-items: center; padding: 12px 0; border: 0; background: none; width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.menurow:last-child { border-bottom: 0; }
.menurow .t { font-size: 16px; } .menurow .s { font-size: 12px; color: var(--muted); } .menurow .c { font-size: 24px; color: var(--muted); }

/* profile picker */
.pick { display: block; width: 100%; text-align: left; font-size: 18px; font-weight: 700; padding: 16px 18px; border: 0; border-radius: 16px; background: var(--card); margin-top: 8px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 30px); transform: translateX(-50%); background: var(--sel); color: var(--on-sel); padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 40; max-width: 90vw; text-align: center; }
[hidden] { display: none !important; }

.entry.tap { cursor: pointer; border-radius: 10px; }
.entry.tap:active, .entry.tap:focus-visible { background: var(--paper); outline: none; }
:focus-visible { outline: 2px solid var(--carb); outline-offset: 2px; }

/* sheet: entry menu and edit form */
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheetcard { background: var(--card); width: min(100%, 520px); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.sheettitle { font-weight: 700; font-size: 16px; margin: 0 4px 8px; word-break: break-word; }
.menuitem { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px 6px; font-size: 16px; border-top: 1px solid var(--line); }
.menuitem.danger { color: var(--red-t); }

/* photo bubble, day explorer, analytics */
.round.soft { background: var(--paper); color: var(--ink); }
body.noscroll { overflow: hidden; }
#daypage { position: fixed; inset: 0; z-index: 30; background: var(--paper); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dphead { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; border-bottom: 1px solid var(--line); }
.dphead .grow { min-width: 0; } .dphead b { font-size: 16px; }
.dpbtn { border: 0; background: var(--card); color: var(--ink); width: 40px; height: 40px; border-radius: 20px; font-size: 20px; flex: none; }
.dpbtn:disabled { opacity: .35; }
.dpbody { max-width: 560px; margin: 0 auto; padding: 4px 16px calc(40px + env(safe-area-inset-bottom)); }
.cmp { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cmp:first-of-type { border-top: 0; } .cmp .muted { flex: 1 1 110px; } .cmp b { flex: none; }
.delta { font-size: 12px; color: var(--muted); } .delta.good { color: var(--green-t); font-weight: 700; } .delta.bad { color: var(--red-t); font-weight: 700; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); }
.stack i { display: block; height: 100%; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar.thin { height: 5px; margin-top: 6px; }
.hl { padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; } .hl:first-child { border-top: 0; }
.msg { padding: 6px 0; border-top: 1px solid var(--line); } .msg:first-child { border-top: 0; } .msg.bot { color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--paper); border-radius: 14px; padding: 10px 12px; } .tile b { display: block; font-size: 20px; margin: 2px 0; }
.squares { display: flex; flex-wrap: wrap; gap: 4px; }
.sq { width: 14px; height: 14px; border: 0; border-radius: 4px; padding: 0; }
.vbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.vb { text-align: center; } .vbc { position: relative; height: 90px; background: var(--paper); border-radius: 8px; overflow: hidden; display: flex; align-items: flex-end; }
.vbc i { display: block; width: 100%; } .vbc u { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed var(--ink); opacity: .5; text-decoration: none; }
.vbv { font-size: 10px; min-height: 14px; } .vbl { color: var(--muted); }

/* day header, two rings and three bars, quick add, meals */
.dayhead { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.dayhead .arrow { width: 48px; height: 48px; border: 0; background: none; font-size: 32px; line-height: 1; color: var(--ink); border-radius: 24px; }
.dayhead .arrow:disabled { color: var(--future); }
.dayhead .daytitle { flex: 1; border: 0; background: none; font-weight: 700; font-size: 16px; text-align: center; padding: 10px 0; color: var(--ink); }
.rings2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.ring2 { text-align: center; }
.ring2 svg { width: 100%; max-width: 150px; height: auto; display: block; margin: 0 auto; }
.ringcap { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bl { margin-top: 12px; }
.bl .top { display: flex; justify-content: space-between; font-size: 13px; }
.bl .bar { height: 8px; }
.cap { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.banner.info { background: #e3efe6; color: #1f5133; }
:root[data-theme="dark"] .banner.info { background: #1f3b2e; color: #bbf7d0; }

/* more colour */
.ring2.kcal svg circle:nth-child(2) { filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--kcal) 45%, transparent)); }
.ring2.protein svg circle:nth-child(2) { filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--prot) 45%, transparent)); }
.ringcap { font-weight: 600; }
.bl .lab { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.bl .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bar.tint { background: color-mix(in srgb, var(--c, var(--line)) 16%, var(--card)); }
.card.accent { border-left: 5px solid var(--ac); padding-left: 14px; }
.mealhead { align-items: flex-start; }
.mealdot { width: 12px; height: 12px; border-radius: 50%; margin: 5px 6px 0 0; flex: none; }
.mealhead .kc { font-size: 16px; }
.macs { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-top: 2px; }
.mac { font-weight: 700; font-size: 12px; }
.chip.q { background: color-mix(in srgb, var(--green) 16%, var(--card)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); }
.chip.fav { background: color-mix(in srgb, var(--carb) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--carb) 30%, transparent); }
.chip.bat { background: color-mix(in srgb, var(--fibre) 18%, var(--card)); border: 1px solid color-mix(in srgb, var(--fibre) 35%, transparent); }
h3.sec { color: var(--ink); opacity: .7; }
.cap { color: var(--green-t); }
.card { box-shadow: 0 1px 2px rgba(20, 32, 26, .05); }
.chips { -webkit-overflow-scrolling: touch; }
.dayhead .daytitle { font-size: 17px; }
.item .row b.grow { overflow-wrap: anywhere; }
.entry .row b { overflow-wrap: anywhere; }
.tile b { overflow-wrap: anywhere; }

/* tabs */
.tabs { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin: 6px -16px 0; padding: 6px 16px 0; background: var(--paper); border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 11px 0 9px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; border-radius: 0; }
.tab.on { color: var(--ink); border-bottom-color: var(--tc, var(--ink)); }
.tiles .tile:nth-child(1) { background: color-mix(in srgb, var(--kcal) 12%, var(--card)); } .tiles .tile:nth-child(1) b { color: var(--kcal); }
.tiles .tile:nth-child(2) { background: color-mix(in srgb, var(--prot) 12%, var(--card)); } .tiles .tile:nth-child(2) b { color: var(--prot); }
.tiles .tile:nth-child(3) { background: color-mix(in srgb, var(--carb) 12%, var(--card)); } .tiles .tile:nth-child(3) b { color: var(--carb); }
.tiles .tile:nth-child(4) { background: color-mix(in srgb, var(--fibre) 14%, var(--card)); } .tiles .tile:nth-child(4) b { color: var(--fibre); }

/* ---------- new Today screen ---------- */
.dayhead2 { padding: 8px 4px 0; }
.daytitle2 { background: none; border: 0; padding: 0; text-align: left; font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: -.01em; line-height: 1.1; color: var(--ink); min-height: 48px; }
.daytitle2 small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 14px; color: var(--muted); letter-spacing: 0; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 8px 0 16px; }
.week .day { min-height: 56px; border: 0; background: none; border-radius: var(--r-m); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); }
.week .day b { font-size: 16px; color: var(--ink); font-weight: 700; }
.week .day i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.week .day.done i { background: var(--green); }
.week .day[aria-pressed="true"] { background: var(--primary); color: var(--on-sel); }
.week .day[aria-pressed="true"] b { color: var(--on-sel); }
.week .day[aria-pressed="true"] i { background: var(--on-sel); }
.week .day:disabled { opacity: .5; cursor: default; }
.hero { background: var(--primary-c); color: var(--on-primary-c); border-radius: var(--r-xl) var(--r-xl) var(--r-l) var(--r-l); padding: 20px 24px 16px; }
.hero-top { display: flex; gap: 16px; align-items: stretch; }
.hero-num { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.hero .num { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero .num.words { font-size: 28px; line-height: 1.1; letter-spacing: -.01em; }
.hero .unit { font-size: 16px; margin-top: 6px; } .hero .unit.top { font-size: 14px; font-weight: 700; margin: 0 0 6px; }
.hero .sub { font-size: 14px; margin-top: 8px; }
.jug { flex: none; width: 62px; height: 112px; }
.jug .shell { fill: color-mix(in srgb, var(--card) 55%, transparent); stroke: var(--on-primary-c); stroke-width: 2; }
.jug .fill { fill: var(--kcal); transition: y .7s cubic-bezier(.34, 1.4, .5, 1), height .7s cubic-bezier(.34, 1.4, .5, 1); }
.jug .tick { stroke: var(--on-primary-c); stroke-width: 2; opacity: .7; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--on-primary-c) 22%, transparent); }
.trio span { display: block; font-size: 12px; } .trio b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.protein-card { margin-top: 8px; background: var(--primary); color: var(--on-sel); border-radius: var(--r-l) var(--r-l) var(--r-xl) var(--r-xl); padding: 16px 24px 20px; }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.pc-s { padding: 4px 12px; border-radius: 99px; background: color-mix(in srgb, var(--on-sel) 18%, transparent); }
.pc-s.ok { background: var(--on-sel); color: var(--primary); }
.pc-big { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 12px; }
.pc-big b { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pc-big span { font-size: 20px; font-weight: 500; }
.pc-big.words { font-family: var(--font-display); font-weight: 800; font-size: 28px; }
.pc-bar { height: 16px; border-radius: 8px; background: color-mix(in srgb, var(--on-sel) 22%, transparent); overflow: hidden; }
.pc-bar i { display: block; height: 100%; border-radius: 8px; background: var(--on-sel); transition: width .7s cubic-bezier(.34, 1.4, .5, 1); }
.nutrients { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; margin-top: 8px; }
.nutrients h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 20px; }
.nutrients h3 span { font-family: var(--font-body); font-weight: 400; font-size: 14px; color: var(--muted); margin-left: 8px; }
.nut { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; } .nut + .nut { margin-top: 14px; }
.nut .nl { grid-column: 1 / 3; display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 8px; }
.nut .nl > i { width: 12px; height: 12px; border-radius: 4px; flex: none; } .nut .nl > b { flex: 1; font-weight: 700; }
.nut .nv { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; } .nut .nv b { color: var(--ink); font-size: 16px; }
.m3 { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; } .m3 i { display: block; height: 100%; border-radius: 5px; transition: width .7s cubic-bezier(.34, 1.4, .5, 1); }
.nut:not(:has(.ns)) .m3 { grid-column: 1 / 3; }
.ns { font-size: 14px; color: var(--muted); text-align: right; white-space: nowrap; min-width: 92px; line-height: 1; }
.ns.ok { color: var(--green-t); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Check before saving ---------- */
.sheetcard.rv { border-radius: var(--r-xl) var(--r-xl) 0 0; }
.rv-meals { display: flex; gap: 6px; margin-bottom: 12px; } .rv-meals .chip { flex: 1; padding: 0 6px; justify-content: center; }
.rv-item { border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; margin-bottom: 8px; background: var(--paper); }
.rv-item.check { border: 2px solid var(--warn); }
.rv-item .src { display: inline-flex; margin-top: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); }
.rv-item .src.label { background: var(--primary-c); color: var(--on-primary-c); } .rv-item .src.guess { background: var(--warn-c); color: var(--warn); }
.rv-item .rm { width: 48px; height: 48px; margin: -8px -8px 0 0; border-radius: 50%; border: 0; background: none; color: var(--muted); font-size: 20px; }
.rv-amt { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.rv-amt .st { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 22px; font-weight: 700; }
.rv-amt .gv { flex: 1; text-align: center; font-family: var(--font-display); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; } .rv-amt .gv small { font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--muted); }
.rv-nums { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; font-variant-numeric: tabular-nums; } .rv-nums span { color: var(--muted); }
.rv-note { margin-top: 8px; padding: 8px 12px; border-radius: var(--r-s); background: var(--warn-c); color: var(--warn); font-size: 14px; font-weight: 500; }
.rv-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.rv-tot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } .rv-tot b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; } .rv-tot span { font-size: 14px; color: var(--muted); }
.rv-macros { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; font-size: 14px; color: var(--muted); } .rv-macros b { color: var(--ink); }

/* ---------- Progress ---------- */
.pg-title { margin: 8px 4px 12px; font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.check { background: var(--primary-c); color: var(--on-primary-c); border-radius: var(--r-xl) var(--r-xl) var(--r-l) var(--r-l); padding: 24px; }
.check .eyebrow { font-size: 14px; font-weight: 700; }
.check .big { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.check .num { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.check .num.words { font-size: 28px; line-height: 1.1; letter-spacing: -.01em; }
.check .delta { font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 99px; background: var(--card); color: var(--ink); }
.check .unit { font-size: 16px; margin-top: 6px; } .check p { margin: 16px 0 0; font-size: 16px; line-height: 1.5; } .check .fine { font-size: 12px; opacity: .85; margin-top: 8px; }
.check .btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.check .btn { width: auto; margin: 0; min-height: 52px; padding: 0 24px; border-radius: 99px; font-weight: 700; font-size: 16px; }
.check .btn.fill { background: var(--primary); color: var(--on-sel); } .check .btn.tonal { background: color-mix(in srgb, var(--on-primary-c) 14%, transparent); color: var(--on-primary-c); }
.check .conf { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 14px; flex-wrap: wrap; }
.check .dots { display: flex; gap: 4px; } .check .dots i { width: 10px; height: 10px; border-radius: 50%; background: color-mix(in srgb, var(--on-primary-c) 25%, transparent); } .check .dots i.on { background: var(--on-primary-c); }
.check .why { margin-top: 16px; border-top: 1px solid color-mix(in srgb, var(--on-primary-c) 22%, transparent); }
.check .why summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none; }
.check .why summary::-webkit-details-marker { display: none; } .check .why summary::after { content: "+"; font-size: 20px; } .check .why[open] summary::after { content: "–"; }
.check .calc { display: grid; gap: 10px; padding: 4px 0 8px; } .check .calc div { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; } .check .calc b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.check .calc .tot { border-top: 1px solid color-mix(in srgb, var(--on-primary-c) 22%, transparent); padding-top: 10px; }
.check.learn .num { font-size: 28px; line-height: 1.1; letter-spacing: -.01em; }
.check .prog { margin-top: 16px; display: grid; gap: 12px; } .check .prog .l { display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.check .meter { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--on-primary-c) 18%, transparent); overflow: hidden; } .check .meter i { display: block; height: 100%; border-radius: 5px; background: var(--on-primary-c); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 99px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.seg button { min-height: 44px; border-radius: 99px; border: 0; background: none; font-size: 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; box-shadow: 0 0 0 1px var(--line); }
.head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; } .head b { font-family: var(--font-display); font-size: 28px; letter-spacing: -.01em; } .head b.words { font-size: 20px; } .head span { font-size: 14px; color: var(--muted); }
svg.chart { width: 100%; height: auto; display: block; margin-top: 8px; } .chart text { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; } .legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.logw { margin-top: 8px; min-height: 48px; padding: 0 20px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-weight: 500; font-size: 14px; }
.avgrow + .avgrow { margin-top: 16px; } .avgrow .l { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; } .avgrow .l span { color: var(--muted); }
.food-edit-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.sheetcard input, .sheetcard select, .sheetcard textarea { min-width: 0; max-width: 100%; box-sizing: border-box; }
.sheetcard .row > input { flex: 1; width: 0; }
/* body, notes and the daily check */
.tap { cursor: pointer; border-radius: 10px; }
.tap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* scan result and kitchen */
.scan-title { font-size: 20px; font-weight: 700; line-height: 1.25; }
.scan-amountrow { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 14px; }
.scan-amountrow .chip.round { width: 48px; padding: 0; justify-content: center; font-size: 22px; }
.sheetcard input.scan-amount { font-size: 38px; font-weight: 800; text-align: center; width: 130px; background: none; border: 0; padding: 0; }
.scan-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.scan-chips .chip { justify-content: center; padding: 0 6px; white-space: normal; line-height: 1.15; text-align: center; }
.scan-card { background: var(--paper); border-radius: 16px; padding: 12px; margin-top: 12px; }
.scan-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.scan-tiles > div { background: var(--card); border-radius: 12px; padding: 8px; }
.est { font-size: 12px; color: var(--amber-t); margin-top: 8px; }
.est:empty { display: none; }
.scan-details { margin-top: 10px; border-top: 1px solid var(--line); }
.scan-details summary { cursor: pointer; padding: 12px 0; color: var(--muted); font-size: 14px; }
.scan-details[open] summary { color: var(--ink); font-weight: 600; }
.kfield { display: block; margin-top: 10px; min-width: 0; }
.kfield > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; line-height: 1.25; }
.kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 4px; align-items: end; }
.kinput { position: relative; }
.kinput input { padding-right: 38px; }
.kinput em, .kinput .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 13px; color: var(--muted); pointer-events: none; }
.sheetcard input[type=text] { min-height: 46px; font-size: 16px; }
.sheetcard select { width: 100%; min-height: 46px; font: inherit; font-size: 16px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.pantry-item { border-bottom: 1px solid var(--line); padding: 12px 0 8px; }
.pantry-item.out { opacity: .65; }
.pantry-item .est-tag { font-size: 11px; color: var(--amber-t); }
.rep-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rep-row .rep-amt { display: flex; align-items: center; gap: 6px; }
.rep-row .rep-amt input { width: 72px; text-align: center; min-height: 40px; padding: 0 6px; }
.rep-row .rep-amt .chip { min-height: 40px; width: 40px; padding: 0; justify-content: center; font-size: 18px; }
.linkbtn { background: none; border: 0; padding: 6px 0 0; font-size: 13px; color: var(--muted); text-decoration: underline; min-height: 32px; }
#bar #mic { margin-left: auto; }
