/* Page « Calendrier des élections » (pipeline/calendrier.py, commun/calendrier.js) */
:root { --e-site: #2a78d6; --e-disponible: #c8690f; --e-introuvable: #b5367e; --e-anterieur: #7d6bd1; --e-avenir: #1c9c82; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --e-site: #3987e5; --e-disponible: #c97a2b; --e-introuvable: #e0609a; --e-anterieur: #8f7be0; --e-avenir: #25a08a; }
}
:root[data-theme="dark"] { --e-site: #3987e5; --e-disponible: #c97a2b; --e-introuvable: #e0609a; --e-anterieur: #8f7be0; --e-avenir: #25a08a; }

.contenu.large { max-width: 1480px; }
.calendrier h1 { font-size: clamp(28px, 4.5vw, 40px); line-height: 1.1; margin: 8px 0 6px; }
.cal-chapeau { font-size: 16px; color: var(--text-secondary); margin: 0 0 16px; }

/* Marques d'état : couleur et texture, pour ne pas dépendre de la seule couleur */
.m { display: inline-block; min-width: 3px; height: 100%; border-radius: 2px; background: var(--e); --e: var(--e-site); }
.m-site { --e: var(--e-site); }
.m-disponible { --e: var(--e-disponible); }
.m-introuvable { --e: var(--e-introuvable); background: repeating-linear-gradient(45deg, var(--e) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--e); }
.m-anterieur { --e: var(--e-anterieur); background: repeating-linear-gradient(135deg, var(--e) 0 1.5px, transparent 1.5px 4px); box-shadow: inset 0 0 0 1px var(--e); }
.m-avenir { --e: var(--e-avenir); background: transparent; box-shadow: inset 0 0 0 2px var(--e); }

.etats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.etat-filtre { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.etat-filtre .m { width: 13px; height: 13px; flex: none; }
.etat-filtre b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.etat-filtre[aria-pressed=false] { color: var(--text-muted); background: transparent; border-style: dashed; }
.etat-filtre[aria-pressed=false] .m { opacity: .3; }

.cal-filtres { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; margin-bottom: 8px; }
.cal-filtres label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.cal-filtres select, .cal-filtres input { font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; min-height: 34px; box-sizing: border-box; }
#f-pays, #f-type { width: 170px; }
.cherche input { width: 170px; }
.segmente { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.segmente button { font: inherit; font-size: 13px; padding: 7px 14px; border: 0; background: var(--surface-2); color: var(--text-secondary); cursor: pointer; }
.segmente button + button { border-left: 1px solid var(--border); }
.segmente button[aria-pressed=true] { background: var(--accent); color: #fff; }
.effacer { font: inherit; font-size: 13px; color: var(--accent); background: none; border: 0; padding: 7px 2px; cursor: pointer; text-decoration: underline; }
.cal-compte { margin: 4px 0 10px; font-size: 13px; color: var(--text-muted); }
.vide { padding: 32px 0; color: var(--text-muted); text-align: center; }

/* Frise */
.frise-defile { overflow: auto; max-height: 76vh; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); }
.frise { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.frise thead th { position: sticky; top: 0; z-index: 2; height: 26px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-weight: 500; padding: 0; min-width: 20px; }
.frise thead th span { display: flex; justify-content: center; width: 100%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.frise th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-1); text-align: left; min-width: 118px; max-width: 118px; padding: 0 6px 0 10px;
  border-right: 1px solid var(--border); }
.frise thead th:first-child { z-index: 3; background: var(--surface-2); }
.frise tbody th button { font: inherit; font-weight: 500; color: var(--text-primary); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
.frise tbody th button:hover { color: var(--accent); }
.frise td { height: 22px; padding: 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); min-width: 20px; }
.frise .an-courant { background: var(--accent-soft); }
.frise thead .an-courant { color: var(--text-primary); font-weight: 700; background: var(--accent-soft); }
.frise td button { display: flex; gap: 1px; width: calc(100% - 3px); height: 15px; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 3px; }
.frise td button:hover { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.frise td .m { min-width: 2px; }
.frise-aide { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }
.cal-bulle { position: fixed; z-index: 50; max-width: 320px; padding: 8px 10px; font-size: 13px; color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .18); pointer-events: none; }
.cal-bulle ul { list-style: none; margin: 5px 0 0; padding: 0; }
.cal-bulle li { display: flex; gap: 6px; align-items: baseline; line-height: 1.35; margin-top: 2px; }
.cal-bulle .m { flex: none; width: 9px; height: 9px; }
.cal-bulle small { display: block; margin-top: 4px; color: var(--text-muted); }

/* Liste */
.an-titre { position: sticky; top: 0; z-index: 1; margin: 18px 0 0; padding: 5px 0; font-size: 18px; background: var(--surface-0); border-bottom: 1px solid var(--border); }
.cal-liste { list-style: none; margin: 0; padding: 0; }
.cal-ligne { display: grid; grid-template-columns: 150px minmax(0, 1.5fr) 180px minmax(0, 1.4fr); gap: 4px 14px; padding: 8px 0; font-size: 14px; line-height: 1.4;
  border-bottom: 1px solid var(--border); }
.s-date { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.s-nom b { font-weight: 600; }
.s-nom small { display: block; color: var(--text-muted); font-size: 12px; }
.s-etat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; }
.s-etat .m { flex: none; width: 10px; height: 10px; }
.s-info { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 13px; color: var(--text-secondary); min-width: 0; }
.s-info details { flex-basis: 100%; }
.s-info summary { cursor: pointer; color: var(--text-muted); }
.s-info details p { margin: 4px 0 0; overflow-wrap: anywhere; }
.voir { font-weight: 600; }
.controle { color: var(--text-primary); border-bottom: 1px dotted var(--text-muted); }
.repere { height: 0; scroll-margin-top: 44px; }
.cal-notes p { color: var(--text-secondary); }
.cal-maj { font-size: 13px; color: var(--text-muted) !important; }

@media (max-width: 760px) {
  .cal-filtres label { flex: 1 1 42%; }
  #f-pays, #f-type, .cherche input, .cal-filtres select { width: 100%; }
  .segmente { flex: 1 1 100%; }
  .segmente button { flex: 1; }
  .frise th:first-child { min-width: 92px; max-width: 92px; padding-left: 8px; }
  .cal-ligne { grid-template-columns: minmax(0, 1fr) auto; }
  .s-nom, .s-info { grid-column: 1 / -1; }
  .s-date { grid-row: 1; }
  .s-etat { grid-row: 1; grid-column: 2; }
}
