:root {
  color-scheme: dark;
  --bg: #070910;
  --panel: #101722;
  --panel-raised: #151f2e;
  --panel-soft: #0c121d;
  --text: #f8fafc;
  --muted: #9aa7bd;
  --line: #293447;
  --line-strong: #3a4860;
  --primary: #0090ff;
  --primary-dark: #006fd6;
  --primary-soft: rgba(0, 144, 255, 0.16);
  --accent: #f76b15;
  --accent-dark: #d95708;
  --accent-soft: rgba(247, 107, 21, 0.16);
  --success: #22c55e;
  --warning: #facc15;
  --danger: #f43f5e;
  --danger-dark: #e11d48;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  --shadow-hot: 0 14px 34px rgba(247, 107, 21, 0.2);
  --glass-surface: rgba(21, 31, 46, 0.54);
  --glass-surface-strong: rgba(21, 31, 46, 0.7);
  --glass-highlight: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.18);
  --body-texture: rgba(255, 255, 255, 0.045);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, rgba(247, 107, 21, 0.28) 0%, rgba(247, 107, 21, 0.08) 22%, transparent 44%),
    radial-gradient(circle at 84% 10%, rgba(0, 144, 255, 0.32) 0%, rgba(0, 144, 255, 0.1) 24%, transparent 48%),
    radial-gradient(circle at 72% 82%, rgba(247, 107, 21, 0.18) 0%, transparent 34%),
    linear-gradient(135deg, #05070c 0%, #0e1724 38%, #080b13 68%, #12131a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(255, 255, 255, 0.045) 18% 18.4%, transparent 18.4% 45%, rgba(0, 144, 255, 0.08) 45% 45.45%, transparent 45.45% 100%),
    linear-gradient(155deg, transparent 0 34%, rgba(247, 107, 21, 0.075) 34% 34.5%, transparent 34.5% 100%),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.07) 0%, transparent 30%);
  opacity: 0.78;
  mix-blend-mode: screen;
  content: "";
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 1px 1px, var(--body-texture) 1px, transparent 1.6px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 18px 18px, 64px 64px, 64px 64px;
  mask-image: radial-gradient(circle at 50% 18%, black 0%, rgba(0, 0, 0, 0.88) 42%, rgba(0, 0, 0, 0.28) 100%);
  opacity: 0.42;
  content: "";
}

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

button {
  min-height: 46px;
  border: 1px solid rgba(0, 144, 255, 0.34);
  border-radius: 8px;
  padding: 0 16px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 144, 255, 0.18);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
}

button:hover {
  background: linear-gradient(180deg, #1ea0ff 0%, var(--primary-dark) 100%);
  border-color: rgba(0, 144, 255, 0.58);
  box-shadow: 0 14px 34px rgba(0, 144, 255, 0.22);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: var(--panel-raised);
  color: var(--text);
  border-color: var(--line);
  box-shadow: none;
}

button.secondary:hover {
  background: #1b2738;
  border-color: var(--line-strong);
  box-shadow: none;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-dark);
}

button.compact {
  min-height: 38px;
  padding: 0 12px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel-soft);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(0, 144, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(0, 144, 255, 0.16);
}

input[type="range"] {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}

label span,
.eyebrow {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 14px 36px;
}

.auth-view {
  display: grid;
  min-height: 92vh;
  align-content: center;
  gap: 22px;
}

.brand-block h1 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: clamp(2.25rem, 10vw, 4.25rem);
  line-height: 1;
  text-shadow: 0 0 34px rgba(247, 107, 21, 0.24);
}

.panel {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.026) 48%, rgba(255, 255, 255, 0.014) 100%),
    radial-gradient(circle at 10% 0%, rgba(0, 144, 255, 0.1) 0%, transparent 34%),
    radial-gradient(circle at 92% 12%, rgba(247, 107, 21, 0.085) 0%, transparent 28%),
    var(--glass-surface);
  box-shadow: inset 0 1px 0 var(--glass-highlight), inset 0 -1px 0 rgba(255, 255, 255, 0.045), var(--shadow);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.auth-panel,
.exercise-form,
.routine-form,
.routine-item-form {
  display: grid;
  gap: 16px;
}

.exercise-weight-reported-as-field,
.weight-reported-as-toggle,
.exercise-variations-field {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  grid-column: 1 / -1;
}

.exercise-variations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.exercise-variation-list {
  display: grid;
  gap: 10px;
}

.exercise-variation-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

.backfill-workout-modal {
  width: min(100%, 560px);
}

.backfill-workout-description {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.weight-reported-as-toggle {
  grid-column: 1 / -1;
}

#workoutMeasureFields .weight-reported-as-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#workoutMeasureFields .weight-reported-as-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  gap: 18px;
}

#workoutMeasureFields .weight-reported-as-toggle label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

#workoutMeasureFields .weight-reported-as-toggle input {
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.auth-panel,
.toolbar {
  padding: 18px;
}

.auth-actions,
.form-actions,
.row-actions {
  display: grid;
  gap: 10px;
}

.section-actions {
  display: grid;
  align-items: center;
  gap: 8px;
  grid-auto-flow: column;
}

.form-message {
  min-height: 1.25rem;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.account-menu {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.site-title {
  display: inline-block;
  width: fit-content;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  text-transform: none;
  cursor: pointer;
  text-shadow: 0 0 24px rgba(247, 107, 21, 0.22);
  box-shadow: none;
}

.site-title:hover {
  background: transparent;
  color: var(--text);
  opacity: 0.84;
}

.site-title:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.user-label {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}

.user-label:hover {
  background: transparent;
}

.account-menu-panel {
  top: calc(100% + 10px);
  right: 0;
  min-width: 148px;
}

.toolbar {
  margin-bottom: 22px;
}

.view-title {
  margin-bottom: 14px;
}

.view-title h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 0 24px rgba(247, 107, 21, 0.14);
}

.tabbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #121b29 0%, #0b111b 100%);
  box-shadow: var(--shadow);
}

.tab {
  display: inline-grid;
  place-items: center;
  min-height: 60px;
  padding: 0;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background 140ms ease-out, color 140ms ease-out, box-shadow 140ms ease-out, transform 140ms ease-out;
  box-shadow: none;
}

.tab:hover {
  background: rgba(0, 144, 255, 0.12);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.tab.active {
  background: linear-gradient(180deg, rgba(0, 144, 255, 0.22) 0%, rgba(247, 107, 21, 0.1) 100%);
  color: var(--text);
  border-color: rgba(0, 144, 255, 0.42);
  box-shadow: 0 10px 24px rgba(0, 144, 255, 0.16);
  transform: translateY(-1px);
}

.tab-icon {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.view.active > :first-child.panel,
.view.active > :first-child.exercise-section,
.view.active > :first-child.routine-layout,
.view.active > :first-child.history-layout {
  margin-top: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.completion-section-heading h3 {
  font-size: 1rem;
}

.workout-launcher-recent-routine {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.count-pill,
.type-badge,
.detail-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
}

.detail-badge {
  background: rgba(247, 107, 21, 0.14);
  color: #ffb06f;
}

.rpe-badge {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.history-set-pill {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
  transform: none;
}

.history-set-pill:hover,
.history-set-pill:focus-visible {
  background: rgba(247, 107, 21, 0.22);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.exercise-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.exercise-list,
.routine-list,
.routine-item-list,
.routine-layout,
.workout-history-list,
.history-layout,
.history-workout-exercises {
  display: grid;
  gap: 10px;
}

.history-calendar-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
}

.history-export-actions {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.history-export-actions button {
  width: 100%;
  max-width: 1000px;
}

.history-export-actions .export-history-button,
.history-export-actions .export-history-button:disabled {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
}

.history-export-actions .export-history-button:hover {
  background: linear-gradient(180deg, #1ea0ff 0%, var(--primary-dark) 100%);
}

.history-calendar-header {
  margin-bottom: 0;
  align-items: center;
}

.history-calendar-nav {
  display: grid;
  grid-template-columns: auto minmax(150px, max-content) auto auto;
  gap: 8px;
  align-items: center;
}

.history-calendar-month {
  margin: 0;
  min-width: 150px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.history-calendar-year-button {
  white-space: nowrap;
}

.history-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.history-calendar-weekday {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.history-calendar-cell {
  display: grid;
  align-content: space-between;
  justify-items: start;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.history-calendar-cell:disabled {
  background: rgba(12, 18, 29, 0.55);
  color: var(--muted);
  cursor: default;
  opacity: 0.75;
}

.history-calendar-cell.has-workouts {
  background: linear-gradient(180deg, rgba(247, 107, 21, 0.22) 0%, rgba(21, 31, 46, 0.95) 100%);
  border-color: rgba(247, 107, 21, 0.38);
}

.history-calendar-cell:hover:not(:disabled) {
  background: #162134;
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform: none;
}

.history-calendar-cell.has-workouts:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(247, 107, 21, 0.28) 0%, rgba(21, 31, 46, 1) 100%);
  border-color: rgba(247, 107, 21, 0.54);
}

.history-calendar-cell.today {
  box-shadow: inset 0 0 0 1px rgba(247, 107, 21, 0.58);
}

.history-calendar-cell.selected {
  border-color: rgba(0, 144, 255, 0.72);
  box-shadow: 0 12px 28px rgba(0, 144, 255, 0.18);
}

.history-calendar-cell:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.history-calendar-cell-empty {
  min-height: 64px;
  border: 1px dashed transparent;
  background: transparent;
}

.history-calendar-day-number {
  font-size: 0.95rem;
  font-weight: 800;
}

.history-calendar-count {
  justify-self: end;
  min-width: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
}

.workout-day-chooser-modal {
  width: min(100%, 460px);
}

.history-year-modal {
  width: min(100%, 1180px);
  max-height: min(calc(100dvh - 36px), 920px);
  overflow: auto;
}

.history-year-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-year-description {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.history-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.history-year-month {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.history-year-month-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.history-year-weekdays,
.history-year-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.history-year-weekday {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.history-year-day,
.history-year-day-empty {
  min-height: 28px;
}

.history-year-day {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-items: center;
  padding: 4px 2px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1;
  text-align: center;
}

.history-year-day:hover {
  background: rgba(247, 107, 21, 0.14);
  box-shadow: none;
  transform: none;
}

.history-year-day.has-workouts {
  background: rgba(247, 107, 21, 0.16);
  color: var(--text);
}

.history-year-day.has-workouts:hover {
  background: rgba(247, 107, 21, 0.24);
}

.history-year-day.today {
  box-shadow: inset 0 0 0 1px rgba(247, 107, 21, 0.58);
}

.history-year-day.selected {
  border-color: rgba(0, 144, 255, 0.72);
  box-shadow: 0 10px 22px rgba(0, 144, 255, 0.16);
}

.history-year-day:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.history-year-day-number {
  font-size: 0.74rem;
  font-weight: 750;
}

.history-year-day-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8px;
  min-height: 8px;
  margin-top: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 14px;
}

.history-year-day-indicator:empty {
  min-width: 8px;
  min-height: 8px;
  padding: 0;
  font-size: 0;
  line-height: 0;
}

.workout-history-text-summary-modal {
  width: min(100%, 760px);
  max-height: min(calc(100dvh - 36px), 920px);
  overflow: auto;
}

.workout-history-text-summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workout-history-text-summary-body {
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.workout-day-chooser-date {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.workout-day-chooser-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.workout-day-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  box-shadow: none;
}

.workout-day-choice:hover {
  background: #162134;
  box-shadow: none;
  transform: none;
}

.workout-day-choice-title {
  font-size: 0.98rem;
  font-weight: 800;
}

.workout-day-choice-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.exercise-row,
.routine-card,
.routine-item-row,
.workout-history-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.exercise-row,
.routine-card,
.workout-history-card {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
}

.routine-card,
.workout-history-card {
  cursor: pointer;
}

.workout-history-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.routine-card.selected,
.workout-history-card.selected {
  border-color: rgba(0, 144, 255, 0.5);
  box-shadow: var(--shadow-hot);
}

.routine-editor,
.workout-history-detail {
  padding: 16px;
}

.workout-history-form,
.history-set-grid {
  display: grid;
  gap: 14px;
}

.history-set-grid {
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: stretch;
}

.history-exercise-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.history-exercise-card .section-heading {
  margin-bottom: 0;
  gap: 10px;
  align-items: start;
}

.history-exercise-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.history-exercise-title-block {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.history-exercise-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-exercise-title-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em;
  min-width: 0;
  flex: 1 1 auto;
}

.history-exercise-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.history-exercise-progress-button,
.history-exercise-edit-button {
  min-width: 38px;
  width: 38px;
  padding: 0;
}

.history-exercise-progress-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-insights {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0;
  background-color: var(--accent);
  mask: url("images/insights.svg") center / contain no-repeat;
  -webkit-mask: url("images/insights.svg") center / contain no-repeat;
}

.history-exercise-card h3 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.history-exercise-title-row h3 {
  margin: 0;
  min-width: 0;
  flex: 0 0 auto;
  width: fit-content;
}

.history-exercise-rpe-inline {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.history-exercise-notes {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.history-set-row {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
}

.history-set-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.history-set-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-set-summary .detail-badge,
.history-set-summary .type-badge {
  white-space: nowrap;
}

.history-rpe-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.history-rpe-value {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(247, 107, 21, 0.14);
  color: var(--text);
  font-weight: 800;
}

.history-exercise-edit-form {
  display: grid;
  gap: 14px;
}

.history-exercise-edit-fields {
  display: grid;
  gap: 14px;
}

.history-exercise-swap-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
}

.history-exercise-swap-field label {
  min-width: 0;
}

.history-exercise-edit-modal {
  width: min(100%, 720px);
}

.rpe-field {
  display: grid;
  gap: 8px;
}

.rpe-slider-row {
  --rpe-value-width: 48px;
  --rpe-row-gap: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rpe-value-width);
  align-items: center;
  gap: var(--rpe-row-gap);
}

.rpe-slider {
  accent-color: var(--primary);
}

.rpe-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 8px;
  background: rgba(247, 107, 21, 0.14);
  color: var(--text);
  font-weight: 850;
}

.rpe-scale {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  align-items: start;
  width: calc(100% - 60px);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  padding-bottom: 18px;
}

.rpe-scale::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 13px;
  background:
    linear-gradient(
      90deg,
      #16a34a 0%,
      #16a34a 10%,
      #65a30d 10%,
      #65a30d 20%,
      #84cc16 20%,
      #84cc16 30%,
      #eab308 30%,
      #eab308 40%,
      #f59e0b 40%,
      #f59e0b 50%,
      #fb923c 50%,
      #fb923c 60%,
      #f97316 60%,
      #f97316 70%,
      #ef4444 70%,
      #ef4444 80%,
      #dc2626 80%,
      #dc2626 90%,
      #b91c1c 90%,
      #b91c1c 100%
    );
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  border-radius: 2px;
}

.rpe-scale span {
  display: flex;
  justify-content: center;
  position: relative;
  min-width: 0;
}

.workout-rpe-field {
  --selected-rpe: 5;
  --rpe-fill-percent: 44.444444%;
  gap: 10px;
}

.workout-notes-field label {
  display: grid;
  gap: 6px;
}

.workout-notes-field textarea {
  min-height: 76px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
}

.workout-rpe-value {
  display: block;
  text-align: left;
  color: var(--text);
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 26px rgba(247, 107, 21, 0.28);
}

.workout-rpe-slider {
  position: relative;
  width: 100%;
  padding-block: 14px 6px;
}

.workout-rpe-track,
.workout-rpe-track-fill {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 18px;
  border-radius: 999px;
  transform: translateY(-50%);
  pointer-events: none;
}

.workout-rpe-track {
  z-index: 0;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.workout-rpe-track-fill {
  z-index: 1;
  background: linear-gradient(
    90deg,
    #16a34a 0%,
    #65a30d 14%,
    #84cc16 28%,
    #eab308 42%,
    #f59e0b 58%,
    #fb923c 72%,
    #f97316 84%,
    #ef4444 93%,
    #b91c1c 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 18px rgba(247, 107, 21, 0.18);
  clip-path: inset(0 calc(100% - var(--rpe-fill-percent)) 0 0 round 999px);
}

.workout-rpe-range {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.workout-rpe-range:focus {
  outline: none;
}

.workout-rpe-range::-webkit-slider-runnable-track {
  height: 18px;
  background: transparent;
}

.workout-rpe-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -7px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.36), 0 0 0 5px rgba(247, 107, 21, 0.2);
}

.workout-rpe-range::-moz-range-track {
  height: 18px;
  background: transparent;
  border: 0;
}

.workout-rpe-range::-moz-range-progress {
  height: 18px;
  background: transparent;
  border: 0;
}

.workout-rpe-range::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.36), 0 0 0 5px rgba(247, 107, 21, 0.2);
}

.workout-rpe-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px rgba(247, 107, 21, 0.24), 0 4px 14px rgba(0, 0, 0, 0.36);
}

.workout-rpe-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 6px rgba(247, 107, 21, 0.24), 0 4px 14px rgba(0, 0, 0, 0.36);
}

.history-rpe-field {
  max-width: 420px;
}

.routine-item-list {
  margin-top: 14px;
}

.routine-item-row {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: none;
}

.routine-item-row[draggable="true"] {
  cursor: grab;
}

.routine-item-row.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.routine-item-row.drag-over-before::before,
.routine-item-row.drag-over-after::after {
  position: absolute;
  right: 12px;
  left: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.routine-item-row.drag-over-before::before {
  top: -9px;
}

.routine-item-row.drag-over-after::after {
  bottom: -9px;
}

.workout-start-form,
.workout-set-form {
  display: grid;
  gap: 16px;
}

.workout-session,
.workout-rest,
.workout-complete {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.012)),
    radial-gradient(circle at 10% 0%, rgba(0, 144, 255, 0.1) 0%, transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(247, 107, 21, 0.09) 0%, transparent 30%),
    var(--glass-surface);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.workout-complete {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
}

.workout-session {
  position: relative;
}

.workout-rest {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.workout-rest-next {
  margin: -2px 0 0;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.35;
}

.workout-rest-history-preview {
  width: min(100%, 420px);
  text-align: left;
}

.workout-rest-history-preview .workout-history-preview {
  background: var(--panel-raised);
  box-shadow: var(--shadow);
}

.rest-pie {
  --rest-progress: 0deg;
  display: grid;
  place-items: center;
  width: min(62vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg var(--rest-progress), var(--panel-soft) var(--rest-progress) 360deg);
  box-shadow: inset 0 0 0 12px var(--panel), 0 0 44px rgba(247, 107, 21, 0.2), var(--shadow);
}

.rest-pie span {
  display: grid;
  place-items: center;
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 3rem;
  font-weight: 900;
}

.set-timer-panel {
  display: grid;
  gap: 12px;
  align-content: end;
}

.set-timer-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 12px;
  align-items: end;
}

.set-timer-input-row label {
  min-width: 0;
}

.set-timer-button {
  display: inline-grid;
  place-items: center;
  min-height: 58px;
  width: 58px;
  min-width: 58px;
  padding: 0;
}

.icon-timer {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.set-timer-display {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.set-timer-pie {
  width: min(46vw, 150px);
  box-shadow: inset 0 0 0 8px var(--panel), 0 10px 28px rgba(0, 0, 0, 0.32);
}

.set-timer-pie span {
  font-size: 1.75rem;
}

.workout-session-header {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.workout-progress-group {
  display: grid;
  gap: 2px;
}

.workout-session-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workout-session-menu {
  display: flex;
  position: relative;
  flex: 0 0 auto;
  align-items: center;
}

.workout-session-header h2 {
  margin: 4px 0 0;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 1.95rem;
}

.workout-exercise-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  height: 42px;
  min-height: 42px;
  width: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 10px;
}

.icon-menu {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-chevron {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-edit {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.workout-exercise-progress {
  --progress-segment-size: 100%;
  --progress-slant: 16deg;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 16px;
  margin: 0;
  border-radius: 0;
  background: var(--panel-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: skewX(calc(var(--progress-slant) * -1));
  transform-origin: left center;
}

.workout-exercise-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(var(--progress-segment-size) - 2px),
    rgba(7, 9, 16, 0.9) calc(var(--progress-segment-size) - 2px),
    rgba(7, 9, 16, 0.9) var(--progress-segment-size)
  );
  pointer-events: none;
}

.workout-exercise-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 100%);
  transition: width 180ms ease-out;
}

.workout-set-progress .workout-exercise-progress-fill {
  background: linear-gradient(90deg, var(--accent-dark) 0%, var(--accent) 100%);
}

.workout-progress {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.workout-hint,
.workout-complete-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.workout-complete-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
}

.workout-complete.is-revealed .workout-complete-content > * {
  animation: completion-block-in 520ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.workout-complete.is-revealed .workout-complete-content > :nth-child(1) {
  animation-delay: 0ms;
}

.workout-complete.is-revealed .workout-complete-content > :nth-child(2) {
  animation-delay: 110ms;
}

.workout-complete.is-revealed .workout-complete-content > :nth-child(3) {
  animation-delay: 220ms;
}

.workout-complete.is-revealed .workout-complete-content > :nth-child(4) {
  animation-delay: 330ms;
}

.workout-complete.is-revealed .workout-complete-content > :nth-child(5) {
  animation-delay: 440ms;
}

.workout-complete h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
}

.workout-complete-title {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 0.18em;
}

.completion-title-word {
  display: inline-block;
  transform-origin: center bottom;
}

.workout-complete.is-revealed .completion-title-word {
  animation: completion-title-stamp 680ms cubic-bezier(0.18, 1.05, 0.32, 1) both;
}

.workout-complete.is-revealed .completion-title-word-workout {
  animation-delay: 60ms;
}

.workout-complete.is-revealed .completion-title-word-complete {
  animation-delay: 180ms;
}

.completion-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.completion-stat {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    var(--glass-surface-strong);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.workout-complete.is-revealed .completion-stat {
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  animation: completion-stat-in 520ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
  animation-delay: var(--completion-delay, 0ms);
}

.completion-stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.completion-stat-value {
  display: inline-block;
  min-width: 0;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.completion-section {
  display: grid;
  gap: 12px;
}

.workout-complete-content .section-heading {
  margin-bottom: 0;
}

.workout-complete-content .completion-section {
  gap: 5px;
}

.completion-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.completion-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 850;
}

.completion-entry-list {
  display: grid;
  gap: 10px;
}

.completion-entry {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    var(--glass-surface);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.workout-complete.is-revealed .completion-entry {
  opacity: 0;
  transform: translateY(10px);
  animation: completion-card-in 480ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
  animation-delay: var(--completion-delay, 0ms);
}

.completion-entry-pr {
  border-color: rgba(247, 107, 21, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(247, 107, 21, 0.09);
}

.completion-entry-match {
  border-color: rgba(0, 144, 255, 0.3);
}

.completion-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.completion-entry-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.completion-entry-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
}

.completion-entry-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.completion-entry-badge {
  flex: 0 0 auto;
  min-height: 0;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.completion-entry-badge.is-pr {
  background: rgba(247, 107, 21, 0.16);
  color: #ffd2b0;
}

.completion-entry-badge.is-match {
  background: rgba(0, 144, 255, 0.16);
  color: #c9e7ff;
}

.completion-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.completion-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.completion-empty-state,
.workout-complete-coach-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.workout-complete-coach-note {
  padding-top: 2px;
  font-weight: 700;
}

.workout-complete.is-revealed .workout-complete-coach-note,
.workout-complete.is-revealed .form-actions {
  opacity: 0;
  transform: translateY(10px);
  animation: completion-block-in 520ms cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

.workout-complete.is-revealed .workout-complete-coach-note {
  animation-delay: 440ms;
}

.workout-complete.is-revealed .form-actions {
  animation-delay: 540ms;
}

@keyframes completion-block-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes completion-card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes completion-stat-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes completion-title-stamp {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(-8deg) translateY(8px);
    letter-spacing: 0.02em;
  }

  45% {
    opacity: 1;
    transform: scale(1.08) rotate(2deg) translateY(0);
  }

  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .workout-complete.is-revealed .workout-complete-content > *,
  .workout-complete.is-revealed .completion-title-word,
  .workout-complete.is-revealed .completion-stat,
  .workout-complete.is-revealed .completion-entry,
  .workout-complete.is-revealed .workout-complete-coach-note,
  .workout-complete.is-revealed .form-actions {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.workout-history-preview {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.workout-history-preview-header {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workout-history-preview-header h3 {
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
}

.workout-history-preview-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workout-history-preview-summary .history-set-pill {
  min-height: 24px;
  padding: 0 8px;
  font-size: 0.88rem;
  line-height: 1;
}

.workout-history-preview-summary .history-set-pill-preview {
  font-size: 0.88rem;
}

.workout-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 176px;
  padding: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018)),
    var(--glass-surface-strong);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 18px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.workout-session-menu .workout-menu-panel {
  display: grid;
  gap: 5px;
}

.workout-menu-item {
  width: 100%;
  min-height: 42px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  box-shadow: none;
  transform: none;
}

.workout-menu-item:hover {
  background: rgba(247, 107, 21, 0.14);
  box-shadow: none;
  transform: none;
}

.workout-menu-item.active {
  background: rgba(247, 107, 21, 0.2);
  color: var(--text);
}

.danger-text,
.danger-text:hover {
  color: var(--danger);
}

#workoutContinueButton {
  min-height: 122px;
  font-size: 1.15rem;
}

.workout-loading-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 8px;
  background: rgba(7, 9, 16, 0.74);
  backdrop-filter: blur(3px);
}

.workout-loading-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(100%, 380px);
  padding: 16px 18px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018)),
    var(--glass-surface-strong);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 24px 56px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.workout-loading-spinner {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 4px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: workout-spin 0.85s linear infinite;
}

.workout-loading-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.workout-loading-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
}

.workout-loading-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.35;
}

@keyframes workout-spin {
  to {
    transform: rotate(360deg);
  }
}

.workout-hint + .form-message {
  margin-top: 8px;
}

.workout-measure-fields {
  display: grid;
  gap: 12px;
}

.freeform-exercise-picker,
.freeform-exercise-form {
  display: grid;
  gap: 12px;
}

.freeform-exercise-picker {
  grid-column: 1 / -1;
}

.workout-weighted-fields,
.workout-bodyweight-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.workout-weighted-fields .weight-reported-as-toggle {
  grid-column: 1 / -1;
}

.workout-measure-fields input {
  min-height: 58px;
  font-size: 1.15rem;
}

.workout-set-log {
  display: grid;
  grid-template-columns: repeat(var(--workout-set-columns, 1), minmax(110px, 1fr));
  gap: 10px;
  margin-top: 16px;
  overflow-x: auto;
}

.workout-set-chip {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.92rem;
  text-align: left;
  box-shadow: none;
}

button.workout-set-chip:hover {
  background: #162134;
  box-shadow: none;
  transform: none;
}

button.workout-set-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.workout-set-chip span:first-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

.workout-set-chip span:last-child {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.workout-notes-chip span:last-child {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 12, 0.72);
  overflow: auto;
  overscroll-behavior: contain;
}

.modal-card {
  width: min(100%, 460px);
  padding: 18px;
  max-height: calc(100dvh - 36px);
}

.workout-set-edit-modal,
.freeform-exercise-modal,
.freeform-workout-rest-modal,
.history-exercise-edit-modal {
  width: min(100%, 720px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
}

.workout-history-modal {
  width: min(100%, 920px);
  max-height: min(calc(100dvh - 36px), 920px);
  overflow: auto;
}

.exercise-progress-modal {
  width: min(100%, 920px);
  max-height: min(calc(100dvh - 36px), 920px);
  overflow: auto;
}

.workout-history-scorecard-modal {
  width: min(100%, 920px);
  max-height: min(calc(100dvh - 36px), 920px);
  overflow: auto;
}

.exercise-progress-description {
  margin: 8px 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.exercise-progress-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.exercise-progress-chart {
  position: relative;
}

.exercise-progress-chart-frame {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.exercise-progress-chart-svg {
  display: block;
  width: 100%;
  max-width: 100%;
}

.progress-chart-grid {
  stroke: #263247;
  stroke-width: 1;
}

.progress-chart-axis {
  stroke: #74839a;
  stroke-width: 1.5;
}

.progress-chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress-chart-point {
  fill: var(--primary);
  stroke: var(--panel-soft);
  stroke-width: 3;
  cursor: pointer;
}

.progress-chart-point:focus,
.progress-chart-point:hover {
  fill: var(--accent);
  stroke: rgba(247, 107, 21, 0.35);
  stroke-width: 5;
  outline: none;
}

.progress-chart-y-label,
.progress-chart-x-label,
.progress-chart-axis-title {
  fill: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 750;
}

.progress-chart-axis-title {
  fill: var(--text);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.exercise-progress-point-detail {
  position: absolute;
  z-index: 2;
  width: min(280px, calc(100% - 16px));
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
  transform: translate(-50%, -100%);
}

.exercise-progress-point-detail.below {
  transform: translateX(-50%);
}

.exercise-progress-point-detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.exercise-progress-point-detail-header span,
.exercise-progress-point-detail-header strong {
  display: block;
}

.exercise-progress-point-detail-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.exercise-progress-point-detail-header strong {
  margin-top: 2px;
  font-size: 1rem;
}

.exercise-progress-point-detail-header button {
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
}

.exercise-progress-point-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.exercise-progress-point-detail th,
.exercise-progress-point-detail td {
  padding: 7px 6px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.exercise-progress-point-detail th {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.exercise-progress-point-detail th:first-child,
.exercise-progress-point-detail td:first-child {
  text-align: left;
}

.exercise-progress-point-detail td span {
  color: var(--muted);
  font-size: 0.72rem;
}

.exercise-progress-details {
  margin-top: 18px;
}

.exercise-progress-details h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.exercise-progress-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.exercise-progress-table th,
.exercise-progress-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.exercise-progress-table th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.exercise-progress-table th:first-child,
.exercise-progress-table td:first-child {
  width: 28%;
  white-space: nowrap;
}

.exercise-progress-table th:nth-child(2),
.exercise-progress-table td:nth-child(2) {
  overflow-wrap: anywhere;
}

.exercise-progress-table th:last-child,
.exercise-progress-table td:last-child {
  width: 30%;
  text-align: right;
  white-space: nowrap;
}

.exercise-progress-table tbody tr:last-child td {
  border-bottom: 0;
}

#historyExerciseEditModal {
  z-index: 50;
}

#exerciseProgressModal {
  z-index: 60;
}

.workout-history-modal-header {
  margin-bottom: 0;
  align-items: start;
}

.icon-close {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.workout-set-edit-form {
  display: grid;
  gap: 14px;
}

.freeform-workout-rest-form {
  display: grid;
  gap: 14px;
}

.freeform-workout-rest-modal {
  width: min(100%, 460px);
}

.freeform-workout-rest-none {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.freeform-workout-rest-none input {
  width: auto;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
}

.history-notes-field {
  display: grid;
  gap: 6px;
}

.history-notes-field textarea {
  min-height: 76px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
}

.exercise-main {
  min-width: 0;
}

.exercise-main h3 {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.empty-state {
  margin: 18px 0;
  color: var(--muted);
  font-weight: 700;
}

.history-calendar-cell,
.history-year-month,
.workout-history-text-summary-body,
.workout-day-choice,
.history-exercise-card,
.history-set-row,
.routine-item-row,
.routine-card,
.workout-history-card,
.exercise-row,
.workout-history-preview,
.workout-set-chip,
.exercise-progress-chart-frame,
.exercise-progress-point-detail {
  border-color: var(--glass-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.02)),
    var(--glass-surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.085), inset 0 -1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.history-calendar-cell.has-workouts {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.014)),
    linear-gradient(180deg, rgba(247, 107, 21, 0.24) 0%, rgba(21, 31, 46, 0.72) 100%);
}

.history-calendar-cell.has-workouts:hover:not(:disabled) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.018)),
    linear-gradient(180deg, rgba(247, 107, 21, 0.3) 0%, rgba(21, 31, 46, 0.78) 100%);
}

@media (min-width: 680px) {
  .auth-view {
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.75fr);
    align-items: center;
  }

  .exercise-form {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.35fr) minmax(180px, 0.35fr) auto;
    align-items: end;
  }

  .form-actions {
    grid-auto-flow: column;
    align-items: end;
  }

  .exercise-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .routine-layout {
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
    align-items: start;
    gap: 14px;
  }

  .routine-form {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.35fr) auto;
    align-items: end;
  }

  .routine-item-form {
    grid-template-columns: minmax(0, 1fr) minmax(96px, 0.25fr) minmax(96px, 0.25fr) auto;
    align-items: end;
  }

  .routine-card,
  .routine-item-row,
  .workout-history-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .history-set-row {
    grid-template-columns: 70px repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .workout-start-form {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr) auto;
    align-items: end;
  }

  .workout-measure-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .freeform-exercise-picker {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .row-actions {
    grid-auto-flow: column;
  }
}

@media (max-width: 520px) {
  .history-exercise-swap-field {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 679px) {
  .exercise-variation-row,
  .workout-weighted-fields,
  .workout-bodyweight-fields {
    grid-template-columns: 1fr;
  }
}
