/* ── CSS Variables ──────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg:           #f2f2f7;
  --surface:      #fff;
  --surface-2:    #f2f2f7;
  --border:       #e0e0e0;
  --border-2:     #d0d0d0;
  --border-light: #f0f0f0;
  --divider:      #e5e5ea;
  --text:         #1c1c1e;
  --text-2:       #8e8e93;
  --text-3:       #555;
  --text-muted:   #c0c0c0;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:           #1c1c1e;
  --surface:      #2c2c2e;
  --surface-2:    #3a3a3c;
  --border:       #3a3a3c;
  --border-2:     #48484a;
  --border-light: #2c2c2e;
  --divider:      #3a3a3c;
  --text:         #f2f2f7;
  --text-2:       #8e8e93;
  --text-3:       #aeaeb2;
  --text-muted:   #636366;
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); min-height: 100vh; }
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e8f8f2 0%, var(--bg) 60%);
  padding: 24px;
}
[data-theme="dark"] .login-screen {
  background: linear-gradient(160deg, #0a1a14 0%, #1c1c1e 60%);
}
.login-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 36px 28px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}
[data-theme="dark"] .login-card { box-shadow: 0 4px 24px rgba(0,0,0,0.4); }
.login-logo     { font-size: 52px; margin-bottom: 10px; line-height: 1; }
.login-title    { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.login-subtitle { font-size: 15px; color: var(--text-2); margin-bottom: 28px; }
.login-card .modal-input { width: 100%; }
.login-card .btn-save    { margin-top: 4px; margin-bottom: 0; }
.login-divider {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 16px 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  gap: 10px;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--divider);
}
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  font-family: inherit;
}
.btn-google:active { background: var(--surface-2); }
.login-error {
  width: 100%;
  font-size: 14px;
  color: #c0392b;
  background: #fdecea;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  text-align: center;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-dot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.app-name { white-space: nowrap; }

.btn-back {
  padding: 8px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-back:active { opacity: 0.6; }

.saving {
  font-size: 13px;
  color: #1D9E75;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
  flex-shrink: 0;
  white-space: nowrap;
}
.saving.show  { opacity: 1; }
.saving.error { color: #c0392b; }

.offline-banner {
  background: #c0392b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
}

.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-logout   { color: var(--text-2); font-size: 16px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 180px;
  background: var(--surface);
  flex-shrink: 1;
  min-width: 0;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1D9E75;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .user-chip { background: var(--surface-2); }
[data-theme="dark"] .user-avatar { background: #0f6e56; }

/* ── Generic buttons ───────────────────────────────────────────────────────── */
.btn-icon {
  padding: 8px 12px;
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.btn-icon:active { opacity: 0.6; }
.btn-sm {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border-2);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-sm:active { opacity: 0.6; }
.btn-sm.btn-green { background: #e8f8f2; color: #0f6e56; border-color: #5DCAA5; }
.btn-sm.btn-blue  { background: #eef4ff; color: #185FA5; border-color: #378ADD; }
.btn-sm.btn-red   { background: #fdecea; color: #c0392b; border-color: #e74c3c; }
[data-theme="dark"] .btn-sm.btn-green { background: #0d2018; color: #5DCAA5; }
[data-theme="dark"] .btn-sm.btn-blue  { background: #0a1428; color: #60a0e0; }
[data-theme="dark"] .btn-sm.btn-red   { background: #280808; color: #e74c3c; }

.btn-save {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #1D9E75;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  font-family: inherit;
  margin-bottom: 14px;
}
.btn-save:active { opacity: 0.75; }

/* ── Content area ──────────────────────────────────────────────────────────── */
.content { padding: 14px 16px; }
.loading { text-align: center; padding: 80px 20px; color: var(--text-2); font-size: 16px; }
.empty   { text-align: center; padding: 50px 20px; color: var(--text-2); font-size: 16px; line-height: 1.6; }
.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 18px 0 10px;
}

/* ── Home: category cards ──────────────────────────────────────────────────── */
.home-content { padding-top: 20px; display: flex; flex-direction: column; gap: 14px; }

.category-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
  border-radius: 18px;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  background: var(--surface);
  transition: transform 0.12s, opacity 0.12s;
}
.category-card:active { transform: scale(0.98); opacity: 0.85; }
.card-challenges { border-color: #f0c040; background: linear-gradient(135deg, #fffbea 0%, #fff9e0 100%); }
.card-weights    { border-color: #5DCAA5; background: linear-gradient(135deg, #f0fdf8 0%, #e6f9f2 100%); }
.card-clients    { border-color: #378ADD; background: linear-gradient(135deg, #eef4ff 0%, #e4eeff 100%); }

[data-theme="dark"] .card-challenges { border-color: #c0a000; background: linear-gradient(135deg, #2a2610 0%, #1e1a08 100%); }
[data-theme="dark"] .card-weights    { border-color: #1D9E75; background: linear-gradient(135deg, #0d2018 0%, #0a1a10 100%); }
[data-theme="dark"] .card-clients    { border-color: #378ADD; background: linear-gradient(135deg, #0d1428 0%, #0a1020 100%); }

.category-icon { font-size: 38px; flex-shrink: 0; line-height: 1; }
.category-body { flex: 1; min-width: 0; }
.category-title { font-size: 19px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.category-desc  { font-size: 14px; color: var(--text-2); }
.category-arrow { font-size: 24px; color: var(--text-muted); flex-shrink: 0; }

/* ── Info panel: about block ────────────────────────────────────────────────── */
.info-about {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.info-logo { font-size: 40px; line-height: 1; }
.info-about-text {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
}
.info-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.home-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--text-2);
  text-decoration: none;
  border: 1px solid var(--border);
}
.home-badge:active { opacity: 0.7; }
.home-badge-ai { background: #f0e8ff; color: #7c3aed; border-color: #d8c4f8; }
.home-badge-gh { background: #f0f0f0; color: #24292f; border-color: #d0d7de; }
[data-theme="dark"] .home-badge-ai { background: #1a0a38; color: #c0a0ff; border-color: #6030a0; }
[data-theme="dark"] .home-badge-gh { background: #2c2c2e; color: #e0e0e0; border-color: #48484a; }
.home-kofi {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #ff5e5b;
  text-decoration: none;
  padding: 10px 20px;
  border: 1.5px solid #ff5e5b;
  border-radius: 22px;
}
.home-kofi:active { background: #ff5e5b; color: #fff; }

/* ── Exercise list (weights) ───────────────────────────────────────────────── */
.ex-list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 16px;
  margin-bottom: 8px;
  cursor: pointer;
}
.ex-list-row:active { opacity: 0.7; }
.ex-list-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ex-list-name { font-size: 16px; font-weight: 600; color: var(--text); }
.ex-list-arrow { font-size: 22px; color: var(--text-muted); flex-shrink: 0; }

.top-badge {
  font-size: 13px;
  font-weight: 500;
  color: #7a5c00;
  background: #fff8dc;
  border-radius: 20px;
  padding: 3px 10px;
  display: inline-block;
  width: fit-content;
}
[data-theme="dark"] .top-badge { color: #e0b800; background: #2a2400; }
.no-record    { font-size: 13px; color: var(--text-muted); }
.no-record-sm { font-size: 13px; color: var(--text-muted); }

/* ── Leaderboard ───────────────────────────────────────────────────────────── */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: opacity 0.1s;
}
.leaderboard-row:active { opacity: 0.7; }
.rank-gold   { border-color: #f0c040; background: linear-gradient(135deg, #fffdf0 0%, #fffbe0 100%); }
.rank-silver { border-color: #c0c8d0; background: linear-gradient(135deg, #f8f9fb 0%, #f0f2f5 100%); }
.rank-bronze { border-color: #d0a070; background: linear-gradient(135deg, #fdf6f0 0%, #faeee0 100%); }

[data-theme="dark"] .rank-gold   { border-color: #c0a000; background: linear-gradient(135deg, #2a2500 0%, #1e1a00 100%); }
[data-theme="dark"] .rank-silver { border-color: #606870; background: linear-gradient(135deg, #252830 0%, #1e2028 100%); }
[data-theme="dark"] .rank-bronze { border-color: #805040; background: linear-gradient(135deg, #2a1a10 0%, #1e1008 100%); }

.medal      { font-size: 24px; flex-shrink: 0; width: 34px; text-align: center; line-height: 1; }
.rank-none  { font-size: 16px; color: var(--text-muted); }
.lb-info    { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lb-name    { font-size: 16px; font-weight: 600; color: var(--text); }
.lb-value   { font-size: 14px; color: var(--text-3); font-weight: 500; }
.lb-date    { font-size: 13px; color: var(--text-2); font-weight: 400; }
.lb-e1rm    { font-size: 12px; color: var(--text-2); font-weight: 400; }
.lb-arrow   { font-size: 20px; color: var(--text-muted); flex-shrink: 0; }

/* ── Session: exercise cards ───────────────────────────────────────────────── */
.ex-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 16px 14px; margin-bottom: 8px; }

.ex-name-label {
  display: block; font-size: 15px; font-weight: 600; margin-bottom: 14px;
  color: var(--text);
}
.ex-name-label.ex-name-custom { color: #7B5EA7; }
[data-theme="dark"] .ex-name-label.ex-name-custom { color: #c0a0ff; }

.btn-ex-history {
  width: 100%; margin-top: 10px;
  padding: 10px 14px;
  border: 1.5px solid #1D9E75; border-radius: 10px;
  background: transparent; color: #1D9E75;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-align: center;
}
.btn-ex-history:active { background: #e8f8f3; }
[data-theme="dark"] .btn-ex-history:active { background: #0d2018; }

.ctrl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ctrl-label { font-size: 13px; color: var(--text-2); width: 56px; flex-shrink: 0; }
.ctrl-btn {
  width: 46px; height: 46px; border: 1.5px solid var(--border-2); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; font-size: 24px; font-weight: 300; color: var(--text);
  display: flex; align-items: center; justify-content: center; font-family: inherit;
  user-select: none; flex-shrink: 0;
}
.ctrl-btn:active { background: var(--border); }
.num-input {
  width: 66px; text-align: center; font-size: 21px; font-weight: 600; color: var(--text);
  border: none; border-bottom: 2px solid var(--border); background: transparent; font-family: inherit;
  outline: none; padding: 2px 0; -moz-appearance: textfield;
}
.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input:focus { border-bottom-color: #1D9E75; }
.ctrl-unit { font-size: 13px; color: var(--text-2); flex-shrink: 0; }

.band-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.band-circle {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; flex-shrink: 0; transition: transform 0.15s;
}
.band-circle.active { border-color: var(--text); transform: scale(1.2); }
.band-none-btn {
  padding: 7px 11px; border-radius: 20px; border: 1.5px solid var(--border-2);
  background: var(--surface-2); font-size: 13px; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.band-none-btn.active { border-color: var(--text); color: var(--text); font-weight: 600; background: var(--border); }

.add-ex-btn {
  width: 100%; padding: 14px; border: 1.5px dashed var(--border-2); border-radius: 14px;
  background: transparent; cursor: pointer; font-size: 15px; color: var(--text-2);
  font-family: inherit; margin-top: 6px;
}
.add-ex-btn:active { opacity: 0.6; }

/* ── History ───────────────────────────────────────────────────────────────── */
.history-section { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.history-title   { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.chart-wrap      { position: relative; height: 200px; }
.history-list    { margin-top: 4px; }
.history-row       { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.history-row:last-child { border-bottom: none; }
.history-row-left  { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.history-date      { font-size: 13px; color: var(--text-2); }
.history-vals      { font-size: 14px; font-weight: 500; color: var(--text); }
.no-history        { font-size: 14px; color: var(--text-2); text-align: center; padding: 20px 0; line-height: 1.6; }
.btn-history-delete {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: #fdecea;
  color: #c0392b;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.btn-history-delete:active { background: #e74c3c; color: #fff; }
.band-dot        { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ── Challenges ────────────────────────────────────────────────────────────── */
.challenge-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 8px;
  cursor: pointer;
}
.challenge-card:active { opacity: 0.7; }
.challenge-card-inner  { flex: 1; min-width: 0; }
.challenge-card-header { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.challenge-name { font-size: 16px; font-weight: 600; color: var(--text); }
.challenge-meta { font-size: 13px; color: var(--text-2); }
.challenge-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.challenge-inactive { opacity: 0.6; }

/* ── Leaderboard age & name row ────────────────────────────────────────────── */
.lb-name-row { display: flex; align-items: baseline; gap: 6px; }
.lb-age      { font-size: 11px; color: var(--text-2); font-weight: 400; }

/* ── Sex group section label ───────────────────────────────────────────────── */
.sex-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 0 6px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}
.sex-section-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.challenge-info-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 4px;
}
.challenge-info-item { font-size: 14px; color: var(--text-3); font-weight: 500; }
.btn-finish-challenge {
  border: 1.5px solid #e74c3c; border-radius: 20px;
  background: transparent; color: #e74c3c;
  font-size: 13px; font-weight: 600;
  padding: 4px 12px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-finish-challenge:active { background: #e74c3c; color: #fff; }

/* ── Clients panel ─────────────────────────────────────────────────────────── */
.panel-bg {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 100;
  display: flex; align-items: flex-end;
}
.panel-bg.panel-bg-center {
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.panel {
  background: var(--bg); border-radius: 20px 20px 0 0;
  width: 100%; max-height: 80vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}
.panel.panel-centered {
  border-radius: 20px;
  max-width: 400px;
  max-height: 88vh;
  padding-bottom: 0;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface); border-radius: 20px 20px 0 0;
}
.panel.panel-centered .panel-header { border-radius: 20px 20px 0 0; }
.panel-title { font-size: 17px; font-weight: 700; color: var(--text); }
.panel-body  { overflow-y: auto; padding: 12px 16px; flex: 1; }
.panel-search { padding: 10px 16px 4px; background: var(--surface); border-bottom: 1px solid var(--border-light); }
.search-input {
  width: 100%; box-sizing: border-box;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; background: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
  outline: none; color: var(--text);
}
.search-input:focus { border-color: #1D9E75; background-color: var(--surface); }

.panel-client-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 8px;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #dbeeff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; color: #185FA5; flex-shrink: 0;
}
[data-theme="dark"] .avatar { background: #0a2040; color: #60a8e0; }
.panel-client-info    { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.panel-client-name    { font-size: 16px; font-weight: 500; color: var(--text); }
.panel-client-meta    { font-size: 12px; color: var(--text-2); }
.panel-client-actions { display: flex; gap: 8px; flex-shrink: 0; }
.access-hint         { font-size: 14px; color: var(--text-2); margin-bottom: 12px; line-height: 1.5; }
.access-section-title { font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px; }
.access-divider      { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }
.btn-contact {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #1D9E75;
  text-decoration: none;
  padding: 10px 20px;
  border: 1.5px solid #1D9E75;
  border-radius: 22px;
}
.btn-contact:active { background: #1D9E75; color: #fff; }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); display: flex;
  align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--surface); border-radius: 18px; padding: 28px 24px;
  width: 90%; max-width: 360px;
}
.modal-lg { max-width: 420px; }
.modal-title   { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.modal-input   {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--border-2); border-radius: 10px;
  background: var(--surface-2); font-size: 16px; color: var(--text); font-family: inherit;
  outline: none; margin-bottom: 12px;
}
.modal-input:focus { border-color: #1D9E75; }
.modal-select  { appearance: none; -webkit-appearance: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.btn-cancel    { flex: 1; padding: 13px; border: 1.5px solid var(--border-2); border-radius: 10px; background: transparent; cursor: pointer; font-size: 15px; color: var(--text-2); font-family: inherit; }
.btn-confirm   { flex: 1; padding: 13px; border: none; border-radius: 10px; background: #1D9E75; cursor: pointer; font-size: 15px; font-weight: 600; color: #fff; font-family: inherit; }
.btn-confirm:active { opacity: 0.8; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #1c1c1e; color: #fff; padding: 13px 22px; border-radius: 12px;
  font-size: 15px; font-weight: 500; z-index: 300; opacity: 0;
  transition: opacity 0.3s; pointer-events: none; white-space: nowrap;
}
.toast.show        { opacity: 1; }
.toast.toast-error { background: #c0392b; }
[data-theme="dark"] .toast             { background: #f2f2f7; color: #1c1c1e; }
[data-theme="dark"] .toast.toast-error { background: #c0392b; color: #fff; }

/* ── App footer ─────────────────────────────────────────────────────────────── */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px 32px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-top: auto;
}
.app-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.app-footer-link:active { color: var(--text); }
.app-footer-gh {
  width: 14px; height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ── Theme toggle ───────────────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.theme-btn {
  padding: 5px 9px;
  border: none;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: background 0.15s;
}
.theme-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ── Challenge metric selector ─────────────────────────────────────────────── */
.metric-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.metric-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  text-align: center;
  user-select: none;
}
.metric-opt input[type="radio"] { display: none; }
.metric-opt:has(input:checked) {
  border-color: #1D9E75;
  background: #e8f8f2;
  color: #1D9E75;
}
[data-theme="dark"] .metric-opt:has(input:checked) { background: #0d2018; }
.metric-opt-icon { font-size: 22px; line-height: 1; }

/* ── Challenge date row ─────────────────────────────────────────────────────── */
.date-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.date-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.date-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.date-field .modal-input { margin-bottom: 0; }

/* ── Challenge badges ───────────────────────────────────────────────────────── */
.ch-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ch-badge-active   { background: #e8f8f2; color: #1D9E75; }
.ch-badge-pending  { background: #fff3e0; color: #e67e22; }
.ch-badge-finished { background: var(--surface-2); color: var(--text-2); }
[data-theme="dark"] .ch-badge-active  { background: #0d2018; }
[data-theme="dark"] .ch-badge-pending { background: #2a1800; color: #e67e22; }

/* ── Challenge inactive / finished banner ──────────────────────────────────── */
.finished-banner {
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 16px;
}
.pending-banner {
  background: #fff8e6;
  color: #b07d00;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 16px;
}
[data-theme="dark"] .pending-banner { background: #2a1800; color: #e0a000; }
.countdown-badge {
  font-size: 12px;
  font-weight: 600;
  color: #b07d00;
  background: #fff8e6;
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .countdown-badge { background: #2a1800; color: #e0a000; }
.challenge-dates {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden { display: none; }

/* ── Footer version ─────────────────────────────────────────────────────────── */
.app-footer-version {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  font-family: ui-monospace, monospace;
}

/* ── Dev banner ──────────────────────────────────────────────────────────────── */
.dev-banner {
  background: #f59e0b;
  color: #1c1c1e;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  letter-spacing: 0.2px;
}
