/* Écrans d'analyse (lot F) : calendrier (cal-) et comparer (cmp-).
   Couleurs : uniquement les variables de css/style.css (§ 8.8 du plan). Le rose → cramoisi reste au degré ;
   le bleu-vert pour ce qui se touche et l'année affichée ; le gris pour l'an dernier ou la référence. */

/* ========== boutons segmentés et flèches (communs) ========== */

.cal-segments-choix,
.cmp-segments-choix {
  display: flex;
}

.cal-segments {
  flex: none;
}

.cal-segment,
.cmp-segment {
  position: relative;
  display: flex;
  min-width: 0;
}

/* La vraie radio couvre tout le segment (toucher, VoiceOver) mais reste invisible : le span dessine le bouton. */
.cal-segment-entree,
.cmp-segment-entree {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.cal-segment-texte,
.cmp-segment-texte {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--toucher);
  padding: 8px 16px;
  border: 1.5px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
}

.cal-segment:first-of-type .cal-segment-texte,
.cmp-segment:first-of-type .cmp-segment-texte {
  border-radius: var(--rayon) 0 0 var(--rayon);
}

.cal-segment:last-of-type .cal-segment-texte,
.cmp-segment:last-of-type .cmp-segment-texte {
  border-radius: 0 var(--rayon) var(--rayon) 0;
}

.cal-segment + .cal-segment .cal-segment-texte,
.cmp-segment + .cmp-segment .cmp-segment-texte {
  border-left-width: 0;
}

.cal-segment-entree:checked + .cal-segment-texte,
.cmp-segment-entree:checked + .cmp-segment-texte {
  background: var(--accent);
  color: var(--sur-accent);
}

.cal-segment-entree:focus-visible + .cal-segment-texte,
.cmp-segment-entree:focus-visible + .cmp-segment-texte {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (hover: hover) {
  .cal-segment-entree:not(:checked):hover + .cal-segment-texte,
  .cmp-segment-entree:not(:checked):hover + .cmp-segment-texte {
    background: var(--accent-doux, var(--fond));
  }
}

.cal-fleche,
.cmp-fleche {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--toucher);
  height: var(--toucher);
  padding: 0;
  border: 1.5px solid var(--trait);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
}

.cal-fleche svg,
.cmp-fleche svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cal-fleche:active:not(:disabled),
.cmp-fleche:active:not(:disabled) {
  background: var(--accent-doux, var(--fond));
}

.cal-fleche:disabled,
.cmp-fleche:disabled {
  color: var(--encre-3);
  opacity: 0.45;
}

/* ========== calendrier (cal-) ========== */

.cal-tete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 12px 0;
}

.cal-tete .titre-ecran {
  margin: 0;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.cal-titre {
  flex: 1;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 750;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cal-titre:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- grille du mois ---------- */

.cal-grille {
  margin: 0 0 12px;
}

.cal-semaine,
.cal-jours {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cal-semaine {
  margin: 0 0 6px;
  color: var(--encre-3);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.cal-jour {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: var(--toucher);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--trait);
  color: var(--encre);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.cal-jour:disabled {
  background: transparent;
  box-shadow: none;
  color: var(--encre-3);
  cursor: default;
}

.cal-jour:active:not(:disabled) {
  filter: brightness(0.94);
}

.cal-jour.cal-d-1 { background: var(--degre-1); color: var(--sur-degre-1); box-shadow: none; }
.cal-jour.cal-d-2 { background: var(--degre-2); color: var(--sur-degre-2); box-shadow: none; }
.cal-jour.cal-d-3 { background: var(--degre-3); color: var(--sur-degre-3); box-shadow: none; }
.cal-jour.cal-d-4 { background: var(--degre-4); color: var(--sur-degre-4); box-shadow: none; }

/* Aujourd'hui : entouré d'encre ; sur un jour coloré, un filet de surface sépare l'anneau du degré. */
.cal-jour.cal-aujourdhui {
  box-shadow: inset 0 0 0 2px var(--encre);
}

.cal-jour.cal-aujourdhui:is(.cal-d-1, .cal-d-2, .cal-d-3, .cal-d-4) {
  box-shadow: inset 0 0 0 2px var(--encre), inset 0 0 0 4px var(--surface);
}

.cal-aujourdhui .cal-num {
  font-weight: 850;
}

/* Le jour choisi : anneau bleu-vert (après « aujourd'hui » pour l'emporter). */
.cal-jour.cal-choisi {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.cal-jour.cal-choisi:is(.cal-d-1, .cal-d-2, .cal-d-3, .cal-d-4) {
  box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px var(--surface);
}

@media (hover: hover) {
  .cal-jour:not(:disabled):not(.cal-choisi):hover {
    box-shadow: inset 0 0 0 2px var(--accent);
  }
}

/* Petit point sous le chiffre : le journal de ce jour est rempli (couleur du texte, lisible sur chaque fond). */
.cal-point {
  position: absolute;
  bottom: 18%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- légende ---------- */

.cal-legende {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
  color: var(--encre-2);
  font-size: 0.875rem;
}

.cal-legende-liste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-legende-liste li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cal-legende-titre {
  font-weight: 650;
}

.cal-cle {
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 4px;
}

.cal-cle-d1 { background: var(--degre-1); }
.cal-cle-d2 { background: var(--degre-2); }
.cal-cle-d3 { background: var(--degre-3); }
.cal-cle-d4 { background: var(--degre-4); }

.cal-cle-aujourdhui {
  box-shadow: inset 0 0 0 2px var(--encre);
}

.cal-cle-point {
  flex: none;
  width: 5px;
  height: 5px;
  margin: 0 4px;
  border-radius: 50%;
  background: var(--encre);
}

/* Vue année : comme le point des mini-mois (.gr-mini-journal). 4 + 2 × 4,5 = 13 px, la largeur des autres clés. */
.cal-cle-point-mini {
  width: 4px;
  height: 4px;
  margin: 0 4.5px;
  background: var(--encre-3);
}

/* ---------- panneau du jour choisi ---------- */

.cal-panneau {
  scroll-margin-bottom: calc(var(--hauteur-onglets, 56px) + var(--bas-sur) + 12px);
}

.cal-indice {
  margin: 0;
  text-align: center;
}

.cal-panneau-titre {
  margin: 0 0 4px;
  font-size: 1.125rem;
  font-weight: 700;
}

.cal-bloc {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--trait);
}

.cal-bloc:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.cal-bloc p {
  margin: 0;
}

.cal-bloc-titre {
  color: var(--encre-2);
  font-size: 0.8125rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cal-poussee {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cal-poussee-texte {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cal-poussee-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-weight: 650;
}

.cal-poussee-texte .aide {
  overflow-wrap: anywhere;
}

.cal-resume {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cal-resume li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--fond);
  color: var(--encre);
  font-size: 0.875rem;
  line-height: 1.35;
}

.cal-note {
  color: var(--encre-2);
  font-style: italic;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.cal-panneau .bouton {
  width: 100%;
}

.cal-panneau > .bouton {
  margin-top: 12px;
}

/* ---------- ce mois / cette année contre l'an dernier ---------- */

.cal-bilan .aide {
  margin: 0 0 8px;
}

.cal-table {
  width: 100%;
  margin: 4px 0 0;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.cal-table th,
.cal-table td {
  padding: 9px 0 9px 12px;
  border-bottom: 1px solid var(--trait);
  text-align: right;
  vertical-align: baseline;
}

.cal-table :is(th, td):first-child {
  padding-left: 0;
}

.cal-table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

.cal-table thead th {
  color: var(--encre-2);
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

.cal-table tbody th {
  font-weight: 500;
  text-align: left;
}

.cal-table thead th,
.cal-table tbody td {
  width: 1%;
  padding-left: 20px;
}

.cal-table tbody td {
  font-weight: 700;
  white-space: nowrap;
}

/* « Tout comparer » : le texte commence au même bord que le titre de la carte. */
.cal-bilan .bouton-lien {
  margin-top: 4px;
  padding-left: 0;
}

/* ---------- vue année ---------- */

.cal-annee {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.cal-annee .gr-mini:disabled {
  cursor: default;
  opacity: 0.55;
}

/* ========== comparer (cmp-) ========== */

.cmp-filtres {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 8px;
}

.cmp-annee {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cmp-annee-valeur {
  min-width: 3em;
  font-size: 1.375rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cmp-annee-valeur:focus:not(:focus-visible) {
  outline: none;
}

.cmp-annee-ref {
  margin-left: 6px;
  color: var(--encre-2);
  font-size: 0.9375rem;
}

.cmp-segments {
  flex: 1 1 100%;
}

.cmp-segments-legende {
  margin: 0 0 6px;
  color: var(--encre-2);
  font-size: 0.875rem;
  font-weight: 650;
}

.cmp-segment {
  flex: 1 1 0;
}

.cmp-segment-texte {
  padding: 8px 6px;
  font-size: 0.9375rem;
}

.cmp-section {
  margin: 0 0 16px;
}

.cmp-titre {
  margin: 24px 0 4px;
  font-size: 1.25rem;
  font-weight: 750;
}

.cmp-section .aide {
  margin: 0 0 8px;
}

.cmp-section .gr-figure + .aide {
  margin-top: 10px;
}

/* ---------- tuiles de l'année ---------- */

.cmp-tuiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 10px;
  padding: 0;
  list-style: none;
}

.cmp-tuile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 8px 10px 10px;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  box-shadow: var(--ombre);
}

.cmp-tuile p {
  margin: 0;
}

.cmp-tuile-nom {
  min-height: 2.5em;
  color: var(--encre-2);
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.25;
}

/* Grand nombre seul : chiffres proportionnels (pas de tabular-nums). */
.cmp-tuile-valeur {
  color: var(--encre);
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
}

.cmp-unite {
  color: var(--encre-2);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
}

.cmp-tuile-avant {
  color: var(--encre-2);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.cmp-tuile .cmp-verdict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 6px;
  font-size: 0.8125rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.cmp-verdict-icone {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cmp-mieux {
  color: var(--mieux);
}

.cmp-moins-bien {
  color: var(--moins-bien);
}

.cmp-pareil {
  color: var(--encre-2);
}

/* ---------- la veille de tes poussées ---------- */

.cmp-encourage {
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--rayon) var(--rayon) 0;
  background: var(--accent-doux, var(--surface));
  color: var(--encre);
}

.cmp-details {
  margin: 12px 0;
  padding: 0 14px;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
}

.cmp-details[open] {
  padding-bottom: 12px;
}

.cmp-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--toucher);
  color: var(--accent);
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.cmp-details summary::-webkit-details-marker {
  display: none;
}

.cmp-details summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}

.cmp-details[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.cmp-details p {
  margin: 12px 0 0;
  color: var(--encre-2);
  font-size: 0.9375rem;
}

.cmp-reperes {
  margin: 0;
}

.cmp-reperes dt {
  margin: 12px 0 4px;
}

.cmp-reperes dt:first-child {
  margin-top: 4px;
}

.cmp-reperes dd {
  margin: 0;
  color: var(--encre-2);
  font-size: 0.9375rem;
}

.cmp-facteurs {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.cmp-facteur {
  margin: 0 0 10px;
}

.cmp-facteur p {
  margin: 0;
}

.cmp-facteur-tete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin: 0 0 10px;
}

.cmp-facteur-tete h3 {
  font-size: 1.0625rem;
  font-weight: 700;
}

/* Le repère : toujours un mot ; l'encre (pas une couleur d'état) dit seulement s'il est établi. */
.cmp-repere {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border: 1.5px solid var(--trait-fort, var(--encre-3));
  border-radius: 999px;
  color: var(--encre-2);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.cmp-repere-lien_net {
  border-color: var(--encre);
  background: var(--encre);
  color: var(--surface);
}

.cmp-repere-a_confirmer {
  border-color: var(--encre);
  color: var(--encre);
}

.cmp-repere-insuffisant {
  border-style: dashed;
}

.cmp-ligne {
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* Une seule échelle pour toutes les cartes : la plus haute part vaut toute la largeur. */
.cmp-barre {
  display: block;
  width: calc(var(--cmp-part, 0) * 100%);
  min-width: 3px;
  height: 8px;
  margin: 6px 0 12px;
  border-radius: 0 4px 4px 0;
}

.cmp-barre-avec {
  background: var(--accent);
}

.cmp-barre-sans {
  background: var(--serie-prec);
}

.cmp-barre-zero {
  width: 0;
  min-width: 0;
}

.cmp-ecart {
  color: var(--encre);
  font-weight: 750;
}

.cmp-facteur-insuffisant {
  background: transparent;
  box-shadow: none;
}

.cmp-facteur-insuffisant .cmp-ligne {
  color: var(--encre-2);
}

.cmp-facteur-insuffisant .cmp-ligne + .cmp-ligne {
  margin-top: 4px;
}

/* ---------- états vides et rappel ---------- */

.cmp-vide p {
  margin: 0 0 8px;
}

.cmp-vide-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.cmp-rappel {
  margin: 24px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--trait);
  color: var(--encre-2);
  font-size: 0.9375rem;
  text-align: center;
}
