/* Composants : boutons, liens, filtres, pastilles, champs, mail, jauge, contrôles, fenêtres, message bas d'écran.
   Chaque composant a ses états : défaut, survol (souris seulement), focus visible, appui, désactivé, erreur. */

/* ---------------------------------------------------------------- boutons et liens */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--e2); min-height: var(--cible-confort); padding: 0 var(--e5); border: 1px solid var(--bord-bouton); border-radius: var(--r10); background: var(--papier); color: var(--encre); font-size: var(--t15); font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; box-shadow: var(--ombre-1); transition: background-color var(--d-entree) ease, border-color var(--d-entree) ease, transform var(--d-appui) var(--ease-out); }
.btn.plein { background: var(--ocean); border-color: var(--ocean); color: #fff; box-shadow: 0 1px 2px rgba(8, 74, 115, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.petit { min-height: var(--cible); padding: 0 var(--e4); font-size: var(--t14); }
.btn.grand { min-height: 52px; padding: 0 var(--e6); font-size: var(--t16); }
.btn[disabled] { background: var(--sable-2); border: 1px dashed var(--bord-champ); color: var(--encre-2); box-shadow: none; cursor: not-allowed; }
.btn[aria-busy="true"]::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tourne 600ms linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

.lien { display: inline-flex; align-items: center; gap: var(--e1); min-height: var(--cible); padding: 0; border: 0; background: none; color: var(--ocean); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-align: left; transition: color var(--d-entree) ease, transform var(--d-appui) var(--ease-out); }
.tertiaire { margin-top: var(--e2); }

.btn:active:not([disabled]), .lien:active, .filtre:active, .fermer-x:active, .toast button:active, .retour:active, .nav-liste a:active { transform: var(--appui); }
.ligne-tache:active, .billet:active, .rangee:active, .file-ligne:active { transform: scale(0.99); }
:focus-visible:active { transform: none !important; }

/* ---------------------------------------------------------------- filtres (puces à presser) */
.puces-filtre { display: flex; gap: var(--e2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--e4)); padding: var(--e1) var(--e4); scroll-padding-inline: var(--e4); }
.puces-filtre::-webkit-scrollbar { display: none; }
.filtre { flex: none; display: inline-flex; align-items: center; gap: var(--e2); min-height: var(--cible); padding: 0 var(--e2) 0 var(--e4); border: 1px solid var(--bord); border-radius: var(--rond); background: var(--papier); color: var(--encre); font-size: var(--t14); font-weight: 600; white-space: nowrap; transition: background-color var(--d-entree) ease, border-color var(--d-entree) ease, color var(--d-entree) ease, transform var(--d-appui) var(--ease-out); }
.filtre-nb { min-width: 28px; height: 28px; padding: 0 var(--e2); border-radius: var(--rond); background: var(--sable-2); color: var(--encre-2); font-size: var(--t13); line-height: 28px; text-align: center; }
.filtre-num { width: 22px; height: 22px; margin-left: calc(-1 * var(--e1)); border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; line-height: 19px; text-align: center; }
.filtre[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: #fff; }
.filtre[aria-pressed="true"] .filtre-nb { background: rgba(255, 255, 255, .16); color: #fff; }
@media (min-width: 768px) { .puces-filtre { flex-wrap: wrap; overflow: visible; margin: 0; padding: var(--e1) 0; } }

/* ---------------------------------------------------------------- pastilles d'état (toujours un texte, jamais la couleur seule) */
.puce { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 var(--e3); border-radius: var(--rond); background: var(--sable-2); color: var(--encre-2); font-size: var(--t13); font-weight: 600; white-space: nowrap; flex: none; }
.puce i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.puce.corail { background: var(--corail-clair); color: var(--corail); }
.puce.soleil { background: var(--soleil-clair); color: var(--soleil); }
.puce.verte { background: var(--vert-clair); color: var(--vert); }
.puce.ocean { background: var(--ocean-clair); color: var(--ocean); }
b.corail { color: var(--corail); } b.verte { color: var(--vert); } b.soleil { color: var(--soleil); }

.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--ocean-clair); color: var(--ocean); font-weight: 700; font-size: var(--t14); }
.avatar.petit { width: 32px; height: 32px; font-size: var(--t13); }
.type { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r10); }
.type .ico { width: 18px; height: 18px; }
.f-reponses { background: var(--corail-clair); color: var(--corail); }
.f-relances { background: var(--ocean-clair); color: var(--ocean); }
.f-j30 { background: var(--lagon-clair); color: var(--lagon-texte); }
.f-paiements { background: var(--soleil-clair); color: var(--soleil); }
.f-departs { background: var(--sable-2); color: var(--encre); }
.type.fait { background: var(--vert-clair); color: var(--vert); }
.rond-ok, .rond-neutre { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--vert-clair); color: var(--vert); flex: none; }
.rond-neutre { background: var(--sable-2); color: var(--encre-2); }
.rond-ok .ico { width: 24px; height: 24px; stroke-width: 2.2; }

/* ---------------------------------------------------------------- champs */
.etiquette { display: block; font-weight: 600; font-size: var(--t15); margin: var(--e4) 0 var(--e2); }
.aide { color: var(--encre-2); font-size: var(--t14); }
.erreur { color: var(--erreur); font-size: var(--t14); font-weight: 600; }
.erreur:empty { display: none; }
.erreur:not(:empty) { margin-top: var(--e2); }
input:not([type=radio]), textarea, select { min-height: var(--cible-confort); width: 100%; padding: var(--e2) var(--e3); border: 1px solid var(--bord-champ); border-radius: var(--r10); background: var(--papier); font-size: var(--t16); transition: border-color var(--d-entree) ease; }
textarea { min-height: 112px; resize: vertical; }
[aria-invalid="true"] { border-color: var(--erreur) !important; box-shadow: 0 0 0 1px var(--erreur); }
.champ-euro { position: relative; display: block; max-width: 240px; }
.champ-euro input { padding-right: 36px; font-size: var(--t18); font-weight: 600; }
.champ-euro span { position: absolute; right: var(--e3); top: 50%; transform: translateY(-50%); color: var(--encre-2); font-weight: 600; }
.champ-recherche { position: relative; display: block; }
.champ-recherche .ico { position: absolute; left: var(--e3); top: 50%; transform: translateY(-50%); color: var(--encre-2); }
.champ-recherche input { padding-left: 42px; }
.choix select { width: auto; min-width: 180px; font-weight: 600; }

/* ---------------------------------------------------------------- mail : reçu, préparé */
.mail { border: 1px solid var(--bord); border-radius: var(--r14); background: var(--papier); overflow: hidden; }
.mail-tete { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); padding: var(--e3) var(--e4); border-bottom: 1px solid var(--bord); background: var(--ocean-voile); }
.mail-titre { display: flex; align-items: center; gap: var(--e2); font-size: var(--t14); font-weight: 600; color: var(--encre-2); min-width: 0; }
.mail-titre .ico { width: 18px; height: 18px; }
.adr { display: grid; gap: var(--e1); padding: var(--e3) var(--e4); border-bottom: 1px solid var(--bord); font-size: var(--t14); }
.adr div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--e2); }
.adr dt { color: var(--encre-2); }
.adr dd { font-weight: 600; overflow-wrap: anywhere; }
.message { padding: var(--e4) var(--e4) var(--e2); font-size: var(--t16); line-height: 1.6; overflow-wrap: anywhere; }
.message > div { font-family: var(--police) !important; font-size: var(--t16) !important; color: var(--encre) !important; line-height: 1.6 !important; max-width: 68ch; }
.recu { display: grid; gap: var(--e2); }
.recu-texte { position: relative; max-width: 68ch; padding: var(--e4); border-radius: var(--r14) var(--r14) var(--r14) var(--r6); background: var(--sable-2); white-space: pre-line; overflow-wrap: anywhere; max-height: 11em; overflow: hidden; line-height: 1.6; }
.recu-texte::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4em; background: linear-gradient(rgba(239, 232, 219, 0), var(--sable-2) 85%); }
.recu-texte.ouvert { max-height: none; }
.recu-texte.ouvert::after { display: none; }
.discret { color: var(--encre-2); font-weight: 400; }
.avert { display: flex; gap: var(--e3); align-items: flex-start; padding: var(--e3) var(--e4); border-radius: var(--r10); background: var(--soleil-clair); color: var(--soleil); font-size: var(--t15); }
.avert .ico { margin-top: 2px; }
.avert span { color: var(--encre); }

/* ---------------------------------------------------------------- jauge de remplissage (participants / minimum) */
.jauge { display: grid; gap: 6px; }
.jauge-texte { font-size: var(--t14); color: var(--encre-2); }
.jauge-texte b { color: var(--encre); font-size: var(--t16); }
.jauge.compacte .jauge-texte span::before { content: "· "; color: var(--encre-2); font-weight: 400; }
.jauge:not(.atteint) .jauge-texte span { color: var(--soleil); font-weight: 600; }
.jauge-piste { position: relative; display: block; height: 8px; border-radius: var(--rond); background: var(--sable-2); box-shadow: inset 0 0 0 1px rgba(15, 37, 54, .06); }
.jauge-piste i { position: absolute; inset: 0; border-radius: inherit; background: #C98B1A; transform-origin: left center; }
.jauge.atteint .jauge-piste i { background: var(--lagon); }
.jauge-piste b { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; background: var(--encre); }
.jauge.compacte .jauge-piste { height: 6px; }

/* ---------------------------------------------------------------- liste de contrôle (guide, restaurant, menus) */
.controle { display: grid; gap: var(--e2); }
.controle li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2) var(--e3); padding: var(--e3) var(--e4); border-radius: var(--r10); background: var(--papier); border: 1px solid var(--bord); }
.controle .etat { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; }
.controle .etat .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.controle .bon .etat { background: var(--vert-clair); color: var(--vert); }
.controle .manque .etat { background: var(--corail-clair); color: var(--corail); }
.controle .info .etat { background: var(--soleil-clair); color: var(--soleil); }
.controle-texte { flex: 1 1 160px; font-weight: 600; }

.statuts { display: flex; flex-wrap: wrap; gap: var(--e1) var(--e4); }
.statut { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t14); color: var(--encre-2); }
.statut .ico { width: 16px; height: 16px; stroke-width: 2.4; }
.statut.bon .ico { color: var(--vert); } .statut.manque .ico { color: var(--corail); } .statut.info .ico { color: var(--soleil); }
.statut-nom { color: var(--encre); font-weight: 600; }

/* ---------------------------------------------------------------- fenêtres : centre (feuille du bas sur téléphone) et tiroir */
dialog { border: 0; padding: 0; color: var(--encre); background: var(--papier); overscroll-behavior: contain; box-shadow: var(--ombre-3);
  width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: var(--r20) var(--r20) 0 0;
  opacity: 0; transform: translateY(24px); transition: opacity var(--d-sortie) var(--ease-out), transform var(--d-sortie) var(--ease-out), overlay var(--d-sortie) allow-discrete, display var(--d-sortie) allow-discrete; }
dialog.tiroir { height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
dialog[open] { opacity: 1; transform: none; transition-duration: var(--d-entree); transition-timing-function: var(--ease-tiroir); }
dialog:not([open]) { pointer-events: none; }
dialog::backdrop { background: rgba(15, 37, 54, .45); opacity: 0; transition: opacity var(--d-sortie) var(--ease-out), overlay var(--d-sortie) allow-discrete, display var(--d-sortie) allow-discrete; }
dialog[open]::backdrop { opacity: 1; transition-duration: var(--d-entree); }
@starting-style { dialog[open] { opacity: 0; transform: translateY(24px); } dialog[open]::backdrop { opacity: 0; } }
dialog.instantane, dialog.instantane::backdrop { transition: none; }
.dlg { padding: var(--e5) var(--e5) calc(var(--e5) + var(--bas-sur)); display: grid; gap: var(--e3); }
.dlg > .fermer-x { position: sticky; top: 0; z-index: 1; justify-self: end; margin: calc(-1 * var(--e2)) calc(-1 * var(--e2)) calc(-1 * var(--cible) - var(--e1)) 0; }
#fenetre-titre { font-size: var(--t22); line-height: 1.25; padding-right: var(--e10); }
#fenetre-titre:focus { outline: none; }
.meta { color: var(--encre-2); font-size: var(--t14); overflow-wrap: anywhere; }
.sous-titre { margin-top: var(--e3); font-size: var(--t13); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-2); }
.actions { display: flex; flex-wrap: wrap; gap: var(--e3); margin-top: var(--e3); }
.dlg .actions { position: sticky; bottom: calc(-1 * var(--e5) - var(--bas-sur)); margin: var(--e3) calc(-1 * var(--e5)) calc(-1 * var(--e5) - var(--bas-sur)); padding: var(--e3) var(--e5) calc(var(--e3) + var(--bas-sur)); background: var(--papier); border-top: 1px solid var(--bord); }
.dlg .actions .btn { flex: 1 1 auto; }
.fermer-x { display: grid; place-items: center; width: var(--cible); height: var(--cible); border: 0; border-radius: 50%; background: var(--sable); color: var(--encre); transition: background-color var(--d-entree) ease, transform var(--d-appui) var(--ease-out); }
.editeur { border: 1px solid var(--bord-champ); border-radius: var(--r10); min-height: 220px; max-height: 50dvh; overflow: auto; }
.editeur:focus-visible { outline-offset: 0; }
.coches { display: grid; gap: var(--e1); max-height: 38dvh; overflow: auto; margin: var(--e2) 0; padding: var(--e1); border: 1px solid var(--bord); border-radius: var(--r10); }
.coches label { display: flex; gap: var(--e3); align-items: center; min-height: 56px; padding: var(--e2) var(--e3); border-radius: var(--r6); cursor: pointer; }
.coches label > span { display: grid; }
.coches input { width: 20px; height: 20px; accent-color: var(--ocean); flex: none; }
.coches label:has(input:checked) { background: var(--ocean-clair); }
.sans-cadre { border: 0; padding: 0; margin: 0; min-width: 0; }
.noms-confirmation { display: grid; gap: var(--e1); max-height: 40dvh; overflow: auto; padding: var(--e3) var(--e4); border-radius: var(--r10); background: var(--sable); font-weight: 600; }
.noms-confirmation li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 var(--e3) 2px 0; border-radius: 50%; background: var(--ocean); }
.proposition { display: grid; gap: var(--e3); padding: var(--e4); border-radius: var(--r14); background: var(--ocean-voile); border: 1px solid var(--ocean-clair); }
.proposition-titre { display: flex; gap: var(--e2); align-items: center; font-size: var(--t16); }
.proposition-titre .ico { color: var(--ocean); }
.chiffres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--e3); }
.chiffres dt { color: var(--encre-2); font-size: var(--t13); }
.chiffres dd { font-weight: 700; font-size: var(--t18); font-variant-numeric: tabular-nums; }

@media (min-width: 768px) {
  dialog { width: min(640px, calc(100% - 48px)); margin: auto; border-radius: var(--r20); max-height: calc(100dvh - 64px); transform: scale(0.96); }
  @starting-style { dialog[open] { opacity: 0; transform: scale(0.96); } }
  dialog.tiroir { width: min(600px, calc(100% - var(--e10))); height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border-radius: var(--r20) 0 0 var(--r20); transform: translateX(32px); }
  dialog.tiroir[open] { transform: none; transition-duration: var(--d-tiroir); }
  @starting-style { dialog.tiroir[open] { opacity: 0; transform: translateX(32px); } }
  .dlg { padding: var(--e8); gap: var(--e4); }
  .dlg .actions { bottom: calc(-1 * var(--e8)); margin: var(--e4) calc(-1 * var(--e8)) calc(-1 * var(--e8)); padding: var(--e4) var(--e8); justify-content: flex-end; }
  .dlg .actions .btn { flex: 0 1 auto; }
}

/* ---------------------------------------------------------------- message en bas d'écran (au-dessus de la barre du bas) */
.toast { position: fixed; z-index: 40; left: calc(var(--nav-gauche) + var(--e4)); right: var(--e4); bottom: calc(var(--nav-bas) + var(--bas-sur) + var(--e3)); margin-inline: auto; max-width: 520px; display: flex; align-items: center; gap: var(--e3); padding: var(--e2) var(--e2) var(--e2) var(--e4); border-radius: var(--r14); background: var(--encre); color: #fff; font-weight: 500; box-shadow: var(--ombre-3);
  opacity: 0; visibility: hidden; transform: translateY(16px); transition: opacity var(--d-sortie) var(--ease-out), transform var(--d-sortie) var(--ease-out), visibility 0s var(--d-sortie); }
.toast.vu { opacity: 1; visibility: visible; transform: none; transition: opacity var(--d-entree) var(--ease-out), transform var(--d-entree) var(--ease-out), visibility 0s; }
.toast.instantane, .toast.instantane.vu { transition: none; }
.toast span { flex: 1; }
.toast button { flex: none; min-height: var(--cible); padding: 0 var(--e4); border: 1px solid rgba(255, 255, 255, .5); border-radius: var(--r10); background: transparent; color: #fff; font-weight: 600; transition: background-color var(--d-entree) ease, transform var(--d-appui) var(--ease-out); }
.toast :focus-visible { outline-color: #fff; }
body.detail-mobile .toast { bottom: calc(80px + var(--nav-bas) + var(--bas-sur) + var(--e3)); }
@media (min-width: 768px) { .toast { bottom: var(--e6); } body.detail-mobile .toast { bottom: calc(88px + var(--e3)); } }
/* PC : la boîte a sa barre d'actions en bas du détail ; le message se pose au-dessus pour ne jamais la cacher. */
@media (min-width: 1024px) { body[data-vue="boite"] .toast { bottom: calc(88px + var(--e4)); } }

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not([disabled]) { background: var(--ocean-voile); border-color: var(--bord-champ); }
  .btn.plein:hover:not([disabled]) { background: var(--ocean-fonce); border-color: var(--ocean-fonce); }
  .lien:hover { color: var(--ocean-fonce); text-decoration-thickness: 2px; }
  .filtre:hover:not([aria-pressed="true"]) { border-color: var(--bord-champ); }
  .fermer-x:hover { background: var(--sable-2); }
  .toast button:hover { background: rgba(255, 255, 255, .12); }
  .coches label:hover { background: var(--ocean-voile); }
}
