/* ============================================================
   GymTracker Pro — Complete Design System
   Mobile-first, dark premium theme
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --c-bg: #0a0a0f;
  --c-surface: #13131d;
  --c-surface-2: #1c1c2e;
  --c-surface-3: #252538;
  --c-border: rgba(255,255,255,0.07);
  --c-border-strong: rgba(255,255,255,0.13);

  --c-accent: #ff6b35;
  --c-accent-hover: #ff8555;
  --c-accent-glow: rgba(255,107,53,0.25);
  --c-accent-subtle: rgba(255,107,53,0.1);

  --c-purple: #8b5cf6;
  --c-purple-glow: rgba(139,92,246,0.25);
  --c-purple-subtle: rgba(139,92,246,0.1);

  --c-blue: #3b82f6;
  --c-blue-subtle: rgba(59,130,246,0.12);
  --c-green: #22c55e;
  --c-green-subtle: rgba(34,197,94,0.12);
  --c-red: #ef4444;
  --c-red-subtle: rgba(239,68,68,0.12);
  --c-yellow: #f59e0b;
  --c-yellow-subtle: rgba(245,158,11,0.12);

  --c-text: #f0f0ff;
  --c-text-secondary: #8888aa;
  --c-text-muted: #55556a;

  --nav-h: 72px;
  --header-h: 58px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --radius-full: 999px;

  --shadow-sm: 0 2px 12px rgba(0,0,0,0.3);
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
  --shadow-accent: 0 4px 24px var(--c-accent-glow);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --t: 0.2s ease;
  --t-spring: 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 0; height: 0; }

/* --- App Shell --- */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* --- Gradient Orbs --- */
.gradient-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.07;
  z-index: 0;
}

.gradient-orb-1 {
  width: 320px;
  height: 320px;
  background: var(--c-accent);
  top: -120px;
  right: -80px;
  animation: orb-float 8s ease-in-out infinite;
}

.gradient-orb-2 {
  width: 280px;
  height: 280px;
  background: var(--c-purple);
  bottom: 80px;
  left: -100px;
  animation: orb-float 10s ease-in-out infinite reverse;
}

@keyframes orb-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(20px); }
}

/* --- App Header --- */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-h);
  background: rgba(10,10,15,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--c-border);
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo { font-size: 22px; }

.app-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff 0%, var(--c-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* --- Main Content --- */
.app-main {
  margin-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + 12px);
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  position: relative;
  z-index: 1;
}

.view {
  width: 100%;
  padding: 20px 16px;
  animation: viewFadeIn 0.3s ease;
}

.view.hidden { display: none !important; }

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

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: rgba(13,13,20,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--c-text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--t);
  min-width: 56px;
  font-family: var(--font);
  position: relative;
}

.nav-item span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: color var(--t);
}

.nav-icon {
  width: 22px;
  height: 22px;
  transition: transform var(--t);
  flex-shrink: 0;
}

.nav-item.active { color: var(--c-accent); }
.nav-item.active .nav-icon { transform: scale(1.1); }

.nav-item--center {
  position: relative;
  top: -10px;
  color: var(--c-text-secondary);
}

.nav-center-btn {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--c-accent) 0%, #ff3d00 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-accent), 0 0 0 0 var(--c-accent-glow);
  transition: transform var(--t), box-shadow var(--t);
}

.nav-item--center .nav-icon {
  color: white;
  width: 28px;
  height: 28px;
}

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

.nav-item--center.active .nav-center-btn {
  box-shadow: var(--shadow-accent), 0 0 0 4px rgba(255,107,53,0.2);
}

/* --- Cards --- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--t);
}

.stat-card:active { transform: scale(0.97); }

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-color, var(--c-accent));
  opacity: 0.7;
}

.stat-value {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  color: var(--c-text);
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 10px;
  color: var(--c-text-secondary);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

/* --- Section Headers --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
}

.section-action {
  font-size: 13px;
  color: var(--c-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  padding: 4px 0;
}

/* --- Welcome strip --- */
.welcome-strip {
  padding: 4px 0 20px;
}

.welcome-greeting {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 3px;
  line-height: 1.2;
}

.welcome-sub {
  font-size: 13px;
  color: var(--c-text-secondary);
}

/* --- Weekly bar chart --- */
.weekly-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 80px;
  padding: 0 2px;
  margin: 14px 0 4px;
}

.weekly-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
}

.weekly-bar-fill {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.weekly-bar {
  width: 100%;
  background: linear-gradient(to top, var(--c-accent), #ff8555);
  border-radius: 4px 4px 2px 2px;
  min-height: 0;
  transition: height 0.6s cubic-bezier(0.34,1.56,0.64,1);
}

.weekly-bar.current { box-shadow: 0 0 14px var(--c-accent-glow); }
.weekly-bar.empty { background: var(--c-surface-3); }

.weekly-bar-label {
  font-size: 10px;
  color: var(--c-text-muted);
  font-weight: 600;
}

/* --- Workout Cards --- */
.workout-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), transform 0.1s ease;
  position: relative;
  overflow: hidden;
}

.workout-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 50%);
  pointer-events: none;
}

.workout-card:active { transform: scale(0.99); background: var(--c-surface-2); }

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

.workout-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  flex: 1;
  line-height: 1.3;
}

.workout-card-date-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.workout-card-date {
  font-size: 12px;
  color: var(--c-text-secondary);
  background: var(--c-surface-2);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.workout-card-time {
  font-size: 10px;
  color: var(--c-text-muted);
}

.workout-card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.workout-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--c-text-secondary);
}

.workout-meta-item svg { width: 13px; height: 13px; opacity: 0.7; }

/* Workout detail (expanded) */
.workout-card-exercises {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}

.workout-card.expanded .workout-card-exercises { display: block; }

.workout-exercise-item { margin-bottom: 16px; }

.workout-exercise-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 6px;
}

.workout-sets-table {
  width: 100%;
  border-collapse: collapse;
}

.workout-sets-table th {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-align: left;
  padding: 0 4px 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.workout-sets-table td {
  font-size: 13px;
  color: var(--c-text);
  padding: 4px 4px;
  vertical-align: middle;
}

.workout-sets-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

/* --- Set Badges --- */
.set-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.set-badge.normal  { background: var(--c-surface-3); color: var(--c-text-secondary); }
.set-badge.warmup  { background: var(--c-blue-subtle); color: var(--c-blue); }
.set-badge.failure { background: var(--c-red-subtle); color: var(--c-red); }
.set-badge.dropset { background: var(--c-purple-subtle); color: var(--c-purple); }

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 11px 14px;
  gap: 10px;
  margin-bottom: 16px;
  transition: border-color var(--t);
}

.search-bar:focus-within { border-color: var(--c-accent); }

.search-bar svg { width: 18px; height: 18px; color: var(--c-text-muted); flex-shrink: 0; }

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--c-text);
  font-size: 15px;
  font-family: var(--font);
}

.search-input::placeholder { color: var(--c-text-muted); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: 0.1px;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--c-accent) 0%, #ff3d00 100%);
  color: white;
  box-shadow: var(--shadow-accent);
}

.btn-secondary {
  background: var(--c-surface-2);
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
}

.btn-secondary:hover { background: var(--c-surface-3); }

.btn-ghost {
  background: none;
  color: var(--c-accent);
  padding: 8px 12px;
}

.btn-danger {
  background: var(--c-red-subtle);
  color: var(--c-red);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-block { width: 100%; }

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  gap: 5px;
}

.btn-lg {
  padding: 16px 24px;
  font-size: 16px;
  border-radius: var(--radius-lg);
  letter-spacing: -0.2px;
}

.btn svg { width: 18px; height: 18px; }
.btn-sm svg { width: 15px; height: 15px; }

/* --- Filter Chips --- */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-secondary);
  cursor: pointer;
  transition: all var(--t);
  font-family: var(--font);
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: white;
  box-shadow: 0 0 12px var(--c-accent-glow);
}

/* --- Tags --- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tag-accent  { background: var(--c-accent-subtle); color: var(--c-accent); }
.tag-purple  { background: var(--c-purple-subtle); color: var(--c-purple); }
.tag-green   { background: var(--c-green-subtle); color: var(--c-green); }
.tag-blue    { background: var(--c-blue-subtle); color: var(--c-blue); }
.tag-red     { background: var(--c-red-subtle); color: var(--c-red); }
.tag-yellow  { background: var(--c-yellow-subtle); color: var(--c-yellow); }

/* --- Form Elements --- */
.form-input {
  width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-size: 15px;
  font-family: var(--font);
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--t);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus { border-color: var(--c-accent); }
.form-input::placeholder { color: var(--c-text-muted); }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 52px;
  margin-bottom: 16px;
  display: block;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--c-text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Chart container --- */
.chart-container {
  position: relative;
  height: 200px;
  margin: 8px 0 12px;
}

/* --- Modal / Bottom Sheet --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.hidden { display: none !important; }

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--c-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 8px 0 32px;
  border-top: 1px solid var(--c-border-strong);
  animation: slideUp var(--t-spring);
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.modal-close-x {
  position: absolute;
  top: -8px;
  right: 14px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-strong);
  color: var(--c-text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 210;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}

.modal-close-x:active {
  transform: scale(0.9);
  background: var(--c-surface-3);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 38px;
  height: 4px;
  background: var(--c-border-strong);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-content {
  padding: 0 20px;
  position: relative;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-top: 6px;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
  padding-right: 44px; /* Leave space for close button */
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-strong);
  color: var(--c-text);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  animation: toastSlide 0.3s ease;
  pointer-events: none;
}

.toast.hidden { display: none; }

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Active Workout View --- */
.workout-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}

.workout-timer {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  color: var(--c-accent);
  min-width: 80px;
  text-align: center;
}

.workout-name-input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  outline: none;
  color: var(--c-text);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  padding: 4px 2px;
  text-align: center;
  transition: border-color var(--t);
}

.workout-name-input:focus { border-bottom-color: var(--c-accent); }

/* --- Exercise Block --- */
.exercise-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.exercise-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-border);
  background: rgba(255,255,255,0.02);
}

.exercise-block-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  flex: 1;
}

.icon-btn {
  background: var(--c-surface-2);
  border: none;
  color: var(--c-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
  flex-shrink: 0;
}

.icon-btn:hover, .icon-btn:active { background: var(--c-surface-3); color: var(--c-red); }
.icon-btn svg { width: 16px; height: 16px; }

.exercise-sets-container { padding: 8px 14px 14px; }

/* Set rows */
.set-row-header {
  display: grid;
  grid-template-columns: 34px 50px 1fr 1fr 38px;
  gap: 6px;
  padding: 3px 0 6px;
}

.set-row-header span {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.set-row {
  display: grid;
  grid-template-columns: 34px 50px 1fr 1fr 38px;
  gap: 6px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--c-border);
  transition: opacity var(--t);
}

.set-row:last-of-type { border-bottom: none; }
.set-row.done-row { opacity: 0.6; }

.set-row-num {
  display: flex;
  justify-content: center;
}

.prev-best {
  font-size: 11px;
  color: var(--c-text-muted);
  text-align: center;
  line-height: 1.3;
}

.set-input {
  width: 100%;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  color: var(--c-text);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  padding: 9px 4px;
  text-align: center;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--t), background var(--t);
}

.set-input:focus { border-color: var(--c-accent); background: var(--c-surface-3); }

input[type=number].set-input::-webkit-inner-spin-button,
input[type=number].set-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.set-check-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
}

.set-check-btn svg { width: 18px; height: 18px; }

.set-check-btn.done {
  background: var(--c-green-subtle);
  border-color: rgba(34,197,94,0.35);
  color: var(--c-green);
}

.add-set-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px dashed var(--c-border-strong);
  border-radius: 10px;
  color: var(--c-accent);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--t);
  margin-top: 10px;
}

.add-set-btn:hover { background: var(--c-accent-subtle); border-color: var(--c-accent); }

/* --- Rest Timer Overlay --- */
.rest-timer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 250;
  animation: viewFadeIn 0.25s ease;
}

.rest-timer-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.rest-timer-ring {
  position: relative;
  width: 210px;
  height: 210px;
  margin-bottom: 28px;
}

.rest-timer-ring svg { transform: rotate(-90deg); }

.rest-timer-circle-bg  { fill: none; stroke: var(--c-surface-3); stroke-width: 8; }
.rest-timer-circle-fill {
  fill: none;
  stroke: var(--c-accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 8px var(--c-accent-glow));
}

.rest-timer-countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.rest-timer-seconds {
  font-size: 58px;
  font-weight: 900;
  letter-spacing: -3px;
  color: var(--c-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rest-timer-total {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-top: 4px;
}

.rest-timer-actions {
  display: flex;
  gap: 12px;
}

/* --- Import View --- */
.import-dropzone {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  background: var(--c-surface);
  position: relative;
}

.import-dropzone.drag-over {
  border-color: var(--c-accent);
  background: var(--c-accent-subtle);
}

.import-dropzone-icon { font-size: 48px; margin-bottom: 14px; display: block; }
.import-dropzone-title { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.import-dropzone-subtitle { font-size: 13px; color: var(--c-text-secondary); margin-bottom: 18px; }

.import-preview {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
}

.import-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.import-preview-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 14px;
}

.import-preview-stat:last-child { border-bottom: none; }
.import-preview-stat-value { font-weight: 800; color: var(--c-accent); }

/* --- Exercise List --- */
.exercise-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  transition: opacity var(--t);
}

.exercise-list-item:last-child { border-bottom: none; }
.exercise-list-item:active { opacity: 0.7; }

.exercise-list-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 2px;
}

.exercise-list-meta {
  font-size: 12px;
  color: var(--c-text-muted);
}

.exercise-list-arrow { color: var(--c-text-muted); width: 18px; height: 18px; flex-shrink: 0; }

/* --- Exercise search in modal --- */
.exercise-search-list {
  max-height: 45vh;
  overflow-y: auto;
}

.exercise-search-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text);
  transition: color var(--t), padding-left var(--t);
}

.exercise-search-item:last-child { border-bottom: none; }
.exercise-search-item:active { color: var(--c-accent); padding-left: 6px; }

/* --- Stat row --- */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 14px;
}

.stat-row:last-child { border-bottom: none; }
.stat-row-label { color: var(--c-text-secondary); }
.stat-row-value { font-weight: 700; }

/* --- Dividers --- */
.divider {
  height: 1px;
  background: var(--c-border);
  margin: 12px 0;
}

/* --- Month header in history --- */
.month-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 0 8px;
}

/* --- Utilities --- */
.text-accent   { color: var(--c-accent); }
.text-muted    { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }
.text-green    { color: var(--c-green); }
.text-red      { color: var(--c-red); }
.font-bold     { font-weight: 700; }
.font-black    { font-weight: 900; }
.flex          { display: flex; }
.flex-between  { display: flex; justify-content: space-between; align-items: center; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.gap-8         { gap: 8px; }
.gap-12        { gap: 12px; }
.mt-8          { margin-top: 8px; }
.mt-12         { margin-top: 12px; }
.mt-16         { margin-top: 16px; }
.mt-20         { margin-top: 20px; }
.mb-8          { margin-bottom: 8px; }
.mb-12         { margin-bottom: 12px; }
.mb-16         { margin-bottom: 16px; }
.mb-20         { margin-bottom: 20px; }
.w-full        { width: 100%; }
.text-center   { text-align: center; }
.hidden        { display: none !important; }

/* --- Spinner --- */
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--c-surface-3);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 24px auto;
}

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

/* --- Info card --- */
.info-card {
  background: var(--c-accent-subtle);
  border: 1px solid rgba(255,107,53,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--c-text);
  line-height: 1.5;
}

/* --- Edit mode: 4-col set row --- */
.set-row-4 {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 38px;
  gap: 6px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--c-border);
}

.set-row-4:last-of-type { border-bottom: none; }

.set-row-header-4 {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 38px;
  gap: 6px;
  padding: 3px 0 6px;
}

.set-row-header-4 span {
  font-size: 10px;
  font-weight: 700;
  color: var(--c-text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   Login Screen
   ============================================================ */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  padding: 20px;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.login-orb-1 {
  width: 350px; height: 350px;
  background: var(--c-accent); opacity: 0.11;
  top: -100px; right: -80px;
  animation: orb-float 8s ease-in-out infinite;
}
.login-orb-2 {
  width: 300px; height: 300px;
  background: var(--c-purple); opacity: 0.1;
  bottom: -80px; left: -60px;
  animation: orb-float 10s ease-in-out infinite reverse;
}
.login-orb-3 {
  width: 200px; height: 200px;
  background: var(--c-blue); opacity: 0.07;
  top: 40%; left: 50%; transform: translate(-50%,-50%);
  animation: orb-float 7s ease-in-out infinite 1s;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(19, 19, 29, 0.9);
  border: 1px solid var(--c-border-strong);
  border-radius: 28px;
  padding: 36px 28px 28px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04) inset;
  animation: loginCardIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  z-index: 1;
}

@keyframes loginCardIn {
  from { opacity:0; transform: scale(0.92) translateY(20px); }
  to   { opacity:1; transform: scale(1)    translateY(0); }
}

.login-card.shake { animation: shake 0.45s ease; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

.login-brand { text-align: center; margin-bottom: 32px; }

.login-logo-circle {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--c-accent) 0%, #ff3d00 100%);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 32px var(--c-accent-glow);
}

.login-app-name {
  font-size: 26px; font-weight: 900; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--c-accent) 120%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 6px;
}

.login-tagline { font-size: 13px; color: var(--c-text-muted); }

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-field { position: relative; display: flex; align-items: center; }

.login-field-icon {
  position: absolute; left: 14px;
  width: 18px; height: 18px;
  color: var(--c-text-muted);
  pointer-events: none;
}

.login-input {
  width: 100%;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  font-size: 15px; font-family: var(--font);
  padding: 13px 44px 13px 44px;
  outline: none;
  transition: border-color var(--t), background var(--t);
  -webkit-appearance: none;
}
.login-input:focus { border-color: var(--c-accent); background: var(--c-surface-3); }
.login-input::placeholder { color: var(--c-text-muted); }

.login-eye {
  position: absolute; right: 12px;
  background: none; border: none;
  color: var(--c-text-muted); cursor: pointer;
  padding: 4px;
  display: flex; align-items: center;
  transition: color var(--t);
}
.login-eye:hover { color: var(--c-text); }

.login-error {
  background: var(--c-red-subtle);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  color: var(--c-red);
  font-size: 13px; font-weight: 500;
  padding: 10px 14px; text-align: center;
  animation: viewFadeIn 0.25s ease;
}

.login-submit { margin-top: 4px; height: 52px; font-size: 16px; letter-spacing: -0.2px; }

.login-footer {
  text-align: center; color: var(--c-text-muted);
  font-size: 11px; margin-top: 24px; letter-spacing: 0.5px;
}

/* ============================================================
   Header: user chip + admin icon button
   ============================================================ */
.header-user-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-full);
  padding: 5px 12px 5px 6px;
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
  max-width: 140px;
}
.header-user-chip:active { background: var(--c-surface-3); }

.header-user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent) 0%, #ff3d00 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900; color: white; flex-shrink: 0;
}

.header-user-name {
  font-size: 13px; font-weight: 600; color: var(--c-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.header-icon-btn {
  width: 36px; height: 36px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--c-text-secondary);
  transition: background var(--t), color var(--t), border-color var(--t);
  flex-shrink: 0;
}
.header-icon-btn:hover,
.header-icon-btn:active {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  border-color: rgba(255,107,53,0.3);
}
