/* Contenus Mapclim : relecture collaborative */
:root {
  --blanc: #fff;
  --gris-fond: #f3f3f1;
  --gris-filet: #8a8a85;
  --gris-texte: #5c5c58;
  --noir: #1d1d1b;
  --cyan-texte: #006e9e;
  --magenta-texte: #c4006b;
  --vert-texte: #2e7d32;
  --cyan-fond: #e5f3f9;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 32px;
  --space-4: 64px;
  --sommaire: 400px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--blanc); color: var(--noir); font: 400 16px/24px Montserrat, "Helvetica Neue", Helvetica, sans-serif; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan-texte); outline-offset: 2px; }

.cadre { display: grid; grid-template-columns: var(--sommaire) minmax(0, 1fr); min-height: 100vh; }

/* Sommaire */
.sommaire { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--gris-fond); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-3); display: flex; flex-direction: column; }
.tete { margin-bottom: var(--space-3); }
.nom-projet { margin: 0; font-weight: 700; font-size: 18px; line-height: 24px; }
.sous-titre { margin: 0; color: var(--gris-texte); }
.ouvrir { display: none; }
#navigation ul { list-style: none; margin: 0; padding: 0; }
#navigation a { display: block; text-decoration: none; }
#navigation a:hover { text-decoration: underline; text-underline-offset: 3px; }
.rubrique + .rubrique { margin-top: var(--space-3); }
.rubrique > span, .rubrique > a { display: block; padding: 4px var(--space-1); font-size: 18px; line-height: 24px; font-weight: 700; }
.rubrique > ul { margin-top: 4px; }
.rubrique > ul > li > a { padding: 4px var(--space-1); font-size: 16px; line-height: 22px; }
.famille { margin: var(--space-2) 0 0; padding: 4px var(--space-1); font-size: 16px; line-height: 22px; font-weight: 600; }
.famille + ul a { padding: 3px var(--space-1) 3px var(--space-3); font-size: 14px; line-height: 20px; }
#navigation a[aria-current="page"] { background: var(--blanc); color: var(--cyan-texte); font-weight: 600; }
.rubrique > a[aria-current="page"] { font-weight: 700; }
.date { margin: auto 0 0; padding-top: var(--space-3); font-size: 13px; line-height: 18px; color: var(--gris-texte); }

/* Contenu */
.contenu { padding: var(--space-4); outline: none; }
.contenu > * { max-width: 760px; }
.fil { margin: 0 0 var(--space-1); font-size: 13px; line-height: 18px; color: var(--gris-texte); }
h1 { margin: 0 0 var(--space-2); font-size: 40px; line-height: 44px; font-weight: 700; }
.accroche { margin: 0 0 var(--space-2); font-size: 20px; line-height: 26px; font-weight: 600; }
.intro { margin: 0; font-size: 18px; line-height: 28px; }
.rub { margin-top: var(--space-4); }
.trame { margin: 0 0 4px; font-size: 13px; line-height: 18px; color: var(--gris-texte); }
h2 { margin: 0 0 var(--space-2); font-size: 28px; line-height: 34px; font-weight: 700; }
h3 { margin: var(--space-3) 0 var(--space-1); font-size: 20px; line-height: 26px; font-weight: 600; }
h2 + .bloc > h3:first-child { margin-top: 0; }
h4 { margin: var(--space-2) 0 var(--space-1); font-size: 16px; font-weight: 700; }
p { margin: 0 0 var(--space-2); }
ul, ol { margin: 0 0 var(--space-2); padding-left: 22px; }
li { margin: 4px 0; }
.contenu table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-2); }
.contenu th { text-align: left; font-weight: 700; padding: var(--space-1) var(--space-2) var(--space-1) 0; border-bottom: 1px solid var(--noir); }
.contenu td { vertical-align: top; padding: var(--space-2) var(--space-2) var(--space-1) 0; border-bottom: 1px solid var(--gris-filet); }
.contenu td ul { padding-left: 18px; margin: 0; }

/* Repères de lecture */
.note { margin: var(--space-2) 0; padding-left: var(--space-2); }
.note > b { display: block; font-weight: 600; }
.note > b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: var(--space-1); vertical-align: 1px; background: currentColor; }
.note p:last-child, .note ul:last-child { margin-bottom: 0; }
.fournir > b { color: var(--magenta-texte); }
.confirmer > b { color: var(--cyan-texte); }
.emplacement { color: var(--gris-texte); }
.remarque > b { color: var(--noir); }
.emplacement > b::before { background: var(--gris-filet); }
.avertissement { margin-top: var(--space-3); }
.boutons { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: var(--space-2) 0; }
.bouton { padding: var(--space-1) var(--space-2); border-radius: 4px; background: var(--noir); color: var(--blanc); font-weight: 600; }
.choix .choisi { color: var(--cyan-texte); font-weight: 600; }
.choix .choisi span { color: var(--gris-texte); font-weight: 400; }
.points { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--noir); }
.points .note { margin-top: 0; }
.points ul { margin-top: var(--space-1); }

/* Structure du site */
.menu-site { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--noir); border-bottom: 1px solid var(--noir); font-weight: 600; }
.menu-site span:last-child { margin-left: auto; }
.familles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin: var(--space-3) 0; }
.familles h3 { margin: 0 0 var(--space-1); font-size: 16px; line-height: 22px; font-weight: 700; }
.familles ul { padding-left: 18px; margin: 0; }
.legende { list-style: none; padding: 0; }
.legende li { margin: 0 0 var(--space-2); }
.legende .note { margin: 0; }

/* Page suivante */
.suite { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-2); border-top: 1px solid var(--gris-filet); }
.suite a { text-decoration: none; max-width: 48%; }
.suite a span { display: block; font-size: 13px; line-height: 18px; color: var(--gris-texte); }
.suite a b { font-weight: 600; }
.suite a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.suite .apres { margin-left: auto; text-align: right; }

/* Relecture : actions, validations et panneaux */
.sous-titre a { color: var(--gris-texte); }
.marque { margin-left: 6px; font-weight: 700; font-size: 13px; }
.marque.m1 { color: var(--cyan-texte); }
.marque.m2 { color: var(--vert-texte); }
.unite { position: relative; }
.entete { margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-2); margin-top: var(--space-2); padding-top: var(--space-1); border-top: 1px solid #e2e2de; font-size: 14px; line-height: 20px; }
.lien { padding: 4px 0; border: 0; background: none; color: var(--cyan-texte); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.lien:hover { text-decoration-color: currentColor; }
.lien.danger { color: var(--magenta-texte); }
.outils, .val-groupe { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); }
.val-groupe { margin-left: auto; justify-content: flex-end; text-align: right; }
.validation { color: var(--gris-texte); }
.validation.v1 { color: var(--cyan-texte); font-weight: 600; }
.validation.v2 { color: var(--vert-texte); font-weight: 600; }
.attente { color: var(--gris-texte); font-style: italic; }
.valider, .principal, .secondaire { padding: 6px var(--space-2); border-radius: 4px; font-weight: 600; font-size: 14px; line-height: 20px; cursor: pointer; }
.valider, .principal { border: 1px solid var(--noir); background: var(--noir); color: var(--blanc); }
.valider:hover, .principal:hover { background: #3a3a37; }
.secondaire { border: 1px solid var(--noir); background: var(--blanc); }
.secondaire:hover { background: var(--gris-fond); }
button:disabled { opacity: .5; cursor: wait; }
.valid-page { margin-top: var(--space-3); padding: var(--space-2); background: var(--gris-fond); }
.valid-page h2 { font-size: 18px; line-height: 24px; margin-bottom: 4px; }
.valid-page p { margin-bottom: 0; }
.valid-page .actions { border-top-color: #d6d6d1; }
.points .actions { margin-top: var(--space-2); }

.panneau { margin-top: var(--space-2); padding: var(--space-2) var(--space-3) var(--space-3); border-left: 3px solid var(--cyan-texte); background: var(--blanc); box-shadow: 0 0 0 1px #e2e2de inset; }
.panneau h3 { margin-top: var(--space-1); }
.en-modification > .panneau { border-left-color: var(--noir); }
.aide { color: var(--gris-texte); font-size: 14px; }
.message { color: var(--magenta-texte); font-weight: 600; }
.boutons-ligne { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; margin-top: var(--space-2); }

/* Formulaires */
.champ { display: block; margin: 0 0 var(--space-2); }
.champ > span { display: block; font-weight: 600; font-size: 14px; line-height: 20px; margin-bottom: 4px; }
.champ small { display: block; margin-top: 4px; color: var(--gris-texte); font-size: 13px; line-height: 18px; }
input:not([type]), input[type=password], input[type=file], select, textarea, .ed-liste input { width: 100%; padding: 8px 10px; border: 1px solid var(--gris-filet); border-radius: 4px; background: var(--blanc); font: inherit; font-size: 15px; line-height: 22px; color: var(--noir); }
textarea { resize: vertical; min-height: 64px; overflow: hidden; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan-texte); outline-offset: 0; border-color: var(--cyan-texte); }
.case { display: flex; gap: var(--space-1); align-items: flex-start; margin: var(--space-1) 0 0; font-size: 14px; line-height: 20px; cursor: pointer; }
.case input { margin-top: 3px; }
fieldset { margin: 0 0 var(--space-2); padding: var(--space-2); border: 1px solid #d6d6d1; border-radius: 4px; min-width: 0; }
legend { padding: 0 6px; font-size: 13px; color: var(--gris-texte); }
.ed-outils { display: flex; flex-wrap: wrap; gap: 0 var(--space-2); justify-content: flex-end; margin: -8px 0 var(--space-1); }
.ed-sous-bloc { background: var(--gris-fond); }
.ed-sous-bloc > .lien { float: right; margin-top: -8px; }
.ed-liste ul { list-style: none; padding: 0; margin: 0 0 4px; }
.ed-liste li { display: flex; gap: var(--space-1); margin: 0 0 6px; }
.retirer { flex: none; width: 38px; border: 1px solid var(--gris-filet); border-radius: 4px; background: var(--blanc); font-size: 20px; line-height: 1; cursor: pointer; color: var(--gris-texte); }
.retirer:hover { color: var(--magenta-texte); border-color: var(--magenta-texte); }
.garde { font-size: 13px; color: var(--gris-texte); margin: 0; }
.aide-normes { margin: 0 0 var(--space-2); padding: var(--space-2); background: var(--cyan-fond); border-radius: 4px; font-size: 14px; line-height: 20px; }
.aide-normes p { margin-bottom: var(--space-1); }
.aide-normes b { display: block; }
.aide-normes div { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { padding: 4px 10px; border: 1px solid var(--gris-filet); border-radius: 4px; background: var(--blanc); font-size: 13px; line-height: 18px; cursor: pointer; }
.puce:hover { border-color: var(--noir); }
.puce.citee { border-color: var(--cyan-texte); color: var(--cyan-texte); font-weight: 600; }
.puce.ajoutee { background: var(--noir); border-color: var(--noir); color: var(--blanc); }

/* Commentaires, pièces jointes, historique */
.commentaires ul, .fichiers ul, .historique ol { list-style: none; padding: 0; margin: 0 0 var(--space-2); }
.commentaires li, .fichiers li, .historique li { padding: var(--space-1) 0; border-bottom: 1px solid #e2e2de; margin: 0; }
.auteur { margin: 0; font-size: 13px; line-height: 18px; color: var(--gris-texte); }
.texte { white-space: pre-line; margin: 4px 0 0; }
.fichiers li { display: flex; gap: var(--space-2); align-items: center; }
.fichiers img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 4px; background: var(--gris-fond); }
.fichiers li > div { min-width: 0; overflow-wrap: anywhere; }
.historique li p { margin: 0; }
.historique .boutons-ligne { margin-top: 4px; }
.ecart { margin-top: var(--space-1); padding: var(--space-2); background: var(--gris-fond); white-space: pre-line; font-size: 14px; line-height: 21px; }
del { background: #fbe0ee; color: #8a004b; }
ins { background: #dcefdd; color: #1b5e20; text-decoration: none; }
progress { width: 100%; height: 8px; margin-top: var(--space-1); }

/* Suivi */
.suivi .nb { white-space: nowrap; }
.suivi .nb span { color: var(--vert-texte); }
.suivi td.v1 { color: var(--cyan-texte); font-weight: 600; }
.suivi td.v2 { color: var(--vert-texte); font-weight: 600; }
.legende-tableau { font-size: 14px; color: var(--gris-texte); }
.fil-actu { list-style: none; padding: 0; }
.fil-actu li { margin: 0; padding: 6px 0; border-bottom: 1px solid #e2e2de; }
.fil-actu .quand { display: inline-block; min-width: 130px; color: var(--gris-texte); font-size: 13px; }
.fil-actu a { text-decoration: none; }
.fil-actu a:hover { text-decoration: underline; }

/* Messages et connexion */
.avis { position: fixed; z-index: 10; left: 50%; bottom: var(--space-3); transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 10px var(--space-2); border-radius: 4px; background: var(--noir); color: var(--blanc); font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.avis.visible { opacity: 1; transform: translate(-50%, 0); }
.avis.erreur { background: var(--magenta-texte); }
.connexion { max-width: 420px; margin: 12vh auto; padding: 0 var(--space-2); }
.connexion h1 { margin-top: var(--space-1); }
.connexion .intro { margin-bottom: var(--space-3); }
.connexion label { display: block; margin: var(--space-2) 0 4px; font-weight: 600; font-size: 14px; }
.connexion .principal { margin-top: var(--space-3); width: 100%; padding: 10px; font-size: 16px; }
.connexion .message { margin: var(--space-2) 0 0; }

/* Grand écran : le texte reste lisible, le blanc grandit */
@media (min-width: 1800px) {
  :root { --sommaire: 440px; }
  .contenu { padding-left: 120px; }
}

/* Tablette et mobile : le sommaire passe au-dessus du contenu, replié */
@media (max-width: 1023px) {
  .cadre { display: block; }
  .sommaire { position: static; height: auto; padding: var(--space-2); }
  .tete { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 var(--space-2); margin: 0; }
  .nom-projet { font-size: 16px; line-height: 22px; }
  .sous-titre { font-size: 13px; line-height: 18px; }
  .ouvrir { display: block; grid-column: 2; grid-row: 1 / span 2; padding: var(--space-1) var(--space-2); border: 1px solid var(--noir); border-radius: 4px; background: var(--blanc); font-weight: 600; cursor: pointer; }
  nav { display: none; margin-top: var(--space-2); }
  .sommaire.ouvert nav { display: block; }
  .date { display: none; }
  .sommaire.ouvert .date { display: block; padding-top: var(--space-2); }
  .contenu { padding: var(--space-3) var(--space-2) var(--space-4); }
  h1 { font-size: 30px; line-height: 36px; }
  h2 { font-size: 24px; line-height: 30px; }
  .rub { margin-top: var(--space-3); }
  .panneau { padding: var(--space-2); }
}
@media (max-width: 600px) {
  .contenu table, .contenu tbody, .contenu tr, .contenu td { display: block; }
  .contenu thead { display: none; }
  .contenu tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--gris-filet); }
  .contenu td { border: 0; padding: 0 0 var(--space-1); }
  .contenu td[data-titre]::before { content: attr(data-titre); display: block; font-size: 13px; line-height: 18px; color: var(--gris-texte); }
  .menu-site span:last-child { margin-left: 0; }
  .suite { flex-direction: column; }
  .suite a { max-width: none; }
  .val-groupe { margin-left: 0; justify-content: flex-start; text-align: left; }
  .fil-actu .quand { display: block; }
  .suivi td.nb br { display: none; }
  .suivi td.nb span::before { content: " · "; color: var(--gris-texte); }
}
