/* ============================================================
   UI 2.0 — Topbar compacte, nav sticky, mobile-first, thèmes,
   événements, constructeur de plans, groupes.
   Chargé APRÈS styles.css : ses règles priment à spécificité égale.
   ============================================================ */

/* --- Icônes SVG --- */
[data-icon] svg, .tab-btn svg, .ev-btn svg, .btn-ghost svg {
  vertical-align: -0.15em;
}

/* --- Topbar compacte et collante --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-dark) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: 12px;
  color: var(--text-main);
  font-family: inherit;
  text-align: left;
  min-width: 0;
}

.topbar-profile:hover { background: var(--bg-card); }

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.topbar-id { display: flex; flex-direction: column; min-width: 0; }
.topbar-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.topbar-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.role-chip-header { margin-top: 0; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 15px;
  color: var(--text-main);
}
.topbar-brand-icon { color: var(--color-bike); font-size: 16px; display: inline-flex; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-light);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
}
.topbar-btn:hover { color: var(--text-main); border-color: var(--text-muted); }

/* Le sélecteur d'identité n'est plus en position absolue */
.user-switcher {
  position: static;
  top: auto;
  left: auto;
}

/* --- Onglets : collants sous la topbar --- */
.tabs-nav {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
  margin-top: 0;
  border-bottom: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 9px 13px;
}

/* --- Bandeau d'accueil compact --- */
.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 0;
}
.hero-strip h1 {
  font-size: clamp(19px, 4vw, 26px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 2px;
  background: linear-gradient(135deg, var(--text-main) 30%, #3bc4f2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-strip p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}
.hero-strip-icons {
  display: flex;
  gap: 10px;
  font-size: 22px;
  flex-shrink: 0;
}

/* --- Navigation basse mobile --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 110;
  background: color-mix(in srgb, var(--bg-dark) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.bottom-nav button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  cursor: pointer;
  border-radius: 10px;
  min-height: 48px;
}

.bottom-nav button.active { color: var(--color-bike); }
.bottom-nav .bn-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em; }

.bn-sheet {
  display: none;
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  z-index: 109;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  flex-direction: column;
  gap: 2px;
}
.bn-sheet.open { display: flex; }
.bn-sheet button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}
.bn-sheet button:hover, .bn-sheet button.active { background: var(--bg-deep); color: var(--text-main); }

body.no-scroll { overflow: hidden; }

@media (max-width: 768px) {
  .tabs-nav { display: none; }
  .bottom-nav { display: flex; }
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .topbar-brand { display: none; }
  .topbar-inner { justify-content: space-between; }
  .hero-strip-icons { display: none; }
  .profile-col-sep { border-left: none !important; padding-left: 0 !important; }
}

@media (min-width: 769px) {
  .profile-col-sep { border-left: 1px solid var(--border-color); padding-left: 24px; }
}

/* --- Profil : photo d'avatar --- */
.avatar-photo-row { display: flex; align-items: center; gap: 14px; }
.avatar-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-deep);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-ghost:hover { color: var(--text-main); border-color: var(--text-muted); }
.btn-ghost-danger { color: var(--color-z5); border-color: rgba(255, 64, 96, 0.3); }

.lb-bio { font-size: 11px; color: var(--text-muted); font-style: italic; margin: 1px 0 3px; }
.lb-avatar { overflow: hidden; }

/* --- Événements --- */
.ev-head-row { margin-top: 4px; }
.ev-head-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}
.ev-head-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.ev-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  background: rgba(59, 196, 242, 0.12);
  border: 1px solid rgba(59, 196, 242, 0.4);
  color: var(--color-bike);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ev-create-btn:hover { background: rgba(59, 196, 242, 0.2); }

.ev-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.ev-list-past { opacity: 0.65; }
.ev-section-title {
  margin-top: 26px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.ev-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--ev-accent, var(--color-bike));
  border-radius: 14px;
  padding: 14px 16px;
  position: relative;
}
.ev-closed { opacity: 0.75; }

.ev-card-head { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.ev-sport-chip {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.ev-card-id { min-width: 0; flex: 1; }
.ev-title { font-size: 15px; font-weight: 800; color: var(--text-main); }
.ev-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.ev-meta svg { vertical-align: -0.15em; margin-right: 2px; }

.ev-countdown {
  font-size: 12px;
  font-weight: 800;
  color: var(--ev-accent, var(--color-bike));
  background: color-mix(in srgb, var(--ev-accent, #3bc4f2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ev-accent, #3bc4f2) 35%, transparent);
  border-radius: 18px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ev-today { animation: evpulse 1.6s infinite; }
.ev-past { color: var(--text-muted); background: transparent; border-color: var(--border-color); }
@keyframes evpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.ev-card-body { margin-top: 10px; }
.ev-distance { font-size: 12.5px; font-weight: 700; color: var(--text-light); }
.ev-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
.ev-cap-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.ev-cap-txt { font-size: 12px; color: var(--text-light); font-weight: 600; white-space: nowrap; }
.ev-cap-txt svg { vertical-align: -0.15em; }
.ev-cap-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 4px;
  overflow: hidden;
  max-width: 180px;
}
.ev-cap-fill { height: 100%; background: var(--ev-accent, var(--color-bike)); border-radius: 4px; }

.ev-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.ev-manage { margin-left: auto; display: flex; gap: 6px; }

.ev-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-deep);
  color: var(--text-light);
  transition: all 0.2s ease;
  min-height: 38px;
}
.ev-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ev-btn-in {
  background: rgba(96, 239, 184, 0.12);
  border-color: rgba(96, 239, 184, 0.45);
  color: var(--color-swim);
}
.ev-btn-in:hover { background: rgba(96, 239, 184, 0.22); }
.ev-btn-out {
  background: rgba(255, 64, 96, 0.08);
  border-color: rgba(255, 64, 96, 0.35);
  color: var(--color-z5);
}
.ev-btn-ghost:hover { color: var(--text-main); }

.ev-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.ev-icon-btn:hover { color: var(--text-main); border-color: var(--text-muted); }
.ev-icon-danger:hover { color: var(--color-z5); border-color: rgba(255, 64, 96, 0.5); }

.ev-creator { font-size: 10.5px; color: var(--text-muted); margin-top: 10px; }
.ev-empty {
  margin-top: 16px;
  padding: 28px 20px;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ev-form { margin-top: 16px; }
.ev-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 14px;
}
.ev-form-full { grid-column: 1 / -1; }
.ev-textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.ev-form-actions { display: flex; gap: 10px; margin-top: 14px; }

/* Fiche événement (modal / bottom-sheet) */
.ev-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 7, 12, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ev-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px 20px 0 0;
  animation: sheetUp 0.25s ease;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  .ev-sheet-backdrop { align-items: center; padding: 24px; }
  .ev-sheet { border-radius: 20px; }
}

.ev-sheet-hero { padding: 22px 20px 16px; position: relative; }
.ev-sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-light);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ev-sheet-sport { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 6px; }
.ev-sheet-title { font-size: 20px; font-weight: 800; color: var(--text-main); margin-top: 6px; letter-spacing: -0.02em; }
.ev-sheet-count { font-size: 13px; font-weight: 800; margin-top: 6px; }
.ev-sheet-body { padding: 16px 20px calc(22px + env(safe-area-inset-bottom)); }
.ev-sheet-info { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-light); }
.ev-sheet-info svg { vertical-align: -0.15em; margin-right: 4px; color: var(--text-muted); }
.ev-sheet-desc { margin: 14px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.ev-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ev-closed-note { font-size: 12.5px; color: var(--text-muted); font-weight: 700; align-self: center; }
.ev-sheet-parts { margin-top: 20px; }
.ev-sheet-parts-title { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
.ev-part-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border-color); }
.ev-part-row:last-child { border-bottom: none; }
.ev-part-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-deep); border: 1px solid var(--border-color);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; overflow: hidden; flex-shrink: 0;
}
.ev-part-name { font-size: 13px; font-weight: 600; color: var(--text-main); flex: 1; }
.ev-part-date { font-size: 11px; color: var(--text-muted); }
.ev-no-part { font-size: 12.5px; color: var(--text-muted); font-style: italic; }

/* --- Constructeur de plans --- */
.pb-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.pb-new-name { flex: 1; min-width: 180px; }
.pb-list { display: flex; flex-direction: column; gap: 10px; }
.pb-plan { border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-deep); }
.pb-plan.pb-open { border-color: rgba(59, 196, 242, 0.4); }
.pb-plan-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.pb-plan-id { flex: 1; min-width: 0; }
.pb-plan-name { font-size: 14px; font-weight: 700; color: var(--text-main); display: block; }
.pb-plan-meta { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.pb-plan-btns { display: flex; gap: 6px; flex-shrink: 0; }
.pb-plan-desc { font-size: 12.5px; color: var(--text-muted); padding: 0 14px 8px; }

.pb-editor { border-top: 1px solid var(--border-color); padding: 12px 14px 14px; }
.pb-week-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.pb-week-tab {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.pb-week-tab.active { color: var(--color-bike); border-color: rgba(59, 196, 242, 0.5); background: rgba(59, 196, 242, 0.1); }

.pb-days { display: flex; flex-direction: column; gap: 8px; }
.pb-day { display: flex; gap: 10px; align-items: flex-start; }
.pb-day-name { width: 76px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--text-light); padding-top: 6px; }
.pb-day-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pb-day-empty { font-size: 12px; color: var(--text-muted); padding-top: 6px; display: inline-block; }
.pb-sess {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--color-bike);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-light);
}
.pb-sess-icon { display: inline-flex; font-size: 14px; flex-shrink: 0; }
.pb-sess-txt { flex: 1; min-width: 0; }
.pb-sess-desc { display: block; font-size: 11.5px; color: var(--text-muted); }

.pb-add-form {
  display: grid;
  grid-template-columns: 110px 110px 1fr 70px 80px;
  gap: 7px;
  margin-top: 14px;
  align-items: center;
}
.pb-add-form .pb-desc { grid-column: 1 / -2; }
.pb-add-form .ev-btn { grid-column: -2 / -1; justify-content: center; }
@media (max-width: 640px) {
  .pb-add-form { grid-template-columns: 1fr 1fr; }
  .pb-add-form .pb-desc, .pb-add-form .ev-btn { grid-column: 1 / -1; }
}

.pb-assign-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-color); }
.pb-assign-label { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.pb-import-btn { cursor: pointer; }

.coach-assigned {
  font-size: 12.5px;
  color: var(--text-light);
  background: rgba(245, 200, 66, 0.07);
  border: 1px solid rgba(245, 200, 66, 0.25);
  border-radius: 10px;
  padding: 9px 13px;
  margin-bottom: 12px;
}

/* --- Groupes --- */
.grp-list { display: flex; flex-direction: column; gap: 12px; }
.grp-card {
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--grp-color, var(--color-bike));
  border-radius: 12px;
  background: var(--bg-deep);
  padding: 12px 14px;
}
.grp-head { display: flex; align-items: center; gap: 9px; }
.grp-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.grp-name { font-size: 14px; font-weight: 700; color: var(--text-main); }
.grp-meta { font-size: 11.5px; color: var(--text-muted); font-weight: 600; flex: 1; }
.grp-note { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-style: italic; }
.grp-members { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.grp-member {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 7px 4px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}
.grp-member-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; overflow: hidden; flex-shrink: 0;
}
.grp-member-x {
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; display: inline-flex; padding: 2px; font-size: 10px;
}
.grp-member-x:hover { color: var(--color-z5); }
.grp-plans { font-size: 12px; color: var(--text-light); margin-top: 10px; }
.grp-add-row { display: flex; gap: 8px; margin-top: 12px; align-items: center; }

/* --- Page d'accueil / onboarding --- */
.landing {
  position: fixed;
  inset: 0;
  z-index: 300;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(59, 196, 242, 0.1) 0%, transparent 70%),
    var(--bg-dark);
  padding: 40px 20px calc(40px + env(safe-area-inset-bottom));
}
.landing-close { position: fixed; top: 16px; right: 16px; z-index: 301; }
.landing-hero { max-width: 640px; margin: 0 auto; text-align: center; }
.landing-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: rgba(59, 196, 242, 0.12);
  border: 1px solid rgba(59, 196, 242, 0.4);
  color: var(--color-bike);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.landing-title {
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 10px;
  background: linear-gradient(135deg, var(--text-main) 30%, #3bc4f2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.landing-tagline { color: var(--text-light); font-size: 15px; line-height: 1.6; margin: 0; }

.landing-features {
  max-width: 640px;
  margin: 28px auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.landing-feat {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
}
.landing-feat-icon { font-size: 20px; display: inline-flex; flex-shrink: 0; margin-top: 2px; }
.landing-feat-title { font-size: 13.5px; font-weight: 700; color: var(--text-main); }
.landing-feat-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 2px; }

.landing-cards {
  max-width: 640px;
  margin: 26px auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.landing-cards-single { grid-template-columns: 1fr; max-width: 420px; }
.landing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.landing-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.landing-card-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.landing-btn { justify-content: center; margin-top: 4px; }
.landing-code { letter-spacing: 0.1em; color: var(--color-bike); }
.landing-code-input { text-transform: uppercase; letter-spacing: 0.1em; }
.landing-skip {
  display: block;
  margin: 20px auto 0;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.landing-skip:hover { color: var(--text-main); }
.landing-note {
  max-width: 640px;
  margin: 22px auto 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Club : code d'invitation & lien présentation --- */
.club-invite-chip {
  margin-left: auto;
  background: rgba(59, 196, 242, 0.1);
  border: 1px dashed rgba(59, 196, 242, 0.45);
  color: var(--text-light);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.club-invite-chip strong { color: var(--color-bike); letter-spacing: 0.08em; }
.club-invite-chip:hover { background: rgba(59, 196, 242, 0.18); }
.club-landing-link {
  margin-top: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}
.club-landing-link:hover { color: var(--text-main); }

/* --- Événements : portée club/public, filtres, invités --- */
.ev-scope-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 14px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: 2px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  background: var(--bg-deep);
}
.ev-scope-open {
  color: var(--color-z3);
  border-color: rgba(245, 200, 66, 0.45);
  background: rgba(245, 200, 66, 0.1);
}
.ev-ext-line { font-size: 12px; color: var(--text-light); font-weight: 600; margin-top: 4px; }

.ev-filter-row { display: flex; gap: 7px; margin-top: 14px; }
.ev-filter-chip {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  border-radius: 18px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ev-filter-chip.active {
  color: var(--color-bike);
  border-color: rgba(59, 196, 242, 0.5);
  background: rgba(59, 196, 242, 0.1);
}

.ev-ext-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 14px;
  border: 1px dashed rgba(245, 200, 66, 0.35);
  border-radius: 12px;
  padding: 12px;
}
.ev-link { color: var(--color-bike); font-weight: 600; }
.ev-guest-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-z3);
  background: rgba(245, 200, 66, 0.1);
  border: 1px solid rgba(245, 200, 66, 0.35);
  border-radius: 12px;
  padding: 1px 7px;
  margin-left: 6px;
}
.ev-guest-form { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border-color); }
.ev-guest-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-guest-row .form-input { flex: 1; min-width: 140px; }

@media (max-width: 600px) {
  .club-invite-chip { margin-left: 0; }
}

/* ============================================================
   THÈME CLAIR
   ============================================================ */
[data-theme="light"] {
  --bg-dark: #f2f5f9;
  --bg-deep: #e9edf4;
  --bg-card: #ffffff;
  --border-color: #dde4ee;
  --text-main: #1c2430;
  --text-muted: #566070;
  --text-light: #334155;
  --color-repos: #c4ccd8;

  /* Les accents néon (pensés pour le fond sombre) sont illisibles sur fond
     clair : un mint #60efb8 sur blanc plafonne à 1.4:1 de contraste. On les
     assombrit en gardant la teinte de chaque discipline/zone pour passer le
     seuil WCAG AA (4.5:1) partout où ils servent de texte ou de bordure. */
  --color-swim: #0a7050;
  --color-bike: #0e6aa0;
  --color-run: #a85007;
  --color-z1: #0a7050;
  --color-z2: #0e6aa0;
  --color-z3: #7a5d04;
  --color-z4: #a85007;
  --color-z5: #d11138;
}

[data-theme="light"] body { background-color: var(--bg-dark); }

[data-theme="light"] .topbar,
[data-theme="light"] .bottom-nav {
  background: color-mix(in srgb, #ffffff 88%, transparent);
}

[data-theme="light"] .tab-btn.active {
  background-color: #e3f1fb;
  color: #0a7bb5;
  border-bottom-color: #0a7bb5;
}

[data-theme="light"] .hero-strip h1 {
  background: linear-gradient(135deg, #1c2430 30%, #0a7bb5 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="light"] .bn-sheet { box-shadow: 0 -8px 32px rgba(30, 45, 70, 0.18); }
[data-theme="light"] .ev-sheet-backdrop { background: rgba(30, 40, 60, 0.35); }

/* Composants dont le fond sombre était codé en dur */
[data-theme="light"] .timeline-week-btn,
[data-theme="light"] .cal-day-cell,
[data-theme="light"] .phase-btn,
[data-theme="light"] .format-btn { background-color: var(--bg-deep); }
[data-theme="light"] .progress-segment { filter: saturate(1.1); }
[data-theme="light"] .tab-btn:hover { color: var(--text-main); }

/* ============================================================
   COURSES PUBLIQUES — épreuves, inscriptions, organisateur
   ============================================================ */
.ev-races-editor { display: flex; flex-direction: column; gap: 8px; }
.ev-races-editor > .ev-btn { align-self: flex-start; }
.ev-race-row {
  display: grid;
  grid-template-columns: 1fr 1fr 90px 70px 34px;
  gap: 7px;
  align-items: center;
}
@media (max-width: 640px) {
  .ev-race-row { grid-template-columns: 1fr 1fr; }
  .ev-race-row .ev-icon-btn { justify-self: start; }
}

.ev-race-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.ev-race-info { flex: 1; min-width: 0; }
.ev-race-name { font-size: 13.5px; font-weight: 800; color: var(--text-main); }
.ev-race-meta { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

.ev-reg-form {
  border: 1px dashed rgba(96, 239, 184, 0.4);
  border-radius: 12px;
  padding: 14px;
  margin: -2px 0 10px;
}
.ev-reg-form-title { font-size: 12.5px; font-weight: 800; color: var(--text-main); margin-bottom: 10px; }
.ev-reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ev-reg-full { grid-column: 1 / -1; }
.ev-reg-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }

.ev-reg-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 3px 9px;
  white-space: nowrap;
}

.ev-bib {
  min-width: 44px;
  font-size: 12px;
  font-weight: 800;
  color: var(--color-bike);
  flex-shrink: 0;
}
.ev-part-club { color: var(--text-muted); font-weight: 500; font-size: 11.5px; }

.ev-org-panel {
  margin-top: 20px;
  border: 1px solid rgba(245, 200, 66, 0.3);
  border-radius: 14px;
  padding: 14px;
  background: rgba(245, 200, 66, 0.04);
}
.ev-org-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ev-org-stat {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg-deep);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 4px 10px;
}
.ev-org-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-color);
}
.ev-org-row:last-of-type { border-bottom: none; }
.ev-org-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-org-id strong { font-size: 13px; color: var(--text-main); }
.ev-org-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.ev-org-btns { display: flex; gap: 5px; flex-shrink: 0; }
.ev-paid { color: var(--color-swim); border-color: rgba(96, 239, 184, 0.5); }
@media (max-width: 600px) {
  .ev-org-row { flex-wrap: wrap; }
  .ev-org-btns { margin-left: auto; }
}

/* ============================================================
   ADMIN — gestion des membres
   ============================================================ */
.member-role-chip {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.member-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.member-lock { font-size: 11px; }
.member-row-edit { display: block; }
.member-edit-grid {
  display: grid;
  grid-template-columns: 1fr 70px 130px auto 34px;
  gap: 7px;
  align-items: center;
}
@media (max-width: 640px) {
  .member-edit-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   THÈME CLAIR — lisibilité des éléments colorés en JS
   ------------------------------------------------------------
   Beaucoup de puces / libellés reçoivent leur couleur d'accent
   en style inline (color:${hex}) depuis le JS, avec un fond
   teinté de la même couleur. Sur fond clair ce texte néon tombe
   sous 2:1. On force ici un texte sombre lisible (le fond teinté
   et la bordure colorée continuent de porter la teinte). Le
   !important est nécessaire pour battre le style inline.
   ============================================================ */
[data-theme="light"] .ev-sport-chip,
[data-theme="light"] .ev-reg-chip,
[data-theme="light"] .role-chip,
[data-theme="light"] .member-role-chip,
[data-theme="light"] .sdp-sport-chip,
[data-theme="light"] .sdp-badge,
[data-theme="light"] .cal-sport-label,
[data-theme="light"] .badge-check,
[data-theme="light"] .badge-unlocked,
[data-theme="light"] .prog-sport-count,
[data-theme="light"] .phase-name,
[data-theme="light"] .phase-detail-title,
[data-theme="light"] .v-val,
[data-theme="light"] .phase-focus-arrow,
[data-theme="light"] .w-label,
[data-theme="light"] .coach-day-status {
  color: var(--text-main) !important;
}

/* Statuts secondaires : gris lisible plutôt que noir plein. */
[data-theme="light"] .w-status,
[data-theme="light"] .ev-part-club {
  color: var(--text-muted) !important;
}

/* Barres de progression : le mint néon est invisible sur piste
   claire. On les assombrit (élément graphique, pas de texte). */
[data-theme="light"] .weekly-progress-bar-fill,
[data-theme="light"] .week-progress-bar-fill {
  background-color: var(--color-swim);
}

/* ------------------------------------------------------------
   Surfaces sombres codées en dur, jamais adaptées au clair :
   sur fond clair elles deviennent des taches grises sales et le
   texte (désormais sombre) y passe sous 1.5:1. On les repasse
   en surfaces claires.
   ------------------------------------------------------------ */
[data-theme="light"] .cal-header,
[data-theme="light"] .session-row.completed,
[data-theme="light"] .sdp-body,
[data-theme="light"] .schedule-day-row {
  background-color: var(--bg-deep);
}

/* Bannières héro : leur dégradé sombre + le titre passé en sombre
   par le thème clair = texte invisible (1.34:1). On éclaircit. */
[data-theme="light"] .prog-hero,
[data-theme="light"] .club-hero {
  background: linear-gradient(135deg, #ffffff 0%, #e9eef5 100%);
}

/* Compte à rebours / CTA : texte d'accent sur teinte de la même
   couleur → on neutralise le fond pour garder un texte lisible. */
[data-theme="light"] .ev-countdown {
  color: var(--text-main);
  background: var(--bg-deep);
  border-color: var(--border-color);
}
[data-theme="light"] .ev-create-btn { background: var(--bg-card); }
[data-theme="light"] .ev-filter-chip.active { background: var(--bg-deep); }

/* ============================================================
   CONNEXION STRAVA (onglet Profil)
   ============================================================ */
.strava-card { margin-top: 0; }
.strava-note { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 14px; }
.strava-connected { font-size: 14px; font-weight: 700; color: var(--color-swim); margin: 0 0 6px; }
.strava-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.strava-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fc4c02; /* orange Strava */
  color: #ffffff;
  border: 1px solid #fc4c02;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.2s ease;
}
.strava-btn:hover { filter: brightness(1.08); }
.strava-btn-ghost {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border-color);
}
.strava-btn-ghost:hover { filter: none; border-color: var(--text-muted); }
