@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────────────── */
:root {
  --g1: #0a3d1f;
  --g2: #1a5c32;
  --g3: #2e7d46;
  --g4: #43a05a;
  --g5: #6abf7b;
  --g6: #a8e0b0;
  --accent: #f0c040;
  --accent2: #ff6b35;
  --danger: #e53935;
  --bg: #071510;
  --bg2: #0e2218;
  --bg3: #152d20;
  --surface: #1a3328;
  --surface2: #213d2f;
  --border: rgba(255,255,255,0.08);
  --text: #e8f5e9;
  --text2: #a5c8ac;
  --text3: #5a8a65;
  --white: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.3);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

/* ── RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;  /* prevent pull-to-refresh */
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;  /* prevent pull-to-refresh on body */
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); border: none; outline: none; }
input, textarea, select { font-family: var(--font-body); outline: none; }
ul, ol { list-style: none; }

/* ── HIDDEN/SHOW ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

/* ── SCROLLBAR ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--g3); border-radius: 2px; }

/* ── TYPOGRAPHY ────────────────────────────────────────────────── */
.display { font-family: var(--font-display); letter-spacing: 0.03em; }
.mono { font-family: var(--font-mono); }
h1,h2,h3,h4 { line-height: 1.2; }

/* ── LAYOUT UTILS ──────────────────────────────────────────────── */
.container { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.relative { position: relative; }

/* ── BACKGROUND MESH ───────────────────────────────────────────── */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(46,125,70,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 10% 80%, rgba(26,92,50,0.14) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(10,61,31,0.10) 0%, transparent 70%);
}

/* ── CARD ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.14); }
.card-sm { padding: 14px 16px; border-radius: var(--radius-sm); }

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; border-radius: 50px; font-size: 15px; font-weight: 600;
  transition: var(--transition); letter-spacing: 0.02em;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: var(--transition);
}
.btn:active::after { background: rgba(255,255,255,0.1); }
.btn-primary {
  background: linear-gradient(135deg, var(--g3), var(--g4));
  color: var(--white);
  box-shadow: 0 4px 20px rgba(46,125,70,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(46,125,70,0.5); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent), #e8a020);
  color: var(--bg);
  box-shadow: 0 4px 20px rgba(240,192,64,0.35);
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(240,192,64,0.45); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--g3);
  color: var(--g5);
}
.btn-outline:hover { background: var(--surface2); }
.btn-ghost {
  background: var(--surface); color: var(--text2);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #c62828); color: white; }
.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn-lg { padding: 18px 40px; font-size: 17px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── FORM ELEMENTS ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; color: var(--text2); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
}
.form-input:focus { border-color: var(--g3); background: var(--surface); box-shadow: 0 0 0 3px rgba(46,125,70,0.15); }
.form-input::placeholder { color: var(--text3); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 90px; line-height: 1.5; }

/* ── BADGE ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 50px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-green { background: rgba(46,125,70,0.25); color: var(--g5); border: 1px solid rgba(46,125,70,0.3); }
.badge-yellow { background: rgba(240,192,64,0.2); color: var(--accent); border: 1px solid rgba(240,192,64,0.3); }
.badge-red { background: rgba(229,57,53,0.2); color: #ef9a9a; border: 1px solid rgba(229,57,53,0.3); }
.badge-blue { background: rgba(30,136,229,0.2); color: #90caf9; border: 1px solid rgba(30,136,229,0.3); }

/* ── PROGRESS BAR ──────────────────────────────────────────────── */
.progress-bar {
  width: 100%; height: 6px;
  background: var(--bg3); border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--g3), var(--g5));
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

/* ── CHECKBOX ──────────────────────────────────────────────────── */
.set-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1.5px solid var(--border);
  cursor: pointer; transition: var(--transition); user-select: none;
}
.set-check.checked {
  background: rgba(46,125,70,0.2);
  border-color: var(--g3);
}
.set-check .check-box {
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid var(--text3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.set-check.checked .check-box {
  background: var(--g3); border-color: var(--g3); color: white;
}
.set-check .check-label { font-size: 14px; color: var(--text2); }
.set-check.checked .check-label { color: var(--text); }

/* ── GYM SET ROWS (no checkbox, plain text) ─────────────────────── */
.set-row-gym {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  margin-bottom: 0;
}
.set-row-label {
  font-size: 13px; font-weight: 600; color: var(--g5);
  font-family: var(--font-mono);
}
.set-row-reps {
  font-size: 13px; color: var(--text2); font-weight: 500;
}

/* ── TABS ──────────────────────────────────────────────────────── */
.tab-strip {
  display: flex; gap: 4px; overflow-x: auto; padding: 0 0 4px;
  touch-action: manipulation; /* allows clicks + horizontal scroll; blocks only pinch-zoom */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.tab-strip::-webkit-scrollbar { display: none; }

/* Rest timer / auto-pause slide-up animation */
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
.tab-btn {
  flex-shrink: 0; padding: 8px 18px; border-radius: 50px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.03em;
  background: var(--surface); color: var(--text3);
  border: 1.5px solid var(--border); transition: var(--transition);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--g2), var(--g3));
  color: var(--white); border-color: transparent;
  box-shadow: 0 2px 12px rgba(46,125,70,0.35);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Module inner tabs */
.module-tab-content { display: none; }
.module-tab-content.active { display: block; }

/* Run tabs */
.run-tab-content { display: none; }
.run-tab-content.active { display: block; }

/* ── BOTTOM NAV ────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(14,34,24,0.95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px 4px; cursor: pointer; transition: var(--transition);
  background: none; border: none; color: var(--text3); font-size: 11px;
  font-family: var(--font-body); font-weight: 500;
}
.nav-item .nav-icon { font-size: 20px; transition: var(--transition); }
.nav-item.active { color: var(--g5); }
.nav-item.active .nav-icon { transform: scale(1.15); }

/* ── TOP BAR ───────────────────────────────────────────────────── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 0; position: sticky; top: 0; z-index: 50;
  background: linear-gradient(to bottom, var(--bg) 80%, transparent);
}
.top-bar-title { font-size: 20px; font-weight: 700; }
.back-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text2); cursor: pointer; transition: var(--transition);
}
.back-btn:hover { background: var(--surface2); color: var(--text); }

/* ── MODULE CARD ───────────────────────────────────────────────── */
.module-card {
  border-radius: var(--radius-lg); padding: 22px 20px;
  position: relative; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); transition: var(--transition);
  min-height: 110px; display: flex; flex-direction: column; justify-content: space-between;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.module-card:active { transform: scale(0.97); }
.module-card .module-emoji { font-size: 32px; line-height: 1; margin-bottom: 10px; }
.module-card .module-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.module-card .module-sub { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 3px; }
.module-card .module-bg {
  position: absolute; right: -10px; top: -10px;
  font-size: 80px; opacity: 0.08; line-height: 1; pointer-events: none;
}
.module-card .done-ring {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
}

/* ── EXERCISE CARD ─────────────────────────────────────────────── */
.exercise-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: var(--transition);
}
.exercise-card.completed { border-color: var(--g3); }
.exercise-thumb {
  width: 100%; height: 160px; object-fit: cover; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--text3);
}
.exercise-thumb img { width: 100%; height: 100%; object-fit: cover; }
.exercise-body { padding: 16px; }
.exercise-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.exercise-meta { display: flex; gap: 12px; margin-bottom: 10px; }
.exercise-meta span {
  font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 4px;
  background: var(--bg3); padding: 3px 10px; border-radius: 50px;
}
.exercise-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 14px; }
.demo-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--g5); font-weight: 500;
  padding: 6px 14px; background: rgba(46,125,70,0.15);
  border-radius: 50px; border: 1px solid rgba(46,125,70,0.25);
  margin-bottom: 14px; transition: var(--transition);
}
.demo-link:hover { background: rgba(46,125,70,0.25); }
.sets-grid { display: flex; flex-direction: column; gap: 6px; }

/* ── CALENDAR ──────────────────────────────────────────────────── */
.cal-grid {
  display: grid; grid-template-columns: repeat(7,1fr); gap: 4px;
}
.cal-day {
  aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600;
  background: var(--bg3); color: var(--text3); transition: var(--transition);
}
.cal-day.completed { background: var(--g3); color: white; }
.cal-day.today { border: 2px solid var(--accent); color: var(--accent); }
.cal-day.header { background: transparent; font-size: 10px; color: var(--text3); text-transform: uppercase; }

/* ── STAT CARD ─────────────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 10px; text-align: center;
  min-width: 0; overflow: hidden;
}
.stat-val { font-family: var(--font-display); font-size: 30px; color: var(--g5); line-height: 1; word-break: break-all; }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.3; }

/* ── TOAST ─────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 50px; padding: 12px 24px; font-size: 14px; font-weight: 500;
  z-index: 9999; opacity: 0; transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  white-space: nowrap; max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { border-color: var(--g3); color: var(--g6); }
#toast.error { border-color: var(--danger); color: #ef9a9a; }
#toast.info { border-color: var(--accent); color: var(--accent); }

/* ── MODAL ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  width: 100%; max-width: 480px;
  background: var(--bg2); border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid var(--border); border-bottom: none;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 20px;
}
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

/* ── LOADER ────────────────────────────────────────────────────── */
.loader {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--surface2);
  border-top-color: var(--g4);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
}

/* ── DIVIDER ───────────────────────────────────────────────────── */
.divider {
  height: 1px; background: var(--border); margin: 16px 0;
}
.section-title {
  font-size: 12px; font-weight: 700; color: var(--text3);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px;
}

/* ── ANIMATIONS ────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
.animate-in { animation: fadeUp 0.4s cubic-bezier(0.4,0,0.2,1) both; }
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}
@keyframes fadeDown {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(10px); }
}
@keyframes confettiFall {
  0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
.animate-in-1 { animation-delay: 0.05s; }
.animate-in-2 { animation-delay: 0.10s; }
.animate-in-3 { animation-delay: 0.15s; }
.animate-in-4 { animation-delay: 0.20s; }
.animate-in-5 { animation-delay: 0.25s; }

/* ── RUNNING SPECIFIC ──────────────────────────────────────────── */
.run-timer {
  font-family: var(--font-display); font-size: 72px; color: var(--white);
  letter-spacing: 0.04em; line-height: 1; text-align: center;
}
.run-stat { text-align: center; }
.run-stat .val { font-family: var(--font-display); font-size: 28px; color: var(--g5); line-height: 1; }
.run-stat .lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* Activity type pill selector */
.activity-pill {
  flex: 1; padding: 10px 6px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.activity-pill.active {
  border-color: var(--g4); background: rgba(46,125,70,0.2); color: var(--g5);
}

/* Leaflet map z-index fixes inside our app */
.leaflet-pane         { z-index: 1 !important; }
.leaflet-top,
.leaflet-bottom       { z-index: 2 !important; }
.leaflet-control      { z-index: 2 !important; }

/* Live map container: pointer-events ON — map handles its own touches.
   The stats panel sits in a sibling with z-index:20 and pointer-events:auto,
   so button taps reach the buttons. Map gets everything else. */
#run-live-map { pointer-events: auto; }

/* Summary map: also fully interactive */
#run-detail-map { pointer-events: auto; }

/* Zoom buttons overlay on live map */
.run-zoom-btn {
  width: 40px; height: 40px;
  background: rgba(7,21,16,0.88);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; touch-action: manipulation;
  backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}

/* ── SCROLLABLE CONTENT ────────────────────────────────────────── */
.scroll-content {
  flex: 1; overflow-y: auto; padding-bottom: 100px;
}

/* ── STREAK PILL ───────────────────────────────────────────────── */
.streak-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, rgba(240,192,64,0.15), rgba(240,192,64,0.08));
  border: 1px solid rgba(240,192,64,0.25);
  border-radius: 50px; padding: 6px 14px;
  font-size: 14px; font-weight: 600; color: var(--accent);
}

/* ── PLAN CARD ─────────────────────────────────────────────────── */
.plan-card {
  border-radius: var(--radius); overflow: hidden;
  border: 1.5px solid var(--border); cursor: pointer; transition: var(--transition);
}
.plan-card.selected { border-color: var(--g3); box-shadow: 0 0 0 3px rgba(46,125,70,0.2); }
.plan-header { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.plan-title { font-size: 16px; font-weight: 700; }
.plan-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── ADMIN SPECIFIC ────────────────────────────────────────────── */
.admin-section { padding: 16px; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: var(--transition);
}
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--g2), var(--g4));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 12px; color: var(--text3); }

/* ── EMPTY STATE ───────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text3);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ── RESPONSIVE SAFE AREA ──────────────────────────────────────── */
.pb-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ── GRADIENT CARDS ────────────────────────────────────────────── */
.grad-cardio  { background: linear-gradient(135deg, #1a3328, #0f4a20); }
.grad-gym     { background: linear-gradient(135deg, #1a2d38, #0f3a4a); }
.grad-yoga    { background: linear-gradient(135deg, #2d1a38, #4a0f4a); }
.grad-running { background: linear-gradient(135deg, #382d1a, #4a3a0f); }
.grad-stretch { background: linear-gradient(135deg, #1a3833, #0f4a3a); }
.grad-cali    { background: linear-gradient(135deg, #3a1a1a, #5a2a0a); }
.grad-core    { background: linear-gradient(135deg, #3a1a2d, #5a0f2a); }

/* ── SWITCHER ──────────────────────────────────────────────────── */
.switcher {
  display: flex; background: var(--bg3); border-radius: 50px; padding: 3px;
}
.switch-btn {
  flex: 1; padding: 8px; border-radius: 50px; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--text3); transition: var(--transition);
  text-align: center; cursor: pointer; border: none;
}
.switch-btn.active { background: var(--surface2); color: var(--text); }

/* ── INFO ROW ──────────────────────────────────────────────────── */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row .lbl { font-size: 13px; color: var(--text3); }
.info-row .val { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── HYDRATION RING ────────────────────────────────────────────── */
.hydration-ring {
  width: 120px; height: 120px; position: relative; margin: 0 auto;
}
.hydration-ring svg { transform: rotate(-90deg); }
.hydration-ring .ring-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-pct { font-family: var(--font-display); font-size: 28px; color: var(--white); line-height: 1; }
.ring-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ── ADMIN INLINE EDIT ─────────────────────────────────────────── */
.admin-edit-mode .editable {
  border-bottom: 1.5px dashed var(--g3);
  cursor: text;
  min-width: 40px;
  display: inline-block;
  transition: background 0.15s;
  border-radius: 4px;
  padding: 1px 4px;
}
.admin-edit-mode .editable:hover,
.admin-edit-mode .editable:focus {
  background: rgba(46,125,70,0.15);
  outline: none;
}
.admin-edit-mode .editable-block {
  border: 1.5px dashed var(--g3);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: text;
  min-height: 32px;
  transition: background 0.15s;
}
.admin-edit-mode .editable-block:hover,
.admin-edit-mode .editable-block:focus {
  background: rgba(46,125,70,0.12);
  outline: none;
}
.admin-edit-mode .edit-hint {
  display: inline-block;
}
.edit-hint { display: none; }

.admin-edit-bar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: linear-gradient(135deg, #1a3328, #0a3d1f);
  border-bottom: 1px solid var(--g3);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-edit-bar .edit-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--g5);
  flex: 1;
}
.edit-badge {
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.add-exercise-btn {
  width: 100%;
  padding: 14px;
  border: 2px dashed var(--g3);
  border-radius: var(--radius);
  background: transparent;
  color: var(--g5);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
}
.add-exercise-btn:hover { background: rgba(46,125,70,0.1); }
.delete-ex-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(229,57,53,0.2);
  border: 1px solid rgba(229,57,53,0.4);
  color: #ef9a9a;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 5;
}
.delete-ex-btn:hover { background: rgba(229,57,53,0.35); }

/* ── CALENDAR ENHANCED ─────────────────────────────────────────── */
.cal-day.cal-missed {
  background: rgba(229, 57, 53, 0.35);
  color: #ef9a9a;
  border: 1px solid rgba(229,57,53,0.4);
}
.cal-day.cal-future {
  background: var(--bg3);
  color: var(--text3);
  opacity: 0.45;
}
.cal-day.completed {
  background: var(--g3);
  color: white;
  font-size: 15px;
  line-height: 1;
}
.cal-day.today {
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.cal-day[onclick] { transition: transform .1s, opacity .1s; }
.cal-day[onclick]:active { transform: scale(0.88); opacity: .75; }
.history-day-card { transition: transform .12s ease, opacity .12s ease; }
.history-day-card:active { transform: scale(0.975); opacity: 0.82; }
.run-history-card { transition: transform .12s ease, opacity .12s ease; }
.run-history-card:active { transform: scale(0.975); opacity: 0.82; }
.cal-day.completed.today {
  border: 2px solid var(--accent);
  background: var(--g3);
  color: white;
}

/* ── MODULE TILE DRAG & DROP ───────────────────────────────────── */
.module-card[draggable="true"] { cursor: grab; }
.module-card[draggable="true"]:active { cursor: grabbing; }

.module-card.drag-over {
  border: 2px solid var(--accent) !important;
  transform: scale(0.97);
  box-shadow: 0 0 0 3px rgba(240,192,64,0.3);
}

.drag-hint {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 16px;
  color: rgba(255,255,255,0.3);
  line-height: 1;
  letter-spacing: -2px;
  user-select: none;
  pointer-events: none;
  transition: opacity 0.2s;
}
.module-card:hover .drag-hint,
.module-card:active .drag-hint {
  color: rgba(255,255,255,0.6);
}

/* Reorder hint text below tiles */
.reorder-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  padding: 4px 0 8px;
  letter-spacing: 0.03em;
}

/* ── CUSTOM WORKOUT CHIPS ───────────────────────────────────────── */
.cw-chip {
  padding: 6px 14px; border-radius: 50px; font-size: 12px; font-weight: 600;
  background: var(--surface); color: var(--text3);
  border: 1.5px solid var(--border); cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
}
.cw-chip-active {
  background: rgba(46,125,70,0.2); color: var(--g5);
  border-color: var(--g4);
}
.cw-chip:active { transform: scale(0.95); }

/* ════════════════════════════════════════════════════════════════
   LIGHT MODE — applied when <html class="theme-light"> is set
   Only used by admin role. Regular users always get dark mode.
   ════════════════════════════════════════════════════════════════ */
html.theme-light {
  --g1: #d4f1dd;
  --g2: #b8e3c5;
  --g3: #2e7d46;
  --g4: #43a05a;
  --g5: #2e7d46;
  --g6: #1a5c32;
  --accent: #c89a20;
  --accent2: #d65a20;
  --danger: #c62828;
  --bg: #f4f7f5;
  --bg2: #e8eee9;
  --bg3: #dde5df;
  --surface: #ffffff;
  --surface2: #f0f4f1;
  --border: rgba(0,0,0,0.08);
  --text: #1a2620;
  --text2: #4a6055;
  --text3: #7a8a82;
  --white: #ffffff;
  --shadow: 0 8px 32px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.06);
}

/* Adjustments specific to elements that need contrast tweaks in light mode */
html.theme-light body {
  background: var(--bg);
  color: var(--text);
}
html.theme-light .topbar,
html.theme-light .bottom-nav {
  background: var(--surface);
  border-color: var(--border);
}
html.theme-light .card,
html.theme-light .user-row,
html.theme-light .user-info,
html.theme-light input[type=text],
html.theme-light input[type=email],
html.theme-light input[type=password],
html.theme-light input[type=number],
html.theme-light input[type=date],
html.theme-light textarea,
html.theme-light select {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
html.theme-light .modal-content {
  background: var(--surface);
  color: var(--text);
}
html.theme-light .btn-ghost {
  color: var(--text);
}
/* Theme color meta updates handled in JS */
