@font-face { font-family: 'Jakarta'; src: url('../fonts/PlusJakartaSans.woff2') format('woff2'); font-weight: 400 800; font-display: swap; }
:root {
  --font: 'Jakarta', 'Segoe UI', Roboto, system-ui, sans-serif;
  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --good: #16a34a; --good-bg: #dcfce7; --good2: #65a30d;
  --warn: #d97706; --warn-bg: #fef3c7;
  --bad: #dc2626; --bad-bg: #fee2e2;
  --low: #2563eb; --low-bg: #dbeafe;
  --none: #9aa5a0; --none-bg: transparent;
  --mp: #7c6cf2; --mc: #f2a541; --mf: #ef6f8e;
  --ease: cubic-bezier(.2,.8,.2,1);
  --nav-h: 76px;
}
/* ---------- themes ---------- */
html[data-theme=light] {
  --bg: #f3f6f4; --surface: #ffffff; --surface-2: #eef3f0; --surface-3: #e2eae5; --text: #12201a; --text-2: #56655d; --text-3: #8a978f;
  --outline: #dbe3de; --shadow: 0 1px 2px rgba(16,40,28,.06), 0 6px 24px rgba(16,40,28,.07); --scrim: rgba(10,20,15,.42);
  --primary: #0b8457; --on-primary: #fff; --pc: #cdf3df; --on-pc: #00391f; --hero1: #0b8457; --hero2: #12a86d; --hero-text: #fff;
}
html[data-theme=dark] {
  --bg: #0b100e; --surface: #141b18; --surface-2: #1b2420; --surface-3: #25302b; --text: #e6efe9; --text-2: #9eaca4; --text-3: #6f7d75;
  --outline: #2a3631; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35); --scrim: rgba(0,0,0,.6);
  --primary: #5fd3a0; --on-primary: #003920; --pc: #10432e; --on-pc: #c6f2dc; --hero1: #0d5a3d; --hero2: #117a52; --hero-text: #eafff4;
  --good-bg: rgba(34,197,94,.18); --warn-bg: rgba(245,158,11,.2); --bad-bg: rgba(239,68,68,.2); --low-bg: rgba(59,130,246,.2);
  --good: #4ade80; --good2: #a3e635; --warn: #fbbf24; --bad: #f87171; --low: #60a5fa;
}
html[data-accent=indigo][data-theme=light] { --primary: #4f46e5; --pc: #e0e0ff; --on-pc: #1a1466; --hero1: #4338ca; --hero2: #6366f1; }
html[data-accent=indigo][data-theme=dark] { --primary: #a5b4fc; --on-primary: #1e1b5e; --pc: #2a2a6e; --on-pc: #e0e0ff; --hero1: #312e81; --hero2: #4338ca; }
html[data-accent=saffron][data-theme=light] { --primary: #c2570c; --pc: #ffe2c7; --on-pc: #4a1d00; --hero1: #c2410c; --hero2: #ea7a1c; }
html[data-accent=saffron][data-theme=dark] { --primary: #ffb77a; --on-primary: #4a1d00; --pc: #5a2a06; --on-pc: #ffe2c7; --hero1: #7c2d12; --hero2: #b4480f; }
html[data-accent=rose][data-theme=light] { --primary: #d1336b; --pc: #ffd9e4; --on-pc: #4d0020; --hero1: #be185d; --hero2: #e2457f; }
html[data-accent=rose][data-theme=dark] { --primary: #ff8fb4; --on-primary: #4d0020; --pc: #5c1230; --on-pc: #ffd9e4; --hero1: #831843; --hero2: #b0245c; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.4; }
body { overscroll-behavior-y: none; transition: background .3s; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg { display: block; }
.app { max-width: 600px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding: 0 16px calc(var(--nav-h) + 28px); animation: viewIn .38s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view.slide { animation: slideIn .34s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; background: var(--bg);
  transition: box-shadow .2s; }
.topbar.scrolled { box-shadow: 0 1px 0 var(--outline); }
.topbar .ttl { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.topbar .sub { color: var(--text-2); font-size: 13px; font-weight: 600; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: var(--surface); box-shadow: var(--shadow); transition: transform .15s; }
.iconbtn:active { transform: scale(.92); }
.iconbtn.flat { background: transparent; box-shadow: none; }
.iconbtn svg { width: 22px; height: 22px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 36px; height: 36px; border-radius: 11px; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--nav-h); background: var(--surface); display: flex; justify-content: center;
  box-shadow: 0 -1px 0 var(--outline), 0 -8px 30px rgba(0,0,0,.05); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { display: flex; width: 100%; max-width: 600px; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-2); font-size: 11.5px; font-weight: 700; }
.nav .pill { width: 60px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .25s var(--ease), transform .25s var(--ease); }
.nav svg { width: 23px; height: 23px; }
.nav button.on { color: var(--text); }
.nav button.on .pill { background: var(--pc); color: var(--on-pc); transform: scale(1.04); }
.nav button:active .pill { transform: scale(.9); }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--r-xl); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.flat { box-shadow: none; background: var(--surface-2); }
.card h2 { margin: 0 0 12px; font-size: 17px; font-weight: 800; letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; }
.card h2 .grow { flex: 1; }
.card h2 small { font-size: 12px; color: var(--text-2); font-weight: 600; }
.muted { color: var(--text-2); }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--text-2); font-weight: 700; }
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.stat .v small { font-size: 12px; color: var(--text-2); font-weight: 700; margin-left: 2px; }
.stat .s { font-size: 11.5px; color: var(--text-3); font-weight: 600; margin-top: 2px; }

/* ---------- hero (today summary) ---------- */
.hero { background: linear-gradient(135deg, var(--hero1), var(--hero2)); color: var(--hero-text); border-radius: var(--r-xl); padding: 20px; margin-bottom: 14px;
  position: relative; overflow: hidden; box-shadow: 0 10px 30px -10px var(--hero1); }
.hero::before { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero::after { content: ''; position: absolute; left: -40px; bottom: -80px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero .in { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 150px; height: 150px; flex: none; }
.ring svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.ring .trk { stroke: rgba(255,255,255,.2); }
.ring .bar { stroke: #fff; transition: stroke-dashoffset 1.1s var(--ease); }
.ring .bar.over { stroke: #ffd2cc; }
.ring .ctr { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .big { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1.05; }
.ring .lbl { font-size: 12px; opacity: .85; font-weight: 600; }
.hero .side { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hero .kv .k { font-size: 12px; opacity: .8; font-weight: 600; }
.hero .kv .v { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.scorechip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.16); border-radius: 999px; padding: 5px 12px 5px 5px; font-weight: 700; font-size: 13px; }
.scorechip .g { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--hero1); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
.macro .top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; opacity: .92; }
.macro .trk { height: 7px; border-radius: 4px; background: rgba(255,255,255,.2); margin-top: 6px; overflow: hidden; }
.macro .fill { height: 100%; border-radius: 4px; background: #fff; transition: width 1s var(--ease); }

/* ---------- day strip ---------- */
.datebar { display: flex; align-items: center; gap: 6px; margin: 2px 0 12px; }
.datebar .d { flex: 1; text-align: center; font-weight: 800; font-size: 15px; }
.datebar .d small { display: block; color: var(--text-2); font-weight: 600; font-size: 12px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.week button { background: var(--surface); border-radius: 16px; padding: 8px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: var(--shadow);
  font-weight: 700; transition: transform .15s, background .2s; }
.week button:active { transform: scale(.94); }
.week .wd { font-size: 11px; color: var(--text-2); }
.week .dn { font-size: 16px; }
.week .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.week button.sel { background: var(--primary); color: var(--on-primary); }
.week button.sel .wd { color: inherit; opacity: .85; }
.dot.good, .lg.good { background: var(--good); } .dot.warn, .lg.warn { background: var(--warn); } .dot.bad, .lg.bad { background: var(--bad); } .dot.low, .lg.low { background: var(--low); }
.week button.sel .dot { box-shadow: 0 0 0 2px var(--on-primary); }

/* ---------- log input ---------- */
.logcard textarea { width: 100%; min-height: 84px; resize: none; border: 1.5px solid var(--outline); background: var(--surface-2); border-radius: var(--r-md); padding: 13px 14px;
  outline: none; transition: border .2s, background .2s; line-height: 1.45; }
.logcard textarea:focus { border-color: var(--primary); background: var(--surface); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--outline); font-weight: 700; font-size: 13px; color: var(--text-2); background: var(--surface);
  transition: all .2s; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip.on { background: var(--pc); color: var(--on-pc); border-color: transparent; }
.chip:active { transform: scale(.95); }
.chip.ghost { border-style: dashed; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 800; font-size: 15px;
  background: var(--primary); color: var(--on-primary); transition: transform .15s, opacity .2s, box-shadow .2s; box-shadow: 0 6px 18px -8px var(--primary); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; }
.btn.block { width: 100%; }
.btn.tonal { background: var(--pc); color: var(--on-pc); box-shadow: none; }
.btn.outline { background: transparent; color: var(--primary); border: 1.5px solid var(--outline); box-shadow: none; }
.btn.danger { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.btn.sm { height: 38px; padding: 0 16px; font-size: 13.5px; }
.btn svg { width: 20px; height: 20px; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-lg); background: var(--warn-bg); color: var(--text); margin-bottom: 14px; animation: viewIn .4s var(--ease); }
.banner.info { background: var(--pc); color: var(--on-pc); }
.banner .ic { width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.55); display: grid; place-items: center; flex: none; }
html[data-theme=dark] .banner .ic { background: rgba(0,0,0,.25); }
.banner b { display: block; margin-bottom: 2px; }
.banner a, a.link { color: var(--primary); font-weight: 700; text-decoration: none; }
.srcbadge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.srcbadge.ai { background: linear-gradient(90deg, rgba(124,108,242,.16), rgba(239,111,142,.16)); color: var(--mp); }
.srcbadge.offline { background: var(--low-bg); color: var(--low); }
.srcbadge.estimate { background: var(--warn-bg); color: var(--warn); }

/* ---------- day table ---------- */
.tablewrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; scrollbar-width: thin; }
table.day { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 470px; font-size: 14px; }
table.day th { text-align: right; font-size: 11.5px; color: var(--text-2); font-weight: 800; padding: 6px 8px 8px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
table.day th:first-child, table.day td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.day td { padding: 10px 8px; text-align: right; border-top: 1px solid var(--outline); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.day td.food { white-space: normal; min-width: 150px; max-width: 190px; font-weight: 700; }
table.day td.food .q { display: block; font-weight: 600; color: var(--text-2); font-size: 12.5px; margin-top: 1px; }
table.day td.kc { font-weight: 800; }
table.day tr.it { cursor: pointer; transition: background .15s; }
table.day tr.it:active td { background: var(--surface-2); }
table.day tr.meal td { background: var(--surface-2); border-top: 0; padding: 9px 8px; font-weight: 800; }
table.day tr.meal td:first-child { border-radius: 12px 0 0 12px; background: var(--surface-2); }
table.day tr.meal td:last-child { border-radius: 0 12px 12px 0; }
table.day tr.meal .mi { display: inline-flex; align-items: center; gap: 8px; }
table.day tr.meal .mi span.e { font-size: 16px; }
table.day tr.spacer td { border: 0; padding: 4px; }
table.day tr.total td { border-top: 2px solid var(--text); font-weight: 800; font-size: 15px; padding-top: 12px; }
table.day tr.tgt td { border-top: 0; color: var(--text-2); font-weight: 700; padding-top: 4px; padding-bottom: 4px; }
table.day tr.rem td { border-top: 0; font-weight: 800; padding-top: 4px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.cp { color: var(--mp); } .cc { color: var(--mc); } .cf { color: var(--mf); }
.empty { text-align: center; padding: 26px 10px 16px; color: var(--text-2); }
.empty .art { font-size: 46px; margin-bottom: 6px; }
.empty b { color: var(--text); display: block; font-size: 16px; margin-bottom: 4px; }
.note { font-size: 12px; color: var(--text-3); text-align: center; margin: 6px 12px 0; }

/* ---------- sheets / dialogs ---------- */
.scrim { position: fixed; background: var(--scrim); z-index: 50; opacity: 0; transition: opacity .25s; }
.scrim.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-width: 600px; margin: 0 auto; background: var(--surface); border-radius: 28px 28px 0 0;
  max-height: 92vh; display: flex; flex-direction: column; transform: translateY(105%); transition: transform .34s var(--ease); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet.show { transform: none; }
.sheet .grab { width: 36px; height: 4px; background: var(--outline); border-radius: 2px; margin: 10px auto 4px; flex: none; }
.sheet .hd { padding: 6px 20px 10px; display: flex; align-items: center; gap: 10px; flex: none; }
.sheet .hd h3 { margin: 0; font-size: 19px; font-weight: 800; flex: 1; }
.sheet .bd { padding: 0 20px 8px; overflow-y: auto; flex: 1; }
.sheet .ft { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--outline); flex: none; display: flex; gap: 10px; align-items: center; }
.dialog { position: fixed; z-index: 52; left: 20px; right: 20px; top: 50%; max-width: 420px; margin: 0 auto; background: var(--surface); border-radius: 28px; padding: 24px;
  transform: translateY(-46%) scale(.94); opacity: 0; transition: all .25s var(--ease); box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 86vh; overflow-y: auto; }
.dialog.show { transform: translateY(-50%) scale(1); opacity: 1; }
.dialog h3 { margin: 0 0 8px; font-size: 21px; font-weight: 800; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* preview items */
.pitem { border: 1.5px solid var(--outline); border-radius: var(--r-lg); padding: 12px 12px 12px 14px; margin-bottom: 10px; animation: popIn .35s var(--ease) both; background: var(--surface); }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.pitem .top { display: flex; align-items: flex-start; gap: 8px; }
.pitem input.name { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 800; font-size: 16px; padding: 4px 0; outline: none; border-bottom: 1.5px dashed transparent; }
.pitem input.name:focus { border-bottom-color: var(--primary); }
.pitem .kc { font-weight: 800; font-size: 17px; white-space: nowrap; padding-top: 3px; }
.pitem .kc small { font-size: 12px; color: var(--text-2); }
.pitem .mid { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 700; color: var(--primary); }
.stepper button:active { background: var(--surface-3); }
.stepper input { width: 46px; text-align: center; border: 0; background: transparent; font-weight: 800; outline: none; }
.stepper .u { font-size: 13px; color: var(--text-2); font-weight: 700; padding-right: 10px; }
select.mini { border: 1.5px solid var(--outline); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: 13px; outline: none; }
.pitem .mac { display: flex; gap: 12px; margin-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); flex-wrap: wrap; align-items: center; }
.pitem .del { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); flex: none; }
.pitem .del:active { background: var(--bad-bg); color: var(--bad); }
.pitem .nt { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.pitem.busy { opacity: .55; pointer-events: none; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 800; color: var(--text-2); margin: 0 0 6px 4px; }
.input { width: 100%; height: 50px; border-radius: var(--r-md); border: 1.5px solid var(--outline); background: var(--surface-2); padding: 0 14px; outline: none; font-weight: 600; transition: border .2s; }
.input:focus { border-color: var(--primary); background: var(--surface); }
.inrow { display: flex; gap: 10px; }
.inrow > * { flex: 1; min-width: 0; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 38px; border-radius: 999px; font-weight: 800; font-size: 13.5px; color: var(--text-2); transition: all .25s var(--ease); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
html[data-theme=dark] .seg button.on { background: var(--surface-3); }
input[type=range] { width: 100%; accent-color: var(--primary); }
.list .li { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-top: 1px solid var(--outline); }
.list .li:first-child { border-top: 0; }
.list .li .ic { width: 40px; height: 40px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--primary); }
.list .li .ic svg { width: 21px; height: 21px; }
.list .li .t { font-weight: 700; }
.list .li .s { font-size: 12.5px; color: var(--text-2); }
.list .li.tap:active { background: var(--surface-2); }

/* ---------- calendar ---------- */
.calhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.calhead .m { flex: 1; text-align: center; font-weight: 800; font-size: 18px; }
.calwrap { overflow: hidden; touch-action: pan-y; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; transition: transform .3s var(--ease), opacity .3s; }
.calgrid.out-l { transform: translateX(-40%); opacity: 0; } .calgrid.out-r { transform: translateX(40%); opacity: 0; }
.calgrid.in-l { animation: calInL .32s var(--ease); } .calgrid.in-r { animation: calInR .32s var(--ease); }
@keyframes calInL { from { transform: translateX(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes calInR { from { transform: translateX(-40%); opacity: 0; } to { transform: none; opacity: 1; } }
.calgrid .wd { text-align: center; font-size: 11.5px; font-weight: 800; color: var(--text-3); padding: 4px 0; }
.cell { aspect-ratio: .82; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6px 2px 5px;
  background: var(--surface-2); font-weight: 800; position: relative; transition: transform .15s; min-height: 50px; }
.cell:active { transform: scale(.92); }
.cell .n { font-size: 14px; }
.cell .kc { font-size: 10.5px; font-weight: 800; letter-spacing: -.2px; }
.cell .gr { position: absolute; top: 3px; right: 4px; font-size: 9px; opacity: .8; }
.cell.blank { background: transparent; pointer-events: none; }
.cell.future { opacity: .4; }
.cell.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cell.good { background: var(--good-bg); color: var(--good); } .cell.warn { background: var(--warn-bg); color: var(--warn); }
.cell.bad { background: var(--bad-bg); color: var(--bad); } .cell.low { background: var(--low-bg); color: var(--low); }
.cell.good .n, .cell.warn .n, .cell.bad .n, .cell.low .n { color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 4px; display: inline-block; background: var(--surface-3); }
.streaks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.streak { border-radius: var(--r-lg); padding: 14px; background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.streak .e { font-size: 24px; }
.streak .v { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.streak .v small { font-size: 13px; color: var(--text-2); letter-spacing: 0; }
.streak .k { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.streak .b { font-size: 11.5px; color: var(--text-3); font-weight: 700; margin-top: 2px; }
.streak.fire { background: linear-gradient(140deg, #ff8a3d, #ff5f6d); color: #fff; }
.streak.fire .k, .streak.fire .b, .streak.fire .v small { color: rgba(255,255,255,.85); }
.streak.tgt { background: linear-gradient(140deg, #19b36b, #0f8f8a); color: #fff; }
.streak.tgt .k, .streak.tgt .b, .streak.tgt .v small { color: rgba(255,255,255,.85); }

/* history list */
.hday { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--surface); border-radius: var(--r-lg); margin-bottom: 10px; box-shadow: var(--shadow);
  animation: popIn .35s var(--ease) both; }
.hday:active { transform: scale(.985); }
.gbadge { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.gbadge.good { background: var(--good-bg); color: var(--good); } .gbadge.good2 { background: var(--good-bg); color: var(--good2); }
.gbadge.warn { background: var(--warn-bg); color: var(--warn); } .gbadge.bad { background: var(--bad-bg); color: var(--bad); } .gbadge.none { background: var(--surface-2); color: var(--text-3); }
.gbadge small { display: block; font-size: 9.5px; font-weight: 700; margin-top: -3px; opacity: .8; text-align: center; }
.hday .t { font-weight: 800; }
.hday .s { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.mini-trk { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 7px; overflow: hidden; position: relative; }
.mini-trk i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.mini-trk i.good { background: var(--good); } .mini-trk i.warn { background: var(--warn); } .mini-trk i.bad { background: var(--bad); } .mini-trk i.low { background: var(--low); }
.hday .kc { text-align: right; font-weight: 800; font-size: 16px; }
.hday .kc small { display: block; font-size: 11.5px; color: var(--text-2); font-weight: 700; }

/* day detail score panel */
.scorepanel { display: flex; gap: 16px; align-items: center; }
.bigscore { width: 92px; height: 92px; position: relative; flex: none; }
.bigscore svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.bigscore .c { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bigscore .g { font-size: 28px; font-weight: 800; line-height: 1; }
.bigscore .sn { font-size: 12px; font-weight: 700; color: var(--text-2); }
.sbars .r { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.sbars .r .l { width: 76px; color: var(--text-2); }
.sbars .trk { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.sbars .trk i { display: block; height: 100%; border-radius: 4px; background: var(--primary); transition: width 1s var(--ease); }

/* charts */
.chart { width: 100%; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--text-3); font-weight: 700; }
.chart .bar { transition: opacity .2s; }
.chart .grid { stroke: var(--outline); stroke-width: 1; }
.chart .tline { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .6; }
.chart .wline { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .gline { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 6 5; }
.chart .pt { fill: var(--surface); stroke: var(--primary); stroke-width: 2.5; }
.drawline { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.growbar { transform-origin: bottom; transform-box: fill-box; animation: growY .7s var(--ease) both; }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.donutwrap { display: flex; align-items: center; gap: 18px; }
.donutwrap svg { width: 120px; height: 120px; flex: none; transform: rotate(-90deg); }
.lgd .r { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; margin: 6px 0; }
.lgd .r i { width: 12px; height: 12px; border-radius: 4px; }
.lgd .r span { color: var(--text-2); margin-left: auto; padding-left: 12px; }

/* weight */
.wprog { height: 12px; background: var(--surface-3); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.wprog i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), var(--good)); transition: width 1.2s var(--ease); }
.bmigauge { position: relative; height: 12px; border-radius: 6px; margin: 16px 0 6px;
  background: linear-gradient(90deg, #60a5fa 0%, #60a5fa 14%, #22c55e 14%, #22c55e 40%, #f59e0b 40%, #f59e0b 60%, #ef4444 60%, #ef4444 100%); }
.bmigauge .mk { position: absolute; top: -6px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--surface); border: 4px solid var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.25); transition: left 1s var(--ease); }
.bmiscale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.pill-s { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.pill-s.good { background: var(--good-bg); color: var(--good); } .pill-s.warn { background: var(--warn-bg); color: var(--warn); }
.pill-s.bad { background: var(--bad-bg); color: var(--bad); } .pill-s.low { background: var(--low-bg); color: var(--low); }
.avatar { width: 64px; height: 64px; border-radius: 22px; background: linear-gradient(135deg, var(--hero1), var(--hero2)); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; flex: none; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-weight: 700; font-size: 14px; z-index: 80; opacity: 0; transition: all .3s var(--ease); max-width: 88vw; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.welcome-art { width: 88px; height: 88px; border-radius: 26px; margin: 0 auto 14px; display: block; box-shadow: 0 12px 30px -10px var(--primary); }
.steps .st { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; }
.steps .st .n { width: 28px; height: 28px; border-radius: 50%; background: var(--pc); color: var(--on-pc); display: grid; place-items: center; font-weight: 800; flex: none; font-size: 13px; }
.sect { font-size: 13px; font-weight: 800; color: var(--text-2); margin: 20px 4px 10px; text-transform: uppercase; letter-spacing: .6px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.6px; margin-top: 4px; }
.kpi .v small { font-size: 12px; color: var(--text-2); letter-spacing: 0; margin-left: 2px; }
.kpi .s { font-size: 12px; color: var(--text-3); font-weight: 700; }
.topfood { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--outline); font-size: 14px; }
.topfood:first-child { border-top: 0; }
.topfood .rk { width: 26px; height: 26px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: 12px; color: var(--text-2); }
.topfood b { font-weight: 800; }
.mealbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 6px 0 10px; }
.mealbar i { display: block; height: 100%; }
/* icon sizing */
.card h2 svg { width: 20px; height: 20px; color: var(--primary); flex: none; }
.card h2 .srcbadge svg { width: 12px; height: 12px; color: inherit; }
.banner .ic svg { width: 20px; height: 20px; }
.srcbadge svg { width: 12px; height: 12px; flex: none; }
.list .li > svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.chip svg { width: 14px; height: 14px; }
.ring .ctr, .scrim, .bigscore .c { top: 0; left: 0; right: 0; bottom: 0; }
.scorechip.prog .g { background: rgba(255,255,255,.9); }
/* compact day table so all columns fit on a ~360-412px phone; still scrolls if needed */
table.day { min-width: 330px; font-size: 13.5px; }
table.day th { padding: 6px 5px 8px; font-size: 11px; letter-spacing: .2px; }
table.day th small { display: block; font-size: 9.5px; opacity: .8; text-transform: none; }
table.day td { padding: 9px 5px; }
table.day td.food { min-width: 112px; max-width: 150px; }
table.day tr.meal td { padding: 9px 5px; }

/* today, still in progress: neutral tint instead of a verdict */
.cell.prog { background: var(--surface-2); color: var(--text-2); background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--primary) 9%, transparent) 6px 12px); }
.mini-trk i.prog { background: var(--primary); opacity: .55; }

/* confidence markers */
.srcbadge.est { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
table.day td .q b.estc { color: var(--warn); font-weight: 800; }
table.day td .q b.lowc { color: var(--bad); font-weight: 800; }
.pitem .nt { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.35; }
