/* QuadriNuit : une interface sombre, parce qu'on y parle de nuit et de ciel étoilé.
   Le contraste reste au-dessus du seuil AA du RGAA sur tous les textes. */

:root {
  --nuit: #0b1220;
  --nuit-claire: #131c2e;
  --panneau: #18233a;
  --bord: #2a3852;
  --texte: #e8edf6;
  --texte-doux: #9fb0ca;
  --ambre: #f0a04b;
  --ambre-clair: #ffc178;
  --grenat: #c2410c;
  --vert: #4ade80;
  --rouge: #f87171;
}

* { box-sizing: border-box; }

/* L'attribut « hidden » doit l'emporter sur toute mise en page. Sans cette règle, le voile
   d'attente, posé en « display: flex », restait invisible tout en interceptant les clics :
   l'interface paraissait morte. Relevé à l'épreuve au navigateur, le 07/09/2026. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.55 "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--nuit);
  color: var(--texte);
}

/* ------------------------------------------------------------------ bandeau */

.bandeau {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 14px 24px;
  background: linear-gradient(180deg, #0d1526 0%, #0b1220 100%);
  border-bottom: 1px solid var(--bord);
}
.marque { display: flex; align-items: center; gap: 14px; }
.lune {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #fff3dd 0%, var(--ambre) 62%, #b26f24 100%);
  box-shadow: 0 0 22px rgba(240, 160, 75, 0.45);
}
.titre { font-size: 19px; font-weight: 700; letter-spacing: 0.3px; }
.sous-titre { font-size: 12.5px; color: var(--texte-doux); }
.fil { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.niveau-courant { color: var(--ambre-clair); font-weight: 600; }
.lien-retour {
  background: none; border: 1px solid var(--bord); color: var(--texte-doux);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.lien-retour:hover { border-color: var(--ambre); color: var(--ambre-clair); }

/* ------------------------------------------------------------------ accueil */

.ecran-accueil { max-width: 1000px; margin: 0 auto; padding: 48px 24px 64px; }
.ecran-accueil h1 { font-size: 27px; margin: 0 0 14px; }
.chapeau { color: var(--texte-doux); font-size: 15.5px; max-width: 66ch; margin: 0 0 34px; }
.niveaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); gap: 18px; }
.niveau {
  text-align: left; background: var(--panneau); border: 1px solid var(--bord);
  border-radius: 10px; padding: 22px; cursor: pointer; color: inherit;
  font: inherit; transition: border-color .15s, transform .15s;
}
.niveau:hover { border-color: var(--ambre); transform: translateY(-2px); }
.niveau .rang { font-size: 12px; color: var(--ambre); letter-spacing: 1.4px; text-transform: uppercase; }
.niveau h3 { margin: 8px 0 10px; font-size: 17.5px; }
.niveau .resume { color: var(--texte); font-size: 14px; margin: 0 0 10px; }
.niveau .detail { color: var(--texte-doux); font-size: 13px; margin: 0; }
.mention { color: var(--texte-doux); font-size: 12.5px; margin-top: 32px; max-width: 70ch; }

/* ------------------------------------------------------------------ travail */

.ecran-travail { display: grid; grid-template-columns: 400px 1fr; height: calc(100vh - 66px); }
.panneau { overflow-y: auto; padding: 22px; border-right: 1px solid var(--bord); background: var(--nuit-claire); }
.panneau h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.1px;
              color: var(--ambre); margin: 26px 0 12px; }
.panneau h2:first-child { margin-top: 0; }
.carte { height: 100%; background: var(--nuit); }

.etiquette { display: block; font-size: 12.5px; color: var(--texte-doux); margin: 12px 0 5px; }
input[type="search"], input[type="number"], input[type="email"], input[type="text"], select {
  width: 100%; padding: 9px 11px; border-radius: 7px;
  border: 1px solid var(--bord); background: #0e1729; color: var(--texte); font: inherit;
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--ambre); outline-offset: 1px; border-color: var(--ambre);
}
.aide { font-size: 12.5px; color: var(--texte-doux); margin: 7px 0 0; }
.ou { text-align: center; color: var(--texte-doux); font-size: 12px; margin: 10px 0; }

.bouton-principal, .bouton-secondaire {
  width: 100%; padding: 11px 14px; border-radius: 7px; font: inherit;
  font-weight: 600; cursor: pointer; margin-top: 14px; border: 1px solid transparent;
}
.bouton-principal { background: var(--ambre); color: #23150a; }
.bouton-principal:hover:not(:disabled) { background: var(--ambre-clair); }
.bouton-principal:disabled { background: #394863; color: #8496b3; cursor: not-allowed; }
.bouton-secondaire { background: transparent; border-color: var(--bord); color: var(--texte); }
.bouton-secondaire:hover { border-color: var(--ambre); color: var(--ambre-clair); }
.bouton-fichier { display: block; text-align: center; }

.suggestions {
  list-style: none; margin: 4px 0 0; padding: 0; max-height: 230px; overflow-y: auto;
  border: 1px solid var(--bord); border-radius: 7px; background: #0e1729;
}
.suggestions li { padding: 9px 11px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #1c2740; }
.suggestions li:last-child { border-bottom: none; }
.suggestions li:hover { background: #16223a; color: var(--ambre-clair); }
.suggestions .detail { color: var(--texte-doux); font-size: 12px; }
.perimetre-choisi {
  margin-top: 12px; padding: 10px 12px; border-radius: 7px;
  background: rgba(74, 222, 128, .09); border: 1px solid rgba(74, 222, 128, .3);
  font-size: 13.5px;
}

.couches { list-style: none; margin: 0; padding: 0; }
.couches li {
  padding: 11px 12px; border: 1px solid var(--bord); border-radius: 7px;
  margin-bottom: 8px; background: #0e1729; font-size: 13.5px;
}
.couches .nom-couche { font-weight: 600; }
.couches .reglages { color: var(--texte-doux); font-size: 12.5px; margin-top: 4px; }
.couches .reglages-modifiables { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.couches .reglages-modifiables label { font-size: 11.5px; color: var(--texte-doux); }
.couches .reglages-modifiables input, .couches .reglages-modifiables select { padding: 6px 8px; font-size: 13px; }

.correspondance { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; margin-bottom: 9px; }
.correspondance .attendu { font-size: 13.5px; }
.correspondance .attendu small { display: block; color: var(--texte-doux); font-size: 11.5px; }

.anomalies { margin-top: 14px; }
.anomalie {
  padding: 10px 12px; border-radius: 7px; margin-bottom: 8px; font-size: 13px;
  background: rgba(248, 113, 113, .09); border: 1px solid rgba(248, 113, 113, .3);
}
.anomalie.douce { background: rgba(240, 160, 75, .09); border-color: rgba(240, 160, 75, .3); }

.repli { margin-top: 18px; border-top: 1px solid var(--bord); padding-top: 12px; }
.repli summary { cursor: pointer; font-size: 13px; color: var(--texte-doux); }
.repli summary:hover { color: var(--ambre-clair); }

.etat-calcul { margin-top: 12px; font-size: 13px; color: var(--texte-doux); }
.etat-calcul.echec { color: var(--rouge); }

.telechargements { list-style: none; margin: 0; padding: 0; }
.telechargements li { margin-bottom: 8px; }
.telechargements a {
  display: block; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 7px;
  color: var(--texte); text-decoration: none; font-size: 13.5px; background: #0e1729;
}
.telechargements a:hover { border-color: var(--ambre); color: var(--ambre-clair); }

.repartition { list-style: none; margin: 10px 0 0; padding: 0; }
.repartition li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.repartition .pastille { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.repartition .effectif { margin-left: auto; color: var(--texte-doux); }

.avertissement {
  padding: 11px 12px; border-radius: 7px; font-size: 13px; margin-bottom: 10px;
  background: rgba(240, 160, 75, .1); border: 1px solid rgba(240, 160, 75, .35);
}

.tableau-saisie { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.tableau-saisie td { border-bottom: 1px solid var(--bord); padding: 6px 4px; }
.tableau-saisie input, .tableau-saisie select { padding: 5px 7px; font-size: 12.5px; }

/* ------------------------------------------------------------------ attente */

.attente {
  position: fixed; inset: 0; background: rgba(11, 18, 32, .86);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.attente-boite { text-align: center; max-width: 420px; padding: 30px; }
.rotation {
  width: 46px; height: 46px; margin: 0 auto 20px; border-radius: 50%;
  border: 3px solid var(--bord); border-top-color: var(--ambre);
  animation: tourner 1s linear infinite;
}
@keyframes tourner { to { transform: rotate(360deg); } }
.attente-detail { color: var(--texte-doux); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .rotation { animation-duration: 3s; }
  .niveau:hover { transform: none; }
}

@media (max-width: 900px) {
  .ecran-travail { grid-template-columns: 1fr; height: auto; }
  .panneau { border-right: none; border-bottom: 1px solid var(--bord); }
  .carte { height: 60vh; }
}

/* Leaflet, accordé au fond sombre */
.leaflet-container { background: #0e1729; }
.leaflet-control-attribution { background: rgba(11, 18, 32, .82) !important; color: #9fb0ca !important; }
.leaflet-control-attribution a { color: var(--ambre-clair) !important; }

/* Classes posées depuis le code, pour éviter tout style écrit dans un attribut. */
.panne { padding: 40px; color: var(--rouge); }
.titre-releve { color: var(--ambre); font-size: 13px; text-transform: uppercase; letter-spacing: 1.1px; }
.titre-releve.espace { margin-top: 26px; }
table.registre td.nombre { text-align: right; }
