:root {
  --bg: #eef1ed;
  --surface: #fff;
  --text: #172019;
  --muted: #6d776f;
  --line: #e3e8e4;
  --accent: #159447;
  --accent-dark: #0d7637;
  --accent2: #e7f6ec;
  --danger: #a23d32;
  --shadow: 0 3px 14px rgba(20, 46, 31, .055);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  background: linear-gradient(180deg, #f3f5f2 0, #e9ede9 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.app { max-width: 400px; margin: auto; min-height: 100vh; padding: 12px 12px 96px; background: #fff; }
.top { display: flex; justify-content: space-between; align-items: center; min-height: 38px; margin-bottom: 8px; }
.logo { color: var(--text); font-weight: 850; font-size: 16px; letter-spacing: -.02em; text-decoration: none; }
.profile-chip { color: var(--accent); background: var(--accent2); border-radius: 999px; padding: 7px 11px; font-size: 11px; font-weight: 800; text-decoration: none; }
.card, .hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.hero { padding: 14px; }
.eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
h1 { font-size: 23px; line-height: 1.12; letter-spacing: -.025em; margin: 3px 0 5px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.4; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.metric { background: #f7f9f7; border-radius: 11px; padding: 10px; }
.metric strong { font-size: 18px; display: block; letter-spacing: -.02em; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.pill { background: var(--accent2); color: var(--accent); border-radius: 999px; padding: 6px 9px; font-size: 12px; font-weight: 800; }
.pill.done { background: var(--accent); color: #fff; }
.pill.warning { background: #fff0d7; color: #8a5b11; }
.food { width: 48px; height: 48px; border-radius: 12px; background: var(--accent2); display: grid; place-items: center; font-size: 25px; }
.foodrow { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; }
.btn, .btn2, .btn-ghost {
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  border-radius: 9px;
  padding: 10px 13px;
  font-weight: 800;
}
.btn { background: var(--accent); color: white; }
.btn:hover { background: var(--accent-dark); }
.btn2 { background: var(--accent2); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.97); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); }
.navin { max-width: 400px; margin: auto; display: grid; grid-template-columns: repeat(5,1fr); gap: 2px; }
.nav a { text-decoration: none; color: var(--muted); text-align: center; padding: 6px 2px; border-radius: 9px; font-size: 10px; line-height: 1.45; }
.nav a.active { color: var(--accent); font-weight: 800; }
.callout { background: var(--accent2); border-radius: 13px; padding: 12px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.field { display: grid; gap: 6px; margin-bottom: 13px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 750; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fbfcfa; color: var(--text);
  border-radius: 13px; padding: 12px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent2); }
.field textarea { min-height: 84px; resize: vertical; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .card { transition: .15s ease; box-shadow: none; }
.choice input:checked + .card { border-color: var(--accent); background: #f7fbf8; box-shadow: 0 0 0 2px var(--accent2); }
.choice input:checked + .card .select-dot { background: var(--accent); color: white; }
.select-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.meal-card { box-shadow: none; padding: 10px 12px; }
.mini-check { cursor: pointer; }
.mini-check input { position: absolute; opacity: 0; pointer-events: none; }
.mini-check span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); font-weight: 900; }
.mini-check input:checked + span { background: var(--accent); color: white; }
.success-note { display: inline-flex; align-items: center; color: var(--accent); font-size: 12px; font-weight: 800; padding: 8px 0; }
.success-active { background: var(--accent); color: white; }
.button-row select { border: 1px solid var(--line); border-radius: 13px; padding: 10px; background: white; color: var(--text); }
.recipe-hero { display: grid; grid-template-columns: 74px 1fr; gap: 14px; align-items: center; margin: 14px 0 20px; }
.big-food { width: 74px; height: 74px; font-size: 36px; }
.recipe-group + .recipe-group { margin-top: 16px; }
.steps { margin: 0; padding-left: 22px; }
.steps li { padding: 0 0 14px 7px; line-height: 1.5; }
.steps li:last-child { padding-bottom: 0; }
.training-card { box-shadow: none; }
.training-icon { font-size: 28px; }
.run-entry { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.run-entry .field { margin: 0; }
.run-entry .btn { grid-column: 1 / -1; }
.activity-result { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--accent2); color: var(--accent); }
.activity-result span { font-size: 12px; }
.schedule-callout { margin-bottom: 14px; }
.schedule-callout .kv { border-color: rgba(47,122,87,.18); }
.proposal-row { display: grid; grid-template-columns: 1fr 110px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(47,122,87,.18); }
.proposal-row small { display: block; color: var(--muted); margin-top: 2px; }
.proposal-row select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: white; color: var(--text); }
.week-picker { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; margin: 16px 0 8px; }
.week-arrow { width: 42px; height: 42px; border: 0; border-radius: 13px; background: var(--accent2); color: var(--accent); font-size: 20px; font-weight: 900; cursor: pointer; }
.meal-card .foodrow { grid-template-columns: 44px 1fr auto; }
.meal-card .food { width: 44px; height: 44px; font-size: 23px; }
.compact-meal-row { display: grid; grid-template-columns: 1fr 44px 28px; gap: 9px; align-items: center; }
.meal-copy { min-width: 0; color: var(--text); text-decoration: none; display: grid; gap: 1px; }
.meal-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.meal-day { font-size: 9px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.meal-thumb { text-decoration: none; }
.meal-card > .success-note { padding: 6px 0 0; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-item:last-child { border-bottom: 0; }
.check-item input { width: 20px; height: 20px; accent-color: var(--accent); }
.check-item:has(input:checked) span { text-decoration: line-through; color: var(--muted); }
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.workout-count { font-size: 48px; font-weight: 850; letter-spacing: -.04em; margin: 10px 0; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 92px; transform: translate(-50%, 16px); max-width: calc(100vw - 28px); background: var(--text); color: white; padding: 11px 15px; border-radius: 13px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; padding: 24px 12px; }
.danger { color: var(--danger); }

.dashboard-hero { margin-bottom: 14px; }
.dashboard-hero > .muted { margin-bottom: 12px; }
.metric-strip { display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.metric-strip .metric { min-width: 0; padding: 10px 8px; background: #fff; border-radius: 0; border-right: 1px solid var(--line); text-align: left; }
.metric-strip .metric:last-child { border-right: 0; text-align: center; }
.metric-strip .metric > span { display: block; min-height: 18px; color: var(--muted); font-size: 10px; }
.metric-strip .metric > small { color: var(--muted); font-size: 9px; }
.goal-ring { --goal-progress: 0deg; width: 44px; height: 44px; margin: 2px auto; padding: 4px; border-radius: 50%; background: conic-gradient(var(--accent) var(--goal-progress), #e8ece8 0); }
.goal-ring::before { content: ""; display: block; width: 100%; height: 100%; border-radius: inherit; background: #fff; }
.goal-ring strong { position: relative; display: block; margin-top: -30px; font-size: 12px; line-height: 18px; }
.section-label { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px 7px; color: var(--text); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.focus-card { display: flex; align-items: center; gap: 10px; background: linear-gradient(100deg, #f4fbf6, #fff); border-color: #dbeee1; }
.focus-card .row { flex: 1; }
.activity-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: var(--accent2); }
.compact-action { flex: none; min-height: 34px; padding: 8px 11px; font-size: 11px; }
.meal-highlight { border-color: #f0e3d2; background: linear-gradient(100deg, #fffaf3, #fff); }
.meal-highlight .food { background: #fff0db; }
.meal-highlight strong, .card-kicker { display: block; }
.card-kicker { margin-bottom: 2px; color: #b66b12; font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.goals-heading { margin-top: 15px; }
.day-goals { display: grid; grid-template-columns: repeat(var(--daily-goal-count, 5), 1fr); gap: 6px; margin-bottom: 12px; }
.day-goal { min-width: 0; padding: 8px 2px 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); display: grid; place-items: center; gap: 4px; cursor: pointer; font-size: 9px; }
.day-goal .goal-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #f1f4f1; font-size: 17px; filter: grayscale(.3); }
.day-goal .goal-check { color: #a7afa9; font-size: 12px; font-weight: 900; line-height: 1; }
.day-goal.done { border-color: #bee2ca; color: var(--accent); background: #f7fcf8; font-weight: 800; }
.day-goal.done .goal-icon { background: var(--accent2); filter: none; }
.day-goal.done .goal-check { color: var(--accent); }
.compact-callout { margin-top: 8px; }
.compact-callout p { margin-bottom: 0; }

body:not([data-page="home"]) .app > .eyebrow { margin-top: 8px; }
body:not([data-page="home"]) .app > h1 + .muted { margin-bottom: 12px; }
.training-card, #recipe-request-form, #checkin-form { padding: 12px; }
.week-picker { margin-top: 12px; border-radius: 13px; padding: 9px; }
.week-arrow { width: 36px; height: 36px; border-radius: 9px; }

@media (min-width: 700px) {
  .app { min-height: calc(100vh - 32px); margin-top: 16px; margin-bottom: 16px; padding-top: 16px; border-radius: 24px; box-shadow: 0 18px 55px rgba(20,46,31,.12); }
}
