:root {
  /* Core Color Palette - Refined Warm Athletic Orange (Matte, non-glowy, gentle & clean) */
  --primary: #e07355;              /* Clean, warm, balanced orange - not harsh, not neon */
  --primary-hover: #d16447;
  --primary-soft: rgba(224, 115, 85, 0.14);
  --primary-subtle: rgba(224, 115, 85, 0.08);

  --bg-main: #0d121d;              /* Deep Midnight Slate Canvas */
  --bg-surface: #151c2c;           /* Elevated Card Surface */
  --bg-subtle: #0f1523;            /* Inset Cells / Nested Boxes */
  --bg-muted: #1c2538;             /* Elevated Chips / Dropdowns */
  --bg-highlight: rgba(224, 115, 85, 0.1);

  --text-main: #ffffff;            /* Crisp White */
  --text-muted: #8fa0b5;           /* Secondary / Subtle text */
  --text-dim: #5a6b82;             /* Sub-labels / Dim text */
  --text-on-primary: #ffffff;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-accent: rgba(224, 115, 85, 0.35);
  --border-focus: #e07355;

  --success: #10b981;
  --success-hover: #059669;
  --success-soft: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.4);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-border: rgba(239, 68, 68, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.5);

  --transition: all 0.16s ease-in-out;
}

/* Base Reset & Box Sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: #070a12;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mobile App Shell (iPhone Pro centered on desktop, 100% on phone) */
.mobile-app {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #070a12;
}

.app-container {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-main);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.7);
}

/* iOS Safe Areas Handling */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 18, 29, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: max(10px, env(safe-area-inset-top)) 16px 10px 16px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

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

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

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.offline-badge {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.timer-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.timer-quick-btn:active {
  background: var(--primary-soft);
  transform: scale(0.96);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 14px 16px;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

/* Tab Pane Visibility */
.tab-pane {
  display: none;
  animation: fadeIn 0.18s ease-in-out;
}

.tab-pane.active {
  display: block;
}

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

/* Cards System */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

/* ==================================================== */
/* 1. HOME SCREEN STYLING                               */
/* ==================================================== */
.home-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.home-date-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.home-day-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.today-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hero-top-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.hero-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.template-picker-select {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btnManageRoutinesHome {
  height: 38px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.in-progress-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.in-progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.hero-top-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary);
  text-transform: uppercase;
}

.hero-workout-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-workout-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
  margin-bottom: 14px;
}

.hero-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.hero-meta-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#homeWeightBox {
  cursor: pointer;
  transition: var(--transition);
}

#homeWeightBox:hover {
  border-color: var(--border-accent);
}

.meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-hero {
  width: 100%;
  min-height: 52px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.btn-hero:hover {
  background: var(--primary-hover);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.btn-hero:active {
  transform: scale(0.98);
}

.home-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 22px;
  margin-bottom: 10px;
}

.summary-compact-card {
  padding: 12px 14px;
}

.compact-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-main);
}

.card-title-group h3 {
  font-size: 0.92rem;
  font-weight: 700;
}

.pill-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.summary-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-cell {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-name {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.weekly-count-card {
  padding: 12px 14px;
}

.weekly-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weekly-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.weekly-val {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.progress-highlight-card {
  padding: 12px 14px;
}

.progress-bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.progress-bullet-list li {
  position: relative;
  padding-left: 14px;
  line-height: 1.4;
}

.progress-bullet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

/* ==================================================== */
/* 2. WORKOUT SCREEN (ACTIVE WORKOUT FLOW)              */
/* ==================================================== */
.workout-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.workout-session-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
  text-transform: uppercase;
}

.workout-session-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

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

.bw-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px 9px;
  font-size: 0.75rem;
  cursor: pointer;
}

.bw-quick-chip .chip-lbl {
  color: var(--text-dim);
  font-weight: 600;
}

.bw-quick-chip .chip-val {
  color: var(--text-main);
  font-weight: 700;
}

/* Stepper Progress Box */
.stepper-progress-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.stepper-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.stepper-step-lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.stepper-percent-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stepper-progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 10px;
}

.stepper-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.25s ease-out;
}

/* Horizontal Exercise Pill Strip */
.exercise-pill-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.exercise-pill-strip::-webkit-scrollbar {
  display: none;
}

.ex-pill {
  flex-shrink: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.ex-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.ex-pill.done {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

.ex-pill.done.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Active Exercise Card */
.active-exercise-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.ex-main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.ex-name-title {
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.ex-category-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary);
}

.ex-target-scheme-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.target-val-bold {
  color: var(--text-main);
  font-weight: 700;
}

/* Last Workout Box (Clean, Distinct, Monospace/Tabular Look) */
.last-workout-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.last-workout-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.last-sets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.last-set-line {
  font-size: 0.84rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-main);
  font-weight: 600;
}

/* Today's Sets Section */
.today-sets-header {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.set-rows-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

/* Single Set Mobile Row (Large Touch Targets!) */
.set-mobile-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 38px;
  align-items: center;
  gap: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  transition: var(--transition);
}

.set-mobile-row.completed {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}

.set-index-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

/* Stepper Group for Weight and Reps */
.stepper-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 38px;
  min-width: 0;
}

.stepper-btn {
  width: 22px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  flex-shrink: 0;
}

.stepper-btn:active {
  background: var(--bg-subtle);
  color: var(--primary);
}

.stepper-val-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  padding: 0 1px;
  outline: none;
  /* -moz-appearance: textfield; */
  /* box-sizing: border-box; */
}

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

.stepper-unit {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-dim);
  padding-right: 3px;
  flex-shrink: 0;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Large Tactile Checkmark Button */
.btn-set-check {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-set-check:active {
  transform: scale(0.92);
}

.btn-set-check.active {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.btn-add-set-row {
  width: 100%;
  height: 38px;
  background: transparent;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-add-set-row:active {
  background: var(--bg-subtle);
}

/* RIR Section (Clean Pills) */
.rir-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.rir-header-group {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.rir-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-main);
}

.rir-sub-explainer {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.rir-pill-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.rir-pill-btn {
  height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.rir-pill-btn:active {
  transform: scale(0.94);
}

.rir-pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: none;
}

.rir-meaning-text {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 6px;
  min-height: 18px;
}

/* Cardio Section */
.cardio-compact-card {
  padding: 12px 14px;
}

.cardio-grid-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cardio-field-cell {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.cardio-field-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Exercise Navigation Dock (Sticky above bottom nav) */
.exercise-nav-dock {
  margin-top: 8px;
  margin-bottom: 12px;
}

.btn-next-exercise {
  width: 100%;
  min-height: 52px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.btn-next-exercise.btn-finish-mode {
  background: var(--success);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.btn-next-exercise:active {
  transform: scale(0.98);
}

.exercise-nav-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.btn-subtle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  height: 40px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-subtle:active {
  background: var(--bg-subtle);
}

/* ==================================================== */
/* 3. HISTORY SCREEN                                    */
/* ==================================================== */
.pane-header-mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pane-title-mobile {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.pane-sub-mobile {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==================================================== */
/* 3. HISTORY SCREEN                                    */
/* ==================================================== */
/* History keeps the shared athletic palette; all refinements stay local. */
#tab-history {
  --history-cardio: oklch(0.77 0.13 230);
  --history-cardio-soft: color-mix(in oklab, var(--history-cardio) 10%, transparent);
}
#tab-history .pane-header-mobile { gap: 16px; margin: 4px 0 24px; }
#tab-history .pane-title-mobile { font-size: 1.45rem; line-height: 1.25; letter-spacing: 0; }
#tab-history .pane-sub-mobile { margin-top: 6px; line-height: 1.5; }
#tab-history #btnExportJSONHistory { min-height: 38px; padding: 8px 12px; }
.history-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.history-count-badge { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.btn-hist-toggle-all { font-size: .74rem; padding: 7px 10px; min-height: 34px; flex-shrink: 0; }
.history-list { display: flex; flex-direction: column; gap: 14px; }
.history-card-mobile { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .16s ease; }
.history-card-mobile:hover, .history-card-mobile.expanded { border-color: var(--border-accent); }
.hist-card-summary { padding: 18px 16px; cursor: pointer; user-select: none; }
.hist-card-summary:hover { background: var(--primary-subtle); }
.hist-card-summary:focus-visible, .hist-expand-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.hist-top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.hist-title-group { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.hist-title { font-size: 1.06rem; font-weight: 700; line-height: 1.35; color: var(--text-main); letter-spacing: 0; overflow-wrap: anywhere; }
.hist-meta-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.hist-date { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.hist-duration-badge { font-size: .72rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.hist-expand-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg-muted); color: var(--text-muted); border: 1px solid var(--border-color); border-radius: var(--radius-sm); cursor: pointer; }
.hist-expand-hint, .hist-click-hint { display: none; }
.history-card-mobile.expanded .hist-expand-btn { color: var(--primary); background: var(--primary-soft); border-color: var(--border-accent); }
.hist-chevron { transition: transform .18s ease; }
.history-card-mobile.expanded .hist-chevron { transform: rotate(180deg); }
.hist-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-chip { font-size: .75rem; line-height: 1.4; font-weight: 600; background: var(--bg-muted); color: var(--text-muted); padding: 6px 9px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.hist-chip.chip-highlight { color: var(--primary); background: var(--primary-soft); }
.hist-chip.chip-cardio { color: var(--history-cardio); background: var(--history-cardio-soft); }
.hist-details-body { border-top: 1px solid var(--border-color); padding: 18px 16px 14px; }
.hist-details-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.hist-details-title { font-size: .82rem; font-weight: 600; letter-spacing: 0; color: var(--text-muted); }
.hist-exercises-list { display: flex; flex-direction: column; gap: 20px; }
.hist-exercise-block { min-width: 0; padding: 0 0 18px; border-bottom: 1px solid var(--border-color); }
.hist-exercise-block:last-child { padding-bottom: 0; border-bottom: 0; }
.hist-ex-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 9px; }
.hist-ex-title { font-size: .9rem; font-weight: 700; color: var(--text-main); min-width: 0; overflow-wrap: anywhere; }
.hist-ex-category { font-size: .68rem; font-weight: 600; color: var(--primary); padding-top: 2px; max-width: 35%; overflow-wrap: anywhere; text-align: right; }
.hist-ex-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; font-size: .72rem; color: var(--text-muted); margin-bottom: 12px; }
.hist-meta-pill { line-height: 1.6; font-weight: 400; overflow-wrap: anywhere; }
.hist-meta-pill strong { color: var(--text-muted); font-weight: 600; }
.hist-sets-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .74rem; font-variant-numeric: tabular-nums; }
.hist-sets-table th { text-align: left; font-size: .65rem; font-weight: 500; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0; padding: 8px 3px; background: var(--bg-subtle); border-bottom: 1px solid var(--border-color); }
.hist-sets-table td { padding: 10px 3px; border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); overflow-wrap: anywhere; }
.hist-sets-table th:first-child, .hist-sets-table td:first-child { padding-left: 7px; }
.hist-sets-table th:last-child, .hist-sets-table td:last-child { text-align: right; padding-right: 7px; width: 25%; }
.hist-sets-table tr:last-child td { border-bottom: none; }
.hist-sets-table .hist-set-num { font-weight: 500; color: var(--text-muted); }
.hist-sets-table .hist-set-val { font-weight: 600; color: var(--text-main); }
.hist-set-vol { font-size: .7rem; }
.hist-set-status-badge { display: inline-flex; align-items: center; gap: 3px; font-size: .65rem; font-weight: 500; padding: 3px 4px; border-radius: 4px; }
.hist-set-status-badge.completed { background: var(--success-soft); color: var(--success); }
.hist-set-status-badge.skipped { background: var(--bg-muted); color: var(--text-muted); }
.hist-cardio-box { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color); }
.hist-cardio-title { font-size: .85rem; font-weight: 600; color: var(--history-cardio); display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.hist-cardio-title svg { color: var(--history-cardio) !important; }
.hist-cardio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 12px; }
.hist-cardio-stat { display: flex; flex-direction: column; min-width: 0; }
.hist-cardio-lbl { font-size: .68rem; color: var(--text-muted); }
.hist-cardio-val { font-size: .82rem; font-weight: 600; color: var(--text-main); margin-top: 4px; overflow-wrap: anywhere; }
.hist-meta-footer { margin-top: 20px; padding: 14px 0; border-top: 1px solid var(--border-color); font-size: .74rem; line-height: 1.7; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.hist-meta-footer strong { color: var(--text-main); font-weight: 500; }
.hist-actions-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-color); padding-top: 12px; }
.hist-actions-row .btn { min-height: 38px; }
.hist-actions-row .btn-del-hist { color: var(--danger); }
#tab-history .card.text-center { background: transparent; border: 1px dashed var(--border-color); border-radius: var(--radius-sm); box-shadow: none; margin-top: 8px; }
@media (max-width: 360px) {
  .hist-card-summary, .hist-details-body { padding-left: 12px; padding-right: 12px; }
  .hist-set-status-badge { font-size: .6rem; gap: 2px; }
  .hist-sets-table { font-size: .68rem; }
  .hist-chip { padding: 5px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  #tab-history, #tab-history * { animation: none; transition: none; }
}

/* ==================================================== */
/* 4. PROGRESS SCREEN                                   */
/* ==================================================== */
.chart-card-mobile {
  padding: 14px;
}

.card-heading-mobile {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.chart-box-mobile {
  width: 100%;
  height: 200px;
  position: relative;
}

.calc-card-mobile {
  padding: 14px;
}

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

.calc-formula-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.calc-inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.calc-input-cell label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stepper-box {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  height: 42px;
}

.res-hero-box {
  background: var(--primary-soft);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  margin-bottom: 10px;
}

.res-hero-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
}

.res-hero-val {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 2px;
}

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

.res-sub-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.res-sub-lbl {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
}

.res-sub-val {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.table-responsive-mobile {
  overflow-x: auto;
  margin-top: 6px;
}

.mobile-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.mobile-stats-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.mobile-stats-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

/* ==================================================== */
/* 5. SETTINGS SCREEN                                   */
/* ==================================================== */
.settings-section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 18px 4px 8px 4px;
}

.settings-group-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
}

.settings-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.settings-item-row:last-child {
  border-bottom: none;
}

.settings-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.settings-icon-box.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.settings-icon-box.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.settings-info {
  flex: 1;
  min-width: 0;
}

.settings-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.settings-desc {
  display: block;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-danger-card {
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.input-select-mobile {
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.input-select-mobile:focus {
  border-color: var(--border-focus);
}

.backup-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.mobile-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.82rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

.mobile-textarea:focus {
  border-color: var(--border-focus);
}

.parser-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.parse-preview-mobile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.76rem;
}

/* ==================================================== */
/* BOTTOM NAVIGATION (CLEAN, 5 TABS, FIXED TO BOTTOM)   */
/* ==================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 20, 32, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 100;
}

.nav-item {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px 0;
  transition: var(--transition);
  touch-action: manipulation;
}

.nav-item .nav-icon {
  stroke: var(--text-dim);
  transition: stroke 0.16s ease;
}

.nav-item .nav-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color 0.16s ease;
}

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

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

.nav-item.active .nav-icon {
  stroke: var(--primary);
}

.nav-item.active .nav-lbl {
  color: var(--primary);
  font-weight: 700;
}

/* ==================================================== */
/* MODALS & OVERLAYS                                    */
/* ==================================================== */
.modal-overlay,
.timer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}

.modal-overlay.active,
.timer-overlay.active {
  display: flex;
  animation: fadeIn 0.16s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close,
.sheet-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* 1. WORKOUT COMPLETION CARD */
.completion-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 22px 18px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.completion-card .modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.completion-icon-box {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: var(--success);
  border: 2px solid var(--success-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
}

.completion-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.completion-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.completion-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.comp-metric-cell {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.comp-val {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.comp-lbl {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 1px;
}

.comp-weight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 10px;
  text-align: left;
}

.comp-weight-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.comp-weight-ref {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.comp-weight-input-box {
  display: flex;
  align-items: center;
  gap: 4px;
}

.comp-weight-input {
  width: 68px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
}

.comp-weight-input:focus {
  border-color: var(--primary);
  outline: none;
}

.comp-date-input {
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  color-scheme: dark;
  outline: none;
}

.comp-cardio-row {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
}

/* 2. REST TIMER SHEET */
.timer-sheet {
  width: 100%;
  max-width: 360px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.timer-sheet .sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.timer-sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.timer-sheet-clock {
  font-size: 3.2rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 16px;
}

.timer-presets-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.timer-preset-btn {
  height: 38px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.timer-preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

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

/* Form Groups & Utilities */
.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.input-mobile {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

.input-mobile:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
}

.btn {
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  padding: 10px 16px;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:active {
  background: var(--primary-hover);
  transform: scale(0.97);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
}

.btn-outline-subtle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 10px;
  font-size: 0.76rem;
  border-radius: var(--radius-full);
}

.btn-sm {
  font-size: 0.76rem;
  padding: 6px 12px;
  height: 32px;
}

.btn-xs {
  font-size: 0.72rem;
  padding: 0 10px;
  height: 26px;
  min-height: 26px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

#btnLoadSampleText {
  height: 26px;
  min-height: 26px;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-subtle {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.text-muted { color: var(--text-muted); }
.text-xs { font-size: 0.72rem; }
.text-lg { font-size: 1.15rem; font-weight: 700; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.ml-auto { margin-left: auto; }

/* ==================================================== */
/* ROUTINE SELECTOR & ICON ACTIONS                      */
/* ==================================================== */
.routine-exercise-item:hover {
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
}

.routine-ex-info:hover .routine-ex-name {
  color: var(--primary, #d9725b) !important;
}

.routine-picker-actions-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.routine-mgr-dropdown {
  flex: 1;
  min-width: 0;
  height: 42px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.btn-icon-action {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  padding: 0;
  touch-action: manipulation;
}

.btn-icon-action:hover {
  background: var(--bg-surface);
  border-color: var(--border-focus);
}

.btn-icon-action:active {
  transform: scale(0.94);
}

.btn-icon-action-danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
}

.btn-icon-action-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
}

.btn-icon-action-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-icon-action-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* ==================================================== */
/* CUSTOM POPUP / DIALOG STYLES (NO WINDOW.CONFIRM)     */
/* ==================================================== */
#customConfirmModal,
#customPromptModal,
#customAlertModal {
  z-index: 1050;
}

.custom-popup-card {
  max-width: 360px;
  width: 90%;
  text-align: center;
  padding: 24px 20px;
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.custom-popup-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.custom-popup-icon-box.info {
  background: rgba(217, 114, 91, 0.12);
  color: var(--primary);
}

.custom-popup-icon-box.success {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.custom-popup-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.custom-popup-message {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* ==================================================== */
/* 10. CUSTOM MOBILE SELECT PICKER (NO NATIVE OS WHEEL) */
/* ==================================================== */
.custom-picker-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 26, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-picker-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.custom-picker-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border: 1px solid var(--border-color);
  border-bottom: none;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom)) 16px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.custom-picker-overlay.active .custom-picker-sheet {
  transform: translateY(0);
}

/* Grab handle at top of mobile sheet */
.custom-picker-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 auto 10px auto;
  flex-shrink: 0;
}

.custom-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.custom-picker-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0;
}

.custom-picker-header .sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: all 0.15s ease;
  padding: 0;
}

.custom-picker-header .sheet-close:active {
  transform: scale(0.92);
  background: var(--bg-surface);
  color: var(--text-main);
}

.custom-picker-options {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  max-height: calc(70vh - 80px);
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.custom-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
  user-select: none;
}

.custom-picker-item:hover {
  background: var(--bg-subtle);
}

.custom-picker-item:active {
  transform: scale(0.98);
  background: rgba(224, 115, 85, 0.14);
}

.custom-picker-item.selected {
  background: rgba(224, 115, 85, 0.12);
  border-color: rgba(224, 115, 85, 0.35);
  color: var(--primary);
  font-weight: 700;
}

.picker-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-check {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-left: 10px;
  flex-shrink: 0;
}

.custom-picker-item.selected .picker-check {
  display: flex;
}

/* Desktop / Tablet responsiveness */
@media (min-width: 641px) {
  .custom-picker-overlay {
    align-items: center;
    padding: 20px;
  }
  .custom-picker-sheet {
    border-radius: 18px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  }
  .custom-picker-overlay.active .custom-picker-sheet {
    transform: scale(1);
    opacity: 1;
  }
  .custom-picker-sheet::before {
    display: none;
  }
}

/* Custom chevron arrow on all select dropdowns */
select.input-mobile,
select.input-select-mobile,
select.template-picker-select,
.routine-mgr-dropdown {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  padding-right: 32px !important;
  cursor: pointer;
}
