/* Sobre et presque vide : une seule colonne, très peu de boîtes, le violet pour ce qui se touche.
   Le thème suit l'appareil (clair ou sombre). */

@font-face {
  font-family: Inter;
  src: url("/static/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --fond: #F5F3F7;
  --texte: #2A2830;
  --discret: #6A6674;
  --trait: #DCD8E3;
  --surface: #E9E6EE;
  --accent: #6A3FD0;
  --sur-accent: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #17161B;
    --texte: #D9D6DF;
    --discret: #8C8896;
    --trait: #2B2932;
    --surface: #201E26;
    --accent: #BBA6FF;
    --sur-accent: #17161B;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

a { color: var(--discret); }
a:hover { color: var(--texte); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* En-tête de page */

.entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 22px 0 22px;
}

/* Le titre passe sous la barre, aligné sur la colonne de la page. */
.entete > .entete-titres, .entete > .titre {
  order: 3;
  flex: none;
  width: 100%;
  padding: 22px max(0px, calc((100% - 560px) / 2)) 0;
}
.entete-titres { display: flex; flex-direction: column; gap: 4px; }
.titre { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.sous-titre { font-size: 14px; color: var(--discret); }

.lien-entete {
  font-size: 14px;
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.retour {
  width: 44px;
  height: 44px;
  margin-left: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Corps et pied */

.corps {
  flex: 1;
  width: 100%;
  max-width: 604px;
  margin: 0 auto;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.pied {
  width: 100%;
  max-width: 604px;
  margin: 0 auto;
  padding: 12px 22px calc(env(safe-area-inset-bottom, 0px) + 12px) 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.centre { justify-content: center; align-items: center; text-align: center; }

.texte-discret { margin: 0; font-size: 15px; color: var(--discret); }
.petit { margin: 0; font-size: 13px; color: var(--discret); }
.erreur { margin: 0; font-size: 15px; font-weight: 500; }

.rubrique {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--discret);
}

.logo { width: 72px; height: 72px; border-radius: 16px; }

/* Boutons */

.bouton {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  min-height: 52px;
  padding: 0 18px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  width: 100%;
}

.bouton[disabled] { opacity: 0.6; cursor: default; }

.bouton-discret {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 18px;
  background: transparent;
  color: var(--discret);
  cursor: pointer;
  width: 100%;
}

/* Liste de lignes cliquables (numéros d'aide, passkeys) */

.lignes { display: flex; flex-direction: column; gap: 10px; }

.ligne {
  text-decoration: none;
  color: var(--texte);
  border-top: 1px solid var(--trait);
  padding: 14px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lignes { gap: 0; }

.ligne:hover { color: var(--texte); }
.ligne-textes { display: flex; flex-direction: column; gap: 2px; }
.ligne-titre { font-size: 16px; font-weight: 500; }
.ligne-numero { font-size: 20px; font-weight: 600; color: var(--accent); }

/* ------------------------------------------------------------------ */
/* Journal : deux volets, écriture, fin de séance                      */
/* ------------------------------------------------------------------ */

:root { --bascule-active: #FBFAFC; --ombre-bascule: none; }
@media (prefers-color-scheme: dark) {
  :root { --bascule-active: #302D39; }
}

.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* Une seule colonne */

body.ecran-fixe { height: 100dvh; min-height: 0; }
.volet-page { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* Journal : les entrées passées */

.liste-groupe { display: flex; flex-direction: column; }
.liste-groupe .rubrique { padding-bottom: 8px; }
.liste-entree {
  text-decoration: none; color: var(--texte);
  border-top: 1px solid var(--trait); padding: 14px 0;
  display: flex; flex-direction: column; gap: 4px;
}
.liste-entree:hover { color: var(--texte); }
.liste-ligne { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; font-weight: 500; }
.liste-etat { color: var(--discret); font-weight: 400; font-size: 14px; }
.liste-extrait { font-size: 14px; line-height: 1.45; color: var(--discret); }

/* Aujourd'hui */

.aujourd-hui { gap: 0; }
.jour-ligne { display: flex; flex-direction: column; gap: 4px; padding: 18px 0; border-top: 1px solid var(--trait); }
.jour-titre {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 17px; font-weight: 500; color: var(--texte); text-decoration: none;
}
a.jour-titre { min-height: 30px; align-items: center; }
.jour-titre span[aria-hidden] { color: var(--discret); font-weight: 400; }
.jour-titre.a-faire, .jour-titre.a-faire:hover { color: var(--accent); }
.jour-ligne p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--discret); }
.jour-liens { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; }
.jour-liens a, .jour-liens button {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none;
  background: none; border: 0; padding: 0; min-height: 44px; display: flex; align-items: center; cursor: pointer;
}
.jour-liens .second { color: var(--discret); font-weight: 400; }

/* Menu */

.menu { gap: 6px; padding-top: 30px; }
.menu a {
  display: flex; flex-direction: column; justify-content: center; min-height: 52px;
  font-size: 21px; font-weight: 500; color: var(--texte); text-decoration: none;
}
.menu a:hover { color: var(--accent); }

/* En-tête d'une entrée : titre, puis bascule Guidé/Libre et Terminer */

.barre { padding: 8px 22px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

.bascule { display: flex; background: var(--surface); border-radius: 10px; padding: 3px; gap: 3px; }
.bascule button {
  font: inherit; font-size: 14px; font-weight: 500;
  border: 0; border-radius: 8px; min-height: 44px; padding: 0 18px;
  background: transparent; color: var(--discret); cursor: pointer;
}
.bascule button[aria-pressed="true"] {
  font-weight: 600; background: var(--bascule-active); color: var(--texte); box-shadow: var(--ombre-bascule);
}

.bouton-contour {
  font: inherit; font-size: 14px; font-weight: 500;
  border: 0; border-radius: 10px; min-height: 44px; padding: 0 16px;
  background: var(--surface); color: var(--accent); cursor: pointer;
}
.bouton-lien { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.bouton-discret { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.bouton-large { width: auto; }

/* Fil de la séance */

.fil { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 16px; }
.colonne { width: 100%; max-width: 560px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; gap: 18px; }
#bandeau:not(:has(.bandeau)) { display: none; }

.bulle { font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle-ia { align-self: flex-start; color: var(--discret); }
.bulle-yoan { align-self: flex-end; max-width: 86%; background: var(--surface); border-radius: 14px; padding: 10px 14px; }
.attente { color: var(--discret); animation: attente 1.2s ease-in-out infinite; }
@keyframes attente { 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .attente { animation: none; } }

.pied-saisie {
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 14px) 16px;
  display: flex; gap: 10px; align-items: flex-end;
}
.pied-saisie textarea {
  flex: 1; font: inherit; font-size: 16px; line-height: 1.4;
  border: 1px solid transparent; border-radius: 22px; padding: 11px 16px;
  min-height: 46px; max-height: 40dvh; resize: none;
  color: var(--texte); background: var(--surface);
}
.bouton-envoyer {
  flex: none; border: 0; border-radius: 50%; width: 46px; height: 46px;
  background: var(--surface); color: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Mode libre : page continue, l'IA en retrait */

.fil-libre { padding: 16px 22px; }
.texte-libre { font-size: 17px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.retrait { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.retrait p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--discret); white-space: pre-wrap; }
.saisie-libre {
  flex: 1; width: 100%; min-height: 8em; padding: 0;
  font: inherit; font-size: 17px; line-height: 1.6;
  border: 0; outline: none; resize: none;
  background: transparent; color: var(--texte);
}

.pied-libre {
  padding: 10px 22px calc(env(safe-area-inset-bottom, 0px) + 14px) 22px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
}
.bouton-reponds {
  font: inherit; font-size: 15px; font-weight: 600;
  border: 0; border-radius: 12px; min-height: 46px; padding: 0 18px;
  background: var(--surface); color: var(--accent); cursor: pointer;
}
.bouton-reponds[disabled] { opacity: 0.6; }
.en-cours { display: none; }
.bouton-reponds[disabled] .au-repos { display: none; }
.bouton-reponds[disabled] .en-cours { display: inline; }

.avis {
  margin: 0; font-size: 14px; color: var(--discret);
  background: var(--surface); border-radius: 12px; padding: 10px 14px;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.avis .lien-bouton { white-space: nowrap; }
.lien-bouton { font: inherit; font-weight: 600; background: none; border: 0; color: var(--accent); min-height: 44px; cursor: pointer; padding: 0; }

.bandeau {
  border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; font-size: 15px;
}
.bandeau-numeros { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.bandeau-numeros a { color: var(--texte); text-decoration: none; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.bandeau-numeros strong { color: var(--accent); font-size: 17px; }

/* Fin de séance et relecture */

.formulaire { flex: 1; display: flex; flex-direction: column; }
.corps-fin { gap: 32px; }
.bloc { display: flex; flex-direction: column; gap: 10px; }
.bloc-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.etiquette { font-size: 15px; font-weight: 600; }
.zone-resume { display: flex; flex-direction: column; gap: 8px; }
.champ {
  width: 100%; font: inherit; font-size: 16px; line-height: 1.5;
  border: 1px solid transparent; border-radius: 12px; padding: 14px; resize: none;
  color: var(--texte); background: var(--surface);
}

.humeurs { display: flex; gap: 8px; }
.humeur { flex: 1; position: relative; }
.humeur input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.humeur span {
  display: flex; align-items: center; justify-content: center; min-height: 52px;
  background: var(--surface); border-radius: 12px; font-size: 17px; font-weight: 500;
}
.humeur input:checked + span { background: var(--accent); color: var(--sur-accent); font-weight: 600; }
.humeur input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.legende { display: flex; justify-content: space-between; font-size: 13px; color: var(--discret); }

.resume-relu { display: flex; flex-direction: column; gap: 8px; padding-bottom: 18px; border-bottom: 1px solid var(--trait); }
.resume-relu p { margin: 0; }

/* Grand écran (Mac) : la même page, centrée, avec du vide autour */

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

  .entete { padding: 10px 26px 0; }
  .corps { padding-top: 34px; }
  .barre { padding: 10px 26px; }
  .tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .tete .entete { flex: 1; }

  .fil-guide, .fil-libre { padding: 40px max(26px, calc((100% - 560px) / 2)); }
  .texte-libre, .saisie-libre { font-size: 18px; line-height: 1.65; }
  .retrait { padding-left: 24px; }
  .retrait p { font-size: 17px; line-height: 1.55; }
  .pied-saisie, .pied-libre { padding: 12px max(26px, calc((100% - 560px) / 2)) 22px; }
}

/* Écran d'écriture : la date reste dans la barre, en petit. */
.tete .entete { flex-wrap: nowrap; padding-bottom: 0; }
.tete .entete > .entete-titres { order: 0; flex: 1; width: auto; padding: 0; gap: 0; }
.tete .titre { font-size: 15px; font-weight: 500; letter-spacing: 0; }
.tete .sous-titre { font-size: 12px; }

/* Mémoire et corbeille */

.section-memoire { display: flex; flex-direction: column; gap: 8px; }
.section-memoire p { margin: 0; font-size: 16px; line-height: 1.55; }
.section-memoire .vide { color: var(--discret); }
.corps > p { margin: 0; }
.centre-texte { text-align: center; }
label.rubrique { display: block; }

/* Bascule Texte / Graphe (mêmes valeurs que Guidé / Libre) */

.bascule a {
  font-size: 14px; font-weight: 500; text-decoration: none;
  border-radius: 8px; min-height: 44px; padding: 0 18px;
  display: flex; align-items: center; color: var(--discret);
}
.bascule a[aria-current="page"] {
  font-weight: 600; background: var(--bascule-active); color: var(--texte); box-shadow: var(--ombre-bascule);
}
.barre-vues { justify-content: center; }

/* Graphe */

.zone-graphe { flex: 1; min-height: 0; }
#graphe { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.g-lien { stroke: var(--trait); stroke-width: 1.5; }
.g-point { cursor: pointer; outline: none; }
.g-point circle { fill: var(--discret); stroke: var(--fond); stroke-width: 2; }
.g-point text { font-size: 11px; fill: var(--discret); pointer-events: none; }
.g-centre circle, .g-rubrique circle { fill: var(--accent); }
.g-rubrique.g-vide circle { fill: var(--fond); stroke: var(--accent); }
.g-centre text, .g-rubrique text { font-size: 12px; font-weight: 600; fill: var(--texte); }
.g-choisi circle, .g-point:focus-visible circle { stroke: var(--accent); stroke-width: 3; }
.g-choisi text { fill: var(--texte); }

.graphe-detail {
  min-height: 108px;
  padding: 14px 22px calc(env(safe-area-inset-bottom, 0px) + 14px) 22px;
  border-top: 1px solid var(--trait);
  display: flex; flex-direction: column; gap: 6px;
}
.graphe-detail p { margin: 0; font-size: 16px; line-height: 1.5; }
@media (min-width: 900px) { .graphe-detail { padding: 16px 32px; } }

/* Retouches après essai dans un navigateur */

.pied-saisie textarea:focus-visible, .champ:focus-visible { outline: none; border-color: var(--accent); }
.liste-extrait { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.bouton-envoyer[disabled] { opacity: 0.5; cursor: default; }

/* Écran d'écriture : il occupe exactement la partie visible, clavier de l'iPhone compris. */
body.ecran-fixe { position: fixed; top: 0; left: 0; width: 100%; height: var(--hauteur-visible, 100dvh); overflow: hidden; }

/* Réglages : rappel du soir */
.rappel-heure { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.champ-heure { width: auto; min-height: 44px; padding: 8px 12px; }
.rappel-appareil { display: flex; flex-direction: column; gap: 10px; }
.rappel-appareil [hidden] { display: none; }

/* Page de consultation */
.section-memoire ul.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.point {
  display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 12px 0;
  border-top: 1px solid var(--trait); font-size: 16px; line-height: 1.5; cursor: pointer;
}
.point input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }
.point:has(input:checked) span { color: var(--discret); text-decoration: line-through; }
.section-memoire ul { margin: 0; padding-left: 20px; font-size: 16px; line-height: 1.55; }
.section-memoire p.petit { font-size: 13px; line-height: 1.45; }
.jours-recents { display: flex; flex-direction: column; gap: 14px; }
.jour-recent { display: flex; flex-direction: column; gap: 2px; }
.jour-recent p { margin: 0; font-size: 16px; line-height: 1.55; }

/* Ajout à la mémoire proposé par l'IA sous une réponse */
.proposition {
  align-self: flex-start; max-width: 100%; margin: 0; padding: 10px 14px;
  background: var(--surface); border-radius: 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.proposition .bouton-contour { background: none; padding: 0; }
.proposition-texte { font-size: 15px; line-height: 1.45; color: var(--texte); }
.proposition-faite { align-self: flex-start; }

/* Questionnaire « Ma situation » */
.question-situation { font-size: 20px; font-weight: 500; line-height: 1.35; }

/* Nouvelle entrée : choix du mode */
.choix-mode { display: flex; flex-direction: column; }
.choix {
  font: inherit; text-align: left; cursor: pointer; color: var(--texte); background: none;
  border: 0; border-top: 1px solid var(--trait); padding: 18px 0; min-height: 72px;
  display: flex; flex-direction: column; gap: 4px;
}
.choix:hover .choix-titre { color: var(--accent); }
.choix:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.choix-titre { font-size: 17px; font-weight: 500; color: var(--accent); }

/* Noter ma journée (maquette 5, une mesure par écran) */
.question-mesure { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.question-mesure h1 { margin: 0; }
.question-mesure .lien-bouton { align-self: flex-start; }
.notes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.notes button {
  font: inherit; font-size: 17px; font-weight: 500; height: 48px; cursor: pointer;
  border: 0; border-radius: 12px; background: var(--surface); color: var(--texte);
}
.notes button[aria-pressed="true"] { font-weight: 600; background: var(--accent); color: var(--sur-accent); }
.legende { gap: 12px; }
.pied-liens { display: flex; gap: 10px; }
a.bouton { display: flex; align-items: center; justify-content: center; text-decoration: none; }
a.bouton:hover { color: var(--accent); }

.recap { display: flex; flex-direction: column; }
.recap-ligne {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--trait);
  color: var(--texte); text-decoration: none; font-size: 16px;
}
.recap-valeur { font-size: 17px; font-weight: 600; white-space: nowrap; }
.note-libre { white-space: pre-wrap; overflow-wrap: anywhere; }
.lien-ligne { align-self: flex-start; display: flex; align-items: center; text-decoration: none; }

/* Suivi des notes : une courbe par mesure, et ses chiffres sur quatorze jours */
.courbe { display: flex; flex-direction: column; gap: 6px; padding: 10px 0 14px; border-bottom: 1px solid var(--trait); }
.courbe .bloc-tete { flex-wrap: wrap; gap: 2px 12px; }
.courbe svg { display: block; width: 100%; height: auto; overflow: visible; }
.c-repere { stroke: var(--trait); stroke-width: 1; }
.c-trait { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-point { fill: var(--accent); stroke: var(--fond); stroke-width: 2; }
.c-tableau { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; font-variant-numeric: tabular-nums; }
.c-tableau td { padding: 0; font-size: 14px; font-weight: 600; }
.c-tableau th { padding: 0; font-size: 11px; font-weight: 400; color: var(--discret); }
.pied-liens .bouton-discret { padding: 0 8px; white-space: nowrap; }

/* Page de consultation : tableau des notes (chiffres seuls) */
.notes-defilement { overflow-x: auto; }
.notes-tableau { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.notes-tableau td { text-align: center; padding: 5px 0; min-width: 17px; font-weight: 600; }
.notes-tableau thead th { font-size: 11px; font-weight: 400; color: var(--discret); padding: 0 0 4px; }
.notes-tableau tbody th { text-align: left; font-weight: 400; padding: 5px 8px 5px 0; position: sticky; left: 0; background: var(--fond); max-width: 132px; line-height: 1.3; }
.notes-tableau tbody tr { border-bottom: 1px solid var(--trait); }
.notes-tableau th.notes-groupe { font-size: 12px; font-weight: 400; color: var(--discret); padding-top: 12px; max-width: none; }
