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

:root {
  --primary: #DC2626;
  --primary-dark: #991B1B;
  --primary-light: #FEF2F2;
  --accent: #FFD700;
  --accent-dark: #D4A800;
  --success: #00B050;
  --danger: #E31837;
  --warning: #ed8936;
  --gray-100: #F0F0F0;
  --gray-200: #E0E0E0;
  --gray-300: #BDBDBD;
  --gray-600: #6B6B6B;
  --gray-800: #1A1A1A;
  --bg: #F5F5F5;
  --card-bg: white;
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
}

body.dark-mode {
  --bg: #121212;
  --card-bg: #1E1E1E;
  --text: #E0E0E0;
  --text-secondary: #9E9E9E;
  --gray-100: #2C2C2C;
  --gray-200: #333333;
  --gray-300: #444444;
  --primary: #EF4444;
  --primary-dark: #DC2626;
  --primary-light: rgba(239, 68, 68, 0.15);
  --accent: #FFD700;
  --accent-dark: #D4A800;
  --success: #00C853;
  --danger: #FF4444;
  --warning: #ffb800;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

/* Light mode: soft blood red gradient */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(220, 38, 38, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(255, 215, 0, 0.03) 0%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

/* Dark mode: blood & lightning gradient */
body.dark-mode::after {
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, rgba(239, 68, 68, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 85% 20%, rgba(255, 215, 0, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(220, 38, 38, 0.03) 0%, transparent 60%);
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 16px;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-timer-wrap {
  position: relative;
}
.header-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}
.header-timer:active {
  transform: scale(0.95);
}
.header-timer.running {
  border-color: var(--primary);
  background: rgba(220, 38, 38, 0.1);
}
.header-timer.running .header-timer-icon {
  stroke: var(--primary);
}
.header-timer.running .header-timer-value {
  color: var(--primary);
}
.header-timer.timer-done {
  animation: timerFlash 0.4s ease 5;
  border-color: var(--accent);
  background: rgba(255, 215, 0, 0.15);
}
@keyframes timerFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.header-timer-icon {
  stroke: var(--text-secondary);
  transition: stroke 0.2s;
}
.header-timer-value {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  transition: color 0.2s;
  min-width: 40px;
}
.timer-picker {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: var(--card-bg);
  border: 1.5px solid var(--gray-200);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 100;
  white-space: nowrap;
}
.timer-preset {
  padding: 6px 10px;
  border: none;
  border-radius: 10px;
  background: var(--gray-100);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.15s;
}
.timer-preset:active {
  transform: scale(0.92);
  background: var(--primary);
  color: #fff;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--card-bg);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  color: var(--text);
}

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

.icon-btn:hover {
  background: var(--gray-200);
}

/* ======= iOS-style theme toggle ======= */
.theme-toggle {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.theme-toggle:active .toggle-track { opacity: 0.85; }
.toggle-track {
  position: relative;
  width: 51px;
  height: 31px;
  background: #e5e5ea;
  border-radius: 16px;
  transition: background 0.3s ease;
}
body.dark-mode .toggle-track { background: #34C759; }
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.28), 0 0 0 0.5px rgba(0,0,0,0.06);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
body.dark-mode .toggle-thumb { transform: translateX(20px); }
/* ======================================== */

/* ===== Floating Timer (FAB + Bottom Sheet) ===== */
.ft-fab {
  position: fixed;
  bottom: 76px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1.5px solid var(--gray-200);
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  color: var(--text);
  gap: 1px;
  padding: 0;
}
.ft-fab:active { transform: scale(0.88); }
.ft-fab.running {
  border-color: var(--primary);
  animation: ft-pulse 1.5s infinite;
}
@keyframes ft-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220,38,38,0.25); }
  50%       { box-shadow: 0 0 0 7px rgba(220,38,38,0.06); }
}
.ft-fab-time {
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  line-height: 1;
  display: none;
}
.ft-fab.running svg { display: none; }
.ft-fab.running .ft-fab-time { display: block; font-size: 13px; }

.ft-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.ft-overlay.open { display: block; }

.ft-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(env(safe-area-inset-bottom, 16px) + 20px);
  z-index: 301;
  transform: translateY(110%);
  transition: transform 0.38s cubic-bezier(0.34, 1.1, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.2);
}
.ft-sheet.open { transform: translateY(0); }

.ft-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  flex-shrink: 0;
}
.ft-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  align-self: flex-start;
}
.ft-timer-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ft-timer-wrap svg {
  position: absolute;
  top: 0; left: 0;
}
.ft-display {
  font-size: 44px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  position: relative;
  z-index: 1;
}
.ft-track {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 10;
}
.ft-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 502.65;
  stroke-dashoffset: 0;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.9s linear, stroke 0.5s;
}
.ft-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.ft-presets button {
  padding: 6px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.ft-presets button.active,
.ft-presets button:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.ft-adjust {
  display: flex;
  gap: 10px;
}
.ft-adjust button {
  padding: 8px 22px;
  border-radius: 10px;
  border: 1.5px solid var(--gray-200);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ft-adjust button:active { background: var(--gray-200); }
.ft-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.ft-actions button {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ft-actions button:active { opacity: 0.8; }
.ft-actions button:first-child {
  background: var(--primary);
  color: #fff;
}
.ft-actions button:last-child {
  background: var(--gray-200);
  color: var(--text);
}
body.dark-mode .ft-sheet { background: #1e1e1e; }
body.dark-mode .ft-fab   { background: #1e1e1e; border-color: rgba(255,255,255,0.12); }
/* ================================================ */

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  gap: 2px;
}

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

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

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

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

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

.btn-secondary {
  background: var(--gray-200);
  color: var(--text);
}

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

.btn-success {
  background: var(--success);
  color: white;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 20px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-strength { background: #dbeafe; color: #1e40af; }
.badge-cardio { background: #fef3c7; color: #92400e; }
.badge-stretching { background: #fce7f3; color: #9d174d; }
.badge-yoga { background: #ede9fe; color: #5b21b6; }
.badge-swimming { background: #cffafe; color: #0e7490; }
.badge-mixed { background: #d1fae5; color: #065f46; }
.badge-other { background: var(--gray-200); color: var(--gray-600); }

/* Muscle group tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--gray-200);
  color: var(--text-secondary);
}

/* Modal / Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

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

.modal {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-200);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Search */
.search-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 15px;
  background: var(--card-bg);
  color: var(--text);
  margin-bottom: 12px;
}

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

/* Filter Pills */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.filter-pill {
  padding: 6px 14px;
  border: 2px solid var(--gray-200);
  background: var(--card-bg);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--text);
}

.filter-pill:active {
  transform: scale(0.95);
}

.filter-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
}

.app-header h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-content {
  padding: 0 16px 100px;
}

/* Outline button */
.btn-outline {
  background: transparent;
  border: 2px solid var(--gray-300);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--gray-200);
}

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.cal-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.cal-day.empty {
  cursor: default;
}

.cal-day:not(.empty):hover {
  background: var(--gray-200);
}

.cal-day.today {
  font-weight: 700;
  border: 2px solid var(--primary);
}

.cal-day.has-workout {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

body.dark-mode .cal-day.has-workout {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

/* Timer Circle */
.timer-circle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-display {
  position: absolute;
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ============ STATS PAGE ============ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  color: white;
}

.stat-card--blue .stat-card-icon { background: linear-gradient(135deg, #DC2626, #991B1B); }
.stat-card--green .stat-card-icon { background: linear-gradient(135deg, #00B050, #008A3E); }
.stat-card--purple .stat-card-icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.stat-card--orange .stat-card-icon { background: linear-gradient(135deg, #FFD700, #D4A800); }

.stat-card--blue .stat-value { color: #DC2626; }
.stat-card--green .stat-value { color: #00B050; }
.stat-card--purple .stat-value { color: #8b5cf6; }
.stat-card--orange .stat-value { color: #D4A800; }

body.dark-mode .stat-card--blue .stat-value { color: #EF4444; }
body.dark-mode .stat-card--green .stat-value { color: #00C853; }
body.dark-mode .stat-card--purple .stat-value { color: #a78bfa; }
body.dark-mode .stat-card--orange .stat-value { color: #FFD700; }

.stats-section {
  margin-bottom: 20px;
}

.chart-container {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chart-placeholder {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 24px 0;
}

/* SVG chart styles */
.chart-bar {
  animation: barGrow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transform-origin: bottom;
}

@keyframes barGrow {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

.chart-bar-label {
  font-size: 9px;
  font-weight: 600;
  fill: var(--text-secondary);
}

.chart-axis-label {
  font-size: 9px;
  fill: var(--text-secondary);
}

.chart-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: lineReveal 1.2s ease-out forwards;
}

@keyframes lineReveal {
  to { stroke-dashoffset: 0; }
}

.chart-dot {
  animation: dotPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes dotPop {
  from { r: 0; opacity: 0; }
  to { r: 4; opacity: 1; }
}

/* Donut chart */
.donut-segment {
  animation: donutReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes donutReveal {
  from { stroke-dashoffset: 339; opacity: 0; }
  to { stroke-dashoffset: 0; opacity: 1; }
}

.donut-center-value {
  font-size: 22px;
  font-weight: 700;
  fill: var(--text);
}

.donut-center-label {
  font-size: 10px;
  fill: var(--text-secondary);
}

.pie-chart-container {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-name {
  flex: 1;
  font-weight: 500;
}

.legend-pct {
  font-weight: 600;
  color: var(--text);
  min-width: 32px;
  text-align: right;
}

.legend-count {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: right;
}

/* Exercise select */
.exercise-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--text);
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.exercise-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Personal records */
.records-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s;
}

.record-item:active {
  transform: scale(0.98);
}

.record-gold { border-left: 3px solid #f59e0b; }
.record-silver { border-left: 3px solid #94a3b8; }
.record-bronze { border-left: 3px solid #cd7f32; }

.record-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.record-gold .record-rank { background: #fef3c7; color: #d97706; }
.record-silver .record-rank { background: #f1f5f9; color: #64748b; }
.record-bronze .record-rank { background: #fef3c7; color: #b45309; }

body.dark-mode .record-gold .record-rank { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
body.dark-mode .record-silver .record-rank { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
body.dark-mode .record-bronze .record-rank { background: rgba(205, 127, 50, 0.15); color: #cd7f32; }

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

.record-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-bar-track {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.record-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.record-gold .record-bar-fill { background: linear-gradient(90deg, #f59e0b, #d97706); }
.record-silver .record-bar-fill { background: linear-gradient(90deg, #94a3b8, #64748b); }
.record-bronze .record-bar-fill { background: linear-gradient(90deg, #cd7f32, #b45309); }

.record-weight {
  text-align: right;
  flex-shrink: 0;
}

.record-kg {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.record-unit {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Timing stats */
.timing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.timing-name {
  flex: 0 0 100px;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timing-bar-track {
  flex: 1;
  height: 20px;
  background: var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}

.timing-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 10px;
  animation: timingFill 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes timingFill {
  from { width: 0 !important; }
}

.timing-value {
  flex: 0 0 55px;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.timing-value span {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Border variable */
:root {
  --border: var(--gray-300);
}

/* Workout history item */
.workout-history-item {
  cursor: pointer;
  transition: background 0.2s;
}

.workout-history-item:hover {
  background: var(--gray-200);
}

/* ============ SHEET HISTORY ============ */
.sheet-history-card {
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.sheet-history-card:active { transform: scale(0.98); }

.sheet-history-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-history-icon {
  font-size: 28px;
  flex-shrink: 0;
}

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

.sheet-history-title {
  font-weight: 600;
  font-size: 15px;
}

.sheet-history-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sheet-history-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.history-ex-tag {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 8px;
  font-weight: 500;
}

body.dark-mode .history-ex-tag {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
}

.history-ex-more {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--gray-100);
  color: var(--text-secondary);
  border-radius: 8px;
  font-weight: 500;
}

.sheet-history-notes {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.sheet-history-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
}

.sheet-exercise-detail {
  margin-bottom: 12px;
}

.sheet-exercise-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.sheet-exercise-name {
  font-weight: 600;
  font-size: 14px;
}

.sheet-exercise-time {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--gray-100);
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
}

.overload-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(0, 176, 80, 0.12);
  color: var(--success);
  border-radius: 8px;
  font-weight: 600;
}

.sheet-set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
}

.sheet-set-num {
  color: var(--text-secondary);
  width: 20px;
  flex-shrink: 0;
}

.sheet-set-kg {
  font-weight: 500;
  min-width: 60px;
}

.sheet-set-reps { min-width: 60px; }

.sheet-set-reps.reps-high {
  color: var(--success);
  font-weight: 600;
}

.sheet-set-done {
  color: var(--success);
  font-weight: 700;
}

/* ============ DARK MODE OVERRIDES ============ */

/* Header — gradient title (blood → lightning) */
body.dark-mode header h1,
body.dark-mode .app-header h1 {
  background: linear-gradient(135deg, #EF4444, #FFD700);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Cards — subtle shadow */
body.dark-mode .card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Icon buttons */
body.dark-mode .icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Bottom nav — glass */
body.dark-mode .bottom-nav {
  background: rgba(18, 18, 18, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

body.dark-mode .nav-item.active {
  color: #EF4444;
}

/* Stat cards */
body.dark-mode .stat-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Chart containers */
body.dark-mode .chart-container,
body.dark-mode .pie-chart-container {
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Record items */
body.dark-mode .record-item {
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Buttons */
body.dark-mode .btn-primary {
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

body.dark-mode .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

body.dark-mode .btn-success {
  box-shadow: 0 2px 8px rgba(0, 200, 83, 0.3);
}

body.dark-mode .btn-danger {
  box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

/* Form inputs — focus */
body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

body.dark-mode .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

body.dark-mode .exercise-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

/* Filter pill active */
body.dark-mode .filter-pill.active {
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

/* Calendar today */
body.dark-mode .cal-day.today {
  border-color: var(--primary);
}

/* Toast */
body.dark-mode .toast {
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Modal */
body.dark-mode .modal {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.dark-mode .modal-close {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-close:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* Spinner */
body.dark-mode .spinner {
  border-color: rgba(239, 68, 68, 0.2);
  border-top-color: var(--primary);
}

/* Badges — dark mode */
body.dark-mode .badge-strength { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
body.dark-mode .badge-cardio { background: rgba(255, 184, 0, 0.12); color: #ffb800; border: 1px solid rgba(255, 184, 0, 0.2); }
body.dark-mode .badge-stretching { background: rgba(236, 72, 153, 0.12); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.2); }
body.dark-mode .badge-yoga { background: rgba(167, 139, 250, 0.12); color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.2); }
body.dark-mode .badge-swimming { background: rgba(14, 116, 144, 0.12); color: #22d3ee; border: 1px solid rgba(14, 116, 144, 0.2); }
body.dark-mode .badge-mixed { background: rgba(0, 200, 83, 0.12); color: #00C853; border: 1px solid rgba(0, 200, 83, 0.2); }
body.dark-mode .badge-other { background: rgba(158, 158, 158, 0.12); color: #9E9E9E; border: 1px solid rgba(158, 158, 158, 0.2); }

/* Tags */
body.dark-mode .tag {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Workout history items */
body.dark-mode .workout-history-item:hover {
  background: rgba(239, 68, 68, 0.06);
}

/* Outline button */
body.dark-mode .btn-outline {
  border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

/* Section Labels */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Sync Status Indicator */
.sync-status {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  z-index: 150;
  transition: all 0.3s;
  pointer-events: none;
}

.sync-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

.sync-synced {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.sync-syncing {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  background: #fef2f2;
  color: #DC2626;
}

.sync-offline {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  background: #fef3c7;
  color: #92400e;
  pointer-events: auto;
}

.sync-error {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  background: #fef2f2;
  color: #dc2626;
  pointer-events: auto;
  cursor: pointer;
}

body.dark-mode .sync-synced {
  background: rgba(0, 200, 83, 0.12);
  color: #00C853;
}

body.dark-mode .sync-syncing {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

body.dark-mode .sync-offline {
  background: rgba(255, 184, 0, 0.12);
  color: #ffb800;
}

body.dark-mode .sync-error {
  background: rgba(255, 68, 68, 0.12);
  color: #FF4444;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-logo {
  margin-bottom: 8px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 32px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--gray-100);
  border-radius: 12px;
  padding: 4px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.login-tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.login-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  display: none;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.login-btn:disabled {
  opacity: 0.6;
}

body.dark-mode .login-card {
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .login-btn {
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

body.dark-mode .login-error {
  background: rgba(255, 68, 68, 0.12);
  color: #FF4444;
}

/* ============ ACHIEVEMENTS ============ */
.achievement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.achievement-card {
  text-align: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: transform 0.15s;
}
.achievement-card:active { transform: scale(0.96); }
.achievement-card.locked { opacity: 0.35; filter: grayscale(1); }
.achievement-card.unlocked { box-shadow: 0 0 12px rgba(245,158,11,0.2); }
body.dark-mode .achievement-card {
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
body.dark-mode .achievement-card.unlocked { box-shadow: 0 0 12px rgba(245,158,11,0.15); }
.achievement-icon { font-size: 28px; margin-bottom: 4px; }
.achievement-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.achievement-toast {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: white !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============ HEATMAP ============ */
.heatmap-scroll { overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.heatmap-grid { display: flex; gap: 3px; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell { width: 12px; height: 12px; border-radius: 2px; transition: transform 0.15s; }
.heatmap-cell:hover { transform: scale(1.5); }
.heatmap-cell.l0 { background: var(--gray-200); }
.heatmap-cell.l1 { background: #fca5a5; }
.heatmap-cell.l2 { background: #ef4444; }
.heatmap-cell.l3 { background: #DC2626; }
body.dark-mode .heatmap-cell.l0 { background: var(--gray-300); }
body.dark-mode .heatmap-cell.l1 { background: rgba(239,68,68,0.3); }
body.dark-mode .heatmap-cell.l2 { background: rgba(239,68,68,0.6); }
body.dark-mode .heatmap-cell.l3 { background: #EF4444; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 11px; color: var(--text-secondary); }
.heatmap-day-labels { display: flex; flex-direction: column; gap: 3px; margin-right: 4px; font-size: 9px; color: var(--text-secondary); }
.heatmap-day-labels span { height: 12px; line-height: 12px; }

/* ============ WEEK COMPARISON ============ */
.week-compare { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.week-compare-card {
  text-align: center;
  padding: 14px 8px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
body.dark-mode .week-compare-card {
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.week-compare-label { font-size: 11px; color: var(--text-secondary); font-weight: 500; margin-bottom: 6px; }
.week-compare-value { font-size: 22px; font-weight: 700; color: var(--text); }
.week-compare-delta { font-size: 12px; font-weight: 600; margin-top: 4px; }
.week-compare-delta.up { color: var(--success); }
.week-compare-delta.down { color: var(--danger); }
.week-compare-delta.same { color: var(--text-secondary); }

/* ============ 1RM STYLES ============ */
.onerm-value { font-size: 18px; font-weight: 700; color: var(--primary); }
.onerm-formula { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

/* Responsive */
@media (max-width: 400px) {
  .container { padding: 12px; }
  header h1 { font-size: 20px; }
  .btn { padding: 12px 16px; font-size: 14px; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
  .timer-display { font-size: 36px; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
