:root {
  --primary: #00ff88;
  --primary-dark: #00cc6a;
  --on-primary: #000000;
  --neon-blue: #00f3ff;

  --bg: #000000;
  --card-bg: #18181b;
  --input-bg: #27272a;
  --nav-bg: rgba(24, 24, 27, 0.88);

  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --divider: #27272a;

  --failure: #ef4444;
  --success: #00ff88;
  --warm-up: #f59e0b;
  --drop-set: #3b82f6;
  --rest-day: #3f3f46;
  --rest-day-active: #3b82f6;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --primary: #10B981;
  --primary-dark: #059669;
  --on-primary: #ffffff;

  --bg: #F9FAFB;
  --card-bg: #FFFFFF;
  --input-bg: #F3F4F6;
  --nav-bg: rgba(255, 255, 255, 0.92);

  --text-main: #111827;
  --text-muted: #6B7280;
  --divider: #E5E7EB;

  --success: #10B981;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100dvh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.app-shell {
  max-width: 500px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px 20px calc(110px + env(safe-area-inset-bottom));
}

/* =========================================
   AUTH SCREENS (LOGIN / REGISTER / RESET)
   ========================================= */
.auth-wrapper {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.lang-pill {
  display: inline-flex;
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}

.lang-pill a,
.lang-pill button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9px;
  text-decoration: none;
  cursor: pointer;
}

.lang-pill a.active,
.lang-pill button.active {
  background: var(--primary);
  color: var(--on-primary);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
  margin-bottom: 14px;
  box-shadow: 0 0 28px rgba(0, 255, 136, 0.2);
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input {
  width: 100%;
  height: 48px;
  background: var(--input-bg);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 42px 0 42px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary);
}

.toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.btn-primary {
  width: 100%;
  height: 48px;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--failure);
}

.alert-success {
  background: rgba(0, 255, 136, 0.12);
  border: 1px solid rgba(0, 255, 136, 0.35);
  color: var(--primary);
}

.auth-links {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* =========================================
   HEADER & HOME CARDS
   ========================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.greeting-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.greeting-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: var(--on-primary);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--warm-up);
  font-size: 13px;
  font-weight: 700;
}

.week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.week-day span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.week-day.today span {
  color: var(--primary);
}

.day-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.week-day.today .day-circle {
  border: 1.5px solid var(--primary);
}

.quick-start-banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--on-primary);
  border-radius: 22px;
  padding: 20px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 124px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.quick-start-banner .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pill-dark {
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
}

.quick-start-banner .sub {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.85;
}

.quick-start-banner .title {
  font-size: 20px;
  font-weight: 900;
  margin-top: 2px;
}

/* =========================================
   MINI BARRA DE ENTRENAMIENTO ACTIVO
   ========================================= */
.mini-workout-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: calc(100% - 32px);
  max-width: 468px;
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 10px 14px;
  display: none;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  z-index: 95;
  text-decoration: none;
  color: var(--text-main);
}

.mini-workout-bar.visible {
  display: flex;
}

.mini-workout-bar.resting {
  border-color: var(--warm-up);
}

.mini-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mini-accent {
  width: 4px;
  height: 28px;
  border-radius: 4px;
  background: var(--primary);
  flex-shrink: 0;
}

.mini-title {
  font-size: 12px;
  font-weight: 700;
}

.mini-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-timer {
  background: var(--input-bg);
  padding: 6px 11px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 13px;
}

/* =========================================
   MENÚ INFERIOR FLOTANTE (4 PESTAÑAS)
   ========================================= */
.floating-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: calc(100% - 32px);
  max-width: 468px;
  height: 68px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--divider);
  border-radius: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 100;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-item svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
  background: rgba(0, 255, 136, 0.08);
}

[data-theme="light"] .nav-item.active {
  background: rgba(16, 185, 129, 0.1);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 16px;
  height: 3px;
  border-radius: 99px;
  background: var(--primary);
}

/* =========================================
   PERFIL & PREFERENCIAS
   ========================================= */
.list-card {
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid var(--divider);
  font-size: 15px;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-row-left svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.list-row.danger,
.list-row.danger svg {
  color: var(--failure);
}

/* Switch moderno */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: var(--input-bg);
  border-radius: 99px;
  cursor: pointer;
  transition: 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: var(--text-main);
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--on-primary);
}