/* =====================================================================================
   Sudoptic — « Motion » (2026-11-08). Chargé en dernier, après diamond-v4.css.
   1. Transitions douces entre les pages · 2. Barre d'ouverture des espaces
   3. Connexion, inscription, récupération chorégraphiées · 4. Ouverture des espaces
   5. Confort visuel · 6. Effets coûteux allégés (rendu identique).
   Tout mouvement s'arrête si le système demande de réduire les animations.
   ===================================================================================== */
html{--m-out:cubic-bezier(.16,1,.3,1);--m-spring:cubic-bezier(.34,1.56,.64,1);--m-in-out:cubic-bezier(.65,0,.35,1);--m-gold:#F6797F;--m-gold-2:#F6797F;--m-ok:#3DDC97}

/* ---------- 1. Transitions entre les pages (navigateurs récents, sans effet ailleurs) ---------- */
@view-transition{navigation:auto}
::view-transition-old(root){animation:m-vt-out .18s var(--m-in-out) both}
::view-transition-new(root){animation:m-vt-in .32s var(--m-out) both}
html.pro .app-sidebar .app-brand{view-transition-name:m-brand}
html.pro .app-topbar{view-transition-name:m-topbar}
html.pro .app-sidebar nav a[aria-current]{view-transition-name:m-active}
::view-transition-group(m-active){animation-duration:.42s;animation-timing-function:var(--m-out)}
@keyframes m-vt-out{to{opacity:0}}
@keyframes m-vt-in{from{opacity:0}}
@media (prefers-reduced-motion:reduce){
 @view-transition{navigation:none}
 ::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}
}

/* ---------- 2. Ouverture sécurisée d'un espace : fine barre dorée si l'attente dépasse 0,25 s ---------- */
html.do-boot::after{content:"";position:fixed;z-index:2147483647;left:0;top:0;width:42%;height:3px;border-radius:0 3px 3px 0;pointer-events:none;
 background:linear-gradient(90deg,transparent,var(--m-gold) 45%,var(--m-gold-2));box-shadow:0 0 14px rgba(246,121,127,.55);opacity:0;
 animation:m-show .2s .25s forwards,m-boot 1.15s var(--m-in-out) .25s infinite}
@keyframes m-show{to{opacity:1}}
@keyframes m-boot{from{transform:translateX(-100%)}to{transform:translateX(240%)}}
@media (prefers-reduced-motion:reduce){html.do-boot::after{width:100%;animation:m-show .2s .4s forwards}}

/* ---------- 3. Connexion, inscription, récupération ---------- */
/* Champs : halo doré au focus, libellé qui s'allume */
html.pro-auth body:not(#_):not(#m) .access-card :is(input:not([type=checkbox]),select){transition:border-color .2s,box-shadow .3s var(--m-out),background-color .2s!important}
html.pro-auth body:not(#_):not(#m) .access-card :is(input:not([type=checkbox]),select):focus{box-shadow:0 0 0 4px rgba(245,123,129,.22),0 10px 26px rgba(0,0,0,.28)!important}
html.pro-auth body:not(#_):not(#m) .access-card label{transition:color .2s}
html.pro-auth body:not(#_):not(#m) .access-card label:has(+ :is(input,select,.password-row):focus-within){color:var(--a-gold,#eb8489)!important}
/* Bouton principal : chargement visible pendant la vérification */
html.pro-auth body:not(#_):not(#m) .access-card :is(button[type=submit],button.primary):disabled{cursor:progress!important;opacity:1!important;filter:none!important}
html.pro-auth body:not(#_):not(#m) .access-card :is(button[type=submit],button.primary):disabled::before{content:""!important;display:inline-block!important;position:static!important;flex:none;width:16px!important;height:16px!important;margin:0 10px 0 0!important;border-radius:50%!important;border:2.5px solid currentColor!important;border-right-color:transparent!important;background:none!important;box-shadow:none!important;transform:none;opacity:.9!important;inset:auto!important;filter:none!important}
html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card :is(button[type=submit],button.primary)::before{display:none!important}
/* Connexion réussie : bouton vert, carte lumineuse, barre « votre espace s'ouvre » */
html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card :is(button[type=submit],button.primary){background:linear-gradient(180deg,#6be8b0,#2fbf83)!important;border-color:#2fbf83!important;color:#06281a!important;-webkit-text-fill-color:#06281a!important;box-shadow:0 10px 28px rgba(47,191,131,.35)!important}
html.pro-auth body.auth-unlocked:not(#_):not(#m) main.access-layout{box-shadow:0 0 0 1px rgba(111,224,176,.45),0 30px 80px rgba(47,191,131,.22)!important;transition:box-shadow .6s var(--m-out)}
html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card>.auth-success-notice{position:relative;overflow:hidden;padding-bottom:12px!important}
html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card>.auth-success-notice::after{content:"";position:absolute;left:0;right:0;bottom:0;height:3px;background:linear-gradient(90deg,#8ff0c4,var(--m-gold));transform-origin:left}
html.pro-auth body:not(#_):not(#m) .success-check{position:relative}

@media (prefers-reduced-motion:no-preference){
 /* Carte : montée douce, puis contenu en cascade */
 html.pro-auth body:not(#_):not(#m) main.access-layout{animation:m-card-in .75s var(--m-out) both!important}
 html.pro-auth body:not(#_):not(#m) .access-story::before{animation:m-up .6s var(--m-out) .18s backwards}
 html.pro-auth body:not(#_):not(#m) .access-story::after{animation:m-up .7s var(--m-out) .26s backwards}
 html.pro-auth body:not(#_):not(#m) .access-story .auth-lock{animation:m-orbit-in 1.4s var(--m-out) .1s backwards,pa-spin 70s linear infinite!important}
 html.pro-auth body:not(#_):not(#m) .access-story li{animation:m-right .55s var(--m-out) backwards!important}
 html.pro-auth body:not(#_):not(#m) .access-story li:nth-child(1){animation-delay:.38s!important}
 html.pro-auth body:not(#_):not(#m) .access-story li:nth-child(2){animation-delay:.46s!important}
 html.pro-auth body:not(#_):not(#m) .access-story li:nth-child(3){animation-delay:.54s!important}
 html.pro-auth body:not(#_):not(#m) .access-card>:not(form),html.pro-auth body:not(#_):not(#m) .access-card form>*{animation:m-up .5s var(--m-out) backwards!important;animation-delay:calc(min(var(--m-i,0),12) * 42ms + 220ms)!important}
 /* Ordre : tampon de marque, surtitre, titre, introduction, champs du formulaire, puis le reste */
 html.pro-auth body:not(#_):not(#m) .access-card>:not(form){--m-i:12}
 html.pro-auth body:not(#_):not(#m) .access-card>.diamond-brand-stamp{--m-i:0}
 html.pro-auth body:not(#_):not(#m) .access-card>.eyebrow{--m-i:1}
 html.pro-auth body:not(#_):not(#m) .access-card>h2{--m-i:2}
 html.pro-auth body:not(#_):not(#m) .access-card>h2+p{--m-i:3}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(1){--m-i:4}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(2){--m-i:5}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(3){--m-i:6}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(4){--m-i:7}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(5){--m-i:8}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(6){--m-i:9}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(7){--m-i:10}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(8){--m-i:11}
 html.pro-auth body:not(#_):not(#m) .access-card form>:nth-child(n+9){--m-i:12}
 /* Message d'erreur qui glisse (le tremblement du formulaire est joué par motion.js) */
 html.pro-auth body:not(#_):not(#m) .access-card [role=alert]:not(:empty){animation:m-alert .4s var(--m-out) backwards!important}
 /* Bouton principal : rotation pendant la vérification (le reflet existant est conservé) */
 html.pro-auth body:not(#_):not(#m) .access-card :is(button[type=submit],button.primary):disabled::before{animation:m-spin .7s linear infinite!important}
 /* Succès de connexion */
 html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card :is(button[type=submit],button.primary){animation:m-pop .5s var(--m-spring) both!important}
 html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card>.auth-success-notice{animation:m-up .4s var(--m-out) backwards!important;animation-delay:0s!important}
 html.pro-auth body.auth-unlocked:not(#_):not(#m) .access-card>.auth-success-notice::after{animation:m-progress 1.2s linear both}
 /* Succès d'inscription : coche qui rebondit, onde, texte en cascade */
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden]){animation:m-up .55s var(--m-out) backwards!important;animation-delay:0s!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden])>*{animation:m-up .5s var(--m-out) backwards!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden])>:nth-child(2){animation-delay:.18s!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden])>:nth-child(3){animation-delay:.26s!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden])>:nth-child(4){animation-delay:.34s!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden])>:nth-child(n+5){animation-delay:.42s!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden]) .success-check{animation:m-check .75s var(--m-spring) .08s both!important}
 html.pro-auth body:not(#_):not(#m) #access-success:not([hidden]) .success-check::after{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid #8ff0c4;pointer-events:none;animation:m-ring 1.5s var(--m-out) .35s both}
 /* Récupération d'accès */
 html.pro-auth body:not(#_):not(#m) main.compact>header{animation:m-up .5s var(--m-out) backwards}
 html.pro-auth body:not(#_):not(#m) main.compact .panel{animation:m-card-in .7s var(--m-out) .06s backwards!important}
 html.pro-auth body:not(#_):not(#m) main.compact .panel>*{animation:m-up .5s var(--m-out) backwards!important;animation-delay:calc(var(--m-i,0) * 55ms + 220ms)!important}
 html.pro-auth body:not(#_):not(#m) main.compact .panel>:nth-child(2){--m-i:1}
 html.pro-auth body:not(#_):not(#m) main.compact .panel>:nth-child(3){--m-i:2}
 html.pro-auth body:not(#_):not(#m) main.compact .panel>:nth-child(n+4){--m-i:3}
 html.pro-auth body:not(#_):not(#m) main.compact #result:not(:empty){animation:m-alert .4s var(--m-out) backwards!important}
}

/* ---------- 4. Espaces : ouverture fluide, premier accès chorégraphié ---------- */
@media (prefers-reduced-motion:no-preference){
 /* Le contenu apparaît au moment où l'espace s'affiche (et non pendant la vérification invisible) */
 html.pro:not(.do-boot) body.application:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) main{animation:m-page .45s var(--m-out) both}
 /* Pages client (suivi de commande, propositions) : blocs en cascade */
 html.pro body:not(.application):not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) main>*{animation:m-up .55s var(--m-out) backwards}
 html.pro body:not(.application):not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) main>:nth-child(2){animation-delay:.07s}
 html.pro body:not(.application):not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) main>:nth-child(3){animation-delay:.14s}
 html.pro body:not(.application):not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) main>:nth-child(4){animation-delay:.21s}
 html.pro body:not(.application):not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) main>:nth-child(n+5){animation-delay:.28s}
 /* Première ouverture après la connexion : la barre latérale se compose */
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar .app-brand{animation:m-brand-in .7s var(--m-spring) both}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar :is(.app-role,.app-sidebar-bottom){animation:m-up .5s var(--m-out) .12s backwards}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a{animation:m-right .5s var(--m-out) backwards;animation-delay:calc(var(--m-n,0) * 38ms + 160ms)}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(2){--m-n:1}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(3){--m-n:2}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(4){--m-n:3}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(5){--m-n:4}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(6){--m-n:5}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(7){--m-n:6}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(8){--m-n:7}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(9){--m-n:8}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(10){--m-n:9}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(11){--m-n:10}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(12){--m-n:11}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar nav a:nth-child(n+13){--m-n:12}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-topbar{animation:m-drop .5s var(--m-out) .08s backwards}
 html.m-intro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-bottom-nav{animation:m-rise .5s var(--m-out) .2s backwards}
}

/* ---------- 5. Confort visuel pour tous ---------- */
html.pro,html.pro-auth{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
html.pro body:not(#_) main :is(h1,h2,h3),html.pro-auth body:not(#_) :is(h1,h2){text-wrap:balance}
html.pro body:not(#_) main :is(p,li),html.pro-auth body:not(#_) :is(p,li){text-wrap:pretty}
html.pro body:not(#_) main a:not([class]){text-underline-offset:.2em}
html.pro{scroll-padding-top:84px}
@media (prefers-reduced-motion:no-preference){html.pro,html.pro-auth{scroll-behavior:smooth}}
/* Téléphones : champs à 16 px pour éviter le zoom automatique à la saisie */
@media (max-width:760px){
 html.pro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) :is(main,dialog) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea){font-size:16px!important}
 html.pro-auth body:not(#_):not(#m) :is(.access-card,main.compact) :is(input:not([type=checkbox]):not(#access-code),select){font-size:16px!important}
}
@media (prefers-reduced-transparency:reduce){html.pro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-topbar{backdrop-filter:none!important;background:var(--v-bg)!important}}

/* ---------- 6. Fluidité : effets coûteux allégés, rendu identique ---------- */
/* Le fond « aurore » est déjà un dégradé doux : le flou de 70 px recalculé à chaque image est inutile */
html.pro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m)::before,html.pro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m)::after{filter:none!important}
/* Barre latérale opaque : le flou d'arrière-plan ne se voit pas mais coûte à chaque défilement */
html.pro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-sidebar{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
@media (max-width:760px){html.pro body:not(#_):not(#v6):not(#v6b):not(#v6c):not(#m) .app-topbar{backdrop-filter:blur(8px)!important}}

@keyframes m-card-in{from{opacity:0;transform:translateY(22px) scale(.975)}to{opacity:1;transform:none}}
@keyframes m-up{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@keyframes m-right{from{opacity:0;transform:translateX(-12px)}to{opacity:1;transform:none}}
@keyframes m-orbit-in{from{opacity:0;scale:.55}}
@keyframes m-alert{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
@keyframes m-pop{0%{transform:scale(1)}40%{transform:scale(1.045)}100%{transform:scale(1)}}
@keyframes m-check{0%{opacity:0;transform:scale(.3) rotate(-30deg)}60%{opacity:1;transform:scale(1.14) rotate(5deg)}100%{opacity:1;transform:none}}
@keyframes m-ring{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(1.9)}}
@keyframes m-spin{to{transform:rotate(360deg)}}
@keyframes m-progress{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes m-page{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes m-brand-in{from{opacity:0;transform:scale(.85)}to{opacity:1;transform:none}}
@keyframes m-drop{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:none}}
@keyframes m-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
