:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #efece3;
  --text: #1d1f1c;
  --muted: #62665f;
  --border: #dedad0;
  --primary: #1d5fbf;
  --primary-soft: #e1ebfa;
  --green: #1f7a4d;
  --green-soft: #dff0e6;
  --yellow: #e8a917;
  --yellow-soft: #fbf0d3;
  --red: #c8342b;
  --red-soft: #f8e0de;
  --blue: #2a62b8;
  --blue-soft: #e0e9f7;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141614;
    --surface: #1d201d;
    --surface-2: #262a26;
    --text: #ecece6;
    --muted: #a3a89f;
    --border: #343a34;
    --primary: #3d7bd9;
    --primary-soft: #1c2b45;
    --green: #4cbf83;
    --green-soft: #1d3a2a;
    --yellow: #f2c04a;
    --yellow-soft: #3a3120;
    --red: #ec6a60;
    --red-soft: #3d2220;
    --blue: #7aa7ec;
    --blue-soft: #1f2c42;
    --shadow: none;
    color-scheme: dark;
  }
}

/* thème sombre choisi dans le profil (quel que soit le réglage du téléphone) */
:root[data-theme="dark"] {
    --bg: #141614;
    --surface: #1d201d;
    --surface-2: #262a26;
    --text: #ecece6;
    --muted: #a3a89f;
    --border: #343a34;
    --primary: #3d7bd9;
    --primary-soft: #1c2b45;
    --green: #4cbf83;
    --green-soft: #1d3a2a;
    --yellow: #f2c04a;
    --yellow-soft: #3a3120;
    --red: #ec6a60;
    --red-soft: #3d2220;
    --blue: #7aa7ec;
    --blue-soft: #1f2c42;
    --shadow: none;
    color-scheme: dark;
  --j0: #7aa7ec; --j1: #ec6a60;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { font-size: 16px; }
html[data-taille="grand"] { font-size: 18px; }
body {
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h4 { font-size: 1rem; margin-top: 1.1em; }
p { margin: 0 0 .8em; }

/* ---------- barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: conic-gradient(var(--red) 0 33%, var(--yellow) 0 66%, var(--green) 0);
}
.stats { display: flex; gap: 10px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.stats span { display: inline-flex; align-items: center; gap: 3px; }

main { max-width: 680px; margin: 0 auto; padding: 16px; outline: none; }

/* ---------- navigation du bas ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 0 7px; font-size: .72rem; color: var(--muted); text-decoration: none;
}
.bottomnav a .ic { font-size: 1.25rem; line-height: 1.2; filter: grayscale(1); opacity: .7; }
.bottomnav a.active { color: var(--primary); font-weight: 700; }
.bottomnav a.active .ic { filter: none; opacity: 1; }

/* ---------- éléments communs ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 18px;
  border: 0; border-radius: 12px;
  background: var(--primary); color: #fff;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btns { display: flex; gap: 10px; }
.btns .btn { flex: 1; }

.hero { padding: 20px 16px; background: var(--primary); color: #fff; border: 0; }
.hero h1 { margin-bottom: 4px; }
.hero p { opacity: .9; margin: 0; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.hero .progress { background: rgba(255,255,255,.25); margin-top: 14px; }
.hero .progress > i { background: var(--yellow); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.tile {
  display: block; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
}
.tile b { display: block; }
.tile .small { color: var(--muted); }
.tile.accent { border-color: var(--yellow); background: var(--yellow-soft); }

.list { list-style: none; margin: 0; padding: 0; }
.list a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); text-decoration: none;
}
.list .check { margin-left: auto; color: var(--primary); font-weight: 700; }

/* ---------- fiches ---------- */
.fiche h4 { color: var(--primary); }
.fiche ul, .fiche ol { padding-left: 1.2em; margin: 0 0 .8em; }
.fiche li { margin-bottom: .35em; }
.defs dt { font-weight: 700; margin-top: .7em; color: var(--primary); }
.defs dd { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; margin-bottom: .8em; }
.tbl th, .tbl td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.tbl th { background: var(--surface-2); }
.astuce { background: var(--yellow-soft); border-left: 4px solid var(--yellow); padding: 10px 12px; border-radius: 8px; margin: .8em 0; }
.formule { background: var(--blue-soft); padding: 10px 12px; border-radius: 8px; font-weight: 700; text-align: center; }
.etapes li { margin-bottom: .6em; }

/* ---------- cartes-mémoire ---------- */
.flash {
  min-height: 230px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; font-size: 1.15rem; cursor: pointer; user-select: none;
}
.flash .face-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.flash.back { background: var(--primary-soft); border-color: var(--primary); }
.boxes { display: flex; gap: 6px; margin: 10px 0 16px; }
.boxes div { flex: 1; text-align: center; padding: 6px 2px; border-radius: 8px; background: var(--surface-2); font-size: .75rem; }
.boxes b { display: block; font-size: 1.05rem; }

/* ---------- quiz ---------- */
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice {
  text-align: left; min-height: 48px; padding: 12px 14px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.choice.good { border-color: var(--green); background: var(--green-soft); }
.choice.bad { border-color: var(--red); background: var(--red-soft); }
.choice:disabled { cursor: default; }
.feedback { margin-top: 12px; padding: 12px; border-radius: 10px; }
.feedback.ok { background: var(--green-soft); }
.feedback.ko { background: var(--red-soft); }
.score-big { font-size: 3rem; font-weight: 800; color: var(--primary); text-align: center; margin: 8px 0; }

/* ---------- atelier ---------- */
.parents { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; text-align: center; }
.parent { padding: 10px 6px; border-radius: 12px; background: var(--surface-2); }
.parent .geno { font-size: 1.15rem; font-weight: 800; font-family: ui-monospace, Consolas, monospace; }
.times { font-size: 1.4rem; font-weight: 700; color: var(--muted); }
.step-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 4px 0 10px; }
.step-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .85rem;
}
.step-num.todo { background: var(--surface-2); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  min-width: 52px; min-height: 44px; padding: 8px 12px;
  border: 2px solid var(--border); border-radius: 99px;
  background: var(--surface); color: var(--text);
  font: 700 1rem ui-monospace, Consolas, monospace; cursor: pointer;
}
.chip.on { border-color: var(--primary); background: var(--primary-soft); }
.chip.bad { border-color: var(--red); background: var(--red-soft); }
.grid-wrap { overflow-x: auto; margin-bottom: 12px; }
.punnett { border-collapse: separate; border-spacing: 4px; margin: 0 auto; font-family: ui-monospace, Consolas, monospace; }
.punnett th { font-size: .85rem; padding: 4px; color: var(--muted); }
.punnett th.g { background: var(--yellow-soft); color: var(--text); border-radius: 8px; }
.punnett td {
  min-width: 58px; padding: 8px 4px; text-align: center; font-size: .82rem; font-weight: 700;
  background: var(--surface-2); border-radius: 8px; transition: background .3s;
}
.pheno-rows { display: grid; gap: 8px; }
.pheno-row { display: flex; align-items: center; gap: 8px; }
.pheno-row .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.pheno-row .lbl { flex: 1; font-size: .92rem; }
.pheno-row input {
  width: 58px; min-height: 42px; text-align: center; font: 700 1rem system-ui;
  border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.pheno-row input.good { border-color: var(--green); }
.pheno-row input.bad { border-color: var(--red); }
.pheno-row .den { color: var(--muted); font-weight: 600; width: 40px; }
.legend-note { font-size: .85rem; color: var(--muted); }

/* ---------- duel ---------- */
:root { --j0: #2a62b8; --j1: #c8342b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --j0: #7aa7ec; --j1: #ec6a60; } }
.j0 { color: var(--j0); }
.j1 { color: var(--j1); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: .88rem; font-weight: 700; margin-bottom: 4px; }
.field input {
  width: 100%; min-height: 46px; padding: 8px 12px; font: inherit;
  border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.field input:focus { border-color: var(--primary); outline: none; }
.handoff { text-align: center; padding: 24px 16px; }
.handoff-nom { font-size: 2rem; font-weight: 800; margin: 0 0 8px; word-break: break-word; }
.duel-score {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.duel-score > div {
  flex: 1; min-width: 0; padding: 10px; border-radius: 12px; background: var(--surface);
  border: 2px solid currentColor; text-align: center;
}
.duel-score span { display: block; font-size: .82rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-score b { font-size: 1.4rem; color: var(--text); }
.duel-score i { font-style: normal; font-weight: 700; color: var(--muted); }
.duel-tag { font-weight: 800; }
.chrono { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px 0 14px; }
.chrono i { display: block; height: 100%; width: 100%; background: var(--primary); transition: width .1s linear; }
.chrono i.urgent { background: var(--red); }
.choice.picked { border-color: var(--text); background: var(--surface-2); }
.reveal { padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; }
.reveal.ok { background: var(--green-soft); }
.reveal.ko { background: var(--red-soft); }

/* ---------- matières ---------- */
.matieres {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 10px;
  background: var(--surface-2); border-radius: 12px;
}
.matiere {
  flex: 1; text-align: center; padding: 9px 8px; border-radius: 9px;
  color: var(--muted); font-weight: 700; text-decoration: none;
}
.matiere.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* ---------- chapitres ---------- */
.chap-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.chap-tabs::-webkit-scrollbar { display: none; }
.chap-tab {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 99px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; text-decoration: none; font-size: .92rem;
}
.chap-tab span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.chap-tab.on { border-color: var(--primary); background: var(--primary-soft); }
.chap-label { margin: -4px 0 12px; }

/* ---------- jeu « Défends l'organisme » ---------- */
.vies { font-size: 1.05rem; letter-spacing: 2px; }
.threat { font-size: 1.02rem; }
.poche { padding: 12px 6px; border-radius: 12px; background: var(--red-soft); text-align: center; }
.poche .grp { font-size: 1.8rem; font-weight: 800; color: var(--red); }
.ordre { margin: 8px 0 12px; padding-left: 1.6em; }
.ordre li { margin-bottom: 6px; }
.ordre li.vide { color: var(--muted); }
.ordre .pos {
  width: 100%; text-align: left; padding: 8px 10px; min-height: 40px;
  border: 2px solid var(--primary); border-radius: 10px; background: var(--primary-soft); color: var(--text); font: inherit; font-size: .92rem; cursor: pointer;
}
.ordre .pos.good { border-color: var(--green); background: var(--green-soft); }
.ordre .pos.bad { border-color: var(--red); background: var(--red-soft); }
.ordre .pos:disabled { cursor: default; }
.pool { display: grid; gap: 8px; margin-bottom: 12px; }
.pool .step { min-height: 42px; padding: 8px 12px; font-size: .92rem; border-style: dashed; }

/* ---------- jeu « Influx express » ---------- */
.schema { display: block; width: 100%; height: auto; max-width: 420px; margin: 0 auto; font-family: system-ui, sans-serif; }
.mission-tag {
  display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 99px;
  background: var(--blue-soft); color: var(--blue); font-size: .8rem; font-weight: 700;
}

/* ---------- bandeau de mise à jour ---------- */
.maj {
  position: fixed; left: 12px; right: 12px; z-index: 30;
  bottom: calc(76px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 14px;
  background: var(--text); color: var(--bg);
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  animation: maj-in .3s ease-out;
}
.maj-txt { flex: 1; line-height: 1.35; }
.maj .btn { min-height: 40px; padding: 8px 14px; flex: none; }
.maj-x {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font-size: 1rem; cursor: pointer; opacity: .7;
}
@keyframes maj-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- jeu « Laboratoire de l'évolution » ---------- */
.adn { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.adn code { font: 700 1.02rem/1.5 ui-monospace, Consolas, monospace; letter-spacing: .04em; margin-bottom: 6px; word-break: break-all; }

/* ---------- mon espace ---------- */
.topbar-droite { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 800; text-decoration: none;
  border: 2px solid transparent;
}
.avatar.on { border-color: var(--primary); }
.sous-menu { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 2px; scrollbar-width: none; }
.sous-menu::-webkit-scrollbar { display: none; }
.sous-menu a {
  flex: none; padding: 7px 13px; border-radius: 99px; text-decoration: none; font-weight: 700; font-size: .9rem;
  color: var(--muted); background: var(--surface-2);
}
.sous-menu a.on { background: var(--primary); color: #fff; }
.form select, .form input[type="date"], .form input[type="time"], .form input[type="number"] {
  width: 100%; min-height: 46px; padding: 8px 12px; font: inherit;
  border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.form select:focus, .form input:focus { border-color: var(--primary); outline: none; }
.form .sec, h3.sec { font-size: 1rem; margin: 18px 0 6px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 400; margin-bottom: 4px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.niveau-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.niveau-row:last-of-type { border-bottom: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 7px 4px; border-radius: 8px; font-size: .85rem; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font-weight: 600;
}
.seg input:checked + span { background: var(--primary); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.espace-intro { display: block; text-decoration: none; color: var(--text); border: 2px dashed var(--primary); }
.espace-intro b { display: block; font-size: 1.1rem; margin-bottom: 4px; }
.pastille { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--yellow-soft); color: var(--text); white-space: nowrap; }
.cours-jour { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cours-jour span { font-size: .85rem; padding: 4px 9px; border-radius: 8px; background: var(--surface-2); }
.seance-mini { display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: var(--primary-soft); }
.seance-mini.now { outline: 2px solid var(--primary); }
.seance-mini .btn { margin-top: 6px; }
.jour.auj { border-color: var(--primary); }
.creneau {
  display: flex; gap: 12px; align-items: center; padding: 9px 10px; margin-top: 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--text); text-decoration: none;
}
.creneau .h { flex: none; width: 92px; font-weight: 700; font-size: .9rem; }
.creneau.rev { background: var(--primary-soft); border-left: 4px solid var(--primary); }
.phase { display: grid; gap: 4px; border-left: 4px solid var(--yellow); }
.seance-ligne { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); padding: 12px; }
.seance-ligne .h { flex: none; width: 52px; font-weight: 800; }
.seance-ligne .etat { margin-left: auto; flex: none; font-size: .8rem; font-weight: 700; }
.seance-ligne.fait { opacity: .7; }
.seance-ligne.fait .etat { color: var(--green); }
.seance-ligne.maintenant { border: 2px solid var(--primary); }
.seance-ligne.maintenant .etat { color: var(--primary); }
.seance-ligne.manquee .etat { color: var(--muted); }
.etapes-seance { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.etapes-seance li {
  display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
.etapes-seance .num {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 800;
}
.etapes-seance li.ok .num { background: var(--green-soft); color: var(--green); }
.etapes-seance li.ok .txt { color: var(--muted); text-decoration: line-through; }
.etapes-seance .txt { flex: 1; }
.etapes-seance .btn { flex: none; min-height: 38px; padding: 6px 12px; }
.rappel {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 31; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: var(--primary); color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.25); animation: maj-in .3s ease-out;
}
.rappel .btn { background: #fff; color: var(--primary); min-height: 40px; padding: 8px 14px; flex: none; }
.chap-ligne { display: grid; grid-template-columns: 1fr 70px 40px; gap: 8px; align-items: center; margin-top: 10px; }
.fichier { width: 100%; padding: 10px; border: 2px dashed var(--border); border-radius: 10px; font: inherit; }

/* --- grille de l'emploi du temps --- */
.grille-wrap { overflow-x: auto; margin: 0 -4px 6px; padding: 0 4px; }
.grille-edt { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.grille-edt thead th { font-size: .78rem; font-weight: 700; color: var(--text); padding: 2px; }
.grille-edt thead th span { display: block; font-weight: 400; color: var(--muted); }
.grille-edt thead th:first-child, .grille-edt tbody th { width: 40px; }
.grille-edt tbody th { font-size: .85rem; text-align: left; color: var(--muted); }
.grille-edt tr.auj th { color: var(--primary); }
.grille-edt .case {
  width: 100%; min-height: 48px; padding: 4px; border-radius: 10px; cursor: pointer;
  border: 2px dashed var(--border); background: transparent; color: var(--muted);
  font: 700 .86rem/1.2 system-ui, sans-serif; overflow-wrap: anywhere;
}
.grille-edt .case.pleine { border: 2px solid transparent; background: var(--surface-2); color: var(--text); }
.grille-edt tr.auj .case.pleine { background: var(--primary-soft); }
.sheet-fond {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  background: var(--surface); color: var(--text); border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: maj-in .2s ease-out;
}
.grille-matieres { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.grille-matieres .mat {
  min-height: 48px; padding: 8px; border-radius: 12px; cursor: pointer; text-align: center;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: 600 .95rem system-ui, sans-serif;
}
.grille-matieres .mat.on { border-color: var(--primary); background: var(--primary-soft); }
.grille-matieres .mat.autre { border-style: dashed; color: var(--muted); }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce {
  min-height: 40px; min-width: 48px; padding: 6px 12px; border-radius: 99px; cursor: pointer;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: 600 .9rem system-ui, sans-serif;
}
.puce.on { border-color: var(--primary); background: var(--primary); color: #fff; }
.puce.lien { border-style: dashed; color: var(--primary); }
.revs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rev-puce {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 99px;
  background: var(--primary-soft); font-size: .88rem; font-weight: 600;
}
.rev-puce button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.ajout-rev input[type="time"] { width: 100%; }
.heure-row { display: grid; grid-template-columns: 62px 1fr auto 1fr 36px; gap: 6px; align-items: center; margin-bottom: 8px; }
.heure-row .heure-num { font-size: .85rem; font-weight: 700; }
.heure-row input { min-height: 42px !important; padding: 6px !important; }
.heure-row .suppr-h { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer; }

.etat-suivi { margin: 6px 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--yellow-soft); font-size: .9rem; }
.etat-suivi.ok { background: var(--green-soft); }
.etat-suivi.ko { background: var(--red-soft); }
.check-row.consent { align-items: flex-start; font-size: .9rem; }
.check-row.consent input { margin-top: 3px; }
.form input[type="email"] { width: 100%; min-height: 46px; padding: 8px 12px; font: inherit; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 20; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 360px) {
  .tiles { grid-template-columns: 1fr; }
  .stats { gap: 6px; font-size: .8rem; }
}
