/* Calendrier du mois commun (lib/calendrier.mjs) — maquettes validées par Said
   le 01/11/2026 (docs/design/passe3/calendrier-*.png). Couleurs de DESIGN.md ;
   une couleur par type de rendez-vous, rappelée par la légende-filtre. */
:root {
  --cal-formation: #1d4ed8; --cal-formation-s: #e8eefc;
  --cal-assemblee: #c14a1e; --cal-assemblee-s: #fdefe8;
  --cal-reunion: #0f766e;   --cal-reunion-s: #e6f5f2;
  --cal-permanence: #6d5bd0; --cal-permanence-s: #efedfb;
  --cal-trait: #f1ece6;
}

/* Barre d'outils : Mois / Liste, mois, aujourd'hui, filtres */
.cal-barre { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.cal-bascule { display: inline-flex; background: #fff; border: 1px solid var(--trait, #ece5dd); border-radius: 999px; padding: 4px; }
.cal-bascule button { border: 0; background: transparent; padding: 8px 16px; min-height: 36px; border-radius: 999px; font: 600 14px/1 Inter, system-ui, sans-serif; color: var(--ink-2, #5c5c5c); cursor: pointer; }
.cal-bascule button[aria-pressed="true"] { background: var(--nuit, #172638); color: #fff; }
.cal-mois { display: flex; align-items: center; gap: 10px; }
.cal-mois h2 { margin: 0; font: 700 20px/1.1 "Space Grotesk", Inter, sans-serif; letter-spacing: -.02em; min-width: 170px; text-align: center; }
.cal-rond { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--trait, #ece5dd); background: #fff; display: grid; place-items: center; font: 700 18px/1 Inter, sans-serif; color: var(--ink, #1a1a1a); cursor: pointer; }
.cal-auj { border: 1px solid var(--trait, #ece5dd); background: #fff; border-radius: 999px; padding: 0 16px; min-height: 44px; font: 600 14px Inter, sans-serif; cursor: pointer; color: var(--ink, #1a1a1a); }
.cal-filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cal-filtre { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--trait, #ece5dd); background: #fff; border-radius: 999px; padding: 0 13px; min-height: 40px; font: 600 13.5px Inter, sans-serif; color: var(--ink, #1a1a1a); cursor: pointer; }
.cal-filtre i { width: 10px; height: 10px; border-radius: 50%; background: var(--nuit, #172638); }
.cal-filtre i.formation { background: var(--cal-formation); } .cal-filtre i.assemblee { background: var(--cal-assemblee); }
.cal-filtre i.reunion { background: var(--cal-reunion); } .cal-filtre i.permanence { background: var(--cal-permanence); }
.cal-filtre[aria-pressed="false"] { opacity: .5; }
.cal-filtre[aria-pressed="false"] span { text-decoration: line-through; }
.cal-barre button:focus-visible, .calm button:focus-visible { outline: 3px solid var(--cfdt, #e05c28); outline-offset: 2px; }

/* Zone : grille + panneau du jour à droite */
.cal-zone { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }

/* Grille */
.calm { background: #fff; border: 1px solid var(--trait, #ece5dd); border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(30, 38, 52, .06); }
.calm-jours, .calm-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calm-jours span { padding: 10px 12px; font: 700 12px Inter, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2, #5c5c5c); border-bottom: 1px solid var(--trait, #ece5dd); }
.calm-case { position: relative; min-height: 132px; min-width: 0; border-right: 1px solid var(--cal-trait); border-bottom: 1px solid var(--cal-trait); padding: 6px 7px 7px; display: flex; flex-direction: column; gap: 4px; }
.calm-case:nth-child(7n) { border-right: 0; }
.calm-case.we { background: #fcfaf7; }
.calm-case.hors { background: #fbf9f6; }
.calm-case.hors .calm-num { color: #c4beb6; font-weight: 700; font-size: 14px; padding: 4px 5px; }
.calm-case.choisi { box-shadow: inset 0 0 0 2px var(--cfdt, #e05c28); background: #fff8f4; }
.calm-num { align-self: flex-start; border: 0; background: transparent; padding: 3px 5px; border-radius: 8px; font: 700 14px Inter, sans-serif; color: var(--ink, #1a1a1a); cursor: pointer; min-width: 30px; text-align: left; }
.calm-num:hover { background: #f3eee8; }
.calm-case.auj .calm-num b { background: var(--cfdt-fond, #c14a1e); color: #fff; border-radius: 999px; padding: 1px 8px; }
.calm-el { display: block; width: 100%; text-align: left; border: 0; border-radius: 7px; padding: 4px 7px 5px 9px; font: 600 12.5px/1.25 Inter, sans-serif; cursor: pointer; min-width: 0; background: #eef2f7; color: var(--nuit, #172638); box-shadow: inset 3px 0 var(--nuit, #172638); }
.calm-el time { display: block; font-size: 11.5px; font-weight: 700; opacity: .85; }
.calm-el span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; hyphens: auto; }
.calm-el:hover { filter: brightness(.97); }
.calm-el.barre span { text-decoration: line-through; opacity: .75; }
.calm-el.formation { background: var(--cal-formation-s); color: var(--cal-formation); box-shadow: inset 3px 0 var(--cal-formation); }
.calm-el.assemblee { background: var(--cal-assemblee-s); color: var(--cfdt-dark, #b94317); box-shadow: inset 3px 0 var(--cal-assemblee); }
.calm-el.reunion { background: var(--cal-reunion-s); color: #115e59; box-shadow: inset 3px 0 var(--cal-reunion); }
.calm-el.permanence { background: var(--cal-permanence-s); color: #4c3fa6; box-shadow: inset 3px 0 var(--cal-permanence); }
.calm-el.brouillon { background: #fff; color: #5c5c5c; box-shadow: none; outline: 1.5px dashed #b9b2a9; outline-offset: -1.5px; }
.calm-el.repos { background: #eaf6ef; color: #14532d; box-shadow: inset 3px 0 #16a34a; }
.calm-plus { align-self: flex-start; border: 0; background: transparent; padding: 2px 4px; font: 600 12px Inter, sans-serif; color: var(--cfdt-dark, #b94317); cursor: pointer; }
.calm-marque { width: max-content; max-width: 100%; border-radius: 999px; padding: 2px 8px; font: 700 11.5px Inter, sans-serif; background: var(--cfdt-soft, #fdefe8); color: var(--cfdt-dark, #b94317); }
.calm-marque.eux { background: var(--cfdt-fond, #c14a1e); color: #fff; }
.calm-marque.envoye { background: var(--cal-permanence-s); color: #4c3fa6; }
.calm-code, .calm-points { display: none; }

/* Panneau du jour (droite sur ordinateur, sous la grille sur téléphone) */
.cal-jour { background: #fff; border: 1px solid var(--trait, #ece5dd); border-radius: 16px; box-shadow: 0 10px 30px rgba(30, 38, 52, .06); padding: 18px; position: sticky; top: 18px; }
.cal-jour > h2 { margin: 0 0 12px; font: 700 19px/1.2 "Space Grotesk", Inter, sans-serif; letter-spacing: -.02em; }
.cal-jour > h2::first-letter { text-transform: uppercase; }
.cal-vide { color: var(--ink-2, #5c5c5c); font-size: 14px; margin: 0; }
.cal-carte { display: flex; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--trait, #ece5dd); border-radius: 14px; padding: 12px 14px; margin: 0 0 8px; cursor: pointer; font: inherit; color: inherit; }
.cal-carte[aria-expanded="true"] { border-color: #f0c9b6; background: #fffaf7; }
.cal-carte .t { width: 4px; border-radius: 2px; flex: none; background: var(--nuit, #172638); }
.cal-carte .t.formation { background: var(--cal-formation); } .cal-carte .t.assemblee { background: var(--cal-assemblee); }
.cal-carte .t.reunion { background: var(--cal-reunion); } .cal-carte .t.permanence { background: var(--cal-permanence); }
.cal-carte .h { font: 700 16px "Space Grotesk", Inter, sans-serif; min-width: 54px; color: var(--nuit, #172638); }
.cal-carte b { display: block; font-size: 15.5px; line-height: 1.3; }
.cal-carte small { display: block; color: var(--ink-2, #5c5c5c); font-size: 13.5px; margin-top: 2px; }
.cal-carte.annule b { text-decoration: line-through; }
.cal-fiche { border-top: 1px solid var(--trait, #ece5dd); margin: 4px 0 14px; padding: 12px 2px 0; }
.cal-fiche .sur { margin: 0; font: 700 12px Inter, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--cfdt-dark, #b94317); }
.cal-fiche h3 { margin: 6px 0 8px; font: 700 21px/1.15 "Space Grotesk", Inter, sans-serif; letter-spacing: -.02em; }
.cal-ligne { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 14.5px; }
.cal-ligne svg { width: 19px; height: 19px; flex: none; margin-top: 1px; fill: none; stroke: var(--nuit, #172638); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cal-fiche .desc { color: #3d4652; font-size: 14.5px; white-space: pre-line; margin: 10px 0; }
.cal-fiche .annulation { background: #fdecea; color: #8a1c12; border-radius: 10px; padding: 8px 10px; font-size: 14px; margin: 8px 0; }
.cal-fiche .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cal-fiche .actions a, .cal-fiche .actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; border: 1px solid var(--trait, #ece5dd); background: #fff; font: 600 14px Inter, sans-serif; color: var(--ink, #1a1a1a); text-decoration: none; cursor: pointer; padding: 0 14px; }

/* Éditeur d'agenda */
.cal-legende-brouillon { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2, #5c5c5c); }
.cal-legende-brouillon span { width: 22px; height: 14px; border-radius: 4px; outline: 1.5px dashed #b9b2a9; outline-offset: -1.5px; }
.cal-carte .etat { display: inline-block; margin-top: 4px; font: 700 11.5px Inter, sans-serif; border-radius: 999px; padding: 2px 8px; background: #eef1f5; color: #3d4a5a; }
.cal-carte .etat.publie { background: #e6faf6; color: #115e59; } .cal-carte .etat.annule { background: #fdecea; color: #8a1c12; }
.cal-ajouter { width: 100%; min-height: 44px; margin-top: 6px; border-radius: 12px; border: 1px dashed #d6b8a8; background: var(--cfdt-soft, #fdefe8); color: var(--cfdt-dark, #b94317); font: 600 14px Inter, sans-serif; cursor: pointer; }

/* Vue liste */
.cal-liste h3 { margin: 18px 0 8px; font: 700 17px "Space Grotesk", Inter, sans-serif; }
.cal-liste h3::first-letter { text-transform: uppercase; }
.cal-liste .cal-carte { max-width: 860px; }

@media (max-width: 1279px) {
  .cal-zone { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .cal-jour { position: static; }
}
@media (max-width: 700px) {
  .cal-barre { gap: 8px; }
  .cal-mois { order: 3; width: 100%; justify-content: space-between; }
  .cal-mois h2 { min-width: 0; font-size: 19px; }
  .cal-auj { margin-left: auto; }
  .cal-filtres { margin-left: 0; order: 4; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .cal-filtre { flex: none; }
  .calm-jours span { padding: 8px 0; text-align: center; font-size: 11px; letter-spacing: .04em; }
  .calm-case { min-height: 60px; padding: 5px 1px; align-items: center; gap: 3px; border-right: 0; }
  .calm-case.choisi { box-shadow: none; background: transparent; }
  .calm-case.choisi .calm-num b { background: var(--nuit, #172638); color: #fff; border-radius: 999px; padding: 2px 7px; }
  .calm-num { align-self: center; text-align: center; font-size: 15px; padding: 3px 4px; }
  .calm-num::after { content: ""; position: absolute; inset: 0; }
  .calm-case.hors .calm-num { align-self: center; font-size: 15px; }
  .calm-el, .calm-plus, .calm-marque { display: none; }
  .calm-code { display: block; font: 700 12px "Space Grotesk", Inter, sans-serif; color: var(--nuit, #172638); }
  .calm-code.repos { color: #15803d; }
  .calm-points { display: flex; gap: 3px; justify-content: center; }
  .calm-points i { width: 7px; height: 7px; border-radius: 50%; background: var(--nuit, #172638); }
  .calm-points i.formation { background: var(--cal-formation); } .calm-points i.assemblee { background: var(--cal-assemblee); }
  .calm-points i.reunion { background: var(--cal-reunion); } .calm-points i.permanence { background: var(--cal-permanence); }
  .calm-points i.brouillon { background: #b9b2a9; } .calm-points i.marque { background: var(--cfdt, #e05c28); }
  .calm-points i.service, .calm-points i.repos { display: none; }
}
@media (prefers-reduced-motion: reduce) { .calm-el:hover { filter: none; } }
@media print {
  .cal-barre, .cal-jour { display: none; }
  .cal-zone { display: block; }
  .calm { box-shadow: none; }
}
