/* Fitness app (working title). Phone first.
   Pine for the app, three macro colours (protein blue, carbs amber, fat berry) that mean the same thing everywhere,
   and a warm sand for training. The day's ring on Today is the one bold thing; everything else stays calm. */
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("/fonts/poppins-medium.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("/fonts/poppins-bold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin.woff2") format("woff2"); }
:root {
  --pine: #0e4a45; --pine-2: #1b6b62; --pine-soft: #e3f0ec; --leaf: #8fd3b6;
  --protein: #3f6fe8; --carbs: #f0a12f; --fat: #c9548b;
  --sand: #fbe9c9; --sand-ink: #6b4a12;
  --ink: #12302d; --muted: #5f7773; --faint: #94a8a4; --bg: #f3f6f4; --surface: #ffffff; --line: rgb(18 48 45 / 0.09);
  --over: #c2410c; --radius: 22px; --radius-sm: 14px;
  --shadow: 0 1px 2px rgb(14 74 69 / 0.06), 0 8px 24px rgb(14 74 69 / 0.06);
  --display: "Poppins", "Avenir Next", system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--text); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: 320px; background: linear-gradient(180deg, #dcece6 0%, rgb(243 246 244 / 0) 100%); z-index: -1; }
a { color: var(--pine-2); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; font-weight: 700; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: 0.95rem; margin: 16px 0 6px; }
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 120px; }
main.plain { padding-bottom: 40px; }
.sub { color: var(--muted); margin: 4px 0 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }
.center { text-align: center; }
.head { margin: 8px 2px 18px; }
.flash { background: var(--pine); color: #fff; border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px; font-weight: 600; box-shadow: var(--shadow); }
.note { background: var(--sand); color: var(--sand-ink); border-radius: var(--radius-sm); padding: 10px 12px; margin: 12px 0 0; font-size: 0.92rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-head h2 { flex: none; }
.card-head .muted { text-align: right; font-size: 0.88rem; }
.label { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.stack { display: grid; gap: 12px; }
.narrow { max-width: 420px; margin: 24px auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
form.inline { display: inline; margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-form input:not([type=hidden]) { flex: 1; min-width: 120px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.grid-form .wide, .grid-form button.wide, .grid-form > .barcode { grid-column: 1 / -1; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: grid; gap: 5px; font-size: 0.86rem; font-weight: 600; color: var(--ink); }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: #f7faf8; border: 1.5px solid transparent; border-radius: 12px; padding: 11px 13px; width: 100%; min-height: 46px; transition: border-color .15s, background .15s; }
input:hover, select:hover { border-color: var(--line); }
input:focus, select:focus { background: #fff; border-color: var(--pine-2); outline: none; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; }
fieldset { border: 0; margin: 0; }
legend { font-family: var(--display); font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 6px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input { width: 20px; min-height: 20px; margin-top: 2px; flex: none; accent-color: var(--pine); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; background: var(--pine); color: #fff; font: 600 0.95rem var(--text); padding: 12px 20px; min-height: 46px; cursor: pointer; text-decoration: none; transition: transform .1s, background .15s; }
.btn:hover { background: var(--pine-2); }
.btn:active { transform: scale(0.98); }
.btn.small { padding: 8px 15px; min-height: 38px; font-size: 0.88rem; }
.btn.big { padding: 15px 24px; font-size: 1.02rem; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--pine-soft); color: var(--pine); }
.btn.ghost:hover { background: #d4e8e1; }
.btn.danger { background: var(--over); }
.btn.strava { background: #fc4c02; }
.tick { color: var(--pine-2); font-weight: 700; font-size: 0.88rem; }
.chip-x { border: 0; background: none; color: inherit; opacity: 0.6; font-size: 1.05rem; cursor: pointer; padding: 0 2px 0 6px; min-height: 28px; }

/* Signed out */
.hero { padding: 26px 4px 10px; }
.hero-kicker { font-family: var(--display); font-weight: 700; color: var(--pine-2); margin: 0 0 22px; display: flex; align-items: center; gap: 8px; }
.hero-kicker::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 4px solid var(--leaf); border-top-color: var(--carbs); }
.hero h1 { font-size: clamp(2.5rem, 11vw, 3.6rem); line-height: 1.02; letter-spacing: -0.035em; }
.hero-sub { font-size: 1.08rem; color: var(--muted); margin: 18px 0 24px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-points { list-style: none; padding: 0; margin: 30px 0; display: grid; gap: 10px; }
.hero-points li { background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow); }
.hero-points li strong { font-family: var(--display); font-weight: 500; display: block; }
.prose p { max-width: 62ch; }

/* Today */
.day-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; margin: 2px 0 10px; }
.step { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); text-decoration: none; font-size: 1.5rem; color: var(--pine); box-shadow: var(--shadow); }
.fuel { background: var(--surface); border-radius: 28px; padding: 22px 18px 18px; margin: 0 0 14px; box-shadow: var(--shadow); }
.ring { position: relative; width: min(220px, 64vw); margin: 0 auto; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring .track { fill: none; stroke: #edf2f0; }
.ring .arc { fill: none; stroke-linecap: round; transition: stroke-dasharray .6s cubic-bezier(.2,.8,.2,1); }
.ring .arc.protein { stroke: var(--protein); } .ring .arc.carbs { stroke: var(--carbs); } .ring .arc.fat { stroke: var(--fat); }
.ring-centre { position: absolute; inset: 22%; display: grid; place-content: center; text-align: center; }
.ring-num { font: 700 2.7rem/1 var(--display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.ring-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.macros { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.macros li { background: #f6f9f8; border-radius: var(--radius-sm); padding: 9px 10px; display: grid; gap: 1px; }
.macros .dot { width: 8px; height: 8px; border-radius: 50%; }
.macros .protein .dot { background: var(--protein); } .macros .carbs .dot { background: var(--carbs); } .macros .fat .dot { background: var(--fat); }
.m-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.m-num { font-size: 0.78rem; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.m-num strong { color: var(--ink); font-family: var(--display); font-size: 1rem; }
.train-today { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.train-today a { font-size: 0.85rem; margin-left: auto; font-weight: 600; text-decoration: none; }
.session-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--sand); color: var(--sand-ink); border-radius: 99px; padding: 5px 11px; font-size: 0.82rem; font-weight: 700; }
.session-chip.done { background: var(--pine-soft); color: var(--pine); }
.session-chip.rest { background: #eef3f1; color: var(--muted); }
.nudge { background: linear-gradient(135deg, #eaf0ff, #f3f6ff); border: 1px solid #d6e0fb; }
.nudge p { margin: 0 0 6px; }
.nudge strong { color: var(--protein); }
.weigh { display: flex; align-items: end; gap: 8px; }
.weigh label { flex: 1; }
.meal-card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; box-shadow: var(--shadow); }
.meal-head { display: flex; align-items: center; gap: 12px; }
.meal-titles { flex: 1; min-width: 0; }
.meal-titles h2 { font-size: 0.8rem; color: var(--muted); font-weight: 600; font-family: var(--text); letter-spacing: 0; }
.meal-name { font: 500 1.05rem/1.25 var(--display); margin: 1px 0 0; }
.slot-icon { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.slot-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.slot-icon.breakfast { background: #fff2d9; color: #b7791f; } .slot-icon.lunch { background: #e3f0ec; color: var(--pine-2); }
.slot-icon.dinner { background: #ebe7fb; color: #5b4bb7; } .slot-icon.snack { background: #fbe4ee; color: var(--fat); }
.meal-kcal { font: 700 1.1rem/1 var(--display); text-align: right; display: grid; font-variant-numeric: tabular-nums; }
.meal-kcal small { font: 600 0.7rem var(--text); color: var(--muted); }
.eaten-badge { width: 30px; height: 30px; border-radius: 50%; background: var(--pine); color: #fff; display: grid; place-items: center; font-weight: 700; }
.meal-card.done { background: #fbfdfc; }
.ingredients { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 0; }
.ingredients li { display: flex; justify-content: space-between; gap: 10px; font-size: 0.93rem; padding: 6px 0; border-top: 1px solid var(--line); }
.ingredients li span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; font-weight: 600; }
.mini-macros { display: flex; gap: 6px; margin: 10px 0 0; font-size: 0.78rem; font-weight: 700; }
.mini-macros span { border-radius: 99px; padding: 2px 8px; }
.mini-macros .protein { background: #eaf0ff; color: var(--protein); } .mini-macros .carbs { background: #fff3df; color: #a8650a; } .mini-macros .fat { background: #fbe9f1; color: var(--fat); }
.is-done .ingredients, .is-done .mini-macros { opacity: 0.45; }
.topup { background: #eaf0ff; border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.topup p { margin: 0; font-size: 0.9rem; }
.topup strong { color: var(--protein); }
.logged { list-style: none; padding: 0; margin: 10px 0 0; }
.logged li { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 0.93rem; padding: 6px 0; border-top: 1px solid var(--line); }
.logged li span:first-child { flex: 1; }
details > summary { cursor: pointer; font-weight: 600; color: var(--pine-2); padding: 10px 0 2px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.add-food > summary::before, details.sub-add > summary::before, details.adder > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pine-soft); margin-right: 8px; font-weight: 700; }
details[open] > summary::before { content: "−"; }
.add-panel { margin-top: 8px; }
.add-panel h3:first-child { margin-top: 4px; }
.pick-list { list-style: none; padding: 0; margin: 0; }
.pick-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pick-list li:last-child { border-bottom: 0; }
.pick-list li span small { display: block; color: var(--muted); font-size: 0.82rem; }
.pick-list li.on span { font-weight: 700; }
.pick-list li.off span { color: var(--faint); text-decoration: line-through; }
.barcode { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border: 1.5px dashed var(--leaf); border-radius: var(--radius-sm); background: #f8fcfa; }
.barcode input[data-barcode-number] { flex: 1; min-width: 140px; }
.barcode p { flex-basis: 100%; margin: 0; }
.foot { text-align: center; color: var(--muted); }

/* Plan */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; align-items: end; }
.week-strip a { background: var(--surface); border-radius: 16px; padding: 10px 2px 8px; text-align: center; text-decoration: none; color: var(--ink); display: grid; gap: 4px; font-size: 0.72rem; font-weight: 600; box-shadow: var(--shadow); }
.week-strip a strong { font: 700 0.8rem var(--display); font-variant-numeric: tabular-nums; }
.week-strip a.train { background: var(--sand); color: var(--sand-ink); }
.kcal-tag { background: var(--pine-soft); color: var(--pine); border-radius: 99px; padding: 4px 11px; font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.day-card h2 a { color: inherit; text-decoration: none; }
.day-meals { list-style: none; padding: 0; margin: 10px 0 0; }
.day-meals li { display: grid; grid-template-columns: 78px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 0.93rem; }
.day-meals .slot { color: var(--muted); font-size: 0.8rem; padding-top: 2px; font-weight: 600; }
.day-meals a { text-decoration: none; font-weight: 500; }

/* Shop */
.range { margin-bottom: 12px; }
.range label { flex: 1; }
.steps { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 10px; align-items: flex-start; color: var(--muted); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.92rem; }
.steps li::before { content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #eef3f1; font-weight: 700; font-size: 0.8rem; }
.steps li.on { color: var(--ink); box-shadow: inset 0 0 0 2px var(--leaf); }
.steps li.on::before { background: var(--pine); color: #fff; }
.aisle { font: 600 0.8rem var(--text); color: var(--muted); margin: 18px 4px 8px; letter-spacing: 0; }
.shop-list { list-style: none; margin: 0 0 6px; padding: 0; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.shop-item { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-tick { flex: 1; margin: 0; }
.shop-tick button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; min-height: 50px; }
.shop-tick button:focus-visible { outline: 3px solid var(--leaf); outline-offset: -3px; }
.shop-box { flex: none; width: 24px; height: 24px; border: 2px solid #c6d4d0; border-radius: 8px; transition: background .15s, border-color .15s; }
.shop-name { flex: 1; }
.shop-amt { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; font-size: 0.92rem; }
.shop-item.got .shop-name, .shop-item.got .shop-amt { text-decoration: line-through; color: var(--faint); }
.shop-item.got .shop-box { background: var(--pine) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 16px no-repeat; border-color: var(--pine); }
.shop-list.ordered { opacity: 0.8; }
.plain { margin: 8px 0; padding-left: 1.2em; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* Train */
.race { background: var(--pine); color: #fff; }
.race .label { color: var(--leaf); }
.race strong { display: block; font: 700 1.35rem var(--display); margin: 2px 0; }
.week-list { list-style: none; padding: 0; margin: 0; }
.week-list li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); align-items: center; }
.wd { font: 700 0.9rem var(--display); color: var(--muted); }
.sessions { display: flex; flex-wrap: wrap; gap: 6px; }
.add-session { grid-template-columns: 1fr 1fr; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows li div { display: grid; }
.rows li:last-child { border-bottom: 0; }

/* Me and getting started */
.big-number strong { display: block; font: 700 2.8rem/1.1 var(--display); letter-spacing: -0.03em; color: var(--pine); }
.choice { display: grid; gap: 8px; }
.chip-radio { display: flex; align-items: center; gap: 10px; background: #f6f9f8; border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 600; cursor: pointer; }
.chip-radio input { width: 20px; min-height: 20px; accent-color: var(--pine); }
.chip-radio:has(input:checked) { background: var(--pine-soft); box-shadow: inset 0 0 0 2px var(--pine-2); }
fieldset:has(input[value=maintain]:checked) .goal-fields { display: none; }
.spark { margin: 6px 0 10px; }
.spark svg { width: 100%; height: 90px; }
.spark path { fill: none; stroke: var(--pine-2); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark figcaption { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }
.danger summary { color: var(--over); }

/* The bar: a floating pill on phones; a side rail on wide screens */
.bar { position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); background: rgb(255 255 255 / 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 26px; padding: 7px; box-shadow: 0 10px 30px rgb(14 74 69 / 0.16), 0 1px 2px rgb(14 74 69 / 0.08); z-index: 10; }
.bar .brand { display: none; }
.bar a { display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 0.7rem; font-weight: 600; padding: 6px 0 5px; border-radius: 20px; }
.bar a svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar a.on { color: #fff; background: var(--pine); }
@media (min-width: 900px) {
  .bar { top: 16px; bottom: 16px; left: 16px; right: auto; width: 210px; margin: 0; grid-template-columns: 1fr; align-content: start; gap: 4px; padding: 20px 12px; border-radius: 26px; }
  .bar .brand { display: block; font: 700 1.2rem var(--display); color: var(--pine); padding: 0 10px 18px; text-decoration: none; }
  .bar a { grid-auto-flow: column; justify-content: start; gap: 10px; font-size: 0.95rem; padding: 11px 12px; }
  main { padding-bottom: 40px; }
  body:not(.signed-out) main { margin-left: max(250px, calc(50% - 280px)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.hero-demo { background: var(--surface); border-radius: 28px; padding: 22px 18px 18px; margin: 30px 0 0; box-shadow: var(--shadow); }
