:root {
  --bleu: #1f4e79;
  --bleu-clair: #2f6db0;
  --gris: #6b7280;
  --bord: #e2e6ea;
  --fond: #f5f7fa;
  --ok: #1a7f4b;
  --off: #9aa0a6;
  --rouge: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: #1f2328;
  line-height: 1.5;
}
a { color: var(--bleu-clair); text-decoration: none; }
a:hover { text-decoration: underline; }

/* En-tête */
.barre {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--bleu); color: #fff; padding: 0.7rem 1.5rem;
}
.barre a { color: #fff; }
.marque { font-weight: 700; font-size: 1.2rem; }
.barre nav { display: flex; gap: 1.2rem; }
.barre .droite { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.qui { font-size: 0.85rem; opacity: 0.9; }

.contenu { max-width: 920px; margin: 1.5rem auto; padding: 0 1.5rem; }
.sous-titre { color: var(--gris); }
.entete-page { display: flex; align-items: center; justify-content: space-between; }

/* Cartes & formulaires */
.carte {
  background: #fff; border: 1px solid var(--bord); border-radius: 10px;
  padding: 1.3rem 1.5rem; margin-bottom: 1.2rem;
}
.carte.etroite { max-width: 380px; margin: 4rem auto; }
.carte.centre { text-align: center; }

/* Bouton « Se connecter avec Microsoft » */
.bouton-ms {
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin-top: 1rem; padding: 0.6rem 1.2rem;
  background: #2f2f2f; color: #fff; border-radius: 6px; font-weight: 600;
}
.bouton-ms:hover { background: #1f1f1f; text-decoration: none; }
.logo-ms { display: inline-grid; grid-template-columns: 9px 9px; gap: 2px; }
.logo-ms span { width: 9px; height: 9px; display: block; }
.logo-ms span:nth-child(1) { background: #f25022; }
.logo-ms span:nth-child(2) { background: #7fba00; }
.logo-ms span:nth-child(3) { background: #00a4ef; }
.logo-ms span:nth-child(4) { background: #ffb900; }
.carte.large { max-width: 760px; }
label { display: block; margin: 0.8rem 0; font-weight: 600; font-size: 0.9rem; }
label.case { font-weight: 400; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 0.55rem 0.7rem; margin-top: 0.3rem;
  border: 1px solid var(--bord); border-radius: 7px; font: inherit; font-weight: 400;
}
textarea { resize: vertical; }
.indice { color: var(--gris); font-size: 0.85rem; font-weight: 400; }
.boutons { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }

button.primaire, .primaire {
  background: var(--bleu-clair); color: #fff; border: 0; border-radius: 7px;
  padding: 0.55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
}
.primaire:hover { background: var(--bleu); text-decoration: none; }
button.lien {
  background: none; border: 0; color: var(--bleu-clair); cursor: pointer;
  font: inherit; padding: 0;
}
button.lien.danger, .danger { color: var(--rouge); }
.enligne { display: inline; }

/* Tables */
table.liste { width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--bord); border-radius: 10px; overflow: hidden; }
table.liste th, table.liste td { padding: 0.6rem 0.8rem; text-align: left;
  border-bottom: 1px solid var(--bord); font-size: 0.9rem; }
table.liste th { background: #fafbfc; color: var(--gris); font-weight: 600; }
tr.inactif { opacity: 0.55; }
.actions { display: flex; gap: 0.8rem; align-items: center; }
code { background: #f0f2f5; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.82rem; }

/* Badges */
.badge { font-size: 0.75rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: #eef1f4; color: var(--gris); }
.badge.ok { background: #e3f3ea; color: var(--ok); }
.badge.off { background: #eceef0; color: var(--off); }
.badge.statut.EN_COURS { background: #e7f0fb; color: var(--bleu-clair); }
.badge.statut.EN_ATTENTE_HUMAIN { background: #fdf2dc; color: #9a6b00; }
.badge.statut.TERMINE { background: #e3f3ea; color: var(--ok); }
.badge.statut.ERREUR { background: #fbe7e6; color: var(--rouge); }

/* Tableau de bord */
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.carte.action { display: block; }
.carte.action h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.carte.action p { margin: 0; color: var(--gris); font-size: 0.9rem; }

/* Suivi */
.journal { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.83rem; }
.journal li { padding: 0.25rem 0.4rem; border-bottom: 1px solid #f0f2f5; white-space: pre-wrap; }
.journal li.vide { color: var(--gris); font-style: italic; }
.evt-orchestrateur_debut, .evt-orchestrateur_frictions, .evt-orchestrateur_questions,
.evt-orchestrateur_relance, .evt-orchestrateur_termine { color: var(--bleu); font-weight: 600; }
.evt-erreur { color: var(--rouge); }
.question { margin-bottom: 0.8rem; }
.erreur-bloc pre { color: var(--rouge); white-space: pre-wrap; }

/* Informations du cas */
.carte h3 { font-size: 0.95rem; color: var(--gris); margin: 1rem 0 0.4rem;
  text-transform: uppercase; letter-spacing: 0.03em; }
.pieces { margin: 0.3rem 0; padding-left: 1.2rem; }
.pieces li { margin: 0.15rem 0; }

/* Markdown rendu (note de synthèse, journal interne) */
.markdown { font-size: 0.95rem; color: #1f2328; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1 { font-size: 1.5rem; }
.markdown h2 { font-size: 1.25rem; border-bottom: 1px solid var(--bord); padding-bottom: 0.3rem; }
.markdown h3 { font-size: 1.08rem; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { color: var(--bleu); margin: 1.3rem 0 0.6rem; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown table { margin: 0.6rem 0; }
.markdown ul, .markdown ol { padding-left: 1.5rem; }
.markdown li { margin: 0.2rem 0; }
.markdown blockquote { border-left: 3px solid var(--bleu-clair); margin-left: 0;
  padding: 0.2rem 0 0.2rem 1rem; color: var(--gris); background: #f7f9fc; }
.markdown code { background: #f0f2f5; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.88em; }
.markdown pre { background: #f7f9fc; border: 1px solid var(--bord); border-radius: 8px;
  padding: 0.9rem 1rem; overflow-x: auto; }
.markdown pre code { background: none; padding: 0; }
.markdown table { border-collapse: collapse; width: 100%; }
.markdown th, .markdown td { border: 1px solid var(--bord); padding: 0.4rem 0.6rem; text-align: left; }
.markdown th { background: #fafbfc; }
.markdown hr { border: 0; border-top: 1px solid var(--bord); margin: 1.2rem 0; }

/* Flash */
.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash.erreur { background: #fbe7e6; color: var(--rouge); }
.flash.succes { background: #e3f3ea; color: var(--ok); }
