body {
  min-height: 100vh;
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937, #020617);
  color: #e5e7eb;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.main-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1,
h2,
h3,
h4,
h5 {
  color: #f9fafb;
  letter-spacing: 0.01em;
}

p,
span,
li,
label {
  color: #e5e7eb;
}

.text-secondary {
  color: #cbd5f5 !important;
  opacity: 0.9;
}

.navbar {
  backdrop-filter: blur(18px);
  background: rgba(15, 23, 42, 0.92) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.32);
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  position: relative;
  z-index: 1100;
}

.navbar .container {
  max-width: 1100px;
}

.navbar-brand {
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #f9fafb;
  font-size: 0.9rem;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 9px;
  flex-shrink: 0;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-text-main {
  font-weight: 700;
}

.brand-text-sub {
  font-weight: 600;
  opacity: 0.9;
}

.nav-link {
  position: relative;
  font-weight: 500;
  color: #e5e7eb !important;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 2px;
  width: 0;
  background: #3b82f6;
  transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.navbar-dark .navbar-nav .nav-link {
  color: #e5e7eb;
}

.navbar-collapse {
  background: rgba(15, 23, 42, 0.98);
}

.dropdown,
.dropup,
.dropend,
.dropstart {
  position: relative;
}

.dropdown-menu {
  background: #0b1220 !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
  padding: 6px;
  z-index: 2200 !important;
  opacity: 1 !important;
  isolation: isolate;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.dropdown-item {
  color: #e5e7eb !important;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 500;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #f9fafb !important;
}

.dropdown-divider {
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.dropdown-item.text-danger {
  color: #fca5a5 !important;
}

.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
  background: rgba(220, 38, 38, 0.22) !important;
  color: #fee2e2 !important;
}

.theme-toggle-btn {
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(75, 85, 99, 0.95);
  color: #f9fafb;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
}

.profile-pill:hover {
  text-decoration: none;
}

.avatar-circle {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #f9fafb;
  font-weight: 600;
  margin-right: 6px;
}

.btn-primary {
  border-radius: 999px;
  background-color: #2563eb;
  border-color: #2563eb;
  color: #f9fafb;
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-outline-light {
  border-radius: 999px;
  border-color: rgba(148, 163, 184, 0.8);
  color: #e5e7eb;
}

.btn-outline-light:hover {
  background: #e5e7eb;
  color: #020617;
}

a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  text-decoration: underline;
}

.btn-pill {
  border-radius: 999px !important;
  padding-inline: 1.2rem;
}

.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  color: #e5e7eb;
  position: relative;
}

.hero h1 {
  font-size: clamp(1.9rem, 6.2vw, 3.2rem);
  font-weight: 800;
}

.hero p {
  font-size: clamp(1rem, 3.3vw, 1.25rem);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 480px;
  height: 480px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.4), transparent 60%);
  filter: blur(4px);
  z-index: -1;
}

.home-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.home-stat-card {
  background: rgba(15, 23, 42, 0.96);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.9);
  padding: 14px 16px;
}

.home-stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5f5;
}

.home-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f9fafb;
}

.home-hero {
  padding-top: 2.5rem;
}

.home-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
}

.home-hero-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5f5;
  opacity: 0.9;
}

.home-hero-metric {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: #f9fafb;
  margin-top: 0.2rem;
}

.home-hero-metric-sub {
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 0.4rem;
  color: #cbd5f5;
}

.home-hero-subtext {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: #cbd5f5;
}

.hero-cta-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.home-today-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 1.75rem;
}

.home-chip {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.home-chip-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5f5;
}

.home-chip-value {
  margin-top: 4px;
  font-weight: 700;
  color: #f9fafb;
}

.home-chip-unit {
  font-size: 0.8rem;
  margin-left: 0.25rem;
  color: #cbd5f5;
}

.home-last-workout .home-last-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5f5;
}

.home-last-workout .home-last-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f9fafb;
  margin-top: 4px;
}

.home-last-workout .home-last-meta {
  font-size: 0.86rem;
  color: #cbd5f5;
  margin-top: 2px;
}

.glass-card {
  background: rgba(15, 23, 42, 0.92);
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(14px);
  animation: fadeUp 0.35s ease-out;
}

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

.workout-card {
  background: rgba(15, 23, 42, 0.97);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease,
    background 0.18s ease;
}

.workout-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.95);
  border-color: #3b82f6;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), #020617);
}

.workout-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workout-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f9fafb;
}

.workout-meta {
  font-size: 0.87rem;
  color: #d1d5db;
}

.workout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-category {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.96);
}

.badge-push {
  background: rgba(37, 99, 235, 0.35);
  border-color: #60a5fa;
  color: #e5f2ff;
}
.badge-pull {
  background: rgba(129, 140, 248, 0.35);
  border-color: #a5b4fc;
  color: #e0e7ff;
}
.badge-legs {
  background: rgba(34, 197, 94, 0.35);
  border-color: #6ee7b7;
  color: #bbf7d0;
}
.badge-upper {
  background: rgba(59, 130, 246, 0.32);
  border-color: #93c5fd;
  color: #dbeafe;
}
.badge-lower {
  background: rgba(251, 146, 60, 0.32);
  border-color: #fed7aa;
  color: #ffedd5;
}
.badge-cardio {
  background: rgba(248, 113, 113, 0.32);
  border-color: #fecaca;
  color: #fee2e2;
}
.badge-core {
  background: rgba(244, 114, 182, 0.32);
  border-color: #f9a8d4;
  color: #fce7f3;
}
.badge-full {
  background: rgba(34, 197, 235, 0.32);
  border-color: #67e8f9;
  color: #cffafe;
}
.badge-other {
  background: rgba(31, 41, 55, 0.95);
  border-color: #6b7280;
  color: #f9fafb;
}

.badge-pr {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(249, 115, 22, 0.32);
  border: 1px solid #fdba74;
  color: #fed7aa;
  margin-left: 6px;
}

.streak-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 1.5rem;
}

.streak-card {
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.3), #020617);
  border-radius: 18px;
  border: 1px solid rgba(129, 140, 248, 0.8);
  padding: 16px 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.95);
}

.streak-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #c7d2fe;
}

.streak-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #f9fafb;
  margin-top: 6px;
}

.streak-subtext {
  font-size: 0.85rem;
  color: #cbd5f5;
}

.streak-bar-wrapper {
  margin-top: 10px;
}

.streak-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
  border: 1px solid rgba(129, 140, 248, 0.7);
}

.streak-bar-fill {
  height: 100%;
  background: linear-gradient(to right, #22c55e, #4ade80, #22c55e);
}

.calendar-shell {
  max-width: 900px;
  margin: 0 auto;
}

.calendar-streak-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.calendar-streak-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.calendar-streak-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c4d3ff;
}

.calendar-streak-value {
  font-weight: 700;
  color: #f9fafb;
  font-size: 0.98rem;
}

.calendar-streak-secondary {
  font-size: 0.86rem;
  color: #cbd5f5;
}

.calendar-nav-row {
  max-width: 520px;
  margin: 0 auto;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: #cbd5f5;
}

.calendar-weekdays div {
  padding-bottom: 4px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day {
  border-radius: 10px;
  text-align: center;
  font-size: 0.8rem;
  background: rgba(15, 23, 42, 0.97);
  color: #e5e7eb;
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 8px 0;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.calendar-day:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.95);
}

.calendar-day.has-workout {
  color: #f9fafb;
}

.calendar-day.intensity-1 {
  background: rgba(37, 99, 235, 0.3);
  border-color: #60a5fa;
}
.calendar-day.intensity-2 {
  background: rgba(37, 99, 235, 0.5);
  border-color: #60a5fa;
}
.calendar-day.intensity-3 {
  background: rgba(37, 99, 235, 0.85);
  border-color: #93c5fd;
}

.calendar-day.future-scheduled {
  background: rgba(34, 211, 238, 0.25);
  border-color: #22d3ee;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.55);
}

.calendar-day.today {
  box-shadow: 0 0 0 2px #f97316, 0 0 24px rgba(249, 115, 22, 0.55);
}

.calendar-day-outside {
  opacity: 0.35;
}

.form-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #e5e7eb;
}

.form-control,
.form-select {
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #f9fafb;
}

.form-control::placeholder {
  color: #9ca3af;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.6fr);
  gap: 18px;
}

.settings-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #cbd5f5;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.danger-zone {
  border-color: rgba(248, 113, 113, 0.7) !important;
  background: rgba(127, 29, 29, 0.85) !important;
  color: #fee2e2;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.library-card {
  background: rgba(15, 23, 42, 0.97);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 14px 16px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.9);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease,
    background 0.18s ease;
}

.library-card:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.95);
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.22), #020617);
}

.library-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f9fafb;
  margin-bottom: 4px;
}

.library-meta {
  font-size: 0.8rem;
  color: #cbd5f5;
  margin-bottom: 6px;
}

.library-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
}

.meal-card-shell {
  border-radius: 20px;
  padding: 14px 16px;
  max-width: 720px;
  margin: 0 auto;
}

.meal-table {
  width: 100%;
}

.meal-table thead tr th {
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5f5;
}

.meal-table tbody tr td {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

.meal-table tbody tr:last-child td {
  border-bottom: none;
}

.meal-macros {
  font-size: 0.86rem;
  color: #cbd5f5;
}

.app-footer {
  padding: 0.75rem 0;
  margin-top: 2rem;
  border-color: rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.85), #020617);
}

.app-footer-brand {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: #e5e7eb;
  opacity: 0.9;
}

.app-footer-meta {
  position: relative;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: #4ade80;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.app-footer-meta::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.9);
}

.footer-text {
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
}

.footer-text svg {
  vertical-align: middle;
  margin: 0 4px;
}

.d-none {
  display: none !important;
}

.app-loader {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-loader-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.5);
  border-top-color: #3b82f6;
  animation: spin 0.7s linear infinite;
}

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

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.toast-success {
  background: rgba(22, 163, 74, 0.96);
  color: #dcfce7;
}

.app-toast.toast-error {
  background: rgba(220, 38, 38, 0.96);
  color: #fee2e2;
}

.app-toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.workout-card.swipeable {
  position: relative;
  overflow: hidden;
}

.workout-card.swipeable .workout-actions {
  position: relative;
  transition: transform 0.18s ease;
}

.workout-card.swipeable.swiped-left .workout-actions {
  transform: translateX(-64px);
}

/* =========================
   ✅ LIGHT THEME (FIXED)
========================= */
body.theme-light {
  background: radial-gradient(circle at 30% 0%, rgba(59, 130, 246, 0.16), transparent 45%),
    linear-gradient(#f8fafc, #eef2ff);
  color: #0f172a;
}

body.theme-light h1,
body.theme-light h2,
body.theme-light h3,
body.theme-light h4,
body.theme-light h5 {
  color: #0f172a;
}

body.theme-light p,
body.theme-light span,
body.theme-light li,
body.theme-light label {
  color: #0f172a;
}

body.theme-light .text-secondary {
  color: #475569 !important;
  opacity: 1;
}

body.theme-light .hero {
  color: #0f172a;
}
body.theme-light .hero::before {
  background: radial-gradient(circle, rgba(37, 99, 235, 0.18), transparent 60%);
  filter: blur(10px);
}

/* ✅ NAVBAR FIX (light mode) */
body.theme-light .navbar {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid #d1d5db !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.theme-light .navbar-collapse {
  background: transparent !important;
}

body.theme-light .nav-link {
  color: #0f172a !important;
  font-weight: 800;
  opacity: 0.78;
}

body.theme-light .nav-link:hover {
  opacity: 1;
}

body.theme-light .nav-link::after {
  height: 3px;
  background: #2563eb;
}

body.theme-light .nav-link.active {
  opacity: 1;
}

/* ✅ ✅ HAMBURGER ICON FIX (light mode) */
body.theme-light .navbar .navbar-toggler {
  border-color: rgba(15, 23, 42, 0.25);
}

body.theme-light .navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(15, 23, 42, 0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body.theme-light .navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* ✅ pills/buttons in navbar */
body.theme-light .btn-outline-light {
  border-color: #d1d5db;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.96);
}

body.theme-light .btn-outline-light:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

body.theme-light .theme-toggle-btn {
  background: rgba(255, 255, 255, 0.96);
  border-color: #d1d5db;
  color: #0f172a;
}

/* ✅ cards pop more (slightly darker borders) */
body.theme-light .glass-card,
body.theme-light .workout-card,
body.theme-light .home-stat-card,
body.theme-light .home-chip,
body.theme-light .library-card,
body.theme-light .meal-table tbody tr,
body.theme-light .calendar-streak-pill,
body.theme-light .streak-card {
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: #d1d5db !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08) !important;
  color: #0f172a;
}

body.theme-light .home-stat-label,
body.theme-light .home-chip-label,
body.theme-light .home-hero-label,
body.theme-light .home-hero-subtext,
body.theme-light .home-last-workout .home-last-label,
body.theme-light .home-last-workout .home-last-meta,
body.theme-light .meal-macros,
body.theme-light .calendar-streak-label,
body.theme-light .calendar-weekdays,
body.theme-light .streak-label,
body.theme-light .streak-subtext {
  color: #475569 !important;
}

body.theme-light .home-stat-value,
body.theme-light .home-chip-value,
body.theme-light .home-hero-metric,
body.theme-light .workout-title,
body.theme-light .calendar-streak-value,
body.theme-light .streak-value {
  color: #0f172a !important;
}

body.theme-light .workout-meta {
  color: #475569 !important;
}

/* progress bars in light mode */
body.theme-light .streak-bar {
  background: rgba(15, 23, 42, 0.08);
  border-color: #d1d5db;
}

/* calendar */
body.theme-light .calendar-day {
  background: rgba(255, 255, 255, 0.94);
  border-color: #d1d5db;
  color: #0f172a;
}

body.theme-light .calendar-day.intensity-1 {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.30);
}
body.theme-light .calendar-day.intensity-2 {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(37, 99, 235, 0.38);
}
body.theme-light .calendar-day.intensity-3 {
  background: rgba(37, 99, 235, 0.34);
  border-color: rgba(37, 99, 235, 0.55);
}

body.theme-light .calendar-day.future-scheduled {
  background: rgba(34, 211, 238, 0.16);
  border-color: rgba(34, 193, 238, 0.40);
  color: #0f172a;
}

/* form inputs */
body.theme-light .form-control,
body.theme-light .form-select {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d1d5db;
  color: #0f172a;
}

body.theme-light .form-control::placeholder {
  color: #64748b;
}

/* profile pill */
body.theme-light .profile-pill {
  background: rgba(255, 255, 255, 0.96);
  border-color: #d1d5db;
  color: #0f172a;
}

/* badges in light mode */
body.theme-light .badge-category,
body.theme-light .library-tag {
  background: rgba(15, 23, 42, 0.04);
  border-color: #d1d5db;
  color: #0f172a;
}

/* footer */
body.theme-light .app-footer {
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid #d1d5db;
}

body.theme-light .app-footer-brand {
  color: #0f172a;
}

body.theme-light .app-footer-meta {
  color: #16a34a;
}

body.theme-light .footer-text {
  color: #475569;
}

/* dropdown in light mode */
body.theme-light .dropdown-menu {
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
}

body.theme-light .dropdown-item {
  color: #0f172a !important;
}

body.theme-light .dropdown-item:hover,
body.theme-light .dropdown-item:focus {
  background: rgba(37, 99, 235, 0.10) !important;
  color: #0f172a !important;
}

body.theme-light .dropdown-divider {
  border-top: 1px solid rgba(15, 23, 42, 0.10);
}

.workout-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 1rem;
}

.workout-filters .form-control,
.workout-filters .form-select {
  min-width: 180px;
}

.workout-filters .form-control {
  max-width: 260px;
}

@media (max-width: 767px) {
  .workout-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .workout-filters .form-control,
  .workout-filters .form-select {
    width: 100%;
  }
}

@media (max-width: 991px) {
  .home-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .streak-grid {
    grid-template-columns: 1fr;
  }

  .library-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 767px) {
  .hero {
    padding-top: 3rem;
  }

  .home-stats-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .calendar-shell {
    padding: 0 0.25rem;
  }

  .workout-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .workout-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .home-hero-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-cta-column {
    flex-direction: row;
    gap: 0.75rem;
  }

  .home-today-row {
    grid-template-columns: 1fr;
  }

  .meal-table thead {
    display: none;
  }

  .meal-table tbody tr {
    display: block;
    background: rgba(15, 23, 42, 0.97);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.9);
  }

  body.theme-light .meal-table tbody tr {
    background: rgba(255, 255, 255, 0.94) !important;
    border-color: #d1d5db !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08) !important;
  }

  .meal-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .meal-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: none;
    padding: 4px 0;
    font-size: 0.92rem;
  }

  .meal-table tbody td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-right: 0.75rem;
  }

  body.theme-light .meal-table tbody td::before {
    color: #64748b;
  }

  .meal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 4px;
  }
}

@media (max-width: 550px) {
  .home-stats-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 2.5rem;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    padding: 5px 0;
    font-size: 0.68rem;
  }
}

@media (max-width: 575px) {
  .main-shell {
    max-width: 100%;
    padding: 1rem 0.9rem 2.25rem;
  }

  .hero {
    padding: 2.6rem 0 2rem;
  }

  .btn,
  .btn-sm {
    min-height: 42px;
  }

  .meal-card-shell {
    max-width: 100%;
    width: 100%;
    padding: 12px 12px;
  }

  .form-control,
  .form-select {
    width: 100%;
  }

  .meal-table tbody tr {
    padding: 12px 12px;
  }

  .meal-table tbody td {
    white-space: normal;
    word-break: break-word;
    gap: 8px;
    align-items: flex-start;
  }

  .meal-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .meal-actions .btn,
  .meal-actions button {
    flex: 1 1 auto;
    min-width: 110px;
    padding: 10px 12px;
    border-radius: 999px;
  }
}

@media (max-width: 480px) {
  .main-shell {
    padding: 1rem 0.9rem 2.25rem;
  }

  .meal-card-shell {
    max-width: 100%;
    padding: 12px 12px;
  }

  .glass-card {
    border-radius: 16px;
  }

  .btn {
    width: 100%;
  }

  .btn + .btn {
    margin-top: 10px;
  }

  .form-control,
  .form-select {
    font-size: 16px;
  }
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

.brand-text-sub {
  color: #22c55e;
}

body.theme-light .brand-text-sub {
  color: #16a34a;
}

/* unified progress bars (fix for dark mode track visibility) */
.progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

body.theme-light .progress {
  background-color: rgba(15, 23, 42, 0.18);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background-color: #22c55e;
  transition: width 0.35s ease;
}

.fit-green {
  color: #22c55e;
  font-weight: 800;
}

/* =========================
   ✅ MOBILE NAV: ALWAYS SLIDE-OVER (no "switch")
========================= */
@media (max-width: 991.98px) {
  /* IMPORTANT: style the collapsed state too (prevents flash) */
  #mainNav.navbar-collapse,
  #mainNav.collapse {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(88vw, 360px);
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    padding: 88px 16px 22px;
    z-index: 2000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* start hidden off-screen */
    transform: translateX(100%);
    transition: transform 0.18s ease;
    display: block !important;
  }

  /* when opened */
  #mainNav.collapse.show,
  #mainNav.navbar-collapse.show {
    transform: translateX(0);
  }

  .navbar .navbar-toggler {
    position: relative;
    z-index: 2100;
  }

  #mainNav .navbar-nav {
    margin-top: 10px;
    gap: 6px;
  }

  #mainNav .nav-link {
    padding: 12px 12px;
    border-radius: 12px;
  }

  #mainNav .d-flex.align-items-center.gap-2 {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
    margin-top: 12px;
  }

  #mainNav .btn {
    width: 100%;
  }

  #mainNav .dropdown-menu {
    position: static !important;
    float: none !important;
    width: 100%;
    margin-top: 8px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
  }

  #mainNav .dropdown-item {
    padding: 12px 12px;
  }
}

/* ✅ Light mode navbar branding */
body.theme-light .navbar-brand,
body.theme-light .brand-wordmark,
body.theme-light .brand-text-main {
  color: #0f172a !important;
  opacity: 1 !important;
}

body.theme-light .navbar-brand:hover {
  color: #0f172a !important;
  text-decoration: none;
}

/* ✅ Light mode mobile drawer (your #mainNav fixed panel) */
@media (max-width: 991.98px) {
  body.theme-light #mainNav.collapse,
  body.theme-light #mainNav.navbar-collapse {
    background: rgba(255, 255, 255, 0.98) !important;
    border-left: 1px solid rgba(15, 23, 42, 0.12) !important;
  }

  body.theme-light #mainNav .dropdown-menu {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
  }

  body.theme-light #mainNav .nav-link {
    color: #0f172a !important;
    opacity: 0.85;
  }

  body.theme-light #mainNav .nav-link.active,
  body.theme-light #mainNav .nav-link:hover {
    opacity: 1;
  }
}

/* ✅ Auth buttons in mobile nav */
@media (max-width: 991.98px) {
  #mainNav .btn {
    min-height: 44px;
    font-weight: 700;
  }

  #mainNav .btn-outline-light {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.55);
  }

  body.theme-light #mainNav .btn-outline-light {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.18);
    color: #0f172a;
  }
}