:root {
  --bg: #0d0f12;
  --screen: #15171c;
  --card: #1c1f26;
  --input: #262a31;
  --border: #262a31;
  --text: #f4f5f7;
  --muted: #8b8f98;
  --accent: #1ee6a3;
  --accent-text: #04342c;
  --danger: #f5a623;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  background: var(--screen);
  display: flex;
  flex-direction: column;
}

.screen { padding: 20px 18px 90px; flex: 1; }
h1 { font-size: 19px; font-weight: 500; margin: 4px 0 0; }
.subtitle { font-size: 12px; color: var(--muted); margin: 0; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge.ok { color: var(--accent); background: rgba(30,230,163,0.12); }
.badge.risk { color: var(--danger); background: rgba(245,166,35,0.12); }

.btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
  font-size: 14px;
  border: none;
  border-radius: 12px;
  padding: 13px;
  width: 100%;
  cursor: pointer;
}
.btn.secondary { background: var(--input); color: var(--text); }

input, select {
  width: 100%;
  background: var(--input);
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 12px;
}

nav.bottom {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 6px 16px;
  border-top: 0.5px solid var(--border);
  background: var(--screen);
}
nav.bottom a {
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
nav.bottom a.active { color: var(--accent); }
nav.bottom a.fab {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  margin-top: -26px;
  font-size: 22px;
}

.btn:disabled { opacity: 0.6; cursor: default; }

.back-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.field-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 18px 0 8px;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.set-row .set-label {
  font-size: 13px;
  color: var(--muted);
  min-width: 56px;
}
.set-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}
.set-remove:active { color: var(--danger); }
.set-remove-placeholder { width: 26px; }

.stepper-card { display: flex; justify-content: center; padding: 16px 14px; }

.stepper {
  display: flex;
  align-items: center;
  gap: 16px;
}
.stepper-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--input);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.stepper-btn:active { background: var(--accent); color: var(--accent-text); }
.stepper-value {
  min-width: 64px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
}

/* --- onglets (Suivi, Réglages) --- */
.tabs { display: flex; gap: 8px; margin: 14px 0 16px; }
.tab-btn {
  flex: 1;
  background: var(--input);
  color: var(--muted);
  border: none;
  border-radius: 10px;
  padding: 9px;
  font-size: 13px;
  cursor: pointer;
}
.tab-btn.active { background: var(--accent); color: var(--accent-text); font-weight: 500; }

/* --- listes à cocher (formulaires Réglages, lancement de séance) --- */
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; }
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  accent-color: var(--accent);
}
.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.icon-btn:active { color: var(--danger); }

/* --- Stats : calendrier type GitHub + courbes --- */
.stats-scroll { overflow-x: auto; padding-bottom: 4px; }
.stats-grid { display: flex; gap: 3px; width: max-content; }
.stats-week { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }
.stats-cell { width: 11px; height: 11px; border-radius: 2px; background: var(--input); }
.stats-cell.lvl1 { background: rgba(30, 230, 163, 0.35); }
.stats-cell.lvl2 { background: rgba(30, 230, 163, 0.6); }
.stats-cell.lvl3 { background: var(--accent); }
.stats-cell.lvl-empty { background: transparent; }

/* --- photos : galerie + comparateur slider --- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--card);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 4px 6px;
  font-size: 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
}

.photo-compare {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 3 / 4;
  background: var(--card);
}
.photo-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-compare-after { position: absolute; inset: 0; }
.photo-compare input[type="range"] {
  position: absolute;
  bottom: 10px;
  left: 8px;
  width: calc(100% - 16px);
  background: transparent;
  padding: 0;
  margin: 0;
  height: 20px;
  accent-color: var(--accent);
}
