/* ---------- tokens ---------- */
:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --sunken: #f1f1ee;
  --text: #141414;
  --text-2: #4a4a4f;
  --muted: #8b8b92;
  --line: #ebebe7;
  --line-2: #dcdcd7;
  --accent: #157a50;
  --accent-soft: #e7f4ed;
  --on-accent: #ffffff;
  --warn: #d4570f;
  --warn-soft: #fdf0e7;
  --danger: #d92d20;
  --p: #4f6bed; --c: #e0a106; --f: #d9547c;
  --l0: #ecece8; --l1: #cde8da; --l2: #8fcbad; --l3: #3fa275; --l4: #157a50;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 2px 8px -2px rgba(20, 20, 20, .05);
  --shadow-lg: 0 -8px 40px -8px rgba(20, 20, 20, .25);
  --r: 20px;
  --max: 640px;
  --bnav: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0b;
    --card: #161817;
    --sunken: #1e201f;
    --text: #f3f3f1;
    --text-2: #bdbdb8;
    --muted: #82847f;
    --line: #242725;
    --line-2: #333734;
    --accent: #4ed39a;
    --accent-soft: #14291e;
    --on-accent: #04130b;
    --warn: #fb923c;
    --warn-soft: #2c1d12;
    --danger: #f87171;
    --p: #8196ff; --c: #f5c542; --f: #f17ea0;
    --l0: #1f2220; --l1: #173a2a; --l2: #1f6447; --l3: #2f9a6b; --l4: #4ed39a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 -8px 40px -8px rgba(0, 0, 0, .7);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
body.noscroll { overflow: hidden; }
h1, h3, h4 { margin: 0; letter-spacing: -.02em; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
small { font-size: 13px; }
b, time, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 13px; }
svg { flex: none; }
button { font: inherit; color: inherit; }

/* ---------- header & nav ---------- */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); }
.top-in { max-width: 960px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.mark {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: var(--accent) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M10 21c0-6 4-10 12-11-1 8-5 12-11 12' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round'/></svg>") center / contain no-repeat;
}
.mark.big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 20px; }
.tabs { display: flex; gap: 4px; margin: 0 auto; background: var(--sunken); padding: 4px; border-radius: 12px; }
.tab { border: 0; background: none; padding: 7px 16px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); transition: color .15s, background .15s; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.avatar {
  position: relative; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 15px; display: grid; place-items: center;
}
.avatar.on { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 5px var(--accent); }
.avatar::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--bg); background: transparent; }
.avatar[data-sync="ok"]::after { background: var(--accent); }
.avatar[data-sync="pending"]::after, .avatar[data-sync="syncing"]::after { background: var(--c); }
.avatar[data-sync="error"]::after { background: var(--danger); }
.avatar.lg { width: 48px; height: 48px; font-size: 19px; cursor: default; }
.avatar.lg::after { display: none; }

.bnav { display: none; }
main { max-width: var(--max); margin: 0 auto; padding: 12px 20px 120px; }

/* ---------- page header ---------- */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 14px 0 18px; }
.phead h1 { font-size: 30px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.pnav { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, transform .1s; flex: none;
}
.icon-btn:hover { background: var(--sunken); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); }
.icon-btn.sm:hover { background: var(--sunken); color: var(--danger); }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.chead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.note { margin: 14px 0 0; color: var(--text-2); font-size: 13.5px; }
.note b { color: var(--text); }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--sunken); color: var(--text-2); }
.pill.good { background: var(--accent-soft); color: var(--accent); }
.empty-line { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 8px; margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; cursor: pointer; font-size: 14.5px; font-weight: 600;
  transition: opacity .15s, transform .1s; white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--sunken); opacity: 1; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; padding: 14px; font-size: 15px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 500; padding: 12px; display: block; margin: 8px auto 0; }
.link:hover { color: var(--text); }
.link.danger:hover { color: var(--danger); }
.addbtn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px; margin-top: 4px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r); background: transparent; color: var(--text-2); font-weight: 600; font-size: 15px; cursor: pointer; transition: all .15s;
}
.addbtn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.addbtn.in { margin-top: 12px; border-radius: 14px; padding: 12px; }

/* inputs */
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--sunken); border: 1px solid transparent;
  border-radius: 12px; padding: 11px 14px; transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; background: var(--card); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b92' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
textarea { resize: vertical; }
input[type="number"]::-webkit-inner-spin-button { display: none; }
.field { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 14px; }
.field > input, .field > select, .field > textarea, .field > .unit, .field > .seg, .field > .two { margin-top: 6px; }
.field small { font-weight: 400; color: var(--muted); }
.unit { position: relative; display: flex; align-items: center; }
.unit > span { position: absolute; right: 14px; color: var(--muted); font-weight: 500; font-size: 14px; pointer-events: none; }
.unit input { padding-right: 40px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.four .field { margin-bottom: 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--sunken); padding: 4px; border-radius: 12px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; }
.seg span { display: block; text-align: center; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 14px; }
.seg input:checked + span { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.err { color: var(--danger); font-size: 14px; margin: -4px 0 14px; }

/* ---------- login ---------- */
#app.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 20px; }
.login { width: 100%; max-width: 380px; text-align: center; }
.login h1 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.login .sub { margin-bottom: 26px; }
.login .card { text-align: left; padding: 22px; }
.login .card p { margin: 0 0 16px; color: var(--text-2); }

/* ---------- today ---------- */
.setup { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; cursor: pointer; background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.setup span { display: flex; flex-direction: column; gap: 2px; }
.setup b { font-size: 15px; }
.setup small { color: var(--text-2); }
.weigh { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.weigh > div { display: flex; flex-direction: column; }
.weigh small { color: var(--muted); }
.unit.lg { width: 130px; }
.unit.lg input { font-size: 22px; font-weight: 700; text-align: right; padding: 8px 40px 8px 12px; }

.hero { display: flex; align-items: center; gap: 22px; padding: 20px; }
.ringwrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .trk { stroke: var(--l0); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .5s cubic-bezier(.3, .8, .3, 1); }
.ring .val.over { stroke: var(--warn); }
.ringtxt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ringtxt b { font-size: 28px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.ringtxt small { color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 4px; }
.herostats { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 11px; }
.hs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 2px; }
.hs small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.hs b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.mbh { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 5px; }
.mbh b { color: var(--text); font-weight: 600; }
.mbt { height: 6px; border-radius: 9px; background: var(--l0); overflow: hidden; }
.mbt i { display: block; height: 100%; border-radius: 9px; background: var(--accent); transition: width .4s; }
.mb.p .mbt i { background: var(--p); } .mb.c .mbt i { background: var(--c); } .mb.f .mbt i { background: var(--f); }
.mbt.big { height: 8px; margin: 12px 0 6px; }
.mbt i.over { background: var(--warn); }

.group { margin-top: 22px; }
.ghead { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px 8px; }
.ghead span { font-size: 13px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.card.list, .list { padding: 4px 0; }
.card.list { padding: 4px 6px; }
.item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 10px; border-radius: 14px; cursor: pointer;
  background: none; border: 0; text-align: left; transition: background .12s; position: relative; margin: 0;
}
.item + .item::before { content: ''; position: absolute; top: 0; left: 54px; right: 10px; border-top: 1px solid var(--line); }
.item:hover { background: var(--sunken); }
.item.static { cursor: default; }
.item.static:hover { background: none; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-main b { font-weight: 600; font-size: 15px; transition: color .15s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item > input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.tick {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center;
  color: transparent; transition: all .18s cubic-bezier(.3, .8, .3, 1.4);
}
.tick svg { width: 15px; height: 15px; stroke-width: 3; }
.item:hover .tick { border-color: var(--accent); }
.item input:checked + .tick { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: scale(1.05); }
.item input:checked ~ .item-main b { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.item input:focus-visible + .tick { outline: 2px solid var(--accent); outline-offset: 2px; }
.item.late input:not(:checked) + .tick { border-color: var(--warn); }
.item.late input:not(:checked) ~ .item-main small { color: var(--warn); }
.chip-daily { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 500; flex: none; }
.chip-daily.wide { background: var(--sunken); padding: 4px 8px; border-radius: 8px; }
.chev { color: var(--line-2); display: grid; }
.card.empty { text-align: center; padding: 30px 20px; margin-top: 22px; }
.card.empty b { font-size: 16px; }
.card.empty p { color: var(--muted); margin: 6px 0 16px; }

/* ---------- plan ---------- */
.wsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; overflow: hidden; }
.ws { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; margin: 0; min-width: 0; }
.ws + .ws { border-left: 1px solid var(--line); }
.ws small { font-size: 12px; color: var(--muted); font-weight: 500; }
.ws b { font-size: 21px; font-weight: 700; letter-spacing: -.03em; }
.ws > span:last-child:not(.unit) { font-size: 12px; color: var(--muted); }
.ws .unit input { font-size: 21px; font-weight: 700; letter-spacing: -.03em; padding: 0 30px 0 0; background: none; border: 0; border-bottom: 1.5px dashed var(--line-2); border-radius: 0; box-shadow: none; }
.ws .unit > span { right: 0; }
.dpills { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 18px 0 12px; }
.dpill {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 0 8px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; transition: all .15s;
}
.dpill small { font-size: 11px; color: var(--muted); font-weight: 600; }
.dpill b { font-size: 17px; font-weight: 700; }
.dpill span { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.dpill span.ok { color: var(--accent); }
.dpill span.off { color: var(--warn); }
.dpill.is-today { border-color: var(--accent); }
.dpill.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.dpill.on small, .dpill.on span { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.dhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.dhead h3 { font-size: 20px; font-weight: 700; }
.dhead small { color: var(--muted); }
.dtot { font-size: 14px; color: var(--muted); font-weight: 500; }
.dtot b { color: var(--text); font-size: 17px; }
.dtot.over b { color: var(--warn); }
.dayplan .list { margin: 4px -8px 0; }
.dayplan .item { padding: 10px 8px; }
.dayplan .item + .item::before { left: 8px; right: 8px; }
.item.daily { opacity: .7; }
.time, .time-in { width: 70px; flex: none; font-size: 14px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.time-in { background: none; padding: 6px 0; border-radius: 6px; }
.time-in::-webkit-calendar-picker-indicator { display: none; }
.time-in:hover { background: var(--sunken); }
.copyrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.copyrow > span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; margin-right: 4px; }
.chip { border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--text); }

/* ---------- meals ---------- */
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; margin-bottom: 12px; color: var(--muted); }
.search input { background: none; border: 0; padding: 12px 0; box-shadow: none; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.tip { margin-top: 18px; padding: 16px 18px; border-radius: var(--r); background: var(--sunken); color: var(--text-2); font-size: 14px; }
.tip b { color: var(--text); }
.bignut { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.bignut div { background: var(--sunken); border-radius: 14px; padding: 12px 8px; text-align: center; }
.bignut b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.03em; }
.bignut small { color: var(--muted); font-size: 12px; }
.bignut div:first-child { background: var(--accent-soft); }
.bignut div:first-child b { color: var(--accent); }
.dailynote { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 14px; margin: 0 0 14px; }
.ing { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0 16px; }
.ing th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 6px 4px; }
.ing td { padding: 9px 4px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ing td small { display: block; color: var(--muted); font-size: 12px; }
.ing th:not(:first-child), .ing td:not(:first-child) { text-align: right; width: 44px; }

/* ---------- progress ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { margin: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi small { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi b { font-size: 26px; font-weight: 700; letter-spacing: -.04em; line-height: 1.15; }
.kpi b span { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.kpi em.good { color: var(--accent); font-weight: 600; }
.kpi em svg { color: var(--warn); }
.wchart { width: 100%; height: auto; display: block; overflow: visible; }
.wchart polyline { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; }
.wchart circle { fill: var(--card); stroke: var(--accent); stroke-width: 3; }
.wchart text { fill: var(--text-2); font: 600 17px Inter, sans-serif; text-anchor: middle; }
.wchart text.d { fill: var(--muted); font-weight: 500; font-size: 15px; }
.cbars { position: relative; display: flex; gap: 5px; height: 150px; }
.cbars > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.cbars .bar { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.cbars .bar::after { content: ''; position: absolute; left: -3px; right: -3px; bottom: var(--t); border-top: 1.5px dashed var(--text-2); opacity: .35; }
.cbars i { width: 100%; max-width: 22px; min-height: 3px; border-radius: 6px; background: var(--accent); }
.cbars i.over { background: var(--warn); }
.cbars i.under { background: var(--accent); opacity: .4; }
.cbars i.nil { background: var(--l0); }
.cbars small { font-size: 11px; color: var(--muted); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.legend i.over { background: var(--warn); }
.legend i.under { background: var(--accent); opacity: .4; }
.legend i.line { height: 0; width: 14px; border-top: 1.5px dashed var(--text-2); border-radius: 0; background: none; opacity: .6; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 4px; display: block; }
.heat i.future { background: transparent; }
.heat i.none { opacity: .5; }
.lv0 { background: var(--l0); } .lv1 { background: var(--l1); } .lv2 { background: var(--l2); } .lv3 { background: var(--l3); } .lv4 { background: var(--l4); }
.mini-meter { width: 70px; height: 6px; background: var(--l0); border-radius: 9px; overflow: hidden; flex: none; }
.mini-meter i { display: block; height: 100%; background: var(--warn); border-radius: 9px; }

/* ---------- account ---------- */
.acct { display: flex; align-items: center; gap: 14px; }
.acct-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acct-main b { font-size: 17px; }
.acct-main small { color: var(--muted); }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.nums > div { background: var(--sunken); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.nums small { font-size: 12px; color: var(--muted); font-weight: 500; }
.nums b { font-size: 19px; font-weight: 700; letter-spacing: -.03em; }
.nums span { font-size: 12px; color: var(--muted); }
.nums .hl { background: var(--accent-soft); }
.nums .hl b { color: var(--accent); }
.adv { margin-top: 14px; }
.adv summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: 12px; }

/* ---------- bottom sheet ---------- */
#sheet { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#sheet.open { pointer-events: auto; }
.sh-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .25s; }
#sheet.open .sh-bg { opacity: 1; }
.sh {
  position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); transform: translate(-50%, 100%); transition: transform .3s cubic-bezier(.2, .9, .3, 1);
}
#sheet.open .sh { transform: translate(-50%, 0); }
.grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 0 auto 10px; }
.sh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sh-head h3 { font-size: 20px; font-weight: 700; }
.sh-head .sub { font-size: 13.5px; }
.sh-head .icon-btn { border: 0; background: var(--sunken); width: 34px; height: 34px; border-radius: 50%; }
.sh .search { background: var(--sunken); border-color: transparent; }
.picklist { max-height: 46vh; overflow-y: auto; margin: 0 -8px; }
.pick { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 8px; border: 0; background: none; border-radius: 12px; cursor: pointer; text-align: left; }
.pick + .pick { border-top: 1px solid var(--line); }
.pick:hover { background: var(--sunken); }
.pick span { display: flex; flex-direction: column; min-width: 0; }
.pick b { font-weight: 600; }
.pick small { color: var(--muted); }
.pick i { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.quick { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.quick h4 { margin-bottom: 10px; }
.qrow { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; }
.sh-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.form { margin-top: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 30; transform: translate(-50%, 140px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .35); transition: transform .3s cubic-bezier(.2, .9, .3, 1.2); max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- phone ---------- */
@media (max-width: 720px) {
  .top-in { padding: 10px 16px; }
  .top .tabs { display: none; }
  .brand { margin-right: auto; }
  main { padding: 4px 16px calc(var(--bnav) + 40px + env(safe-area-inset-bottom)); }
  .bnav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--line);
  }
  .bnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
  .bnav button.on { color: var(--accent); }
  .toast { bottom: calc(var(--bnav) + 18px + env(safe-area-inset-bottom)); }
  .phead { margin: 8px 0 16px; }
  .phead h1 { font-size: 28px; }
  .card { padding: 16px; border-radius: 18px; }
  .hero { gap: 16px; padding: 16px; }
  .ringwrap { width: 112px; height: 112px; }
  .ringtxt b { font-size: 23px; }
  .hs b { font-size: 15px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .nums { grid-template-columns: 1fr 1fr; }
  .four { grid-template-columns: 1fr 1fr; }
  .wsum { grid-template-columns: 1fr 1fr; }
  .wsum .ws:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .wsum .ws:nth-child(3) { border-left: 1px solid var(--line); }
  .wsum .ws:nth-child(2) { border-left: 0; }
  .dpills { gap: 4px; }
  .dpill { padding: 8px 0 6px; border-radius: 12px; }
  .bignut b { font-size: 17px; }
  .chip-daily.wide span { display: none; }
  .chip-daily.wide { padding: 6px; }
}
@media (max-width: 340px) {
  .hero { flex-direction: column; align-items: stretch; }
  .ringwrap { margin: 0 auto; }
}

/* ---------- workouts ---------- */
:root { --w: #6d5ce8; --w-soft: #efedfd; }
@media (prefers-color-scheme: dark) { :root { --w: #a397ff; --w-soft: #221f3d; } }
.tag-w { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 11.5px; font-weight: 600; color: var(--w); background: var(--w-soft); padding: 4px 8px; border-radius: 8px; }
.item.workout .tick { border-color: color-mix(in srgb, var(--w) 45%, var(--line-2)); }
.item.workout:hover .tick { border-color: var(--w); }
.item.workout input:checked + .tick { background: var(--w); border-color: var(--w); }
.item.workout.late input:not(:checked) + .tick { border-color: var(--warn); }
.item.daily.workout { opacity: .85; }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick label { cursor: pointer; }
.daypick input { position: absolute; opacity: 0; width: 0; }
.daypick span { display: grid; place-items: center; height: 40px; border-radius: 12px; background: var(--sunken); color: var(--muted); font-weight: 700; font-size: 14px; transition: all .15s; }
.daypick input:checked + span { background: var(--text); color: var(--bg); }
.bignut.one { grid-template-columns: 1fr; }
.bignut.one div:first-child { background: var(--w-soft); }
.bignut.one div:first-child b { color: var(--w); }
.group.first { margin-top: 4px; }
.kpis { grid-template-columns: 1fr 1fr; }
.kpis .kpi:first-child { grid-column: auto; }
.heats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.heats h4 { margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; }
.heats h4 span { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; }
.heat.w .lv1 { background: color-mix(in srgb, var(--w) 25%, var(--l0)); }
.heat.w .lv2 { background: color-mix(in srgb, var(--w) 50%, var(--l0)); }
.heat.w .lv3 { background: color-mix(in srgb, var(--w) 75%, var(--l0)); }
.heat.w .lv4 { background: var(--w); }
@media (max-width: 720px) {
  .heats { grid-template-columns: 1fr; }
  .kpis .kpi:first-child { grid-column: auto; }
}
.lw { display: none; }
.form:has(input[name="mf-kind"][value="workout"]:checked) .food-only { display: none; }
.form:has(input[name="mf-kind"][value="workout"]:checked) .lf { display: none; }
.form:has(input[name="mf-kind"][value="workout"]:checked) .lw { display: inline; }
.form:has(input[name="mf-kind"][value="workout"]:checked) .four { grid-template-columns: 1fr; }
/* planned vs eaten hero */
.hs.two { grid-template-columns: 1fr 1fr; }
.mb.fb .mbt i { background: #2f9e8f; }
@media (prefers-color-scheme: dark) { .mb.fb .mbt i { background: #4fd1c0; } }
.herostats { gap: 10px; }
.bignut { grid-template-columns: repeat(5, 1fr); }
.bignut div { padding: 12px 4px; }
@media (max-width: 720px) { .bignut b { font-size: 15px; } }
/* 12-hour times */
.time { width: 72px; }
.time-in { width: 100px; }
