/* 316 Wellness Hub styles. Colors, fonts and radius come from theme.js as
   CSS variables; this file only lays things out. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: var(--font-heading); font-weight: 700; margin: 0 0 8px; letter-spacing: -0.02em; }
h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: var(--bg) var(--login-backdrop) center / cover no-repeat;
}
.login .logo { width: 210px; height: auto; margin: 0 auto 18px; display: block; }
.login form { max-width: 380px; width: 100%; margin: 0 auto; }
.login .subtitle { text-align: center; margin: 0 0 6px; font-size: 15px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.login .tagline { text-align: center; margin-bottom: 32px; font-size: 15px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--text-muted); margin: 12px 0 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 13px 14px; color: var(--text);
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.btn {
  font: inherit; font-weight: 600; width: 100%; padding: 14px; margin-top: 16px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 980px;
}
.btn.secondary { background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); }
.btn.small { width: auto; padding: 8px 14px; margin: 0; font-size: 14px; }
.error { color: var(--danger); margin-top: 12px; font-size: 14px; }

/* ---------- shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .logo { height: 26px; width: auto; display: block; }
.topbar .logolink { display: inline-flex; align-items: center; }
.topbar .who { font-size: 13px; color: var(--text-muted); text-align: right; }
.topbar .who strong { display: block; color: var(--text); font-weight: 600; }
.contextbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 14px;
}
.contextbar .ctx-nav { display: inline-flex; gap: 14px; align-items: center; }
.contextbar .ctx-nav a:first-child { font-weight: 600; }
.tier { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; background: var(--tint); color: var(--text); border: 1px solid var(--border); }
main.screen { flex: 1; padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); max-width: 640px; width: 100%; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
/* On a phone the tab bar is solid (a blurred fixed bar misplaces itself on iPhone after the keyboard closes) and steps aside while typing. */
@media (max-width: 640px) {
  .tabbar { background: var(--surface-raised); backdrop-filter: none; -webkit-backdrop-filter: none; }
  body.typing .tabbar, body.typing .rest-timer { display: none; }
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: var(--text-muted); font-size: 10.5px; font-weight: 500; letter-spacing: 0.02em; border-radius: 10px; }
.tabbar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
@media (min-width: 640px) { .tabbar { max-width: 640px; margin: 0 auto; left: 0; right: 0; border-radius: 16px 16px 0 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); } }
/* Signed-in app on a desktop (960px and wider): one wider page for every screen, with its cards
   flowing into columns where that reads better. Nothing here applies to a phone or tablet. */
@media (min-width: 960px) {
  .app.hub main.screen { max-width: 1080px; }
  .app.hub .tabbar { max-width: 1080px; }
  .home-grid { column-count: 2; column-gap: 20px; }
  .home-grid > * { break-inside: avoid; }
  /* The programs list reads across: 316 Method and Elite Plan side by side, Executive Plan under the 316 Method, then the rest in order. */
  .home-grid.prog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; column-count: auto; }
  .pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
  .week-days { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
}

/* ---------- cards and lists ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stat { display: flex; flex-direction: column; }
.stat .value { font-family: var(--font-heading); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat .label { font-size: 12px; color: var(--text-muted); letter-spacing: 0.02em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.placeholder { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.chev { color: var(--text-muted); }

/* ---------- step 4 additions ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--track); margin-top: 14px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.numbered { margin: 0; padding: 0 0 0 22px; }
.numbered li { padding: 6px 0; }
.numbered li::marker { color: var(--accent); font-weight: 600; }
.list li .bullet { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; align-self: flex-start; }
.list li:has(.bullet) { justify-content: flex-start; align-items: flex-start; }

/* ---------- step 5 additions ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer; }
.chip.current { border-color: var(--accent); color: var(--text); }
.chip.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.exrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; color: inherit; }
.rx { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.video-card video { width: 100%; border-radius: 12px; background: #000; display: block; aspect-ratio: 16 / 9; }
.video-card iframe { width: 100%; border: 0; border-radius: 12px; display: block; aspect-ratio: 16 / 9; }
.ex-image { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; display: block; margin-bottom: 10px; }
.media-placeholder { text-align: center; padding: 28px 16px; }
.media-placeholder img { width: 72px; opacity: 0.6; }

/* ---------- step 6: charts, photos, history ---------- */
.chart-card .stat .value { font-size: 26px; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 6px; touch-action: pan-y; }
svg.chart .grid { stroke: var(--tint); stroke-width: 1; }
svg.chart .area { fill: var(--chart-fill); }
svg.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
svg.chart .val { fill: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
svg.chart .axis { fill: var(--text-muted); font-size: 13px; }
svg.chart .hit { fill: transparent; cursor: crosshair; }
svg.chart .cursor line { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .cursor circle { fill: var(--surface); stroke: var(--chart-line); stroke-width: 2; }
.tip { margin-top: 6px; font-size: 13px; color: var(--text); min-height: 18px; font-variant-numeric: tabular-nums; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); display: block; }
.photos figcaption { font-size: 12px; margin-top: 6px; line-height: 1.3; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; padding: 0 0 8px; }
.table td { padding: 8px 0; border-top: 1px solid var(--border); }
.table th:not(:first-child), .table td:not(:first-child) { text-align: right; }

/* ---------- step 7: documents ---------- */
.upload-btn { display: block; text-align: center; margin: 0; cursor: pointer; }
.doc-icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; background: var(--tint); display: flex; align-items: center; justify-content: center; }
.doc-icon svg { width: 20px; height: 20px; stroke: var(--accent); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title { font-size: 22px; word-break: break-word; }
.doc-card { padding: 8px; }
.doc-card { padding: 0; overflow: hidden; }
.doc-frame { width: 100%; height: 58vh; border: 0; border-radius: 12px 12px 0 0; background: #fff; display: block; }
.doc-image { width: 100%; height: auto; border-radius: 12px; display: block; }

/* ---------- step 8: coach measurement form ---------- */
.measure-form .grid3 { gap: 10px; }
.measure-form .grid3 label { margin-top: 10px; }
.measure-form input[type=number] { padding-left: 10px; padding-right: 6px; }
@media (max-width: 360px) { .measure-form .grid3 { grid-template-columns: 1fr; } }

/* ---------- workout log: sets ---------- */
.list li.exitem { display: block; }
.exhead { display: flex; align-items: center; gap: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.exhead .status { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; }
.exhead .status svg { width: 16px; height: 16px; stroke: transparent; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.exitem.done .status { background: var(--accent); border-color: var(--accent); }
.exitem.done .status svg { stroke: var(--accent-text); }
.exitem.done .exname strong { color: var(--text-muted); }
.exhead .exname { flex: 1; min-width: 0; }
.exhead .exmeta { flex: 0 0 auto; text-align: right; }
.exhead .rx { font-weight: 600; font-variant-numeric: tabular-nums; }
.exitem.open .exhead .exname strong { color: var(--text); }
.setbox { margin: 12px 0 4px 42px; }
.sets { display: flex; flex-direction: column; gap: 8px; }
.sethead, .setrow { display: grid; grid-template-columns: 22px 1fr 14px 1fr 34px; align-items: center; gap: 6px; }
.sethead { font-size: 11px; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.setrow .setno { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: center; }
.setrow label { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 11px; color: var(--text-muted); }
.setrow input { padding: 8px 6px; text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; min-width: 0; }
.setrow input::-webkit-outer-spin-button, .setrow input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.setrow input::placeholder { color: var(--placeholder); }
.setrow .x { color: var(--text-muted); text-align: center; }
.tick { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.tick svg { width: 18px; height: 18px; stroke: transparent; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.setrow.done .tick { background: var(--accent); border-color: var(--accent); }
.setrow.done .tick svg { stroke: var(--accent-text); }
.setrow.done input { color: var(--text-muted); }
.setbox > a { display: inline-block; margin-top: 10px; }
.sessions td:last-child { text-align: left; font-variant-numeric: tabular-nums; }
.table tr.current-row td { color: var(--accent); }

/* ---------- phases, weekdays, editor, library ---------- */
.daycard .dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.daycard.rest { padding: 10px 16px; opacity: 0.6; }
.daycard.today { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.workout + .workout { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.workout .wtitle { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.movesel { font: inherit; font-size: 12px; padding: 4px 8px; width: auto; border-radius: 8px; background: var(--surface-raised); color: var(--text-muted); border: 1px solid var(--border); }
.alts { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.tempo { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.setrow .settarget { grid-column: 1 / -1; font-size: 11px; color: var(--text-muted); margin: -2px 0 0 28px; }
.sethead { grid-template-columns: 22px 1fr 14px 1fr 34px; }
.setrow.single { grid-template-columns: 22px 1fr 34px; }
.setrow.single label { grid-column: 2; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; background: var(--tint); color: var(--text-muted); border: 1px solid var(--border); }
.libprog summary { list-style: none; cursor: pointer; display: block; }
.libprog summary::-webkit-details-marker { display: none; }
.libprog.locked { opacity: 0.72; }
.badge.locked { color: var(--text-muted); }
.badge.current { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.badge.upcoming { color: var(--text); }
.phase-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; color: inherit; }
.locked { opacity: 0.55; pointer-events: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.btn.tiny { width: auto; padding: 6px 10px; margin: 0; font-size: 13px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.editrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.editrow label { margin-top: 6px; }
.edit-ex { padding: 12px 0; border-top: 1px solid var(--border); }
.edit-ex:first-child { border-top: 0; }
.edit-ex .exhead { display: flex; justify-content: space-between; gap: 10px; align-items: center; cursor: default; }
.edit-ex .actions { display: flex; gap: 6px; }
.edit-ex .actions button { font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-raised); color: var(--text); cursor: pointer; }
.edit-ex details { margin-top: 8px; }
.edit-ex summary { cursor: pointer; font-size: 13px; color: var(--accent); }
textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.search-results { max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; margin-top: 6px; }
.search-results button { display: block; width: 100%; text-align: left; font: inherit; padding: 10px 12px; background: transparent; border: 0; border-top: 1px solid var(--border); color: var(--text); cursor: pointer; }
.search-results button:first-child { border-top: 0; }
.search-results button.active, .search-results button:hover:not(:disabled) { background: var(--tint); }
.search-results button span { color: var(--text-muted); font-size: 12px; }
.status { font-size: 13px; color: var(--text-muted); min-height: 18px; }
.daygrid { display: flex; gap: 6px; flex-wrap: wrap; }
.daygrid label { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); margin: 0; }
.daygrid input { width: auto; }
.coach-tabs a { font-size: 10.5px; }
.summary-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

/* ---------- calendar ---------- */
.tabbar.many a { font-size: 9.5px; padding: 6px 0; }
.tabbar.many a svg { width: 20px; height: 20px; }
.chip.small { width: auto; height: 32px; border-radius: 999px; padding: 0 12px; font-size: 13px; }
.cal-workout { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: inherit; background: transparent; border: 0; padding: 8px 0; cursor: pointer; border-top: 1px solid var(--border); }
.cal-workout:first-of-type { border-top: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: 0 0 9px; }
.dot.done { background: var(--accent); }
.dot.partial { background: transparent; border: 2px solid var(--accent); box-sizing: border-box; }
.cal-card { padding: 10px 6px 12px; margin-left: -8px; margin-right: -8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-head { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--text-muted); letter-spacing: 0.06em; margin-bottom: 4px; }
.cal-cell { position: relative; min-height: 64px; border-radius: 8px; padding: 5px 4px 4px; background: var(--cell); display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.past { opacity: 0.6; }
.cal-cell .num { white-space: nowrap; }
.cal-cell .num .mon { font-size: 9px; color: var(--text-muted); margin-left: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-cell .num.month { font-size: 11px; letter-spacing: -0.01em; }
.cal-cell.ph0 { background: var(--cell-phase0); }
.cal-cell.ph1 { background: var(--cell-phase1); }
.cal-cell.today { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.cal-cell.has { cursor: pointer; }
.cal-cell .num { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1; }
.cal-cell.today .num { color: var(--accent); }
.cal-cell .phlabel { font-size: 9px; color: var(--accent); letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-cell .wt { font-size: 10.5px; color: var(--text); line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.cal-cell .dot { width: 8px; height: 8px; flex: 0 0 8px; }
@media (min-width: 640px) { .cal-card { margin-left: 0; margin-right: 0; padding: 14px; } .cal-grid { gap: 6px; } .cal-cell { min-height: 110px; padding: 8px; } .cal-cell .wt { font-size: 12px; } .cal-cell .num { font-size: 15px; } }
.mk { position: absolute; right: 3px; top: 3px; width: 10px; height: 10px; border-radius: 2px; background: var(--text-muted); box-shadow: 0 0 0 4px transparent; }
a.mk { cursor: pointer; }
a.mk:hover, a.mk:focus { background: var(--text); }
.cal-cell a.phlabel { color: var(--accent); }

/* ---------- home: encouragement and next steps ---------- */
.encourage { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.encourage .verse { font-family: var(--font-heading); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; margin: 0 0 8px; }
.steps .step { justify-content: flex-start; align-items: flex-start; gap: 10px; }
.steps .step .tick { flex: 0 0 30px; width: 30px; height: 30px; margin-top: 1px; }
.steps .step .tick svg { width: 16px; height: 16px; }
.steps .step.done .tick { background: var(--accent); border-color: var(--accent); }
.steps .step.done .tick svg { stroke: var(--accent-text); }
.steps .step.done > span, .steps .step.done .steplink { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--line); }
.steps .step.done .steplink span span { display: none; }
.steplink { flex: 1; min-width: 0; color: inherit; display: flex; }
.step-edit { display: block; }
.step-edit .btn.tiny { padding: 6px 8px; }

/* ---------- blueprint pillars ---------- */
.pillar .pillar-tag { font-family: var(--font-heading); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.pillar.finish { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.pillar.finish .pillar-tag { color: var(--accent); }

/* ---------- progress photo sets ---------- */
.photoset { padding: 12px 0 4px; border-top: 1px solid var(--border); }
.photoset:first-of-type { border-top: 0; padding-top: 4px; }
.photos4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tile { position: relative; margin: 0; }
.tile img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); display: block; background: var(--surface-raised); }
.tile.empty { cursor: pointer; }
.tile.empty img { opacity: 0.6; border-style: dashed; }
.tile.has img { cursor: zoom-in; }
.tile figcaption { font-size: 13px; margin-top: 6px; text-align: center; line-height: 1.3; }
.tile figcaption .small { color: var(--text-muted); }
.tile-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.65); color: #fff; font-size: 13px; cursor: pointer; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 12px; }
.lightbox p { color: var(--text-muted); margin: 0; }

.photonav { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; }
.photonav select { flex: 1; }
.photos4.row4 { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 0; }
.row4 .tile figcaption { font-size: 11px; margin-top: 4px; }
.row4 .tile-x { width: 22px; height: 22px; font-size: 11px; top: 4px; right: 4px; }
.row4 .tile img { border-radius: 8px; }

/* ---------- progress sections ---------- */
.subtabs { margin: 4px 0 14px; }
/* The Library's five parts all show, wrapping onto a second line on a phone, rather than scrolling off the edge. */
.chips.subtabs { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none !important; mask-image: none !important; }
.subtabs .chip { text-decoration: none; display: inline-flex; align-items: center; }
.latest { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.latest-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-raised); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.latest-tile.selected { border-color: var(--accent); }
.latest-tile .label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.latest-tile .value { font-family: var(--font-heading); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.latest-tile .unit { font-size: 12px; font-weight: 400; color: var(--text-muted); letter-spacing: 0; }
.latest-tile .delta { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.latest-tile .delta.good { color: var(--success); }
.latest-tile .delta.bad { color: var(--danger); }
.marker-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 34px; gap: 6px; margin-bottom: 8px; align-items: center; }
.marker-row input { padding: 8px 8px; font-size: 14px; }
.marker-row .row-x { padding: 6px 0; }
.table.blood td, .table.blood th { text-align: left; }
.table.blood tr.flag-high td:nth-child(2) strong, .table.blood tr.flag-low td:nth-child(2) strong { color: var(--accent); }
.badge.flag { margin-left: 6px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

/* ---------- history by month ---------- */
details.month { border-top: 1px solid var(--border); padding: 8px 0; }
details.month:first-of-type { border-top: 0; }
details.month summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
details.month summary::-webkit-details-marker { display: none; }
details.month summary::before { content: '›'; color: var(--text-muted); margin-right: 8px; display: inline-block; transition: transform 0.15s; }
details.month[open] summary::before { transform: rotate(90deg); }
details.month .table { margin-top: 8px; }

/* ---------- agreements ---------- */
.steps .step.auto .status-dot { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; position: relative; margin-top: 1px; }
.steps .step.auto .status-dot::after { content: '!'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 700; font-size: 14px; }
.agreement .btn.tiny { flex: 0 0 auto; }

/* ---------- PAR-Q ---------- */
.parq-q { padding: 10px 0; border-top: 1px solid var(--border); }
.parq-q:first-of-type { border-top: 0; }
.parq-q p { margin: 0 0 6px; }
.parq-q .daygrid label { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; }
.parq-q .daygrid label:has(input:checked) { border-color: var(--accent); color: var(--text); }

/* ---------- nutrition library ---------- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.grid5 input { padding: 8px 6px; }
.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.recipe-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; color: inherit; }
.recipe-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-raised); }
.recipe-card .rc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.recipe-card strong { font-size: 14px; line-height: 1.25; }
.recipe-hero { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.recipe-hero > img { width: 120px; height: 90px; object-fit: cover; border-radius: 12px; flex: 0 0 120px; background: var(--surface-raised); }
.recipe-hero > .cover-pick { margin: 0; cursor: pointer; position: relative; flex: 0 0 120px; }
.recipe-hero > .cover-pick > img { width: 120px; height: 90px; object-fit: cover; border-radius: 12px; display: block; background: var(--surface-raised); }
.recipe-hero > .cover-pick > span { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; color: var(--accent); pointer-events: none; }
.macro-strip .stat .value { font-size: 22px; }
.macro-strip .unit { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.donut-wrap { display: flex; gap: 14px; align-items: center; }
.donut { width: 120px; height: 120px; flex: 0 0 120px; }
.donut-num { fill: var(--text); font-size: 18px; font-weight: 700; font-family: var(--font-heading); }
.donut-lbl { fill: var(--text-muted); font-size: 9px; }
.donut-legend { flex: 1; }
.donut-legend .dot { display: inline-block; vertical-align: middle; margin-right: 6px; }
@media (min-width: 640px) { .recipe-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- meal plans ---------- */
.macro-strip .label .target { font-size: 10px; color: var(--text-muted); letter-spacing: 0; text-transform: none; }
.meal { padding: 10px 0; border-top: 1px solid var(--border); }
.meal:first-of-type { border-top: 0; padding-top: 4px; }
.mealhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mealhead .actions { display: flex; gap: 4px; flex: 0 0 auto; }
.mealhead .actions button, .mi-edit button { font: inherit; font-size: 13px; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-raised); color: var(--text-muted); border: 1px solid var(--border); cursor: pointer; padding: 0; }
.mealhead .actions button:disabled { opacity: 0.35; cursor: default; }
.list.mealitems { margin-top: 6px; }
.list li.mealitem { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.mi-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; }
.mi-link img, .pickrow img { width: 44px; height: 44px; flex: 0 0 44px; object-fit: cover; border-radius: 10px; background: var(--surface-raised); }
.mi-body { display: flex; flex-direction: column; min-width: 0; }
.mi-body strong { font-size: 14px; line-height: 1.25; }
.mi-edit { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.mi-edit input { width: 58px; padding: 6px 4px; text-align: right; font-variant-numeric: tabular-nums; }
.meal.done .mealhead > span > strong { color: var(--text-muted); }
.addfood { margin-top: 8px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.picklist { margin-top: 6px; max-height: 300px; overflow: auto; }
.pickrow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: inherit; background: transparent; border: 0; padding: 6px 0; cursor: pointer; }
.pickrow .chev { color: var(--accent); font-size: 20px; }
.inline-details summary { list-style: none; display: inline-block; }
.inline-details summary::-webkit-details-marker { display: none; }
.cal-meal { text-decoration: none; }
.cal-meal .mealicon { width: 22px; height: 22px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; }
.cal-meal .mealicon svg { width: 18px; height: 18px; fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cal-meal.done .mealicon svg { stroke: var(--accent); }
.cal-cell .ml { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.cal-cell .ml.done { background: var(--accent); }
.cal-cell .ml:hover { color: var(--text); }
.mealhead .tick { flex: 0 0 34px; margin-right: 2px; }
.meal.done .tick { background: var(--accent); border-color: var(--accent); }
.meal.done .tick svg { stroke: var(--accent-text); }
.meal.done .mealitems { opacity: 0.6; }
.list li.shoprow { display: block; padding: 0; }
.shoprow label { display: flex; align-items: center; gap: 12px; padding: 10px 0; margin: 0; cursor: pointer; font-size: 15px; color: var(--text); text-transform: none; letter-spacing: 0; }
.shoprow input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--accent); margin: 0; }
.shoprow .shopbody { flex: 1; min-width: 0; }
.shoprow .qty { font-weight: 400; color: var(--text-muted); white-space: nowrap; }
.shoprow.done strong { color: var(--text-muted); text-decoration: line-through; }
.cal-meal.partial .mealicon svg { stroke: var(--text); }

.list li.replacebox { display:block; padding:8px 0 4px }
.replacebox .picklist { margin-top:6px }
.inline-ask { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 0 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); vertical-align: middle; }
.chip.danger { border-color: var(--danger); color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: 90vw; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.inline-ask.block { display: flex; margin: 8px 0 0; }

/* taking on clients */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.field-error { margin: 4px 0 0; font-size: 13px; }
.checkline { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 4px; color: var(--text); font-size: 15px; }
.checkline input { width: auto; margin: 3px 0 0; flex: 0 0 auto; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-raised); padding: 1px 6px; border-radius: 6px; }
input:disabled { opacity: 0.6; }

details.small summary { cursor: pointer; color: var(--accent); margin: 8px 0 4px; }

/* coach strip on Home; workout cards on Program */
.card.coach { display: flex; align-items: center; gap: 14px; }
.card.coach img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 2px solid color-mix(in srgb, var(--accent) 60%, var(--border)); }
.daycard .workout-card { padding: 10px 0 2px; }
.daycard .workout-card + .workout-card { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }
.workout-card.done strong { color: var(--text-muted); }

/* messaging */
.topbar { position: relative; }
.topbar .msgbtn { position: relative; display: inline-flex; align-items: center; margin-left: 10px; color: var(--text); }
.topbar .msgbtn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linejoin: round; }
.unread { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700; }
.topbar .msgbtn .unread { position: absolute; top: -6px; right: -8px; }
.list.msgs { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; }
.list.msgs li.msg { display: flex; flex-direction: column; align-items: flex-start; border: 0; padding: 0; gap: 3px; }
.list.msgs li.msg.mine { align-items: flex-end; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface-raised); color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.msg.mine .bubble { border-radius: 16px 16px 4px 16px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }
.msg .when { font-size: 11px; }
.composer { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; background: var(--bg); padding: 8px 0; }
.composer textarea { flex: 1; min-height: 44px; margin: 0; font-family: inherit; font-size: 15px; resize: none; }
.composer .btn { margin: 0; }
.unread[hidden] { display: none; }
.topbar .who { font-size: 12px; line-height: 1.35; }
/* blueprint editor rows: the text takes the full width, controls sit under it */
.bp-row .row { flex-wrap: wrap; }
.bp-row input[name="text"] { flex: 1 1 100% !important; }

.msg .msg-del { color: var(--text-muted); }
.msg .msg-del:hover { color: var(--danger); }

.login .art { width: min(56vw, 250px); height: auto; margin: 0 auto 14px; display: block; }

/* ---------- desktop polish (960px and wider only): matching cards, a clearer calendar ---------- */
/* The new calendar pieces are hidden everywhere a desktop rule does not switch them on. */
.cal-pill, .cal-phasebar, .rest-new { display: none; }
@media (min-width: 960px) {
  /* Home: every card the same size and the same border. */
  .home-grid.uniform { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(284px, auto); gap: 18px; column-count: auto; }
  .home-grid.uniform > .card { margin: 0; padding: 22px 24px; display: flex; flex-direction: column; min-width: 0; border-color: var(--border); }
  .home-grid.uniform > .card.coach { flex-direction: row; align-items: center; }
  .home-grid.uniform > .card:not(.home-wide) .list { max-height: 205px; overflow-y: auto; }
  .home-grid.uniform > .card:not(.home-wide) .list { scrollbar-width: thin; padding-right: 6px; }
  .home-grid.uniform .list.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent); }

  /* Blueprint: three pillars of one size and one look. */
  .pillars { align-items: stretch; gap: 18px; }
  .pillars > .card { margin: 0; padding: 22px 24px; display: flex; flex-direction: column; border-color: var(--border); }
  .pillars .pillar.finish { border-color: var(--border); }
  .pillars .pillar.finish .pillar-tag { color: inherit; }
  .pillars .pillar > p.small.muted { min-height: 3.9em; }

  /* Program: the days of a week as cards of one size; a rest day is the same card as a workout day. */
  .week-days { gap: 16px; grid-auto-rows: 1fr; align-items: stretch; }
  .week-days > .card { margin: 0; padding: 18px 22px; display: flex; flex-direction: column; min-height: 156px; }
  .week-days > .card.rest { opacity: 1; }
  .week-days > .card.rest > .dayhead { display: none; }
  .week-days > .card.rest > .rest-new { display: block; }
  .rest-line { padding: 10px 0 2px; }

  /* Calendar: the phase up front, and workouts and meals as labelled, full-width targets. */
  .cal-phasebar { display: flex; align-items: center; gap: 28px; margin: 6px 0 16px; padding: 20px 26px; border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border)); border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface)); color: inherit; text-decoration: none; }
  .cal-phasebar .pb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .cal-phasebar .eyebrow { margin: 0; }
  .cal-phasebar strong { font-family: var(--font-heading); font-size: 30px; letter-spacing: -0.02em; line-height: 1.1; }
  .cal-phasebar .pb-dates { color: var(--text-muted); font-size: 14px; }
  .cal-phasebar .pb-bar { display: block; height: 5px; max-width: 420px; margin-top: 8px; border-radius: 3px; background: var(--track); overflow: hidden; }
  .cal-phasebar .pb-bar i { display: block; height: 100%; background: var(--accent); }
  .cal-phasebar .pb-next { text-align: right; color: var(--text-muted); font-size: 13px; line-height: 1.4; }
  .cal-phasebar .pb-next strong { font-family: inherit; font-size: 15px; letter-spacing: 0; color: var(--text); }
  .cal-cell { min-height: 150px; gap: 6px; }
  .cal-cell.past { opacity: 0.85; }
  .cal-cell .dot, .cal-cell a.ml, .cal-cell a.mk, .cal-legend { display: none; }
  .cal-pill { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 7px 9px; border: 1px solid transparent; border-radius: 9px; background: var(--pill); color: var(--text); text-decoration: none; font-size: 12px; line-height: 1.25; }
  .cal-pill:hover { border-color: var(--accent); background: var(--pill-hover); }
  .cal-pill .pill-title { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 600; }
  .cal-pill.ml2 .pill-title { font-weight: 500; }
  .cal-pill .pill-meta { flex: 0 0 auto; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
  .cal-pill.done { background: color-mix(in srgb, var(--accent) 24%, transparent); }
  .cal-pill.done .pill-meta { color: var(--text); }
  .cal-pill.partial { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
  .cal-pill.mk2 { background: transparent; border-color: var(--border); }
  .cal-pill.wk { flex-direction: column; align-items: flex-start; gap: 3px; }
  .cal-pill.wk .pill-title { -webkit-line-clamp: 3; }
}

/* ---------- sign-in footage ---------- */
.login { position: relative; isolation: isolate; }
.login-still, .login-video, .login-veil { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
.login-still { background: center / cover no-repeat; }
.login-video { object-fit: cover; }
/* A deep veil with a warm glow low in the frame keeps the stencil and the form legible over any frame. */
.login-veil { background: radial-gradient(ellipse 44% 74% at 50% 50%, rgba(0,0,0,0.68), transparent 100%), radial-gradient(ellipse at 50% 100%, rgba(255,69,58,0.12), transparent 55%), linear-gradient(rgba(0,0,0,0.10), rgba(0,0,0,0.30)); }
.login .subtitle, .login .tagline, .login label, .login form + p, .login p.muted { text-shadow: var(--text-shadow); }
@media (prefers-reduced-motion: reduce) { .login-video { display: none; } }
/* Footage is landscape: on a phone it is a band across the top that fades into the page, not a cropped full screen. */
@media (max-width: 700px) {
  .login-still, .login-video, .login-veil { bottom: auto; height: 46dvh; -webkit-mask-image: linear-gradient(#000 52%, transparent); mask-image: linear-gradient(#000 52%, transparent); }
  .login-veil { background: radial-gradient(ellipse 80% 46% at 50% 44%, rgba(0,0,0,0.50), transparent 100%), linear-gradient(rgba(0,0,0,0.06), rgba(0,0,0,0.26)); }
}

/* ---------- home banner: a photograph behind the greeting ---------- */
.home-hero { position: relative; isolation: isolate; display: flex; align-items: flex-end; min-height: 152px; padding: 20px; margin: 0 0 18px; background: var(--hero-backing); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.home-hero::after { opacity: 0; transition: opacity 0.5s ease; content: ''; position: absolute; inset: 0; z-index: -2; background: var(--hero) var(--hero-pos, 50% 80%) / cover no-repeat; filter: var(--hero-filter, none); }
.home-hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(0,0,0,0.58), rgba(0,0,0,0.10) 55%, rgba(0,0,0,0)); }
.home-hero h1 { margin: 0; color: var(--on-photo); }
.home-hero .hh-text { flex: 1; min-width: 0; }
.home-hero .hh-sub { margin: 4px 0 0; font-size: 14px; color: rgba(255,255,255,0.8); text-shadow: 0 1px 12px rgba(0,0,0,0.7); }
.home-hero.slim { min-height: 118px; padding: 16px 20px; }
.home-hero .hh-badge.complete, .home-hero .hh-badge.upcoming { background: rgba(0,0,0,0.62); color: var(--on-photo-muted); }
.home-hero.ready::after { opacity: 1; }
.home-hero.instant::after { transition: none; }
@media (prefers-reduced-motion: reduce) { .home-hero::after { transition: none; } }
.home-hero .eyebrow { margin-bottom: 4px; color: var(--accent-on-photo); }
.home-hero .hh-badge.current { color: var(--accent-on-photo); }
.home-hero .hh-badge { display: inline-block; margin-top: 12px; background: rgba(0,0,0,0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (max-width: 700px) { .home-hero, .home-hero.slim { min-height: 148px; } .home-hero h1 { font-size: 26px; max-width: 70%; } .home-hero .hh-badge { font-size: 10px; padding: 3px 8px; } }
@media (min-width: 960px) { .home-hero { min-height: 220px; padding: 30px 34px; } .home-hero.slim { min-height: 156px; padding: 22px 34px; } }

/* ---------- small polish: collapsed history, fading tab rows, an overlap warning ---------- */
.list.collapsed li.more { display: none; }
.chips.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.chips.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.chips.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.card.warn { border-color: var(--warn-border); }
.card.warn .eyebrow { color: var(--warn); }

/* Light or dark switch (looks with a `light` set): next to Messages in the top bar, top right on the sign-in page. */
.topbar .tools { display: inline-flex; align-items: center; }
/* The appearance pill: Auto, Light or Dark, cycling on tap. */
.modebtn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 7px; margin: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--pill); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; }
.modebtn:hover { background: var(--pill-hover); }
.modebtn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topbar .modebtn { margin-left: 10px; }
.login .modebtn { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; text-shadow: var(--text-shadow); }
@media (min-width: 960px) { .topbar .modebtn { margin-left: 24px; font-size: 14px; padding: 6px 12px 6px 9px; } .topbar .modebtn svg { width: 20px; height: 20px; } }

/* Coach-only FaceTime button in the client context bar. */
.contextbar .facetime { margin-left: 8px; text-decoration: none; }

/* Desktop only: the signed-in name and the Account link sit at the right, next to Messages, and larger. */
@media (min-width: 960px) {
  .topbar .who { margin-left: auto; font-size: 15px; line-height: 1.4; }
  .topbar .who strong { font-size: 17px; }
  .topbar .who a { display: inline-block; padding: 4px 8px; margin: -4px -4px; font-size: 15px; font-weight: 600; }
  .topbar .msgbtn { margin-left: 24px; }
  .topbar .msgbtn svg { width: 28px; height: 28px; }
}

/* Home: the first-week checklist and Your Week. */
.checklist { margin: 0; }
.checklist li.ckrow { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist li.ckrow:last-child { border-bottom: 0; }
.ck { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: var(--accent-text); }
.ck.on { background: var(--accent); border-color: var(--accent); }
.weekrows { list-style: none; margin: 10px 0 0; padding: 0; }
.weekrows li { display: grid; grid-template-columns: 104px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 15px; line-height: 1.45; }
.weekrows li:first-child { border-top: 0; }
.wk-label { color: var(--text-muted); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 3px; }
.sess-add summary { cursor: pointer; color: var(--accent); font-size: 14px; }
@media (min-width: 960px) { .weekrows li { grid-template-columns: 150px 1fr; font-size: 16px; } }

/* ---------- community ---------- */
.post-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.post-actions .chip { display: inline-flex; align-items: center; }

/* ---------- tier grid ---------- */
.tiergrid { width: 100%; border-collapse: collapse; }
.tiergrid th { text-align: center; font-weight: 600; font-size: 13px; padding: 0 0 10px; }
.tiergrid th[scope=row] { text-align: left; font-weight: 400; font-size: 15px; padding: 12px 10px 12px 0; border-top: 1px solid var(--border); }
.tiergrid td { text-align: center; width: 76px; border-top: 1px solid var(--border); }
.tiergrid input { width: 22px; height: 22px; margin: 0; }
@media (max-width: 420px) { .tiergrid td { width: 62px; } .tiergrid th { font-size: 12px; } }

/* ---------- session look: a client's workout and exercise screens, laid out like a gym app ---------- */
/* Its colors are the hub's own, in whatever appearance (Dark, Light or Auto) the visitor chose under Account. */
.app.hub.session { background: var(--bg); color: var(--text); min-height: 100vh; }
.session-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.session-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.3s ease; }
.app.hub.session .card.workout { background: transparent; border: 0; padding: 0; margin: 0; }
.app.hub.session .card.workout .wtitle { margin-bottom: 10px; }
.app.hub.session .list li.exitem { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 0 0 12px; }
.app.hub.session .list li.exitem.open { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.app.hub.session .exhead .exname strong { font-size: 18px; }
.app.hub.session .exhead .rx { font-size: 17px; }
.app.hub.session .exhead .status { width: 34px; height: 34px; flex-basis: 34px; }
.app.hub.session .setbox { margin: 14px 0 4px; }
.app.hub.session .sethead, .app.hub.session .setrow { grid-template-columns: 26px 1fr 14px 1fr 46px; gap: 8px; }
.app.hub.session .setrow { margin-bottom: 8px; }
.app.hub.session .setrow input { padding: 12px 8px; font-size: 18px; border-radius: 12px; background: var(--bg); border-color: var(--line); }
.app.hub.session .tick { width: 46px; height: 46px; }
.app.hub.session .tick svg { width: 22px; height: 22px; }
.rest-timer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; border-radius: 999px;
  background: #1e1e23; color: #f4f4f6; border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}
.rest-timer strong { font-size: 24px; font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }
.rest-timer button { border: 0; border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; background: rgba(255, 255, 255, 0.12); color: #f4f4f6; }
.rest-timer .rt-skip { background: var(--accent); color: var(--accent-text); }
.rest-timer.over strong { color: var(--accent); }

/* ---------- a newer version is out ---------- */
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; justify-content: center; align-items: center; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 600; }
.update-bar button { border: 0; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; background: rgba(255, 255, 255, 0.92); color: #1c1c1e; }

/* ---------- Today: the client's way into training ---------- */
.today-head { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 4px 0 12px; }
.today-head h1 { margin: 0; font-size: 26px; min-width: 120px; text-align: center; }
.today-head button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 22px; line-height: 1; cursor: pointer; }
.datestrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 20px; }
.dcell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text-muted); font: inherit; font-size: 11px; cursor: pointer; }
.dcell strong { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.dcell.istoday strong { color: var(--accent); }
.dcell.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.daychips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 8px 0 16px; }
.dchip { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; min-width: 0; }
.dchip small { font-size: 9.5px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; text-transform: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dchip.rest { opacity: 0.5; }
.dchip.sel { border-color: var(--accent); opacity: 1; }
.todaycard { padding: 18px; }
.todaycard h2 { font-size: 18px; letter-spacing: 0.03em; margin-bottom: 4px; }
.tnumbers { list-style: none; margin: 14px 0 18px; padding: 0; display: grid; gap: 8px; }
.tnumbers li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-raised); }
.tnumbers .num { flex: 0 0 28px; height: 28px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.tnumbers .tname { flex: 1; min-width: 0; }
.tnumbers .tname strong { font-size: 15px; }
.tpill { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg); color: var(--text-muted); }
.tpill.done { background: var(--accent); color: var(--accent-text); }
.startbtn { display: block; width: 100%; text-align: center; padding: 16px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 800; letter-spacing: 0.08em; font-size: 15px; }

.tabbar a { position: relative; }
.tabbar .tabdot { position: absolute; top: 0; left: calc(50% + 6px); }

/* A program's picture: 4 by 3, the same size as a meal plan's photo, beside the program's name; a placeholder until one is uploaded. */
.progsum { display: flex; gap: 14px; align-items: flex-start; }
.progsum-text { flex: 1; min-width: 0; display: block; }
.libprog summary.progsum { display: flex; }
.prog-pic { width: 120px; height: 90px; flex: 0 0 120px; object-fit: cover; border-radius: 12px; background: var(--surface-raised); display: block; margin: 0; }
#pc-pic { margin: 0 0 10px; }
.libprog.locked .prog-pic { opacity: 0.55; }

/* ---------- coach home ---------- */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.dash-head h2 { margin: 0; font-size: 18px; }
.dash-card .eyebrow { margin: 0 0 6px; }
.badge.late { color: var(--danger); border-color: var(--danger); }
.step-chip { display: inline-block; margin: 6px 6px 0 0; padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; color: var(--text-muted); }
.step-chip.ok { color: var(--text); }
.step-chip.todo { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.list li.dash-msg { display: block; }
.dash-thread { margin: 12px 0 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.dash-msgs { max-height: 280px; overflow-y: auto; margin-bottom: 10px; }
@media (min-width: 960px) {
  .dash .card { margin: 0 0 20px; }
}
}

.list li.dash-alert { gap: 10px; }
.list li.dash-alert .exrow { flex: 1; min-width: 0; }
.list li.dash-alert .btn { flex: 0 0 auto; white-space: nowrap; }

/* Booked sessions on the calendar. */
.cal-cell .ses { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.cal-session { cursor: default; }
.cal-session .mealicon svg { stroke: var(--accent); }
@media (min-width: 960px) { .cal-cell .ses { display: none; } .cal-pill.ses2 { border-color: var(--accent); } }
/* Today's verse: a slim banner at the top of Home. */
.verse-banner { position: relative; margin: 12px 0; padding: 12px 44px 12px 16px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: 14px; background: var(--surface); }
.verse-banner .verse { font-family: var(--font-heading); font-size: 16px; font-weight: 600; line-height: 1.35; margin: 0 0 4px; }
.verse-x { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.verse-x:hover { color: var(--text); }

.latest-stats .stat .value { font-size: 24px; }
.latest-stats .stat .label { font-size: 12px; }

.next-phase-line { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); }

/* Coach: a small + on a month-view calendar cell to add a workout to that day. */
.cal-cell .cal-add { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; padding: 0; line-height: 1; border-radius: 50%; border: 1px solid var(--line, currentColor); background: transparent; color: var(--text-muted); font-size: 14px; cursor: pointer; opacity: 0.55; }
.cal-cell .cal-add:hover, .cal-cell .cal-add:focus-visible { opacity: 1; }

/* Off-plan meals: what a client ate that was not the plan (a skipped or replaced meal, and extras). */
.meallog { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--cell); }
.meallog.swapped, .meallog.skipped { border-left: 3px solid #d9822b; }
.meallog.extra { border-left: 3px solid var(--accent); }
.meallog-photo { display: block; max-width: 100%; max-height: 160px; margin-top: 8px; border-radius: 8px; }
.meallog-form { margin-top: 10px; }
.meallog-form .radio { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.meallog-form .radio input { width: auto; margin: 0; }
.cal-cell .ml.off { box-shadow: 0 0 0 2px #d9822b; }

/* A person's thumbnail: a coach's photo, or their initials in a circle. */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex: 0 0 auto; vertical-align: middle; background: var(--tint, rgba(255,69,58,.12)); color: var(--accent); font-weight: 700; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border, transparent)); overflow: hidden; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.md { width: 48px; height: 48px; font-size: 16px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xl { width: 60px; height: 60px; font-size: 20px; border: 2px solid color-mix(in srgb, var(--accent) 60%, var(--border, transparent)); }
.card.coach .avatar.xl { width: 60px; height: 60px; }
.list.msgs li.msg .msg-from { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.list.msgs li.msg .msg-from .bubble { max-width: calc(100% - 40px); }

/* Pull down from the top to refresh (touch screens). */
.ptr { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; z-index: 99; transform: translate(-50%, calc(-70px + var(--pull, 0px))); opacity: 0; pointer-events: none; transition: opacity .15s ease; padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-raised, #2c2c2e); color: var(--text, #fff); border: 1px solid var(--border, rgba(255,255,255,.2)); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.ptr.show { opacity: 1; }
.ptr.ready { background: var(--accent); color: var(--accent-text, #fff); border-color: var(--accent); }
