:root {
  --ink: #4a071c;
  --ink-soft: #7d4253;
  --raspberry: #ed174c;
  --raspberry-dark: #c80f3e;
  --rose: #f9dce3;
  --rose-strong: #f3b9c8;
  --blush: #fef6f7;
  --paper: #fffdfd;
  --line: #efd5dc;
  --success: #b91746;
  --danger: #a50f35;
  --shadow: 0 12px 34px rgb(91 8 35 / 8%);
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 30px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--blush);
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--blush);
  color: var(--ink);
  font: 16px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #8b1bff;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
}

.skip-link:focus {
  transform: none;
}

.shell {
  width: min(100%, 600px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(110px + env(safe-area-inset-bottom));
}

.app-header,
.workout-header,
.section-heading,
.exercise-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header {
  min-height: 52px;
  margin-bottom: 28px;
}

.brand {
  color: var(--ink);
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.06em;
  text-decoration: none;
}

.profile-link,
.text-action,
.back-to-list {
  border: 0;
  background: none;
  color: var(--raspberry-dark);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.notice {
  margin: 0 0 16px;
  border: 1px solid var(--rose-strong);
  border-radius: var(--radius-sm);
  background: #fff0f4;
  color: var(--ink);
  padding: 13px 15px;
  font-weight: 700;
  animation: notice-in 180ms ease-out;
}

.workout-page .notice {
  position: fixed;
  z-index: 40;
  top: max(10px, env(safe-area-inset-top));
  right: 14px;
  left: 14px;
  width: min(calc(100% - 28px), 492px);
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--raspberry-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: -0.045em;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.3rem, 11vw, 4rem);
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.1;
}

.dashboard-hero {
  padding: 8px 0 20px;
}

.dashboard-hero h1 {
  margin-bottom: 22px;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.week-day {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-weight: 800;
}

.week-day small {
  font-size: 0.72rem;
}

.week-day i {
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
}

.week-day.is-done i {
  border-color: var(--raspberry);
  background: var(--raspberry);
  box-shadow: inset 0 0 0 7px var(--raspberry), inset 0 0 0 9px white;
}

.week-day.is-today i {
  box-shadow: 0 0 0 3px var(--rose-strong);
}

.primary-action,
.secondary-action,
.save-set {
  display: inline-flex;
  min-height: 58px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 18px;
  background: var(--raspberry);
  color: white;
  padding: 15px 20px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 26px rgb(237 23 76 / 20%);
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.primary-action:hover,
.save-set:hover {
  background: var(--raspberry-dark);
}

.primary-action:active,
.save-set:active,
.circle-action:active,
.step-actions button:active {
  transform: scale(0.97);
}

.primary-action img {
  width: 27px;
  height: 27px;
}

.resume-action {
  background: var(--ink);
  box-shadow: 0 10px 26px rgb(74 7 28 / 18%);
}

.gym-tag-dialog {
  width: min(calc(100% - 24px), 520px);
  max-height: min(86vh, 720px);
  margin: auto;
  overflow: visible;
  border: 0;
  background: transparent;
  padding: 0;
}

.gym-tag-dialog::backdrop {
  background: rgb(45 5 18 / 52%);
  backdrop-filter: blur(3px);
}

.gym-tag-dialog-card {
  max-height: min(86vh, 720px);
  overflow: auto;
  border: 1px solid var(--rose-strong);
  border-radius: 28px;
  background: var(--paper);
  padding: 22px;
  box-shadow: 0 28px 80px rgb(74 7 28 / 28%);
}

.gym-tag-dialog-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.gym-tag-dialog-card h2 {
  margin-bottom: 7px;
  font-size: clamp(1.55rem, 7vw, 2.1rem);
}

.gym-tag-dialog-card header p:last-child {
  max-width: 38ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--rose);
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.gym-tag-options {
  display: grid;
  max-height: 300px;
  gap: 8px;
  margin: 0;
  overflow-y: auto;
  border: 0;
  padding: 0 2px 2px;
}

.gym-tag-option {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--blush);
  padding: 11px 13px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.gym-tag-option:has(input:checked) {
  border-color: var(--raspberry);
  background: #fff0f4;
  box-shadow: inset 0 0 0 1px var(--raspberry);
}

.gym-tag-option input {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin: 0;
  accent-color: var(--raspberry);
}

.gym-tag-option span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.gym-tag-option strong {
  overflow-wrap: anywhere;
}

.gym-tag-option small,
.gym-tag-new-name small {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.gym-tag-option.is-new {
  border-style: dashed;
}

.gym-tag-new-name {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--ink);
  font-weight: 850;
}

.gym-tag-new-name[hidden] {
  display: none;
}

.gym-tag-new-name input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--rose-strong);
  border-radius: 15px;
  background: white;
  color: var(--ink);
  padding: 12px 14px;
}

.gym-tag-dialog-actions {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr);
  gap: 10px;
  margin-top: 18px;
}

.gym-tag-dialog-actions .primary-action,
.gym-tag-dialog-actions .secondary-action {
  min-height: 54px;
  padding: 12px 14px;
}

.content-section {
  padding: 28px 0 4px;
}

.section-heading {
  margin-bottom: 14px;
}

.exercise-list,
.summary-list,
.timeline,
.legacy-events {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.exercise-row,
.library-row,
.summary-list article,
.legacy-events article {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 16px;
}

.exercise-row + .exercise-row,
.library-row + .library-row,
.summary-list article + article,
.legacy-events article + article {
  border-top: 1px solid var(--line);
}

.exercise-copy,
.library-row > div,
.summary-list article > div,
.legacy-events article > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.exercise-copy strong,
.library-row strong {
  overflow: hidden;
  font-size: 1.03rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exercise-copy span {
  color: var(--raspberry-dark);
  font-weight: 800;
}

.exercise-copy small,
.library-row small,
.summary-list small,
.legacy-events span {
  color: var(--ink-soft);
}

.circle-action,
.icon-button,
.library-row > a {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 2px solid var(--raspberry);
  border-radius: 50%;
  background: transparent;
  color: var(--raspberry);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.circle-action:hover {
  background: #fff0f4;
}

.circle-action img {
  width: 21px;
  height: 21px;
}

.library-row > a,
.icon-button {
  width: 44px;
  height: 44px;
  border-color: transparent;
}

.library-row img {
  width: 22px;
  height: 22px;
}

.search-field {
  display: block;
  margin-bottom: 12px;
}

.search-field input,
.activity-select select,
.form-surface input,
.form-surface textarea,
.form-surface select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  padding: 13px 15px;
}

.library-row[hidden] {
  display: none;
}

.account-tools {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 34px 4px 12px;
  font-size: 0.84rem;
}

.account-tools a {
  color: var(--ink-soft);
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 600px);
  min-height: 76px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: rgb(255 253 253 / 94%);
  padding: 8px 14px max(8px, env(safe-area-inset-bottom));
  backdrop-filter: blur(18px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
  text-decoration: none;
}

.bottom-nav img {
  width: 25px;
  height: 25px;
  opacity: 0.67;
}

.bottom-nav a.is-active {
  color: var(--raspberry);
}

.bottom-nav a.is-active img {
  opacity: 1;
}

/* Active workout */
.workout-page {
  background: #fff5f7;
}

.workout-page .shell {
  width: min(100%, 520px);
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: 42px;
}

.workout-header {
  min-height: 48px;
  margin-bottom: 28px;
}

.workout-header > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.workout-header .eyebrow {
  margin: 0;
}

.workout-header strong {
  font-size: 0.88rem;
}

.workout-header small {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.workout-header .session-gym-tag,
.summary-gym-tag,
.history-gym-tag,
.previous-gym-context span {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--rose-strong);
  border-radius: 99px;
  background: var(--rose);
  color: var(--raspberry-dark);
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.2;
}

.workout-header .session-gym-tag {
  flex-basis: 100%;
}

.workout-header form {
  margin: 0;
}

.finish-workout {
  min-height: 46px;
  border: 1px solid var(--raspberry);
  border-radius: 15px;
  background: transparent;
  color: var(--raspberry-dark);
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.exercise-title {
  display: block;
  margin-bottom: 20px;
}

.exercise-title > div {
  width: 100%;
}

.exercise-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exercise-title p {
  margin: 5px 0 0;
  color: var(--raspberry-dark);
  font-size: 1.1rem;
  font-weight: 900;
}

.exercise-title > .eyebrow {
  margin: 0 0 8px;
  font-size: 0.68rem;
}

.exercise-title h1 {
  max-width: none;
  margin-bottom: 0;
  font-size: clamp(2rem, 8.8vw, 3.4rem);
  text-wrap: balance;
}

.compact-heading {
  align-items: end;
  margin-bottom: 10px;
}

.compact-heading .eyebrow {
  margin-bottom: 4px;
}

.compact-heading h2 {
  font-size: 1.22rem;
}

.session-exercises {
  margin-bottom: 14px;
}

.session-exercise-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 2px 2px 6px;
}

.session-exercise {
  display: grid;
  min-width: 0;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 70%);
  color: var(--ink);
  padding: 11px 13px;
  text-decoration: none;
}

.session-exercise span {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-exercise small {
  color: var(--ink-soft);
}

.session-exercise.is-active {
  border-color: var(--raspberry);
  background: var(--rose);
  box-shadow: inset 0 0 0 1px var(--raspberry);
}

.exercise-switcher {
  position: relative;
}

.exercise-switcher summary {
  display: grid;
  min-width: 58px;
  min-height: 48px;
  place-items: center;
  border-radius: 15px;
  color: var(--raspberry-dark);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.exercise-switcher summary::-webkit-details-marker {
  display: none;
}

.switcher-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(86vw, 340px);
  max-height: 62vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px;
  box-shadow: var(--shadow);
}

.switcher-panel > strong {
  padding: 8px 9px 12px;
}

.switcher-panel a {
  display: grid;
  gap: 2px;
  border-radius: 12px;
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
}

.switcher-panel a:hover,
.switcher-panel a[aria-current="true"] {
  background: #fff0f4;
}

.switcher-panel small {
  color: var(--ink-soft);
}

.workout-switcher {
  width: 100%;
  margin-bottom: 16px;
}

.workout-switcher > summary {
  display: flex;
  width: 100%;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--rose-strong);
  border-radius: 18px;
  background: var(--paper);
  color: var(--raspberry-dark);
  padding: 13px 15px;
  font-size: 0.96rem;
  box-shadow: var(--shadow);
}

.workout-switcher > summary span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workout-switcher > summary img {
  width: 23px;
  height: 23px;
}

.workout-switcher > summary > img {
  width: 20px;
  height: 20px;
  transition: transform 140ms ease;
}

.workout-switcher[open] > summary > img {
  transform: rotate(90deg);
}

.workout-switcher .switcher-panel {
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  width: 100%;
}

.set-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 20px;
}

.set-progress i {
  height: 5px;
  border-radius: 99px;
  background: var(--rose);
}

.set-progress i.is-complete,
.set-progress i.is-current {
  background: var(--raspberry);
}

.set-progress i.is-current {
  animation: pulse-progress 1.6s ease-in-out infinite;
}

.suggestion-note {
  margin-bottom: 12px;
  border-left: 4px solid var(--raspberry);
  color: var(--ink-soft);
  padding: 2px 0 2px 10px;
  font-size: 0.78rem;
  line-height: 1.32;
}

.suggestion-note strong {
  color: var(--ink);
}

.previous-performance {
  margin-bottom: 16px;
  border: 1px solid var(--rose-strong);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 72%);
  padding: 14px;
}

.previous-performance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.previous-performance-header .eyebrow {
  margin-bottom: 2px;
}

.previous-performance-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.previous-performance-header time {
  border-radius: 99px;
  background: var(--rose);
  color: var(--raspberry-dark);
  padding: 6px 9px;
  font-size: 0.72rem;
  font-weight: 900;
}

.previous-gym-context {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 9px 0 -2px;
}

.previous-gym-context small {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.previous-gym-context.is-different span {
  border-color: #dc9a3c;
  background: #fff4dc;
  color: #7f4900;
}

.previous-performance-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.previous-performance-summary > div {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  background: var(--paper);
  padding: 9px 10px;
}

.previous-performance-summary small {
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.previous-performance-summary strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.previous-set-chart {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.previous-set-chart li {
  display: grid;
  grid-template-columns: 20px minmax(34px, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.previous-set-number {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 7px;
  background: var(--rose);
  color: var(--raspberry-dark);
  font-size: 0.66rem;
  font-weight: 900;
}

.previous-set-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--rose);
}

.previous-set-track i {
  display: block;
  width: var(--set-bar);
  height: 100%;
  border-radius: inherit;
  background: var(--raspberry);
  opacity: 0.58;
}

.previous-set-chart strong {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.previous-set-chart li.is-best .previous-set-number,
.previous-set-chart li.is-best .previous-set-track i {
  background: var(--raspberry-dark);
  color: white;
  opacity: 1;
}

.previous-set-chart li small {
  grid-column: 2 / -1;
  margin-top: -7px;
  color: var(--raspberry-dark);
  font-size: 0.62rem;
  font-weight: 900;
}

.previous-performance-hint {
  margin: 11px 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  padding-top: 9px;
  font-size: 0.7rem;
  line-height: 1.35;
}

@media (max-width: 350px) {
  .previous-performance-summary {
    grid-template-columns: 1fr 1fr;
  }

  .previous-performance-summary > div:last-child {
    grid-column: 1 / -1;
  }
}

.set-composer {
  overflow: hidden;
  border: 1px solid var(--rose-strong);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 68%);
  box-shadow: var(--shadow);
}

.composer-intro {
  padding: 18px 18px 2px;
}

.composer-intro .eyebrow {
  margin-bottom: 5px;
}

.composer-intro h2 {
  margin-bottom: 7px;
  font-size: 1.35rem;
}

.composer-intro > p:last-child {
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.set-count-control {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgb(249 220 227 / 52%);
  padding: 11px 13px 11px 18px;
}

.set-count-control > span:first-child {
  display: grid;
}

.set-count-control small {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 500;
}

.compact-stepper {
  display: grid;
  grid-template-columns: 42px 46px 42px;
  gap: 5px;
}

.compact-stepper button,
.compact-stepper input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--rose-strong);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  padding: 4px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 900;
}

.compact-stepper button:last-child {
  border-color: var(--raspberry);
  background: var(--raspberry);
  color: white;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-control {
  display: grid;
  min-width: 0;
  justify-items: center;
  padding: 22px 11px 18px;
}

.metric-control + .metric-control {
  border-left: 1px solid var(--rose-strong);
}

.metric-control > span:first-child {
  font-weight: 900;
}

.metric-value {
  display: flex;
  width: 100%;
  min-height: clamp(82px, 21vw, 104px);
  min-width: 0;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin: 9px 0 13px;
  overflow: hidden;
  padding-inline: 5px 9px;
}

.metric-value input {
  width: var(--metric-text-width, min(118px, 75%));
  min-width: 0;
  max-width: calc(100% - var(--metric-unit-width, 34px) - 5px);
  flex: 0 1 auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--metric-font-size, clamp(3rem, 15vw, 5rem));
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.08em;
  line-height: 1;
  padding: 0 0.08em;
  text-align: center;
  appearance: textfield;
  transition: font-size 140ms ease, width 140ms ease;
}

.metric-value input::-webkit-outer-spin-button,
.metric-value input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.metric-value b {
  flex: 0 0 auto;
  color: var(--raspberry-dark);
  font-size: clamp(0.76rem, 3.6vw, 0.95rem);
  line-height: 1;
  white-space: nowrap;
}

.metric-value.is-compact b {
  font-size: 0.72rem;
}

.metric-value.is-compact {
  display: grid;
  grid-template-rows: 1fr auto;
  align-content: center;
  align-items: center;
  justify-items: center;
  gap: 0;
}

.metric-value.is-compact input {
  max-width: 100%;
  text-align: center;
}

.metric-value.is-compact b {
  margin-top: -2px;
}

.step-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 100%;
  gap: 9px;
}

.step-actions button {
  display: grid;
  min-height: 68px;
  place-items: center;
  border: 1px solid var(--rose-strong);
  border-radius: 19px;
  background: var(--rose);
  color: var(--ink);
  font-size: 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 100ms ease, background 100ms ease;
}

.step-actions button.is-primary {
  border-color: var(--raspberry);
  background: var(--raspberry);
  color: white;
}

.field-error {
  color: var(--danger);
}

.save-set {
  min-height: 68px;
  border-radius: 0;
  font-size: 1.15rem;
  box-shadow: none;
}

.rest-panel {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  margin: 16px 0 24px;
  border: 1px solid var(--rose-strong);
  border-radius: var(--radius);
  background: var(--rose);
  padding: 14px 15px;
}

.rest-panel > div {
  display: grid;
}

.rest-panel span {
  font-size: 0.82rem;
  font-weight: 800;
}

.rest-panel strong {
  font-size: 2.2rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.rest-panel button {
  min-height: 48px;
  border: 1px solid var(--raspberry);
  border-radius: 14px;
  background: transparent;
  color: var(--raspberry-dark);
  padding: 9px 12px;
  font-weight: 900;
  cursor: pointer;
}

.rest-panel button img {
  width: 21px;
  height: 21px;
}

.completed-sets h2 {
  margin-bottom: 10px;
  font-size: 1.28rem;
}

.set-count-badge {
  border-radius: 99px;
  background: var(--rose);
  color: var(--raspberry-dark);
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 900;
}

.set-row {
  display: grid;
  grid-template-columns: 30px 1fr auto 28px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 3px;
}

.set-row > span {
  color: var(--raspberry);
  font-size: 1.25rem;
  font-weight: 900;
}

.set-row small {
  color: var(--ink-soft);
}

.set-row > img {
  width: 26px;
  height: 26px;
}

.empty-copy {
  color: var(--ink-soft);
}

.rest-tool {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 55%);
}

.rest-tool > summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.rest-tool > summary::-webkit-details-marker {
  display: none;
}

.rest-tool > summary span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rest-tool > summary img {
  width: 21px;
  height: 21px;
}

.rest-tool .rest-panel {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}

.back-to-list {
  display: block;
  min-height: 48px;
  margin-top: 20px;
  padding: 12px;
  text-align: center;
}

/* History, progress, forms */
.page-intro {
  padding: 12px 0 28px;
}

.page-intro.compact {
  padding-bottom: 14px;
}

.page-intro h1 {
  margin-bottom: 12px;
}

.page-intro p:last-child {
  max-width: 38ch;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.summary-intro {
  padding-top: 36px;
  text-align: center;
}

.summary-intro > p {
  margin-right: auto;
  margin-left: auto;
}

.summary-gym-tag {
  margin: 2px auto 20px;
}

.summary-list article > span {
  color: var(--raspberry-dark);
  font-weight: 900;
}

.stacked-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.secondary-action {
  border: 1px solid var(--rose-strong);
  background: transparent;
  color: var(--raspberry-dark);
  box-shadow: none;
}

.timeline-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 14px;
  text-decoration: none;
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-row time {
  display: grid;
  justify-items: center;
  border-radius: 15px;
  background: var(--rose);
  padding: 7px;
}

.timeline-row time strong {
  font-size: 1.25rem;
  line-height: 1;
}

.timeline-row time span,
.timeline-row > div span {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.timeline-row > div {
  display: grid;
  gap: 3px;
}

.timeline-row > div .history-gym-tag {
  margin-top: 3px;
  font-size: 0.68rem;
}

.timeline-row > img {
  width: 22px;
  height: 22px;
}

.empty-state {
  padding: 30px 20px;
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  margin: 0;
  color: var(--ink-soft);
}

.legacy-events {
  margin-top: 28px;
}

.legacy-events h2 {
  padding: 18px 16px 8px;
}

.legacy-events time {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.activity-select {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.activity-select label {
  font-size: 0.82rem;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 28px;
}

.stats-grid article {
  display: grid;
  min-height: 112px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 16px;
}

.stats-grid span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.stats-grid strong {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.chart-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 18px 16px;
}

.chart-section canvas {
  display: block;
  width: 100%;
  height: 240px;
  margin-top: 16px;
}

.chart-empty {
  margin: 18px 0 8px;
  color: var(--ink-soft);
  text-align: center;
}

.chart-section.has-data .chart-empty {
  display: none;
}

.form-surface {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 18px;
}

.form-surface p,
.form-surface label {
  display: grid;
  gap: 7px;
  margin: 0;
  font-weight: 800;
}

.form-surface ul {
  margin: 0;
  padding-left: 20px;
}

.form-surface #id_fields_list {
  display: grid;
  gap: 9px;
}

.form-surface #id_fields_list label {
  display: flex;
  min-height: 42px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.form-surface input[type="checkbox"] {
  width: 22px;
  height: 22px;
}

.helper-copy,
.sync-state {
  color: var(--ink-soft);
  font-size: 0.87rem;
}

.simple-stepper {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 7px;
}

.simple-stepper button {
  border: 0;
  border-radius: 14px;
  background: var(--raspberry);
  color: white;
  font-size: 1.6rem;
  font-weight: 800;
}

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

@media (min-width: 700px) {
  .shell {
    padding-right: 30px;
    padding-left: 30px;
  }

  .dashboard-hero {
    padding-top: 34px;
  }
}

@media (max-width: 370px) {
  .shell {
    padding-right: 13px;
    padding-left: 13px;
  }

  .metric-control {
    padding-right: 8px;
    padding-left: 8px;
  }

  .metric-value input {
    font-size: var(--metric-font-size, 3rem);
  }

  .step-actions button {
    min-height: 60px;
  }

  .rest-panel {
    grid-template-columns: 1fr auto;
  }

  .rest-panel > button:last-child {
    grid-column: 1 / -1;
  }

  .gym-tag-dialog {
    width: calc(100% - 14px);
  }

  .gym-tag-dialog-card {
    border-radius: 23px;
    padding: 18px 14px;
  }

  .gym-tag-dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .exercise-row,
  .library-row,
  .timeline-row {
    animation: row-in 260ms both;
  }

  .exercise-row:nth-child(2),
  .library-row:nth-child(2) {
    animation-delay: 35ms;
  }

  .exercise-row:nth-child(3),
  .library-row:nth-child(3) {
    animation-delay: 70ms;
  }

  @keyframes row-in {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
  }

  @keyframes notice-in {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
  }

  @keyframes pulse-progress {
    50% {
      opacity: 0.45;
    }
  }
}

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