/* Comparaison de communes (/comparer) */
.comparer-page { align-items: stretch; max-width: 1100px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.comparer-page .card { max-width: none; }
.comparer-tete { padding: 20px; display: grid; gap: 14px; }
.comparer-tete h1 { margin: 0; font-size: 28px; color: var(--text); }

/* Communes choisies : une pastille de couleur par commune, la même dans les tableaux */
.selection { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.selection:empty { display: none; }
.selection li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-left: 4px solid var(--couleur); padding: 8px 6px 8px 10px; min-width: 0; }
.selection .pastille { display: none; }
.selection .nom { display: grid; min-width: 0; flex: 1; }
.selection .nom a, .selection .nom > span:first-child { font-weight: 700; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection .nom a:hover { color: var(--blue); text-decoration: underline; }
.selection .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.retirer { flex: none; border: 0; background: none; font-size: 22px; line-height: 1; width: 32px; height: 32px; color: var(--text-3); cursor: pointer; }
.retirer:hover { background: var(--bg); color: var(--text); }
button.lien { border: 0; background: none; color: var(--blue); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; padding: 0; }

.propositions { display: grid; gap: 6px; }
.propositions p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.puce { border: 1px solid var(--blue); background: var(--fg); color: var(--blue); padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.puce:hover { background: var(--blue-soft); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .bouton { display: inline-flex; align-items: center; gap: 6px; }
.bouton.secondaire { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.comparer-tete input:disabled { background: var(--bg); }

/* Barre des thèmes (même présentation que la fiche commune) */
.themes { position: sticky; top: 0; z-index: 5; width: 100%; display: flex; gap: 4px; overflow-x: auto;
  background: var(--fg); border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,.06); scrollbar-width: none; box-sizing: border-box; }
.themes::-webkit-scrollbar { display: none; }
.themes a { flex: none; padding: 12px 14px; color: var(--text-2); text-decoration: none; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
.themes a:hover { color: var(--text); background: var(--bg); }
.themes a[aria-current="true"] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.themes[hidden], #resultats[hidden] { display: none; }
#resultats { width: 100%; }
.vide { padding: 16px 20px; display: flex; align-items: center; gap: 8px; }
.vide-page { padding: 20px; }

.saillants { padding-bottom: 0; max-width: none; }
.saillants h3 { font-size: 15px; margin: 14px 0 6px; color: var(--text); }
.saillants ul { margin: 0; padding-left: 20px; }
.saillants li { margin-bottom: 4px; }
.comparer-page .prose:empty { display: none; }
.comparer-page .prose > .muted { margin-top: 10px; }

/* Tableau : première colonne fixe, communes défilant à côté sur petit écran */
.table-scroll { overflow-x: auto; }
.comparer-page table.comparaison { font-size: 13px; table-layout: fixed; min-width: calc(170px + var(--n, 2) * 110px); }
.comparer-page table.comparaison thead th:first-child { width: 28%; }
.comparer-page table.comparaison th[scope="row"], .comparer-page table.comparaison thead th:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--fg); text-align: left; font-weight: 400; color: var(--text); white-space: normal;
  min-width: 170px; max-width: 280px; border-bottom: 1px solid var(--border); }
.comparer-page table.comparaison thead th:first-child { font-weight: 600; color: var(--text-2); border-bottom: 2px solid var(--border); }
.comparer-page table.comparaison thead th.commune { min-width: 120px; white-space: normal; vertical-align: bottom; }
.comparer-page table.comparaison .pastille { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--couleur); margin-right: 6px; }
.comparer-page table.comparaison td.num { text-align: right; font-variant-numeric: tabular-nums; }
.comparer-page table.comparaison td .valeur { display: block; }
.comparer-page table.comparaison .france { color: var(--text-3); }
.comparer-page tr.intertitre th { background: var(--bg); color: var(--text-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; }
.comparer-page tr.intertitre th[scope="colgroup"] { position: static; }

/* Graphiques : un par indicateur, deux par ligne sur grand écran */
.graphiques-cmp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 20px 4px; }
.graphique-cmp { border: 1px solid var(--border); padding: 4px; min-width: 0; margin: 0; }
.graphique-cmp arcgis-chart { display: block; width: 100%; }
.sous-titre-cmp { margin: 12px 20px 6px; font-size: 15px; color: var(--text); }
.note-comparer { margin: 0; }
.comparer-page .note-tableau { margin: 0; padding: 10px 20px 16px; }


@media (max-width: 700px) {
  .graphiques-cmp { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 4px; }
  .comparer-tete { padding: 16px; }
  .comparer-tete h1 { font-size: 22px; }
  .comparer-page table.comparaison th[scope="row"], .comparer-page table.comparaison thead th:first-child { min-width: 120px; max-width: 150px; font-size: 12px; }
  .comparer-page table.comparaison { min-width: calc(120px + var(--n, 2) * 100px); }
  .comparer-page table.comparaison thead th:first-child { width: 120px; }
}
