/* Mia — carnet de journée, version pétillante. Mobile d'abord ; navigation latérale à partir de 900 px.
   Sens des couleurs (toujours doublé d'un mot) : soleil = à décider / hypothèse,
   menthe = confirmé / fait, violet = action. Le reste (rose, bleu ciel) n'est que décor. */

:root {
  --fond: #FFF8F1;
  --encre: #1F1640;
  --encre-douce: #5E5680;
  --bleu: #6A3CF5;           /* couleur d'action (nom historique conservé) */
  --bleu-fonce: #4E22D6;
  --violet-pale: #F0EAFF;
  --rose: #FF5D8F;
  --rose-pale: #FFE4EC;
  --ciel: #38B6FF;
  --soleil: #FFC53D;
  --sauge: #D5F6EA;
  --sauge-encre: #0B6A52;
  --ambre: #FFF0C4;
  --ambre-encre: #7A4A00;
  --blanc: #FFFFFF;
  --trait: #EDE4F7;
  --alerte: #C0263A;
  --alerte-fond: #FFE6EA;

  --ombre: 0 1px 2px rgb(31 22 64 / 0.06), 0 8px 24px rgb(106 60 245 / 0.08);
  --ombre-forte: 0 2px 4px rgb(31 22 64 / 0.08), 0 16px 40px rgb(106 60 245 / 0.18);
  --degrade: linear-gradient(120deg, #6A3CF5 0%, #B03CF0 45%, #FF5D8F 100%);

  --police: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --t-corps: 1rem;
  --t-petit: 0.875rem;
  --t-titre: clamp(2rem, 8vw, 2.75rem);
  --t-section: 1.25rem;

  --rayon: 22px;
  --rail: 1.75rem;
  --nav-h: 4.25rem;
  --marge: 1rem;
  --rebond: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 var(--t-corps)/1.5 var(--police);
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* Taches de couleur douces, fixes derrière tout le contenu. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38rem 26rem at 110% -6%, rgb(255 93 143 / 0.16), transparent 60%),
    radial-gradient(30rem 24rem at -14% 22%, rgb(255 197 61 / 0.20), transparent 60%),
    radial-gradient(34rem 28rem at 60% 112%, rgb(106 60 245 / 0.14), transparent 60%);
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: var(--t-titre);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h2 { font-size: var(--t-section); line-height: 1.25; font-weight: 800; letter-spacing: -0.015em; }
h3 { font-size: var(--t-corps); font-weight: 700; }

a { color: var(--bleu); text-underline-offset: 0.18em; text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; border-radius: 8px; }

.evitement { position: absolute; left: -999px; top: 0; background: var(--blanc); padding: 0.75rem 1rem; z-index: 50; }
.evitement:focus { left: 0; }

.chargement { padding: 3rem var(--marge); color: var(--encre-douce); font-weight: 600; }
.chargement::before { content: ""; display: inline-block; width: 0.9em; height: 0.9em; margin-right: 0.6rem; vertical-align: -0.1em; border-radius: 50%; background: var(--degrade); animation: pulser 1s ease-in-out infinite alternate; }
.discret { color: var(--encre-douce); font-size: var(--t-petit); }
.cache { display: none !important; }
.lecteur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Petite mascotte : une bulle dégradée avec deux yeux. */
.mascotte, .marque::before, .message.mia::before {
  --taille: 2rem;
  content: ""; flex: none; display: inline-block; width: var(--taille); height: var(--taille); border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%;
  background:
    radial-gradient(circle at 36% 44%, #fff 0 9%, transparent 10%),
    radial-gradient(circle at 64% 44%, #fff 0 9%, transparent 10%),
    var(--degrade);
  box-shadow: 0 4px 12px rgb(176 60 240 / 0.35);
}

/* ---------- Structure ---------- */

.coquille { min-height: 100dvh; display: flex; flex-direction: column; }

.entete {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.5rem;
  padding: calc(0.5rem + env(safe-area-inset-top)) var(--marge) 0.5rem;
  background: color-mix(in srgb, var(--fond) 80%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.marque { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 800; letter-spacing: -0.03em; font-size: 1.35rem; }
.marque::before { animation: flotter 4s ease-in-out infinite; }

.domaine-actif {
  margin-left: auto; min-height: 44px; max-width: 70%;
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.6rem 0.3rem 0.9rem; border: 0; border-radius: 999px;
  background: var(--blanc); box-shadow: var(--ombre); color: var(--encre); font: inherit; font-size: var(--t-petit); cursor: pointer;
  text-align: left; transition: transform 160ms var(--rebond);
}
button.domaine-actif:hover { transform: translateY(-1px); }
button.domaine-actif:active { transform: scale(0.97); }
.domaine-actif .noms { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.domaine-actif strong { font-weight: 700; overflow-wrap: anywhere; }
.domaine-actif .noms span { color: var(--encre-douce); font-size: 0.75rem; }
.domaine-actif svg { flex: none; color: var(--bleu); }

.cloche { position: relative; min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: var(--blanc); box-shadow: var(--ombre); cursor: pointer; color: var(--encre); display: grid; place-items: center; }
.cloche:hover svg { animation: sonner 600ms ease-in-out; }
.cloche[data-nombre]:not([data-nombre="0"])::after {
  content: attr(data-nombre); position: absolute; top: -2px; right: -2px;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; border-radius: 999px; border: 2px solid var(--fond);
  background: var(--rose); color: var(--blanc); font-size: 0.7rem; line-height: 1rem; font-weight: 800;
}

.contenu {
  flex: 1; width: 100%; max-width: 46rem;
  padding: 1rem var(--marge) calc(var(--nav-h) + 2.5rem + env(safe-area-inset-bottom));
}

.titre-ecran { margin-bottom: 1.5rem; }
.titre-ecran h1 { background: var(--degrade); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 0.08em; }
.titre-ecran .surtitre { font-weight: 700; color: var(--encre-douce); margin-bottom: 0.2rem; }
.titre-ecran p { margin-top: 0.4rem; color: var(--encre-douce); max-width: 36rem; }

/* Navigation basse (téléphone) : une barre flottante en pilule. */
.nav {
  position: fixed; left: 0.6rem; right: 0.6rem; bottom: calc(0.6rem + env(safe-area-inset-bottom)); z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--blanc) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-radius: 26px; box-shadow: var(--ombre-forte); padding: 0.3rem;
}
.nav a, .nav button {
  min-height: calc(var(--nav-h) - 0.6rem); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
  border: 0; border-radius: 20px; background: none; color: var(--encre-douce); font: inherit; font-size: 0.66rem; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; cursor: pointer;
  transition: color 160ms, background-color 160ms;
}
.nav svg { padding: 0.25rem 0.9rem; box-sizing: content-box; border-radius: 999px; transition: background-color 200ms, transform 300ms var(--rebond); }
.nav a:active svg, .nav button:active svg { transform: scale(0.88); }
.nav [aria-current="page"] { color: var(--bleu); font-weight: 800; }
.nav [aria-current="page"] svg { stroke-width: 2.2; background: var(--violet-pale); transform: translateY(-1px); }
.nav .secondaire { display: none; }

/* ---------- Page de domaine et rail ---------- */

.page-domaine {
  margin-top: 1.25rem; padding: 1.15rem 1rem 0.75rem; position: relative;
  background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre);
  --accent: var(--bleu);
}
.page-domaine:first-of-type { margin-top: 0; }
.page-domaine:nth-of-type(4n+2) { --accent: var(--rose); }
.page-domaine:nth-of-type(4n+3) { --accent: var(--ciel); }
.page-domaine:nth-of-type(4n+4) { --accent: var(--soleil); }

.bandeau-domaine {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem;
  margin-bottom: 1rem;
}
.bandeau-domaine::before { content: ""; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.bandeau-domaine .genre { padding: 0.05rem 0.6rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--blanc)); color: var(--encre-douce); font-size: 0.78rem; font-weight: 600; }

/* Le rail : une ligne continue, chaque entrée s'y accroche par un repère. */
.rail { --rail-x: 0.5rem; position: relative; margin: 0; padding: 0 0 0 calc(var(--rail-x) - 0.5rem + var(--rail)); list-style: none; }
.contenu > .rail { --rail-x: 1.4rem; padding-top: 0.85rem; padding-bottom: 0.85rem; padding-right: 1rem; background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); }
.rail::before {
  content: ""; position: absolute; left: var(--rail-x); top: 0.6rem; bottom: 0.6rem;
  width: 3px; border-radius: 3px;
  background: linear-gradient(var(--accent, var(--bleu)), color-mix(in srgb, var(--accent, var(--bleu)) 15%, transparent));
  opacity: 0.45;
}
.rail > li { position: relative; padding: 0.55rem 0; }
.rail > li::before {
  content: ""; position: absolute; left: calc(0.5rem - var(--rail) - 4px + 1.5px); top: 1.05rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blanc); border: 2.5px solid var(--encre-douce);
}
.rail > li.jalon { padding-top: 1.1rem; }
.rail > li.jalon:first-child { padding-top: 0.2rem; }
.rail > li.jalon::before { top: 1.4rem; width: 14px; height: 14px; left: calc(0.5rem - var(--rail) - 6px + 1.5px); background: var(--accent, var(--bleu)); border-color: var(--blanc); box-shadow: 0 0 0 2px var(--accent, var(--bleu)); }
.rail > li.jalon:first-child::before { top: 0.5rem; }
.rail > li.retard::before { background: var(--alerte); border-color: var(--alerte); }
.rail > li.fait::before { background: var(--sauge-encre); border-color: var(--sauge-encre); }
.rail > li.attente::before { background: var(--soleil); border-color: var(--ambre-encre); }

.jalon h3 { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--encre-douce); }

.entree { display: flex; align-items: flex-start; gap: 0.75rem; }
.entree .corps { flex: 1; min-width: 0; }
.entree .intitule { font-weight: 700; overflow-wrap: anywhere; color: var(--encre); text-decoration: none; }
.entree a.intitule:hover { color: var(--bleu); }
.entree.terminee .intitule { text-decoration: line-through; color: var(--encre-douce); }
.entree .precisions { margin-top: 0.15rem; color: var(--encre-douce); font-size: var(--t-petit); }
.entree .actions { display: flex; gap: 0.25rem; flex: none; }

/* ---------- Zone de décision : le bloc ensoleillé ---------- */

.decision {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #FFF3CC, #FFE29A); color: var(--encre);
  border-radius: 18px; padding: 1rem 1.1rem; margin-bottom: 1.25rem;
}
.decision::after { content: ""; position: absolute; width: 7rem; height: 7rem; right: -2.5rem; top: -2.5rem; border-radius: 50%; background: rgb(255 255 255 / 0.4); pointer-events: none; }
.decision > h3 { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ambre-encre); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.decision > h3::before { content: "✋" / ""; font-size: 1rem; }
.decision ul { margin: 0; padding: 0; list-style: none; position: relative; z-index: 1; }
.decision li + li { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1.5px dashed color-mix(in srgb, var(--ambre-encre) 25%, transparent); }
.decision .boutons { margin-top: 0.85rem; position: relative; z-index: 1; }

.proposition { position: relative; background: var(--blanc); border: 0; border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1.1rem 1.1rem 1.1rem 1.35rem; margin-bottom: 1rem; overflow: hidden; }
.proposition::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--soleil); }
.proposition.fait-etabli::before { background: var(--sauge-encre); }
.proposition .raison { margin: 0.5rem 0 0.75rem; }
.proposition .lignes { margin: 0 0 0.75rem; padding: 0; list-style: none; }
.proposition .lignes label { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.4rem 0; min-height: 44px; }
.apercu { background: var(--violet-pale); border-radius: 14px; padding: 0.85rem 1rem; margin: 0.75rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.apercu dt { color: var(--encre-douce); font-size: var(--t-petit); font-weight: 600; }
.apercu dd { margin: 0 0 0.5rem; }

/* ---------- Étiquettes, toujours avec un mot ---------- */

.etiquette { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 800; vertical-align: 0.08em; white-space: nowrap; }
.etiquette.fait { background: var(--sauge); color: var(--sauge-encre); }
.etiquette.hypothese { background: var(--ambre); color: var(--ambre-encre); }
.etiquette.alerte { background: var(--alerte-fond); color: var(--alerte); }
.etiquette.neutre { background: var(--violet-pale); color: var(--bleu-fonce); }

.note { border-left: 4px solid var(--trait); border-radius: 4px; padding: 0.35rem 0 0.35rem 0.85rem; color: var(--encre-douce); margin: 0.75rem 0; }
.note.alerte { border-color: var(--alerte); color: var(--alerte); }
.note.indispo { border-color: var(--soleil); color: var(--ambre-encre); }

.vide { padding: 1.75rem 1.25rem; margin: 0.5rem 0 1rem; color: var(--encre-douce); background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); text-align: center; }
.vide::before { content: ""; display: block; margin: 0 auto 0.85rem; width: 3.25rem; height: 3.25rem; border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%; background: radial-gradient(circle at 36% 44%, #fff 0 9%, transparent 10%), radial-gradient(circle at 64% 44%, #fff 0 9%, transparent 10%), var(--degrade); box-shadow: 0 6px 16px rgb(176 60 240 / 0.35); animation: flotter 4s ease-in-out infinite; }
.vide strong { display: block; color: var(--encre); font-size: var(--t-section); font-weight: 800; margin-bottom: 0.35rem; letter-spacing: -0.015em; }
.vide .boutons { justify-content: center; }

/* ---------- Boutons et formulaires ---------- */

.bouton {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 1.2rem; border-radius: 999px; border: 2px solid var(--bleu);
  background: var(--bleu); color: var(--blanc); font: inherit; font-weight: 800; cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 0 var(--bleu-fonce);
  transition: transform 140ms var(--rebond), box-shadow 140ms, background-color 140ms;
}
.bouton:hover { background: var(--bleu-fonce); border-color: var(--bleu-fonce); transform: translateY(-1px); box-shadow: 0 4px 0 #3A169F; }
.bouton:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bleu-fonce); }
.bouton.second { background: var(--blanc); color: var(--bleu); box-shadow: 0 3px 0 var(--violet-pale); }
.bouton.second:hover { background: var(--violet-pale); box-shadow: 0 4px 0 #DCD0FF; }
.bouton.calme { background: none; border-color: transparent; color: var(--bleu); padding-inline: 0.7rem; font-weight: 700; box-shadow: none; }
.bouton.calme:hover { background: var(--violet-pale); transform: none; }
.bouton.danger { background: var(--blanc); border-color: var(--alerte); color: var(--alerte); box-shadow: 0 3px 0 var(--alerte-fond); }
.bouton.danger:hover { background: var(--alerte-fond); }
.bouton.petit { min-height: 36px; padding: 0.25rem 0.85rem; font-size: var(--t-petit); }
.bouton:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.boutons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.haut { margin-top: 1.1rem; }

.icone-bouton { min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: none; color: var(--encre-douce); cursor: pointer; display: inline-grid; place-items: center; transition: transform 200ms var(--rebond), background-color 150ms; }
.icone-bouton:hover { background: var(--violet-pale); color: var(--bleu); transform: rotate(90deg); }

.cocher { flex: none; width: 30px; height: 30px; margin: 0; border-radius: 50%; border: 2.5px solid #C8BEE0; background: var(--blanc); cursor: pointer; display: grid; place-items: center; color: transparent; font-weight: 800; transition: transform 220ms var(--rebond), border-color 150ms, background-color 150ms; }
.cocher:hover { border-color: var(--sauge-encre); color: var(--sauge-encre); background: var(--sauge); transform: scale(1.12); }
.cocher:active { transform: scale(0.9); }
.cocher[aria-pressed="true"] { background: var(--sauge-encre); border-color: var(--sauge-encre); color: var(--blanc); }

.champ { display: block; margin-bottom: 0.95rem; }
.champ > span { display: block; font-weight: 700; font-size: var(--t-petit); margin-bottom: 0.3rem; }
.champ small { display: block; color: var(--encre-douce); margin-top: 0.25rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"], input[type="time"], input[type="number"], select, textarea {
  width: 100%; min-height: 48px; padding: 0.6rem 0.9rem;
  border: 2px solid var(--trait); border-radius: 16px; background: var(--blanc); color: var(--encre); font: inherit;
  transition: border-color 150ms, box-shadow 150ms;
}
input::placeholder, textarea::placeholder { color: #9A93B5; }
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--bleu); box-shadow: 0 0 0 4px rgb(106 60 245 / 0.18); }
input[type="checkbox"], input[type="radio"] { width: 1.35rem; height: 1.35rem; margin: 0.1rem 0 0; accent-color: var(--bleu); flex: none; }
.choix { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.45rem 0; min-height: 44px; }
.choix small { display: block; color: var(--encre-douce); }
.ligne-champs { display: grid; gap: 0 0.75rem; grid-template-columns: 1fr 1fr; }
fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
legend { font-weight: 700; font-size: var(--t-petit); padding: 0; margin-bottom: 0.3rem; }

.ajout { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; padding: 0.4rem; background: var(--blanc); border-radius: 999px; box-shadow: var(--ombre); }
.ajout input { flex: 1; border-color: transparent; border-radius: 999px; min-height: 44px; }

.section { margin-top: 2.25rem; }
.section > h2 { margin-bottom: 0.6rem; }
.section > h2 + .discret { margin-top: -0.35rem; }
form > .bouton, form > .boutons { margin-top: 0.6rem; }
.section > .discret { margin-bottom: 0.85rem; max-width: 36rem; }

/* Les listes deviennent des cartes blanches à rangées. */
.liste { margin: 0; padding: 0 1rem; list-style: none; background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); }
.liste > li { padding: 0.85rem 0; border-bottom: 1.5px solid var(--trait); display: flex; gap: 0.75rem; align-items: flex-start; }
.liste > li:last-child { border-bottom: 0; }
.liste > li .corps { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feuille .liste { padding: 0; box-shadow: none; border-radius: 0; background: none; }
.feuille .liste > li > .bouton.calme { width: 100%; justify-content: flex-start; gap: 0.75rem; text-align: left; border-radius: 16px; }

details.repli > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--bleu); font-weight: 700; }
details.repli[open] > summary { margin-bottom: 0.5rem; }

/* ---------- Feuilles (dialogues) ---------- */

dialog.feuille {
  width: 100%; max-width: 34rem; max-height: 88dvh; margin: auto auto 0; border: 0; padding: 0;
  border-radius: 28px 28px 0 0; background: var(--blanc); color: var(--encre);
  box-shadow: 0 -12px 48px rgb(31 22 64 / 0.25);
}
dialog.feuille::backdrop { background: rgb(31 22 64 / 0.4); backdrop-filter: blur(3px); }
.feuille .tete { position: sticky; top: 0; z-index: 1; background: var(--blanc); display: flex; align-items: center; gap: 0.5rem; padding: 1.4rem 1.1rem 0.6rem; }
.feuille .tete::before { content: ""; position: absolute; top: 0.55rem; left: 50%; width: 2.5rem; height: 5px; margin-left: -1.25rem; border-radius: 3px; background: var(--trait); }
.feuille .tete h2 { flex: 1; }
.feuille .interieur { padding: 0.5rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom)); }

.annonces { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom)); z-index: 40; display: grid; justify-items: center; gap: 0.4rem; pointer-events: none; padding: 0 var(--marge); }
.annonce { pointer-events: auto; max-width: 30rem; background: var(--encre); color: var(--blanc); padding: 0.75rem 1.15rem; border-radius: 999px; font-size: var(--t-petit); font-weight: 600; box-shadow: var(--ombre-forte); }
.annonce.erreur { background: var(--alerte); border-radius: 18px; }

/* ---------- Conversation ---------- */

.fil { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1rem; }
.message { max-width: 88%; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.moi { align-self: flex-end; background: var(--degrade); color: var(--blanc); padding: 0.65rem 1rem; border-radius: 22px 22px 6px 22px; box-shadow: 0 6px 16px rgb(176 60 240 / 0.25); }
.message.mia { align-self: flex-start; position: relative; margin-left: 2.4rem; background: var(--blanc); padding: 0.65rem 1rem; border-radius: 22px 22px 22px 6px; box-shadow: var(--ombre); }
.message.mia::before { --taille: 1.85rem; position: absolute; left: -2.4rem; bottom: 0; }
.message .appuis { white-space: normal; margin-top: 0.4rem; }
.composer { position: sticky; bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); padding: 0.4rem; display: flex; gap: 0.5rem; align-items: flex-end; background: var(--blanc); border-radius: 26px; box-shadow: var(--ombre-forte); }
.composer textarea { min-height: 44px; max-height: 9rem; flex: 1; border-color: transparent; border-radius: 20px; }

/* ---------- Connexion ---------- */

.accueil { max-width: 26rem; margin: 0 auto; padding: 9vh var(--marge) 2rem; }
.accueil::before { content: ""; display: block; width: 4rem; height: 4rem; margin-bottom: 1.25rem; border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%; background: radial-gradient(circle at 36% 44%, #fff 0 9%, transparent 10%), radial-gradient(circle at 64% 44%, #fff 0 9%, transparent 10%), var(--degrade); box-shadow: 0 10px 24px rgb(176 60 240 / 0.4); animation: flotter 4s ease-in-out infinite; }
.accueil h1 { margin-bottom: 0.5rem; font-size: clamp(2.5rem, 12vw, 3.5rem); }
.accueil h1::after { content: " 👋" / ""; display: inline-block; transform-origin: 70% 70%; animation: saluer 2.4s ease-in-out 600ms 2; }
.accueil .discret { margin-bottom: 1.75rem; font-size: var(--t-corps); }
.accueil form { padding: 1.25rem; background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); }

/* Accueil en version large : connexion d'abord sur téléphone, pitch à gauche sur ordinateur. */
.accueil-large { display: grid; gap: 1rem; max-width: 64rem; margin: 0 auto; padding-bottom: 2rem; }
.accueil-large .accueil { padding-bottom: 1rem; }

.pitch {
  position: relative; overflow: hidden;
  margin: 0 var(--marge); padding: 1.75rem 1.25rem;
  background: var(--encre); color: var(--blanc); border-radius: 28px;
}
.pitch::before { content: ""; position: absolute; width: 18rem; height: 18rem; right: -7rem; top: -8rem; border-radius: 50%; background: var(--degrade); opacity: 0.55; filter: blur(8px); pointer-events: none; }
.pitch > * { position: relative; }
.pitch .surtitre { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--soleil); color: var(--encre); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.pitch h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.1; letter-spacing: -0.03em; margin: 0.75rem 0; text-wrap: balance; }
.pitch .chapeau { color: #D9D3F0; }
.benefices { margin: 1.5rem 0; padding: 0; list-style: none; display: grid; gap: 0.75rem; }
.benefices li { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.85rem; border-radius: 18px; background: rgb(255 255 255 / 0.07); }
.benefices .emoji { flex: none; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 14px; background: rgb(255 255 255 / 0.12); font-size: 1.4rem; }
.benefices li:nth-child(1) .emoji { background: rgb(255 197 61 / 0.25); }
.benefices li:nth-child(2) .emoji { background: rgb(56 182 255 / 0.25); }
.benefices li:nth-child(3) .emoji { background: rgb(46 196 166 / 0.25); }
.benefices p { color: #C9C2E6; font-size: var(--t-petit); margin-top: 0.1rem; }
.pitch .appel {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem; border-radius: 18px; background: rgb(255 255 255 / 0.1);
}
.pitch .appel .bouton { background: var(--soleil); border-color: var(--soleil); color: var(--encre); box-shadow: 0 3px 0 #C98F00; }
.pitch .appel .bouton:hover { background: #FFD465; }

@media (min-width: 900px) {
  .accueil-large { grid-template-columns: 1fr 1fr; align-items: center; gap: 2.5rem; min-height: 100dvh; padding: 2rem var(--marge); }
  .accueil-large .accueil { order: 2; width: 100%; padding: 0; }
  .accueil-large .pitch { order: 1; margin: 0; padding: 2.5rem; }
}

/* ---------- Ordinateur : navigation latérale ---------- */

@media (min-width: 900px) {
  :root { --marge: 2.5rem; }
  .coquille { display: grid; grid-template-columns: 16rem 1fr; grid-template-rows: auto 1fr; }
  .entete { grid-column: 2; padding-top: 1rem; }
  .entete .marque { display: none; }
  .nav {
    position: sticky; top: 1rem; left: auto; right: auto; bottom: auto; grid-column: 1; grid-row: 1 / span 2; height: calc(100dvh - 2rem);
    margin: 1rem 0 1rem 1rem;
    display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem;
    padding: 1.25rem 0.75rem; border-radius: 28px;
  }
  .nav::before { content: "Mia"; font-weight: 800; font-size: 1.75rem; letter-spacing: -0.04em; padding: 0 0.75rem 1.25rem; background: var(--degrade); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .nav a, .nav button { flex-direction: row; justify-content: flex-start; gap: 0.6rem; min-height: 46px; padding: 0 0.5rem; border-radius: 16px; font-size: var(--t-corps); font-weight: 600; }
  .nav svg { padding: 0.35rem; }
  .nav a:hover { background: var(--fond); color: var(--encre); }
  .nav [aria-current="page"] { background: var(--violet-pale); }
  .nav [aria-current="page"] svg { background: var(--bleu); color: var(--blanc); transform: none; }
  .nav .secondaire { display: flex; }
  .nav .plus { display: none; }
  .contenu { grid-column: 2; padding-top: 1.5rem; padding-bottom: 3rem; }
  .page-domaine { padding: 1.5rem 1.5rem 1rem; }
  dialog.feuille { margin: auto; border-radius: 28px; }
  .feuille .tete::before { display: none; }
  .feuille .tete { padding-top: 1.1rem; }
  .annonces { bottom: 1.5rem; }
  .composer { bottom: 1rem; }
}

/* ---------- Mouvement (désactivé si l'utilisateur le demande) ---------- */

@keyframes flotter { 50% { transform: translateY(-3px) rotate(-4deg); } }
@keyframes pulser { from { transform: scale(0.8); opacity: 0.6; } to { transform: scale(1.1); opacity: 1; } }
@keyframes saluer { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
@keyframes sonner { 25% { transform: rotate(14deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(6deg); } }
@keyframes monter { from { transform: translateY(2rem); opacity: 0; } }
@keyframes apparaitre { from { transform: translateY(10px); opacity: 0; } }
@keyframes rebondir { from { transform: translateY(14px) scale(0.92); opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  dialog.feuille[open] { animation: monter 280ms var(--rebond); }
  .contenu > * { animation: apparaitre 360ms ease-out both; }
  .contenu > :nth-child(2) { animation-delay: 60ms; }
  .contenu > :nth-child(3) { animation-delay: 120ms; }
  .contenu > :nth-child(4) { animation-delay: 180ms; }
  .contenu > :nth-child(n+5) { animation-delay: 240ms; }
  .annonce { animation: rebondir 320ms var(--rebond); }
  .message { animation: rebondir 280ms var(--rebond); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Clôture (MIA Relief) : sobre, sans effet de récompense ---------- */
.proposition-cloture {
  margin: 0 0 1.25rem; padding: 0.85rem 1rem; border-radius: 12px;
  background: var(--sauge); color: var(--sauge-encre);
}
.proposition-cloture p { margin-bottom: 0.6rem; }
.rituel .reconnaissance { font-size: var(--t-section); font-weight: 600; margin-bottom: 1rem; overflow-wrap: anywhere; }
.rituel .section-courte { margin-bottom: 1.25rem; }
.rituel .section-courte > h3 { margin-bottom: 0.4rem; }
.rituel .suites select { margin-top: 0.5rem; width: 100%; }
.rituel .precisions-suite:not(:empty) { margin-top: 0.6rem; }
.rituel .repli { margin-top: 1rem; }
.rituel .frontiere { border-left: 3px solid var(--sauge-encre); padding: 0.35rem 0 0.35rem 0.85rem; color: var(--encre); }
.rituel .frontiere p + p { margin-top: 0.3rem; }
.rituel .frontiere .signal { margin-top: 0.75rem; font-weight: 600; }
.autoevaluation { margin: 0 0 1.1rem; padding: 0.75rem 0.85rem; border: 1px solid var(--trait); border-radius: 18px; background: var(--blanc); }
.autoevaluation p { margin-bottom: 0.5rem; }
.echelle { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.35rem; margin-bottom: 0.4rem; }
.echelle .bouton { padding-inline: 0; min-width: 0; }

/* Orientation */
.reperes { margin: 0 0 1.25rem; padding: 0.9rem 1rem; border-radius: 22px; background: var(--blanc); box-shadow: var(--ombre); }
.reperes h2 { font-size: 1rem; margin-bottom: 0.6rem; }
.reperes .bouton { min-height: 44px; }
.message.mia.securite { border: 2px solid var(--soleil); }
.elements { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.elements li { display: block; background: var(--blanc); border-radius: 16px; padding: 0.7rem 0.9rem; box-shadow: var(--ombre); }
.elements li.fait strong { text-decoration: line-through; opacity: 0.7; }
.elements .boutons { margin-top: 0.3rem; }
