/* Mise en page de l'app (les couleurs viennent de tokens.css). */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--police); font-size: 16px; line-height: 1.35; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

.app { max-width: 540px; margin: 0 auto; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.contenu { display: grid; gap: 14px; padding: 8px 16px 0; }

/* Barre du haut */
.barre-haut {
  position: sticky; top: 0; z-index: 5;
  display: grid; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--trait);
}
.onglets { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--trait); border-radius: 999px; padding: 3px; }
.onglets button { border: 0; background: none; border-radius: 999px; padding: 8px 0; font-weight: 700; color: var(--discret); }
.onglets button[aria-selected="true"] { background: var(--accent); color: var(--sur-accent); }
.etats { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.synchro { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--discret); }
.synchro i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.synchro.attente i { background: var(--moitie); }
.cloche { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--trait-fort); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 0.82rem; font-weight: 700; }
.cloche svg { width: 18px; height: 18px; }
.cloche.on { border-color: var(--accent); color: var(--accent); background: var(--accent-doux); }
.cloche.bloque { color: var(--discret); }
.astuce { margin: 0; font-size: 0.8rem; color: var(--discret); }

/* Titres */
.tete { display: grid; gap: 2px; }
.surtitre { margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--discret); }
.tete h1 { margin: 0; font-size: 1.6rem; line-height: 1.15; font-weight: 800; }
.tete h1 span { font-size: 1rem; font-weight: 600; color: var(--discret); }

/* Jours de la semaine */
.jours { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.jour { position: relative; display: grid; border: 1px solid var(--trait); background: var(--surface); border-radius: 12px; padding: 6px 0; }
.jour b { font-size: 1.05rem; }
.jour span { font-size: 0.72rem; color: var(--discret); font-variant-numeric: tabular-nums; }
.jour.choisi { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.jour.choisi span { color: var(--sur-accent); }
.jour.auj::after { content: ""; position: absolute; top: 5px; inset-inline-end: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--rate); }

/* Avancement */
.progres { display: grid; gap: 6px; }
.progres p { margin: 0; font-size: 0.88rem; color: var(--discret); }
.barre { height: 8px; border-radius: 999px; background: var(--trait); overflow: hidden; }
.barre i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* Liste du jour */
.moment h2 { margin: 6px 4px 8px; font-size: 0.8rem; font-weight: 800; color: var(--discret); }
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ligne { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon-petit); padding-inline: 2px 10px; }
.ligne.maintenant { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-doux); }
.ligne.avenir { opacity: 0.55; }
.rond { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 0; background: none; padding: 0; }
.rond i { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--trait-fort); display: grid; place-items: center; color: #fff; }
.rond svg { width: 18px; height: 18px; }
.rond.est-done i { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.rond.est-half i { background: var(--moitie); border-color: var(--moitie); }
.rond.est-miss i { background: var(--rate); border-color: var(--rate); }
.avenir .rond i { border-style: dashed; }
.corps { flex: 1; min-width: 0; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; border: 0; background: none; padding: 9px 0; text-align: start; }
.heure { font-size: 0.85rem; color: var(--discret); font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }
.quoi { min-width: 0; display: grid; }
.titre { font-weight: 700; line-height: 1.25; }
.sous { font-size: 0.82rem; color: var(--discret); line-height: 1.25; }
.marques { display: inline-flex; align-items: center; gap: 6px; color: var(--discret); }
.marques svg { width: 18px; height: 18px; }
.badge { font-size: 0.7rem; font-weight: 800; color: var(--sur-accent); background: var(--accent); border-radius: 999px; padding: 2px 8px; }
.pastille { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }
.p-tfila { background: var(--p-tfila); } .p-shiur { background: var(--p-shiur); } .p-seder { background: var(--p-seder); }
.p-perso { background: var(--p-perso); } .p-rest { background: var(--p-rest); } .p-chore { background: var(--p-chore); }
.discrete { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding-block: 3px; padding-inline: 50px 10px; font-size: 0.85rem; color: var(--discret); }
.discrete .quoi { font-weight: 600; }
.discrete.maintenant .quoi { color: var(--accent); }

.calme { background: var(--surface); border-radius: var(--rayon); padding: 26px 18px; text-align: center; box-shadow: var(--ombre); color: var(--discret); }
.calme p { margin: 0; }

/* Bilan */
.semaine { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 6px; }
.semaine h1 { font-size: 1.15rem; text-align: center; }
.btn-icone { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--trait); background: var(--surface); border-radius: 50%; padding: 0; }
.btn-icone svg { width: 20px; height: 20px; }
.btn-icone:disabled { opacity: 0.35; }
.carte { background: var(--surface); border-radius: var(--rayon); padding: 14px; box-shadow: var(--ombre); display: grid; gap: 10px; }
.carte h2 { margin: 0; font-size: 1rem; font-weight: 800; }
.jours-barres { display: grid; gap: 8px; }
.jour-barre { display: grid; grid-template-columns: 26px 1fr 52px; align-items: center; gap: 8px; font-size: 0.9rem; }
.jour-barre b { font-variant-numeric: tabular-nums; text-align: end; direction: ltr; }
.etapes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.etapes li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.score { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 0.85rem; padding: 2px 9px; border-radius: 999px; direction: ltr; }
.score.bon { background: var(--accent-doux); color: var(--accent); }
.score.faible { background: var(--rate-doux); color: var(--rate); }
.grand { margin: 0; font-size: 1.05rem; color: var(--discret); }
.grand b { font-size: 2rem; color: var(--encre); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes li { border-top: 1px solid var(--trait); padding-top: 8px; display: grid; gap: 2px; }
.notes li:first-child { border-top: 0; padding-top: 0; }
.notes .meta { font-size: 0.8rem; color: var(--discret); }
.discret { margin: 0; color: var(--discret); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 16px; border-radius: var(--rayon-petit); border: 1px solid var(--trait-fort); background: var(--surface); font-weight: 700; }
.btn.principal { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.btn:disabled { opacity: 0.6; }

/* Feuille du bas */
.fond { position: fixed; inset: 0; z-index: 20; background: var(--voile); display: flex; align-items: flex-end; justify-content: center; }
.fond[hidden] { display: none; }
.feuille { width: 100%; max-width: 540px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; box-shadow: 0 -10px 30px rgb(0 0 0 / 0.2); }
.poignee { width: 40px; height: 5px; border-radius: 99px; background: var(--trait-fort); justify-self: center; }
.feuille h2 { margin: 0; font-size: 1.4rem; text-align: center; }
.feuille .sous { margin: -6px 0 0; text-align: center; font-size: 0.9rem; }
.statuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.statuts button { min-height: 56px; border-radius: var(--rayon-petit); border: 1px solid var(--trait-fort); background: var(--surface); font-weight: 700; display: grid; place-items: center; gap: 2px; padding: 6px 0; }
.statuts svg { width: 20px; height: 20px; }
.statuts [aria-pressed="true"][data-statut="done"] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.statuts [aria-pressed="true"][data-statut="half"] { background: var(--moitie); border-color: var(--moitie); color: #fff; }
.statuts [aria-pressed="true"][data-statut="miss"] { background: var(--rate); border-color: var(--rate); color: #fff; }
.etiquette { font-size: 0.82rem; font-weight: 700; color: var(--discret); margin-bottom: -6px; }
textarea, input[type="text"] { width: 100%; border: 1px solid var(--trait-fort); border-radius: 12px; padding: 12px; background: var(--fond); font-size: 16px; }
textarea { resize: vertical; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }

/* Connexion */
.connexion { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 12px; padding: 24px 20px; text-align: center; }
.connexion .logo { border-radius: 18px; box-shadow: var(--ombre); }
.connexion h1 { margin: 0; font-size: 1.8rem; }
.connexion p { margin: 0; color: var(--discret); }
.connexion form { width: 100%; max-width: 340px; display: grid; gap: 12px; text-align: start; margin-top: 8px; }
.erreur { color: var(--rate); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
