/* V5 · SURFACES FLOTTANTES — menus et popovers, notification, palette de commandes (Ctrl+K), feuilles.
   Menus et popovers reprennent les surfaces calmes de Claude / ChatGPT : fond neutre, lignes compactes, survol discret.
   Les détails clavier (coche à gauche, raccourci à droite) restent empruntés à macOS. Concernés : menu « … », clic droit
   (js/menu-contexte.js), listes déroulantes (js/pc-ui.js), menus V5 (js/v5/ui.js). */

/* ------------------------------------------------------------------ menus */
.menu-contexte.pc, .sel-menu, .v5-menu{
  position: fixed; z-index: 10040; box-sizing: border-box; min-width: 180px; max-width: 340px; max-height: calc(100vh - 24px); overflow-y: auto;
  padding: 5px; border: 0; border-radius: var(--v5-r-menu);
  background: var(--v5-surface-elevee); color: var(--v5-texte); box-shadow: var(--v5-ombre-menu);
  font: var(--v5-g-moyen) var(--v5-t-13)/16px var(--v5-police);
  animation: v5-surgit 120ms var(--v5-courbe); transform-origin: var(--v5-origine, top left);
}
.menu-contexte.pc::-webkit-scrollbar, .sel-menu::-webkit-scrollbar, .v5-menu::-webkit-scrollbar{ display: none; }
@supports not selector(::-webkit-scrollbar){ .menu-contexte.pc, .sel-menu, .v5-menu{ scrollbar-width: none; } }
.sel-menu[hidden]{ display: none; }
.v5-menu:focus{ outline: none; }
@keyframes v5-apparait{ from{ opacity: 0; } }
/* 03/11 · Claude Desktop : menus et popovers grandissent depuis leur bouton (98 % → 100 %, origine posée par V5.menu) */
@keyframes v5-surgit{ from{ opacity: 0; scale: .98; } }
@media (prefers-reduced-motion: reduce){ .menu-contexte.pc, .sel-menu, .v5-menu, .v5-popover{ animation-name: v5-apparait; } }

.menu-contexte.pc .mc-item, .sel-menu .sel-item, .v5-menu-item{
  display: flex; align-items: center; gap: 7px; box-sizing: border-box; width: 100%; height: var(--v5-ligne-s); min-height: var(--v5-ligne-s); padding: 0 11px; margin: 0;
  border: 0; border-radius: var(--v5-r-sel); background: none; color: var(--v5-texte); text-align: left; white-space: nowrap;
  font: inherit; cursor: default; outline: none;
}
/* Survol neutre (Claude / ChatGPT) : le violet reste réservé aux actions et aux liens. */
.menu-contexte.pc .mc-item:hover, .menu-contexte.pc .mc-item:focus-visible,
.sel-menu .sel-item:hover, .sel-menu .sel-item:focus-visible, .sel-menu .sel-item.actif,
.v5-menu-item:hover, .v5-menu-item:focus{
  background: var(--v5-survol); color: var(--v5-texte);
}
/* Le focus clavier reste net sans transformer le menu en bandeau violet. */
.menu-contexte.pc .mc-item:focus-visible, .sel-menu .sel-item:focus-visible,
.v5-menu-item:focus-visible{
  outline: var(--v5-focus-l) solid var(--v5-focus); outline-offset: -3px;
}
.menu-contexte.pc .mc-ic, .v5-menu-ic{ display: inline-flex; width: 16px; height: 16px; color: var(--v5-texte); flex: none; }
.menu-contexte.pc .mc-ic:empty{ display: none; }
.menu-contexte.pc .mc-ic svg, .v5-menu-ic svg{ width: 16px; height: 16px; }
.menu-contexte.pc .mc-lbl, .v5-menu-lib{ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.menu-contexte.pc .mc-raccourci, .v5-menu-raccourci{ margin-left: 20px; font-size: var(--v5-t-13); color: var(--v5-texte-3); }
.menu-contexte.pc .mc-item.danger, .v5-menu-item.danger{ color: var(--v5-rouge); }
.menu-contexte.pc .mc-item.danger .mc-ic, .v5-menu-item.danger .v5-menu-ic{ color: var(--v5-rouge); }
.menu-contexte.pc .mc-sep, .v5-menu-sep{ height: 1px; margin: 5px 11px; background: var(--v5-rempli-1); }
.menu-contexte.pc .mc-titre, .v5-menu-titre{ display: flex; align-items: center; height: var(--v5-ligne-s); padding: 0 11px; font-size: var(--v5-t-13); font-weight: var(--v5-g-gras); color: var(--v5-texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* coche à gauche : la colonne de 12 px est réservée à tous les éléments d'un menu à coches */
.sel-menu .sel-item .sel-check, .v5-menu-item .v5-coche{ order: -1; flex: none; width: 12px; height: 12px; margin: 0 1px 0 -2px; color: var(--v5-texte); visibility: hidden; }
.sel-menu .sel-item.selectionne .sel-check, .v5-menu-item[aria-checked="true"] .v5-coche{ visibility: visible; }
.v5-menu-item:disabled{ color: var(--v5-texte-inactif); --v5-texte: var(--v5-texte-inactif); pointer-events: none; }
.sel-menu .sel-item.desactive{ color: var(--v5-texte-inactif); pointer-events: none; }
.sel-menu .sel-item:not(.selectionne){ padding-left: 29px; }   /* colonne de la coche réservée à tous les éléments (seul l'élément choisi porte la coche) */
.v5-menu-item .v5-compteur{ margin-left: auto; font-size: var(--v5-t-13); }
.v5-menu-item .v5-point{ margin: 0 2px; }
.mc-overlay:not(.tactile){ position: fixed; inset: 0; z-index: 10039; background: transparent; }

/* ------------------------------------------------------------------ popover : r20, surface neutre, ombre portée douce */
.v5-popover{
  position: fixed; z-index: 10040; box-sizing: border-box; min-width: 220px; max-width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
  padding: 14px; border-radius: var(--v5-r-popover);
  background: var(--v5-surface-elevee);
  color: var(--v5-texte); box-shadow: var(--v5-ombre-popover);
  font: var(--v5-g-normal) var(--v5-t-13)/16px var(--v5-police);
  animation: v5-surgit 120ms var(--v5-courbe); transform-origin: var(--v5-origine, top left);
}

/* ------------------------------------------------------------------ notification éphémère : #app-toast (js/core.js, notifier()) — le seul système de toast.
   Surface solide et calme, avec un signal d'état clair ; la position et l'apparition restent celles de la feuille d'origine. */
html.v5 .app-toast{
  padding: 9px 16px; border-radius: var(--v5-r-popover); border: 0;
  background: var(--v5-surface-elevee); color: var(--v5-texte); box-shadow: var(--v5-ombre-popover);
  font: var(--v5-g-moyen) var(--v5-t-13)/16px var(--v5-police);
}
html.v5 .app-toast[data-resultat="ok"], html.v5 .app-toast[data-resultat="erreur"]{ display: inline-flex; align-items: center; gap: 8px; }
html.v5 .app-toast[data-resultat="ok"]::before{
  content: ""; flex: none; width: 14px; height: 14px; background: var(--v5-vert);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
html.v5 .app-toast[data-resultat="erreur"]::before{ content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--v5-rouge-plein); }
/* 22/10 (Lucas, d'après Notion) : la bulle n'est plus un petit texte en bas, mais une carte posée en haut au centre, avec un filet
   et une ombre douce. Une action en cours (message en « … ») a une petite roue à droite, comme « En route vers votre espace de travail… ». */
html.v5 .app-toast{
  top: 64px; bottom: auto; transform: translate(-50%, -8px); max-width: min(520px, 88vw);
  padding: 12px 16px; border-radius: var(--v5-r-fenetre); background: var(--v5-surface-elevee);
  box-shadow: 0 0 0 1px var(--v5-separateur-fort), var(--v5-ombre-popover);
  font: var(--v5-g-normal) var(--v5-t-13)/18px var(--v5-police); text-align: left;
}
html.v5 .app-toast.visible{ transform: translate(-50%, 0); }
html.v5 .app-toast[data-resultat="cours"]{ display: inline-flex; align-items: center; gap: 12px; }
html.v5 .app-toast[data-resultat="cours"]::after{
  content: ""; flex: none; box-sizing: border-box; width: 14px; height: 14px; border-radius: 50%;
  border: 1.6px solid var(--v5-texte-3); border-top-color: transparent; animation: v5-bulle-roue .8s linear infinite;
}
@keyframes v5-bulle-roue{ to{ transform: rotate(360deg); } }
html.v5 .status-line.statut-en-bulle{ visibility: hidden; }
@media (prefers-reduced-motion: reduce){ html.v5 .app-toast[data-resultat="cours"]::after{ animation: none; } }

/* ------------------------------------------------------------------ palette de commandes (recherche globale, façon Spotlight) */
.pal-fond{
  position: fixed; inset: 0; z-index: 10030; display: flex; justify-content: center; align-items: flex-start;
  padding-top: 14vh; background: var(--v5-voile); font-family: var(--v5-police);
  animation: v5-fondu 120ms ease-out;
}
.pal-fond[hidden]{ display: none; }
@keyframes v5-fondu{ from{ opacity: 0; } }
.pal-colonne{ width: min(640px, calc(100vw - 48px)); }
.pal-modes{ display: none; }
.pal{
  display: flex; flex-direction: column; max-height: min(560px, 72vh); overflow: hidden;
  border: 1px solid var(--v5-separateur); border-radius: var(--v5-r-popover); background: var(--v5-surface-elevee); color: var(--v5-texte);
  box-shadow: var(--v5-ombre-fenetre); animation: v5-apparait 140ms ease-out;
}
.pal-tete{ display: flex; align-items: center; gap: 10px; flex: none; height: 52px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--v5-rempli-1); }
.pal-tete .pal-champ{ flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: none; outline: none; box-shadow: none; font: var(--v5-g-normal) var(--v5-t-17) var(--v5-police); color: var(--v5-texte); }
.pal-tete .pal-champ::placeholder{ color: var(--v5-texte-3); }
.pal-fermer{ width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--v5-texte-3); cursor: default; }
.pal-fermer:hover{ background: var(--v5-survol); color: var(--v5-texte); }
.pal-filtres{ display: flex; flex: none; gap: 4px; padding: 8px 12px 0; }
.pal-filtre{ height: 24px; padding: 0 10px; border: 0; border-radius: var(--v5-r-ctrl); background: none; font: var(--v5-g-moyen) var(--v5-t-12) var(--v5-police); color: var(--v5-texte-2); cursor: default; }
.pal-filtre:hover{ background: var(--v5-survol); color: var(--v5-texte); }
.pal-filtre.actif{ background: var(--v5-bouton); color: var(--v5-texte); }
/* 15/10 (Lucas) : dans la recherche, pas de piste en capsule collée aux bords de la fenêtre. Filtres en texte, seul le choix actif garde sa tuile
   arrondie (Spotlight, Raycast). Sélecteur renforcé pour passer devant la recette commune des segmentés (css/v5/formes.css). */
html.v5 .pal .pal-filtres.pal-filtres{ width: auto; height: 28px; margin: 10px 14px 2px; padding: 0; gap: 2px; background: none; overflow-x: auto; scrollbar-width: none; }
html.v5 .pal .pal-filtres.pal-filtres::-webkit-scrollbar{ display: none; }
html.v5 .pal .pal-filtres.pal-filtres > .pal-filtre{ flex: none; padding: 0 10px; font-size: var(--v5-t-13); }
.pal-liste{ flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 8px; }
.pal-section{ padding: 10px 10px 4px; font-size: var(--v5-t-11); font-weight: var(--v5-g-gras); color: var(--v5-texte-3); }
.pal-item{ display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 10px; border-radius: var(--v5-r-sel); cursor: default; }
.pal-item[aria-selected="true"]{ background: var(--v5-selection); }
.pal-vignette{ width: 28px; height: 28px; flex: none; object-fit: cover; border-radius: var(--v5-r-mini); background: var(--v5-rempli-3); }
.pal-ic{ display: grid; place-items: center; width: 28px; height: 28px; flex: none; color: var(--v5-texte-2); }
.pal-ic svg{ width: 16px; height: 16px; }
.pal-txt{ flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pal-nom{ font-size: var(--v5-t-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-sub{ font-size: var(--v5-t-12); color: var(--v5-texte-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-mark{ background: none; color: inherit; font-weight: var(--v5-g-fort); }
.pal-plus, .pal-entrer{ display: none; flex: none; width: 24px; height: 24px; place-items: center; border: 0; border-radius: var(--v5-r-ctrl); background: none; color: var(--v5-texte-3); }
.pal-item[aria-selected="true"] .pal-entrer, .pal-item[aria-selected="true"] .pal-plus{ display: grid; }
.pal-plus:hover{ background: var(--v5-presse); color: var(--v5-texte); }
.pal-vide{ padding: 36px 16px; text-align: center; color: var(--v5-texte-3); }
.pal-pied{ display: flex; flex: none; gap: 16px; height: 34px; align-items: center; padding: 0 16px; border-top: 1px solid var(--v5-rempli-1); font-size: var(--v5-t-12); color: var(--v5-texte-3); }
.pal-pied kbd{ margin-left: 4px; padding: 1px 5px; border-radius: var(--v5-r-mini); font: var(--v5-g-moyen) var(--v5-t-11) var(--v5-police); background: var(--v5-rempli-2); }

/* ------------------------------------------------------------------ feuille V5 (confirmation longue, petit formulaire) : fenêtre r16 */
.v5-voile{ position: fixed; inset: 0; z-index: 10020; display: grid; place-items: center; background: var(--v5-voile); animation: v5-fondu 140ms ease-out; }
.v5-dialogue{
  box-sizing: border-box; width: min(420px, calc(100vw - 48px)); max-height: calc(100vh - 80px); overflow: auto;
  padding: 20px; border-radius: var(--v5-r-fenetre); background: var(--v5-surface-elevee); color: var(--v5-texte);
  box-shadow: var(--v5-ombre-fenetre); font-family: var(--v5-police); animation: v5-feuille var(--v5-duree-feuille) var(--v5-courbe);
}
@keyframes v5-feuille{ from{ opacity: 0; transform: translateY(-8px) scale(.985); } }
.v5-dialogue{ position: relative; }
.v5-dialogue-fermer{ position: absolute; top: 14px; right: 14px; }
.v5-dialogue-titre{ padding-right: 32px; }
.v5-dialogue-titre{ margin: 0 0 6px; font-size: var(--v5-t-15); font-weight: var(--v5-g-fort); line-height: var(--v5-i-15); }
.v5-dialogue-texte{ margin: 0; font-size: var(--v5-t-13); line-height: 1.45; color: var(--v5-texte-2); }
.v5-dialogue-actions{ display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.v5-dialogue-actions .v5-btn{ height: var(--v5-ctrl-l); min-width: 76px; padding: 0 16px; border-radius: var(--v5-r-bouton); }

/* ------------------------------------------------------------------ rectangle de sélection à la souris (js/v5/lasso.js) : comme dans le Finder */
.v5-lasso{
  position: fixed; z-index: 10010; pointer-events: none; box-sizing: border-box; border-radius: 2px;
  background: var(--v5-lasso-fond); box-shadow: inset 0 0 0 1px var(--v5-lasso-bord);
}
/* variante « dessous » (Fiches) : le rectangle est dans la zone, derrière les photos */
.v5-lasso.v5-lasso-dessous{ position: absolute; z-index: 0; }
html.v5-lasso-actif, html.v5-lasso-actif *{ user-select: none; -webkit-user-select: none; cursor: default; }

/* ------------------------------------------------------------------ contraste élevé Windows (forced-colors)
   Les fonds d'auteur ne sont pas rendus : l'élément de menu survolé ou atteint au clavier, l'élément choisi de la palette
   et le rectangle de sélection deviennent de vrais contours aux couleurs du système. */
@media (forced-colors: active){
  .menu-contexte.pc .mc-item:hover, .menu-contexte.pc .mc-item:focus-visible, .sel-menu .sel-item:hover, .sel-menu .sel-item:focus-visible, .sel-menu .sel-item.actif,
  .v5-menu-item:focus, .pal-item[aria-selected="true"]{
    outline: var(--v5-focus-l) solid Highlight; outline-offset: -3px; box-shadow: none;
  }
  .menu-contexte.pc, .sel-menu, .v5-menu, .v5-popover, .v5-dialogue, .v5-alerte, .pal{ outline: 1px solid CanvasText; }
  .v5-lasso{ outline: 1px solid Highlight; }
}

/* le nom d’un élément de menu ne cède jamais sa place : c’est la précision de droite qui se coupe (11/10 : un texte long à droite faisait disparaître le nom) */
.v5-menu-lib{ flex: 1 0 auto; }
.v5-menu-raccourci{ flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 25/10 (audit, P3) : un raccourci court (« Ctrl , », « Ctrl / ») ne se coupe jamais ; seule une longue précision peut se couper */
.v5-menu-raccourci.v5-rac-court{ flex: none; overflow: visible; }

/* élément de menu sur deux lignes (11/10) : le nom, puis une phrase de détail en gris dessous — pour les choix qui demandent une
   explication (modes de Vinty). La ligne grandit, la coche et l'icône restent alignées sur le nom. */
.v5-menu-item.v5-menu-item-2{ height: auto; min-height: 44px; padding-top: 6px; padding-bottom: 7px; align-items: flex-start; white-space: normal; }
.v5-menu-item-2 .v5-menu-lib{ display: flex; flex-direction: column; flex: 1 1 auto; gap: 1px; overflow: visible; font-weight: var(--v5-g-moyen); line-height: 17px; }
.v5-menu-detail{ font-size: var(--v5-t-12); font-weight: var(--v5-g-normal); line-height: 15px; color: var(--v5-texte-2); white-space: normal; }
.v5-menu-item-2 :is(.v5-menu-ic, .v5-coche){ margin-top: 1px; }
.v5-menu-item-2:focus .v5-menu-detail{ color: var(--v5-sur-violet); }

/* fenêtre « Raccourcis clavier » (js/v5/raccourcis.js) : un groupe par contexte, les touches à droite */
.v5-raccourcis + .v5-raccourcis .v5-section-titre{ margin-top: 16px; }
.v5-raccourcis dd{ gap: 3px; }
.v5-raccourcis .v5-kbd{ min-width: 18px; height: 20px; justify-content: center; padding: 0 5px; color: var(--v5-texte-2); background: var(--v5-rempli-2); }
