:root {
    --bg: #f6f6f4; --card: #ffffff; --text: #1d1d1b; --muted: #6b6b66; --line: #e4e4df;
    --accent: #2f7d4f; --over: #c0562f; --chip: #eef1ec;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #151614; --card: #1f201d; --text: #ecece8; --muted: #9a9a93; --line: #31322e;
        --accent: #5fb985; --over: #e0845f; --chip: #2a2c28;
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 0 16px 48px; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.3rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
.slot { text-transform: capitalize; }
.nav { display: flex; gap: 4px; justify-content: center; padding: 10px 16px; background: var(--card);
       border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.nav a { padding: 6px 14px; border-radius: 999px; color: var(--muted); }
.nav a.active { background: var(--chip); color: var(--text); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; text-align: center; margin: 16px 0; }
.pager > a { font-size: 1.8rem; padding: 0 12px; }
header { margin: 16px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.strong { font-weight: 700; }
.empty { text-align: center; color: var(--muted); margin: 32px 0; }
.macro { margin-bottom: 10px; }
.macro:last-of-type { margin-bottom: 0; }
.macro-head { display: flex; justify-content: space-between; }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; background: var(--accent); }
.bar > div.over { background: var(--over); }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.entries, .items { list-style: none; margin: 0; padding: 0; }
.entries > li { padding: 8px 0; border-top: 1px solid var(--line); }
.entries > li:first-child { border-top: 0; }
.entries > li.skipped .entry-head > span:first-child { text-decoration: line-through; color: var(--muted); }
.items { margin-top: 4px; padding-left: 12px; }
.entry-head { display: flex; justify-content: space-between; gap: 8px; }
.chip { font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.chip.eaten { color: var(--accent); }
.chip.skipped { text-decoration: line-through; }
.stats { display: flex; justify-content: space-around; text-align: center; }
.stats > div { display: flex; flex-direction: column; }
.stats strong { font-size: 1.4rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 6px 4px; border-top: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { border-top: 0; color: var(--muted); font-weight: 500; font-size: 0.875rem; }
tr.future td { color: var(--muted); }
.ok { color: var(--accent); font-weight: 600; }
.low { color: var(--over); font-weight: 600; }
td.center { text-align: center; }
.macro.water { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.macro.water .bar > div { background: #3f8fd2; }
.weight { margin-top: 10px; }
.stats.second { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.narrow { max-width: 360px; }
.center { text-align: center; }
.login { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 0.875rem; color: var(--muted); }
.login input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
               border-radius: 8px; padding: 10px 12px; }
.login button { font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0;
                border-radius: 8px; padding: 11px; cursor: pointer; }
.nav .logout { margin: 0; }
.nav .logout button { font: inherit; background: none; border: 0; color: var(--muted); padding: 6px 10px; cursor: pointer; }
