/* =============================================================================
   FORMULAIRES GUIDÉS (web/js/formulaire-guide.js)
   Obligatoire / facultatif en discret, drapeaux sous le champ (rouge = bloquant, orange = conseil),
   liste de ce qui manque au clic, jauge « Prêt à émettre 5/7 ». Une alerte est toujours rouge (--danger) ;
   le bleu (--accent) ne sert qu'à ce qui est prêt.
   ============================================================================= */

/* marque discrète à côté du libellé */
.fg-marque { margin-left: 7px; font-size: 11px; font-weight: 500; letter-spacing: .01em; color: var(--ink-3); white-space: nowrap; }

/* drapeau sous le champ */
.fg-msg { display: flex; flex-direction: column; gap: 4px; margin-top: 1px; font-size: 12.5px; line-height: 1.45; font-weight: 600;
  color: var(--danger); animation: fg-arrivee .28s var(--ease-out) both; }
.fg-msg.conseil { color: var(--amber); font-weight: 500; }
.fg-msg .fg-texte { position: relative; display: block; padding-left: 22px; overflow-wrap: anywhere; }
.fg-msg .fg-texte::before { content: "!"; position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); display: grid; place-items: center; font-size: 10px; font-weight: 800; line-height: 1; color: #fff; }
.fg-msg.conseil .fg-texte::before { background: var(--amber); }
.fg-ref { font-weight: 500; color: var(--ink-3); }
.fg-msg .fg-ref { font-size: 11.5px; }
.fg-lien { display: inline; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.fg-lien:hover { color: var(--ink); text-decoration-thickness: 2px; }
.fg-lien:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; border-radius: 4px; }

/* le champ lui-même : contour rouge (bloquant) ou orange (conseil), sans changer sa taille */
/* contour dessiné par une ombre intérieure : visible aussi sur téléphone, où les champs n'ont pas de bordure */
.input.fg-ko, .sel-btn.fg-ko, .dp-txt.fg-ko, input.fg-ko, textarea.fg-ko { border-color: var(--danger) !important;
  box-shadow: inset 0 0 0 1.5px var(--danger), 0 0 0 3px var(--danger-soft) !important; }
.input.fg-attention, .sel-btn.fg-attention, .dp-txt.fg-attention, input.fg-attention { border-color: var(--amber) !important;
  box-shadow: inset 0 0 0 1.5px var(--amber) !important; }
.fg-secoue { animation: fg-secoue .38s var(--ease); }
@keyframes fg-secoue { 20% { transform: translateX(-4px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } 100% { transform: none; } }
@keyframes fg-arrivee { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* lignes d'une facture ou d'un devis : le message prend toute la largeur sous les lignes */
.lines > .fg-msg, #lines + .fg-msg { margin: 10px 0 2px; }

/* relance : le message se place sous le champ, dans la colonne du champ (pas sous le libellé) */
.rl-champ > .fg-msg { grid-column: 2 / -1; margin-top: -2px; }
.rl-papier > .fg-msg { margin-top: 8px; }
.rl-corps.fg-ko { border-radius: var(--r-sm); padding: 10px 12px; }
.rl-lettre > .fg-liste { margin: 16px 22px 0; }

/* liste de ce qui manque */
.fg-liste { margin: 0 0 14px; padding: 14px 16px 12px; border-radius: var(--r-md); background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent); color: var(--ink); animation: fg-arrivee .3s var(--ease-out) both; }
.fg-liste-titre { position: relative; padding-left: 24px; font-size: 13.5px; font-weight: 700; color: var(--danger); line-height: 1.4; }
.fg-liste-titre::before { content: "!"; position: absolute; left: 0; top: 1px; width: 17px; height: 17px; border-radius: 50%; background: var(--danger);
  color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; }
.fg-liste ul { list-style: none; margin: 8px 0 0; padding: 0 0 0 24px; display: grid; gap: 6px; }
.fg-liste li { font-size: 13px; line-height: 1.45; }
.fg-point { display: inline; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.fg-point:hover { text-decoration: underline; text-underline-offset: 2px; }
.fg-point:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; border-radius: 4px; }
.fg-point .fg-ref { display: block; font-size: 11.5px; }
.fg-liste li .fg-lien { display: block; width: fit-content; margin-top: 3px; font-size: 12.5px; }
.modal-body > .fg-liste:first-child { margin-top: 0; }

/* jauge « Prêt à émettre 5/7 » (posée dans le résumé sombre ou clair : couleurs reprises du texte) */
.fg-jauge { margin: 16px 0 2px; }
.fg-jauge-haut { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; }
.fg-jauge-haut span { opacity: .7; }
.fg-jauge-haut b { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fg-barre { margin-top: 8px; height: 6px; border-radius: var(--pill); background: color-mix(in srgb, currentColor 14%, transparent); overflow: hidden; }
.fg-barre i { display: block; height: 100%; border-radius: inherit; background: currentColor; opacity: .55; transition: width .45s var(--ease-out); }
.fg-jauge.fini .fg-jauge-haut span { opacity: 1; }
.fg-jauge.fini .fg-barre i { background: var(--ink); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .fg-msg, .fg-liste { animation: none; }
  .fg-secoue { animation: none; }
  .fg-barre i { transition: none; }
}
@media (max-width: 820px) {
  .fg-msg { font-size: 13px; }
  .fg-liste { padding: 13px 14px 11px; }
}

/* liste posée sous le résumé (éditeurs de facture et de devis) : rien quand elle est vide */
.fg-hote-liste:empty { display: none; }
.fg-hote-liste > .fg-liste { margin: 0; }
@media (min-width: 821px) {
  .input.fg-ko, .sel-btn.fg-ko, .dp-txt.fg-ko, input.fg-ko, textarea.fg-ko { box-shadow: inset 0 0 0 .5px var(--danger), 0 0 0 3px var(--danger-soft) !important; }
  .input.fg-attention, .sel-btn.fg-attention, .dp-txt.fg-attention, input.fg-attention { box-shadow: none !important; }
}
