/* Surcouche légère au DSFR : uniquement ce que le DSFR ne fournit pas tel quel. */

.principal { padding-top: 0.75rem; padding-bottom: 0.75rem; }

/* Le DSFR impose un display sur ces classes : on rétablit l'attribut hidden */
.fr-error-text[hidden],
[hidden] {
  display: none !important;
}

/* Navigation par étapes */
.barre-haute {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-bottom: 0.25rem;
}
.stepper { margin: 0; }
/* Gouttières réduites (le DSFR en met 1,5 rem) */
.gouttiere-fine { margin: -0.25rem; }
.gouttiere-fine > [class*="fr-col"] { padding: 0.25rem; }
.stepper__liste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.stepper__liste { list-style: none !important; }
.stepper__liste li { padding: 0; margin: 0; list-style: none !important; }
.stepper__liste li::marker { content: ""; }
.stepper__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  border: 1px solid var(--border-active-blue-france, #000091);
  border-radius: 1.25rem;
  background: var(--background-default-grey, #fff);
  color: var(--text-action-high-blue-france, #000091);
  font-size: 0.875rem;
  cursor: pointer;
}
.stepper__btn:disabled {
  border-color: var(--border-default-grey, #ddd);
  color: var(--text-disabled-grey, #929292);
  cursor: default;
}
.stepper__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--background-contrast-blue-france, #e3e3fd);
  font-weight: 700;
  font-size: 0.8125rem;
}
.stepper__btn:disabled .stepper__num { background: var(--background-disabled-grey, #e5e5e5); }
.stepper__btn--courant {
  background: var(--background-action-high-blue-france, #000091);
  color: #fff;
  font-weight: 700;
}
.stepper__btn--courant .stepper__num { background: #fff; color: #000091; }

/* Rappel de la situation */
.recap {
  margin: 0 0 0.5rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border-default-grey, #ddd);
  background: var(--background-alt-grey, #f6f6f6);
  font-size: 0.875rem;
}
.recap summary { cursor: pointer; }

/* Étapes */
.etape { margin-top: 0.5rem; }
.etape[hidden] { display: none; }
.etape__barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.etape__barre .fr-btns-group { margin: 0; }
.etape :focus-visible { outline-offset: 2px; }
.etape h2 { font-size: 1.0625rem; line-height: 1.4; font-weight: 700; margin: 0 0 0.5rem; }
.etape__barre h2 { margin: 0; }
.aide { font-size: 0.875rem; padding: 0.25rem 0; }
.aide summary { cursor: pointer; color: var(--text-action-high-blue-france, #000091); }
.fr-input-group textarea { resize: vertical; }

.nav-bas {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}
.nav-bas .fr-btn[hidden] { display: none !important; }
.nav-bas #btn-suiv { margin-left: auto; }

/* Cartes du tirage (compactes) */
.tirage-pile { display: flex; flex-direction: column; gap: 0.5rem; }
.carte {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-default-grey, #ddd);
  border-top: 3px solid var(--border-plain-blue-france, #000091);
  background: var(--background-default-grey, #fff);
  font-size: 0.875rem;
  line-height: 1.4;
}
.carte__titre {
  margin: 0.25rem 0;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}
.carte p, .carte li { margin-bottom: 0.25rem; font-size: 0.875rem; line-height: 1.4; }
.carte .carte__titre { font-size: 1rem; }
.carte .fr-badge { font-size: 0.6875rem; }
.carte ul { margin: 0; padding-left: 1.125rem; }
.carte li { padding-bottom: 0.125rem; }
.recap .carte { height: 100%; }

/* Alertes en rouge pâle (données nominatives, faits à contrôler) */
.alerte-rouge {
  background-color: var(--background-contrast-error, #ffe9e9);
}
.alerte-rouge.fr-alert { font-size: 0.875rem; }
.alerte-rouge p { margin: 0; font-size: 0.875rem; line-height: 1.4; font-weight: 400; }

/* Blocs de prompt : la hauteur suit l'écran, le texte défile dans son cadre */
.bloc {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.bloc__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}
.bloc__entete h3 { margin: 0; font-size: 1rem; line-height: 1.4; }
.prompt-texte {
  flex: 1;
  margin: 0;
  padding: 0.75rem;
  max-height: calc(100vh - 25rem);
  min-height: 7rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  background: var(--background-alt-grey, #f6f6f6);
  border-left: 4px solid var(--border-plain-blue-france, #000091);
}
.prompt-texte--court { max-height: 14rem; min-height: 4rem; }
.prompt-texte--vous { border-left-color: var(--border-plain-grey, #666); }
.prompt-texte--rapide { border-left-color: var(--border-default-grey, #bbb); }
mark.champ {
  background: #fceeac;
  color: #161616;
  padding: 0 0.2rem;
}
.statut-copie { min-height: 1.25rem; margin: 0.125rem 0 0; }

/* Retour IA */
.retour-priorite {
  margin: 0 0 0.75rem;
  padding: 0.625rem 0.875rem;
  border-left: 4px solid var(--border-plain-blue-france, #000091);
  background: var(--background-contrast-blue-france, #e3e3fd);
}
.retour-priorite p { margin: 0; }
.retour-critere {
  height: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-default-grey, #ddd);
  font-size: 0.875rem;
  line-height: 1.4;
}
.retour-critere__tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.retour-critere h4 { margin: 0; font-size: 0.9375rem; }
.retour-critere p { margin: 0 0 0.25rem; font-size: 0.875rem; line-height: 1.4; }
.texte-alerte { color: var(--text-default-error, #ce0500); }

/* Imprévu */
.imprevu-pistes li { margin-bottom: 0.25rem; font-size: 0.875rem; }

/* Marges verticales resserrées dans les étapes */
.etape p { margin-bottom: 0.5rem; }
#questionnaire textarea { min-height: 3rem; }
#questionnaire .fr-label { padding-bottom: 0.125rem; }

/* Dossier de la situation */
.carte--dossier { border-top-color: var(--border-plain-green-menthe, #009081); }
.dossier-texte {
  margin: 0;
  max-height: 9.5rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.4;
}
.carte--dossier { margin-bottom: 0.5rem; }
.dossier-entete { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.dossier-entete .carte__titre { flex: 1; margin: 0; }

/* Versions du prompt */
.versions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Réponse de l'IA rendue (texte formaté) */
.sortie {
  max-height: calc(100vh - 21rem);
  min-height: 8rem;
  overflow: auto;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-default-grey, #ddd);
  border-left: 4px solid var(--border-plain-blue-france, #000091);
  background: var(--background-default-grey, #fff);
  font-size: 0.875rem;
  line-height: 1.5;
}
.sortie p { margin: 0 0 0.5rem; font-size: inherit; line-height: inherit; }
.sortie__titre { font-weight: 700; }
.sortie__liste { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.sortie__liste li { padding-bottom: 0.125rem; font-size: inherit; }
.sortie__tableau { overflow-x: auto; margin-bottom: 0.5rem; }
.sortie__table { border-collapse: collapse; font-size: 0.8125rem; }
.sortie__table th, .sortie__table td { border: 1px solid var(--border-default-grey, #bbb); padding: 0.25rem 0.5rem; vertical-align: top; text-align: left; }
.sortie__table th { background: var(--background-alt-grey, #f6f6f6); }

/* Synthèse du travail */
.synthese {
  max-height: calc(100vh - 17rem);
  overflow: auto;
  padding: 0.5rem 0.875rem;
  border-left: 4px solid var(--border-plain-blue-france, #000091);
  background: var(--background-contrast-blue-france, #e3e3fd);
  font-size: 0.875rem;
  line-height: 1.45;
}
.synthese p, .synthese li { font-size: inherit; line-height: inherit; }
.synthese__liste { margin: 0 0 0.5rem; padding-left: 1.125rem; }
.synthese__piste { margin: 0.25rem 0 0; }

.actions-saisie { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.25rem; }
.actions-saisie .fr-btns-group { margin: 0; }
.fr-alert--info.fr-alert--sm p { font-size: 0.875rem; line-height: 1.4; margin: 0; }
