/* Hallmark · macrostructure: Workbench (app frame) · genre: atmospheric · theme: Lumen (Orange Foundry)
 * nav: N3 side-rail (desktop) + bottom dock (mobile) · footer: none (app scope)
 * enrichment: hand-built CSS apparatus — loaded barbell, leader callouts with real values
 * tone: technical · accent: molten orange H42 · display: Instrument Serif lowercase, verb landmark
 * previous builds: app-in-place tab shell ×2 (blueberry locked) — differs on paper hue + accent hue + nav
 * data: all numerals computed from authenticated tenant workout data — nothing invented
 * pre-emit critique: P5 H4 E4 S5 R4 V4
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { overflow-x: clip; }

.hidden { display: none !important; }

/* ── Auth first paint ──────────────────────────────────────
 * data-auth on <html> drives which of three states is shown: "checking" (the
 * default markup state — /api/session is in flight, or the inline hint-cookie
 * check in index.html optimistically already flipped this to "in"), "out" (no
 * valid session — show the gate) or "in" (show the app). A signed-in visitor
 * must never see the gate, not even for one frame — see
 * plans/admin-and-accounts/03-session-first-paint.md.
 */
html:not([data-auth="in"]) #app,
html:not([data-auth="out"]) #gate { display: none; }
/* admin/index.html reuses this same data-auth attribute and adds a fourth
 * state, "forbidden": signed in, but not an admin. It must say so rather than
 * falling back to the login form the visitor has already satisfied — see
 * plans/admin-and-accounts/03-session-first-paint.md §6 open question 2.
 * #forbidden and #admin do not exist in new-design/index.html's markup, so
 * these two rules are no-ops there. */
html:not([data-auth="in"]) #admin,
html:not([data-auth="forbidden"]) #forbidden { display: none; }
.auth-shell { display: none; min-height: 100vh; place-items: center; background: var(--color-paper); }
[data-auth="checking"] .auth-shell { display: grid; }
.auth-shell__wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-ink-2);
  opacity: 0.55;
}

body {
  background: var(--color-paper);
  color: var(--color-ink-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  text-transform: lowercase;            /* two-register foundation: prose is lowercase */
  -webkit-font-smoothing: antialiased;
}

input, textarea { text-transform: none; }  /* user-typed content is not page prose */
/* Numeric values use the drawn +/- controls; do not surface browser chrome. */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* mono labels — the only uppercase surface */
.eyebrow, .callout span, .meter__label, .stat__label, .chart__caption,
.rail__readout, .step__eyebrow, .row__tag, .barbell__stencil {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  color: var(--color-muted);
  line-height: 1.5;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  transition: none;
}

button {
  font: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ── Buttons — eight states ─────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 44px;
  padding: 0 var(--space-lg);
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out),
              transform 100ms var(--ease-out);
}
.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}
@media (hover: hover) {
  .btn--primary:hover { transform: translateY(-1.5px); background: var(--color-accent-hover); }
  .btn--ghost:hover { background: var(--color-paper-2); }
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn[data-state="loading"] { pointer-events: none; color: transparent; position: relative; }
.btn[data-state="loading"]::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-accent-ink);
  border-top-color: transparent;
  animation: spin 700ms linear infinite;
}
.btn--primary[data-state="error"] {
  background: transparent;
  border: 1px solid var(--color-error);
  color: var(--color-error-text);
}
.btn--primary[data-state="success"] { background: var(--color-paper-3); color: var(--color-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn--ghost {
  border: 1px solid var(--color-rule-2);
  color: var(--color-ink-2);
  background: transparent;
}

.icon-btn {
  min-width: 44px; min-height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  transition: background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .icon-btn:hover { background: var(--color-paper-2); color: var(--color-ink); } }

/* ── Fields ─────────────────────────────────────────── */
.field label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
}
.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-2);       /* 1px in every state — no shift */
  outline: 2px solid transparent;
  outline-offset: 1px;
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: inherit;
  transition: background-color var(--dur-micro) var(--ease-out);
}
.field input::placeholder { color: var(--color-muted); opacity: 0.75; }
@media (hover: hover) { .field input:hover { background: var(--color-paper-3); } }
.field input:focus-visible { outline: 2px solid var(--color-focus); }
.field input[aria-invalid="true"] { border-color: var(--color-error); }
/* Same treatment as .field input — no .field use had a <select> until the
 * admin panel's tenant picker. */
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: inherit;
  text-transform: none;
}
.field__helper { min-height: 1lh; font-size: var(--text-sm); color: var(--color-muted); margin-top: var(--space-2xs); }
.field__error { min-height: 1lh; font-size: var(--text-sm); color: var(--color-error-text); margin-top: var(--space-2xs); }

/* ── Gate ───────────────────────────────────────────── */
.gate {
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: var(--space-xl) clamp(1rem, 5vw, 4rem);
  background:
    linear-gradient(var(--rule-blueprint) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--rule-blueprint) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(55% 45% at 74% 38%, var(--color-paper-emit) 0%, transparent 65%),
    var(--color-paper);
}
.gate__inner {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.gate__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: normal;
  font-size: var(--text-display);
  line-height: 1.05;
  letter-spacing: -0.032em;
  color: var(--color-ink);
  max-width: 14ch;
  overflow-wrap: anywhere;
  min-width: 0;
  margin-top: var(--space-sm);
}
.gate__title em {
  font-style: normal;                    /* verb landmark — colour + line, never italic */
  color: var(--color-accent-2);
  position: relative;
  white-space: nowrap;
}
.gate__title em::after {
  content: "";
  position: absolute;
  left: 0.05em; right: 0.05em; bottom: 0.04em;
  height: 1px;
  background: var(--color-accent-2);
  transform-origin: left;
  animation: underline-in 320ms var(--ease-out) 700ms backwards;
}
@keyframes underline-in { from { transform: scaleX(0); } }
.gate__lede {
  max-width: 44ch;
  margin: var(--space-md) 0 var(--space-xl);
  color: var(--color-ink-2);
}
.gate__form { display: grid; gap: var(--space-md); max-width: 24rem; }
/* admin/index.html's sign-in and "not an admin" screens: the same gate frame,
 * minus the apparatus figure the two-column .gate__inner was built around —
 * see plans/admin-and-accounts/01-admin-panel.md §5. */
.gate__inner--single { grid-template-columns: minmax(0, 1fr); max-width: 40rem; }

/* ── Apparatus — loaded barbell, side view ──────────── */
.apparatus { position: relative; padding: var(--space-2xl) 0; }
.barbell {
  position: relative;
  height: 200px;
  max-width: 440px;
  margin-inline: auto;
}
.barbell__bar {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 2px; margin-top: -1px;
  background: linear-gradient(to right,
    var(--color-rule-2) 0%,
    var(--color-bar-metal) 35%,
    var(--color-bar-metal) 65%,
    var(--color-rule-2) 100%);
}
.barbell__knurl {
  position: absolute;
  top: 50%; left: 50%;
  width: 96px; height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: linear-gradient(to right,
    var(--color-filament-hot) 0%,
    var(--color-filament) 50%,
    var(--color-filament-hot) 100%);
  box-shadow:
    0 0 16px 4px var(--color-glow),
    0 0 48px 12px var(--color-glow-wide);
  animation: knurl-pulse var(--dur-pulse) ease-in-out infinite;
}
@keyframes knurl-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.86; }
}
.barbell__collar {
  position: absolute;
  top: 50%;
  width: 8px; height: 26px;
  transform: translateY(-50%);
  border: 1px solid var(--color-rule-2);
  border-radius: 2px;
  background: var(--color-paper-3);
}
.barbell__collar--l { left: 21%; }
.barbell__collar--r { right: 21%; }
.barbell__plate {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--side) * (32% + var(--i) * 4%));
  width: 11px;
  height: calc(140px - var(--i) * 34px);
  transform: translate(-50%, -50%);
  border: 1px solid var(--color-rule-2);
  border-radius: 4px;
  background:
    radial-gradient(120% 90% at 50% 30%, var(--color-emit-card) 0%, transparent 70%),
    var(--color-paper-2);
}
.barbell__stencil {
  position: absolute;
  bottom: -34px; left: 50%;
  transform: translateX(-50%);
}
.callouts { list-style: none; }
.callout {
  position: absolute;
  white-space: nowrap;
}
.callout::before {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(16px, 4vw, 44px);
  height: 1px;
  background: var(--color-rule-2);
}
.callout--tl { top: 6%; left: 0; }
.callout--tr { top: 14%; right: 0; text-align: right; }
.callout--bl { bottom: 16%; left: 0; }
.callout--br { bottom: 6%; right: 0; text-align: right; }
.callout--tl::before, .callout--bl::before { left: calc(100% + 8px); }
.callout--tr::before, .callout--br::before { right: calc(100% + 8px); }

/* ── App frame — workbench ──────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100dvh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: var(--space-lg) var(--space-md);
  border-right: 1px solid var(--color-rule);
  background: var(--color-paper);
}
.rail__wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-ink);
  padding: 0 var(--space-sm);
  margin-bottom: var(--space-lg);
}
.rail__nav { display: grid; gap: var(--space-3xs); }
.rail__item {
  display: block;
  text-align: left;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  color: var(--color-muted);
  transition: background-color var(--dur-micro) var(--ease-out),
              color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .rail__item:hover { background: var(--color-paper-2); color: var(--color-ink); } }
.rail__item.is-active {
  border-left-color: var(--color-accent);
  color: var(--color-ink);
  background: var(--color-paper-2);
}
.rail__item--log { margin-top: var(--space-md); border: 1px solid var(--color-rule-2); border-left-width: 1px; }
.rail__item--log.is-active { border-color: var(--color-accent); }
.rail__profile { margin-top: var(--space-xs); }
.rail__readout { margin-top: auto; padding: 0 var(--space-sm); }
.rail__lock {
  text-align: left;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
}
@media (hover: hover) { .rail__lock:hover { color: var(--color-ink); background: var(--color-paper-2); } }

.stage {
  padding: clamp(1rem, 3vw, 3rem) clamp(1rem, 4vw, 4rem) var(--space-2xl);
  max-width: 74rem;
  width: 100%;
}

.view { animation: view-in 150ms var(--ease-out); }
@keyframes view-in { from { opacity: 0; } }

.view__head { margin-bottom: var(--space-xl); }
.view__head--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.view__head--split .seg { margin-bottom: var(--space-2xs); }
.view__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-2xl);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  overflow-wrap: anywhere;
  min-width: 0;
  margin-top: var(--space-2xs);
}
.section__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--color-ink);
  margin: var(--space-xl) 0 var(--space-md);
}
.section__title--flush { margin-top: 0; }
.profile-mobile-link { display: none; }
.profile-card { margin-bottom: var(--space-lg); max-width: 44rem; }
.profile-form { display: grid; gap: var(--space-md); margin-bottom: var(--space-lg); max-width: 28rem; }
.kv { display: grid; gap: var(--space-sm); max-width: 32rem; }
.kv > div { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--color-rule); }
.kv dt { color: var(--color-muted); font: 500 11px/1.5 var(--font-mono); letter-spacing: var(--tracking-micro); text-transform: uppercase; }
.kv dd { color: var(--color-ink); overflow-wrap: anywhere; }

/* ── Stats — three cells, always ────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--color-rule);
}
.stat { padding: var(--space-lg) var(--space-md); }
.stat + .stat { border-left: 1px solid var(--color-rule); }
.stat__value {
  font-family: var(--font-display);
  font-size: var(--text-stat);
  line-height: 1.1;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

/* ── Meter strip — real volume series ───────────────── */
.meter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-lg);
  align-items: center;
  padding: var(--space-sm) 0;
  margin: var(--space-lg) 0 var(--space-xl);
  border-bottom: 1px solid var(--color-rule);
  background:
    linear-gradient(var(--rule-blueprint) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--rule-blueprint) 1px, transparent 1px) 0 0 / 32px 32px;
}
.meter__bars { display: flex; gap: 3px; align-items: end; height: 34px; }
.meter__bars > span {
  flex: 1;
  min-width: 1px;
  background: var(--color-accent);
  border-radius: 0.5px;
}

/* ── Cards — hairline, lit from within ──────────────── */
.card {
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  background:
    radial-gradient(130% 110% at 18% -8%, var(--color-emit-card) 0%, transparent 55%),
    var(--color-paper);
  transition: transform var(--dur-short) var(--ease-out);
}
@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    background:
      radial-gradient(130% 110% at 18% -8%, var(--color-emit-card-hover) 0%, transparent 55%),
      var(--color-paper);
  }
}
.card__title {
  font-weight: 500;
  color: var(--color-ink);
  margin-bottom: var(--space-md);
}

.duo {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--space-lg);
}
.duo + .duo { margin-top: var(--space-lg); }
.duo--uneven { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }

/* ── Calendar ───────────────────────────────────────── */
.calendar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.calendar__head .card__title { margin-bottom: 0; }
.calendar__weekdays, .calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-3xs);
}
.calendar__weekdays span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-align: center;
  padding-bottom: var(--space-2xs);
}
.cal-day {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.cal-day::before { content: ""; position: absolute; inset: -3px; }  /* hit-target expansion */
.cal-day--session { color: var(--color-ink); }
.cal-day--session::after {
  content: "";
  position: absolute;
  bottom: 15%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--color-accent);
}
@media (hover: hover) { .cal-day--session:hover { background: var(--color-paper-2); } }
.cal-day.is-selected { outline: 1px solid var(--color-rule-2); outline-offset: -1px; background: var(--color-paper-2); }
.cal-day--blank { visibility: hidden; }
.calendar__detail {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-rule);
  font-size: var(--text-sm);
}
.calendar__detail strong { color: var(--color-ink); font-weight: 500; }
.calendar__detail-head { margin-bottom: var(--space-2xs); }
.row--tight { padding: var(--space-sm) 0; grid-template-columns: 5rem minmax(0, 1fr) auto; }
.row--tight:first-of-type { border-top: none; }
.row--tight .row__value { font-size: var(--text-sm); }

/* ── Charts (hand-built SVG) ────────────────────────── */
.chart { position: relative; height: 170px; }
.chart-empty { display: grid; height: 100%; place-items: center; color: var(--color-muted); font-size: var(--text-sm); }
.chart svg { display: block; width: 100%; height: 100%; }
.chart__caption { margin-top: var(--space-sm); }
.chart .line { fill: none; stroke: var(--color-accent); stroke-width: 1.5; }
.chart .area { fill: var(--color-emit-card); stroke: none; }
.chart .grid-rule { stroke: var(--color-rule); stroke-width: 1; }
.chart .tick-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--color-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chart .dot { fill: var(--color-accent); }
.chart .bar { fill: var(--color-accent); }
.chart .bar.is-active { opacity: 1 !important; filter: brightness(1.2); }
.chart-hover-rule { stroke: var(--color-rule-2); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-hover-dot { fill: var(--color-paper); stroke: var(--color-accent); stroke-width: 2; }
.chart-tooltip {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -100%);
  min-height: 28px;
  padding: var(--space-3xs) var(--space-xs);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
  color: var(--color-ink);
  box-shadow: 0 8px 18px rgb(0 0 0 / 0.2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.overview-weekly { margin-top: var(--space-lg); }

/* ── Filter (exercises view) ────────────────────────── */
.filter {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.field--search { max-width: 24rem; }
.ex-list { margin-top: var(--space-sm); }
.ex-detail__meta { margin-bottom: var(--space-lg); }

/* ── Chips + segmented ──────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chip {
  min-height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-pill);
  color: var(--color-ink-2);
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .chip:hover { background: var(--color-paper-2); } }
.chip.is-active {
  border-color: var(--color-accent);
  color: var(--color-ink);
  background: var(--color-emit-card-hover);
}
.seg {
  display: inline-flex;
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.seg button {
  min-height: 44px;
  padding: 0 var(--space-md);
  color: var(--color-muted);
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out);
}
.seg button + button { border-left: 1px solid var(--color-rule-2); }
@media (hover: hover) { .seg button:hover { background: var(--color-paper-2); } }
.seg button.is-active { background: var(--color-paper-3); color: var(--color-ink); }
.hint { font-size: var(--text-sm); color: var(--color-muted); }

/* ── Rows (recent sessions, history, lists) ─────────── */
.row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) auto;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-rule);
  align-items: baseline;
}
.row:last-child { border-bottom: 1px solid var(--color-rule); }
.row__tag { padding-top: 3px; }
.row__main { min-width: 0; }
.row__main strong { display: block; color: var(--color-ink); font-weight: 500; }
.row__main span { font-size: var(--text-sm); color: var(--color-muted); }
.row__value { color: var(--color-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* exercise list buttons */
.ex-list { display: grid; }
.ex-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  text-align: left;
  padding: var(--space-md) var(--space-2xs);
  border-top: 1px solid var(--color-rule);
  border-radius: 0;
  align-items: baseline;
  min-height: 44px;
  transition: background-color var(--dur-micro) var(--ease-out);
}
.ex-row:last-child { border-bottom: 1px solid var(--color-rule); }
@media (hover: hover) { .ex-row:hover { background: var(--color-paper-2); } }
.ex-row strong { color: var(--color-ink); font-weight: 500; display: block; }
.ex-row .sub { font-size: var(--text-sm); color: var(--color-muted); }
.ex-row .last { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); white-space: nowrap; }
.ex-row--icon { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }

/* Exercise avatar — the muscle-group figure (or a catalog image_url) with the
 * equipment pictogram badged onto it. Decorative: always beside a visible name. */
.ex-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  /* portrait, tracking the trimmed figure's ~0.66 aspect — a square box would
   * letterbox it down to a shape too small to read at a glance */
  width: 34px;
  height: 48px;
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
}
.ex-avatar__art { width: 100%; height: 100%; padding: 2px; }
.ex-avatar__badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  background: var(--color-paper);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-pill);
  color: var(--color-accent);
}
.ex-avatar__badge svg { width: 14px; height: 14px; }
.ex-avatar--lg { width: 60px; height: 84px; }
.ex-avatar--lg .ex-avatar__badge { right: -8px; bottom: -8px; width: 28px; height: 28px; }
.ex-avatar--lg .ex-avatar__badge svg { width: 19px; height: 19px; }
.ex-detail__head { display: flex; align-items: center; gap: var(--space-lg); }
.ex-detail__head .ex-detail__name { margin-top: 0; }
.ex-detail__head .ex-detail__meta { margin-bottom: 0; }

.ex-detail__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-xl);
  color: var(--color-ink);
  margin-top: var(--space-lg);
}
.ex-detail__meta { color: var(--color-muted); margin: var(--space-2xs) 0 var(--space-lg); }
.ex-detail .card { margin-bottom: var(--space-lg); }

/* ── Muscles ────────────────────────────────────────── */
.group-bars { display: grid; gap: var(--space-sm); }
.gbar {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) 5.5rem;
  gap: var(--space-md);
  align-items: center;
}
.gbar__label { font-size: var(--text-sm); color: var(--color-ink-2); }
.gbar__track { height: 8px; border-radius: 4px; background: var(--color-paper-3); overflow: hidden; }
.gbar__fill { height: 100%; border-radius: 4px; background: var(--color-rule-2); }
.gbar--top .gbar__fill { background: var(--color-accent); }
.gbar__value { font-size: var(--text-sm); color: var(--color-muted); text-align: right; white-space: nowrap; }

.last-trained { display: grid; }

/* ── Log flow ───────────────────────────────────────── */
.log-date-card {
  display: grid;
  grid-template-columns: minmax(11rem, 14rem) minmax(11rem, 14rem) minmax(0, 1fr);
  align-items: end;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.log-date-card .field label { font-family: var(--font-mono); font-size: 11px; letter-spacing: var(--tracking-micro); text-transform: uppercase; }
.log-date-card .hint { padding-bottom: var(--space-xs); }
.log-duration-row { display: flex; gap: var(--space-xs); }
.log-duration-row input { min-width: 0; }
.daily-stash { margin-top: var(--space-xl); }
.daily-stash > .btn { margin-top: var(--space-md); }
.daily-stash > .hint { margin: calc(var(--space-xs) * -1) 0 var(--space-sm); }
.daily-empty { padding: var(--space-md) 0; border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); color: var(--color-muted); font-size: var(--text-sm); }
.daily-row { grid-template-columns: 5.5rem minmax(0, 1fr) auto auto; align-items: center; }
.daily-row--nested { padding-left: var(--space-lg); border-top-style: dashed; }
.daily-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-xs); }
.daily-actions .btn { padding-inline: var(--space-sm); }
.step__eyebrow { margin-bottom: var(--space-xs); }
.step__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--color-ink);
  margin-bottom: var(--space-lg);
}
.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: var(--space-xs);
}
.part-btn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-sm);
  min-height: 72px;
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  transition: background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .part-btn:hover { background: var(--color-paper-2); } }
.part-btn .sub { display: block; font-size: var(--text-sm); color: var(--color-muted); }
.part-btn__icon { width: 34px; height: 48px; }
/* The muscle figures are painted through --muscle-art, a custom property set
 * once per group in a stylesheet app.js injects — so a list of 40 exercise
 * rows carries 8 data URLs between them, not one per row. */
.part-btn__icon, .ex-avatar__art {
  background-image: var(--muscle-art);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* the sheet's native highlight is cyan — rotate it toward each drop's accent */
  filter: hue-rotate(215deg) saturate(0.85) brightness(1.15);
}
[data-theme="blueberry"] .part-btn__icon,
[data-theme="blueberry"] .ex-avatar__art { filter: brightness(1.1); }
[data-theme="strawberry"] .part-btn__icon,
[data-theme="strawberry"] .ex-avatar__art { filter: hue-rotate(140deg) saturate(1.1) brightness(1.1); }
/* Line art inherits currentColor, so it already follows the drop. Re-hueing it
 * would shift it a second time and drift away from the accent. */
.ex-avatar__art--line,
[data-theme] .ex-avatar__art--line {
  filter: none;
  color: var(--color-accent);
  padding: 3px;
}
/* A real catalog image is already in its own colours — never re-hue it. */
.ex-avatar__art--photo,
[data-theme] .ex-avatar__art--photo {
  filter: none;
  background-size: cover;
  padding: 0;
  border-radius: calc(var(--radius-sm) - 1px);
}
.part-btn--textonly { grid-template-columns: minmax(0, 1fr); min-height: 56px; }
.log-back { margin-bottom: var(--space-md); }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}
.stepper__btn {
  min-width: 52px; min-height: 52px;
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  color: var(--color-ink);
  transition: background-color var(--dur-micro) var(--ease-out);
}
@media (hover: hover) { .stepper__btn:hover { background: var(--color-paper-2); } }
.stepper__btn:active { transform: translateY(1px); }
.stepper input {
  width: 6.5rem;
  min-height: 52px;
  text-align: center;
  font-size: var(--text-md);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--color-rule-2);
  outline: 2px solid transparent;
  outline-offset: 1px;
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
  color: var(--color-ink);
}
.stepper input:focus-visible { outline-color: var(--color-focus); }
.stepper__unit { color: var(--color-muted); }
.reps-custom { max-width: 10rem; margin-top: var(--space-sm); }
.log-field { margin-bottom: var(--space-lg); }
.log-field > .field-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-xs);
}

/* ── Coach ──────────────────────────────────────────── */
.coach__settings { margin-bottom: var(--space-md); }
.card--plan { display: grid; gap: var(--space-sm); justify-items: start; }
.card--plan .field-label { font-size: var(--text-sm); color: var(--color-muted); }
.card--plan .field-label + .field-label,
.card--plan .chips + .field-label { margin-top: var(--space-sm); }
.card--plan .seg { margin-bottom: 0; }
.plan__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}
.suggestion__line { margin-bottom: var(--space-xs); }
.suggestion__line strong { color: var(--color-ink); font-weight: 500; }
#planCard { margin-top: var(--space-lg); }
#planCard .card { margin-top: 0; }
.plan-date-field { width: min(100%, 17rem); }
.plan-editor { display: grid; gap: var(--space-sm); }
.plan-editor__row {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) repeat(3, minmax(4.75rem, .48fr)) auto;
  gap: var(--space-sm);
  align-items: end;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-rule);
}
.plan-editor__field { min-width: 0; }
.plan-editor__field label {
  display: block;
  margin-bottom: var(--space-3xs);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: var(--tracking-micro);
  text-transform: uppercase;
}
.plan-editor input, .plan-editor select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: inherit;
}
.plan-editor select { text-transform: none; }
.plan-editor__remove { min-width: 44px; padding: 0 var(--space-sm); }
.plan-editor__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: end; }
.plan-editor__add { min-width: min(100%, 18rem); flex: 1 1 14rem; }
.record-editor { margin-top: var(--space-lg); }
.record-editor__date { width: min(100%, 17rem); }
.record-editor__number { min-height: 44px; display: grid; place-items: center; color: var(--color-muted); }
.record-row { grid-template-columns: 5.5rem minmax(0, 1fr) auto auto; }
.record-row__edit { justify-self: end; }

/* ── Mobile dock ────────────────────────────────────── */
.dock { display: none; }

@media (max-width: 59.99rem) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .stage { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  .dock {
    position: fixed;
    z-index: var(--z-sticky);
    bottom: 0; left: 0; right: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid var(--color-rule);
    background: var(--color-paper-2);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dock__item {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: var(--space-xs) 0 var(--space-sm);
    min-height: 52px;
    font-size: 11px;
    color: var(--color-muted);
    white-space: nowrap;
  }
  .dock__item.is-active { color: var(--color-ink); }
  .dock__item.is-active .dock__glyph { color: var(--color-accent); }
  .dock__glyph { width: 20px; height: 20px; }
  .gate__inner { grid-template-columns: minmax(0, 1fr); }
  .apparatus { padding: var(--space-lg) 0 var(--space-xl); }
  .barbell { height: 150px; max-width: 320px; }
  .barbell__plate { height: calc(104px - var(--i) * 26px); }
  .duo { grid-template-columns: minmax(0, 1fr); }
  .meter { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); }
  .meter__label--r { display: none; }
  .row { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .row__value { grid-column: 2; }
  .daily-row { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .daily-row .row__value { grid-column: 2; }
  .daily-actions { grid-column: 2; justify-content: flex-start; }
  .log-date-card { grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); }
  .log-date-card .hint { padding-bottom: 0; }
  .gbar { grid-template-columns: 5.5rem minmax(0, 1fr) 4.5rem; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat + .stat { border-left: none; border-top: 1px solid var(--color-rule); }
  .seg--theme button { padding: 0 var(--space-sm); font-size: var(--text-sm); }
  .profile-mobile-link { display: inline-flex; }
  .view__head--split { align-items: flex-start; }
  .plan-editor__row { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
  .plan-editor__exercise { grid-column: 1 / -1; }
  .plan-editor__actions { align-items: stretch; }
  .record-row { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .record-row .row__value, .record-row__edit { grid-column: 2; justify-self: start; }
}

/* ── Admin (admin/index.html) ──────────────────────────
 * A single centred column, not the rail-and-dock Workbench — see
 * plans/admin-and-accounts/01-admin-panel.md §5. Reuses .stage's padding and
 * max-width; .stage normally sits beside .rail in the app's grid, so this
 * page needs the centring .rail's sibling column would otherwise provide.
 */
#admin.stage { margin-inline: auto; }
.admin-fields { display: grid; gap: var(--space-md); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.admin-fields + .field-label, .admin-warning { margin-top: var(--space-sm); }
.admin-form-actions { margin-top: var(--space-md); }
.admin-result { margin-top: var(--space-md); }
.admin-result code {
  font-family: var(--font-mono);
  background: var(--color-paper-2);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-xs);
}

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 150ms !important;
  }
  .barbell__knurl { animation: none; }
  .gate__title em::after { animation: none; }
  .card, .card:hover { transform: none; }
}
