:root {
  --fond: #f5f6f3;
  --papier: #ffffff;
  --encre: #1b2130;
  --encre-douce: #6b7079;
  --bord: #d9dcd5;
  --bord-clair: #eef0eb;
  --survol: #eceee9;
  --alerte-fond: #fbe9e7;
  --alerte-texte: #8b2e1f;
  --ok-texte: #3f7d4c;
  --rayon: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.enveloppe { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }

a { color: inherit; }

/* --- en-tête --- */
.entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.titre-mois { display: flex; align-items: flex-end; gap: 12px; }
h1 { font-size: 40px; font-weight: 600; letter-spacing: -1.2px; line-height: 1; margin: 0; text-transform: capitalize; }
.nav-mois { display: flex; gap: 6px; margin-bottom: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

button, .bouton {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--bord);
  background: var(--papier); color: var(--encre); padding: 8px 12px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .bouton:hover { background: var(--survol); }
button:disabled { opacity: .5; cursor: progress; }
button.principal { background: var(--encre); color: #fff; border-color: var(--encre); }
button.principal:hover { background: #2b3444; }
.rond { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50%; }

/* --- filtres --- */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filtre { border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.filtre[aria-pressed="false"] { opacity: .45; background: transparent; }
.pastille { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.compte { color: var(--encre-douce); }

/* --- messages --- */
.bandeau { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.bandeau.erreur { background: var(--alerte-fond); color: var(--alerte-texte); }
.bandeau.info { background: #eaf0e9; color: #2f4a34; }
.chargement { color: var(--encre-douce); font-size: 14px; margin-bottom: 10px; }

/* --- grille --- */
.colonnes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 1000px) { .colonnes { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); } }

.grille { background: var(--papier); border: 1px solid var(--bord); border-radius: var(--rayon); overflow: hidden; }
.jours-entete, .cases { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.jours-entete div { padding: 8px; font-size: 12px; color: var(--encre-douce); border-bottom: 1px solid var(--bord); }
.case { min-height: 104px; text-align: left; padding: 6px; border: none; border-bottom: 1px solid var(--bord-clair); border-right: 1px solid var(--bord-clair); background: transparent; border-radius: 0; align-items: stretch; flex-direction: column; }
.case:nth-child(7n) { border-right: none; }
.case.hors-mois { background: #fafaf8; }
.case.week-end { background: #fbfbf9; }
.case.selection { background: #e4e7e0; }
.case:focus-visible { outline: 2px solid var(--encre); outline-offset: -2px; }
.tete-case { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.numero { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 13px; }
.numero.aujourdhui { background: var(--encre); color: #fff; font-weight: 700; }
.hors-mois .numero { color: #a8adb4; }
.reste { font-size: 11px; color: var(--encre-douce); }
.puce { font-size: 11px; color: #fff; border-radius: 4px; padding: 2px 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.puce .heure { opacity: .85; }

/* --- panneaux --- */
.panneau { background: var(--papier); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; margin-bottom: 20px; }
.panneau h2 { font-size: 16px; margin: 0 0 10px; }
.panneau h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--encre-douce); margin: 16px 0 6px; }
.panneau p { margin: 6px 0; }
.vide { color: var(--encre-douce); font-size: 14px; }

.ligne-evenement { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--bord-clair); }
.ligne-evenement:first-of-type { border-top: none; }
.barre { width: 5px; border-radius: 3px; align-self: stretch; flex: 0 0 5px; }
.details { flex: 1; min-width: 0; }
.details .nom { font-weight: 600; font-size: 14px; }
.details .meta { font-size: 12px; color: var(--encre-douce); }
select { font: inherit; font-size: 12px; padding: 3px 4px; border-radius: 6px; border: 1px solid var(--bord); background: var(--papier); }

.mesure { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.jauge { height: 7px; background: var(--bord-clair); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.jauge span { display: block; height: 100%; background: var(--encre); }
.liste-seche { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.liste-seche li { margin-bottom: 3px; }
.conflit { color: var(--alerte-texte); }
.ok { color: var(--ok-texte); }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; }
.etiquette { font-size: 12px; border: 1px solid var(--bord); border-radius: 999px; padding: 2px 8px; color: var(--encre-douce); }

textarea, input[type="text"], input[type="number"] {
  font: inherit; width: 100%; padding: 8px; border-radius: 8px; border: 1px solid var(--bord); background: var(--papier);
}
.zone-question { display: flex; gap: 8px; margin-top: 8px; }
.reponse { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bord-clair); white-space: pre-wrap; }

/* --- réglages --- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--bord-clair); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--encre-douce); }
code { background: var(--fond); padding: 2px 5px; border-radius: 5px; font-size: 13px; }
.formulaire-ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 12px; }
.champ { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pied { color: var(--encre-douce); font-size: 13px; margin-top: 28px; }

[hidden] { display: none !important; }

@media (max-width: 700px) {
  h1 { font-size: 30px; }
  .case { min-height: 78px; padding: 4px; }
  .puce { font-size: 10px; padding: 1px 3px; }
  .puce .heure { display: none; }
  .numero { width: 20px; height: 20px; font-size: 12px; }
}

/* --- rubriques colorées de la synthèse --- */
.rubrique {
  border-left: 3px solid var(--accent, var(--bord));
  padding-left: 10px;
  margin-top: 16px;
}
.rubrique h3 { margin-top: 0; color: var(--accent, var(--encre-douce)); }
.puce-niveau {
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  margin-right: 6px;
  vertical-align: 1px;
}
.gommette {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.liste-seche { list-style: none; padding-left: 0; }
.liste-seche.conflit li { padding-left: 14px; text-indent: -14px; }
.liste-seche.conflit li::before { content: "▲ "; color: var(--alerte-texte); }
.etiquette--dispo { border-color: #B6CDB9; color: var(--ok-texte); }
