/* Moi — interface personnelle. Mobile d'abord, clair/sombre selon le système. */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #191c27;
  --muted: #6a7184;
  --border: #e3e6ee;
  --accent: #5b5bd6;
  --accent-soft: #ececfc;
  --accent-text: #ffffff;
  --es: #ef6c1a;
  --es-soft: #fdeee3;
  --sante: #12a37a;
  --sante-soft: #e0f5ee;
  --mem: #8250df;
  --mem-soft: #f1eafd;
  --ok: #2b9a48;
  --ok-soft: #e3f4e7;
  --danger: #d63b3b;
  --danger-soft: #fbe7e7;
  --ins: #d9f2df;
  --del: #fbe1e1;
  --shadow: 0 1px 2px rgba(20, 23, 40, .04), 0 4px 16px rgba(20, 23, 40, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1016;
    --surface: #171a23;
    --surface-2: #1f2330;
    --text: #e9ebf3;
    --muted: #9399ab;
    --border: #2a2f3d;
    --accent: #8484ff;
    --accent-soft: #23244a;
    --accent-text: #0e1016;
    --es: #ff8c42;
    --es-soft: #3a2516;
    --sante: #2fd09e;
    --sante-soft: #12302a;
    --mem: #a77bff;
    --mem-soft: #2a1f42;
    --ok: #4cc66a;
    --ok-soft: #173020;
    --danger: #ff6b6b;
    --danger-soft: #3a1c1c;
    --ins: #1d3b26;
    --del: #432222;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- Barre du haut et navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-in { max-width: 1040px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.15rem; color: var(--text); letter-spacing: -.02em; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.topnav { display: none; gap: 4px; flex: 1; }
.topnav a, .compte-lien {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 550; font-size: .95rem;
}
.topnav a:hover, .compte-lien:hover { background: var(--surface-2); color: var(--text); }
.topnav a.actif { background: var(--accent-soft); color: var(--accent); }
.compte-lien { margin-left: auto; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .72rem; font-weight: 600;
}
.bottomnav a svg.i { width: 23px; height: 23px; }
.bottomnav a.actif { color: var(--accent); }

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; }
  .bottomnav { display: none; }
}

/* ---------- Mise en page ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 32px; }
.page-tete { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-tete p { margin-top: 4px; }
.pile { display: flex; flex-direction: column; gap: 16px; }
.grille { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grille.g2-mobile { grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) {
  .grille.g2 { grid-template-columns: 1fr 1fr; }
  .grille.g3 { grid-template-columns: repeat(3, 1fr); }
  .grille.g4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 900px) { .seulement-mobile { display: none !important; } }

.carte {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.carte-tete h2 { display: flex; align-items: center; gap: 8px; }

/* ---------- Sous-navigation en pilules ---------- */
.pilules { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -4px 0 18px; padding: 2px; }
.pilules::-webkit-scrollbar { display: none; }
.pilules a {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
}
.pilules a.actif { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }

/* ---------- Contrôle segmenté ---------- */
.segment { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segment button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 16px; border-radius: 9px; cursor: pointer;
}
.segment button.actif { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Formulaires ---------- */
label.champ { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=number] { -moz-appearance: textfield; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: .95rem; cursor: pointer;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 16px;
  background: var(--accent); color: var(--accent-text);
  transition: transform .08s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.grand { padding: 13px 22px; font-size: 1rem; }
.btn.plein { width: 100%; }
.btn.discret { background: var(--surface-2); color: var(--text); }
.btn.contour { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn-icone {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.btn-icone:hover { background: var(--surface-2); color: var(--text); }
.btn-icone.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: .88rem; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.puce.actif { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.es { background: var(--es-soft); color: var(--es); }
.badge.sante { background: var(--sante-soft); color: var(--sante); }
.badge.mem, .badge.general { background: var(--mem-soft); color: var(--mem); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge:empty { display: none; }

.barre-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.barre-actions .droite { margin-left: auto; }

/* ---------- Tuiles de chiffres ---------- */
.tuile { display: flex; flex-direction: column; gap: 2px; }
.tuile .valeur { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; }
.tuile .etiquette { font-size: .82rem; color: var(--muted); font-weight: 600; }
.tuile .tendance { font-size: .8rem; font-weight: 650; }
.tendance.bas { color: var(--ok); }
.tendance.haut { color: var(--danger); }

/* ---------- Accueil ---------- */
.raccourcis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
@media (min-width: 760px) { .raccourcis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.raccourci {
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 650; font-size: .92rem;
  box-shadow: var(--shadow); transition: transform .1s;
}
.raccourci:hover { transform: translateY(-1px); }
.pastille { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.pastille.petite { width: 30px; height: 30px; border-radius: 9px; }
.pastille.petite svg.i { width: 17px; height: 17px; }
.pastille.grande { width: 52px; height: 52px; border-radius: 16px; }
.pastille.grande svg.i { width: 26px; height: 26px; }
a.carte { color: inherit; transition: transform .1s; }
a.carte:hover { transform: translateY(-1px); }
.pastille.es { background: var(--es-soft); color: var(--es); }
.pastille.sante { background: var(--sante-soft); color: var(--sante); }
.pastille.mem { background: var(--mem-soft); color: var(--mem); }
.pastille.accent { background: var(--accent-soft); color: var(--accent); }
.mini-graphe { height: 70px; margin-top: 12px; }
.coach-jour { margin-bottom: 18px; border-left: 4px solid var(--accent); }
.coach-jour .analyse strong { color: var(--accent); }
.graphe { position: relative; height: 240px; }
.graphe.haut { height: 300px; }

/* ---------- Correction ---------- */
.zone-texte { position: relative; }
.zone-texte .compteur { position: absolute; right: 12px; bottom: 10px; font-size: .75rem; color: var(--muted); pointer-events: none; }
.resultat { animation: apparait .25s ease-out; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } }
.texte-final {
  white-space: pre-wrap; font-size: 1.05rem; line-height: 1.65; padding: 14px 16px;
  background: var(--surface-2); border-radius: 12px; word-wrap: break-word;
}
.texte-final ins { background: var(--ins); text-decoration: none; border-radius: 4px; padding: 0 2px; }
.texte-final del { background: var(--del); color: var(--muted); border-radius: 4px; padding: 0 2px; }
.liste-erreurs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.liste-erreurs li { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--border); }
.liste-erreurs li:first-child { border-top: 0; }
.erreur-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fautif { text-decoration: line-through; text-decoration-color: var(--danger); color: var(--muted); }
.corrige { font-weight: 700; color: var(--ok); }
.fleche { color: var(--muted); }
.conseil { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); }
.conseil svg.i { color: var(--accent); margin-top: 2px; }
.bravo { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 650; }
.notes { margin: 0; padding-left: 18px; color: var(--muted); }
.notes li { margin: 4px 0; }

/* ---------- Conversation ---------- */
.chat-cadre { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .chat-cadre { grid-template-columns: 260px 1fr; } }
.chat-liste { display: none; }
@media (min-width: 900px) { .chat-liste { display: flex; flex-direction: column; gap: 4px; } }
.chat-liste.ouverte {
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.conv-item {
  display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--text);
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.actif { background: var(--accent-soft); }
.conv-item .titre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: .92rem; }
.conv-item .btn-icone { width: 28px; height: 28px; opacity: 0; }
.conv-item:hover .btn-icone { opacity: 1; }
.chat {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  height: calc(100dvh - 280px - env(safe-area-inset-bottom)); min-height: 340px;
}
@media (min-width: 760px) { .chat { height: calc(100dvh - 250px); } }
@media (max-width: 759px) {
  .page-tete.compacte { flex-wrap: nowrap; align-items: center; }
  .page-tete.compacte p, .page-tete.compacte .btn span { display: none; }
  .page-tete.compacte .btn { padding: 10px 12px; }
}
.chat-fil { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.bulle { max-width: 85%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; }
.bulle.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; }
.bulle.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.fautes {
  align-self: flex-end; max-width: 85%; margin-top: -6px; padding: 8px 12px; border-radius: 12px;
  background: var(--es-soft); font-size: .86rem; animation: apparait .2s ease-out;
}
.fautes-titre { font-weight: 700; color: var(--es); }
.fautes ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.fautes.attente, .fautes.ok { background: transparent; padding: 0 4px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.fautes.attente { color: var(--muted); }
.fautes.ok { color: var(--ok); }
.fautes.ok svg.i { width: 16px; height: 16px; }
.bulle.ecrit::after { content: "▍"; animation: clignote 1s steps(2) infinite; color: var(--muted); }
@keyframes clignote { 50% { opacity: 0; } }
.chat-vide { margin: auto; text-align: center; max-width: 440px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.chat-vide .puces { justify-content: center; }
.chat-saisie { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--border); }
.chat-saisie textarea { min-height: 46px; max-height: 180px; resize: none; border-radius: 14px; }
.chat-saisie .btn { height: 46px; width: 46px; padding: 0; border-radius: 14px; flex: none; }

/* ---------- Santé ---------- */
.saisie-grille { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.saisie-grille .large { grid-column: 1 / -1; }
.jour-nav { display: flex; align-items: center; gap: 4px; }
.jour-nav strong { min-width: 150px; text-align: center; font-size: .95rem; }
.notes-echelle { display: flex; gap: 6px; }
.notes-echelle button {
  flex: 1; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-size: 1.25rem; cursor: pointer; filter: grayscale(1); opacity: .6; transition: all .12s;
}
.notes-echelle button.actif { filter: none; opacity: 1; border-color: var(--sante); background: var(--sante-soft); }
.notes-echelle.chiffres button, .notes-echelle.mots button { font-size: .95rem; font-weight: 700; color: var(--muted); filter: none; opacity: 1; }
.notes-echelle.mots button { font-size: .88rem; }
.notes-jour { display: flex; flex-direction: column; gap: 8px; }
.notes-jour:empty { display: none; }
.note-jour { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.note-jour .heure { font-size: .78rem; font-weight: 700; color: var(--muted); padding-top: 2px; flex: none; }
.note-jour p { flex: 1; white-space: pre-wrap; font-size: .95rem; }
.note-jour .btn-icone { width: 28px; height: 28px; flex: none; }
.sous-titre { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.badge.compris { background: var(--sante-soft); color: var(--text); font-weight: 600; font-size: .8rem; padding: 4px 10px; white-space: normal; }
.analyse { line-height: 1.65; white-space: pre-wrap; }
.analyse strong { color: var(--sante); }
details.carte > summary { font-size: .95rem; }
.bloc-saisie { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.bloc-saisie h3 { font-size: .95rem; }
.bloc-saisie summary { color: var(--muted); }
.ligne-options { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.compteur-champ { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); font-size: .9rem; }
.compteur-champ .btn-icone { border: 1px solid var(--border); font-size: 1.1rem; font-weight: 700; }
.compteur-champ output { min-width: 26px; text-align: center; font-size: 1.1rem; font-weight: 750; color: var(--text); }
.case { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); font-size: .9rem; cursor: pointer; }
.case input { width: 18px; height: 18px; accent-color: var(--accent); }
.notes-echelle.chiffres button.actif { color: var(--sante); }
.historique-ligne {
  display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; align-items: baseline;
}
.historique-ligne:first-child { border-top: 0; }
.historique-ligne .jour { display: inline-block; font-weight: 700; min-width: 92px; font-size: .9rem; }
.historique-ligne .jour::first-letter { text-transform: uppercase; }
.historique-ligne .resume { color: var(--muted); font-size: .9rem; }

/* ---------- Révision (flashcards) ---------- */
.revision { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.progression { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progression span { display: block; height: 100%; width: 0; background: var(--mem); transition: width .3s; }
.flashcard { min-height: 260px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: transform .25s; }
.flashcard.retournee { cursor: default; animation: retourne .3s ease-out; }
@keyframes retourne { from { transform: rotateX(70deg); opacity: .4; } }
.flashcard .recto { font-size: 1.6rem; font-weight: 650; text-align: center; margin: auto 0; word-wrap: break-word; }
.flashcard.retournee .recto { font-size: 1.15rem; color: var(--muted); text-decoration: line-through; text-decoration-color: var(--danger); margin: 0; }
.flashcard .verso { display: flex; flex-direction: column; gap: 8px; text-align: center; margin: auto 0; }
.flashcard .verso .corrige { font-size: 1.6rem; }
.touche { font-size: .75rem; font-weight: 600; opacity: .7; border: 1px solid currentColor; border-radius: 6px; padding: 1px 6px; }
.notes-revision { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.notes-revision .note {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.notes-revision .note span { font-size: .78rem; color: var(--muted); }
.notes-revision .note kbd { display: none; }
@media (pointer: fine) { .notes-revision .note kbd { display: inline; font: 600 .7rem ui-monospace, monospace; color: var(--muted); } }
.notes-revision .n1 strong { color: var(--danger); }
.notes-revision .n2 strong { color: var(--es); }
.notes-revision .n3 strong { color: var(--ok); }
.notes-revision .n4 strong { color: var(--accent); }
.notes-revision .note:hover { background: var(--surface-2); }

/* ---------- Entraînement aux temps ---------- */
.exercice { display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--border); }
.exercice.juste { border-left-color: var(--ok); }
.exercice.fausse { border-left-color: var(--danger); }
.exercice.presque { border-left-color: var(--es); }
.phrase-trou { font-size: 1.15rem; line-height: 2.2; }
.phrase-trou input {
  display: inline-block; width: auto; min-width: 80px; padding: 4px 8px; margin: 0 4px; font-size: 1.05rem; font-weight: 650;
  border-radius: 8px; border: 1px dashed var(--accent); background: var(--accent-soft);
}
.phrase-trou input:disabled { border-style: solid; color: var(--text); opacity: 1; }
.phrase-trou .verbe { color: var(--muted); font-size: .9rem; margin-right: 4px; }
.btn-lien { border: 0; background: none; color: var(--accent); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; padding: 0; }
.verdict { display: flex; flex-direction: column; gap: 2px; }
.verdict svg.i { color: var(--ok); vertical-align: -4px; }

/* ---------- Mémoire ---------- */
.fait {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border);
}
.fait:first-child { border-top: 0; }
.fait .contenu { flex: 1; min-width: 0; }
.fait .contenu p { cursor: text; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.fait .contenu p:hover { background: var(--surface-2); }
.fait .contenu input { padding: 6px 8px; }
.fait .meta { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.fait.inactif .contenu p { color: var(--muted); text-decoration: line-through; }
.interrupteur { position: relative; width: 38px; height: 22px; flex: none; margin-top: 2px; }
.interrupteur input { opacity: 0; width: 0; height: 0; }
.interrupteur span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); cursor: pointer; transition: background .15s; }
.interrupteur span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.interrupteur input:checked + span { background: var(--sante); }
.interrupteur input:checked + span::after { transform: translateX(16px); }
.ajout-fait { display: grid; grid-template-columns: 130px 1fr auto; gap: 8px; }
@media (max-width: 560px) { .ajout-fait { grid-template-columns: 1fr auto; } .ajout-fait select { grid-column: 1 / -1; } }
pre.apercu {
  white-space: pre-wrap; font: .82rem/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--surface-2);
  padding: 14px; border-radius: 12px; max-height: 420px; overflow: auto; margin: 0;
}
details summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "›"; font-size: 1.3rem; line-height: 1; transition: transform .15s; color: var(--muted); }
details[open] summary::before { transform: rotate(90deg); }

/* ---------- Connexion ---------- */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.connexion .carte { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.connexion .logo { width: 56px; height: 56px; border-radius: 16px; }
.alerte { padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: .9rem; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 760px) { .toasts { bottom: 24px; } }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  box-shadow: var(--shadow); animation: apparait .2s ease-out; max-width: 90vw;
}
.toast.erreur { background: var(--danger); color: #fff; }

.vide { text-align: center; color: var(--muted); padding: 24px 8px; }
.squelette { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: brille 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes brille { to { background-position: -200% 0; } }
