:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2129;
  --muted: #6b7380;
  --line: #e3e6eb;
  --today: #2f6fed;
  --done: #22a06b;
  --partial: #d89b14;
  --missed: #d4473b;
  --unplanned: #7b61d6;
  --planned: #9aa3b0;
  --routine: #1597a8;
  --event-bg: #eef1f5;
  --z0: #a9c8f0; --z1: #6fb3e0; --z2: #4cc28a; --z3: #f0c34a; --z4: #f08a3c; --z5: #de4b3e;
  --ph0: #3b5bdb; --ph1: #74a7f5; --ph2: #b47be8; --ph3: #f2a7a0;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --panel: #1a1e25;
    --text: #e6e9ee;
    --muted: #8d96a3;
    --line: #2a3039;
    --today: #5b8ef5;
    --planned: #5d6673;
    --event-bg: #232933;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; text-decoration: none; }
b { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.menu { display: flex; gap: 2px; }
.menu a { padding: 5px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
/* on a phone the menu gets its own row and scrolls sideways instead of widening the page */
@media (max-width: 700px) {
  .menu { order: 3; flex: 1 1 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .menu::-webkit-scrollbar { display: none; }
}
.menu a:hover { color: var(--text); }
.menu a.on { color: var(--text); background: var(--event-bg); font-weight: 600; }
.nav { display: flex; gap: 6px; }
.btn.on { border-color: var(--today); color: var(--today); }
.btn, .sync button {
  display: inline-block; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
}
.btn:hover, .sync button:hover { border-color: var(--muted); }
.sync { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sync form { margin: 0; }
.sync-error { color: var(--missed); cursor: help; }

main { padding: 12px 16px 40px; max-width: 1500px; margin: 0 auto; }

/* The calendar takes the whole window: full width, and the weeks that fit
   (picked by the script in calendar.html) stretch down to the bottom edge. */
.page-cal { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page-cal main { flex: 1; display: flex; flex-direction: column; max-width: none; margin: 0; padding-bottom: 10px; }

/* ---------- legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 10px; font-size: 12px; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

.status-done { --c: var(--done); }
.status-partial { --c: var(--partial); }
.status-missed { --c: var(--missed); }
.status-unplanned { --c: var(--unplanned); }
.status-planned { --c: var(--planned); }
.status-routine { --c: var(--routine); }

/* ---------- calendar grid */
.cal { display: flex; flex-direction: column; }
.cal[data-fitted] { flex: 1; }
.cal[data-fitted] .week { flex: 1 0 auto; }
.cal-head, .week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(140px, .75fr);
  gap: 6px;
}
.cal-head { font-size: 12px; color: var(--muted); padding: 0 2px 4px; }
.week { margin-bottom: 6px; }
.week[hidden] { display: none; }
.week-label { display: none; }

.day {
  display: flex; flex-direction: column; gap: 5px;
  min-height: 92px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.day:hover { border-color: var(--muted); }
.day.past { background: color-mix(in srgb, var(--panel) 70%, var(--bg)); }
.day.today { border-color: var(--today); box-shadow: inset 0 0 0 1px var(--today); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-num { font-weight: 600; }
.today .day-num { color: var(--today); }
.month { font-weight: 400; color: var(--muted); font-size: 12px; }
.wd { display: none; font-size: 12px; color: var(--muted); }

.health { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 11px; color: var(--muted); }
.health b { color: var(--text); font-weight: 600; }
.health .surplus b { color: var(--partial); }
.health .deep b, .health .over b { color: var(--missed); }

.item { border-radius: 7px; font-size: 12px; }
.item.workout {
  padding: 5px 6px 5px 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 7%, var(--panel));
}
.item.workout.status-planned { border-left-style: dashed; }
/* sessions without the watch: vital's estimate, not a recorded workout */
.item.routine { border-left-style: dotted; }
.item.routine.status-missed .item-name { text-decoration: line-through; }
.item-top { display: flex; gap: 5px; align-items: baseline; }
.item-name {
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  font-weight: 500; hyphens: auto; overflow-wrap: anywhere;
}
.item-nums { display: flex; flex-wrap: wrap; gap: 0 8px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hr { color: var(--missed); }
.item.event, .item.rest {
  padding: 2px 6px; background: var(--event-bg); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sport {
  flex: none; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
  padding: 1px 5px; border-radius: 5px; background: var(--event-bg); color: var(--muted);
}
.sport-run { background: #dff3e8; color: #17784f; }
.sport-trail_run { background: #efe6d6; color: #7b5a1d; }
.sport-strength { background: #e8e4f8; color: #5940b5; }
.sport-bike, .sport-cycling { background: #dcecfb; color: #1f5fa8; }
.sport-swim { background: #d9f2f6; color: #127386; }
@media (prefers-color-scheme: dark) {
  .sport-run { background: #173327; color: #6fd3a3; }
  .sport-trail_run { background: #33291a; color: #dcb46c; }
  .sport-strength { background: #272040; color: #b3a2f0; }
  .sport-bike, .sport-cycling { background: #182a3f; color: #86b8ef; }
  .sport-swim { background: #13313a; color: #79cfe0; }
}

.totals {
  padding: 8px 10px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.tot-row { display: flex; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; }
a.tot-row { color: inherit; text-decoration: none; }
a.tot-row:hover b { color: var(--today); }
.bar { height: 6px; border-radius: 3px; background: var(--event-bg); overflow: hidden; margin: 4px 0 1px; }
.bar i { display: block; height: 100%; background: var(--done); border-radius: 3px; }

/* ---------- day page */
.day-title { font-size: 22px; margin: 6px 0 14px; }
.day-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.day-main, .day-side { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.card.workout { border-left: 5px solid var(--c); }
.card.routine { border-left: 5px dotted var(--c); }
.card .skip { margin-top: 10px; }
.card .skip button {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
}
.card .skip button:hover { border-color: var(--muted); }
.card h2 { font-size: 16px; margin: 0; }
.day-side .card h2 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-weight: 600; }

table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pf { margin: 10px 0; min-width: 280px; }
.pf th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: right; padding: 2px 0 4px 18px; }
.pf td { padding: 3px 0; border-top: 1px solid var(--line); }
.pf td + td { text-align: right; padding-left: 18px; }

.zones { margin: 12px 0; max-width: 520px; }
.zones-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.zone { display: grid; grid-template-columns: 26px 1fr 96px; gap: 8px; align-items: center; margin: 3px 0; font-size: 12px; }
.zbars { display: flex; flex-direction: column; gap: 2px; }
.zb { height: 6px; border-radius: 3px; min-width: 0; }
.zb.plan { opacity: .4; }
.zt { text-align: right; font-variant-numeric: tabular-nums; }
.z0 { background: var(--z0); } .z1 { background: var(--z1); } .z2 { background: var(--z2); }
.z3 { background: var(--z3); } .z4 { background: var(--z4); } .z5 { background: var(--z5); }

.steps { width: 100%; margin: 10px 0; font-size: 13px; }
.steps td { padding: 4px 8px 4px 0; vertical-align: top; }
.steps tr.block-start td { border-top: 1px solid var(--line); }
.steps .rep { width: 34px; font-weight: 600; color: var(--today); }
.steps .num { text-align: right; white-space: nowrap; }

.text { margin-top: 10px; }
.text-label { margin-bottom: 2px; }
.prose { white-space: pre-line; overflow-wrap: anywhere; }

.big { font-size: 30px; font-weight: 700; line-height: 1.1; }
.phases { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 10px 0 6px; }
.ph { display: block; height: 100%; }
.ph0 { background: var(--ph0); } .ph1 { background: var(--ph1); } .ph2 { background: var(--ph2); } .ph3 { background: var(--ph3); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.kv { list-style: none; margin: 4px 0 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; padding: 3px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.kv li:first-child { border-top: none; }

/* ---------- weight */
.note { margin: 8px 0 0; }
.unknown { color: var(--partial); font-weight: 600; }
.note-box {
  padding: 10px 14px; border-radius: 10px; margin: 0 0 14px;
  background: color-mix(in srgb, var(--today) 8%, var(--panel)); border: 1px solid var(--line);
}
.note-box a, .card p a { color: var(--today); }
code { font-size: 12px; padding: 1px 4px; border-radius: 4px; background: var(--event-bg); }

.chart { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 200px auto; gap: 4px 8px; margin: 10px 0 2px; }
.chart svg { width: 100%; height: 100%; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chart polyline { fill: none; stroke: var(--today); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart polyline.raw { stroke: var(--muted); stroke-width: 1.2; opacity: .6; }
.chart polyline.trend { stroke-width: 2.5; }
.chart rect.band { fill: color-mix(in srgb, var(--done) 16%, transparent); }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-variant-numeric: tabular-nums; }
.chart-x { grid-column: 2; display: flex; justify-content: space-between; }
.chart-legend { display: flex; gap: 14px; margin-top: 6px; }
.chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 5px; vertical-align: 3px; border-radius: 2px; }
.lg-raw::before { background: var(--muted); opacity: .6; }
.lg-trend::before { background: var(--today); }
.chart-legend .lg-band::before { height: 10px; vertical-align: -1px; background: color-mix(in srgb, var(--done) 30%, transparent); }

/* ---------- target weight */
.goal-line { margin-left: auto; color: var(--muted); }
.goal-line b { color: var(--text); }
.goal-line:hover { color: var(--text); }
.goal-status { font-weight: 600; margin: 2px 0 8px; }
.goal-above .goal-status, .goal-below .goal-status { color: var(--partial); }
.goal-inside .goal-status { color: var(--done); }
.goal-advice {
  margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; font-weight: 600;
  background: color-mix(in srgb, var(--today) 9%, var(--panel));
}
.goal-warn { margin: 8px 0 0; color: var(--missed); }
.how { margin-top: 10px; }
.how summary { cursor: pointer; }
.how p { margin: 6px 0 0; }

.table-wrap { overflow-x: auto; }
.wt { width: 100%; font-size: 13px; margin-top: 6px; }
.wt th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: left; padding: 4px 10px 4px 0; }
.wt td { padding: 4px 10px 4px 0; border-top: 1px solid var(--line); white-space: nowrap; }
.wt .num { text-align: right; }
.wt a { color: var(--today); }
.wt form { margin: 0; }
.wt button.del {
  border: none; background: none; color: var(--muted); font: inherit; font-size: 16px; line-height: 1;
  padding: 0 4px; cursor: pointer;
}
.wt button.del:hover { color: var(--missed); }

/* ---------- body composition analyses */
.scan-add { margin-top: 10px; }
.scan-add summary { cursor: pointer; color: var(--today); font-size: 13px; }
.scan-form {
  display: grid; gap: 8px; align-items: end; margin-top: 8px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.scan-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.scan-form input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; min-width: 0; width: 100%;
}
.scan-form button {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
}
.scan-form button:hover { border-color: var(--muted); }

/* ---------- settings */
.form-error {
  padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; font-weight: 600;
  color: var(--missed); background: color-mix(in srgb, var(--missed) 10%, var(--panel));
}
.people { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.person {
  display: grid; gap: 8px; align-items: end;
  grid-template-columns: minmax(110px, 1.4fr) repeat(3, minmax(70px, .7fr)) minmax(130px, 1fr) minmax(100px, .9fr) 72px 196px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.person.new { border-bottom: none; }
.person label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.person input, .person select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; min-width: 0; width: 100%;
}
.person input[type=checkbox] { width: auto; }
.person label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 7px; white-space: nowrap; color: var(--text); }
.person .actions { display: flex; gap: 6px; }
/* the target fields make a second row under the weight range */
.person label.goal { grid-row: 2; }
.person label.goal-min { grid-column: 2; }
.person label.goal-max { grid-column: 3; }
.person label.goal-pace { grid-column: 4; }
.person button {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
}
.person button:hover { border-color: var(--muted); }
.person button.danger { color: var(--missed); }
.person.routine { grid-template-columns: minmax(110px, 1.2fr) minmax(250px, 2fr) 96px 90px 80px 140px 196px; }
.person .days { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.person .day-checks { display: flex; flex-wrap: wrap; gap: 0 10px; }
.person .day-checks label.check { gap: 4px; }
.wt .ch-good { color: var(--done); font-weight: 600; }
.wt .ch-bad { color: var(--missed); font-weight: 600; }
.wt.change { max-width: 460px; }
.kv li.err { color: var(--missed); font-size: 12px; overflow-wrap: anywhere; }

/* ---------- food log */
/* /food lands here: below the sticky header */
#food { scroll-margin-top: 64px; }
.food-left { font-weight: 600; margin-top: 4px; }
.food-left.over { color: var(--missed); }
.bar.over i { background: var(--missed); }
.wt.meals td.meal-name { white-space: normal; overflow-wrap: anywhere; width: 100%; }
.wt.meals td:last-child { padding-right: 0; }
.meal-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: end; margin-top: 12px; }
.meal-form .meal-what { grid-column: 1 / -1; }
.meal-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.meal-form input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; min-width: 0; width: 100%;
}
.meal-form button {
  grid-column: 2 / -1; padding: 6px 12px; border: 1px solid var(--today); border-radius: 8px;
  background: var(--today); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.photo-link { font-size: 12px; color: var(--today); }
.photo-row {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px;
  border-radius: 10px; background: color-mix(in srgb, var(--today) 7%, var(--panel));
}
.photo-row.failed { background: color-mix(in srgb, var(--missed) 8%, var(--panel)); }
.photo-row img { display: block; width: 52px; height: 52px; object-fit: cover; border-radius: 7px; }
.photo-row .photo-what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.photo-row form { margin: 0; }
.photo-row button {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}
.photo-row button.del { border: none; background: none; color: var(--muted); font-size: 16px; padding: 0 4px; }
.photo-row button.del:hover { color: var(--missed); }
.photo-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: end; margin-top: 12px; }
.photo-form .photo-pick { grid-column: 1 / -1; }
.photo-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 0; }
.photo-form input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; min-width: 0; width: 100%;
}
.photo-form button {
  padding: 6px 12px; border: 1px solid var(--today); border-radius: 8px;
  background: var(--today); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.photo-form button:disabled { opacity: .6; cursor: default; }
.dishes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dishes form { margin: 0; }
.dishes button {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--event-bg); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}
.dishes button:hover { border-color: var(--muted); }

/* ---------- notes for the coach */
.coach-page { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.coach-page .card > p { margin: 8px 0 0; }
.notes { list-style: none; margin: 10px 0 0; padding: 0; }
.note-row { padding: 8px 0 8px 12px; border-left: 3px solid var(--c, var(--line)); margin-top: 8px; }
.note-row.open, .note-row.missing { --c: var(--planned); }
.note-row.sent { --c: var(--done); }
.note-row.yours { --c: var(--today); }
.note-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.note-text { margin-top: 4px; overflow-wrap: anywhere; }
.coach-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.coach-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.coach-form textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg); resize: vertical;
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; width: 100%;
}
.coach-form .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.coach-form button {
  padding: 6px 12px; border: 1px solid var(--today); border-radius: 8px;
  background: var(--today); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.coach-form button.ghost { background: var(--panel); color: var(--text); border-color: var(--line); font-weight: 400; }
.coach-form button.ghost:hover { border-color: var(--muted); }
#draft .btn { margin-top: 10px; }

/* ---------- plans */
.plan-page { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-list a, .plan-link a { color: var(--today); }
.plan-link { margin: 6px 0 0; }
.plan-body { line-height: 1.5; overflow-wrap: anywhere; }
.plan-body > :first-child { margin-top: 0; }
.plan-body > :last-child { margin-bottom: 0; }
.plan-body h2 { font-size: 17px; margin: 18px 0 6px; }
.plan-body h3 { font-size: 15px; margin: 14px 0 4px; }
.plan-body ul, .plan-body ol { padding-left: 22px; }
.plan-body a { color: var(--today); }
/* a wide table scrolls by itself, not the page */
.plan-body table { display: block; overflow-x: auto; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.plan-body th, .plan-body td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.plan-body th { background: var(--event-bg); }
.plan-page details summary { cursor: pointer; color: var(--today); }
.coach-form input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px;
}

/* ---------- narrow screens: weeks become day lists */
@media (max-width: 900px) {
  .cal-head { display: none; }
  .week { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
  .week-label { display: block; order: -2; font-size: 15px; margin: 6px 2px 0; }
  .totals { order: -1; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
  .totals .bar { display: none; }
  .day { min-height: 0; }
  .wd { display: inline; }
  .day-page { grid-template-columns: minmax(0, 1fr); }
  .day-side { order: -1; }
  .sync .muted { display: none; }
  .person { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .person label:first-of-type { grid-column: 1 / -1; }
  .person label.goal { grid-row: auto; grid-column: auto; }
  .person.routine { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .person.routine .days { grid-column: 1 / -1; }
  .goal-line { margin-left: 0; flex-basis: 100%; }
  /* 16px keeps phones from zooming into the field */
  .meal-form input, .photo-form input, .coach-form textarea, .coach-form input { font-size: 16px; }
  #food { scroll-margin-top: 112px; }
}
.day-side .text-label { margin-top: 10px; }

/* form page */
.form-page { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.form-page .wt td .small { font-size: 11px; }
@media (max-width: 700px) { .form-page .wt td .small { display: block; } }

/* races */
.races-page { display: flex; flex-direction: column; gap: 12px; max-width: 980px; }
.races-page details summary { cursor: pointer; color: var(--today); }
.wt.races td { white-space: normal; vertical-align: top; }
.wt.races .when { white-space: nowrap; width: 62px; }
.wt.races tr.month th { padding-top: 12px; font-size: 13px; color: var(--text); text-transform: capitalize; }
.wt.races tr.past { opacity: 0.6; }
.race-name a { color: var(--text); font-weight: 600; text-decoration: none; }
.race-name a:hover { color: var(--today); }
.race-name a.ext { font-weight: 400; color: var(--today); margin-left: 4px; font-size: 12px; }
.race-name .goal { margin-top: 2px; }
.prio { display: inline-block; min-width: 18px; text-align: center; border-radius: 5px; font-size: 11px; font-weight: 700; padding: 1px 4px; margin-right: 4px; color: #fff; }
.prio-a { background: var(--missed); }
.prio-b { background: var(--partial); }
.prio-c { background: var(--planned); }
.trip { font-size: 11px; color: var(--muted); }
.trip-family { color: var(--done); }
.trip-trip { color: var(--unplanned); }
.warn { color: var(--missed); margin: 6px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
button.mini {
  font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); white-space: nowrap;
}
button.mini:hover { border-color: var(--today); color: var(--today); }
.coach-form select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px;
}
@media (max-width: 700px) {
  .wt.races td:nth-child(3) { display: none; }
  .coach-form select { font-size: 16px; }
}

