/*
 * Les fiches de la refonte simplicite (lot 10) : la fiche projet (web/suivi/projet.js),
 * la fiche client (client.js) et son bloc Forfait CM (forfait.js), la liste des clients
 * (clients.js). Reference : maquette/refonte-simplicite.html (.fiche, .bloc, .etapes,
 * dl.infos, .liens, .histo, .rangees, .rangee, details.pli).
 *
 * Prefixe f- partout. Le socle (web/suivi/socle.css) n'est pas redefini : les fiches y
 * prennent tels quels .p-btn (.p-prim, .p-petit), .p-pastille, .p-tag, .p-tag-ent,
 * .p-nombre, .p-lien-frame, .p-lien, .p-consigne et les gestes (.p-gestes, .p-fi).
 *
 * Jamais de rouge ni d'orange (API.md 11.10, tests/couleurs-refonte.test.js) : le vert
 * pour l'etape en cours et les etapes faites, la priorite au contraste ; une erreur est
 * un texte clair et gras, avec un filet a gauche.
 *
 * Telephone (700 px et moins) : cibles de 44 px ; aucun defilement horizontal a 375 px
 * (titres, adresses et liens longs passent a la ligne).
 *
 * Classes :
 *   .f-fiche (.f-liste)         la colonne de la fiche ; .f-attente, .f-echec
 *   .f-retour                   « Retour », un bouton en forme de lien
 *   .f-tete > .f-tete-texte     titre (.f-titre) et aide (.f-aide), un bouton a droite
 *   .f-bloc > .f-bloc-titre     un bloc de la fiche et son titre
 *   .f-etapes > li (.f-fait, .f-ici)   les etapes du projet en puces
 *   .f-main, .f-alerte          qui a la main et le texte de la carte ; l'alerte
 *   .f-compteur (.f-compteur-boutons)   les videos montees d'un projet a plusieurs videos
 *   .f-infos (dl)               les infos : libelle a gauche, valeur a droite
 *   .f-versions > .f-version (.f-version-tete, .f-version-demande, .f-corrections, .f-version-lien)
 *                                         versions du montage et corrections demandees
 *   .f-liens, .f-url, .f-histo, .f-quand   liens et historique du projet
 *   .f-pli (.f-gerer) > summary, .f-pli-corps   un bloc replie (Gerer, livres, forfaits termines)
 *   .f-rangees > .f-rangee      une rangee cliquable : .f-rangee-texte (b, small), .f-rangee-droite
 *   .f-rangee-liens > .f-rangee-lien   une rangee a deux liens : la fiche (etire sur toute
 *                               la rangee) et, a droite, un lien vers l'exterieur (« Livraison ↗ »)
 *   .f-zone                     une zone remplie par un autre module (le forfait), cachee vide
 *   .f-form, .f-form-titre, .f-deux, .f-cases, .f-case, .f-note, .f-err, .f-actions
 *   .f-contacts > .f-contact    les contacts d'un client ; .f-notes
 *   .f-filtres (.f-filtre-texte)   les filtres de la liste des clients
 *   .f-vide (.f-vide-cadre), .f-lien-interne, .f-mois, .f-forfait-fini
 *
 * La page d'un projet CM (web/suivi/projets.js, API.md 11.15), une fiche comme les autres :
 *   .f-projet-cm                la page (plus large : les cartes des plannings cote a cote)
 *   .f-tete-lien                « Fiche client » : un lien en forme de bouton (.p-btn)
 *   .f-rythme-bloc > .f-rythme-titre, .f-rythme > .f-rythme-choix (aria-pressed), .f-rythme-lu
 *                               le rythme du planning : deux boutons, le choisi en vert
 *                               (coche, contour, voile) ; en lecture, le rythme seul
 *   .f-effets                   ce qu'a fait le changement de rythme (les effets du serveur)
 *   .f-infos-note               la precision du volume, sous le volume
 *   .f-cartes                   les cartes des plannings (.p-carte du socle), en grille
 *   .f-prochaine                le prochain planning, en pointille
 *   .f-bloc-tete                le titre d'un bloc et son bouton (« + RDV »)
 *   .f-lignes > .f-ligne        une ligne par RDV ou par periode terminee : .f-ligne-texte,
 *                               small (la note), .f-ligne-liens (V1 ↗ V2 ↗, des .p-lien)
 */

/* ---------- la fiche ---------- */

.f-fiche {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 780px; min-width: 0; overflow-wrap: anywhere;
}
.f-fiche.f-liste { max-width: 900px; }
.f-attente { margin: 0; color: var(--doux); font-size: 14px; }
.f-zone:empty { display: none; }

/* « Retour » : un lien vert, pas un bouton encadre. */
.f-retour {
  min-height: 36px; padding: 4px 6px; margin-left: -6px;
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--accent); font: inherit; font-size: 14px; cursor: pointer;
}
.f-retour:hover:not(:disabled) { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }

.f-tete { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.f-tete-texte { display: flex; flex-direction: column; gap: 4px; flex: 1 1 16em; min-width: 0; }
.f-titre {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  margin: 0; font-size: 20px; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere;
}
.f-aide {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0;
  margin: 0; color: var(--doux); font-size: 13px; overflow-wrap: anywhere;
}

/* ---------- les blocs ---------- */

.f-bloc {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0;
  padding: 14px 16px; background: var(--carte); border: 1px solid var(--bord); border-radius: 12px;
}
/* Deux classes : passe devant le h2 de commun/style.css (majuscules, grande marge). */
.f-bloc .f-bloc-titre {
  margin: 0; color: var(--doux); font-size: 12px; font-weight: 600; line-height: 1.4;
  text-transform: uppercase; letter-spacing: .09em;
}
.f-vide { margin: 0; color: var(--doux); font-size: 13px; }
.f-vide-cadre { padding: 14px; background: var(--carte); border: 1px dashed var(--bord-haut); border-radius: 10px; }
.f-echec { margin: 0; color: var(--alerte-texte); font-size: 14px; font-weight: 650; }

/* ---------- ou en est le projet ---------- */

.f-etapes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.f-etapes li {
  padding: 3px 10px; border: 1px solid var(--bord-haut); border-radius: 999px;
  color: var(--p-pale); font-size: 12px; line-height: 1.45;
}
.f-etapes li.f-fait { color: var(--doux); border-color: var(--bord); }
.f-etapes li.f-fait::before { content: "\2713\00a0"; color: var(--accent); }
.f-etapes li.f-ici { color: var(--texte); border-color: var(--accent); background: var(--p-accent-voile); }

.f-main { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.f-main b { font-weight: 650; }
.f-alerte { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- infos ---------- */

.f-infos {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px;
  margin: 0; font-size: 13.5px;
}
.f-infos dt { color: var(--doux); }
.f-infos dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.f-lien-interne { color: var(--texte); text-decoration: underline; text-decoration-color: var(--p-pale); text-underline-offset: 2px; }
.f-lien-interne:hover { text-decoration-color: var(--texte); }
.f-lien-interne:focus-visible, .f-url:focus-visible, .f-contact-lien:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}

/* ---------- versions et corrections ---------- */

.f-versions { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.f-version { display: grid; gap: 4px; min-width: 0; padding-left: 10px; border-left: 2px solid var(--bord-haut); }
.f-version-tete, .f-version-demande, .f-version-lien { margin: 0; font-size: 13px; }
.f-version-tete b { font-weight: 650; }
.f-version-demande { color: var(--doux); }
/* La note telle qu'elle a ete tapee : ses retours a la ligne, ses tirets, un long prompt colle. */
.f-corrections { margin: 0; font-size: 13.5px; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- liens et historique ---------- */

.f-liens { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.f-liens li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.f-liens b { font-weight: 650; }
.f-url {
  min-width: 0; color: var(--texte); font-size: 12.5px; overflow-wrap: anywhere; word-break: break-all;
  text-decoration: underline; text-decoration-color: var(--p-pale); text-underline-offset: 2px;
}
a.f-url:hover { text-decoration-color: var(--texte); }
.f-histo { display: grid; gap: 3px; margin: 0; padding-left: 18px; color: var(--doux); font-size: 12.5px; }
.f-quand { font-variant-numeric: tabular-nums; }

/* ---------- blocs replies (Gerer, livres, forfaits termines) ---------- */

.f-pli { min-width: 0; }
.f-pli > summary {
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: 100%; padding: 6px 0;
  color: var(--doux); font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  cursor: pointer; list-style: none;
}
.f-pli > summary::-webkit-details-marker { display: none; }
.f-pli > summary::before { content: "\25B8"; font-size: 11px; }
.f-pli[open] > summary::before { content: "\25BE"; }
.f-pli > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.f-pli-corps { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
/* Gerer, sous les blocs : a part, sans cadre, comme la maquette. */
.f-gerer { padding: 0 2px; }

/* ---------- rangees ---------- */

.f-rangees { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f-rangee {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px;
  min-width: 0; padding: 11px 12px;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 10px;
  color: var(--texte); text-align: left; text-decoration: none;
}
a.f-rangee:hover { border-color: var(--bord-haut); }
.f-rangee:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.f-rangee-texte { display: flex; flex-direction: column; gap: 2px; flex: 1 1 12em; min-width: 0; }
.f-rangee-texte b { font-weight: 650; overflow-wrap: anywhere; }
.f-rangee-texte small { color: var(--doux); font-size: 12.5px; overflow-wrap: anywhere; }
.f-rangee-droite { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
/* Dans un bloc, la rangee se detache sur le fond de la page. */
.f-bloc .f-rangee { background: var(--fond); }

/* Une rangee a deux liens (fiche client : « Livraison ↗ ») : le lien de la fiche s'etire
   sur toute la rangee (::after), le lien de droite passe au-dessus de lui. */
.f-rangee.f-rangee-liens { position: relative; }
.f-rangee-liens:hover { border-color: var(--bord-haut); }
.f-rangee-lien { color: var(--texte); text-decoration: none; }
.f-rangee-lien::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.f-rangee-lien:focus-visible { outline: none; }
.f-rangee-liens:has(.f-rangee-lien:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.f-rangee-liens .f-rangee-droite { position: relative; z-index: 1; }

/* ---------- formulaires ---------- */

.f-form {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0;
  padding: 12px; background: var(--fond); border: 1px solid var(--bord-haut); border-radius: 9px;
}
.f-form-titre { margin: 0; color: var(--texte); font-size: 14px; font-weight: 650; }
.f-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; color: var(--doux); font-size: 12.5px; }
/* :is() porte la specificite de son argument le plus fort : ces regles passent devant
   celles de commun/style.css (input[type=text], select, textarea). */
.f-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%; min-width: 0; min-height: 38px; margin: 0; padding: 8px 10px;
  border: 1px solid var(--bord-haut); border-radius: 7px;
  background: var(--fond); color: var(--texte);
  font: inherit; font-size: 14px; line-height: 1.3;
}
.f-form :is(textarea) { resize: vertical; }
.f-form :is(input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.f-deux { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 8px 10px; }
.f-deux > * { min-width: 0; }
.f-cases { display: flex; flex-wrap: wrap; gap: 6px 16px; min-width: 0; margin: 0; padding: 0; border: 0; }
.f-cases legend { margin-bottom: 6px; padding: 0; color: var(--doux); font-size: 12.5px; }
/* Une case a cocher et son libelle, sur une ligne. */
.f-form label.f-case { flex-direction: row; align-items: center; gap: 8px; color: var(--texte); font-size: 13.5px; cursor: pointer; }
.f-case input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.f-note { margin: 0; color: var(--doux); font-size: 12.5px; }
.f-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* L'erreur (la notre ou celle du serveur) : texte clair et gras, un filet a gauche. */
.f-err {
  margin: 0; padding-left: 8px; border-left: 2px solid var(--alerte);
  color: var(--alerte-texte); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere;
}
.f-err[hidden] { display: none; }

/* ---------- forfait CM ---------- */

.f-mois { min-width: 0; }
.f-forfait-fini { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f-forfait-fini-texte { margin: 0; color: var(--doux); font-size: 13px; }

/* ---------- contacts ---------- */

.f-contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 8px; }
.f-contacts > .f-form { grid-column: 1 / -1; }
.f-contact {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0;
  padding: 10px 12px; background: var(--fond); border: 1px solid var(--bord); border-radius: 10px;
}
.f-contact-nom { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-weight: 650; }
.f-contact-detail { margin: 0; color: var(--doux); font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
.f-contact-lien {
  color: var(--texte); font-size: 13.5px; overflow-wrap: anywhere;
  text-decoration: underline; text-decoration-color: var(--p-pale); text-underline-offset: 2px;
}
.f-contact .f-actions { margin-top: 4px; }
.f-notes { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.f-notes-titre { margin: 0; color: var(--doux); font-size: 12px; }
.f-notes-texte { margin: 0; font-size: 13.5px; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- liste des clients ---------- */

.f-filtres {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px;
  align-items: end;
}
.f-filtres label { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; color: var(--doux); font-size: 12.5px; }
.f-filtres :is(input, select) {
  width: 100%; min-width: 0; min-height: 38px; margin: 0; padding: 8px 10px;
  border: 1px solid var(--bord-haut); border-radius: 7px;
  background: var(--fond); color: var(--texte); font: inherit; font-size: 14px;
}
.f-filtres :is(input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- telephone ---------- */

@media (max-width: 700px) {
  .f-bloc { padding: 12px; }
  .f-titre { font-size: 19px; }
  .f-deux { grid-template-columns: 1fr; }
  .f-filtres { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .f-filtre-texte { grid-column: 1 / -1; }
  /* 16 px : sous cette taille, l'iPhone agrandit la page quand le champ prend le focus. */
  .f-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea),
  .f-filtres :is(input, select) { font-size: 16px; }
  .f-tete > .p-btn { flex: 1 1 auto; }
}

/* Au doigt, une cible de moins de 44 px se rate : boutons, liens, champs, cases, replis. */
@media (max-width: 700px), (pointer: coarse) {
  .f-retour, .f-pli > summary { min-height: 44px; }
  .f-form :is(input:not([type="checkbox"]):not([type="radio"]), select),
  .f-filtres :is(input, select) { min-height: 44px; }
  .f-form label.f-case { min-height: 44px; }
  .f-lien-interne, .f-url, .f-contact-lien { display: inline-flex; align-items: center; min-height: 44px; }
  .f-rangee { min-height: 56px; }
}

/* ---------- le compteur des videos montees (fiche projet) ---------- */

.f-compteur { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.f-compteur > p { margin: 0; }
.f-compteur b { font-variant-numeric: tabular-nums; }
.f-compteur-boutons { display: flex; gap: 6px; }
.f-compteur-boutons .p-btn { min-width: 44px; justify-content: center; }
.f-compteur .f-err { flex: 1 1 100%; }

/* ---------- la page d'un projet CM (projets.js) ---------- */

.f-fiche.f-projet-cm { max-width: 900px; }
/* L'aide en ligne (pas en flex) : les « · » gardent leurs espaces. */
.f-projet-cm .f-aide { display: block; }
/* Le titre ne prend le focus que par le code (apres un dessin) : pas de cadre. */
.f-projet-cm .f-titre:focus { outline: none; }
a.f-tete-lien { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* Le rythme du planning : deux boutons ; le choisi coche, contour vert et voile, comme les
   choix des gestes du socle (.p-choix). */
.f-rythme-bloc { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.f-rythme-titre { margin: 0; color: var(--doux); font-size: 12.5px; }
.f-rythme { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
/* Deux classes : passe devant le button de commun/style.css. */
.f-rythme .f-rythme-choix {
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--bord-haut); border-radius: 8px;
  background: var(--fond); color: var(--texte);
  font: inherit; font-size: 14px; line-height: 1.25;
}
.f-rythme .f-rythme-choix[aria-pressed="true"] { border-color: var(--accent); background: var(--p-accent-voile); font-weight: 650; }
.f-rythme .f-rythme-choix[aria-pressed="true"]::before { content: "\2713\00a0"; color: var(--accent); }
.f-rythme-lu { margin: 0; font-size: 14px; font-weight: 650; }
.f-effets {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0;
  padding-left: 8px; border-left: 2px solid var(--doux); font-size: 13px;
}
.f-effets p { margin: 0; overflow-wrap: anywhere; }
.f-infos-note { display: block; color: var(--doux); font-size: 12.5px; }

/* Les plannings : les cartes du socle cote a cote, puis le prochain, en pointille. */
.f-cartes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 8px; align-items: start; min-width: 0;
}
.f-prochaine {
  margin: 0; padding: 10px 12px; border: 1px dashed var(--bord-haut); border-radius: 9px;
  color: var(--doux); font-size: 13px; overflow-wrap: anywhere;
}
.f-prochaine b { color: var(--texte); font-weight: 650; }

/* Les videos en resume (lignes .p-video du socle), sans l'ecart du repli. */
.f-bloc > .p-videos-liste { margin: 0; }

/* Le titre d'un bloc et son bouton sur une ligne (« RDV » et « + RDV »). */
.f-bloc-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; min-width: 0; }

/* Une ligne par RDV ou par periode terminee : le texte, les liens a droite, la note dessous. */
.f-lignes { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.f-ligne {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 12px;
  min-width: 0; padding: 9px 12px;
  background: var(--fond); border: 1px solid var(--bord); border-radius: 10px;
  font-size: 13.5px; overflow-wrap: anywhere;
}
.f-ligne-texte { min-width: 0; }
.f-ligne-texte b { font-weight: 650; }
.f-ligne > small { flex: 1 1 100%; color: var(--doux); font-size: 12.5px; white-space: pre-line; }
.f-ligne-liens { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; }

@media (max-width: 700px) {
  /* Les deux rythmes se partagent la largeur ; le libelle passe a la ligne s'il le faut. */
  .f-rythme .f-rythme-choix { flex: 1 1 0; min-width: 0; padding: 8px 10px; }
  /* « Fiche client » garde sa taille (la regle des fiches etire le bouton de l'en-tete). */
  .f-projet-cm .f-tete > .f-tete-lien { flex: 0 0 auto; }
}

@media (max-width: 700px), (pointer: coarse) {
  .f-rythme .f-rythme-choix { min-height: 44px; }
}
