/* ---------------------------------------------------------------------------
   style.css — Pckt Coach. Mobile-first. The look is taken from a classic
   climbing shoe: white upper, black rubber, yellow strap. Type is Archivo
   (condensed and heavy for headlines, regular for text).
   --------------------------------------------------------------------------- */

:root {
  /* Palette: white upper, black rubber, yellow strap */
  --paper: #F5F5F2;        /* page: the white upper */
  --paper-dark: #E8E8E3;   /* sunken areas, tracks */
  --paper-card: #FFFFFF;   /* cards and inputs */
  --ink: #1A1A1A;          /* text: rubber black */
  --ink-soft: #5F5F5A;     /* secondary text: stitching grey */
  --rubber: #1A1A1A;       /* hero, Today card, dark fills */
  --yellow: #FFD000;       /* strap yellow: primary actions and selections */
  --yellow-deep: #E8BC00;  /* yellow hover and bars */
  --yellow-soft: #FFF4C2;  /* selected tiles, notes */
  --yellow-text: #7A5F00;  /* yellow-family text that's readable on white */
  --fresh: #1A1A1A;
  --red: #D23A1E;
  --red-tint: #FCE6E1;
  --line: #DCDCD5;
  --line-strong: #B3B3AB;

  /* older names, kept so nothing breaks */
  --pine: var(--rubber);
  --gold: var(--yellow-deep);
  --gold-soft: var(--yellow-soft);
  --sage: var(--fresh);
  --sage-tint: var(--yellow-soft);
  --brick: var(--red);
  --brick-tint: var(--red-tint);

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px;
  --gutter: 20px;
  --bar-h: 76px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 0.18em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.loading { padding: 40px var(--gutter); color: var(--ink-soft); text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: opacity .15s ease, transform .08s;
}
.btn:hover:not(:disabled) { opacity: .88; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--pine); color: var(--paper); }
.btn-secondary { background: var(--paper-dark); color: var(--ink); border-color: var(--line); }
.btn-block { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 10px 4px; margin: -10px -4px;
  font: inherit; font-weight: 500; font-size: 15px; color: var(--ink);
  text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer;
}

/* ---------- Preview banner (local testing without PHP only) ---------- */
.preview-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  background: var(--gold-soft); color: var(--ink);
  border-bottom: 1px solid var(--gold);
  font-size: 14px; line-height: 1.4;
}
.preview-banner .link-btn { font-size: 14px; padding: 6px 4px; margin: -6px -4px; }

/* ---------- Top bar (signed in) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.topbar-brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.icon-brand { width: 20px; height: 20px; color: var(--gold); }
.brand { font-family: var(--font); font-stretch: 75%; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }

/* ---------- Form fields ---------- */
.stack { display: grid; gap: 18px; margin-top: 22px; }
.field { display: grid; gap: 6px; }
.field-label, .q-label { font-weight: 600; font-size: 16px; }
.field-hint, .q-hint { color: var(--ink-soft); font-size: 14px; }
.input, .wizard input[type="text"], .wizard input[type="date"], .wizard textarea {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  font-family: var(--font);
  font-size: 17px;                         /* 16px+ stops iOS zooming on focus */
  color: var(--ink);
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  appearance: none;
}
.wizard textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.input:focus, .wizard input:focus, .wizard textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
[aria-invalid="true"] { border-color: var(--brick) !important; }
.field-error { color: var(--brick); font-size: 14px; font-weight: 500; margin-top: 6px; }
.alert { background: var(--brick-tint); color: var(--brick); padding: 12px 14px; border-radius: var(--radius); font-weight: 500; margin-top: 16px; }
.notice { background: var(--yellow-soft); color: var(--ink); padding: 12px 14px; border-radius: var(--radius); font-weight: 500; margin-top: 16px; }

/* ---------- Sign in / Create account ---------- */
.auth-shell { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.auth-hero {
  position: relative;
  background-color: var(--rubber);
  color: var(--paper);
  min-height: 36svh;
  display: flex; align-items: flex-end;
  padding: calc(28px + env(safe-area-inset-top)) var(--gutter) 28px;
}
.auth-hero-text { max-width: 32ch; }
.wordmark-xl {
  font-family: var(--font); font-stretch: 75%;
  font-weight: 600;
  font-size: clamp(64px, 20vw, 128px);
  line-height: .9; letter-spacing: -0.03em;
}
.hero-line { margin-top: 14px; font-size: 17px; line-height: 1.5; color: #D9D6C6; }

.auth-panel { flex: 1; padding: 30px var(--gutter) calc(40px + env(safe-area-inset-bottom)); }
.auth-form-wrap { max-width: 420px; margin: 0 auto; }
.auth-title { font-family: var(--font); font-stretch: 75%; font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.auth-sub { margin-top: 6px; }
.auth-switch { margin-top: 24px; color: var(--ink-soft); text-align: center; }
.auth-switch a { font-weight: 600; color: var(--ink); }

@media (min-width: 900px) {
  .auth-shell { flex-direction: row; }
  .auth-hero { flex: 1.15; min-height: 100vh; padding: 56px; }
  .auth-panel { flex: 1; display: flex; align-items: center; padding: 56px; }
  .auth-form-wrap { width: 100%; }
  .hero-line { font-size: 19px; }
}

/* ---------- Questionnaire ---------- */
.wizard {
  max-width: 640px; margin: 0 auto;
  padding: 20px var(--gutter) calc(var(--bar-h) + 40px + env(safe-area-inset-bottom));
}
.progress { position: sticky; top: 0; z-index: 2; background: var(--paper); padding: 10px 0 12px; margin-top: -10px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.progress-meta .muted { font-weight: 400; }
.progress-track { height: 5px; border-radius: 3px; background: var(--paper-dark); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 3px; transition: width .35s ease; }

.step-body { padding-top: 16px; }
.step-title, .page-title {
  font-family: var(--font); font-stretch: 75%; font-weight: 800;
  font-size: clamp(28px, 7.5vw, 40px); letter-spacing: -0.015em; outline: none;
}
.step-intro, .page-intro { margin-top: 10px; color: var(--ink-soft); font-size: 17px; max-width: 52ch; }
.step-body .alert { margin: 0 0 18px; }

.q { margin-top: 32px; }
.q fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.q legend { padding: 0; margin-bottom: 4px; }
.q .q-hint { margin-bottom: 4px; }
.q label.q-label { display: block; }
.optional { font-weight: 400; color: var(--ink-soft); font-size: 14px; }
.limit-msg { color: var(--ink-soft); font-size: 14px; margin-top: 8px; }

/* Choice tiles: a native radio/checkbox inside each label, visually hidden */
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice { position: relative; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-text {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 54px; padding: 12px 50px 12px 16px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.choice-label { font-weight: 500; }
.choice-desc { color: var(--ink-soft); font-size: 14px; line-height: 1.35; }
.choice-text::after {   /* the tick box */
  content: ""; position: absolute; right: 16px; top: 50%;
  width: 22px; height: 22px; margin-top: -11px;
  border: 1.5px solid var(--line-strong); border-radius: 50%;
  background: var(--paper-card);
}
.choice input[type="checkbox"] + .choice-text::after { border-radius: 4px; }
.choice:hover .choice-text { border-color: var(--line-strong); }
.choice input:checked + .choice-text { border-color: var(--pine); background: var(--sage-tint); box-shadow: inset 0 0 0 1px var(--pine); }
.choice input:checked + .choice-text .choice-label { font-weight: 600; }
.choice input:checked + .choice-text::after {
  border-color: var(--pine);
  background: var(--pine) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%231A1A1A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.choice input:focus-visible + .choice-text { outline: 2px solid var(--gold); outline-offset: 2px; }
.q.has-error .choice-text, .q.has-error .week { border-color: var(--brick); }

/* Short options (1–5, 20 min…) as a row of buttons */
.choices-compact { display: flex; flex-wrap: wrap; gap: 8px; }
.choices-compact .choice { flex: 1 0 auto; min-width: 64px; }
.choices-compact .choice-text,
.scale .choice-text { align-items: center; padding: 12px 14px; text-align: center; }
.choices-compact .choice-text::after,
.scale .choice-text::after { display: none; }
.choices-compact .choice input:checked + .choice-text,
.scale .choice input:checked + .choice-text { background: var(--pine); color: var(--paper); }

@media (min-width: 560px) {
  .choices:not(.choices-compact):not(.choices-described) { grid-template-columns: 1fr 1fr; }
}

/* Number input with unit */
.number-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; max-width: 240px; }
.number-row input { flex: 1; font-family: var(--font); font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums; }
.unit { color: var(--ink-soft); font-weight: 500; min-width: 2.5ch; }
.q input[type="date"], .q textarea { margin-top: 8px; }
.q input[type="date"] { max-width: 240px; }

/* 1–5 scale */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.scale-ends { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 14px; margin-top: 6px; }

/* Weekly planner */
.week { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-card); }
.week-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.week-row + .week-row { border-top: 1px solid var(--line); }
.week-day { flex: 0 0 38px; font-weight: 600; padding-top: 9px; }
.week-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-weight: 500; font-size: 15px; background: var(--paper);
  transition: background-color .12s, border-color .12s;
}
.chip input:checked + span { background: var(--pine); border-color: var(--pine); color: var(--paper); }
.chip-rest input:checked + span { background: var(--paper-dark); border-color: var(--ink-soft); color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Bottom action bar: in thumb reach on phones */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--paper-card);
  border-top: 1px solid var(--line);
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
}
.action-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.action-inner .btn-ghost { min-width: 96px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }

/* Review */
.review { margin-top: 24px; display: grid; gap: 14px; }
.review-block { background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.review-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.review-head h2 { font-family: var(--font); font-stretch: 75%; font-size: 19px; font-weight: 800; }
.review dl { margin: 10px 0 0; display: grid; gap: 2px; }
.review dt { color: var(--ink-soft); font-size: 14px; margin-top: 8px; }
.review dd { margin: 0; font-weight: 500; white-space: pre-line; }
.review dd.missing { color: var(--ink-soft); font-style: italic; font-weight: 400; }
.review dd.missing.has-error { color: var(--brick); font-style: normal; font-weight: 600; }

/* ---------- Home ---------- */
.home { max-width: 640px; margin: 0 auto; padding: 28px var(--gutter) calc(48px + env(safe-area-inset-bottom)); }
.card { margin-top: 20px; background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-title { font-family: var(--font); font-stretch: 75%; font-size: 19px; font-weight: 800; margin-bottom: 12px; }
.card + .btn { margin-top: 24px; }
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); font-weight: 500; }
.tag-primary { border-color: var(--pine); background: var(--sage-tint); }
.tag-note { font-weight: 400; color: var(--ink-soft); font-size: 14px; }
.week-strip { list-style: none; margin: 0 0 12px; padding: 0; }
.week-strip li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.week-strip li:last-child { border-bottom: 0; }
.ws-day { flex: 0 0 38px; font-weight: 600; }
.ws-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-act { padding: 3px 10px; border-radius: 999px; font-weight: 500; font-size: 14px; }
.ws-sport { background: var(--sage-tint); }
.ws-lift { background: var(--pine); color: var(--paper); }
.ws-rest { border: 1px solid var(--line-strong); }
.plain-list { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Signed-in app: navigation, Today, Workout, Log, History, Profile
   ===================================================================== */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link-danger { color: var(--brick); }

/* Tab bar: fixed to the bottom on phones, inline in the header on desktop */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper-card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; text-decoration: none; color: var(--ink-soft);
  font-size: 12.5px; font-weight: 500; -webkit-tap-highlight-color: transparent;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.is-active { color: var(--pine); font-weight: 600; }
.tabbar a.is-active svg { stroke-width: 2.25; }
body.has-tabbar .app { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  .tabbar {
    position: static; display: flex; gap: 4px; background: none; border: 0; padding: 0;
  }
  .tabbar a { flex-direction: row; gap: 8px; min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: var(--radius); }
  .tabbar a:hover { background: var(--paper-dark); }
  .tabbar a.is-active { background: var(--sage-tint); }
  .tabbar svg { width: 18px; height: 18px; }
  body.has-tabbar .app { padding-bottom: 0; }
}

/* Page layout */
.page { max-width: 640px; margin: 0 auto; padding: 24px var(--gutter) 40px; }
.page > .card:first-of-type { margin-top: 20px; }
.eyebrow-date { color: var(--ink-soft); font-size: 14px; margin-bottom: 4px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 0; }

/* Today */
.card-today { background-color: var(--rubber); color: var(--paper); border-color: var(--pine); padding: 22px 20px; }
.card-today .eyebrow-date, .card-today .muted { color: #D9D6C6; }
.today-plan { font-family: var(--font); font-stretch: 75%; font-weight: 800; font-size: 26px; letter-spacing: -0.01em; margin: 2px 0 6px; }
.today-actions { margin-top: 16px; }
.card-today .btn-primary { background: var(--paper); color: var(--pine); }

/* Recovery */
.legend { display: inline-flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.dot-fresh, .rec-fresh .rec-fill { background: var(--sage); }
.dot-recovering, .rec-recovering .rec-fill { background: var(--gold); }
.dot-fatigued, .rec-fatigued .rec-fill { background: var(--brick); }
.rec-empty { margin-bottom: 8px; }
.rec-groups { display: grid; gap: 14px; }
.rec-group-title { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rec-row { display: grid; grid-template-columns: 92px 1fr 42px; column-gap: 10px; align-items: center; font-size: 14.5px; }
.rec-bar { height: 8px; background: var(--paper-dark); border-radius: 4px; overflow: hidden; }
.rec-fill { display: block; height: 100%; border-radius: 4px; transition: width .4s ease; }
.rec-val { text-align: right; font-family: var(--font); font-variant-numeric: tabular-nums; font-size: 14px; }
.rec-when { grid-column: 2 / 4; font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.card-head { flex-wrap: wrap; }
@media (max-width: 559px) { .legend { flex-basis: 100%; } .legend .dot:first-child { margin-left: 0; } }
@media (min-width: 560px) { .rec-groups { grid-template-columns: 1fr 1fr; gap: 16px 28px; } }

/* Quick log */
.quick-log { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper);
  text-decoration: none; font-weight: 500;
}
.chip-link:hover { border-color: var(--pine); }

/* Activity rows */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity:last-child { border-bottom: 0; }
.activity-kind { flex: 0 0 10px; height: 10px; border-radius: 50%; margin-top: 7px; }
.kind-sport { background: var(--sage); }
.kind-lift { background: var(--pine); }
.activity-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.activity-name { font-weight: 600; }
.activity-meta { color: var(--ink-soft); font-size: 14px; }
.activity-full .link-btn { font-size: 14px; white-space: nowrap; }
.lift-detail { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; display: grid; gap: 2px; }
.lift-detail li { display: flex; justify-content: space-between; gap: 12px; }

/* History */
.hist-day { margin-top: 24px; }
.hist-date { font-family: var(--font); font-stretch: 75%; font-size: 18px; font-weight: 800; padding-bottom: 6px; border-bottom: 1px solid var(--line-strong); }

/* Workout */
.back-link { display: inline-block; font-size: 15px; margin-bottom: 14px; padding: 6px 0; }
.page-workout { padding-bottom: calc(var(--bar-h) + 40px + env(safe-area-inset-bottom)); }
.minutes-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }
.minutes-row .muted { margin-right: 4px; }
.pill {
  min-height: 38px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--paper);
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.pill-on { background: var(--pine); border-color: var(--pine); color: var(--paper); }
.coach-notes { list-style: none; margin: 16px 0 0; padding: 12px 14px; background: var(--gold-soft); border-radius: var(--radius); display: grid; gap: 6px; font-size: 15px; }
.ex-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.ex-card { background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.ex-head { display: flex; gap: 12px; align-items: flex-start; }
.ex-num {
  flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--pine); color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
}
.ex-name { font-family: var(--font); font-stretch: 75%; font-size: 20px; font-weight: 800; }
.ex-why { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.ex-target { margin-top: 12px; font-weight: 500; }
.ex-cue { margin-top: 4px; font-size: 14.5px; color: var(--ink-soft); }
.ex-weight-note { margin-top: 4px; font-size: 13.5px; color: var(--yellow-text); font-weight: 600; }
.sets { margin-top: 12px; width: 100%; border-collapse: collapse; }
.sets th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-soft); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.sets td { padding: 6px; border-bottom: 1px solid var(--line); }
.sets tr:last-child td { border-bottom: 0; }
.set-n { width: 36px; font-family: var(--font); font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.input-set { min-height: 44px; padding: 8px 10px; font-family: var(--font); font-variant-numeric: tabular-nums; font-size: 17px; max-width: 110px; }
.sets td:last-child { width: 52px; text-align: right; }
.set-done {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--paper-card); cursor: pointer;
}
.set-done.is-done {
  border-color: var(--pine);
  background: var(--pine) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%231A1A1A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.row-done .input-set { background: var(--sage-tint); }
.ex-tools { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 10px; }
.ex-tools .link-btn { font-size: 14px; }
.workout-foot { margin-top: 20px; text-align: center; }
.action-inner-workout { grid-template-columns: 1fr auto; align-items: center; }
.set-count { font-size: 14.5px; color: var(--ink-soft); }
.set-count.resting { font-family: var(--font); font-variant-numeric: tabular-nums; font-size: 18px; color: var(--ink); font-weight: 500; }

/* Bottom sheet (finish workout) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(26, 26, 26, .5);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto;
  background: var(--paper); border-radius: 14px 14px 0 0;
  padding: 22px var(--gutter) calc(20px + env(safe-area-inset-bottom));
}
.sheet .q { margin-top: 18px; border: 0; padding: 0; }
.sheet-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 22px; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 14px; } }

/* Log form */
.log-form .q { border: 0; padding: 0; margin: 26px 0 0; }
.log-form legend { padding: 0; margin-bottom: 4px; }
.log-form .number-row { margin-top: 10px; }
.input-date { margin-top: 10px; max-width: 240px; }
.form-actions { margin-top: 28px; }

/* Profile */
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 30; background: var(--pine); color: var(--paper);
  padding: 12px 18px; border-radius: 999px; font-weight: 500; font-size: 15px;
  box-shadow: 0 4px 16px rgba(26, 26, 26, .25); transition: opacity .3s;
  max-width: calc(100% - 40px);
}
.toast-out { opacity: 0; }
@media (min-width: 900px) { .toast { bottom: 32px; } }


/* =====================================================================
   Climbing-shoe look: white upper, black rubber, yellow strap
   ===================================================================== */

/* Perforated-upper dot texture and the yellow strap band */
.auth-hero, .card-today {
  background-color: var(--rubber);
  background-image: radial-gradient(circle, rgba(255, 255, 255, .10) 1.3px, transparent 1.6px);
  background-size: 14px 14px;
  position: relative; overflow: hidden;
}
.auth-hero::before, .card-today::before {
  content: ""; position: absolute; pointer-events: none;
  left: -10%; right: -10%; height: 56px; top: 30%;
  background: var(--yellow);
  transform: rotate(-9deg);
}
.card-today::before { height: 8px; top: 0; left: 0; right: 0; transform: none; }
.auth-hero > *, .card-today > * { position: relative; }

/* Type */
.wordmark-xl {
  font-family: var(--font); font-stretch: 70%; font-weight: 900; font-style: italic;
  text-transform: uppercase; letter-spacing: -0.01em; line-height: .86;
  font-size: clamp(68px, 22vw, 140px);
}
.hero-line { color: #D6D6CF; }
.step-title, .page-title { font-family: var(--font); font-stretch: 75%; font-weight: 800; letter-spacing: -0.015em; }
.brand { font-family: var(--font); font-stretch: 72%; font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 22px; letter-spacing: 0; }

/* Brand mark: a slanted strap */
.icon-brand { width: 22px; height: 22px; color: var(--ink); }
.icon-brand path { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.5; }

/* Header gets a strap stripe along the top */
.topbar { border-top: 5px solid var(--yellow); background: var(--paper-card); }

/* Focus */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.input:focus, .wizard input:focus, .wizard textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow); }

/* Buttons: yellow strap with black text */
.btn-primary { background: var(--yellow); color: var(--ink); border-color: var(--ink); }
.btn-primary:hover:not(:disabled) { opacity: 1; background: var(--yellow-deep); }
.btn-secondary { background: var(--paper-card); color: var(--ink); border-color: var(--ink); }
.card-today .btn-primary { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.card-today .btn-primary:hover:not(:disabled) { background: #FFE04D; }

/* Selected choices */
.choice input:checked + .choice-text { border-color: var(--ink); background: var(--yellow-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input:checked + .choice-text::after { border-color: var(--ink); background-color: var(--yellow); }
.choices-compact .choice input:checked + .choice-text,
.scale .choice input:checked + .choice-text { background: var(--yellow); color: var(--ink); }
.chip input:checked + span { background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.chip-rest input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper-card); }
.pill-on { background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.tag-primary { border-color: var(--ink); background: var(--yellow-soft); }
.chip-link:hover { border-color: var(--ink); background: var(--yellow-soft); }

/* Progress */
.progress-fill { background: var(--ink); }

/* Tab bar */
.tabbar a.is-active { color: var(--ink); font-weight: 700; box-shadow: inset 0 3px 0 var(--yellow); }
@media (min-width: 900px) {
  .tabbar a.is-active { background: var(--yellow); box-shadow: none; }
  .tabbar a:hover:not(.is-active) { background: var(--paper-dark); }
}

/* Today */
.card-today { border-color: var(--rubber); padding-top: 28px; }
.today-plan { font-stretch: 75%; font-weight: 800; font-size: 30px; }

/* Recovery: black = fresh, yellow = recovering, red = needs rest */
.dot-fresh, .rec-fresh .rec-fill { background: var(--fresh); }
.dot-recovering, .rec-recovering .rec-fill { background: var(--yellow-deep); }
.dot-fatigued, .rec-fatigued .rec-fill { background: var(--red); }
.rec-bar { background: var(--paper-dark); }

/* Week + activity markers */
.ws-sport { background: var(--paper-dark); }
.ws-lift { background: var(--yellow); color: var(--ink); }
.kind-sport { background: var(--ink); }
.kind-lift { background: var(--yellow); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* Workout */
.ex-num { background: var(--yellow); color: var(--ink); border: 1.5px solid var(--ink); font-weight: 800; }
.set-done.is-done { border-color: var(--ink); background-color: var(--yellow); }
.row-done .input-set { background: var(--yellow-soft); }
.coach-notes { background: var(--yellow-soft); border-left: 4px solid var(--yellow); }
.set-count.resting { font-weight: 700; }

/* Misc */
.preview-banner { background: var(--yellow-soft); border-bottom-color: var(--yellow); }
.toast { background: var(--ink); color: var(--paper-card); }
.hist-date { border-bottom-color: var(--ink); }

/* Phone: strap band sits above the wordmark, never behind it */
@media (max-width: 899px) {
  .auth-hero { padding-top: calc(92px + env(safe-area-inset-top)); }
  .auth-hero::before { top: 22px; height: 38px; }
}
/* Condensed headlines need a touch more space between words */
.wordmark-xl, .step-title, .page-title, .auth-title, .card-title, .ex-name, .today-plan, .hist-date, .review-head h2, .brand { word-spacing: .1em; }

/* Height: feet and inches side by side */
.height-row { display: flex; flex-wrap: wrap; gap: 12px; }
.height-row .number-row { max-width: 130px; }

/* Workout focus picker */
.row-label { min-width: 52px; }
.muscle-picker { margin-top: 12px; padding: 14px; background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 12px; }
.muscle-picker .btn { justify-self: start; }

/* Manual lift logging */
.lift-wrap .q:first-child { margin-top: 26px; }
.lift-list { margin-top: 10px; }
.lift-ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.lift-ex-head .link-btn { font-size: 14px; }
.set-remove { width: 40px; height: 40px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--ink-soft); cursor: pointer; border-radius: 50%; }
.set-remove:hover { background: var(--paper-dark); color: var(--ink); }
.add-ex-btn { margin-top: 12px; }
.sheet-tall { max-height: 88vh; display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; }
.sheet-head .card-title { margin: 0; }
.picker-results { overflow: auto; flex: 1; min-height: 120px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.picker-group-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); padding: 12px 2px 4px; position: sticky; top: 0; background: var(--paper); }
.picker-group ul { list-style: none; margin: 0; padding: 0; }
.picker-item {
  width: 100%; text-align: left; min-height: 48px; padding: 10px 12px;
  background: var(--paper-card); border: 0; border-bottom: 1px solid var(--line);
  font: inherit; font-size: 16px; color: var(--ink); cursor: pointer;
}
.picker-item:hover { background: var(--yellow-soft); }
.custom-ex summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.custom-ex-body { display: grid; gap: 8px; margin-top: 8px; }
.custom-ex-body .q-label { margin-top: 6px; }
.custom-ex-body .btn { justify-self: start; margin-top: 6px; }
select.input { appearance: auto; }

/* Rest timer: black rubber panel above the bottom bar */
.rest-panel {
  position: fixed; left: 0; right: 0; z-index: 6;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
  background: var(--rubber); color: var(--paper-card);
  padding: 14px var(--gutter) 16px;
  box-shadow: 0 -6px 20px rgba(26, 26, 26, .18);
}
.rest-panel > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.rest-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rest-label { font-weight: 700; font-size: 15px; color: #D6D6CF; }
.rest-time {
  font-family: var(--font); font-stretch: 75%; font-weight: 800; font-style: italic;
  font-size: 46px; line-height: 1; color: var(--yellow); font-variant-numeric: tabular-nums;
}
.rest-bar { height: 6px; background: rgba(255, 255, 255, .15); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.rest-fill { display: block; height: 100%; background: var(--yellow); border-radius: 3px; transition: width .25s linear; }
.rest-next { margin-top: 8px; font-size: 15px; color: var(--paper-card); }
.rest-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.rest-actions .pill { background: transparent; color: var(--paper-card); border-color: rgba(255, 255, 255, .4); min-height: 44px; padding: 0 16px; }
.rest-actions .pill-on { background: var(--yellow); color: var(--ink); border-color: var(--yellow); margin-left: auto; }
.rest-panel.rest-done { background: var(--yellow); color: var(--ink); }
.rest-panel.rest-done .rest-label, .rest-panel.rest-done .rest-next { color: var(--ink); }
.rest-panel.rest-done .rest-time { color: var(--ink); }
.rest-panel.rest-done .rest-bar { display: none; }
.rest-panel.rest-done .pill-on { background: var(--ink); color: var(--yellow); border-color: var(--ink); }
body.is-resting .page-workout { padding-bottom: calc(var(--bar-h) + 210px + env(safe-area-inset-bottom)); }
.workout-foot { display: grid; justify-items: center; gap: 14px; }
.workout-foot .add-ex-btn { justify-self: stretch; }
@media (prefers-reduced-motion: reduce) { .rest-fill { transition: none; } }
