/* Écrans : accueil, agenda, jour, listes, voyage, réglages. */

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grille-7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }

.carte-titre { display: flex; justify-content: space-between; align-items: center; }
.etiquette { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--texte-discret); }
.point { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.point-teal { background: var(--teal-2); }
.point-indigo { background: var(--indigo-2); }

.lien-carte { color: inherit; font-weight: inherit; text-decoration: none; }
.lien-carte:hover { color: inherit; }
.carte-discrete p:last-child { font-weight: 600; color: var(--accent); }

/* ----- Boutons complémentaires ----- */
.bouton-contour { background: transparent; border-color: var(--accent); color: var(--accent); }
.bouton-large { width: 100%; }
.bouton-lien { min-height: 36px; padding: 0 10px; background: transparent; color: var(--accent); font-size: 13px; }
.bouton-icone {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--rayon-controle);
  background: var(--carte); color: var(--texte); box-shadow: var(--ombre);
  cursor: pointer;
}
.bouton-plein { background: var(--degrade-info-1); color: #ffffff; box-shadow: none; }
.bouton-supprimer { background: transparent; box-shadow: none; color: var(--texte-discret); font-size: 22px; }
.bouton-supprimer:hover { color: var(--danger); }

/* ----- Accueil ----- */
/* Carrousel de photos : diapositives superposées, fondu entre elles */
.carrousel {
  position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--rayon-carte); box-shadow: var(--ombre); background: var(--bordure);
}
.carrousel-diapo { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 0.6s ease; }
.carrousel-diapo.actif { opacity: 1; }
.carrousel-diapo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carrousel-legende {
  position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px);
  padding: 6px 12px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.45); color: #ffffff; font-size: 13px; font-weight: 600; line-height: 1.35;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Avec plusieurs photos, la légende remonte au-dessus des points */
.carrousel-multiple .carrousel-legende { bottom: 34px; }
.carrousel-fleche {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 40px; height: 40px; border: none; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.28); color: #ffffff; cursor: pointer; opacity: 0.85;
}
.carrousel-fleche:hover, .carrousel-fleche:focus-visible { opacity: 1; background: rgba(0, 0, 0, 0.42); }
.carrousel-precedent { left: 8px; }
.carrousel-suivant { right: 8px; }
.carrousel-points {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 1;
  display: flex; align-items: center;
}
/* Zone de tap confortable, pastille visible plus petite */
.carrousel-point {
  width: 22px; height: 22px; padding: 0; border: none; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.carrousel-point::after {
  content: ""; width: 7px; height: 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.6); box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
  transition: width 0.3s ease, background-color 0.3s ease;
}
.carrousel-point[aria-current="true"]::after { width: 18px; background: #ffffff; }
.carrousel-fleche:focus-visible, .carrousel-point:focus-visible { outline: 3px solid #ffffff; outline-offset: -3px; }
.photo-vide {
  height: 170px; border: 2px dashed var(--pointilles); border-radius: var(--rayon-carte);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--texte-discret); font-size: 14px; font-weight: 600;
}
.photo-vide:hover { color: var(--accent); }

.mot-texte { font-size: 16px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.ecrire-mot > summary { list-style: none; align-self: flex-start; display: inline-flex; min-height: 44px; }
.ecrire-mot > summary::-webkit-details-marker { display: none; }
.ecrire-mot[open] > summary { margin-bottom: 12px; }

.carte-degrade {
  border-radius: var(--rayon-carte); padding: 20px; color: #ffffff; box-shadow: var(--ombre);
  display: flex; flex-direction: column; gap: 14px;
}
.carte-degrade:hover { color: #ffffff; }
.degrade-1 { background: var(--degrade-info-1); }
.degrade-2 { background: var(--degrade-info-2); }

.meteo-haut, .voyage-haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.meteo-lieu { font-size: 13px; font-weight: 600; opacity: 0.92; }
.meteo-temp { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.meteo-libelle { font-size: 14px; font-weight: 600; }
.meteo-jour { background: rgba(255, 255, 255, 0.16); border-radius: var(--rayon-controle); padding: 10px 12px; }
.meteo-jour-nom { font-size: 12px; font-weight: 700; opacity: 0.92; }
.meteo-jour-temp { font-size: 15px; font-weight: 700; }
.meteo-jour-libelle { font-size: 12px; font-weight: 500; }
/* Météo à destination : 1 à 3 jours, en colonnes égales */
.meteo-jours-destination { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }

.ligne-planning { display: flex; align-items: center; gap: 12px; }
.barre-personne { width: 6px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.barre-teal { background: var(--degrade-teal); }
.barre-indigo { background: var(--degrade-indigo); }
.ligne-planning-texte { flex-grow: 1; min-width: 0; }
.ligne-planning-nom { font-size: 13px; font-weight: 700; color: var(--texte-discret); }
.ligne-planning-heures { font-size: 15px; font-weight: 700; }

.voyage-etiquette { font-size: 13px; font-weight: 700; opacity: 0.92; }
.voyage-nom { font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.voyage-dates { font-size: 13px; font-weight: 600; opacity: 0.92; }
.voyage-compteur { font-size: 36px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; white-space: nowrap; }
.voyage-compteur-grand { font-size: 44px; }
.voyage-checklist { font-size: 12px; font-weight: 600; }
.progression { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.progression-barre { display: block; height: 100%; width: 0; border-radius: 4px; background: #ffffff; transition: width 0.25s ease; }

.carte-titre span:last-child { font-size: 13px; font-weight: 700; color: var(--accent); }

.semaine-previsu { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.semaine-jour {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 2px; border-radius: 12px; background: var(--champ-fond);
  border: 1.5px solid transparent;
}
.semaine-jour.aujourdhui { border-color: var(--accent); }
.semaine-jour-lettre { font-size: 10px; font-weight: 700; color: var(--texte-discret); text-transform: uppercase; }
.semaine-jour-num { font-size: 14px; font-weight: 800; }
.semaine-jour.aujourdhui .semaine-jour-num { color: var(--accent); }
.semaine-jour-barres { display: flex; flex-direction: column; gap: 3px; width: 100%; margin-top: 2px; }
.semaine-jour-barres .micro-barre { height: 5px; }

.raccourci { gap: 2px; padding: 16px; }
.raccourci-titre { font-size: 13px; font-weight: 700; color: var(--texte-discret); }
.raccourci-valeur { font-size: 20px; font-weight: 800; }

/* ----- Agenda ----- */
.agenda { display: flex; flex-direction: column; gap: 14px; touch-action: pan-y; }
.agenda-entete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.agenda-entete h1 { font-size: 22px; text-align: center; }

.segments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--rayon-controle); background: var(--bordure); }
.segment { min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 11px; color: var(--texte-discret); font-size: 14px; font-weight: 600; }
.segment.actif { background: var(--carte); color: var(--texte); font-weight: 700; box-shadow: 0 2px 6px rgba(28, 60, 70, 0.1); }

.carte-mois { padding: 12px 8px; gap: 6px; }
.jours-semaine { text-align: center; font-size: 12px; font-weight: 700; color: var(--texte-discret); }
.case-jour {
  height: 62px; padding: 6px 5px; border-radius: 12px; border: 2px solid transparent;
  background: var(--champ-fond); color: var(--texte);
  display: flex; flex-direction: column; justify-content: space-between;
}
.case-jour:hover { color: var(--texte); }
.case-jour.passe .case-num { color: var(--texte-discret); font-weight: 600; }
.case-jour.hors-mois { opacity: 0.35; }
.case-jour.aujourdhui { border-color: var(--accent); }
.case-jour.aujourdhui .case-num { color: var(--accent); font-weight: 800; }
.case-haut { display: flex; justify-content: space-between; align-items: center; }
.case-num { font-size: 13px; font-weight: 700; }
.case-barres { display: flex; flex-direction: column; gap: 3px; }
.point-note { width: 6px; height: 6px; border-radius: 50%; background: #e0a526; display: inline-block; }

.micro-barre { display: block; height: 6px; border-radius: 3px; }
.micro-barre.travail.teal { background: var(--degrade-teal); }
.micro-barre.travail.indigo { background: var(--degrade-indigo); }
.micro-barre.teletravail { border: 1.5px solid; background: transparent; }
.micro-barre.teletravail.teal { border-color: var(--teal-2); }
.micro-barre.teletravail.indigo { border-color: var(--indigo-2); }
.micro-barre.repos { background: transparent; }
.micro-barre.non_saisi { background: repeating-linear-gradient(45deg, var(--pointilles) 0 3px, transparent 3px 6px); }

.legende { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 0 4px; font-size: 12px; font-weight: 600; color: var(--texte-discret); }
.legende > span { display: inline-flex; align-items: center; gap: 6px; }
.legende .micro-barre { width: 18px; }

/* Événements : un point par personne concernée, plus un point neutre (voir teintes_evenements()) */
.case-evenements { display: flex; gap: 3px; min-height: 6px; }
.point-evenement { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; display: inline-block; background: var(--evenement); }
.point-evenement.teal { background: var(--teal-2); }
.point-evenement.indigo { background: var(--indigo-2); }

/* Voyage : fond violet doux, prolongé dans l'espace entre deux cases pour former un bandeau.
   lie-gauche / lie-droite : la case continue le voyage de ce côté (coins droits). */
.case-jour.voyage { background: var(--voyage-fond); }
.case-jour.voyage.lie-gauche { margin-left: -4px; padding-left: 9px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.case-jour.voyage.lie-droite { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.case-jour.voyage .case-num { color: var(--voyage-texte); }
.case-jour.voyage.aujourdhui .case-num { color: var(--accent); }
.pastille-voyage { width: 18px; height: 10px; border-radius: 4px; display: inline-block; background: var(--voyage-fond); box-shadow: inset 0 0 0 1.5px var(--voyage); }

.liste-semaine { display: flex; flex-direction: column; gap: 10px; }
.jour-semaine { gap: 6px; padding: 14px 16px; border: 2px solid transparent; }
.jour-semaine.aujourdhui { border-color: var(--accent); }
.jour-semaine-titre { font-size: 15px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.jour-semaine-ligne { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.jour-semaine-nom { color: var(--texte-discret); min-width: 64px; }
.jour-semaine-note { font-size: 13px; color: var(--texte-discret); }
.jour-semaine.voyage { box-shadow: inset 4px 0 0 var(--voyage), var(--ombre); }
.jour-semaine-evenement { font-size: 13px; }
.jour-semaine-evenement .point-evenement { width: 8px; height: 8px; }
.jour-semaine-evenement-titre { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pastille-voyage-texte { color: var(--voyage-texte); background: var(--voyage-fond); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pastille-petite { padding: 2px 8px; font-size: 11px; }

/* ----- Édition du jour ----- */
.barre-jour { display: flex; justify-content: space-between; align-items: center; }
.barre-jour-nav { display: flex; gap: 8px; }
.lien-retour { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 15px; }
.titre-jour { padding: 0 4px; }
.formulaire-jour { display: flex; flex-direction: column; gap: 14px; }

.section-personne-entete { display: flex; align-items: center; gap: 10px; }
.section-personne-entete h2 { flex-grow: 1; }
.avatar-petit { width: 34px; height: 34px; font-size: 14px; border-width: 0; }

.liste-creneaux { display: flex; flex-direction: column; gap: 10px; }
.creneau { border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--champ-fond); }
.creneau-heures { display: flex; align-items: center; gap: 8px; }
.creneau-heures input {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--bordure); border-radius: 12px; background: var(--carte);
  font-size: 16px; font-weight: 600;
}
.creneau-heures > span { font-weight: 700; color: var(--texte-discret); }

.interrupteur { display: flex; justify-content: space-between; align-items: center; min-height: 36px; font-size: 14px; font-weight: 600; }
.interrupteur input {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 52px; height: 32px; border-radius: 16px; background: var(--bordure);
  position: relative; cursor: pointer; transition: background 0.15s;
}
.interrupteur input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px;
  border-radius: 50%; background: #ffffff; transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.interrupteur input:checked { background: var(--accent); }
.interrupteur input:checked::after { transform: translateX(20px); }
.teinte-indigo .interrupteur input:checked { background: var(--indigo-2); }
.teinte-teal .interrupteur input:checked { background: var(--teal-2); }

.bouton-ajout { min-height: 44px; border: 1.5px dashed var(--pointilles); background: transparent; color: var(--accent); font-size: 14px; }
.teinte-indigo .bouton-ajout { color: var(--indigo-2); }
.texte-repos[hidden] { display: none; }

/* ----- Listes à cocher (courses, todo, checklist) ----- */
.liste-cases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ligne-case { display: flex; align-items: center; gap: 4px; }
.ligne-case + .ligne-case { border-top: 1px solid var(--bordure); }
.case-bouton {
  flex-grow: 1; min-width: 0; min-height: 48px; padding: 0; border: none; background: transparent;
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
}
.case-rond {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--pointilles); display: inline-flex; align-items: center; justify-content: center;
}
.case-bouton[aria-pressed="true"] .case-rond { background: var(--accent); border-color: var(--accent); }
.case-bouton[aria-pressed="true"] .case-rond::after {
  content: ""; width: 7px; height: 12px; margin-top: -3px;
  border: solid #ffffff; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.case-texte { flex-grow: 1; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.case-bouton[aria-pressed="true"] .case-texte { font-weight: 500; color: var(--texte-discret); text-decoration: line-through; }
.case-quantite { font-size: 13px; font-weight: 600; color: var(--texte-discret); white-space: nowrap; }
.case-bouton:disabled { cursor: progress; }
/* Ajout hors ligne pas encore envoyé : cercle en pointillés, texte atténué */
.ligne-case.en-attente .case-rond { border-style: dashed; }
.ligne-case.en-attente .case-texte { color: var(--texte-discret); }
.ligne-case.en-attente .bouton-supprimer { visibility: hidden; }

.carte-rayon { padding: 12px 14px; gap: 2px; }
.titre-rayon { font-size: 13px; font-weight: 800; color: var(--texte-discret); margin-bottom: 4px; }
.liste-rayons { display: flex; flex-direction: column; gap: 12px; }

.ajout-article { display: flex; flex-direction: column; gap: 10px; }
.ajout-ligne { display: flex; gap: 8px; align-items: center; }
.ajout-ligne input[type="text"] {
  flex-grow: 1; min-width: 0; min-height: 46px; padding: 0 14px;
  border: 1.5px solid var(--bordure); border-radius: var(--rayon-controle);
  background: var(--champ-fond); font-size: 16px;
}
.ajout-ligne input[type="text"]:focus { border-color: var(--accent); outline: none; }
.ajout-ligne .champ-quantite { flex: 0 0 72px; }

.suggestions { list-style: none; margin: 0; padding: 0; border: 1px solid var(--bordure); border-radius: var(--rayon-controle); overflow: hidden; }
.suggestions li + li { border-top: 1px solid var(--bordure); }
.suggestion {
  width: 100%; min-height: 44px; padding: 0 14px; border: none; background: var(--carte);
  display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; cursor: pointer;
}
.suggestion:hover { background: var(--champ-fond); }
.suggestion-libelle { font-weight: 700; }
.suggestion-rayon { font-size: 12px; font-weight: 600; color: var(--texte-discret); }

/* Suggestions récurrentes : les habitudes de la liste, à rajouter d'un geste */
.carte-suggestions[hidden] { display: none; }
.recurrentes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.recurrente {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 12px;
  border: 1.5px solid var(--bordure); border-radius: 999px; background: var(--carte);
  font-size: 13px; font-weight: 600; color: var(--texte); cursor: pointer;
}
.recurrente svg { color: var(--texte-discret); }
.recurrente:hover, .recurrente:active { border-color: var(--accent); color: var(--accent); }
.recurrente:hover svg, .recurrente:active svg { color: var(--accent); }
.recurrente:disabled { cursor: progress; opacity: 0.6; }

.rayons { border: 0; margin: 0; min-width: 0; padding: 0 0 4px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.rayons::-webkit-scrollbar { display: none; }
.rayon-pastille { flex-shrink: 0; position: relative; }
.rayon-pastille input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.rayon-pastille span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
  border: 1.5px solid var(--bordure); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--texte-discret); white-space: nowrap;
}
.rayon-pastille input:checked + span { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.rayon-pastille input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ----- Réglages ----- */
.choix-palette {
  border: none; background: transparent; padding: 4px 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--texte-discret);
}
.choix-palette.actif { color: var(--texte); font-weight: 800; }
.pastille-palette { width: 64px; height: 64px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 4px var(--carte); }
.choix-palette.actif .pastille-palette { border-color: var(--accent); }
.pastille-lagon { background: linear-gradient(135deg, #2fb8b0, #4a5fd9); }
.pastille-moderne { background: linear-gradient(135deg, #f6a57f, #d9534f); }
.pastille-prairie { background: linear-gradient(135deg, #e0b83a, #6f7a22); }

.ligne-reglage { flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; }
.interrupteur-bouton {
  flex-shrink: 0; width: 52px; height: 32px; border-radius: 16px; border: none; padding: 0;
  background: var(--bordure); position: relative; cursor: pointer;
}
.interrupteur-bouton[aria-checked="true"] { background: var(--accent); }
.interrupteur-rond {
  position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.interrupteur-bouton[aria-checked="true"] .interrupteur-rond { transform: translateX(20px); }

/* Photos d'accueil : vignettes ordonnées + tuile d'ajout */
.grille-photos { list-style: none; margin: 0; padding: 0; }
.vignette-photo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vignette-image { position: relative; }
.vignette-image img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block;
  border-radius: var(--rayon-controle); background: var(--bordure);
}
.vignette-supprimer {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; padding: 0;
  border: none; border-radius: 50%; cursor: pointer;
  background: rgba(0, 0, 0, 0.5); color: #ffffff; font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.vignette-supprimer:hover { background: var(--danger); }
.vignette-actions { display: flex; align-items: center; gap: 2px; }
.vignette-legende {
  flex: 1; min-width: 0; text-align: center; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vignette-sans-legende { color: var(--texte-discret); font-weight: 500; }
.vignette-deplacer {
  width: 36px; height: 36px; flex-shrink: 0; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--accent); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.vignette-deplacer:disabled { color: var(--bordure); cursor: default; }
.tuile-ajout-photo { height: auto; aspect-ratio: 16 / 10; gap: 4px; cursor: pointer; font-size: 13px; }
.tuile-ajout-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bouton-fichier { position: relative; overflow: hidden; }
.bouton-fichier input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.resume-details { font-size: 17px; font-weight: 800; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
details.carte[open] .resume-details { margin-bottom: 4px; }

/* ----- Diète ----- */
.carte-diete { flex-direction: row; justify-content: space-between; align-items: center; color: var(--texte); }
.carte-diete svg { color: var(--accent); }
.segments-jour .segment { font-size: 13px; }

.titre-repas { font-size: 20px; font-weight: 800; color: var(--accent); }
.actions-repas { display: flex; align-items: center; gap: 2px; }
.actions-repas a { padding: 8px 4px 8px 8px; font-size: 14px; }
.bouton-discret { width: 36px; height: 36px; background: transparent; box-shadow: none; color: var(--texte-discret); }

.liste-aliments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.aliment { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.aliment-nom { flex-grow: 1; min-width: 0; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.aliment-quantite { font-size: 14px; font-weight: 600; color: var(--texte-discret); font-variant-numeric: tabular-nums; white-space: nowrap; }
.aliment-echange { color: var(--accent); display: inline-flex; }

.badge-macro {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #ffffff; font-size: 12px; font-weight: 800;
}
/* Couleurs fixes, indépendantes de la palette : P, C et F doivent rester reconnaissables */
.badge-P { background: #2447b8; }
.badge-C { background: #f06a3a; }
.badge-F { background: #3f7be0; }

details.echange > summary, details.edition-aliment > summary { list-style: none; cursor: pointer; }
details.echange > summary::-webkit-details-marker,
details.edition-aliment > summary::-webkit-details-marker { display: none; }
.alternatives { list-style: none; margin: 0 0 8px 12px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.alternatives li { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; color: var(--texte-discret); }
.alternative-texte strong { color: var(--texte); font-weight: 600; }

.macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.macros > div {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: var(--rayon-controle); background: var(--champ-fond);
}
.macros span { font-size: 11px; font-weight: 700; color: var(--texte-discret); }
.macros strong { font-size: 18px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.macros-total > div { background: rgba(255, 255, 255, 0.16); }
.macros-total span, .macros-total strong { color: #ffffff; }
.kcal-repas { text-align: center; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--texte-discret); }
.kcal-total { text-align: center; font-size: 22px; font-weight: 800; }

.complement {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border-radius: var(--rayon-controle); background: color-mix(in srgb, var(--accent) 14%, var(--carte));
}
.complement-icone { color: var(--accent); display: inline-flex; }
.complement-texte { flex-grow: 1; min-width: 0; }
.complement-nom { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.complement-dose { font-size: 13px; color: var(--texte-discret); }
.complement-lien { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }

/* Édition */
.grille-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grille-4 .champ input { padding: 0 8px; text-align: center; }
.sous-titre { font-size: 13px; font-weight: 700; color: var(--texte-discret); margin-top: 6px; }
.edition-aliment { border-top: 1px solid var(--bordure); }
.edition-aliment:first-of-type { border-top: none; }
.edition-aliment[open] { padding-bottom: 12px; }
.edition-aliment[open] > summary { margin-bottom: 8px; }
.formulaire-compact { gap: 8px; }
.grille-aliment { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 8px; }
.grille-aliment input, .grille-aliment select, .champ-seul {
  min-height: 46px; width: 100%; padding: 0 12px;
  border: 1px solid var(--bordure); border-radius: var(--rayon-controle);
  background: var(--champ-fond); font-size: 16px;
}
.ajout-aliment { border-top: 1px solid var(--bordure); padding-top: 8px; }
.ligne-complement { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 52px; }
.ligne-complement + .ligne-complement { border-top: 1px solid var(--bordure); }
.complement-nom-edition { font-weight: 700; }
.carte.ajout-ligne { flex-direction: row; }

/* ----- Checklist par catégories ----- */
.carte-categorie { gap: 8px; }
.titre-categorie { font-size: 16px; font-weight: 800; }
.compte-categorie { font-size: 13px; font-weight: 700; color: var(--texte-discret); font-variant-numeric: tabular-nums; }
.options-categorie { border-top: 1px solid var(--bordure); padding-top: 6px; }
.options-categorie > summary { font-size: 13px; font-weight: 600; color: var(--texte-discret); cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.options-categorie[open] > summary { margin-bottom: 8px; }
.actions-categorie { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.texte-danger { color: var(--danger); }

/* ----- Aperçu des todos sur l'accueil ----- */
[data-apercu-todo] .liste-cases { margin-top: -4px; }
.lien-suite { font-size: 14px; padding: 4px 0; align-self: flex-start; }

/* ----- Je pense à toi (accueil) ----- */
.carte-pense { gap: 8px; }
.pense-haut { display: flex; align-items: center; gap: 12px; }
.pense-icone {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px;
  background: color-mix(in srgb, var(--accent) 14%, var(--carte));
}
.pense-texte { flex-grow: 1; min-width: 0; }
/* Réaction en un tap à un « je pense à toi » reçu */
.pense-reaction {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--bordure);
}
.pense-recu { font-size: 14px; font-weight: 600; }
.pense-emojis { display: flex; gap: 10px; flex-wrap: wrap; }
.pense-emoji { font-size: 22px; line-height: 1; }

/* ----- Événements et anniversaires ----- */
.liste-evenements { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.evenement { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; }
.evenement + .evenement { border-top: 1px solid var(--bordure); }
.evenement-icone {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
  background: var(--champ-fond);
}
.evenement-texte { flex-grow: 1; min-width: 0; }
.evenement-titre { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.evenement-heure { font-size: 13px; font-weight: 600; color: var(--texte-discret); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.evenement-jour-j .evenement-icone { background: color-mix(in srgb, var(--accent) 18%, var(--carte)); }
.liste-evenements-accueil { border-top: 1px solid var(--bordure); padding-top: 4px; }
.pastille-neutre { color: var(--texte-discret); background: var(--champ-fond); }
.pastille-personne { display: inline-flex; align-items: center; gap: 5px; color: var(--texte-discret); background: var(--champ-fond); }
.pastille-personne.teal { color: var(--teal-2); background: color-mix(in srgb, var(--teal-2) 12%, var(--carte)); }
.pastille-personne.indigo { color: var(--indigo-2); background: color-mix(in srgb, var(--indigo-2) 12%, var(--carte)); }
html[data-theme="sombre"] .pastille-personne.teal { color: var(--teal-1); }
html[data-theme="sombre"] .pastille-personne.indigo { color: var(--indigo-1); }
.puce-personne::before { content: ""; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--evenement); }
.puce-personne.teal::before { background: var(--teal-2); }
.puce-personne.indigo::before { background: var(--indigo-2); }

.ajout-evenement > summary { list-style: none; display: flex; cursor: pointer; }
.ajout-evenement > summary::-webkit-details-marker { display: none; }
.ajout-evenement[open] > summary { margin-bottom: 12px; }
.champ-puces { border: 0; margin: 0; padding: 0; min-width: 0; }
.champ-puces legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 700; }
.puces-rappel { flex-wrap: wrap; overflow-x: visible; }

/* ----- Historique des voyages ----- */
.liste-historique { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.liste-historique li + li { border-top: 1px solid var(--bordure); }
.ligne-historique { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 0; color: var(--texte); font-weight: inherit; }
.ligne-historique:hover { color: var(--texte); }
.ligne-historique svg { color: var(--texte-discret); flex-shrink: 0; }
.ligne-historique-texte { flex-grow: 1; min-width: 0; }
.ligne-historique-nom { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.ligne-historique-dates { font-size: 13px; font-weight: 600; color: var(--texte-discret); }

/* Checklist en lecture seule (voyage passé) : même rendu que les cases, sans interaction */
.case-lecture { cursor: default; }
.case-lecture.coche .case-rond { background: var(--accent); border-color: var(--accent); }
.case-lecture.coche .case-rond::after {
  content: ""; width: 7px; height: 12px; margin-top: -3px;
  border: solid #ffffff; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.case-lecture.coche .case-texte { font-weight: 500; color: var(--texte-discret); text-decoration: line-through; }
