:root { --encre: #faf2e6; --papier: #171b25; --fond: #10131a; --ocre: #eda809; --gris: #a8a294; --filet: rgba(250, 242, 230, .14); --serif: Georgia, "Times New Roman", serif; --sans: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--fond); color: var(--encre); font-family: var(--sans); font-size: 15px; line-height: 1.5; overflow: hidden; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ocre); outline-offset: 2px; }

header { position: absolute; z-index: 1000; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; gap: 18px; padding: 0 20px; background: var(--fond); border-bottom: 1px solid var(--filet); }
header .marque { display: flex; align-items: center; gap: 16px; text-decoration: none; }
header img { height: 42px; display: block; }
header .titre { font-family: var(--serif); font-size: 19px; white-space: nowrap; }
header .liens { display: flex; gap: 16px; font-size: 13px; color: var(--gris); white-space: nowrap; }
header .liens a { text-decoration: none; }
header .liens a:hover { color: var(--ocre); }

.recherche { position: relative; flex: 1; max-width: 540px; margin-left: auto; }
.recherche input { width: 100%; font: inherit; font-size: 15px; color: var(--encre); background: var(--papier); border: 1px solid var(--filet); border-radius: 999px; padding: 9px 18px 9px 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a294' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 15px center; background-size: 17px; }
.recherche input::placeholder { color: var(--gris); }
.recherche input:focus { outline: none; border-color: var(--ocre); }
#resultats { position: absolute; top: calc(100% + 8px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--papier); border: 1px solid var(--filet); border-radius: 16px; box-shadow: 0 18px 44px rgba(0, 0, 0, .5); max-height: 70vh; overflow-y: auto; }
#resultats li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; cursor: pointer; }
#resultats li[aria-selected="true"], #resultats li:hover { background: rgba(250, 242, 230, .08); }
#resultats .texte { min-width: 0; }
#resultats .texte b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#resultats .texte small { color: var(--gris); font-size: 12.5px; }
#resultats .rien { color: var(--gris); cursor: default; }
.signe { flex: none; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #10131a; box-shadow: 0 0 0 1px rgba(250, 242, 230, .35); }

#carte { position: absolute; inset: 60px 0 0 0; }
.leaflet-container { background: var(--fond); font-family: var(--sans); }
/* Fond Plan IGN ramené aux teintes de la charte : noir bleuté, traits ivoire. */
.fond { filter: invert(1) grayscale(1) sepia(.35) hue-rotate(185deg) saturate(1.6) brightness(.66) contrast(1.12); }
.leaflet-control-zoom a { background: var(--papier) !important; color: var(--encre) !important; border-color: var(--filet) !important; }
.leaflet-bar { border: 1px solid var(--filet) !important; border-radius: 12px !important; overflow: hidden; box-shadow: none !important; }
.leaflet-control-attribution { background: rgba(16, 19, 26, .85) !important; color: var(--gris) !important; font-size: 11px; border-radius: 8px 0 0 0; }
.leaflet-control-attribution a { color: var(--encre) !important; }
.leaflet-tooltip { background: #faf2e6; color: #10131a; border: 0; border-radius: 8px; font-size: 13px; padding: 4px 9px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.leaflet-tooltip::before { display: none; }
.bulle { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(237, 168, 9, .16); border: 1.5px solid var(--ocre); color: var(--encre); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.bulle:hover { background: rgba(237, 168, 9, .34); }

.legende { position: absolute; z-index: 900; top: 76px; left: 16px; width: 262px; max-height: calc(100% - 150px); overflow-y: auto; background: var(--papier); border: 1px solid var(--filet); border-radius: 16px; padding: 16px 16px 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.legende h2 { font-family: var(--serif); font-weight: normal; font-size: 18px; margin: 0; }
.legende p { margin: 2px 0 10px; color: var(--gris); font-size: 12.5px; }
.legende label { display: flex; align-items: center; gap: 9px; padding: 5px 0; border-top: 1px solid var(--filet); font-size: 14px; cursor: pointer; }
.legende input { accent-color: var(--ocre); margin: 0; }
.legende .n { margin-left: auto; color: var(--gris); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.territoires { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; padding-top: 12px; border-top: 1px solid var(--filet); }
.territoires button { background: none; border: 1px solid var(--filet); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; }
.territoires button:hover { border-color: var(--ocre); color: var(--ocre); }
.replier { display: none; }

.voile { position: absolute; z-index: 1100; inset: 0; background: rgba(6, 8, 12, .66); display: none; overflow-y: auto; padding: 34px 16px; }
.voile.ouvert { display: block; }
.fiche { position: relative; max-width: 1240px; margin: 0 auto; background: var(--papier); border: 1px solid var(--filet); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.fiche .fermer { position: absolute; z-index: 2; top: 16px; right: 18px; background: none; border: 1px solid var(--filet); border-radius: 999px; padding: 4px 14px; cursor: pointer; font-size: 13px; }
.fiche .fermer:hover { background: var(--encre); color: #10131a; }
.entete { padding: 32px 38px 24px; background: var(--fond); border-bottom: 1px solid var(--filet); position: relative; }
.entete::after { content: ""; position: absolute; left: 38px; bottom: -2px; width: 56px; height: 3px; border-radius: 3px; background: var(--ocre); }
.entete .genre { font-size: 13px; color: var(--ocre); margin: 0 90px 6px 0; }
.entete h1 { font-family: var(--serif); font-weight: normal; font-size: 32px; line-height: 1.15; margin: 0 0 8px; }
.entete .resume { margin: 0; font-size: 15.5px; max-width: 64ch; }
.corps { padding: 10px 38px 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; align-items: start; }
.corps .col + .col { border-left: 1px solid var(--filet); padding-left: 48px; margin-left: -1px; }
.corps.seule { grid-template-columns: 1fr; max-width: 760px; }
section { padding: 18px 0 6px; }
h2 { font-family: var(--serif); font-weight: normal; font-size: 21px; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--filet); }
h2 + .chapeau { margin: 0 0 14px; color: var(--gris); font-size: 13.5px; max-width: 68ch; }
dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; }
dt { color: var(--gris); }
dd { margin: 0; }
.chiffres { font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--gris); padding: 4px 10px 4px 0; border-bottom: 1px solid rgba(250, 242, 230, .4); }
td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--filet); vertical-align: top; }
td.periode, th.periode { white-space: nowrap; width: 112px; padding-right: 0; }
td .prise { color: var(--gris); font-size: 13px; }
td.nb, th.nb { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-right: 0; padding-left: 12px; }
.depasse { color: #e9a07a; }
ul.simple { margin: 0; padding: 0; list-style: none; }
ul.simple li { padding: 6px 0; border-bottom: 1px solid var(--filet); }
ul.simple small { color: var(--gris); }
ul.simple button { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--ocre); text-underline-offset: 3px; text-align: left; }
.manque { border-left: 3px solid var(--ocre); border-radius: 0 10px 10px 0; background: rgba(250, 242, 230, .04); padding: 10px 14px; color: var(--gris); font-size: 14px; max-width: 68ch; }
.pied { padding: 16px 38px 22px; background: var(--fond); border-top: 1px solid var(--filet); font-size: 12.5px; color: var(--gris); }

details.groupe { border-bottom: 1px solid var(--filet); }
details.groupe summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; padding: 11px 2px; font-family: var(--serif); font-size: 16.5px; border-radius: 8px; }
details.groupe summary::-webkit-details-marker { display: none; }
details.groupe summary::before { content: "+"; flex: none; width: 22px; height: 22px; border: 1px solid var(--filet); border-radius: 50%; font-family: var(--sans); font-size: 15px; line-height: 20px; text-align: center; color: var(--ocre); align-self: center; }
details.groupe[open] summary::before { content: "−"; }
details.groupe summary:hover { color: var(--ocre); }
details.groupe summary small { font-family: var(--sans); font-size: 12.5px; color: var(--gris); margin-left: auto; white-space: nowrap; }
details.groupe table { margin: 0 0 14px 32px; width: calc(100% - 32px); }
.replis { margin: 2px 0 8px; font-size: 13px; }
.replis button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--gris); text-decoration: underline; text-underline-offset: 3px; }
.replis button:hover { color: var(--ocre); }

.verdict { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; }
.verdict .sceau { flex: none; border: 1px solid var(--ocre); color: var(--ocre); border-radius: 999px; padding: 5px 16px; font-family: var(--serif); font-size: 17px; }
.verdict small { color: var(--gris); font-size: 13px; }
.note { padding: 13px 0 14px; border-bottom: 1px solid var(--filet); }
.note .haut { display: flex; align-items: baseline; gap: 14px; }
.note .quoi { flex: 1; font-size: 15px; }
.note .quoi small { display: block; color: var(--gris); font-size: 12.5px; margin-top: 1px; }
.note .chiffre { font-family: var(--serif); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.note .chiffre small { font-family: var(--sans); font-size: 12.5px; color: var(--gris); margin-left: 3px; }
.note .barre { position: relative; height: 10px; border-radius: 10px; background: rgba(250, 242, 230, .1); margin: 11px 0 0; }
.note .barre i { position: absolute; inset: 0 auto 0 0; border-radius: 10px; background: var(--ocre); }
.note .barre u { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: var(--encre); box-shadow: 0 0 0 2px var(--papier); }
.note .bas { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--gris); }
.note .ecart { font-weight: 600; }
.note .ecart.plus { color: #9fce9a; } .note .ecart.moins { color: #f0a077; } .note .ecart.egal { color: var(--encre); }
.note.petite .chiffre { font-size: 22px; }
.sous-titre { font-family: var(--serif); font-size: 16.5px; margin: 18px 0 6px; }
.legende-jauge { color: var(--gris); font-size: 12.5px; margin: 8px 0 0; }

.propos { max-width: 760px; }
.propos .corps { display: block; padding-top: 18px; }
.propos p, .propos li { max-width: 68ch; }
.propos ul { padding-left: 20px; }

@media (max-width: 980px) {
  .corps { grid-template-columns: 1fr; } .corps .col + .col { border-left: 0; padding-left: 0; } .fiche { max-width: 820px; }
  header .liens { display: none; }
}
@media (max-width: 720px) {
  header { gap: 12px; padding: 0 12px; } header .titre { display: none; } header img { height: 36px; } .recherche { max-width: none; }
  .legende { top: auto; bottom: 30px; left: 10px; right: 10px; width: auto; max-height: 46%; padding: 10px 14px; }
  .legende.repliee > :not(.replier) { display: none; }
  .replier { display: block; width: 100%; background: none; border: 0; padding: 2px 0; text-align: left; font-family: var(--serif); font-size: 16px; cursor: pointer; }
  .legende h2 { display: none; }
  .voile { padding: 0; } .fiche { border: 0; border-radius: 0; box-shadow: none; min-height: 100%; }
  .entete, .corps, .pied { padding-left: 18px; padding-right: 18px; } .entete::after { left: 18px; }
  .entete h1 { font-size: 25px; }
  dl { grid-template-columns: 1fr; gap: 0; } dt { margin-top: 8px; font-size: 13px; }
  td.periode, th.periode { width: auto; white-space: normal; }
  details.groupe table { margin-left: 0; width: 100%; }
}
