/* RV RAIZSENS — coach numérique CRV/ARV */
:root {
  --papier: #f7f3ea;
  --carte: #fffdf7;
  --encre: #26221c;
  --encre-douce: #6b6357;
  --ligne: #e3dccc;
  --bleu: #1e3a5f;
  --bleu-clair: #eaf0f7;
  --terre: #b05c2c;
  --terre-clair: #f7e9df;
  --vert: #3d6b45;
  --vert-clair: #e8f1e9;
  --rouge: #a03030;
  --ombre: 0 1px 3px rgba(38, 34, 28, .08), 0 4px 14px rgba(38, 34, 28, .06);
  --rayon: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--papier);
  color: var(--encre);
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; }

/* ---------- entête & navigation ---------- */
header.appbar {
  background: var(--bleu);
  color: #f3ede0;
  padding: .9rem 1.2rem .6rem;
}
header.appbar h1 { font-size: 1.25rem; letter-spacing: .04em; }
header.appbar h1 small { font-weight: 400; opacity: .75; font-size: .78rem; display: block; letter-spacing: .02em; }
.appbar-titre { display: flex; align-items: center; gap: .7rem; }
.appbar-logo { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }

/* une seule ligne : si l'écran est trop étroit, le menu défile horizontalement (glisser du doigt) */
nav.onglets {
  display: flex; gap: .15rem; flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--bleu);
  padding: 0 .8rem;
}
nav.onglets a {
  color: #cfd9e6; text-decoration: none; font-size: .86rem;
  padding: .5rem .8rem; border-radius: 8px 8px 0 0;
  white-space: nowrap;
}
nav.onglets a.actif { background: var(--papier); color: var(--bleu); font-weight: 600; }
nav.onglets a:hover:not(.actif) { background: rgba(255,255,255,.1); }

main { max-width: 980px; margin: 0 auto; padding: 1.4rem 1rem 4rem; }

/* ---------- composants ---------- */
.carte {
  background: var(--carte); border: 1px solid var(--ligne);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 1.1rem 1.3rem; margin-bottom: 1rem;
}
.carte h2 { font-size: 1.15rem; margin-bottom: .6rem; color: var(--bleu); }
.carte h3 { font-size: 1rem; margin: .8rem 0 .4rem; }

.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .grille2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--bleu); color: #fff; font-size: .95rem;
  padding: .55rem 1.2rem; border-radius: 8px;
  font-family: inherit;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn.secondaire { background: transparent; color: var(--bleu); border: 1.5px solid var(--bleu); }
.btn.terre { background: var(--terre); }
.btn.vert { background: var(--vert); }
.btn.discret { background: transparent; color: var(--encre-douce); border: 1px solid var(--ligne); font-size: .85rem; padding: .35rem .8rem; }
.btn.grand { font-size: 1.1rem; padding: .8rem 2rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .1rem .55rem; border-radius: 99px;
  background: var(--bleu-clair); color: var(--bleu);
}
.badge.terre { background: var(--terre-clair); color: var(--terre); }
.badge.vert { background: var(--vert-clair); color: var(--vert); }
.badge.rouge { background: #f7e2e2; color: var(--rouge); }

label { font-size: .88rem; color: var(--encre-douce); display: block; margin: .6rem 0 .2rem; }
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; padding: .5rem .7rem; font-size: .95rem; font-family: inherit;
  border: 1px solid var(--ligne); border-radius: 7px; background: #fff;
  color: var(--encre);
}
textarea { min-height: 4.5rem; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--bleu); }

.rangee { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.rangee > * { flex: 1; min-width: 130px; }

/* chips nature primaire */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.chip {
  border: 1.5px solid var(--ligne); background: #fff; border-radius: 99px;
  padding: .3rem .9rem; cursor: pointer; font-size: .88rem; font-family: inherit;
  color: var(--encre);
}
.chip.actif { background: var(--bleu); border-color: var(--bleu); color: #fff; }

/* barres de progression */
.progression { background: var(--ligne); border-radius: 99px; height: 10px; overflow: hidden; margin: .25rem 0 .1rem; }
.progression > div { background: var(--vert); height: 100%; border-radius: 99px; transition: width .4s; }
.progression.bleue > div { background: var(--bleu); }

/* critères */
ul.criteres { list-style: none; }
ul.criteres li { padding: .35rem 0; border-bottom: 1px dashed var(--ligne); font-size: .92rem; display: flex; gap: .6rem; align-items: baseline; }
ul.criteres li:last-child { border-bottom: none; }
ul.criteres .etat-ok { color: var(--vert); font-weight: 700; }
ul.criteres .etat-non { color: var(--encre-douce); }

/* ---------- assistant de session (wizard) ---------- */
.etapes-fil { display: flex; gap: .3rem; margin-bottom: 1rem; flex-wrap: wrap; }
.etapes-fil span {
  font-size: .75rem; padding: .2rem .7rem; border-radius: 99px;
  background: var(--ligne); color: var(--encre-douce);
}
.etapes-fil span.actif { background: var(--bleu); color: #fff; font-weight: 600; }
.etapes-fil span.fait { background: var(--vert-clair); color: var(--vert); }

.trn-affichage {
  font-family: Georgia, serif; font-size: 3rem; letter-spacing: .12em;
  text-align: center; color: var(--bleu); margin: 1rem 0;
  font-variant-numeric: tabular-nums;
}

.papier-rappel {
  background: var(--terre-clair); border-left: 4px solid var(--terre);
  padding: .7rem 1rem; border-radius: 0 8px 8px 0; font-size: .9rem; margin: .8rem 0;
}
.papier-rappel strong { color: var(--terre); }

.info-bleue {
  background: var(--bleu-clair); border-left: 4px solid var(--bleu);
  padding: .7rem 1rem; border-radius: 0 8px 8px 0; font-size: .9rem; margin: .8rem 0;
}

/* chrono / cool-down */
.chrono { text-align: center; margin: 1.2rem 0; }
.chrono .temps { font-size: 3.2rem; font-family: Georgia, serif; color: var(--bleu); font-variant-numeric: tabular-nums; }
.cercle-respiration {
  width: 110px; height: 110px; margin: 1rem auto; border-radius: 50%;
  background: radial-gradient(circle, var(--bleu-clair), #cfdcec);
  border: 2px solid var(--bleu);
  animation: respirer 10s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: var(--bleu); text-align: center;
}
@keyframes respirer {
  0% { transform: scale(.72); }
  50% { transform: scale(1.12); }
  100% { transform: scale(.72); }
}

.compteur-aol { display: flex; align-items: center; gap: .8rem; margin: .6rem 0; }
.compteur-aol .valeur { font-size: 1.6rem; font-family: Georgia, serif; min-width: 2rem; text-align: center; }

/* drill d'idéogrammes */
.case-gestalt { display: flex; align-items: center; gap: .5rem; margin: .15rem 0; font-size: .95rem; color: var(--encre); }
.case-gestalt input[type="checkbox"] { width: auto; accent-color: var(--bleu); }
.suppr-gestalt {
  border: none; background: none; color: var(--rouge); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0 .3rem; font-family: inherit;
}
.mot-gestalt { font-size: 2.6rem; }

/* feedback image */
.cible-feedback { text-align: center; }
.cible-feedback img {
  max-width: 100%; max-height: 420px; border-radius: 8px;
  border: 6px solid #fff; box-shadow: var(--ombre);
}
.paire-arv { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .paire-arv { grid-template-columns: 1fr; } }
.paire-arv figure {
  border: 2px solid var(--ligne); border-radius: 8px; padding: .6rem; text-align: center;
  cursor: pointer; background: #fff;
}
.paire-arv figure.choisie { border-color: var(--vert); background: var(--vert-clair); }
.paire-arv img { max-width: 100%; max-height: 260px; border-radius: 5px; }
.paire-arv figcaption { font-size: .85rem; margin-top: .4rem; color: var(--encre-douce); }

/* ---------- journal ---------- */
table.journal { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.journal th { text-align: left; padding: .4rem .5rem; border-bottom: 2px solid var(--bleu); color: var(--bleu); font-size: .8rem; }
table.journal td { padding: .45rem .5rem; border-bottom: 1px solid var(--ligne); vertical-align: top; }
table.journal tr:hover td { background: var(--bleu-clair); cursor: pointer; }

/* ---------- exercices ---------- */
.exo-liste details {
  background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px;
  margin-bottom: .5rem; padding: .6rem .9rem;
}
.exo-liste summary { cursor: pointer; font-weight: 600; font-size: .95rem; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.exo-liste summary::marker { color: var(--terre); }
.exo-meta { font-size: .8rem; color: var(--encre-douce); margin: .4rem 0; }
.exo-liste ol { margin: .4rem 0 .4rem 1.3rem; font-size: .9rem; }

/* ---------- stats ---------- */
.stat-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat-tuile { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: .8rem 1rem; text-align: center; }
.stat-tuile .valeur { font-size: 1.9rem; font-family: Georgia, serif; color: var(--bleu); }
.stat-tuile .legende { font-size: .78rem; color: var(--encre-douce); }
svg.graphe { width: 100%; height: auto; background: #fff; border: 1px solid var(--ligne); border-radius: 8px; }

/* ---------- divers ---------- */
.liste-simple { list-style: none; }
.liste-simple li { padding: .45rem 0; border-bottom: 1px dashed var(--ligne); font-size: .92rem; }
.liste-simple li:last-child { border-bottom: none; }
.muet { color: var(--encre-douce); font-size: .85rem; }
.centre { text-align: center; }
.droite { text-align: right; }
.mt1 { margin-top: 1rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

dialog {
  border: none; border-radius: var(--rayon); box-shadow: 0 10px 40px rgba(0,0,0,.25);
  padding: 1.4rem; max-width: 640px; width: 92%;
  background: var(--carte); color: var(--encre);
}
dialog::backdrop { background: rgba(38, 34, 28, .45); }

footer.pied {
  text-align: center; font-size: .78rem; color: var(--encre-douce);
  padding: 1rem; border-top: 1px solid var(--ligne);
}

/* ---------- page de bienvenue ---------- */
.frise-gestes { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; margin: .8rem 0; }
.frise-gestes .geste {
  flex: 1; min-width: 160px;
  background: var(--bleu-clair); border-radius: 8px;
  padding: .8rem .9rem; text-align: center; font-size: .88rem;
}
.frise-gestes .geste .num {
  display: block; width: 1.6rem; height: 1.6rem; line-height: 1.6rem;
  margin: 0 auto .35rem; border-radius: 50%;
  background: var(--bleu); color: #fff; font-weight: 700; font-size: .85rem;
}
.frise-gestes .fleche { align-self: center; color: var(--encre-douce); font-size: 1.3rem; }
@media (max-width: 640px) { .frise-gestes .fleche { display: none; } }
.cta-bienvenue { text-align: center; padding-bottom: 1.6rem; }
.cta-bienvenue h2 { text-align: center; }

/* ---------- retours apprenant de fin de phase ---------- */
details.retour-phase {
  border: 1px solid var(--ligne); border-radius: 8px;
  padding: .5rem .9rem; margin: .5rem 0; background: #fff;
}
details.retour-phase summary { cursor: pointer; font-size: .92rem; }
details.retour-phase summary::marker { color: var(--terre); }
details.retour-phase p { font-size: .9rem; margin: .45rem 0; }
.erreur-retour { color: var(--rouge); font-size: .88rem; margin-top: .6rem; }

/* ---------- comptes, synchro, connexion ---------- */
.appbar-ligne { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.appbar-outils { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }

/* liens d'administration dans l'entête (Formateur, Réglages) — même allure que Déconnexion */
.appbar-outils a {
  color: #cfd9e6; text-decoration: none; white-space: nowrap;
  border: 1px solid rgba(255,255,255,.35); border-radius: 8px;
  font-size: .78rem; padding: .25rem .7rem;
}
.appbar-outils a:hover { background: rgba(255,255,255,.12); }
.appbar-outils a.actif { background: var(--papier); color: var(--bleu); border-color: var(--papier); font-weight: 600; }

#etat-sync {
  font-size: .72rem; padding: .15rem .55rem; border-radius: 99px;
  background: rgba(255,255,255,.12); color: #cfd9e6; white-space: nowrap;
}
#etat-sync[data-etat="ok"] { background: rgba(120, 190, 130, .25); color: #d9f0dd; }
#etat-sync[data-etat="attente"] { background: rgba(230, 180, 90, .25); color: #f5e6c8; }
#etat-sync[data-etat="hors-ligne"] { background: rgba(210, 100, 90, .3); color: #f5d5d0; }

#btn-deconnexion {
  border: 1px solid rgba(255,255,255,.35); background: transparent; color: #cfd9e6;
  font-size: .78rem; padding: .25rem .7rem; border-radius: 8px; cursor: pointer;
  font-family: inherit;
}
#btn-deconnexion:hover { background: rgba(255,255,255,.12); }

body.non-connecte nav.onglets,
body.non-connecte footer.pied { display: none; }

.carte-connexion { max-width: 420px; margin: 8vh auto 0; }
.carte-connexion input { width: 100%; }
