/* AFOI Signature — couleurs du site afoi.re (rouge #c4262f, anthracite #3d3d41). */
:root {
  --rouge: #c4262f;
  --rouge-fonce: #9f1d25;
  --sombre: #3d3d41;
  --texte: #1f2937;
  --gris: #6b7280;
  --bord: #e5e7eb;
  --fond: #f5f5f6;
  --carte: #ffffff;
  --vert: #15803d;
  --vert-clair: #dcfce7;
  --bleu: #1d4ed8;
  --bleu-clair: #dbeafe;
  --orange: #b45309;
  --orange-clair: #fef3c7;
  --rouge-clair: #fee2e2;
  --gris-clair: #f3f4f6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; color: var(--texte); background: var(--fond); line-height: 1.45; }
a { color: var(--rouge); }
h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--sombre); }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--sombre); }
h3 { font-size: 1rem; margin: 0 0 8px; }
.muted { color: var(--gris); }
.petit { font-size: 0.85rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; word-break: break-all; }
.nowrap { white-space: nowrap; }

/* En-tête */
.entete { background: var(--carte); border-bottom: 3px solid var(--rouge); }
.entete .barre { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.entete img { height: 38px; display: block; }
.entete nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.entete nav a { text-decoration: none; color: var(--sombre); padding: 6px 12px; border-radius: 6px; font-weight: 500; }
.entete nav a.actif, .entete nav a:hover { background: var(--gris-clair); color: var(--rouge); }
.entete .compte { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--gris); }
.entete .compte form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.titre-page { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.grille { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .grille { grid-template-columns: minmax(0, 1fr); } }

/* Boutons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bord); background: var(--carte); color: var(--sombre); padding: 8px 14px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--gris); }
.btn-principal { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn-principal:hover { background: var(--rouge-fonce); border-color: var(--rouge-fonce); }
.btn-danger { color: var(--rouge); border-color: #f3c3c6; }
.btn-petit { padding: 4px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.en-ligne { display: inline; margin: 0; }

/* Formulaires */
label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 0.92rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f3c3c6; border-color: var(--rouge); }
textarea { min-height: 90px; resize: vertical; }
.champ { margin-bottom: 14px; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.case { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; margin-bottom: 10px; }
.case input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--rouge); }
.aide { font-size: 0.85rem; color: var(--gris); margin-top: 4px; }
fieldset { border: 1px solid var(--bord); border-radius: 8px; padding: 14px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; color: var(--sombre); }
.ligne-dest { display: grid; grid-template-columns: 1fr 1fr 1.5fr auto; gap: 8px; margin-bottom: 8px; }
@media (max-width: 640px) { .ligne-dest { grid-template-columns: 1fr 1fr; } }

/* Messages */
.alerte { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alerte-ok { background: var(--vert-clair); border-color: #bbf7d0; color: #14532d; }
.alerte-erreur { background: var(--rouge-clair); border-color: #fecaca; color: #7f1d1d; }
.alerte-info { background: var(--bleu-clair); border-color: #bfdbfe; color: #1e3a8a; }

/* Tableaux */
.tableau-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gris); font-weight: 600; }
tr:hover td { background: #fafafa; }
td a { text-decoration: none; font-weight: 500; }

/* Pastilles de statut */
.pastille { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pastille.gris { background: var(--gris-clair); color: var(--gris); }
.pastille.bleu { background: var(--bleu-clair); color: var(--bleu); }
.pastille.vert { background: var(--vert-clair); color: var(--vert); }
.pastille.rouge { background: var(--rouge-clair); color: var(--rouge-fonce); }
.pastille.orange { background: var(--orange-clair); color: var(--orange); }

.filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtres a { text-decoration: none; }

/* Historique */
.historique { list-style: none; margin: 0; padding: 0; }
.historique li { padding: 8px 0; border-bottom: 1px solid var(--bord); font-size: 0.9rem; }
.historique li:last-child { border-bottom: 0; }
.historique .quand { color: var(--gris); font-size: 0.8rem; }

dl.infos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
dl.infos dt { color: var(--gris); font-size: 0.88rem; }
dl.infos dd { margin: 0; }

/* Aperçu et zone */
.apercu { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--bord); background: #fff; touch-action: none; }
.apercu canvas { display: block; max-width: 100%; height: auto; }
.apercu .zone { position: absolute; border: 2px dashed var(--rouge); background: rgba(196, 38, 47, 0.12); pointer-events: none; }
.apercu .zone span { position: absolute; top: -20px; left: 0; background: var(--rouge); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
.pages-nav { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

/* Connexion */
.boite-connexion { max-width: 400px; margin: 60px auto; }
.boite-connexion img { height: 48px; display: block; margin: 0 auto 20px; }

/* Page publique */
.public .entete .barre { justify-content: space-between; }
.public main { max-width: 860px; }
.doc-public { border: 1px solid var(--bord); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fff; display: flex; gap: 12px; align-items: flex-start; }
.doc-public.signe { border-color: #bbf7d0; background: #f7fef9; }
.doc-public.refuse, .doc-public.clos { background: #fafafa; }
.doc-public .corps { flex: 1; min-width: 0; }
.doc-public .titre { font-weight: 600; }
.etapes { counter-reset: etape; }
.etape { position: relative; padding-left: 40px; margin-bottom: 22px; }
.etape::before { counter-increment: etape; content: counter(etape); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--rouge); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 0.9rem; }
.code-saisie { font-size: 1.4rem; letter-spacing: 0.4em; text-align: center; max-width: 220px; font-family: ui-monospace, Consolas, monospace; }
.canaux { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.canaux label { display: flex; gap: 6px; align-items: center; font-weight: normal; }
.cache { display: none !important; }
.pied { text-align: center; color: var(--gris); font-size: 0.8rem; padding: 20px 16px 40px; }
details summary { cursor: pointer; color: var(--gris); }
