/* ============================================================
   IRON 24 — Dark OLED Mobile-First UI (styles.css)
   ============================================================ */

:root {
  --bg: #0a0a0c;
  --surface: #141418;
  --surface-2: #1b1b21;
  --surface-3: #23232c;
  --border: #22222a;
  --border-strong: #2f2f3b;
  --text: #f4f4f6;
  --text-muted: #9a9aa8;
  --text-dim: #666675;

  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.14);
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);

  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* App Shell */
.app-shell {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

.main-content {
  padding: 14px 14px calc(var(--nav-height) + 92px + var(--safe-bottom));
}

.tab-view {
  display: none;
  animation: fadeIn 0.16s ease-out;
}
.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Top Bar & Week Switcher */
.top-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  gap: 8px;
}

.week-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.week-nav-btn:active {
  transform: scale(0.94);
  background: var(--surface-3);
}
.week-nav-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.week-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
  min-width: 0;
}

.week-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.phase-badge.deload {
  background: var(--orange-soft);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
.phase-badge.taper {
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  border-color: rgba(6, 182, 212, 0.35);
}
.phase-badge.peak {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Day Switcher Pills */
.day-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.16s ease;
  position: relative;
}

.day-pill-top {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.day-pill-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
}

.day-pill.active[data-day="mon"] {
  background: var(--blue-soft);
  border-color: var(--blue);
}
.day-pill.active[data-day="mon"] .day-pill-top { color: #60a5fa; }
.day-pill.active[data-day="mon"] .day-pill-sub { color: #93c5fd; }

.day-pill.active[data-day="wed"] {
  background: var(--green-soft);
  border-color: var(--green);
}
.day-pill.active[data-day="wed"] .day-pill-top { color: #4ade80; }
.day-pill.active[data-day="wed"] .day-pill-sub { color: #86efac; }

.day-pill.active[data-day="fri"] {
  background: var(--purple-soft);
  border-color: var(--purple);
}
.day-pill.active[data-day="fri"] .day-pill-top { color: #c084fc; }
.day-pill.active[data-day="fri"] .day-pill-sub { color: #d8b4fe; }

.day-pill-done-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* Workout Progress Banner */
.workout-summary-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.summary-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.summary-bar-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.day-accent-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.summary-bar-stats {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.deload-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--orange-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  font-size: 12.5px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Exercise Cards */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}

.exercise-card.all-done {
  border-color: rgba(34, 197, 94, 0.45);
}

.exercise-header {
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.exercise-title-wrap {
  min-width: 0;
  flex: 1;
}

.exercise-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.exercise-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.exercise-card.all-done .exercise-index {
  background: var(--green-soft);
  color: var(--green);
}

.exercise-name {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.improvement-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.exercise-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.meta-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.meta-chip.plan-chip {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.1);
}

.meta-chip.plan-chip strong {
  color: var(--accent);
}

.meta-chip.prev-chip {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}

.exercise-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:active {
  background: var(--surface-3);
  color: var(--text);
}

.improvement-note-box {
  margin: 0 14px 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
  font-size: 12px;
  line-height: 1.4;
}

/* Sets Table inside Exercise Card */
.exercise-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.exercise-card.collapsed .exercise-body {
  display: none;
}

.sets-header {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 44px;
  gap: 8px;
  padding: 8px 4px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  text-align: center;
}

.set-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr 44px;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  border-radius: 11px;
  transition: background 0.18s;
  margin-bottom: 4px;
}

.set-row.done {
  background: rgba(34, 197, 94, 0.12);
}

.set-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}
.set-row.done .set-num {
  color: var(--green);
}

/* Stepper Input Group */
.stepper-group {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  height: 40px;
}
.set-row.done .stepper-group {
  background: rgba(20, 20, 24, 0.75);
  border-color: rgba(34, 197, 94, 0.3);
}

.step-btn {
  width: 30px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.step-btn:active {
  background: var(--surface-3);
  color: var(--text);
}

.step-input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  -moz-appearance: textfield;
}
.step-input::-webkit-inner-spin-button,
.step-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.set-done-btn {
  width: 44px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.set-done-btn:active {
  transform: scale(0.92);
}
.set-row.done .set-done-btn {
  background: var(--green);
  border-color: var(--green);
  color: #052e16;
}

.exercise-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.ghost-sm-btn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.ghost-sm-btn:active {
  background: var(--surface-3);
  color: var(--text);
}

/* Workout Bottom Actions */
.workout-bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-secondary-full {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary-full:active {
  background: var(--surface-2);
  color: var(--text);
}

.btn-primary-full {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s, filter 0.15s;
}
.btn-primary-full:active {
  transform: scale(0.985);
  filter: brightness(0.92);
}

/* ============================================================
   Sticky Rest Timer Bar
   ============================================================ */
.rest-timer-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  width: calc(100% - 24px);
  max-width: 516px;
  background: rgba(20, 20, 26, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  z-index: 40;
  transition: all 0.2s ease;
}

.rest-timer-bar.running {
  border-color: var(--accent);
}
.rest-timer-bar.finished {
  border-color: var(--green);
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.35);
}

.timer-progress-track {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 3px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.timer-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 0.3s linear;
}
.rest-timer-bar.finished .timer-progress-fill {
  background: var(--green);
}

.timer-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.timer-clock-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 10px;
}

.timer-icon {
  font-size: 16px;
}

.timer-display {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.timer-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.rest-timer-bar.running .timer-status-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.timer-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-mini-btn {
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.timer-mini-btn:active {
  background: var(--surface-3);
  color: var(--text);
}

.timer-play-btn {
  width: 38px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-presets-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.rest-timer-bar.collapsed .timer-presets-row {
  display: none;
}

.timer-preset-btn {
  padding: 7px 0;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.timer-preset-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* ============================================================
   Bottom Navigation
   ============================================================ */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 540px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(12, 12, 15, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.15s;
}

.nav-icon {
  width: 22px;
  height: 22px;
}

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

/* ============================================================
   Section Headers & Cards (Plan / Progress / Settings)
   ============================================================ */
.section-heading {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 12px;
}

/* 24-Week Roadmap */
.meso-block {
  margin-bottom: 18px;
}

.meso-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.meso-title {
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.meso-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.meso-weeks-range {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.meso-goal {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.weeks-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.week-plan-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.week-plan-card:active {
  background: var(--surface-2);
}
.week-plan-card.current {
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.08);
}
.week-plan-card.deload {
  border-color: rgba(245, 158, 11, 0.35);
}
.week-plan-card.peak {
  border-color: rgba(239, 68, 68, 0.45);
}

.wpc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wpc-week {
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wpc-lifts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.wpc-lift {
  background: var(--surface-2);
  border-radius: 9px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wpc-lift-label {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 600;
}

.wpc-lift-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* Progress Tab */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
}

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

.chart-title {
  font-size: 15px;
  font-weight: 700;
}

.chart-tabs {
  display: flex;
  gap: 6px;
}

.chart-tab {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.chart-tab.active[data-lift="bench"] {
  background: var(--blue-soft);
  color: #60a5fa;
  border-color: var(--blue);
}
.chart-tab.active[data-lift="squat"] {
  background: var(--green-soft);
  color: #4ade80;
  border-color: var(--green);
}
.chart-tab.active[data-lift="deadlift"] {
  background: var(--purple-soft);
  color: #c084fc;
  border-color: var(--purple);
}

.chart-svg-wrap {
  width: 100%;
  overflow: hidden;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 16px;
  height: 2px;
  display: inline-block;
}
.legend-line.dashed {
  border-top: 2px dashed var(--text-muted);
  height: 0;
}

/* History Items */
.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.history-title {
  font-size: 14.5px;
  font-weight: 700;
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.history-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: none;
  flex-direction: column;
  gap: 6px;
}
.history-card.open .history-details {
  display: flex;
}

.history-ex-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}
.history-ex-name {
  color: var(--text);
  font-weight: 600;
}
.history-ex-sets {
  color: var(--text-muted);
  text-align: right;
}

/* Settings Forms */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-label strong {
  color: var(--text);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.input-box {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  outline: none;
}
.input-box:focus {
  border-color: var(--blue);
}

.input-with-unit {
  position: relative;
}
.input-with-unit .input-box {
  padding-right: 42px;
}
.input-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  pointer-events: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 999px;
  transition: 0.2s;
  cursor: pointer;
}
.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider {
  background: var(--green);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.btn-outline {
  padding: 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}
.btn-outline.danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  background: var(--red-soft);
}

/* Modal Sheet */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.modal-overlay.hidden {
  display: none;
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 18px;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
}

.pr-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 700;
  margin: 3px 4px 3px 0;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: rgba(24, 24, 31, 0.96);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: fadeIn 0.18s ease-out;
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 13.5px;
}
