@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/space-grotesk-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/space-grotesk-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #191627;
  --nuit: #14112a;
  --nuit-clair: #2a2547;
  --paper: #eceaf3;
  --surface: #ffffff;
  --muted: #6b6683;
  --line: #d7d3e2;
  --signal: #4230c4;
  --signal-clair: #6b5bec;
  --signal-soft: #eae6fc;
  --span: #14795d;
  --span-soft: #d7ece4;
  --alert: #a11f2c;
  --alert-soft: #fbe8ea;

  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: 1.9375rem;

  --gap: 1rem;
  --radius: 4px;
  --courbe: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  -webkit-tap-highlight-color: rgba(66, 48, 196, 0.15);
  -webkit-text-size-adjust: 100%;
  min-height: 100%;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* Trame de papier millimetre: l'idee du planning mural, sans decor ajoute. */
  background-image:
    linear-gradient(to right, rgba(25, 22, 39, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(25, 22, 39, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.15;
}

h1 {
  font-size: var(--step-3);
}
h2 {
  font-size: var(--step-2);
}
h3 {
  font-size: var(--step-1);
}

p {
  margin: 0;
  max-width: 62ch;
}

a {
  color: var(--signal);
  text-underline-offset: 0.2em;
  transition: color 0.15s var(--courbe);
}

a:hover {
  color: var(--signal-clair);
}

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

[hidden] {
  display: none !important;
}

/* =========================================================== en-tete */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nuit);
  color: #fff;
  transition: box-shadow 0.2s var(--courbe);
}

.masthead[data-scrolled] {
  box-shadow: 0 6px 24px -12px rgba(20, 17, 42, 0.8);
}

.masthead__inner {
  margin: 0 auto;
  max-width: 46rem;
  padding: 0.7rem max(1.25rem, env(safe-area-inset-left))
           0.7rem max(1.25rem, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}

.masthead a {
  color: #fff;
}

/* La marque: trois corps qui s'alignent. C'est le sens du mot, et le seul
   mouvement de la page qui ne repond pas a une action de l'utilisateur. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand__mark {
  width: 44px;
  height: 16px;
  overflow: visible;
  flex: none;
}

.brand__body {
  fill: #fff;
  transform-origin: center;
}

.brand__body--2 {
  fill: var(--signal-clair);
}

.brand__name {
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.03em;
}

@keyframes alignement {
  from {
    transform: translateY(var(--depart)) scale(0.6);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.brand__body--1 {
  --depart: -9px;
  animation: alignement 0.5s var(--courbe) 0.05s both;
}
.brand__body--2 {
  --depart: 10px;
  animation: alignement 0.5s var(--courbe) 0.15s both;
}
.brand__body--3 {
  --depart: -7px;
  animation: alignement 0.5s var(--courbe) 0.25s both;
}

.brand:hover .brand__body--2 {
  fill: #fff;
}

.masthead__nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.navlink {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.7rem;
  border-radius: 99px;
  font-size: 0.875rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.72);
  transition: background 0.15s var(--courbe), color 0.15s var(--courbe);
}

.navlink:hover {
  background: var(--nuit-clair);
  color: #fff;
}

.navlink[aria-current] {
  background: var(--nuit-clair);
  color: #fff;
}

.navlink--out {
  border: 0;
  font: inherit;
  font-size: 0.875rem;
  background: transparent;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.72);
}

.navlink--out:hover {
  background: var(--nuit-clair);
  color: #fff;
}

/* =========================================================== ossature */

.page {
  margin: 0 auto;
  max-width: 46rem;
  padding: 2.25rem max(1.25rem, env(safe-area-inset-right)) 5rem
           max(1.25rem, env(safe-area-inset-left));
}

/* Une seule entree de page, orchestree. Pas de reveal par section. */
@keyframes entree {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page {
  animation: entree 0.35s var(--courbe) both;
}

.stack > * + * {
  margin-top: var(--gap);
}

.stack-lg > * + * {
  margin-top: 2.75rem;
}

.lede {
  color: var(--muted);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: 0.9rem;
}

section > h2 {
  margin-bottom: 0.9rem;
}

/* ====================================================== le segment */
/* Motif central: une barre horizontale pour toute proportion, duree du sejour
   comme soutien d'une option. */

.span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem 1.1rem;
}

.span__ends {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 500;
}

.span__ends span:last-child {
  text-align: right;
}

.span__bar {
  position: relative;
  margin-top: 0.6rem;
  height: 6px;
  border-radius: 99px;
  background: var(--span-soft);
}

.span__bar::before,
.span__bar::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--span);
  transition: background 0.25s var(--courbe);
}

.span__bar::before {
  left: 0;
}
.span__bar::after {
  right: 0;
}

.span__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--span);
  transition: width 0.45s var(--courbe);
}

.span__meta {
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.span--empty .span__bar {
  background: repeating-linear-gradient(
    90deg,
    var(--line) 0 6px,
    transparent 6px 12px
  );
}

.span--empty .span__bar::before,
.span--empty .span__bar::after {
  background: var(--line);
}

.span__inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.span--enhanced .span__inputs {
  display: none;
}

/* ========================================================= calendrier */

.cal {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cal__title {
  font-weight: 500;
  text-align: center;
  flex: 1;
}

.cal__nav {
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s var(--courbe), color 0.15s var(--courbe);
}

.cal__nav:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.cal__months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.cal__month-name {
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 0.4rem;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal__dow {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding-bottom: 0.2rem;
}

.cal__blank {
  aspect-ratio: 1;
}

.cal__day {
  font: inherit;
  font-size: 0.875rem;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s var(--courbe), color 0.12s var(--courbe);
}

.cal__day:hover {
  background: var(--signal-soft);
}

.cal__day--in {
  background: var(--span-soft);
  border-radius: 0;
}

.cal__day--start,
.cal__day--end {
  background: var(--span);
  color: #fff;
  font-weight: 500;
}

.cal__day--start:hover,
.cal__day--end:hover {
  background: var(--span);
}

/* Hors des bornes fixees par l'organisateur: visible mais inatteignable, pour
   qu'on comprenne la fenetre au lieu de chercher pourquoi rien ne se passe. */
.cal__day--hors {
  color: var(--line);
  cursor: not-allowed;
}

.cal__day--hors:hover {
  background: transparent;
}

.cal__day--today:not(.cal__day--start):not(.cal__day--end) {
  box-shadow: inset 0 0 0 1px var(--line);
}

.cal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.cal__hint {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* =========================================================== decompte */

.tally {
  display: grid;
  grid-template-columns: 7rem 2.25rem;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

.tally__bar {
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.tally__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--signal);
  transition: width 0.6s var(--courbe);
}

.tally__count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ============================================================= listes */

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.rows > li + li {
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.85rem 1.1rem;
  transition: background 0.15s var(--courbe);
}

.row:hover {
  background: #faf9fd;
}

.row__title {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}

.row__title:hover {
  color: var(--signal);
}

.row__sub {
  margin-top: 0.1rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.people li {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0.2rem 0.7rem;
  background: var(--surface);
  font-size: 0.875rem;
}

.people li[data-role="admin"] {
  border-color: var(--signal);
  color: var(--signal);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin-inline: auto;
}

/* ========================================================== discussion */

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat__cadre {
  position: relative;
}

.chat__liste {
  list-style: none;
  margin: 0;
  padding: 1rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  /* Hauteur bornee: la conversation defile a l'interieur, la page ne bouge pas
     et le champ de saisie reste sous les yeux. */
  height: min(60vh, 34rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.chat__vide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.chat__vide p {
  margin-inline: auto;
}

/* Repere de date: un trait coupe par l'etiquette, pour situer sans encombrer. */
.jour {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.jour::before,
.jour::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.chat__liste > .jour:first-child {
  margin-top: 0;
}

/* ------------------------------------------------------------- message */

.msg {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

/* Les messages consecutifs d'une meme personne se collent: on lit une prise de
   parole, pas une suite de fiches. */
.msg--suite {
  margin-top: 0.2rem;
}

.msg--mien {
  flex-direction: row-reverse;
}

.msg__bloc {
  max-width: min(78%, 34rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.msg--mien .msg__bloc {
  align-items: flex-end;
}

.msg__entete {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
  padding-inline: 0.2rem;
}

.msg__auteur {
  font-weight: 500;
  color: var(--ink);
}

.msg--mien .msg__auteur {
  color: var(--signal);
}

@keyframes msg-entree {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg--neuf {
  animation: msg-entree 0.22s var(--courbe) both;
}

/* ------------------------------------------------------------- avatars */

.avatar {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  user-select: none;
}

/* Une teinte stable par personne, calculee a partir de son identifiant: pas de
   stockage, et la meme couleur sur tous les appareils. */
.avatar--0 { background: #4230c4; }
.avatar--1 { background: #14795d; }
.avatar--2 { background: #a1471f; }
.avatar--3 { background: #1f6fa1; }
.avatar--4 { background: #7a2f86; }
.avatar--5 { background: #8a6d10; }
.avatar--6 { background: #2f6b2f; }
.avatar--7 { background: #9c1f47; }

.msg--suite .avatar {
  visibility: hidden;
}

/* -------------------------------------------------------------- bulles */

.bulle {
  padding: 0.55rem 0.85rem;
  border-radius: 16px 16px 16px 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.msg--mien .bulle {
  border-radius: 16px 16px 5px 16px;
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
}

/* Dans une suite, le coin pointu disparait: la bulle appartient au bloc du
   dessus plutot que d'ouvrir une nouvelle prise de parole. */
.msg--suite .bulle {
  border-radius: 16px;
}

.bulle--effacee {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  font-style: italic;
}

.msg--mien .bulle--effacee {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.bulle__note {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ----------------------------------------------------------- reactions */

.reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: -0.5rem;
  margin-inline: 0.35rem;
  position: relative;
  z-index: 1;
}

.msg--mien .reactions {
  justify-content: flex-end;
}

.reaction {
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(20, 17, 42, 0.08);
  transition: border-color 0.15s var(--courbe), transform 0.08s var(--courbe);
}

.reaction:hover {
  border-color: var(--signal);
}

.reaction:active {
  transform: scale(0.94);
}

.reaction--mienne {
  border-color: var(--signal);
  background: var(--signal-soft);
  color: var(--signal);
}

/* Le bouton d'ajout et celui de suppression restent en retrait jusqu'au survol:
   une barre de six emoji en permanence noie le message. */
.reaction--ajout,
.reaction--retrait {
  list-style: none;
  opacity: 0;
  color: var(--muted);
  min-width: 1.5rem;
  text-align: center;
}

.reaction--ajout::-webkit-details-marker {
  display: none;
}

.msg:hover .reaction--ajout,
.msg:hover .reaction--retrait,
.reaction--ajout:focus-visible,
.reaction--retrait:focus-visible,
.palette[open] .reaction--ajout {
  opacity: 1;
}

.reaction--retrait:hover {
  border-color: var(--alert);
  color: var(--alert);
}

.palette {
  position: relative;
}

.palette__choix {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  display: flex;
  gap: 0.15rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  box-shadow: 0 10px 26px -14px rgba(20, 17, 42, 0.6);
  z-index: 5;
}

.msg--mien .palette__choix {
  left: auto;
  right: 0;
}

.palette__emoji {
  font-size: 1.05rem;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  background: transparent;
  cursor: pointer;
  transition: transform 0.1s var(--courbe), background 0.15s var(--courbe);
}

.palette__emoji:hover {
  background: var(--signal-soft);
  transform: scale(1.15);
}

/* ------------------------------------------------- retour vers le bas */

.chat__nouveaux {
  position: absolute;
  left: 50%;
  bottom: 0.8rem;
  transform: translateX(-50%);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 99px;
  background: var(--signal);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px -10px rgba(66, 48, 196, 0.9);
  animation: msg-entree 0.2s var(--courbe) both;
}

/* --------------------------------------------------------- composeur */

.composeur {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  transition: border-color 0.15s var(--courbe), box-shadow 0.15s var(--courbe);
}

.composeur:focus-within {
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-soft);
}

.composeur textarea {
  flex: 1;
  border: 0;
  padding: 0.5rem 0;
  background: transparent;
  resize: none;
  max-height: 8rem;
  line-height: 1.45;
}

.composeur textarea:focus {
  outline: none;
  box-shadow: none;
  border: 0;
}

.composeur__envoi {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--signal);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--courbe), transform 0.08s var(--courbe);
}

.composeur__envoi svg {
  width: 1.1rem;
  height: 1.1rem;
}

.composeur__envoi:hover {
  background: var(--signal-clair);
}

.composeur__envoi:active {
  transform: scale(0.93);
}

@media (max-width: 40rem) {
  .chat__liste {
    height: min(62vh, 30rem);
    padding: 0.8rem 0.6rem;
  }

  .msg__bloc {
    max-width: 84%;
  }

  /* Sur ecran tactile il n'y a pas de survol: les actions restent visibles. */
  .reaction--ajout,
  .reaction--retrait {
    opacity: 1;
  }
}

@media (hover: none) {
  .reaction--ajout,
  .reaction--retrait {
    opacity: 1;
  }
}

/* ------------------------------------------------------ disponibilites */

.dispo {
  display: flex;
  gap: 2px;
  height: 3rem;
  align-items: stretch;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.dispo__jour {
  flex: 1;
  min-width: 2px;
  border-radius: 2px;
  background: var(--line);
}

/* Six niveaux plutot qu'une opacite calculee: la CSP interdit un style en
   ligne, et six paliers se lisent mieux qu'un degrade continu. */
.dispo__jour--0 { background: var(--line); }
.dispo__jour--1 { background: #cfe3da; }
.dispo__jour--2 { background: #a5cfc0; }
.dispo__jour--3 { background: #6fb49d; }
.dispo__jour--4 { background: #359478; }
.dispo__jour--5 { background: var(--span); }

.dispo__bornes {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* =============================================================== carte */

.carte {
  height: 22rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: var(--gap);
  background: var(--surface);
  z-index: 0;
}

.carte__alerte {
  margin: -0.5rem 0 var(--gap);
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--alert);
  border-radius: var(--radius);
  background: var(--alert-soft);
  color: var(--alert);
  font-size: 0.875rem;
}

.carte__popup strong {
  display: block;
  margin-bottom: 0.2rem;
}

.carte__popup p {
  margin: 0 0 0.3rem;
}

.carte__solde {
  color: var(--muted);
  font-size: 0.8125rem;
}

.etapes {
  margin: 0;
  padding-left: 1.2rem;
}

.etapes li + li {
  margin-top: 0.6rem;
}

.etapes__nom {
  display: block;
  font-weight: 500;
}

@media (max-width: 40rem) {
  .carte {
    height: 16rem;
  }
}

/* ====================================================== recapitulatif */

.recap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.recap + .recap {
  margin-top: 0.5rem;
}

.recap__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  list-style: none;
}

.recap__head::-webkit-details-marker {
  display: none;
}

.recap__nom {
  font-weight: 500;
}

.recap[open] .recap__head {
  border-bottom: 1px solid var(--line);
}

.recap__corps {
  padding: 1rem 1.1rem;
}

/* ========================================================== surfaces */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem;
}

.panel__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.tag {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.05rem 0.45rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.pill {
  display: inline-block;
  border-radius: 99px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.pill--ok {
  border-color: var(--span);
  color: var(--span);
  background: var(--span-soft);
}

.pill--warn {
  border-color: var(--alert);
  color: var(--alert);
  background: var(--alert-soft);
}

.pill--signal {
  border-color: var(--signal);
  color: var(--signal);
  background: var(--signal-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.stats__cell {
  background: var(--surface);
  padding: 0.85rem 1rem;
}

.stats__value {
  font-size: var(--step-2);
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
}

.stats__label {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ======================================================= formulaires */

.field {
  display: block;
}

.field__label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.field__hint {
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s var(--courbe), box-shadow 0.15s var(--courbe);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--signal);
  outline: none;
  box-shadow: 0 0 0 3px var(--signal-soft);
}

textarea {
  resize: vertical;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.field--code {
  font-size: 1.6rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  max-width: 12rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9375rem;
}

.choice input {
  accent-color: var(--signal);
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
}

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
}

.inline-form input {
  flex: 1;
}

/* ==================================================== autocompletion */

.combo {
  position: relative;
  flex: 1;
}

.combo__list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -16px rgba(20, 17, 42, 0.55);
  max-height: 16rem;
  overflow-y: auto;
}

.combo__option {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.combo__option--on,
.combo__option:hover {
  background: var(--signal-soft);
}

.combo__pseudo {
  font-weight: 500;
}

.combo__nom {
  color: var(--muted);
  font-size: 0.8125rem;
}

/* =========================================================== boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--signal);
  background: var(--signal);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s var(--courbe), border-color 0.15s var(--courbe),
    transform 0.08s var(--courbe);
}

.btn:hover {
  background: var(--signal-clair);
  border-color: var(--signal-clair);
  color: #fff;
}

/* Le bouton s'enfonce sous le doigt: le seul retour tactile de l'interface. */
.btn:active {
  transform: translateY(1px);
}

.btn--ghost {
  background: transparent;
  color: var(--signal);
}

.btn--ghost:hover {
  background: var(--signal-soft);
  border-color: var(--signal);
  color: var(--signal);
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding-inline: 0;
}

.btn--quiet:hover {
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
}

.btn--danger {
  background: transparent;
  border-color: transparent;
  color: var(--alert);
  padding: 0;
}

.btn--danger:hover {
  background: transparent;
  color: var(--alert);
  text-decoration: underline;
}

/* ========================================================== messages */

@keyframes surgir {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.note {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 0.75rem 0.95rem;
  background: var(--surface);
  animation: surgir 0.28s var(--courbe) both;
}

.note--error {
  border-left-color: var(--alert);
  background: var(--alert-soft);
  color: var(--alert);
}

.note--ok {
  border-left-color: var(--span);
  background: var(--span-soft);
  color: var(--span);
}

.note--invite {
  border-left-color: var(--signal);
}

.note__title {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.note input {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.8125rem;
}

/* ============================================================ tables */

.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.grid-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 0.4rem 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--line);
}

.grid-table td {
  padding: 0.6rem 0.6rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.grid-table td:last-child,
.grid-table th:last-child {
  text-align: right;
  padding-right: 0;
}

/* ============================================================= accueil */

.accueil {
  text-align: center;
  padding-block: 1rem 0.5rem;
}

.accueil__marque {
  width: min(15rem, 70%);
  margin: 0 auto 1.25rem;
}

.accueil__marque svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Les trois corps convergent vers l'axe: c'est le sens du mot, et le seul
   moment ou l'interface se permet un geste pour lui-meme. */
.accueil__axe {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: axe-trace 0.7s var(--courbe) 0.5s forwards;
}

@keyframes axe-trace {
  to {
    stroke-dashoffset: 0;
  }
}

.accueil__corps {
  fill: var(--ink);
  transform-origin: center;
  animation: convergence 0.8s var(--courbe) both;
}

.accueil__corps--1 {
  --depart: -14px;
  animation-delay: 0.05s;
}

.accueil__corps--2 {
  fill: var(--signal);
  --depart: 16px;
  animation-delay: 0.2s;
}

.accueil__corps--3 {
  --depart: -11px;
  animation-delay: 0.35s;
}

@keyframes convergence {
  from {
    transform: translateY(var(--depart)) scale(0.4);
    opacity: 0;
  }
  60% {
    transform: translateY(0) scale(1.12);
    opacity: 1;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.accueil__sur-titre {
  margin-inline: auto;
  color: var(--muted);
  font-size: 0.875rem;
  animation: entree 0.5s var(--courbe) 0.6s both;
}

.accueil__titre {
  font-size: clamp(2.25rem, 9vw, 3.5rem);
  letter-spacing: -0.04em;
  animation: entree 0.5s var(--courbe) 0.7s both;
}

.accueil__pitch {
  margin: 0.9rem auto 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: var(--step-1);
  animation: entree 0.5s var(--courbe) 0.85s both;
}

.accueil__invite {
  margin: 1.1rem auto 0;
  max-width: 30rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--signal);
  border-radius: var(--radius);
  background: var(--signal-soft);
  color: var(--signal);
  animation: entree 0.5s var(--courbe) 1s both;
}

.accueil .actions {
  justify-content: center;
  margin-top: 1.6rem;
  animation: entree 0.5s var(--courbe) 1.1s both;
}

/* --------------------------------------------------------- les atouts */

.atouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  margin-top: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.atout {
  background: var(--surface);
  padding: 1.4rem 1.3rem 1.5rem;
}

.atout h2 {
  font-size: var(--step-1);
  margin-bottom: 0.35rem;
}

.atout p {
  color: var(--muted);
  font-size: 0.9375rem;
}

.atout__dessin {
  margin-bottom: 1rem;
}

.atout__dessin svg {
  width: 100%;
  max-width: 12rem;
  height: auto;
}

/* Reveal a l'entree dans l'ecran. L'etat masque est pose par le script, jamais
   par la feuille de style: si le script echoue, tout reste visible. */
.reveal--arme {
  opacity: 0;
  transform: translateY(14px);
}

.reveal--visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s var(--courbe), transform 0.5s var(--courbe);
}

/* Les animations internes ne partent qu'une fois l'illustration a l'ecran. */
.jauge,
.etape--encours,
.epingle,
.bulle-dessin,
.coeur,
.jalon {
  animation-play-state: paused;
}

.reveal--visible .jauge,
.reveal--visible .etape--encours,
.reveal--visible .epingle,
.reveal--visible .bulle-dessin,
.reveal--visible .coeur,
.reveal--visible .jalon {
  animation-play-state: running;
}

/* voter */
.piste {
  fill: var(--line);
}

.jauge {
  fill: var(--signal);
  transform-origin: 8px center;
  animation: jauge-monte 0.9s var(--courbe) both;
}

.jauge--1 {
  --part: 0.85;
  animation-delay: 0.1s;
}
.jauge--2 {
  --part: 0.45;
  animation-delay: 0.25s;
}
.jauge--3 {
  --part: 0.62;
  animation-delay: 0.4s;
}

@keyframes jauge-monte {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(var(--part));
  }
}

/* etapes */
.etape--faite {
  fill: var(--span);
}

.etape--vide {
  fill: var(--line);
}

.etape--encours {
  fill: var(--signal);
  transform-origin: 45px center;
  animation: jauge-monte 1.1s var(--courbe) 0.4s infinite alternate;
  --part: 1;
}

.jalon {
  fill: var(--surface);
  stroke: var(--span);
  stroke-width: 2;
  animation: entree 0.4s var(--courbe) both;
}

.jalon--1 {
  animation-delay: 0.15s;
}

.jalon--2 {
  stroke: var(--signal);
  animation-delay: 0.55s;
}

/* carte */
.plan {
  fill: var(--paper);
  stroke: var(--line);
}

.rue {
  stroke: var(--line);
  stroke-width: 2;
  fill: none;
}

.epingle circle {
  fill: var(--span);
}

.epingle__pied {
  stroke: var(--span);
  stroke-width: 2;
}

.epingle {
  transform-origin: center bottom;
  animation: epingle-chute 0.5s var(--courbe) both;
}

.epingle--1 {
  animation-delay: 0.15s;
}
.epingle--2 {
  animation-delay: 0.35s;
}
.epingle--3 {
  animation-delay: 0.55s;
}

@keyframes epingle-chute {
  from {
    transform: translateY(-16px);
    opacity: 0;
  }
  70% {
    transform: translateY(2px);
    opacity: 1;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* discussion */
.bulle-dessin {
  transform-origin: left center;
  animation: bulle-pop 0.45s var(--courbe) both;
}

.bulle-dessin--1 {
  fill: var(--paper);
  stroke: var(--line);
  animation-delay: 0.15s;
}

.bulle-dessin--2 {
  fill: var(--signal);
  transform-origin: right center;
  animation-delay: 0.45s;
}

@keyframes bulle-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.coeur {
  fill: var(--alert);
  transform-origin: center;
  animation: coeur-bat 0.5s var(--courbe) 0.8s both;
}

@keyframes coeur-bat {
  from {
    transform: scale(0);
    opacity: 0;
  }
  70% {
    transform: scale(1.4);
    opacity: 1;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 40rem) {
  .accueil__pitch {
    font-size: var(--step-0);
  }

  .atout {
    padding: 1.1rem 1rem 1.2rem;
  }
}

/* ================================================ pages d'authentification */

.auth {
  max-width: 25rem;
  margin-inline: auto;
}

.auth__head {
  margin-bottom: 1.5rem;
}

.auth__head h1 {
  font-size: var(--step-2);
}

/* Meme grammaire que la barre de duree: une etape franchie est un segment
   rempli, l'etape en cours un segment en attente. */
.steps {
  list-style: none;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0;
}

.steps__item {
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 0.5rem;
  border-top: 3px solid var(--line);
  transition: border-color 0.3s var(--courbe), color 0.3s var(--courbe);
}

.steps__item--done {
  border-top-color: var(--span);
  color: var(--span);
}

.steps__item--now {
  border-top-color: var(--signal);
  color: var(--signal);
  font-weight: 500;
}

.secours {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem;
}

.secours li {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.qr-wrap {
  display: flex;
  justify-content: center;
}

.qr {
  width: 100%;
  max-width: 15rem;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================ mobile */

/* Sur ecran tactile, une cible sous ~44px se rate. Et iOS zoome des qu'un champ
   fait moins de 16px: le zoom decale la page et ne repart jamais tout seul. */
@media (pointer: coarse) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
    padding-block: 0.65rem;
  }

  .btn {
    min-height: 44px;
    padding-inline: 1.2rem;
  }

  .btn--quiet,
  .btn--danger {
    min-height: 36px;
  }

  .cal__day {
    min-height: 2.6rem;
    font-size: 1rem;
  }

  .cal__nav {
    width: 2.5rem;
    height: 2.5rem;
  }

  .choice input {
    width: 1.25rem;
    height: 1.25rem;
  }

  .navlink {
    min-height: 38px;
  }

  .combo__option {
    padding-block: 0.7rem;
  }
}

@media (max-width: 46rem) {
  .cal__months {
    grid-template-columns: 1fr;
  }

  /* Le second mois sort du flux: il n'est plus focalisable au clavier. */
  .cal__month:nth-child(2) {
    display: none;
  }
}

@media (max-width: 40rem) {
  :root {
    --step-3: 1.5rem;
    --step-2: 1.2rem;
    --gap: 0.85rem;
  }

  .page {
    padding-top: 1.5rem;
  }

  /* La navigation passe sous la marque et defile horizontalement plutot que de
     se tasser en quatre liens illisibles. */
  .masthead__inner {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding-block: 0.6rem;
  }

  .masthead__nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .masthead__nav::-webkit-scrollbar {
    display: none;
  }

  .navlink {
    white-space: nowrap;
    flex: none;
  }

  .brand__name {
    font-size: var(--step-0);
  }

  .section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .tally {
    grid-template-columns: 1fr 2.25rem;
    gap: 0.6rem;
    width: 100%;
  }

  .inline-form {
    flex-direction: column;
  }

  .span__inputs,
  .duo {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 1rem;
  }

  .actions .btn {
    flex: 1 1 auto;
  }

  .field--code {
    max-width: 100%;
    font-size: 1.4rem;
    letter-spacing: 0.35em;
    text-indent: 0.35em;
  }

  /* Un tableau ne tient pas sur 360 px: chaque ligne devient une fiche, les
     en-têtes passent en etiquettes via data-label. */
  .grid-table,
  .grid-table tbody,
  .grid-table tr,
  .grid-table td {
    display: block;
    width: 100%;
  }

  .grid-table thead {
    display: none;
  }

  .grid-table tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.6rem;
  }

  .grid-table td {
    border: 0;
    padding: 0.2rem 0;
    text-align: left;
  }

  .grid-table td:last-child {
    text-align: left;
    padding-top: 0.5rem;
  }

  .grid-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
  }

  .grid-table td:empty {
    display: none;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
