:root {
  --bg: #f6f6f3;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e1e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7b7a74;
  --accent: #1f7a5a;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ea;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --warn: #b97a00;
  --bad: #d03b3b;
  --protein: #2a78d6;
  --carb: #eda100;
  --fat: #e87ba4;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #242422;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #96958c;
    --accent: #3fb68a;
    --accent-ink: #0b0b0b;
    --accent-soft: #1d3329;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good: #0ca30c;
    --warn: #fab219;
    --bad: #e66767;
    --protein: #3987e5;
    --carb: #c98500;
    --fat: #d55181;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #96958c; --accent: #3fb68a; --accent-ink: #0b0b0b;
  --accent-soft: #1d3329; --series-1: #3987e5; --series-2: #d95926; --good: #0ca30c; --warn: #fab219;
  --bad: #e66767; --protein: #3987e5; --carb: #c98500; --fat: #d55181;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; inset: 9px 5px; background: var(--accent-ink); border-radius: 2px; }
nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav a { padding: .4rem .7rem; border-radius: 999px; color: var(--text-2); text-decoration: none; white-space: nowrap; font-weight: 500; }
nav a.active { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; gap: .5rem; align-items: center; color: var(--text-2); font-size: .9rem; margin-left: auto; }
@media (max-width: 720px) {
  nav { order: 3; flex-basis: 100%; margin: 0 -1rem; padding: 0 1rem; }
}

main { max-width: 1240px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.foot { max-width: 1240px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .8rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: .75rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stack > * + * { margin-top: .75rem; }
.section { margin-top: 1.25rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .9rem; }
.tile .k { color: var(--text-2); font-size: .8rem; }
.tile .v { font-size: 1.45rem; font-weight: 650; margin-top: .1rem; }
.tile .v small { font-size: .8rem; font-weight: 500; color: var(--text-2); }
.tile .s { color: var(--muted); font-size: .8rem; }
.tile.hl { background: var(--accent-soft); border-color: transparent; }
.tile.hl .v { color: var(--accent); }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .5rem .9rem; border-radius: 8px; font: inherit; font-weight: 550; cursor: pointer; min-height: 38px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.small { padding: .25rem .6rem; min-height: 30px; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--accent); padding: .25rem; min-height: 0; }
.btn:disabled { opacity: .55; cursor: default; }

label { display: block; font-size: .85rem; color: var(--text-2); font-weight: 500; }
input, select, textarea {
  width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; min-height: 38px;
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { color: var(--muted); font-size: .78rem; margin-top: .2rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; background: var(--surface); }
legend { font-weight: 650; padding: 0 .35rem; }
.fields { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.checks { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.check { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; color: var(--text); cursor: pointer; background: var(--surface); }
.check input { width: auto; min-height: 0; margin: 0; }
.check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.foodgrid { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: .5rem; }
.foodgrid h4 { margin: .5rem 0 .2rem; font-size: .8rem; color: var(--muted); font-weight: 600; }

.profile-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.preview { position: sticky; top: 76px; }
@media (max-width: 900px) { .profile-layout { grid-template-columns: 1fr; } .preview { position: static; } }

.err { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); color: var(--text); padding: .6rem .8rem; border-radius: 8px; }
.note { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }
.note::before { content: "⚠ "; color: var(--warn); font-weight: 700; }
.ok { color: var(--good); }

.auth { max-width: 420px; margin: 2rem auto; }
.tabs { display: flex; gap: .25rem; background: var(--surface-2); padding: .25rem; border-radius: 10px; margin-bottom: 1rem; }
.tabs button { flex: 1; border: 0; background: none; padding: .5rem; border-radius: 8px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-2); font-weight: 600; font-size: .8rem; }
td.n, th.n { text-align: right; white-space: nowrap; }
@media (max-width: 520px) { table { font-size: .82rem; } th, td { padding: .4rem .3rem; } .hide-sm { display: none; } }
.table-wrap { overflow-x: auto; }

.macrobar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface); margin: .5rem 0; }
.macrobar span { display: block; }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.legend i.line { height: 2px; width: 16px; border-radius: 1px; vertical-align: 3px; }
.legend i.dash { height: 0; width: 16px; border-top: 2px dashed currentColor; border-radius: 0; vertical-align: 3px; background: none !important; }

.weekbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.weekbar .title { font-weight: 650; margin-right: auto; }

.day { padding: 0; overflow: hidden; }
.day-head { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.day-head .d { font-weight: 650; }
.day-head .d small { color: var(--muted); font-weight: 500; margin-left: .35rem; }
.day.today { border-color: var(--accent); }
.badge { display: inline-block; font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.badge.ex { background: var(--accent-soft); color: var(--accent); }
.meal { padding: .6rem 1rem; border-bottom: 1px dashed var(--border); }
.meal:last-of-type { border-bottom: 0; }
.meal-h { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; color: var(--text-2); margin-bottom: .25rem; }
.meal-h b { color: var(--text); }
.meal ul { list-style: none; margin: 0; padding: 0; }
.meal li { display: flex; justify-content: space-between; gap: .5rem; padding: .15rem 0; font-size: .9rem; }
.meal li .q { color: var(--text-2); }
.meal li .kc { color: var(--muted); white-space: nowrap; font-size: .82rem; }
.day-foot { padding: .6rem 1rem; background: var(--surface-2); font-size: .82rem; color: var(--text-2); display: grid; gap: .25rem; }
.dev { font-weight: 600; white-space: nowrap; }
.dev.g { color: var(--good); }
.dev.w { color: var(--warn); }
.dev.b { color: var(--bad); }

.session .seg { display: flex; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.session .seg:last-child { border-bottom: 0; }
.session .seg .m { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.rest { color: var(--muted); font-size: .9rem; padding: .75rem 1rem; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; font-size: .82rem; box-shadow: 0 4px 16px rgb(0 0 0 / .12); }

.shop h3 { margin-top: 1rem; font-size: .85rem; color: var(--text-2); }
.shop label.item { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border); color: var(--text); font-size: .95rem; font-weight: 400; }
.shop label.item input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.shop label.item .q { margin-left: auto; color: var(--text-2); font-size: .85rem; text-align: right; }
.shop label.item:has(input:checked) span { text-decoration: line-through; color: var(--muted); }

details.math { margin-top: 1rem; }
details.math summary { cursor: pointer; font-weight: 600; }
details.math code { background: var(--surface-2); padding: .05rem .3rem; border-radius: 4px; font-size: .85rem; }
details.math li { margin: .3rem 0; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--text-2); }
.loading { color: var(--muted); padding: 2rem 0; text-align: center; }

@media print {
  .top, .foot, .weekbar .btn, nav, .no-print { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- weekly printout (#printsheet) ---------- */
#printsheet { display: none; }
@media print {
  body.printing > *:not(#printsheet) { display: none !important; }
  body.printing { background: #fff; color: #000; font-size: 8pt; line-height: 1.25; }
  body.printing #printsheet { display: block; }
  #printsheet, #printsheet * { color: #000 !important; background: transparent !important; box-shadow: none !important; }
  .ps-page { break-after: page; }
  .ps-page:last-child { break-after: auto; }
  .ps-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.5pt solid #000; padding-bottom: 2mm; margin-bottom: 2mm; }
  .ps-head h1 { font-size: 15pt; margin: 0; }
  .ps-head div { font-size: 9pt; }
  .ps-note { font-size: 7pt; margin: 1.5mm 0; color: #333 !important; }
  .ps-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 7.4pt; }
  .portrait .ps-table { font-size: 6.4pt; }
  .ps-table th, .ps-table td { border: .6pt solid #777; padding: 1.2mm; vertical-align: top; text-align: left; }
  .ps-table thead th { font-size: 8pt; text-align: center; border-bottom: 1.2pt solid #000; }
  .ps-table th.slot { width: 17mm; font-size: 7.5pt; }
  .portrait .ps-table th.slot { width: 13mm; }
  .ps-table small { font-weight: 400; }
  .ps-table ul { list-style: none; margin: 0; padding: 0; }
  .ps-table li { margin: 0 0 .8mm; break-inside: avoid; }
  .ps-table li b { font-weight: 600; }
  .ps-table .po { display: block; font-size: 6.6pt; color: #444 !important; }
  .ps-table .mk { margin-top: .8mm; border-top: .4pt dotted #777; padding-top: .5mm; text-align: right; font-size: 6.8pt; }
  .ps-table tr { break-inside: avoid; }
  .ps-table tr.tot td, .ps-table tr.ex td { font-size: 6.8pt; }
  .ps-shop { columns: 3; column-gap: 8mm; font-size: 9pt; }
  .portrait .ps-shop { columns: 2; }
  .ps-shop .grp { break-inside: avoid; margin-bottom: 3mm; }
  .ps-shop h3 { font-size: 9pt; margin: 0 0 1mm; border-bottom: .6pt solid #000; }
  .ps-shop .si { display: flex; gap: 2mm; align-items: center; padding: .8mm 0; border-bottom: .3pt dotted #999; }
  .ps-shop .box { width: 3mm; height: 3mm; border: .7pt solid #000; flex: none; }
  .ps-shop .q { margin-left: auto; white-space: nowrap; }
}

/* ---------- calorie calculator ---------- */
.calc-layout { display: grid; gap: 1rem; grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.calc-layout > aside { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
@media (max-width: 860px) { .calc-layout > aside { position: static; max-height: none; } }
.rlist-h { font-size: .8rem; color: var(--text-2); font-weight: 600; margin: 1rem .6rem .25rem; text-transform: uppercase; letter-spacing: .03em; }
.rlist.recipes li button { display: block; }
.rlist.recipes li button span { white-space: normal; }
.rlist.recipes .rn { display: block; color: var(--text); font-size: .95rem; font-weight: 550; line-height: 1.3; }
.rlist.recipes .rk { display: block; color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.recipe-fields { grid-template-columns: minmax(0, 2fr) minmax(0, .8fr) minmax(0, 1.2fr); }
@media (max-width: 700px) { .recipe-fields { grid-template-columns: minmax(0, 1fr); } }
#rnotes { resize: vertical; min-height: 96px; line-height: 1.45; }
@media (max-width: 860px) { .calc-layout { grid-template-columns: minmax(0, 1fr); } }
.rlist { list-style: none; margin: .5rem 0 0; padding: 0; }
.rlist li button { width: 100%; text-align: left; border: 0; background: none; padding: .5rem .6rem; border-radius: 8px; font: inherit; color: var(--text); cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; }
.rlist li button:hover, .rlist li button.on { background: var(--accent-soft); }
.rlist li button span { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.searchbox { position: relative; }
.results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .14); max-height: 360px; overflow: auto; }
.results button { display: flex; width: 100%; gap: .6rem; justify-content: space-between; align-items: center; border: 0; background: none; padding: .5rem .7rem; text-align: left; font: inherit; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--border); }
.results button:last-child { border-bottom: 0; }
.results button.on, .results button:hover { background: var(--accent-soft); }
.results .nm { font-size: .9rem; }
.results .meta { color: var(--muted); font-size: .75rem; }
.results .kc { white-space: nowrap; color: var(--text-2); font-size: .82rem; }
.src { display: inline-block; font-size: .68rem; font-weight: 650; padding: 0 .35rem; border-radius: 4px; background: var(--surface-2); color: var(--text-2); margin-right: .3rem; vertical-align: 1px; }
.src.denge, .src.recipe, .src.user { background: var(--accent-soft); color: var(--accent); }
.ing td { vertical-align: middle; }
.ing input, .ing select { margin: 0; min-height: 34px; padding: .3rem .4rem; }
.ing .amt { display: flex; gap: .3rem; min-width: 250px; }
.ing .amt select { min-width: 150px; flex: 1; }
.ing .amt input { width: 80px; flex: none; }
.ing .nm { min-width: 160px; }
.ing .nm small { display: block; color: var(--muted); font-size: .75rem; }
.sumgrid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.sumgrid .tile table td { padding: .15rem 0; border: 0; font-size: .85rem; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .45); display: grid; place-items: center; padding: 1rem; }
.modal .card { width: min(560px, 100%); max-height: 90vh; overflow: auto; }

@media (max-width: 600px) {
  .ing, .ing tbody { display: block; }
  .ing tr:first-child { display: none; }
  .ing tr { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
  .ing td { border: 0; padding: 0; }
  .ing td.nm, .ing td:nth-child(2) { flex-basis: 100%; min-width: 0; }
  .ing .amt { min-width: 0; }
  .ing .amt select { flex: 1; min-width: 0; }
  .ing td[data-l]::after { content: " " attr(data-l); color: var(--muted); font-size: .78rem; }
  .ing td:last-child { margin-left: auto; }
}

/* ---------- household ---------- */
nav a .dot { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .7rem; line-height: 18px; text-align: center; margin-left: .2rem; }
.invite { border-color: var(--accent); background: var(--accent-soft); }
.meal li .others { display: block; color: var(--muted); font-size: .78rem; }

/* ---------- recipe links ---------- */
.rlink { border: 0; background: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-decoration: underline dotted var(--accent); text-underline-offset: 3px; text-align: left; }
.rlink:hover, .rlink:focus-visible { color: var(--accent); }
.modal .card.recipe ol { padding-left: 1.2rem; margin: .25rem 0 0; }
.modal .card.recipe li { margin: .25rem 0; }

/* ---------- menu: full-width day cards ---------- */
.hh-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: .75rem; font-size: .9rem; }
.hh-bar .check { margin: 0; }
.daynav { position: sticky; top: 52px; z-index: 5; display: flex; gap: .35rem; overflow-x: auto; padding: .5rem 0; margin-bottom: .25rem; background: var(--bg); scrollbar-width: none; }
.daynav button { flex: 1 0 64px; display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; position: relative; }
.daynav button small { color: var(--muted); font-size: .72rem; }
.daynav button:hover { border-color: var(--accent); }
.daynav button.today { border-color: var(--accent); background: var(--accent-soft); }
.daynav .exdot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.legendline { margin: .25rem 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.days { display: grid; gap: 1rem; }
.dayc { padding: 0; overflow: hidden; scroll-margin-top: 120px; }
.dayc.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dayc-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 1.5rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dayc-t h2 { font-size: 1.15rem; margin: 0 0 .35rem; }
.dayc-t h2 small { font-size: .85rem; color: var(--muted); font-weight: 500; margin-left: .3rem; }
.dayc-sum { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.dayc-sum .kcal { font-size: 1rem; color: var(--text-2); }
.dayc-sum .kcal b { font-size: 1.25rem; color: var(--text); }
.mchips { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.mchip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .8rem; color: var(--text-2); white-space: nowrap; }
.mchip b { color: var(--text); font-weight: 650; }
.mchip span { color: var(--muted); }
.mchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mchip.g i { background: var(--good); } .mchip.w i { background: var(--warn); } .mchip.b i { background: var(--bad); }
.mchip.n i { display: none; }
.meals { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.mealc { padding: .9rem 1.1rem 1rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: -1px; }
.mealc:last-child { border-right: 0; }
.mealc > header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .6rem; }
.mealc h3 { font-size: 1rem; margin: 0; }
.mealc h3 .time { color: var(--muted); font-weight: 500; font-size: .85rem; margin-left: .25rem; }
.mealc .tpl { color: var(--text-2); font-size: .82rem; margin-top: .1rem; }
.mealc .pill { flex: none; padding: .2rem .6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: .88rem; white-space: nowrap; }
.mealc .pill small { color: var(--text-2); font-weight: 500; }
.prows { display: grid; }
.pr { display: grid; grid-template-columns: var(--cols); gap: .6rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--border); }
.pr:first-child { border-top: 0; }
.pr.head { padding: 0 0 .3rem; font-size: .72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pr.head span:not(:first-child) { text-align: right; }
.pr .nm { font-size: .95rem; line-height: 1.3; }
.pr .am { display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.2; }
.pr .am .q1 { font-size: .9rem; }
.pr .am .q2 { font-size: .74rem; color: var(--muted); }
.pr .am.o .q1 { color: var(--text-2); }
.pr .kc { text-align: right; color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) {
  .dayc-sum { align-items: flex-start; }
  .mchips { justify-content: flex-start; }
  .meals { grid-template-columns: minmax(0, 1fr); }
  .mealc { border-right: 0; }
  .daynav { top: 96px; }
}
@media (max-width: 420px) {
  .pr { gap: .4rem; }
  .pr .nm { font-size: .9rem; }
}

.mealc .solo { color: var(--accent); }
/* Phone: dish name on its own line, portions in equal columns below. */
@media (max-width: 520px) {
  .pr { grid-template-columns: repeat(var(--n), minmax(0, 1fr)) 3rem; row-gap: .2rem; }
  .pr .nm { grid-column: 1 / -1; }
  .pr.head span:first-child { display: none; }
  .pr .am { align-items: flex-start; text-align: left; }
  .pr.head span:not(:first-child) { text-align: left; }
  .pr.head span:last-child, .pr .kc { text-align: right; }
}

/* ---------- intermittent fasting ---------- */
.fastline { padding: .55rem .9rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--text); margin-bottom: .75rem; font-size: .9rem; }
.fastcard .tl { position: relative; height: 18px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); margin: .6rem 0 1.4rem; }
.fastcard .tl .eat { position: absolute; top: 2px; bottom: 2px; border-radius: 7px; background: var(--accent); }
.fastcard .tl .tick { position: absolute; top: 22px; transform: translateX(-50%); font-size: .72rem; color: var(--muted); }
.fastcard .tips { margin: 0; padding-left: 1.1rem; color: var(--text-2); font-size: .9rem; }
.fastcard .tips li { margin: .2rem 0; }
.warnt { color: var(--warn); font-weight: 600; }

/* ---------- household schedule ---------- */
.presets { margin: .5rem 0 .75rem; }
table.sched { width: auto; min-width: 100%; }
table.sched th, table.sched td { text-align: center; padding: .35rem .5rem; }
table.sched th:first-child { text-align: left; }
table.sched th .btn.link { font-weight: 600; color: var(--text-2); padding: 0; }
table.sched th .btn.link:hover { color: var(--accent); }
label.tick { display: inline-flex; cursor: pointer; }
label.tick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.tick span { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); display: inline-grid; place-items: center; transition: background .12s; }
label.tick input:checked + span { background: var(--accent); border-color: var(--accent); }
label.tick input:checked + span::after { content: "✓"; color: var(--accent-ink); font-weight: 700; font-size: .85rem; }
label.tick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- exercise page ---------- */
.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; margin-bottom: 1rem; }
.weekstrip .ws { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-2); font: inherit; text-align: left; min-width: 0; }
.weekstrip .ws b { color: var(--text); }
.weekstrip .ws small { color: var(--muted); font-size: .72rem; }
.weekstrip .ws .wt { font-size: .82rem; line-height: 1.25; margin-top: .2rem; overflow-wrap: anywhere; }
.weekstrip .ws .wm { font-size: .72rem; color: var(--muted); }
.weekstrip .ws.on { background: var(--accent-soft); border-color: transparent; cursor: pointer; }
.weekstrip .ws.on .wt { color: var(--text); font-weight: 600; }
.weekstrip .ws.today { box-shadow: 0 0 0 2px var(--accent); }
.weekstrip .ws:disabled { opacity: .75; cursor: default; }
@media (max-width: 760px) {
  .weekstrip { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 112px; overflow-x: auto; scrollbar-width: none; }
}
.exday { padding: 0; overflow: hidden; scroll-margin-top: 80px; }
.exday.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.exday-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.exday-h h2 { font-size: 1.1rem; margin: 0; }
.exday-h h2 small { font-size: .85rem; color: var(--muted); font-weight: 500; margin-left: .3rem; }
.extitle { font-size: 1rem; font-weight: 600; color: var(--accent); margin-top: .2rem; }
.exstats { display: flex; gap: .5rem; }
.exstats span { padding: .3rem .7rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: .85rem; }
.exstats b { color: var(--text); font-size: 1rem; }
.segs { display: flex; gap: .75rem; padding: 1rem 1.1rem; flex-wrap: wrap; }
.segc { flex: 1 1 200px; min-width: 200px; display: flex; flex-direction: column; gap: .3rem; }
.segc .segbar { height: 6px; border-radius: 3px; background: var(--border); }
.segc.main .segbar { background: var(--accent); }
.segc .segt { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.segc .segt span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.segc p { margin: 0; color: var(--text-2); font-size: .9rem; line-height: 1.4; }
.segc .met { font-size: .75rem; color: var(--muted); }
.moves { padding: 0 1.1rem 1.1rem; }
.moves h3 { font-size: .95rem; margin: 0 0 .6rem; }
.movegrid { list-style: none; counter-reset: mv; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.movegrid li { counter-increment: mv; display: flex; flex-direction: column; gap: .15rem; padding: .6rem .75rem .6rem 2.4rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); position: relative; }
.movegrid li::before { content: counter(mv); position: absolute; left: .7rem; top: .6rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.movegrid .mn { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.movegrid .mr { color: var(--text-2); font-size: .85rem; }
.restcard h3 { font-size: .95rem; margin: 0 0 .5rem; }
.restdays { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }

/* ---------- measurements dashboard ---------- */
.body-top { display: grid; gap: 1rem; grid-template-columns: 330px minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .body-top { grid-template-columns: minmax(0, 1fr); } }
#bodyf h2 { margin-bottom: .6rem; }
.bfields { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; margin: .75rem 0 .4rem; }
.bfields label { font-size: .8rem; }
.bfields .u { color: var(--muted); font-weight: 400; }
.bfields input { min-height: 36px; }
.bodytiles { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
@media (max-width: 520px) { .bodytiles { grid-template-columns: 1fr 1fr; } .bodytiles .tile .v { font-size: 1.2rem; } }
.mgrid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin-top: .5rem; }
.mcard { padding: .85rem 1rem; }
.mhead { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.mhead h3 { margin: 0; font-size: .95rem; }
.mval b { font-size: 1.15rem; }
.mval .hint { margin-left: .3rem; }
.mstatus { font-size: .8rem; color: var(--accent); font-weight: 600; margin-top: .1rem; }
.chart.mini { margin-top: .4rem; }
.chart .reflabel { fill: var(--muted); font-size: 10px; }
.hist { display: grid; }
.hrow { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--border); align-items: start; }
.hrow:first-child { border-top: 0; }
.hd { color: var(--text-2); font-size: .9rem; padding-top: .2rem; }
.hchips { display: flex; flex-wrap: wrap; gap: .35rem; }
.hchip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .3rem .2rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .85rem; }
.hchip .hx { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .8rem; padding: 0 .3rem; border-radius: 50%; }
.hchip .hx:hover { color: var(--bad); }
@media (max-width: 520px) { .hrow { grid-template-columns: minmax(0, 1fr); gap: .3rem; } }

.mhead { display: block; }
.mhead .mval { margin-top: .15rem; }
