/* Layout: a training-log column (max 32rem). Condensed, heavy headings like stencilled plate
   numbers; ruled set tables like a paper log; competition-plate colours encode muscle groups.
   Light-first "chalk", dark "rubber floor". */
:root {
  --bg: #ecedea;
  --surface: #f8f8f6;
  --surface-2: #e1e2de;
  --line: rgba(20, 21, 23, 0.12);
  --line-strong: rgba(20, 21, 23, 0.22);
  --ink: #141517;
  --muted: #5f6267;
  --faint: #95989c;
  --on-ink: #f8f8f6;

  --red: #d33a2c;
  --blue: #2862c7;
  --yellow: #e2ae17;
  --green: #2d8a4e;
  --white: #fafaf7;
  --steel: #8b9096;
  --go: #2d8a4e;
  --on-go: #ffffff;
  --warn: #b4492f;

  --shadow: 0 20px 50px -24px rgba(20, 21, 23, 0.35);
  --scrim: rgba(20, 21, 23, 0.4);

  --font-display:
    "Big Shoulders Display", "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --t-xs: 0.72rem;
  --t-sm: 0.875rem;
  --t-md: 1rem;
  --t-lg: 1.25rem;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --surface: #1a1b1e;
    --surface-2: #26272b;
    --line: rgba(240, 240, 236, 0.1);
    --line-strong: rgba(240, 240, 236, 0.2);
    --ink: #f1f1ee;
    --muted: #a0a3a8;
    --faint: #6c6f74;
    --on-ink: #111214;
    --red: #ef5a47;
    --blue: #4d8df0;
    --yellow: #f2c53d;
    --green: #4db872;
    --white: #e9e9e4;
    --steel: #8d9298;
    --go: #4db872;
    --on-go: #0d1a11;
    --warn: #ef7a5f;
    --shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.7);
    --scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214;
  --surface: #1a1b1e;
  --surface-2: #26272b;
  --line: rgba(240, 240, 236, 0.1);
  --line-strong: rgba(240, 240, 236, 0.2);
  --ink: #f1f1ee;
  --muted: #a0a3a8;
  --faint: #6c6f74;
  --on-ink: #111214;
  --red: #ef5a47;
  --blue: #4d8df0;
  --yellow: #f2c53d;
  --green: #4db872;
  --white: #e9e9e4;
  --steel: #8d9298;
  --go: #4db872;
  --on-go: #0d1a11;
  --warn: #ef7a5f;
  --shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.7);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
html,
body {
  min-height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-md) / 1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
svg {
  display: block;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p,
ol,
ul,
dl,
dd,
figure {
  margin: 0;
  padding: 0;
}
ol,
ul {
  list-style: none;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 8px;
}
img {
  max-width: 100%;
}

.app {
  max-width: 32rem;
  margin-inline: auto;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-block: 6px calc(var(--tab-h) + 36px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Type ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 0.88;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.eyebrow {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: var(--t-sm);
}
.num {
  font-variant-numeric: tabular-nums;
}
.lede {
  color: var(--muted);
  max-width: 34ch;
  margin-top: 10px;
  text-wrap: pretty;
}

/* ---------- Views ---------- */
.view {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.view.enter {
  animation: rise 0.45s var(--ease) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.page-head {
  padding-top: 18px;
}
.page-title {
  font-size: 3.6rem;
}
.block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 14px;
  border: 0;
  font-weight: 600;
  font-size: var(--t-md);
  letter-spacing: 0.01em;
  transition:
    transform 0.2s var(--ease),
    background-color 0.2s,
    opacity 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn-wide {
  width: 100%;
}
.btn-ink {
  background: var(--ink);
  color: var(--on-ink);
}
.btn-go {
  background: var(--go);
  color: var(--on-go);
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
}
.btn-line {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn-warn {
  background: transparent;
  border: 1px solid color-mix(in oklab, var(--warn) 45%, transparent);
  color: var(--warn);
  min-height: 44px;
}
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: var(--t-sm);
  border-radius: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg,
.chip svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.scroller {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: -18px;
  padding-inline: 18px;
}
.scroller::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: var(--t-sm);
  font-weight: 500;
  white-space: nowrap;
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}
.chip .sw {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.chip[aria-pressed="true"] .sw {
  box-shadow: 0 0 0 1.5px var(--on-ink);
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 14px;
}
.seg button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: var(--t-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.field {
  display: grid;
  gap: 10px;
}

/* Group colour stripe: a severity-style marker, coloured like the plate for that muscle group. */
[data-g="push"] {
  --c: var(--red);
}
[data-g="pull"] {
  --c: var(--blue);
}
[data-g="legs"] {
  --c: var(--yellow);
}
[data-g="core"] {
  --c: var(--green);
}
[data-g="stretch"] {
  --c: var(--steel);
}

/* ---------- Thumbs ---------- */
.thumb {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in oklab, var(--c, var(--steel)) 16%, var(--surface));
  display: grid;
  place-items: center;
}
.thumb::before {
  content: attr(data-initials);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: color-mix(in oklab, var(--c, var(--steel)) 80%, var(--ink));
  letter-spacing: 0.02em;
}
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.thumb::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, var(--steel));
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Today ---------- */
.resume {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.resume .eyebrow {
  color: var(--go);
}
.resume strong {
  display: block;
  font-weight: 600;
}
.resume .btn {
  min-height: 42px;
  border-radius: 10px;
}
.today-head {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}
.today-head > * {
  min-width: 0;
}
/* Sized to the longest word (--len, set by the app) so long day names like HYPERTROPHY still fit. */
.day-title {
  font-size: min(
    clamp(4rem, 21vw, 5.6rem),
    calc((min(100vw, 32rem) - 36px) / (var(--len, 4) * 0.6))
  );
}
.day-title span {
  display: block;
  color: var(--c);
}
.plan-meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.plan-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.plan {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-strong);
  counter-reset: plan;
}
.plan li {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.plan-open {
  background: none;
  border: 0;
  padding: 0;
  border-radius: 12px;
}
.plan-text {
  min-width: 0;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
}
.plan-name {
  display: block;
  font-weight: 600;
  line-height: 1.25;
}
.plan-sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.swap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
.plan-empty {
  padding: 20px 0;
  color: var(--muted);
}

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.week li {
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: var(--t-xs);
  color: var(--muted);
  font-weight: 600;
}
.week .bar {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
}
.week .bar i {
  display: block;
  background: var(--c);
}
.week .today {
  color: var(--ink);
}
.week .today .bar {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 3.5px var(--ink);
}
.week .future .bar {
  background: transparent;
  border: 1px dashed var(--line-strong);
}

/* Program slot label above the exercise name, in the plate colour. */
.plan-move {
  display: block;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--c, var(--steel)) 72%, var(--ink));
  margin-bottom: 1px;
}

/* ---------- Suggested weights ---------- */
.sugg {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.sugg small {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--go);
}
.sugg[data-k="deload"] small {
  color: var(--warn);
}
.coach {
  margin: 0 12px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.45;
  text-wrap: pretty;
}
.coach-sheet {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
}
.coach-sheet b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.coach-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: 1px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.coach[data-k="up"] .coach-tag {
  background: var(--go);
  border-color: var(--go);
  color: var(--on-go);
}
.coach[data-k="deload"] .coach-tag {
  border-color: color-mix(in oklab, var(--warn) 60%, transparent);
  color: var(--warn);
}
.coach-prompt {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: var(--t-sm);
  color: var(--muted);
}
.coach-prompt b {
  color: var(--ink);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 10px;
}
.input {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.input input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.input input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}
.input input::placeholder {
  color: var(--faint);
  font-weight: 500;
}
.est dd {
  font-size: 2.3rem;
}
.row-btn {
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.chev {
  color: var(--faint);
  font-size: 1.4rem;
  line-height: 1;
}

/* ---------- Food ---------- */
[data-m="p"] {
  --c: var(--red);
}
[data-m="c"] {
  --c: var(--blue);
}
[data-m="f"] {
  --c: var(--yellow);
}
[data-m="o"] {
  --c: var(--steel);
}
.food {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: -8px;
}
.day-nav {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}
.day-nav .icon-btn {
  width: 44px;
  height: 44px;
}
.day-nav .icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.day-nav-label {
  text-align: center;
  font-weight: 700;
  font-size: var(--t-lg);
}

/* The calorie plate: a bumper plate whose ring fills with protein, carbs and fat. */
.cal-plate {
  display: grid;
  place-items: center;
}
.cal-plate svg {
  width: min(72vw, 260px);
  height: auto;
}
.cal-plate .rim {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.5;
}
.cal-plate .track {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 30;
}
.cal-plate .arc {
  fill: none;
  stroke: var(--c);
  stroke-width: 30;
}
.cal-plate .tick {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
}
.cal-plate .hub {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 1;
}
.cal-plate .big {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 40px;
  fill: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cal-plate .big.over {
  fill: var(--warn);
}
.cal-plate .small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: var(--muted);
}

.macros {
  display: grid;
  gap: 10px;
}
.macros li {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: var(--t-sm);
  font-weight: 600;
}
.macro-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.macros .track {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}
.macros .track i {
  display: block;
  height: 100%;
  background: var(--c);
  border-radius: 5px;
}
.macros .n {
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 6.5em;
}
.macros .n small {
  color: var(--muted);
  font-weight: 500;
}
.target-src {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.target-src p {
  text-wrap: pretty;
}

.meal {
  display: grid;
  gap: 8px;
}
.food-list {
  border-top: 1px solid var(--line-strong);
}
.food-list li {
  border-bottom: 1px solid var(--line);
}
.food-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 8px 0;
  background: none;
  border: 0;
  border-radius: 0;
  text-align: left;
}
.food-row:active {
  background: var(--surface-2);
}
.food-sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.food-kcal {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  text-align: right;
  line-height: 1;
}
.food-kcal small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.meal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.food-group {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.qty {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 10px;
}
.qty-btn {
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
  font-weight: 500;
  border-radius: 14px;
}
.qty-val {
  display: grid;
  justify-items: center;
  line-height: 1;
  gap: 4px;
  text-align: center;
}
.qty-val output {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  font-variant-numeric: tabular-nums;
}
.qty-val small {
  font-size: var(--t-sm);
  color: var(--muted);
}
.qty-presets {
  justify-content: center;
}
.figures.figures-4 {
  grid-template-columns: repeat(4, 1fr);
}
.figures.figures-4 dd {
  font-size: 2rem;
}
.food .figures dd {
  font-size: 2.3rem;
}
.form-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.weigh-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}
.weigh-chart text {
  fill: var(--muted);
  font-size: 10px;
  font-family: var(--font-body);
}
.weigh-chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.weigh-chart .dot {
  fill: var(--faint);
}
.weigh-chart .avg {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.weigh-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.weigh-form .btn {
  min-height: 48px;
  border-radius: 12px;
}

/* ---------- Programs ---------- */
.tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--go) 55%, transparent);
  color: var(--go);
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}
.progs {
  border-top: 1px solid var(--line-strong);
}
.progs li {
  border-bottom: 1px solid var(--line);
}
.prog {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 18px 0 20px;
  background: none;
  border: 0;
  text-align: left;
  border-radius: 0;
}
.prog:active {
  background: var(--surface-2);
}
.prog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.prog-name {
  font-size: 2.1rem;
}
.prog-meta {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--muted);
}
.prog-blurb {
  color: var(--muted);
  font-size: var(--t-sm);
  max-width: 44ch;
  text-wrap: pretty;
}

/* A program drawn as a loaded barbell: one plate per day, banded by muscle group, taller for more sets. */
.prog-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  height: 58px;
  padding-inline: 18px 30px;
  background: linear-gradient(var(--steel), var(--steel)) center / 100% 5px no-repeat;
}
.prog-bar-lg {
  height: 66px;
}
.plate {
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  width: 15px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 1.5px var(--bg);
}
.prog-bar-lg .plate {
  width: 19px;
}
.sheet .plate {
  background: var(--surface);
  box-shadow: 0 0 0 1.5px var(--surface);
}
.plate i {
  display: block;
  flex-basis: 0;
  background: var(--c);
}

.note {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
}
.pday {
  display: grid;
  gap: 6px;
}
.pday-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.55rem;
  text-transform: uppercase;
  line-height: 1;
}
.pday-list {
  border-top: 1px solid var(--line-strong);
}
.pday-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
}
.pday-move {
  font-weight: 600;
  min-width: 0;
}
.pday-move small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: var(--t-xs);
}
.sq {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c, var(--steel));
}

/* Program days on Today: one tab per day, a dot on the day up next. */
.day-strip {
  margin-top: -8px;
  padding-block: 2px;
  scroll-padding-inline: 18px;
}
.day-tab {
  min-height: 44px;
  gap: 8px;
}
.day-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.day-tab[aria-pressed="true"] .day-num {
  color: var(--on-ink);
  opacity: 0.7;
}
.next-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--go);
}
.day-note {
  margin-top: -8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
}
.day-note b {
  color: var(--ink);
  font-weight: 600;
}
.linkish {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Options for one program slot. */
.opt-list {
  margin-top: 0;
}
.opt {
  grid-template-columns: 56px 1fr auto;
  border-radius: 0;
}
.opt:disabled {
  opacity: 0.45;
  cursor: default;
}
.opt-sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  margin-top: 2px;
}
.opt-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
}
.opt-mark svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
.opt[aria-pressed="true"] .opt-mark {
  background: var(--go);
  border-color: var(--go);
  color: var(--on-go);
}
.opt[aria-pressed="true"] .opt-mark svg {
  opacity: 1;
}

/* ---------- Exercises ---------- */
.search-bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  display: grid;
  gap: 10px;
  padding: 10px 18px 12px;
  margin: -10px -18px 0;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.search:focus-within {
  border-color: var(--ink);
}
.search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  flex: none;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: var(--t-md);
}
.ex-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  margin-top: -10px;
}
.ex-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.ex-row:active {
  background: var(--surface-2);
}
.ex-text {
  min-width: 0;
}
.ex-name {
  display: block;
  font-weight: 600;
  line-height: 1.25;
}
.ex-sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  text-transform: capitalize;
  margin-top: 2px;
}
.lvl {
  display: flex;
  gap: 3px;
}
.lvl i {
  width: 6px;
  height: 14px;
  border-radius: 2px;
  background: var(--surface-2);
}
.lvl[data-l="1"] i:nth-child(-n + 1),
.lvl[data-l="2"] i:nth-child(-n + 2),
.lvl[data-l="3"] i:nth-child(-n + 3) {
  background: var(--ink);
}
.sentinel {
  height: 1px;
}

/* ---------- Exercise detail ---------- */
.flip {
  position: relative;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: color-mix(in oklab, var(--c, var(--steel)) 14%, var(--surface));
  display: grid;
  place-items: center;
}
.flip::before {
  content: attr(data-initials);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 4rem;
  color: color-mix(in oklab, var(--c) 70%, var(--ink));
}
.flip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  transition: opacity 0.35s;
}
.flip img.off {
  opacity: 0;
}
.flip-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(20, 21, 23, 0.72);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--line);
}
.facts div {
  padding: 10px 0;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.facts div + div {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.facts dt {
  font-size: var(--t-xs);
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
.facts dd {
  text-transform: capitalize;
  font-weight: 600;
  font-size: var(--t-sm);
}
.muscles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.muscle {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--t-sm);
  text-transform: capitalize;
  border: 1px solid var(--line-strong);
}
.muscle.primary {
  background: color-mix(in oklab, var(--c) 18%, transparent);
  border-color: color-mix(in oklab, var(--c) 55%, transparent);
  font-weight: 600;
}
.steps {
  counter-reset: s;
  display: grid;
  gap: 12px;
}
.steps li {
  counter-increment: s;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  line-height: 1.5;
}
.steps li::before {
  content: counter(s);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--muted);
}
.ex-history {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: var(--t-sm);
}
.credit {
  font-size: var(--t-xs);
  color: var(--faint);
}

/* ---------- Workout ---------- */
.workout {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  animation: slide-up 0.4s var(--ease) both;
}
.workout.leaving {
  animation: slide-down 0.3s var(--ease) both;
}
@keyframes slide-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes slide-down {
  to {
    transform: translateY(40px);
    opacity: 0;
  }
}
.wo-head {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  max-width: 32rem;
  width: 100%;
  margin: 0 auto;
  padding: 8px max(18px, env(safe-area-inset-right, 0px)) 10px
    max(18px, env(safe-area-inset-left, 0px));
}
.wo-meta {
  display: grid;
  justify-items: center;
  text-align: center;
  min-width: 0;
}
.wo-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.wo-clock {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.wo-progress {
  height: 3px;
  background: var(--surface-2);
}
.wo-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--go);
  transition: width 0.4s var(--ease);
}
.wo-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
  max-width: 32rem;
  margin: 0 auto;
  padding: 16px max(18px, env(safe-area-inset-right, 0px))
    calc(120px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* Scrolling flex columns must not squash their children (cards and figures clip their overflow). */
.wo-body > *,
.sheet-body > * {
  flex-shrink: 0;
}
.card {
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.card-head {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 12px 10px;
}
.card-head .thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}
.card-name {
  display: block;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
}
.card-sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  text-transform: capitalize;
}
.card-rx {
  text-transform: none;
}
.card.complete {
  border-color: color-mix(in oklab, var(--go) 50%, transparent);
}
.card.complete .card-name::after {
  content: " ✓";
  color: var(--go);
}

.sets {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.sets th {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding: 4px 4px 6px;
}
.sets th:first-child,
.sets td:first-child {
  width: 40px;
}
.sets th:last-child,
.sets td:last-child {
  width: 56px;
}
.sets td {
  padding: 4px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.sets .setno {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--muted);
}
.sets .prev {
  font-size: var(--t-sm);
  color: var(--faint);
  background: none;
  border: 0;
  padding: 6px 2px;
  width: 100%;
  white-space: nowrap;
}
.sets input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface-2);
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.sets input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}
.sets input::placeholder {
  color: var(--faint);
  font-weight: 500;
}
.check {
  width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  display: grid;
  place-items: center;
  margin: 0 auto;
  transition:
    background-color 0.2s,
    transform 0.2s var(--ease);
}
.check svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.25;
}
.check[aria-pressed="true"] {
  background: var(--go);
  border-color: var(--go);
  color: var(--on-go);
}
.check[aria-pressed="true"] svg {
  opacity: 1;
}
.check:active {
  transform: scale(0.9);
}
tr.done td {
  background: color-mix(in oklab, var(--go) 9%, transparent);
}
tr.done input {
  background: transparent;
}
.card-foot {
  display: flex;
  gap: 8px;
  padding: 8px 12px 12px;
  flex-wrap: wrap;
  align-items: center;
}
.card-foot .btn {
  flex: 1;
}
.bw {
  font-size: var(--t-sm);
  color: var(--muted);
  font-weight: 600;
}

/* Busy gym: the other options for this movement, one tap away. */
.alts {
  display: grid;
  gap: 6px;
  padding: 0 0 10px;
}
.alts-label {
  padding-inline: 12px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.alts-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-inline: 12px;
  scroll-padding-inline: 12px;
}
.alts-row::-webkit-scrollbar {
  display: none;
}
.alts .chip {
  min-height: 40px;
  padding: 0 13px;
}

/* The barbell: plates per side, drawn to the real proportions of competition plates. */
.barbell {
  display: grid;
  gap: 4px;
  padding: 10px 12px 2px;
  border-top: 1px dashed var(--line-strong);
}
.barbell svg {
  width: 100%;
  height: 64px;
}
.barbell-text {
  font-size: var(--t-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.barbell-text b {
  color: var(--ink);
  font-weight: 600;
}
.plate-red {
  fill: var(--red);
}
.plate-blue {
  fill: var(--blue);
}
.plate-yellow {
  fill: var(--yellow);
}
.plate-green {
  fill: var(--green);
}
.plate-white {
  fill: var(--white);
  stroke: var(--line-strong);
  stroke-width: 1;
}
.plate-steel {
  fill: var(--steel);
}
.bar-steel {
  fill: var(--steel);
}

.wo-add {
  display: grid;
  gap: 10px;
}

.rest {
  position: fixed;
  z-index: 45;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: min(30rem, calc(100% - 28px));
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow);
  animation: rise 0.3s var(--ease) both;
}
.rest-fill {
  position: absolute;
  inset: 0;
  transform-origin: left;
  background: color-mix(in oklab, var(--go) 40%, var(--ink));
  z-index: 0;
}
.rest > *:not(.rest-fill) {
  position: relative;
  z-index: 1;
}
.rest-mid {
  display: grid;
  justify-items: center;
  line-height: 1;
}
.rest-mid .eyebrow {
  color: color-mix(in oklab, var(--on-ink) 70%, transparent);
}
.rest-time {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}
.rest-btn {
  min-width: 52px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--on-ink) 25%, transparent);
  background: transparent;
  color: var(--on-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rest-skip {
  padding: 0 12px;
}
.rest.over {
  background: var(--go);
  color: var(--on-go);
}
.rest.over .rest-fill {
  display: none;
}

/* ---------- Progress ---------- */
.figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-block: 1px solid var(--line-strong);
}
.figures div {
  padding: 14px 0 12px;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  min-width: 0;
}
.figures div + div {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}
.figures dd {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.8rem;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.figures dd small {
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}
.figures dt {
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart text {
  fill: var(--muted);
  font-size: 10px;
  font-family: var(--font-body);
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .seg-push {
  fill: var(--red);
}
.chart .seg-pull {
  fill: var(--blue);
}
.chart .seg-legs {
  fill: var(--yellow);
}
.chart .seg-core {
  fill: var(--green);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--t-xs);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}
.balance {
  display: grid;
  gap: 10px;
}
.balance li {
  display: grid;
  grid-template-columns: 52px 1fr 36px;
  gap: 10px;
  align-items: center;
  font-size: var(--t-sm);
  font-weight: 600;
}
.balance .track {
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.balance .track i {
  display: block;
  height: 100%;
  background: var(--c);
  border-radius: 6px;
}
.balance .n {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.prs li,
.hist li {
  border-bottom: 1px solid var(--line);
}
.prs li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
}
.prs .pr-name {
  font-weight: 600;
  min-width: 0;
}
.prs .pr-set {
  font-size: var(--t-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.prs .pr-val {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  text-align: right;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.8rem;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.prs .pr-val small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.prs,
.hist {
  border-top: 1px solid var(--line-strong);
}
.hist button {
  display: grid;
  grid-template-columns: 6px 1fr auto;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  background: none;
  border: 0;
  text-align: left;
  align-items: center;
}
.hist .stripe {
  width: 6px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--c, var(--steel));
}
.hist-title {
  display: block;
  font-weight: 600;
}
.hist-sub {
  display: block;
  font-size: var(--t-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.hist-vol {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  color: var(--muted);
}
.hist-vol b {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 800;
}
.empty {
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed var(--line-strong);
}
.empty p {
  color: var(--muted);
  max-width: 32ch;
}
.empty .demo-bar {
  width: 100%;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 32rem;
  margin-inline: auto;
  padding: 6px max(12px, env(safe-area-inset-left, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-right, 0px));
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid var(--line);
}
@media (min-width: 32rem) {
  .tabbar {
    bottom: 14px;
    left: 14px;
    right: 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding-bottom: 8px;
    box-shadow: var(--shadow);
  }
}
.tabbar a {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 0 3px;
  min-height: 52px;
  text-decoration: none;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.tabbar svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar a[aria-current="page"] {
  color: var(--ink);
}

/* ---------- Sheet ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--scrim);
  animation: fade 0.3s both;
}
.scrim.leaving {
  animation: fade 0.25s reverse both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  max-width: 32rem;
  margin-inline: auto;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -18px 50px -20px rgba(0, 0, 0, 0.4);
  animation: sheet-in 0.42s var(--ease) both;
}
.sheet.leaving {
  animation: sheet-out 0.26s var(--ease) both;
}
@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}
@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  margin: 10px auto 0;
  flex: none;
}
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px max(20px, env(safe-area-inset-right, 0px))
    calc(22px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sheet-title {
  font-size: 2.6rem;
}
.sheet-sticky {
  position: sticky;
  top: -12px;
  z-index: 2;
  background: var(--surface);
  padding: 12px 0 8px;
  margin-top: -12px;
  display: grid;
  gap: 10px;
}
.rows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.row-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.row-text small {
  color: var(--muted);
  font-size: var(--t-sm);
}
.switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex: none;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: background-color 0.2s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.25s var(--ease);
}
.switch input:checked + span {
  background: var(--go);
  border-color: transparent;
}
.switch input:checked + span::after {
  transform: translateX(20px);
  background: #fff;
}
.switch input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.confirm {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.summary-big {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-block: 1px solid var(--line-strong);
}
.pr-list {
  display: grid;
  gap: 8px;
}
.pr-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--yellow) 18%, var(--surface));
  font-size: var(--t-sm);
}
.pr-list b {
  font-variant-numeric: tabular-nums;
}
.detail-ex {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.detail-ex span {
  font-size: var(--t-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Toast & loading ---------- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  bottom: calc(var(--tab-h) + 26px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: var(--t-sm);
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: rise 0.3s var(--ease) both;
}
.app[aria-busy="true"] .plan {
  opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Account: a focused sheet, with the same plate geometry as the training UI. */
.sync-panel {
  padding: 4px 0 12px;
}
.sync-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.sync-mark {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--go);
  stroke-width: 2;
}
.sync-mark circle:nth-child(2) {
  stroke: var(--line-strong);
  stroke-width: 5;
}
.sync-mark circle:first-child {
  stroke-width: 5;
}
.sync-mark path {
  stroke-width: 2;
}
.sync-title {
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  margin: 20px 0 14px;
}
.sync-title span {
  color: var(--go);
}
.sync-intro {
  color: var(--muted);
  font-size: var(--t-sm);
  line-height: 1.6;
  margin: 0 0 24px;
  overflow-wrap: anywhere;
}
.sync-modes {
  margin-bottom: 24px;
}
.sync-modes button {
  min-height: 44px;
}
.sync-form {
  display: grid;
  gap: 18px;
}
.sync-field {
  display: grid;
  gap: 8px;
  font-size: var(--t-sm);
  font-weight: 600;
}
.sync-field[hidden] {
  display: none;
}
.sync-field input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
  box-shadow: none;
}
.sync-field input::placeholder {
  color: var(--faint);
  opacity: 1;
}
.sync-field input:focus {
  border-color: var(--go);
  outline: 2px solid var(--go);
  outline-offset: 2px;
}
.sync-field input[aria-invalid="true"] {
  border-color: var(--warn);
}
.sync-field small {
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 400;
  line-height: 1.5;
}
.sync-field small:empty {
  display: none;
}
.sync-password {
  position: relative;
}
.sync-password input {
  padding-right: 65px;
}
.sync-reveal {
  position: absolute;
  inset: 4px 4px 4px auto;
  min-width: 55px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  font-size: var(--t-xs);
  font-weight: 600;
}
.sync-invite-tag {
  float: right;
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  line-height: 1.9;
}
.sync-submit {
  width: 100%;
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  border-radius: 12px;
  margin-top: 2px;
}
.sync-submit span:last-child {
  font-size: 1.5rem;
  font-weight: 400;
}
.sync-form-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: var(--t-xs);
  line-height: 1.6;
}
.sync-error {
  color: var(--warn);
  background: color-mix(in oklab, var(--warn) 8%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--warn) 35%, var(--line));
  border-radius: 10px;
  margin: 0;
  padding: 12px;
  font-size: var(--t-sm);
  line-height: 1.5;
}
.sync-assurance {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.sync-assurance svg {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}
.sync-assurance p {
  margin: 0;
  font-size: var(--t-xs);
  font-weight: 600;
}
.sync-assurance span {
  display: block;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.6;
  margin-top: 2px;
}
.sync-state {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: var(--t-sm);
  margin-bottom: 16px;
}
.sync-submit svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

/* Passkeys share the account form's contrast and touch-target conventions. */
.sync-passkey-entry[hidden] {
  display: none;
}
.sync-passkey-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  font-weight: 600;
}
.sync-passkey-signin svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  flex-shrink: 0;
}
.sync-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: var(--t-xs);
}
.sync-divider::before,
.sync-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}
.sync-passkeys {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 26px;
}
.sync-passkeys-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.sync-passkeys h3 {
  margin: 0;
  font-size: 1rem;
}
.sync-passkeys-copy,
.sync-passkey-status {
  font-size: var(--t-xs);
  line-height: 1.6;
  color: var(--muted);
  margin: 10px 0 14px;
}
.sync-passkey-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.sync-passkey-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.sync-passkey-list li > span {
  font-size: var(--t-sm);
  overflow-wrap: anywhere;
  min-width: 0;
}
.sync-passkey-list small {
  display: block;
  color: var(--muted);
  font-size: var(--t-xs);
  margin-top: 4px;
}
.sync-passkey-list button {
  flex-shrink: 0;
}
