/* DUERP Forges Pinay — feuille de style unique, sans ressource externe. */
:root {
  --fond: #f5f6f8;
  --carte: #ffffff;
  --texte: #1c2430;
  --discret: #5f6b7a;
  --trait: #e3e6ea;
  --accent: #1f3a5f;
  --accent-clair: #e9eef5;
  --retard: #b42318;
  --retard-clair: #fdecea;
  --succes: #1c6b36;
  --succes-clair: #e3f4e8;
  --prio-1: #f5a04a;
  --prio-2: #f7e07a;
  --prio-3: #9fc3ea;
  --rayon: 10px;
  --largeur-menu: 232px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
small, .discret { color: var(--discret); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Structure : barre latérale fixe + contenu centré ---- */
.menu {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--largeur-menu);
  background: var(--carte); border-right: 1px solid var(--trait);
  display: flex; flex-direction: column; padding: 1.25rem .9rem; overflow-y: auto; z-index: 10;
}
.marque { font-weight: 700; color: var(--accent); font-size: 1.05rem; padding: 0 .6rem 1.2rem; line-height: 1.25; }
.marque small { display: block; font-weight: 400; font-size: .8rem; }
.menu nav { display: flex; flex-direction: column; gap: .15rem; }
.menu nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: .55rem .7rem; border-radius: 8px; color: var(--texte);
}
.menu nav a:hover { background: var(--fond); text-decoration: none; }
.menu nav a.actif { background: var(--accent-clair); color: var(--accent); font-weight: 600; }
.compteur {
  background: var(--accent); color: #fff; border-radius: 999px; font-size: .75rem; min-width: 1.4rem;
  text-align: center; padding: 0 .4rem; line-height: 1.4rem;
}
.menu .compte { margin-top: auto; padding: 1rem .6rem 0; border-top: 1px solid var(--trait); font-size: .9rem; }
.menu .compte .nom { font-weight: 600; }
.menu .compte form { margin-top: .5rem; }
.contenu { margin-left: var(--largeur-menu); padding: 1.75rem 2rem 3rem; }
.contenu > .page { max-width: 1200px; margin: 0 auto; }
body.sans-menu .contenu { margin-left: 0; }

@media (max-width: 1023px) {
  .menu {
    position: static; width: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--trait); padding: .6rem 1rem .4rem; gap: .25rem 1rem;
  }
  .marque { padding: 0; order: 1; flex: 1 1 auto; }
  .marque small { display: none; }
  .menu .compte { order: 2; margin: 0; padding: 0; border: 0; display: flex; align-items: center; gap: .75rem; flex: 0 0 auto; }
  .menu .compte form { margin: 0; }
  .menu nav { order: 3; flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; gap: .1rem .25rem; }
  .menu nav a { white-space: nowrap; padding: .45rem .75rem; }
  .contenu { margin-left: 0; padding: 1.25rem 1rem 2.5rem; }
}

/* ---- En-tête de page ---- */
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.entete h1 { margin: 0; }
.entete .sous-titre { color: var(--discret); margin: .2rem 0 0; }
.actions-entete { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.fil { font-size: .85rem; color: var(--discret); margin-bottom: .4rem; }

/* ---- Cartes ---- */
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.1rem 1.25rem; margin-bottom: 1.1rem; }
.carte > h2:first-child, .carte > .titre-carte:first-child { margin-top: 0; }
.titre-carte { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .7rem; }
.titre-carte h2 { margin: 0; }
.carte.defile { padding: 0; overflow-x: auto; }
.carte.defile .titre-carte { padding: 1rem 1.25rem 0; }
.cartes-chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.1rem; }
@media (max-width: 700px) { .cartes-chiffres { grid-template-columns: repeat(2, 1fr); } }
.chiffre { display: block; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem 1.15rem; color: var(--texte); }
.chiffre:hover { border-color: var(--accent); text-decoration: none; }
.chiffre .valeur { display: block; font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--accent); }
.chiffre .valeur.moyen { font-size: 1.45rem; padding-top: .35rem; }
.chiffre .legende { display: block; color: var(--discret); font-size: .9rem; margin-top: .25rem; }
.chiffre.alerte .valeur { color: var(--retard); }
.chiffres-mini { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.chiffres-mini div { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: .55rem .9rem; min-width: 7.5rem; }
.chiffres-mini strong { display: block; font-size: 1.3rem; color: var(--accent); }
.chiffres-mini .retard strong { color: var(--retard); }
.chiffres-mini span { color: var(--discret); font-size: .85rem; }

/* ---- Messages et bandeaux ---- */
.messages { margin-bottom: 1.1rem; }
.message { padding: .75rem 1rem; border-radius: var(--rayon); border: 1px solid var(--trait); background: var(--accent-clair); margin-bottom: .5rem; }
.message.succes { background: var(--succes-clair); border-color: #bfe3c9; }
.message.erreur { background: var(--retard-clair); border-color: #f3c3be; color: #7a1a12; }
.bandeau {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--accent-clair); border: 1px solid #c9d6e6; border-radius: var(--rayon); padding: .85rem 1.1rem; margin-bottom: 1.1rem;
}
.bandeau p { margin: 0; }
.avertissement { background: #fff8e6; border: 1px solid #f0dca0; border-radius: var(--rayon); padding: .85rem 1.1rem; margin-bottom: 1.1rem; }
.avertissement p:last-child { margin-bottom: 0; }
.vide { color: var(--discret); padding: .4rem 0; margin: 0; }
.carte.defile .vide { padding: 1rem 1.25rem; }

/* ---- Tableaux ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem 1rem; vertical-align: top; }
th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); border-bottom: 1px solid var(--trait); white-space: nowrap; }
td { border-bottom: 1px solid var(--trait); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.nombre, th.nombre { text-align: right; }
td.nowrap { white-space: nowrap; }
table.compact th, table.compact td { padding: .5rem .75rem; }
.ligne-retard td:first-child { box-shadow: inset 3px 0 0 var(--retard); }

/* ---- Pastilles ---- */
.prio, .statut, .etat, .badge {
  display: inline-block; padding: .08rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.prio { color: var(--texte); }
.prio-1 { background: var(--prio-1); }
.prio-2 { background: var(--prio-2); }
.prio-3 { background: var(--prio-3); }
.prio-nc { background: #eceff2; color: var(--discret); font-weight: 500; }
.statut-a_faire { background: #eceff2; color: #4a5563; }
.statut-en_cours { background: #dbe8fb; color: #1d4e89; }
.statut-a_verifier { background: #fdecc8; color: #8a5a00; }
.statut-validee { background: #d8f0de; color: var(--succes); }
.statut-annulee { background: #f3f4f6; color: #8a94a0; text-decoration: line-through; }
.etat { background: #eceff2; color: #4a5563; }
.etat-en_place, .etat-validee, .etat-actif, .etat-traitee, .etat-conforme { background: #d8f0de; color: var(--succes); }
.etat-a_prevoir, .etat-en_attente, .etat-propose, .etat-ouverte, .etat-non_verifie { background: #fdecc8; color: #8a5a00; }
.etat-rejetee, .etat-non_conforme { background: var(--retard-clair); color: var(--retard); }
.etat-archive, .etat-archivee, .etat-retiree, .etat-classee { background: #f3f4f6; color: #8a94a0; }
.badge-retard { background: var(--retard-clair); color: var(--retard); border: 1px solid #f3c3be; }
.badge-neutre { background: var(--accent-clair); color: var(--accent); }

/* ---- Formulaires ---- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
label .facultatif { font-weight: 400; color: var(--discret); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--texte); background: #fff; border: 1px solid #cdd3da; border-radius: 8px; padding: .5rem .65rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.champ { margin-bottom: .9rem; }
.aide { color: var(--discret); font-size: .85rem; margin-top: .2rem; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem 1rem; }
.grille .champ { margin-bottom: 0; }
.grille.deux { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.formulaire { max-width: 720px; }
.formulaire.large { max-width: 960px; }
.filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; align-items: end; }
.filtres .champ { margin: 0; }
.filtres .boutons { display: flex; gap: .5rem; align-items: center; }
.choix { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .35rem 0 .2rem; }
.choix label { font-weight: 400; display: inline-flex; align-items: center; gap: .45rem; margin: 0; font-size: 1rem; }
.choix input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--trait); border-radius: var(--rayon); margin: 0 0 .9rem; padding: .75rem 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }
.ligne-situation { border-top: 1px solid var(--trait); padding: .9rem 0 .2rem; }
.ligne-situation:first-of-type { border-top: 0; }

/* ---- Boutons ---- */
.bouton {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: .5rem 1rem;
  border: 1px solid #cdd3da; background: #fff; color: var(--texte); text-align: center; line-height: 1.4;
}
.bouton:hover { background: var(--fond); text-decoration: none; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { background: #17304f; }
.bouton.danger { color: var(--retard); border-color: #e6b1ab; }
.bouton.danger:hover { background: var(--retard-clair); }
.bouton.petit { padding: .25rem .65rem; font-size: .85rem; }
.lien-bouton { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.lien-bouton:hover { text-decoration: underline; }
.rangee { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
form.en-ligne { display: inline; }

/* ---- Éléments dépliables ---- */
details { margin: .5rem 0; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: .2rem 0; }
details > summary + * { margin-top: .6rem; }
details.carte-pliable { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: .8rem 1.25rem; margin-bottom: 1.1rem; }
details.carte-pliable > summary { font-size: 1.05rem; color: var(--texte); }

/* ---- Fiches ---- */
.proprietes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1.5rem; margin: 0; }
.proprietes dt { color: var(--discret); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.proprietes dd { margin: .1rem 0 0; }
.situation { border-top: 1px solid var(--trait); padding: 1rem 0 .4rem; }
.situation:first-of-type { border-top: 0; padding-top: .2rem; }
.situation h3 { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.cotation { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; margin: .3rem 0 .5rem; }
.cotation .element span { display: block; color: var(--discret); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.zone-validation { border: 1px solid #c9d6e6; background: var(--accent-clair); border-radius: var(--rayon); padding: 1rem 1.25rem; margin-bottom: 1.1rem; }
.zone-validation h2 { margin-top: 0; }
.question { font-weight: 600; margin-bottom: .2rem; }
.commentaire { border-top: 1px solid var(--trait); padding: .6rem 0; }
.commentaire:first-child { border-top: 0; }
.commentaire .meta { color: var(--discret); font-size: .85rem; }
.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { padding: .55rem 0; border-top: 1px solid var(--trait); }
.liste-simple li:first-child { border-top: 0; }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; padding: 1rem; }
.onglets { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1.1rem; border-bottom: 1px solid var(--trait); }
.onglets a { padding: .5rem .9rem; color: var(--discret); border-bottom: 2px solid transparent; }
.onglets a.actif { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.onglets a:hover { text-decoration: none; color: var(--texte); }
.checklist-point { border-top: 1px solid var(--trait); padding: .9rem 0; }
.checklist-point:first-of-type { border-top: 0; }
.checklist-point .libelle { font-weight: 600; }
.sha { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; color: var(--discret); }
pre.json { background: var(--fond); border-radius: 8px; padding: .6rem .8rem; overflow-x: auto; font-size: .8rem; white-space: pre-wrap; word-break: break-word; }

/* ---- Connexion ---- */
.connexion { max-width: 400px; margin: 8vh auto 0; }
.connexion h1 { text-align: center; color: var(--accent); }
.connexion .bouton { width: 100%; }
.erreur-page { text-align: center; margin: 12vh auto 0; max-width: 520px; }
.erreur-page .code { font-size: 3.5rem; font-weight: 700; color: var(--accent); line-height: 1; }

@media print { .menu { display: none; } .contenu { margin: 0; } }
.sous-titre-espace { margin-top: 1.3rem; }

/* ---- Situations compactes ---- */
.situation-ligne { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem 2rem; flex-wrap: wrap; }
.situation-titre { flex: 1 1 280px; min-width: 0; }
.situation-cotation { flex: 0 1 auto; }
.cot { display: flex; gap: .4rem 1.1rem; flex-wrap: wrap; align-items: center; }
.cot b { font-weight: 700; }
.situation-outils { display: flex; gap: .25rem 1.75rem; flex-wrap: wrap; align-items: flex-start; margin-top: .25rem; }
.situation-outils details { margin: .15rem 0; }
.situation-outils details[open] { flex: 1 0 100%; }
.carte.defile > table { min-width: 640px; }
