:root{--window-chrome-clearance:104px;--window-chrome-clearance-top:46px} /* top : 8px + hauteur 30px + 8px d’écart (.appWindowChrome) */

.appWindowDragRegion{
  position:fixed;
  z-index:9998;
  inset:0 0 auto;
  height:10px;
  -webkit-app-region:drag;
}

.appWindowTitlebarToggle{
  position:fixed;
  z-index:9999;
  top:0;
  right:0;
  left:0;
  width:120px;
  height:10px;
  margin-inline:auto;
  -webkit-app-region:no-drag;
}

.appWindowChrome{
  position:fixed;
  /* Au-dessus de tout plein écran (écran de connexion .cloudAccessShell et bandeau DEV MODE TEST, z-index 10000) :
     fermer, réduire et agrandir la fenêtre doivent rester accessibles dans tous les états. */
  z-index:10001;
  /* Intégrés au cadre : aucune capsule, bordure ni ombre propres (pas d'effet « flottant »). */
  top:8px;
  right:10px;
  display:flex;
  align-items:center;
  gap:2px;
  height:30px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  opacity:1;
  pointer-events:auto;
  -webkit-app-region:no-drag;
}

.appWindowChrome .appWindowChrome__button{
  box-sizing:border-box;
  display:grid;
  place-items:center;
  width:30px;
  min-width:30px;
  max-width:30px;
  height:28px;
  min-height:28px;
  max-height:28px;
  margin:0;
  padding:0;
  border:0;
  border-radius:7px;
  background:color-mix(in srgb,var(--fi-nav) 65%,transparent);
  color:var(--fi-on-action);
  box-shadow:none;
  pointer-events:auto;
  transform:none;
}

/* White glyphs on a bounded navy backing remain legible over every shell surface. */
.appWindowChrome .appWindowChrome__button svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.appWindowChrome__restoreIcon{display:none}
body.window-is-maximized .appWindowChrome__maximizeIcon{display:none}
body.window-is-maximized .appWindowChrome__restoreIcon{display:block}

.appWindowChrome .appWindowChrome__button:hover{background:var(--fi-nav);color:var(--fi-on-action);box-shadow:none;transform:none}
/* Fenêtre maximisée : plus de coins arrondis ni d'espace artificiel. */
body.window-is-maximized:is([data-active-surface="home"],[data-active-surface="dossier"])::before,
body.window-is-maximized:is([data-active-surface="home"],[data-active-surface="dossier"])>.v3-home-sidebar[data-ui="v3"]{border-radius:0}
.appWindowChrome .appWindowChrome__button--close:hover{background:var(--fi-danger);color:#fff}
.appWindowChrome .appWindowChrome__button:focus-visible{outline:2px solid var(--fi-on-action);outline-offset:-2px}


/* Déplacement de la fenêtre (frameless) : avec thickFrame, Windows réserve les premiers pixels du
   haut au redimensionnement — la bande .appWindowDragRegion seule ne permettait presque plus de
   déplacer la fenêtre. Le fond des en-têtes de page joue donc le rôle de barre de titre ; tout
   élément interactif qu'ils contiennent reste cliquable. */
#workspaceHome .homeHero,
#clientWorkspace .dossierIdentityCard,
body:is([data-active-surface="home"],[data-active-surface="dossier"]) .v3-home-sidebar{-webkit-app-region:drag;app-region:drag}
:is(#workspaceHome .homeHero,#clientWorkspace .dossierIdentityCard,.v3-home-sidebar) :is(button,a,input,select,textarea,label,[role="button"],[role="listbox"],[tabindex],[contenteditable],.fi-select-control,.copyableField,.homeSearchResults){-webkit-app-region:no-drag;app-region:no-drag}
/* Une zone -webkit-app-region:drag est résolue par Windows AVANT le DOM, sans tenir compte des calques :
   tant qu'une fenêtre superposée ou un menu est ouvert au-dessus de ces en-têtes, un vrai clic (Fermer,
   fond assombri, clic extérieur d'un menu) devenait un déplacement de fenêtre et n'atteignait jamais
   la page. Le déplacement est donc suspendu pendant ces états. */
body:has(:is(.modalOverlay,.workspaceDataOverlay,.clientPresentationOverlay,.clientPresentationDetailOverlay):not([hidden]),/* Fenêtres natives <dialog> (ex. Demandes de crédit) : leur bouton Fermer survole aussi ces en-têtes. */
dialog[open],/* Menus : seulement ceux réellement ouverts au-dessus de ces zones (un aria-expanded générique resté vrai bloquait le déplacement). */
:is(#salesRepresentativePickerButton,#dealStatusPickerButton)[aria-expanded="true"],.fi-select-control.is-open,.fi-temporal-control.is-open) :is(#workspaceHome .homeHero,#clientWorkspace .dossierIdentityCard,.v3-home-sidebar){-webkit-app-region:no-drag;app-region:no-drag}
