/* =====================================================================
   Langage de mouvement et unification visuelle des trois applis (Bureau, terrain, Mes RDV)
   Décision de Kenji du 06/11/2026 (20 h 20), retour de Grok « Détails Apple ». Règles : docs/charte-interface.md § 11.
   Chargé juste après styles.css : les autres feuilles lisent ces jetons ; les règles d'unification en bas de fichier
   l'emportent par une spécificité légèrement plus forte (préfixe html) ; !important seulement pour le mouvement réduit
   et l'absence de flou sur les cartes et sur appareil modeste.
   On n'anime que transform et opacity. Jamais : listes qui défilent (sauf tirer-pour-rafraîchir), données qui changent
   souvent, écrans de réglages.
   ===================================================================== */
:root{
  /* Durées */
  --duree-courte:100ms;      /* pression, survol, petits retours (80–120) */
  --duree-normale:280ms;     /* transitions d'écran, feuilles, apparitions */
  --duree-longue:500ms;      /* changements d'ambiance, gros éléments */
  --duree-badge:250ms;       /* pastilles et badges qui apparaissent */
  --duree-succes:400ms;      /* coche de succès */
  --duree-compteur:350ms;    /* défilement d'un nombre */
  --duree-fondu:600ms;       /* « Bonjour » → « Bonsoir » */
  /* Courbes */
  --courbe:cubic-bezier(.2,.8,.2,1);
  --courbe-pression:cubic-bezier(0,0,.2,1); /* ease-out */
  --ressort:cubic-bezier(.34,1.4,.64,1);    /* repli : navigateurs sans linear() */
  /* Rayons et ombres */
  --rayon-petit:10px;--rayon:14px;--rayon-carte:22px;--rayon-feuille:26px;--rayon-pilule:999px;
  --ombre-1:0 1px 2px rgb(20 28 24 / 5%),0 6px 20px rgb(20 28 24 / 6%);
  --ombre-2:0 2px 6px rgb(20 28 24 / 8%),0 16px 40px rgb(20 28 24 / 12%);
  --ombre-bouton:0 1px 1px rgb(20 28 24 / 10%),0 6px 16px rgb(20 28 24 / 14%);
  --ombre-pressee:0 0 0 rgb(20 28 24 / 0%),0 2px 6px rgb(20 28 24 / 12%);
  /* Boutons principaux (mêmes dans les 3 applis) */
  --bouton-hauteur:54px;--bouton-rayon:var(--rayon);--bouton-graisse:650;--bouton-taille:17px;
  --accent-action:#486354;--accent-action-presse:#3b5345;--accent-action-texte:#fff;
  /* Succès et hors réseau */
  --succes:#1d7448;--succes-doux:#ecf7f0;--succes-encre:#135a37;--succes-fort:#1d7448; /* fond sous texte blanc : 5,9:1 */
  --attention:#d0731a;--attention-doux:#fdf2e6;--attention-encre:#8f4a07
}
:root[data-theme=dark]{
  --ombre-1:0 0 0 1px rgb(255 255 255 / 6%);
  --ombre-2:0 0 0 1px rgb(255 255 255 / 8%),0 16px 40px rgb(0 0 0 / 40%);
  --ombre-bouton:0 1px 1px rgb(0 0 0 / 30%),0 6px 16px rgb(0 0 0 / 30%);
  --ombre-pressee:0 0 0 rgb(0 0 0 / 0%),0 2px 6px rgb(0 0 0 / 30%);
  --accent-action:#4f7a61;--accent-action-presse:#436a54;
  --succes:#2b9963;--succes-doux:#122a1d;--succes-encre:#9fe0bb;
  --attention:#f0a24f;--attention-doux:#34240f;--attention-encre:#ffc98f
}
/* Ressort : léger dépassement (≈ 6 %) puis retour, réservé aux succès et badges */
@supports (transition-timing-function:linear(0,1)){
  :root{--ressort:linear(0,.009 1%,.037 2.1%,.142 4.3%,.307 6.9%,.55 10.3%,.783 14.3%,.924 17.6%,1.012 21%,1.054 24.2%,1.064 27.3%,1.056 30.5%,1.027 36%,1.003 42.3%,.994 49.6%,1)}
}
/* Mouvement réduit : aucune animation, aucune transition (l'état final s'affiche directement) */
@media (prefers-reduced-motion:reduce){
  :root{--duree-courte:0s;--duree-normale:0s;--duree-longue:0s;--duree-badge:0s;--duree-succes:0s;--duree-compteur:0s;--duree-fondu:0s}
  *,*::before,*::after{animation-duration:0s!important;animation-delay:0s!important;animation-iteration-count:1!important;transition-duration:0s!important;transition-delay:0s!important;scroll-behavior:auto!important}
}

/* ---------- Bouton qui s'enfonce : gros boutons et boutons principaux des 3 applis ---------- */
html :is(.primary,.mr-principal,.terrain-heros-action,.terrain-envoyer,.terrain-succes-actions>button,.sd-bouton){
  transition:transform var(--duree-courte) var(--courbe-pression),box-shadow var(--duree-courte) var(--courbe-pression),background-color var(--duree-courte) var(--courbe-pression)
}
html :is(.primary,.mr-principal,.terrain-heros-action,.terrain-envoyer,.terrain-succes-actions>button,.sd-bouton):not(:disabled):active{transform:scale(.97);box-shadow:var(--ombre-pressee)}

/* ---------- Unification des boutons principaux (téléphone) : hauteur, rayon, graisse, accent, pressé, désactivé ---------- */
@media (max-width:760px){
  html body :is(.mr-principal,.terrain-envoyer,.terrain-succes-actions>.primary),html #mes-rdv .mr-principal,
  html body.avec-terrain .terrain-succes-actions>.terrain-succes-retour,
  html .avec-terrain #terrain .terrain-heros-action:is(.primary,.est-fini,.est-route),
  html .avec-terrain .terrain-jai-fini .terrain-envoyer{
    min-height:var(--bouton-hauteur);border-radius:var(--bouton-rayon);font-size:var(--bouton-taille);font-weight:var(--bouton-graisse);letter-spacing:-.2px;
    border:1px solid var(--accent-action);background:var(--accent-action);color:var(--accent-action-texte);box-shadow:var(--ombre-bouton)
  }
  html body :is(.mr-principal,.terrain-succes-actions>.primary):not(:disabled):active,html #mes-rdv .mr-principal:not(:disabled):active,
  html body.avec-terrain .terrain-succes-actions>.terrain-succes-retour:not(:disabled):active,
  html .avec-terrain #terrain .terrain-heros-action:is(.primary,.est-fini,.est-route):not(:disabled):active,
  html .avec-terrain .terrain-jai-fini .terrain-envoyer:not(:disabled):active{background:var(--accent-action-presse);border-color:var(--accent-action-presse);box-shadow:var(--ombre-pressee)}
  :root[data-theme=dark] body.avec-terrain #terrain .terrain-heros-action:not(.est-fini){color:var(--accent-action-texte)}
  html body :is(.mr-principal,.terrain-envoyer,.terrain-heros-action,.terrain-succes-actions>.primary):disabled{opacity:.45;cursor:default;box-shadow:none;transform:none}
  html #mes-rdv .mr-principal{padding-inline:14px;white-space:nowrap}
  /* Les autres gros boutons (secondaires) prennent la même hauteur et le même rayon */
  html body .terrain-succes-actions>button,html .avec-terrain #terrain .terrain-heros-liens>button{border-radius:var(--bouton-rayon)}
  html body .terrain-succes-actions>button{min-height:var(--bouton-hauteur);font-size:var(--bouton-taille);font-weight:var(--bouton-graisse)}
}
html .avec-accueil .primary:not(:disabled){box-shadow:var(--ombre-bouton)}

/* ---------- Succès : un seul composant visuel (coche dessinée sur disque vert, ressort léger, 400 ms) ---------- */
.sd-coche{--taille:96px;position:relative;display:grid;place-items:center;flex:none;width:var(--taille);height:var(--taille);border-radius:50%;background:var(--succes);color:#fff;
  box-shadow:0 10px 30px color-mix(in srgb,var(--succes) 35%,transparent);animation:sd-coche-pose var(--duree-succes) var(--ressort) both}
.sd-coche svg{width:56%;height:56%;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;overflow:visible}
.sd-coche svg :is(path,polyline){stroke-dasharray:30;stroke-dashoffset:0;animation:sd-coche-trace var(--duree-succes) var(--courbe) both;animation-delay:calc(var(--duree-succes) * .35)}
.sd-coche.est-attente{background:var(--attention);box-shadow:0 10px 30px color-mix(in srgb,var(--attention) 30%,transparent)}
.sd-coche.est-attente svg :is(path,polyline){animation:none}
.sd-coche-petite{--taille:22px;box-shadow:none}
.sd-coche-petite svg{stroke-width:3.4}
@keyframes sd-coche-pose{from{transform:scale(.5);opacity:0}to{transform:none;opacity:1}}
@keyframes sd-coche-trace{from{stroke-dashoffset:30}to{stroke-dashoffset:0}}
html .terrain-succes .terrain-succes-coche.sd-coche,html .mr-envoye .mr-envoye-rond.sd-coche{animation:sd-coche-pose var(--duree-succes) var(--ressort) both}
html .terrain-succes:not(.est-hors-reseau) .sd-coche svg path,html .mr-envoye .sd-coche svg :is(path,polyline){stroke-dasharray:30;animation:sd-coche-trace var(--duree-succes) var(--courbe) both;animation-delay:calc(var(--duree-succes) * .35)}
/* Terrain « C'est envoyé » et Mes RDV « Relevé envoyé ✓ » : même disque, même fond vert très léger */
html .terrain-succes .terrain-succes-coche.sd-coche{width:96px;height:96px;margin-bottom:28px}
html .terrain-succes .sd-coche .terrain-succes-svg{width:54px;height:54px}
html .mr-envoye .mr-envoye-rond.sd-coche{width:96px;height:96px;background:var(--succes);color:#fff;margin-bottom:12px}
html .mr-envoye .mr-envoye-rond.sd-coche .mr-ico{width:54px;height:54px;stroke-width:2.6}
html body.avec-accueil.avec-mes-rdv:has(.mr-envoye),:root[data-theme] body.avec-accueil.avec-mes-rdv:has(.mr-envoye){background:var(--succes-doux)}
html .mr-envoye h1{color:var(--succes-encre)}
/* Bureau : bulle de confirmation (garder-position.js) et retour d'une action principale */
html .bureau-bulle{width:max-content;max-width:min(560px,calc(100vw - 32px))}
@media (max-width:600px){html body.avec-accueil:not(.avec-terrain):not(.avec-mes-rdv) .bureau-bulle{bottom:calc(92px + env(safe-area-inset-bottom,0px))}}
html .bureau-bulle[data-ton=succes]{display:flex;align-items:center;gap:10px;padding:10px 18px 10px 10px;border-radius:var(--rayon-pilule);background:var(--succes-fort);color:#fff;font-weight:600;box-shadow:var(--ombre-2)}
html .bureau-bulle[data-ton=succes]::before{order:2}
html .bureau-bulle .sd-coche-petite{--taille:28px;background:rgb(255 255 255 / .22);box-shadow:none;order:1}
html .bureau-bulle:not([data-ton=succes]) .sd-coche{display:none}
html .fiche-action-feedback.success{display:flex;align-items:center;gap:10px;background:var(--succes-doux);color:var(--succes-encre);font-weight:600}
html .fiche-action-feedback.success::before{content:'';flex:none;width:22px;height:22px;border-radius:50%;
  background:var(--succes) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/14px no-repeat;
  animation:sd-coche-pose var(--duree-succes) var(--ressort) both}

/* ---------- Pastille « Enregistré » : apparaît 150 ms, reste 1,2 s, disparaît 200 ms ---------- */
.sd-enregistre{position:fixed;z-index:2147482000;display:inline-flex;align-items:center;gap:6px;padding:4px 10px 4px 6px;border-radius:var(--rayon-pilule);background:var(--succes-fort);color:#fff;
  font:600 13px/18px -apple-system,'SF Pro Text',system-ui,sans-serif;box-shadow:var(--ombre-1);pointer-events:none;white-space:nowrap;
  animation:sd-enregistre-entre 150ms var(--courbe) both,sd-enregistre-sort 200ms var(--courbe) 1350ms forwards}
.sd-enregistre::before{content:'';width:16px;height:16px;border-radius:50%;background:rgb(255 255 255 / .22) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/11px no-repeat}
@keyframes sd-enregistre-entre{from{opacity:0;transform:translateY(3px) scale(.92)}}
@keyframes sd-enregistre-sort{to{opacity:0;transform:scale(.96)}}
@media (prefers-reduced-motion:reduce){.sd-enregistre{animation:none}}

/* ---------- Badge qui apparaît (cloche, pastille « Tâches ») : échelle + fondu, ressort 250 ms ---------- */
.sd-badge-arrive{animation:sd-badge var(--duree-badge) var(--ressort) both}
@keyframes sd-badge{from{transform:scale(.3);opacity:0}to{transform:none;opacity:1}}

/* ---------- Compteur animé : le texte réel reste dans la page (lecteurs d'écran, recherche) ; le défilement est dessiné
   par-dessus, en pseudo-élément, le temps de l'animation ---------- */
.sd-compte-anim{position:relative;color:transparent!important;font-variant-numeric:tabular-nums}
.sd-compte-anim::after{content:attr(data-compte-anim);position:absolute;inset:0;padding:inherit;box-sizing:border-box;color:var(--sd-compte-couleur);white-space:inherit;pointer-events:none;text-align:inherit}
:is(.home-a-traiter-lien,.ma-journee-compteur,.rl-compteur>strong,.jp-compteur>strong,.dossiers-categorie-compte,.notification-count,.nav-pastille){font-variant-numeric:tabular-nums}

/* ---------- « Bonjour » → « Bonsoir » : fondu enchaîné (mouvement.js) ---------- */
.sd-fondu{position:relative}
.sd-fondu::after{content:attr(data-fondu-ancien);position:absolute;left:0;top:0;white-space:nowrap;color:var(--sd-fondu-couleur);pointer-events:none}

/* ---------- Hors réseau : même capsule, même icône, même place dans les 3 applis ---------- */
.sd-hors-reseau{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom,0px) + var(--sd-hors-reseau-bas,16px));z-index:2147481000;transform:translateX(-50%);
  display:inline-flex;align-items:center;gap:8px;max-width:calc(100vw - 32px);margin:0;padding:8px 16px 8px 12px;border-radius:var(--rayon-pilule);
  background:color-mix(in srgb,var(--attention-doux) 92%,transparent);color:var(--attention-encre);font:600 14px/20px -apple-system,'SF Pro Text',system-ui,sans-serif;
  box-shadow:0 0 0 1px color-mix(in srgb,var(--attention) 25%,transparent),var(--ombre-2);-webkit-backdrop-filter:blur(20px) saturate(160%);backdrop-filter:blur(20px) saturate(160%);
  animation:sd-hors-reseau-entre var(--duree-normale) var(--courbe) both}
.sd-hors-reseau svg{flex:none;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.sd-hors-reseau span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@keyframes sd-hors-reseau-entre{from{opacity:0;transform:translate(-50%,10px)}}
@media (max-width:600px){body.avec-accueil:not(.avec-terrain):not(.avec-mes-rdv){--sd-hors-reseau-bas:92px}}
body.avec-mes-rdv:has(.mr-bas){--sd-hors-reseau-bas:96px}
/* Dans une fenêtre modale : au-dessus du gros bouton collé en bas (« Envoyer le compte rendu ») */
dialog .sd-hors-reseau{--sd-hors-reseau-bas:92px}

/* ---------- Tirer pour rafraîchir (accueil terrain, Mes RDV, accueil du Bureau sur téléphone) ---------- */
.sd-tirer{position:fixed;left:50%;top:calc(env(safe-area-inset-top,0px) + 6px);z-index:2147480000;display:grid;place-items:center;width:40px;height:40px;margin-left:-20px;border-radius:50%;
  background:rgb(var(--glass-rgb,255 255 255) / .9);color:var(--accent);box-shadow:var(--ombre-2);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);
  opacity:0;transform:translate3d(0,-56px,0);pointer-events:none;will-change:transform,opacity}
.sd-tirer svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.sd-tirer.est-pret{color:var(--succes)}
.sd-tirer.est-actif svg{animation:sd-tourne .8s linear infinite}
.sd-tirer.est-retour{transition:transform var(--duree-normale) var(--ressort),opacity var(--duree-normale) var(--courbe)}
@keyframes sd-tourne{to{transform:rotate(360deg)}}

/* ---------- Transition d'écran : glissement horizontal léger + fondu (mouvement.js, Web Animations) ---------- */
::view-transition-old(root){animation:sd-ecran-sort var(--duree-normale) var(--courbe) both}
::view-transition-new(root){animation:sd-ecran-entre var(--duree-normale) var(--courbe) both}
@keyframes sd-ecran-sort{to{opacity:0}}
@keyframes sd-ecran-entre{from{opacity:0}}

/* =====================================================================
   Verre dépoli : flou (backdrop-filter) seulement sur les en-têtes, barres et fenêtres/feuilles.
   Les cartes passent à un fond semi-opaque sans flou, un peu plus couvrant pour garder le même rendu
   (le réglage Clair / Standard / Teinté reste respecté via --glass-alpha).
   ===================================================================== */
html :is(.home-team-person,.dossier-card,.fiche-hero,.fiche-panel,.fiche-maintenant,.terrain-mission,.terrain-heading,.dossiers-categorie,.dossiers-sous-etape,.fe-root,.ff-root,.pr-root,.home-heading,.home-panel,
  .dossiers-filter select,.dossiers-creation-field input,.dossiers-creation-field textarea,.dossiers-recherche input,.taches-recherche input,.taches-dossier-recherche input,.home-agenda-ouvrir){
  -webkit-backdrop-filter:none!important;backdrop-filter:none!important /* règle absolue : jamais de flou sur une carte */
}
html .avec-accueil:not(.avec-terrain) :is(.home-panel,.dossier-card,.fiche-hero,.fiche-panel){
  background:linear-gradient(135deg,rgb(255 255 255 / .12),transparent 60%),rgb(var(--glass-rgb) / min(1,calc(var(--glass-alpha) + .16)))
}
html .avec-accueil .home-heading{background:linear-gradient(115deg,rgb(var(--glass-rgb) / min(1,calc(var(--glass-alpha) + .16))),var(--soft))}
html .home-team-person,html .terrain-mission,html :is(.fe-root,.ff-root,.pr-root):not(.pr-integre){background:rgb(var(--glass-rgb) / min(1,calc(var(--glass-alpha,.68) + .16)))}
html .dossier-card{background:rgb(var(--glass-rgb) / .84)}
html .fiche-maintenant{background:rgb(var(--glass-rgb) / .88)}
html .home-day>.home-panel{background:rgb(var(--glass-rgb) / .74)}
html #home-agenda .home-agenda-ouvrir{background:rgb(var(--glass-rgb) / .8)}
html :is(.dossiers-filter select,.dossiers-creation-field input,.dossiers-creation-field textarea,.dossiers-recherche input[type=search],.taches-recherche input){background:rgb(var(--glass-rgb) / .78)}
/* Appareil modeste (≤ 4 cœurs ou ≤ 4 Go) ou transparence réduite : plus aucun flou, fonds presque pleins */
html.verre-modeste *,html.verre-modeste *::before,html.verre-modeste *::backdrop{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
html.verre-modeste:not(.verre-barre) .avec-accueil .v2-sidebar::before,html.verre-modeste:not(.verre-barre) .avec-accueil .v2-sidebar::after{display:none}
html.verre-modeste .avec-accueil :is(.v2-sidebar,.v2-dialog),html.verre-modeste .avec-accueil.v2-compact>.topbar,html.verre-modeste :is(.agenda-visuel,.ag-detail,.notifications-centre,.mr-bas,.taches-ouverte,.taches-ouverte-tete,.sd-hors-reseau,.sd-tirer){background-color:var(--surface)}
html.verre-modeste .avec-accueil :is(.v2-sidebar,.v2-dialog),html.verre-modeste .avec-accueil.v2-compact>.topbar,html.verre-modeste :is(.agenda-visuel,.ag-detail,.notifications-centre,.mr-bas){background-image:none}
/* Barre du bas en verre liquide sur iPhone (29/11/2026) : seule exception au repli, deux petits calques de flou */
@media(max-width:600px){
 html.verre-modeste.verre-barre .avec-accueil .v2-sidebar{background-color:transparent}
 html.verre-modeste.verre-barre .avec-accueil .v2-sidebar::before{-webkit-backdrop-filter:blur(1.5px) saturate(1.8) brightness(1.03)!important;backdrop-filter:blur(1.5px) saturate(1.8) brightness(1.03)!important}
 html.verre-modeste.verre-barre .avec-accueil .v2-sidebar::after{-webkit-backdrop-filter:blur(7px) saturate(2.2) brightness(1.14)!important;backdrop-filter:blur(7px) saturate(2.2) brightness(1.14)!important}
 html.verre-modeste.verre-barre .avec-accueil .glass-loupe-bulle{-webkit-backdrop-filter:blur(14px) saturate(2) brightness(1.08)!important;backdrop-filter:blur(14px) saturate(2) brightness(1.08)!important}
}
