/* Full Potential Hub — design system
   Mobile-first, rendu "app" centré même sur grand écran. */

:root {
  --bg: #0A0A0A;
  --surface: #1F1F22;
  --surface-2: #29292d;
  --border: #333336;
  --text: #E8E6E0;
  --text-dim: #9C9A94;
  --accent: #6E7174;
  --accent-light: #9A9DA0;
  --success: #7FA88C;
  --error: #C97B7B;
  --radius: 16px;
  --radius-sm: 10px;
  --font-title: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;
  /* Zones de sécurité iOS (encoche, barre d'état, barre d'accueil) : non nulles
     en PWA standalone grâce à viewport-fit=cover. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --header-height: 72px;
  /* Échelle typographique */
  --fs-label: 11px;
  --fs-caption: 12px;
  --fs-small: 13px;
  --fs-body: 15px;
  --fs-section: 20px;
  --fs-value: 28px;
  --ls-caps: 0.04em;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  font-size: var(--fs-body);
  font-weight: 400;
}

h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

p { margin: 0; line-height: 1.6; }

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

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Le padding du haut inclut la barre d'état : le fond du header la couvre
     jusqu'en haut de l'écran, et son contenu commence sous l'encoche. */
  padding: calc(18px + var(--safe-top)) calc(20px + var(--safe-right)) 18px calc(20px + var(--safe-left));
  min-height: calc(var(--header-height) + var(--safe-top));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.app-header-titles {
  min-width: 0;
}

/* Bouton retour + logo, groupés à gauche du header. */
.app-header-start {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.app-header-eyebrow {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--accent-light);
  font-family: var(--font-title);
}

.app-header h1 {
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 18px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

main.content {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 20px calc(20px + var(--safe-right)) calc(48px + var(--safe-bottom)) calc(20px + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Filigrane de fond : le monogramme, très discret, ne doit jamais gêner
   la lecture ni les clics. */
.bg-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(60vw, 288px);
  opacity: 0.04;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.header-monogram {
  display: block;
  height: 28px;
  width: auto;
  min-width: 28px;
  flex-shrink: 0;
}

.card {
  background: linear-gradient(180deg, #1F1F22 0%, #1A1A1D 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-title {
  font-size: var(--fs-section);
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  line-height: 1.3;
}

.section-sub {
  font-size: var(--fs-small);
  color: var(--text-dim);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: var(--fs-label);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  font-weight: 600;
}

.input, select.input, textarea.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 16px; /* minimum : en dessous, Safari iOS zoome la page au focus */
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.input:focus { border-color: var(--accent-light); }
.input::placeholder { color: #6b6b6b; }
textarea.input { resize: vertical; min-height: 72px; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-light);
}

.input-file {
  width: 100%;
  font-size: var(--fs-small);
  color: var(--text-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-title);
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  /* Platine sur Obsidienne : le texte noir sur Acier n'atteignait que 4,03:1. */
  background: #E8E6E0;
  border-color: #E8E6E0;
  color: #0A0A0A;
}

.btn-ghost {
  background: transparent;
}

.btn-block { width: 100%; }
.btn-sm { padding: 9px 14px; font-size: 13px; }

/* Messages */
.message {
  font-size: var(--fs-small);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.message-error {
  color: var(--error);
  background: rgba(201, 123, 123, 0.1);
  border-color: rgba(201, 123, 123, 0.3);
}
.message-success {
  color: var(--success);
  background: rgba(127, 168, 140, 0.1);
  border-color: rgba(127, 168, 140, 0.3);
}

.banner-archived {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent-light);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

/* Discrete danger-zone style action at the bottom of a page */
.archive-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0 12px;
}
.archive-action .btn {
  color: var(--text-dim);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 9px 10px;
  border-radius: calc(var(--radius-sm) - 4px);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-title);
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
}
.tab-active {
  background: var(--surface-2);
  color: var(--text);
}

/* Auth page */
.auth-brand {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: calc(48px + var(--safe-top)) calc(20px + var(--safe-right)) 8px calc(20px + var(--safe-left));
}
.auth-logo {
  display: block;
  width: 150px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 12px;
}
/* Page de bienvenue (création du mot de passe après invitation) */
.welcome-intro {
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.welcome-title {
  font-size: var(--fs-section);
  line-height: 1.3;
}
.welcome-text {
  font-size: var(--fs-small);
  color: var(--text-dim);
}

/* Formulaire de connexion (et écran de confirmation), centré sous le logo. */
.auth-form {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
.auth-note {
  max-width: 320px;
  margin: 0 auto;
  text-align: center;
  font-size: var(--fs-caption);
  color: var(--text-dim);
}
.auth-brand p {
  color: var(--text-dim);
  font-size: var(--fs-small);
  margin-top: 6px;
}

/* Lists */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
}

.list-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.list-card-title {
  font-weight: 600;
  font-size: var(--fs-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-card-sub {
  font-size: var(--fs-small);
  color: var(--text-dim);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent-light);
  flex-shrink: 0;
}

.indice-chip {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-light);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  flex-shrink: 0;
}

.empty-text {
  color: var(--text-dim);
  font-size: var(--fs-small);
  text-align: center;
  padding: 14px 0;
}

/* Badges */
.badge {
  font-size: var(--fs-label);
  font-weight: 600;
  font-family: var(--font-title);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  padding: 5px 9px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.badge-envoyee { background: rgba(154, 157, 160, 0.15); color: var(--accent-light); }
.badge-realisee { background: rgba(127, 168, 140, 0.15); color: var(--success); }
.badge-annulee { background: rgba(201, 123, 123, 0.15); color: var(--error); }

/* Gauge */
.gauge-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 4px;
}
.gauge {
  position: relative;
  width: 196px;
  height: 196px;
}
.gauge-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.gauge-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 10;
}
.gauge-fg {
  fill: none;
  stroke: var(--accent-light);
  stroke-width: 10;
  stroke-linecap: round;
}
/* La valeur est en HTML, au centre exact du cercle et au-dessus de l'anneau. */
.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}
.gauge-value {
  display: block;
  font-family: var(--font-title);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: #E8E6E0;
  text-align: center;
}
.gauge-sub {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  line-height: 1.15;
}
.gauge-delta {
  font-size: var(--fs-caption);
  font-weight: 600;
  color: #E8E6E0;
  white-space: nowrap;
}
.gauge-label {
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  color: var(--text-dim);
  white-space: nowrap;
}
.gauge-caption {
  text-align: center;
  font-size: var(--fs-small);
  color: var(--text-dim);
  margin-top: -6px;
}

/* Step rows (éditeur) / cards */
.step-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
}
.step-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-label);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  font-weight: 600;
}
.remove-step {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.step-notes {
  font-size: var(--fs-small);
  color: var(--text-dim);
  font-style: italic;
}
.link-video {
  font-size: var(--fs-small);
  color: var(--accent-light);
  text-decoration: underline;
  width: fit-content;
}

/* Feedback */
.feedback-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-body);
}
.feedback-comment {
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.feedback-video {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  background: #000;
}
.coach-response {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.coach-response p {
  font-size: var(--fs-body);
}

/* Detail rows for session header */
.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.detail-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-consignes {
  font-size: var(--fs-body);
  color: var(--text-dim);
}


/* Navigation coach */
.coach-nav {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 6px;
  margin: 14px 20px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.coach-nav a {
  flex: 1;
  text-align: center;
  padding: 9px 6px;
  border-radius: calc(var(--radius-sm) - 4px);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-title);
  color: var(--text-dim);
}
.coach-nav a.active {
  background: var(--surface-2);
  color: var(--text);
}

/* Tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--accent-light);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
}
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-filter button {
  font-size: var(--fs-caption);
  font-weight: 600;
  font-family: var(--font-title);
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
}
.tag-filter button.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent-light);
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.item-card-desc {
  font-size: var(--fs-small);
  color: var(--text-dim);
}

/* Étapes (lecture) : lignes condensées, détail dans un panneau */
.step-line {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--fs-body);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.step-line:hover { border-color: var(--accent-light); }
.step-line:active { background: var(--surface-2); }
.step-line:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.step-line-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-chevron {
  font-size: 20px;
  line-height: 1;
  color: var(--text-dim);
  flex-shrink: 0;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-light);
  flex-shrink: 0;
}
.step-duree {
  font-size: var(--fs-caption);
  color: var(--text-dim);
  flex-shrink: 0;
}
.step-consigne {
  font-size: var(--fs-body);
  white-space: pre-line;
}

/* Sélecteur d'outil / de modèle */
.picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.picker-item {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.picker-item:hover { border-color: var(--accent-light); }

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-row .btn { flex: 1; }

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-caption);
  color: var(--text-dim);
}

.note-card {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note-card p {
  font-size: var(--fs-body);
  white-space: pre-line;
}
.note-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-caption);
  color: var(--text-dim);
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--fs-caption);
  color: var(--text-dim);
  text-decoration: underline;
  cursor: pointer;
}

.detail-text {
  font-size: var(--fs-body);
  white-space: pre-line;
}

/* Séances à venir */
.upcoming-card .list-card-title {
  display: block;
}
.upcoming-when {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 14px;
}
.upcoming-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.calendar-actions {
  margin-top: 2px;
}

/* Carte « Prochaine séance » : seule carte à contraste inversé de l'écran.
   Charte stricte : #E8E6E0 / #0A0A0A, nuances par opacité uniquement. */
.hero-card {
  background: #E8E6E0;
  color: #0A0A0A;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-eyebrow {
  font-family: var(--font-title);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  opacity: 0.6;
}
.hero-countdown {
  font-size: 14px;
  font-weight: 500;
}
.hero-countdown-soon {
  font-weight: 800;
}
.hero-when {
  display: flex;
  flex-direction: column;
  font-family: var(--font-title);
  font-size: var(--fs-value);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.hero-client {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  width: fit-content;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: var(--fs-body);
}
.hero-titre {
  font-weight: 600;
}
.hero-modalite {
  font-size: var(--fs-caption);
  font-weight: 600;
  border: 1px solid rgba(10, 10, 10, 0.35);
  border-radius: 999px;
  padding: 3px 9px;
}
.hero-lieu {
  font-size: var(--fs-small);
  opacity: 0.75;
  overflow-wrap: anywhere;
}
.hero-card a,
.hero-card .link-video {
  color: #0A0A0A;
  text-decoration: underline;
}
.hero-card .hero-client {
  text-decoration: none;
}
.hero-card .upcoming-links {
  font-size: var(--fs-small);
}
.hero-card .calendar-actions {
  margin-top: 6px;
}
.hero-card .btn {
  background: transparent;
  border-color: #0A0A0A;
  color: #0A0A0A;
  text-decoration: none;
}
.hero-empty {
  gap: 8px;
}
.hero-empty-title {
  font-family: var(--font-title);
  font-size: var(--fs-section);
  font-weight: 700;
}

/* Panneau de détail d'une étape (feuille depuis le bas) */
body.sheet-open { overflow: hidden; }
#step-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.7);
  animation: sheet-fade 0.2s ease;
}
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  animation: sheet-up 0.25s ease;
}
/* Poignée + en-tête : zone de glisser pour fermer ; le geste vertical est géré
   en JavaScript (step-sheet.js), le navigateur n'y fait plus défiler. */
.sheet-grab {
  touch-action: none;
  cursor: grab;
  flex-shrink: 0;
  /* Zone de contrôle : pas de sélection de texte qui détournerait le geste.
     Le contenu du panneau (consigne, objectif) reste sélectionnable. */
  user-select: none;
  -webkit-user-select: none;
}
.sheet-grab:active { cursor: grabbing; }
.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 12px;
  flex-shrink: 0;
}
.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sheet-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sheet-title {
  font-size: var(--fs-section);
  line-height: 1.25;
}
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sheet-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sheet-section h3 { margin: 0; }
.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
@keyframes sheet-up {
  from { transform: translate(-50%, 100%); }
  to { transform: translate(-50%, 0); }
}
@keyframes sheet-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop { animation: none; }
}

/* Aide sous un champ de formulaire */
.field-help {
  font-size: var(--fs-caption);
  color: var(--text-dim);
}

/* Progression : chiffres clés */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stat-value {
  font-family: var(--font-title);
  font-size: var(--fs-value);
  font-weight: 800;
  line-height: 1.1;
  color: #E8E6E0;
}
.stat-value small {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.6;
}
.stat-label {
  font-size: var(--fs-label);
  font-weight: 600;
  color: #E8E6E0;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
}
.stat-sub {
  font-size: var(--fs-caption);
  color: rgba(232, 230, 224, 0.6);
}

/* Progression : courbes SVG */
.chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chart-figure {
  position: relative;
  width: 100%;
}
.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
}
.chart-grid line {
  stroke: #6E7174;
  stroke-opacity: 0.2;
  stroke-width: 1;
  shape-rendering: crispEdges;
}
.chart-tick {
  font-family: var(--font-body);
  font-size: 10.5px;
  fill: rgba(232, 230, 224, 0.55);
}
.chart-line {
  fill: none;
  stroke: #E8E6E0;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart-dot {
  fill: #E8E6E0;
  stroke: #1F1F22;
  stroke-width: 2;
  transition: r 0.12s ease;
}
.chart-dot.is-active { r: 6; }
.chart-hit {
  fill: transparent;
  cursor: pointer;
  outline: none;
}
.chart-hit:focus-visible {
  stroke: #E8E6E0;
  stroke-width: 1.5;
  stroke-opacity: 0.6;
}
.chart-crosshair {
  stroke: #6E7174;
  stroke-width: 1;
}
.chart-end-label {
  font-family: var(--font-title);
  font-size: var(--fs-caption);
  font-weight: 700;
  fill: #E8E6E0;
}
.chart-tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 200px;
  padding: 8px 10px;
  background: #0A0A0A;
  border: 1px solid #6E7174;
  border-radius: 8px;
  font-size: var(--fs-caption);
  color: rgba(232, 230, 224, 0.7);
}
.chart-tooltip strong {
  font-family: var(--font-title);
  font-size: 15px;
  color: #E8E6E0;
}
.chart-tooltip em {
  color: #E8E6E0;
  line-height: 1.35;
}
.chart-foot {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-caption);
  color: rgba(232, 230, 224, 0.6);
}
.chart-foot-single {
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.chart-note {
  font-size: var(--fs-small);
  color: #E8E6E0;
}
.chart-table summary {
  font-size: var(--fs-caption);
  color: rgba(232, 230, 224, 0.6);
  cursor: pointer;
  width: fit-content;
}
.chart-table table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: var(--fs-caption);
}
.chart-table th,
.chart-table td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(110, 113, 116, 0.2);
  font-variant-numeric: tabular-nums;
}
.chart-table th {
  font-weight: 600;
  color: rgba(232, 230, 224, 0.6);
}

/* Progression : frise des séances réalisées */
.timeline {
  display: flex;
  flex-direction: column;
}
.timeline-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid rgba(110, 113, 116, 0.2);
  font-size: var(--fs-body);
}
.timeline-row:last-child { border-bottom: none; }
.timeline-date {
  flex: 0 0 64px;
  font-size: var(--fs-caption);
  color: rgba(232, 230, 224, 0.6);
  font-variant-numeric: tabular-nums;
}
.timeline-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-score {
  flex-shrink: 0;
  font-family: var(--font-title);
  font-size: var(--fs-caption);
  font-weight: 700;
  border: 1px solid #6E7174;
  border-radius: 999px;
  padding: 2px 8px;
}

/* Progression : citations « ce qui a évolué » */
.quote-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.quote {
  margin: 0;
  padding-left: 14px;
  border-left: 2px solid #6E7174;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quote blockquote {
  margin: 0;
  font-size: var(--fs-body);
  white-space: pre-line;
}
/* Espaces insécables : les guillemets ne se retrouvent jamais seuls en fin de ligne. */
.quote blockquote::before { content: '«\00a0'; }
.quote blockquote::after { content: '\00a0»'; }
.quote figcaption {
  font-size: var(--fs-caption);
  color: rgba(232, 230, 224, 0.6);
}

/* Progression : écran d'attente */
.progress-empty {
  align-items: center;
  text-align: center;
  padding: 36px 24px;
  gap: 12px;
}
.progress-empty-mark {
  width: 44px;
  height: auto;
  opacity: 0.5;
}
.progress-empty-title {
  font-size: var(--fs-section);
  line-height: 1.35;
  max-width: 300px;
}

.indice-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.indice-input-row input[type="range"] { flex: 1; }
.indice-number {
  width: 76px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-title);
  font-weight: 700;
}
.progression-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-margin-top: calc(var(--header-height) + var(--safe-top) + 12px);
}


/* Barre d'onglets fixe en bas (espace client) */
:root { --tab-bar-height: 58px; }
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #1F1F22;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
.tab-bar-item {
  flex: 1 1 0;
  min-width: 0;
  height: var(--tab-bar-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #6E7174;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.tab-bar-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab-bar-item.active { color: #E8E6E0; }
.tab-bar-item:focus-visible {
  outline: 2px solid #E8E6E0;
  outline-offset: -4px;
  border-radius: var(--radius-sm);
}
/* Le contenu ne passe jamais sous la barre. */
body.has-tab-bar main.content {
  padding-bottom: calc(var(--tab-bar-height) + 32px + var(--safe-bottom));
}
/* Réserve la place du bouton absent pour garder le titre centré. */
.header-spacer {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

/* Devoir en cours (accueil client) */
.devoir-meta {
  font-size: var(--fs-small);
  color: var(--text-dim);
}

/* Titre complet d'une séance, en tête de sa première carte */
.session-heading {
  font-size: var(--fs-section);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------
   Toucher (iOS) : pas de flash gris, réponse immédiate, zones de 44px
   ------------------------------------------------------------------ */
html { -webkit-tap-highlight-color: transparent; }

/* Contrôles : pas de délai de double-tap, pas de sélection du libellé à l'appui long. */
a, button, summary, label[for], input[type="range"], select {
  touch-action: manipulation;
}
button, .btn, .tab, .coach-nav a, .tab-bar-item, .icon-btn, .back-link, .list-card, .step-line, .timeline-row, .picker-item {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Le flash gris retiré, chaque élément touchable a son propre état d'appui.
   L'atténuation n'est pas un mouvement : elle reste active même en animations réduites. */
.tab:active,
.coach-nav a:active,
.tab-bar-item:active,
.icon-btn:active,
.back-link:active,
.remove-step:active,
.link-btn:active,
.link-video:active,
.upcoming-links a:active,
.hero-client:active,
.tag-filter button:active,
.chart-table summary:active,
a.list-card-title:active {
  opacity: 0.6;
}
@media (prefers-reduced-motion: reduce) {
  a.list-card:active,
  .step-line:active,
  .timeline-row:active,
  .picker-item:active,
  .btn:active:not(:disabled) {
    opacity: 0.8;
  }
}

/* Zones tactiles d'au moins 44 px sans changer le dessin : la zone cliquable
   déborde de l'élément par un pseudo-élément transparent. */
.icon-btn,
.back-link,
.btn,
.tab,
.coach-nav a,
.remove-step,
.link-btn,
.hero-client {
  position: relative;
}
.icon-btn::after,
.back-link::after,
.btn-sm::after,
.tab::after,
.coach-nav a::after,
.remove-step::after,
.link-btn::after,
.hero-client::after {
  content: '';
  position: absolute;
}
.icon-btn::after, .back-link::after { inset: -5px; }          /* 36 → 44 (placé dans la bordure de 1 px) */
.btn-sm::after { inset: -6px 0; }                              /* 35 → 45 (idem) */
.tab::after, .coach-nav a::after { inset: -6px 0; }           /* 33 → 45 */
.remove-step::after { inset: -11px; }                          /* 24 → 44 (idem) */
.link-btn::after { inset: -15px -6px; }                        /* 14 → 44 */
.hero-client::after { inset: -12px -4px; }                     /* 21 → 45 */
/* Liens textuels isolés (« Voir la séance » d'un devoir, lieu…) : même principe. */
.link-video {
  position: relative;
}
.link-video::after {
  content: '';
  position: absolute;
  inset: -15px -4px;                                           /* ~15 → 45 */
}
/* Ligne de liens d'une carte de séance (« Fiche client », « Voir la séance ») :
   les boutons calendrier sont juste dessous, il n'y a pas la place d'agrandir la
   zone sans la superposer à la leur. La ligne prend donc une vraie hauteur de 44 px. */
.upcoming-links {
  align-items: center;
}
.upcoming-links a,
.upcoming-links a.link-video {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.upcoming-links a.link-video::after { content: none; }
/* La navigation coach passe au-dessus du contenu pour que le bas de sa zone
   tactile ne soit pas recouvert. */
.coach-nav { z-index: 2; }
/* Le sous-titre sous le titre-lien d'une carte n'est pas interactif : le toucher
   le traverse et atteint le lien. */
.upcoming-card .list-card-body .list-card-sub { pointer-events: none; }
/* Titre-lien d'une carte (bloc tronqué, donc sans pseudo-élément débordant). */
.upcoming-card a.list-card-title {
  padding-block: 14px;
  margin-block: -14px;
}
/* Curseurs : piste agrandie à 44 px pour attraper le pouce facilement. */
input[type="range"] { height: 44px; }

/* ------------------------------------------------------------------
   Finitions : chargement, retours au toucher, animations
   ------------------------------------------------------------------ */

/* Texte réservé aux lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Blocs de substitution pendant le chargement */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skeleton {
  position: relative;
  overflow: hidden;
  background: #1F1F22;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(232, 230, 224, 0.06) 50%, transparent 100%);
}
.skeleton-row { height: 64px; }
.skeleton-row-sm { height: 48px; }
.skeleton-block { height: 110px; }
.skeleton-chart { height: 180px; }
.skeleton-tile { height: 92px; }
.skeleton-title { height: 20px; width: 45%; border-radius: 6px; }
.skeleton-hero { height: 280px; border-radius: var(--radius); }
.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Survol des boutons principaux (desktop) */
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
}

@media (prefers-reduced-motion: no-preference) {
  /* Apparition douce des blocs principaux, décalée de 40 ms */
  @keyframes reveal-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
  .reveal-stagger > * {
    animation: reveal-up 300ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--reveal-i, 0) * 40ms);
  }
  /* Rang compté parmi les blocs visibles : un bloc masqué ne crée pas de trou. */
  .reveal-stagger > :nth-child(2 of :not([hidden])) { --reveal-i: 1; }
  .reveal-stagger > :nth-child(3 of :not([hidden])) { --reveal-i: 2; }
  .reveal-stagger > :nth-child(4 of :not([hidden])) { --reveal-i: 3; }
  .reveal-stagger > :nth-child(5 of :not([hidden])) { --reveal-i: 4; }
  .reveal-stagger > :nth-child(6 of :not([hidden])) { --reveal-i: 5; }
  .reveal-stagger > :nth-child(7 of :not([hidden])) { --reveal-i: 6; }
  .reveal-stagger > :nth-child(n+8 of :not([hidden])) { --reveal-i: 7; }

  /* Reflet qui balaie les blocs de chargement */
  @keyframes skeleton-sweep {
    to { transform: translateX(100%); }
  }
  .skeleton::after { animation: skeleton-sweep 1.5s ease-in-out infinite; }

  /* Retour au toucher : réduction immédiate à l'appui */
  a.list-card,
  .step-line,
  .timeline-row,
  .picker-item,
  .btn {
    transition: transform 120ms ease, filter 0.15s ease, opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  }
  a.list-card:active,
  .step-line:active,
  .timeline-row:active,
  .picker-item:active,
  .btn:active:not(:disabled) {
    transform: scale(0.98);
  }

  /* Jauge : remplissage progressif en 1,2 s */
  .gauge-fg { transition: stroke-dashoffset 1.2s cubic-bezier(0.16, 1, 0.3, 1); }

  /* Courbes : tracé de gauche à droite en 800 ms, points et aire en fondu */
  @keyframes chart-draw { to { stroke-dashoffset: 0; } }
  @keyframes chart-fade { from { opacity: 0; } }
  .chart-animate .chart-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: chart-draw 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .chart-animate .chart-area,
  .chart-animate .chart-end-label {
    animation: chart-fade 800ms ease both;
  }
  .chart-animate .chart-dot {
    animation: chart-fade 240ms ease both;
    animation-delay: var(--dot-delay, 0ms);
  }
}

@media (min-width: 520px) {
  .app-shell {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
  }
}
