/* ============================================
   PALESTRA TRACKER — PWA Design System
   Mobile-first, CSP-friendly, accessible shell
   ============================================ */

:root {
  --bg: #0a0a0f;
  --bg-s: #101018;
  --bg-card: #14142a;
  --bg-card-h: #1a1a34;
  --bg-input: #18182e;
  --border: #28284a;
  --border-lt: #36365a;
  --accent: #7c5cfc;
  --accent-lt: #9b82ff;
  --accent-dk: #5a3fd4;
  --accent-g: linear-gradient(135deg, #7c5cfc, #5c8cfc);
  --success: #00d4aa;
  --success-dk: #00a888;
  --warn: #ffb74d;
  --danger: #ff5252;
  --t1: #eaeaf4;
  --t2: #9090b0;
  --t3: #606080;
  --font: "Avenir Next", "Segoe UI Variable", "SF Pro Display", "Segoe UI", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --nav-h: 68px;
  --hdr-h: 56px;
  --tr: 0.22s ease;
}

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

html {
  font-size: 16px;
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top right, rgba(124, 92, 252, 0.18), transparent 24rem),
    radial-gradient(circle at top left, rgba(92, 140, 252, 0.12), transparent 20rem),
    var(--bg);
  color: var(--t1);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

main {
  position: relative;
}

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

button {
  border: none;
}

a {
  color: var(--accent-lt);
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid rgba(155, 130, 255, 0.72);
  outline-offset: 2px;
}

.focus-ring:focus-visible {
  outline: 3px solid rgba(155, 130, 255, 0.72);
  outline-offset: 2px;
}

.focus-ring-inset:focus-visible {
  outline: 3px solid rgba(155, 130, 255, 0.72);
  outline-offset: -1px;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--hdr-h);
  padding: 0 16px;
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-header h1 span {
  color: var(--accent-lt);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(155, 130, 255, 0.22);
  border-radius: 999px;
  background: rgba(20, 20, 42, 0.92);
  color: var(--t1);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color var(--tr), transform var(--tr), background var(--tr);
}

.header-chip[data-state="logged-in"] {
  border-color: rgba(0, 212, 170, 0.28);
  color: #d9fff3;
}

.header-chip.busy {
  border-color: rgba(255, 183, 77, 0.35);
}

.header-chip:active {
  transform: scale(0.97);
}

.app-notices {
  position: sticky;
  top: var(--hdr-h);
  z-index: 95;
  display: grid;
  gap: 10px;
  padding: 12px 16px 0;
}

.app-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: rgba(16, 16, 24, 0.92);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.app-banner-update {
  border-color: rgba(124, 92, 252, 0.34);
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.18), rgba(92, 140, 252, 0.14));
}

.app-banner-offline {
  border-color: rgba(255, 183, 77, 0.3);
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.18), rgba(20, 20, 42, 0.92));
}

.app-banner-copy {
  min-width: 0;
}

.app-banner-title {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  height: var(--nav-h);
  background: rgba(10, 10, 15, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  color: var(--t3);
  cursor: pointer;
  transition: color var(--tr), transform var(--tr);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item span {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.05;
  white-space: nowrap;
}

.nav-item.active {
  color: var(--accent-lt);
}

.nav-item:active {
  transform: scale(0.92);
}

.page {
  display: none;
  padding: 18px 16px calc(var(--nav-h) + 24px);
  animation: fadeUp 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.card,
.chart-wrap,
.metric-card,
.history-session,
.checkin-row,
.review-card,
.auth-card,
.status-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.card {
  padding: 16px;
  margin-bottom: 12px;
  transition: background var(--tr), border-color var(--tr);
}

.card:hover,
.card:focus-within,
.auth-card:hover,
.auth-card:focus-within,
.status-panel:hover,
.status-panel:focus-within {
  background: var(--bg-card-h);
  border-color: var(--border-lt);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform var(--tr), opacity var(--tr), box-shadow var(--tr), border-color var(--tr), background var(--tr);
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--accent-g);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(124, 92, 252, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--t1);
  border: 1px solid var(--border);
}

.btn-success {
  background: var(--success);
  color: #04100d;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: var(--r-sm);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--r-md);
}

.btn-icon.sync-ready {
  border-color: var(--accent);
  color: var(--accent-lt);
}

.btn-icon.sync-busy {
  opacity: 0.75;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-row,
.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  color: var(--t1);
  font-size: 1rem;
  transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: var(--t3);
}

select {
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239090b0'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.checkin-scale-row {
  align-items: start;
}

.checkin-scale-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.checkin-scale-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.checkin-scale-current {
  color: var(--accent-lt);
  font-size: 0.76rem;
  font-weight: 700;
}

.checkin-scale-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--t2);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0;
}

.checkin-scale-clear:hover,
.checkin-scale-clear:focus-visible {
  color: var(--t1);
}

.checkin-scale-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.checkin-scale-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.checkin-scale-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.checkin-scale-pill {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(18, 20, 31, 0.92);
  color: var(--t2);
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform var(--tr), border-color var(--tr), background var(--tr), color var(--tr), box-shadow var(--tr);
}

.checkin-scale-option:hover .checkin-scale-pill,
.checkin-scale-input:focus-visible + .checkin-scale-pill {
  border-color: rgba(124, 92, 252, 0.38);
  color: var(--t1);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.14);
}

.checkin-scale-input:checked + .checkin-scale-pill {
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.9), rgba(92, 140, 252, 0.88));
  border-color: transparent;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(92, 104, 252, 0.22);
}

.checkin-scale-endpoints {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--t3);
  font-size: 0.76rem;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 14px;
  color: var(--t2);
  font-size: 0.88rem;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.account-summary {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.account-avatar-shell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border-lt);
  object-fit: cover;
  background: var(--bg-input);
}

.account-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.28), rgba(92, 140, 252, 0.18));
  color: var(--t1);
  font-weight: 800;
  font-size: 1.2rem;
}

.account-copy {
  min-width: 0;
}

.account-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--t1);
}

.account-email,
.account-provider {
  margin-top: 4px;
  color: var(--t2);
  font-size: 0.88rem;
  word-break: break-word;
}

.account-provider {
  color: var(--accent-lt);
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.page-title-row,
.program-summary-head,
.program-day-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-title-row {
  margin-bottom: 12px;
}

.page-subtitle {
  margin-top: 6px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  color: var(--accent-lt);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title-sm {
  font-size: 1rem;
}

.program-summary-head {
  margin-bottom: 8px;
}

.program-hero,
.program-empty,
.wizard-highlight,
.editor-panel-card,
.program-builder-summary {
  position: relative;
  overflow: hidden;
}

.program-hero::before,
.program-empty::before,
.wizard-highlight::before,
.editor-panel-card::before,
.program-builder-summary::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(124, 92, 252, 0.16), transparent 14rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.02), transparent 60%);
  pointer-events: none;
}

.program-summary-copy,
.program-builder-hero > div,
.wizard-hero > div {
  position: relative;
  z-index: 1;
}

.program-day-editor {
  margin-bottom: 0;
}

.program-day-head {
  margin-bottom: 12px;
}

.program-day-title {
  font-size: 0.95rem;
}

.program-day-eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  font-size: 0.74rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.program-exercises {
  display: grid;
  gap: 12px;
}

.program-exercise-row {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.02);
}

.form-row.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-group.full {
  grid-column: 1 / -1;
}

.actions-end {
  align-self: end;
}

.program-summary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.program-summary-name {
  margin-bottom: 4px;
}

.program-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.inline-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(124, 92, 252, 0.12);
  border: 1px solid rgba(124, 92, 252, 0.2);
  color: var(--accent-lt);
  font-size: 0.76rem;
  font-weight: 700;
}

.program-empty-points,
.wizard-panel-note {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.section-divider {
  height: 1px;
  margin: 8px 0 18px;
  background: rgba(255, 255, 255, 0.08);
}

.session-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: transform var(--tr), border-color var(--tr), background var(--tr), box-shadow var(--tr);
  min-height: 168px;
}

.session-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-h);
  box-shadow: 0 18px 42px rgba(7, 8, 20, 0.42);
}

.session-card:active {
  transform: scale(0.95);
}

.session-card-top,
.session-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.session-card-copy {
  display: grid;
  gap: 8px;
}

.s-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(124, 92, 252, 0.14);
  color: var(--accent-lt);
  font-size: 0.8rem;
  font-weight: 800;
}

.session-card .s-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.session-card .s-name {
  font-size: 1rem;
  font-weight: 800;
}

.session-card .s-desc {
  font-size: 0.8rem;
  color: var(--t2);
}

.session-card .s-meta {
  font-size: 0.76rem;
  color: var(--t3);
  font-weight: 700;
}

.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--tr), box-shadow var(--tr), transform var(--tr), background var(--tr);
}

.exercise-card.done {
  border-color: var(--success-dk);
  opacity: 0.7;
}

.exercise-card.current {
  border-color: var(--accent);
}

.ex-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
}

.ex-header:active {
  background: var(--bg-card-h);
}

.ex-info h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.ex-meta {
  font-size: 0.75rem;
  color: var(--t2);
  line-height: 1.4;
}

.ex-progress {
  min-width: 38px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-s);
  color: var(--t2);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.ex-progress.complete {
  color: var(--success);
  background: rgba(0, 212, 170, 0.1);
}

.ex-progress.bump {
  animation: progressBump 0.48s ease;
}

@keyframes progressBump {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
    background: rgba(124, 92, 252, 0.16);
    color: var(--t1);
  }
  100% {
    transform: none;
  }
}

.ex-sets {
  display: none;
  padding: 0 16px 14px;
}

.exercise-card.open .ex-sets,
.exercise-card.open .ex-last-time {
  display: block;
}

.set-row {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 0;
}

.set-main-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 70px 64px 44px;
  grid-template-areas:
    "label load reps rir done"
    ". note note note done";
  gap: 8px;
  align-items: center;
}

.set-label {
  grid-area: label;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--t2);
  text-align: center;
}

.set-main-row .input-load {
  grid-area: load;
}

.set-main-row .input-reps {
  grid-area: reps;
}

.set-main-row .input-rir {
  grid-area: rir;
}

.set-row input,
.set-row select {
  padding: 10px 8px;
  font-size: 0.9rem;
  border-radius: var(--r-sm);
  min-width: 0;
}

.btn-set-note {
  grid-area: note;
  justify-self: end;
  min-height: 30px;
  padding: 6px 12px;
  font-size: 0.72rem;
}

.set-row.has-note .btn-set-note {
  border-color: rgba(124, 92, 252, 0.3);
  background: rgba(124, 92, 252, 0.14);
}

.set-note-wrap {
  display: block;
}

.set-note-wrap .input-set-note {
  width: 100%;
}

.set-note-preview {
  font-size: 0.78rem;
  color: var(--t2);
  line-height: 1.5;
  padding-left: calc(42px + 8px);
}

.btn-set-done {
  grid-area: done;
  align-self: start;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  background: none;
  color: var(--t3);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
}

.btn-set-done:active {
  transform: scale(0.9);
}

.set-row.saved .btn-set-done {
  background: var(--success);
  border-color: var(--success);
  color: #04100d;
}

.set-row.just-saved {
  animation: setSavedFlash 0.76s ease;
}

.set-row.just-saved .btn-set-done {
  animation: setDonePop 0.46s ease;
}

@keyframes setSavedFlash {
  0% {
    background: rgba(0, 212, 170, 0);
    transform: translateY(0);
  }
  35% {
    background: rgba(0, 212, 170, 0.08);
    transform: translateY(-1px);
  }
  100% {
    background: rgba(0, 212, 170, 0);
    transform: none;
  }
}

@keyframes setDonePop {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 0 rgba(0, 212, 170, 0);
  }
  55% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(0, 212, 170, 0.14);
  }
  100% {
    transform: none;
    box-shadow: 0 0 0 rgba(0, 212, 170, 0);
  }
}

.set-row.saved input,
.set-row.saved select {
  opacity: 0.5;
  pointer-events: none;
}

.ex-last-time {
  display: none;
  font-size: 0.73rem;
  color: var(--accent-lt);
  padding: 0 16px 8px;
  line-height: 1.5;
}

.ex-support-copy {
  display: block;
}

.ex-support-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.exercise-demo-btn {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 0.72rem;
}

.exercise-card.just-completed {
  animation: cardCompleteGlow 0.88s ease;
}

@keyframes cardCompleteGlow {
  0% {
    transform: translateY(0);
    box-shadow: 0 0 0 rgba(0, 212, 170, 0);
  }
  40% {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 212, 170, 0.12);
    border-color: rgba(0, 212, 170, 0.55);
  }
  100% {
    transform: none;
    box-shadow: 0 0 0 rgba(0, 212, 170, 0);
  }
}

#wo-finish.finish-ready-anim {
  animation: finishReadyPulse 0.9s ease;
}

@keyframes finishReadyPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(0, 212, 170, 0);
  }
  45% {
    transform: scale(1.02);
    box-shadow: 0 10px 28px rgba(0, 212, 170, 0.16);
  }
  100% {
    transform: none;
    box-shadow: 0 0 0 rgba(0, 212, 170, 0);
  }
}

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

.btn-back {
  background: none;
  color: var(--accent-lt);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 0;
}

.workout-duration {
  color: var(--t2);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.workout-session-copy {
  flex: 1;
  display: grid;
  gap: 4px;
  text-align: center;
}

.workout-program-name {
  font-size: 0.72rem;
  color: var(--accent-lt);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workout-session-label {
  font-size: 1.1rem;
  font-weight: 800;
}

.action-slot {
  width: 100%;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.metric-card {
  padding: 16px 12px;
  text-align: center;
}

.metric-value {
  display: block;
  margin-bottom: 2px;
  color: var(--accent-lt);
  font-size: 1.6rem;
  font-weight: 800;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-wrap {
  padding: 16px;
  margin-bottom: 16px;
}

.analysis-period-wrap {
  border: 1px solid rgba(255, 183, 77, 0.18);
  background:
    radial-gradient(circle at top right, rgba(255, 183, 77, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(124, 92, 252, 0.12), rgba(92, 140, 252, 0.08));
}

.analysis-period-wrap .chart-wrap-head {
  margin-bottom: 8px;
}

.analysis-period-wrap .period-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  overflow: visible;
  padding-bottom: 0;
}

.analysis-period-wrap .period-nav-btn {
  min-width: 0;
  width: 100%;
}

.chart-wrap-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row.compact.chart-controls-row {
  margin-bottom: 8px;
  grid-template-columns: minmax(0, 1fr);
}

.chart-controls-row .form-group {
  margin-bottom: 0;
}

.chart-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.period-nav {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.period-nav-btn {
  flex: 0 0 auto;
  min-width: 144px;
  align-items: flex-start;
  flex-direction: column;
  text-align: left;
}

.period-nav-btn.is-active {
  background: rgba(124, 92, 252, 0.16);
  border-color: rgba(124, 92, 252, 0.38);
  box-shadow: 0 10px 24px rgba(124, 92, 252, 0.14);
}

.period-nav-btn-copy {
  color: var(--t1);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: capitalize;
}

.period-nav-btn-meta {
  color: var(--t2);
  font-size: 0.72rem;
  font-weight: 600;
}

.week-summary-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.week-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: rgba(20, 20, 42, 0.72);
  overflow: hidden;
}

.week-summary-toggle {
  width: 100%;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.week-summary-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.week-summary-kicker {
  color: var(--t2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.week-summary-title {
  color: var(--t1);
  font-size: 1rem;
  font-weight: 800;
  text-transform: capitalize;
}

.week-summary-pills,
.day-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.week-summary-chevron {
  min-width: 24px;
  color: var(--accent-lt);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.week-summary-panel {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(124, 92, 252, 0.18);
}

.week-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.week-stat-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(10, 10, 15, 0.32);
  border: 1px solid var(--border);
}

.week-stat-label {
  color: var(--t2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.week-stat-value {
  color: var(--t1);
  font-size: 1rem;
  font-weight: 800;
}

.week-stat-sub {
  color: var(--t2);
  font-size: 0.74rem;
}

.day-summary-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.day-summary-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  background: rgba(10, 10, 15, 0.32);
  border: 1px solid rgba(124, 92, 252, 0.14);
}

.day-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.day-summary-title {
  color: var(--t1);
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: capitalize;
}

.day-summary-sub {
  color: var(--t2);
  font-size: 0.78rem;
  margin-top: 4px;
}

.calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calendar-nav-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 1rem;
}

.calendar-month-label {
  min-width: 128px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--t1);
  text-transform: capitalize;
}

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

.calendar-grid > .empty-state {
  grid-column: 1 / -1;
}

.calendar-weekdays {
  margin-top: 14px;
  margin-bottom: 8px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-day {
  min-height: 64px;
  padding: 10px 6px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

button.calendar-day {
  cursor: pointer;
  transition: transform var(--tr), border-color var(--tr), background var(--tr);
}

button.calendar-day:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 92, 252, 0.3);
}

.calendar-day.has-workout {
  background: rgba(124, 92, 252, 0.12);
  border-color: rgba(124, 92, 252, 0.28);
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(255, 183, 77, 0.5);
}

.calendar-day.is-placeholder {
  min-height: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.calendar-day-number {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--t1);
}

.calendar-day-meta {
  font-size: 0.68rem;
  color: var(--t3);
  line-height: 1.2;
}

.pr-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.pr-card {
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.pr-type {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 183, 77, 0.14);
  color: #ffd48f;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr-exercise {
  display: block;
  margin-bottom: 4px;
  font-size: 0.96rem;
  font-weight: 700;
}

.pr-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--t1);
}

.pr-meta {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--t2);
  line-height: 1.45;
}

.achievement-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.achievement-card {
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(0, 212, 170, 0.14);
  background:
    linear-gradient(180deg, rgba(0, 212, 170, 0.06), rgba(255, 255, 255, 0.02));
}

.achievement-type {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 212, 170, 0.12);
  color: #9cf2df;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.achievement-title {
  display: block;
  margin-bottom: 5px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--t1);
}

.achievement-detail {
  font-size: 0.8rem;
  color: var(--t2);
  line-height: 1.45;
}

.achievement-meta {
  margin-top: 7px;
  font-size: 0.74rem;
  color: var(--t2);
  line-height: 1.45;
}

.exercise-demo-frame {
  margin: 14px 0 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top, rgba(255, 183, 77, 0.14), transparent 58%),
    rgba(255, 255, 255, 0.03);
}

.exercise-demo-modal-card {
  text-align: left;
}

.exercise-demo-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: var(--r-md);
}

.exercise-demo-meta {
  margin-bottom: 10px;
}

.exercise-demo-cues {
  margin: 0;
  padding-left: 18px;
  color: var(--t2);
  font-size: 0.83rem;
  line-height: 1.55;
}

.muscle-volume-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.muscle-volume-card {
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.muscle-volume-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.muscle-volume-head strong {
  font-size: 0.95rem;
  color: var(--t1);
}

.muscle-volume-value {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-lt);
}

.muscle-volume-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.muscle-volume-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 183, 77, 0.92), rgba(255, 140, 92, 0.88));
}

.muscle-volume-meta {
  margin-top: 7px;
  font-size: 0.74rem;
  color: var(--t2);
  line-height: 1.45;
}

.muscle-heatmap-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.muscle-heatmap-card {
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
}

.muscle-heatmap-card h4 {
  margin-bottom: 10px;
  font-size: 0.86rem;
  color: var(--t2);
}

.muscle-figure {
  position: relative;
  min-height: 260px;
  border-radius: var(--r-md);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 36%),
    rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.muscle-figure::before {
  content: '';
  position: absolute;
  inset: 18px 26%;
  border-radius: 999px 999px 36px 36px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  opacity: 0.9;
}

.muscle-figure::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.muscle-zone {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff7e7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 183, 77, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.muscle-heatmap-legend {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.muscle-heatmap-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: var(--t2);
}

.muscle-heatmap-legend-item strong {
  color: var(--t1);
}

.muscle-heatmap-legend-item span:last-child {
  color: var(--accent-lt);
  font-weight: 800;
}

.chart-wrap h3 {
  margin-bottom: 10px;
  color: var(--t2);
  font-size: 0.85rem;
  font-weight: 700;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 160px !important;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.data-table th {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--t2);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(40, 40, 74, 0.4);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.table-main {
  font-weight: 700;
}

.table-sub {
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--t3);
  white-space: nowrap;
}

.delta-pos {
  color: var(--success);
}

.delta-neg {
  color: var(--danger);
}

.archive-shell {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding: 18px;
  border: 1px solid rgba(124, 92, 252, 0.18);
  border-radius: calc(var(--r-lg) + 2px);
  background:
    radial-gradient(circle at top right, rgba(255, 183, 77, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(24, 26, 54, 0.96), rgba(13, 15, 30, 0.98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
}

.archive-shell-compact {
  padding: 16px;
}

.archive-overview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.archive-overview-copy {
  min-width: 0;
}

.archive-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 183, 77, 0.22);
  background: rgba(255, 183, 77, 0.1);
  color: #ffd9a1;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.archive-title {
  display: block;
  margin-top: 10px;
  color: var(--t1);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: capitalize;
}

.archive-sub {
  margin: 8px 0 0;
  color: var(--t2);
  font-size: 0.84rem;
  line-height: 1.55;
}

.archive-list,
.history-month-list {
  display: grid;
  gap: 12px;
}

.archive-list-checkins {
  gap: 10px;
}

.archive-load-more {
  margin-top: 2px;
}

.history-day {
  margin-bottom: 0;
  padding: 16px;
  border: 1px solid rgba(124, 92, 252, 0.16);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(30, 33, 70, 0.38), rgba(17, 19, 38, 0.3)),
    rgba(12, 13, 24, 0.86);
}

.history-day.history-day-focus {
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 2px rgba(124, 92, 252, 0.2), 0 16px 36px rgba(0, 0, 0, 0.18);
  background:
    linear-gradient(180deg, rgba(124, 92, 252, 0.14), rgba(17, 19, 38, 0.34)),
    rgba(12, 13, 24, 0.9);
}

.history-date {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 12px;
}

.history-date-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-date-main {
  color: var(--t1);
  font-size: 0.96rem;
  font-weight: 800;
  text-transform: capitalize;
}

.history-date-sub {
  color: var(--t3);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.history-date-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.history-session {
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r-md);
  background: rgba(8, 9, 18, 0.42);
}

.history-session:last-child {
  margin-bottom: 0;
}

.history-session-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--t1);
  margin-bottom: 8px;
}

.history-session-meta {
  color: var(--t2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-set {
  font-size: 0.8rem;
  color: var(--t2);
  padding: 12px 0 0;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.history-set:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.checkin-row {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(124, 92, 252, 0.16);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(34, 38, 79, 0.36), rgba(18, 20, 40, 0.28)),
    rgba(10, 11, 22, 0.88);
}

.checkin-row .ci-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ci-date-main {
  color: var(--t1);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: capitalize;
}

.ci-date-sub {
  color: var(--t3);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.checkin-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkin-row .ci-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.77rem;
  color: var(--t2);
}

.checkin-row .ci-item strong {
  color: var(--t1);
}

.ci-note-block {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 183, 77, 0.14);
  background: rgba(255, 183, 77, 0.06);
  color: var(--t2);
  font-size: 0.8rem;
  line-height: 1.5;
}

.checkin-row-top,
.history-set-top {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.checkin-copy,
.history-set-copy {
  min-width: 0;
  flex: 1;
}

.checkin-actions,
.history-actions,
.history-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-linkish {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(124, 92, 252, 0.2);
  background: rgba(124, 92, 252, 0.1);
  color: var(--accent-lt);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--tr), color var(--tr), background var(--tr), transform var(--tr);
}

.btn-linkish:active {
  transform: scale(0.97);
}

.btn-linkish:hover,
.btn-linkish:focus-visible {
  border-color: var(--accent);
  color: #f2ecff;
  background: rgba(124, 92, 252, 0.18);
}

.btn-linkish.btn-danger-soft {
  border-color: rgba(255, 82, 82, 0.24);
  background: rgba(255, 82, 82, 0.08);
  color: #ff9b9b;
}

.btn-linkish.btn-danger-soft:hover,
.btn-linkish.btn-danger-soft:focus-visible {
  border-color: var(--danger);
  color: #ffd0d0;
  background: rgba(255, 82, 82, 0.18);
}

.history-set-main {
  color: var(--t1);
  line-height: 1.55;
  font-weight: 600;
}

.history-set-notes {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--t2);
  font-size: 0.78rem;
  line-height: 1.45;
}

.history-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.history-edit-grid .form-group {
  margin-bottom: 0;
}

.history-edit-grid .form-group.full {
  grid-column: 1 / -1;
}

.timer-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-g);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(124, 92, 252, 0.4);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--tr), box-shadow var(--tr);
}

.timer-fab:active {
  transform: scale(0.9);
}

.timer-fab.running {
  animation: timerPulse 1.5s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% {
    box-shadow: 0 4px 24px rgba(124, 92, 252, 0.4);
  }
  50% {
    box-shadow: 0 4px 36px rgba(124, 92, 252, 0.7);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: min(420px, 100%);
  padding: 28px 24px;
  text-align: center;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  animation: scaleUp 0.25s ease;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.modal-lg,
.modal-xl {
  width: min(860px, 100%);
  max-height: min(90vh, 920px);
  overflow: auto;
  text-align: left;
}

.modal-xl {
  width: min(1040px, 100%);
}

@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.modal-desc {
  margin-bottom: 6px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.wizard-modal,
.program-builder-modal {
  background:
    linear-gradient(180deg, rgba(23, 24, 49, 0.98), rgba(15, 16, 32, 0.98)),
    var(--bg-s);
}

.wizard-shell,
.program-builder-shell {
  display: grid;
  gap: 20px;
}

.wizard-hero,
.program-builder-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.wizard-title,
.program-builder-title {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.wizard-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--t2);
  text-align: left;
  cursor: pointer;
}

.wizard-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  font-weight: 800;
}

.wizard-step-copy {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wizard-step.is-active,
.wizard-step.is-complete {
  border-color: rgba(124, 92, 252, 0.45);
  color: var(--t1);
  background: rgba(124, 92, 252, 0.12);
}

.wizard-step.is-active .wizard-step-index,
.wizard-step.is-complete .wizard-step-index {
  background: var(--accent-g);
  color: #fff;
}

.wizard-progress-copy {
  min-height: 20px;
}

.wizard-panel {
  min-height: 260px;
}

.wizard-highlight {
  padding: 18px;
}

.wizard-highlight-soft {
  background: rgba(255, 255, 255, 0.03);
}

.wizard-highlight-title {
  margin-bottom: 8px;
  font-size: 1.08rem;
  font-weight: 800;
}

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

.template-choice-card {
  position: relative;
  padding: 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: left;
  cursor: pointer;
  transition: transform var(--tr), border-color var(--tr), background var(--tr), box-shadow var(--tr);
}

.template-choice-card:hover,
.template-choice-card:focus-visible {
  border-color: var(--accent);
  background: var(--bg-card-h);
}

.template-choice-card.is-selected {
  border-color: rgba(124, 92, 252, 0.6);
  box-shadow: 0 16px 36px rgba(9, 11, 24, 0.38);
}

.template-choice-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.template-choice-title {
  font-size: 1rem;
  font-weight: 800;
}

.template-choice-meta,
.template-choice-desc {
  font-size: 0.8rem;
  color: var(--t2);
  line-height: 1.45;
}

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

.program-builder-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.program-builder-sidebar {
  display: grid;
  gap: 14px;
  align-self: stretch;
}

.program-builder-summary {
  padding: 18px 16px;
}

.program-builder-nav {
  display: grid;
  gap: 8px;
}

.editor-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--t1);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr), transform var(--tr);
}

.editor-nav-btn:hover,
.editor-nav-btn:focus-visible {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.08);
}

.editor-nav-btn.is-active {
  border-color: rgba(124, 92, 252, 0.55);
  background: rgba(124, 92, 252, 0.12);
}

.editor-nav-btn-title {
  font-size: 0.94rem;
  font-weight: 800;
}

.editor-nav-btn-meta {
  font-size: 0.76rem;
  color: var(--t2);
}

.program-builder-stage,
.editor-section {
  min-width: 0;
}

.editor-panel-card {
  padding: 18px;
}

.editor-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.editor-day-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-day-list-card,
.editor-day-stage-card {
  min-width: 0;
}

.editor-day-stage-card {
  display: grid;
  gap: 12px;
}

.editor-day-list {
  display: grid;
  gap: 10px;
}

.editor-day-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--t1);
  text-align: left;
  transition: border-color var(--tr), background var(--tr), transform var(--tr);
}

.editor-day-card:hover,
.editor-day-card:focus-visible {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.08);
}

.editor-day-card.is-active {
  border-color: rgba(124, 92, 252, 0.55);
  background: rgba(124, 92, 252, 0.12);
}

.editor-day-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-day-card-index {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--t3);
}

.editor-day-card-title {
  font-size: 0.94rem;
  font-weight: 800;
}

.editor-day-card-meta {
  font-size: 0.78rem;
  color: var(--t2);
  line-height: 1.45;
}

.program-builder-actions {
  justify-content: space-between;
  align-items: center;
}

.editor-section:not(.hidden),
.wizard-panel:not(.hidden),
.section-enter {
  animation: softSectionIn 0.28s ease;
}

@keyframes softSectionIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.timer-display {
  font-size: 4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--t1);
  margin: 24px 0;
  letter-spacing: -0.02em;
}

.timer-display.done-anim {
  animation: timerDone 0.5s ease;
}

@keyframes timerDone {
  0%, 100% {
    color: var(--t1);
  }
  50% {
    color: var(--success);
    transform: scale(1.08);
  }
}

.timer-presets {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.timer-preset {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: none;
  color: var(--t1);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--tr);
}

.timer-preset:active {
  transform: scale(0.94);
}

.timer-preset.active {
  border-color: var(--accent);
  background: rgba(124, 92, 252, 0.15);
  color: var(--accent-lt);
}

.toast-container {
  position: fixed;
  top: calc(var(--hdr-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  animation: toastIn 0.3s ease forwards;
}

.toast.success {
  border-color: var(--success-dk);
  color: var(--success);
}

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

.toast.hiding {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section h3 {
  margin-bottom: 10px;
  color: var(--t2);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.settings-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), transform var(--tr);
}

.settings-item:hover {
  background: var(--bg-card-h);
  border-color: var(--border-lt);
}

.settings-item:active {
  transform: scale(0.99);
}

.settings-item-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settings-item-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.settings-item-sub {
  color: var(--t2);
  font-size: 0.78rem;
  line-height: 1.4;
}

.s-arrow {
  flex: none;
  color: var(--t3);
  font-size: 1rem;
}

.status-panel,
.auth-card {
  padding: 16px;
  margin-bottom: 12px;
}

.status-copy {
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 6px;
}

.subsection-title {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-provider-btn {
  background: rgba(20, 20, 42, 0.92);
}

.button-grid {
  margin-top: 12px;
}

.button-grid-tertiary .btn {
  background: rgba(20, 20, 42, 0.92);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--t3);
}

.empty-state .empty-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.5;
}

.empty-state-copy {
  margin-top: 10px;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.empty-state-actions .btn {
  min-width: 160px;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-accent {
  color: var(--accent-lt);
}

.text-success {
  color: var(--success);
}

.text-muted {
  color: var(--t2);
}

.helper-text {
  color: var(--t2);
  font-size: 0.78rem;
  line-height: 1.5;
}

.helper-text strong {
  color: var(--t1);
}

.helper-text-tight {
  margin-top: 2px;
}

.helper-note {
  margin-top: 8px;
}

#timer-save-exercise-btn {
  margin-top: 12px;
}

.helper-tip {
  margin-bottom: 12px;
}

.scroll-x {
  overflow-x: auto;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.gap-8 {
  gap: 8px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-title {
  margin: 20px 0 12px;
  color: var(--t1);
  font-size: 1rem;
  font-weight: 700;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.review-card {
  padding: 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(124, 92, 252, 0.08), rgba(92, 140, 252, 0.08));
  border-color: rgba(124, 92, 252, 0.25);
}

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

.review-card h4,
.review-card h5 {
  margin-bottom: 8px;
  color: var(--accent-lt);
  font-size: 0.85rem;
  font-weight: 700;
}

.review-card p {
  color: var(--t2);
  font-size: 0.82rem;
  line-height: 1.5;
}

.confirm-content p {
  color: var(--t2);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .app-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .button-grid,
  .form-row,
  .history-edit-grid {
    grid-template-columns: 1fr;
  }

  .form-row.compact {
    grid-template-columns: 1fr 1fr;
  }

  .form-row.compact.chart-controls-row {
    grid-template-columns: 1fr;
  }

  .account-summary {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .account-avatar {
    width: 56px;
    height: 56px;
  }

  .metrics-row {
    grid-template-columns: 1fr;
  }

  .calendar-nav {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-month-label {
    min-width: 0;
    flex: 1;
  }

  .analysis-period-wrap .period-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-nav-btn {
    min-width: 126px;
  }

  .week-summary-toggle {
    flex-direction: column;
    align-items: stretch;
  }

  .week-summary-chevron {
    align-self: flex-end;
  }

  .week-summary-stats {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 58px;
    padding: 8px 4px;
  }

  .session-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wizard-stepper {
    grid-template-columns: 1fr 1fr;
  }

  .template-choice-grid {
    grid-template-columns: 1fr;
  }

  .program-builder-layout,
  .editor-day-workspace,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .wizard-panel {
    min-height: 0;
  }

  .program-summary-actions,
  .wizard-hero,
  .program-builder-hero,
  .wizard-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .program-builder-actions {
    justify-content: stretch;
  }

  .program-builder-sidebar {
    gap: 12px;
  }

  .program-builder-summary,
  .editor-panel-card {
    padding: 16px;
  }

  .program-builder-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .editor-nav-btn {
    padding: 12px;
    min-height: 0;
  }

  .editor-nav-btn-title {
    font-size: 0.82rem;
  }

  .editor-nav-btn-meta {
    display: none;
  }

  .editor-day-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 78%);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
  }

  .editor-day-card {
    scroll-snap-align: start;
  }

  .set-main-row {
    grid-template-columns: 36px minmax(0, 1fr) 64px 58px 40px;
  }

  .set-note-preview {
    padding-left: calc(36px + 8px);
  }

  .checkin-row-top,
  .history-date,
  .history-set-top {
    flex-direction: column;
    align-items: stretch;
  }

  .history-date-pills {
    justify-content: flex-start;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .page-title-row,
  .program-summary-head,
  .program-day-head,
  .modal-head,
  .workout-top {
    flex-direction: column;
    align-items: stretch;
  }

  .workout-session-copy {
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .workout-top {
    flex-wrap: wrap;
  }

  .workout-session-copy {
    order: 3;
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 420px) {
  .app-header {
    padding: 0 12px;
  }

  .header-right {
    gap: 6px;
  }

  .header-chip {
    max-width: 7.5rem;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav {
    height: calc(var(--nav-h) + 2px);
  }

  .nav-item {
    gap: 2px;
    padding: 6px 1px 4px;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .nav-item span {
    font-size: 0.54rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
  }

  .page {
    padding-bottom: calc(var(--nav-h) + 88px + env(safe-area-inset-bottom, 0));
  }

  .timer-fab {
    right: 12px;
    bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom, 0));
    width: 52px;
    height: 52px;
    font-size: 1.25rem;
  }

  .session-grid {
    grid-template-columns: 1fr;
  }

  .wizard-stepper {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .template-choice-grid {
    grid-template-columns: 1fr;
  }

  .wizard-modal,
  .program-builder-modal {
    padding: 20px 18px;
  }

  .wizard-step {
    padding: 10px 12px;
  }

  .wizard-step-copy {
    font-size: 0.74rem;
  }

  .wizard-hero,
  .program-builder-hero {
    gap: 14px;
  }

  .wizard-title,
  .program-builder-title {
    font-size: 1.2rem;
  }
  .session-card {
    min-height: 0;
  }

  .checkin-row {
    padding: 14px;
  }

  .archive-shell,
  .archive-shell-compact {
    padding: 14px;
  }
}

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