/* =========================================================================
   Pacific Admin 0.28.x — effet verre (couleurs de la 0.28.0, remises en 0.28.3)
   Chargée après pti-lagon.css sur la Gestion, Clair, la plateforme, la compta et le cabinet (pas sur le générateur de
   devis : l'aperçu imprimé ne doit pas changer).

   Principe, mesuré sur un banc local avant livraison :
   - le fond de page porte des halos de couleur fixes, peints une seule fois ;
   - les cartes, listes et tuiles sont du « verre » sans flou : blanc translucide, liseré et reflet ; sur un fond
     déjà doux, le flou ne se verrait presque pas et coûterait à chaque image du défilement ;
   - le vrai flou (backdrop-filter) est réservé à ce qui flotte au-dessus du contenu : barres du haut et du bas,
     fenêtres, panneaux, menus. Jamais sur les fonds plein écran derrière une fenêtre (assombris, pas floutés).

   - les liserés (--lg-line, --lg-line-2) ne sont PAS redéfinis : ceux de pti-lagon.css restent, opaques. Certaines
     feuilles s'en servent comme couleur de texte sur les cartes noires (cartes chiffrées « is-ink ») ; translucides,
     ces textes disparaissaient (0.28.0, corrigé en 0.28.1).

   Tout est rangé dans une couche (@layer) : ses règles !important passent devant celles des anciennes feuilles,
   quelle que soit leur précision, sans toucher à ces feuilles. Un navigateur trop ancien pour les couches ignore
   ce fichier et garde l'apparence précédente.
   ========================================================================= */
@layer verre {

/* ---------- 1. Jetons : clair ---------- */
html:root, html body {
  --verre-fond: #EDEFF1;
  --verre-halo-1: rgba(19, 161, 147, .30);
  --verre-halo-2: rgba(86, 124, 255, .27);
  --verre-halo-3: rgba(150, 108, 255, .22);
  --verre-halo-4: rgba(255, 168, 104, .22);
  --verre-flou: saturate(1.7) blur(22px);
  --verre-flottant: rgba(250, 250, 251, .80);
  --verre-voile: rgba(16, 18, 26, .30);
  --verre-colle: rgba(248, 249, 250, .94);
  --verre-reflet: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 0 0 1px rgba(255, 255, 255, .45);

  --lg-bg: #EDEFF1 !important;
  --lg-bg-2: rgba(30, 32, 44, .05) !important;
  --lg-surface: rgba(255, 255, 255, .54) !important;
  --lg-surface-2: rgba(255, 255, 255, .40) !important;
  --lg-surface-3: rgba(30, 32, 44, .045) !important;
  --lg-side: rgba(255, 255, 255, .38) !important;
  --lg-glass: rgba(246, 246, 247, .62) !important;
  --lg-shadow-1: inset 0 1px 0 rgba(255, 255, 255, .85), 0 1px 2px rgba(20, 24, 40, .04), 0 10px 28px -16px rgba(20, 24, 40, .20) !important;
  --lg-shadow-2: inset 0 1px 0 rgba(255, 255, 255, .85), 0 1px 2px rgba(20, 24, 40, .05), 0 22px 44px -18px rgba(20, 24, 40, .26) !important;
}

/* ---------- 2. Jetons : sombre ---------- */
html[data-pti-theme="dark"], html[data-pti-theme="dark"] body, html body.theme-dark {
  --verre-fond: #07080A;
  --verre-halo-1: rgba(19, 161, 147, .19);
  --verre-halo-2: rgba(70, 104, 255, .20);
  --verre-halo-3: rgba(146, 92, 255, .16);
  --verre-halo-4: rgba(255, 140, 90, .07);
  --verre-flottant: rgba(20, 22, 27, .80);
  --verre-voile: rgba(0, 0, 0, .46);
  --verre-colle: rgba(19, 21, 26, .94);
  --verre-reflet: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 0 0 1px rgba(255, 255, 255, .035);

  --lg-bg: #07080A !important;
  --lg-bg-2: rgba(255, 255, 255, .04) !important;
  --lg-surface: rgba(24, 27, 33, .58) !important;
  --lg-surface-2: rgba(255, 255, 255, .035) !important;
  --lg-surface-3: rgba(255, 255, 255, .06) !important;
  --lg-side: rgba(12, 14, 17, .42) !important;
  --lg-glass: rgba(9, 10, 13, .58) !important;
  --lg-shadow-1: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .7) !important;
  --lg-shadow-2: inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .3), 0 24px 48px -18px rgba(0, 0, 0, .8) !important;
}

/* ---------- 3. Fond : halos fixes, peints une fois ---------- */
html, html:has(body) { background: var(--verre-fond) !important; }
html body { background: transparent !important; }
html body::before {
  content: "" !important; position: fixed !important; inset: 0 !important; z-index: -1 !important; pointer-events: none !important;
  background:
    radial-gradient(50vmax 40vmax at 14% 6%, var(--verre-halo-1), transparent 66%),
    radial-gradient(48vmax 38vmax at 90% 10%, var(--verre-halo-2), transparent 66%),
    radial-gradient(52vmax 44vmax at 76% 96%, var(--verre-halo-3), transparent 66%),
    radial-gradient(44vmax 38vmax at 12% 92%, var(--verre-halo-4), transparent 66%),
    radial-gradient(40vmax 30vmax at 48% 48%, var(--verre-halo-2), transparent 70%),
    var(--verre-fond) !important;
}
/* Page affichée dans une autre (Clair dans la Gestion) : fond transparent, les halos sont ceux de la page hôte. */
html.pti-embedded-html, html.pti-embedded-html body, html:has(body.pti-embedded), html body.pti-embedded { background: transparent !important; }
html.pti-embedded-html body::before, html body.pti-embedded::before { display: none !important; }
html body .pti-embed, html body .pti-embed-frame { background: transparent !important; background-color: transparent !important; }
/* Les enveloppes de page laissent voir le fond. */
html body .page, html body .shell, html body .content, html body main.content, html body .pti-main, html body .tab-panel,
html body .lg-home, html body .overview-shell, html body .ps-page, html body.lg-platform > main, html body .pti-shell, html body .pti-shell main {
  background: transparent !important; background-color: transparent !important;
}

/* ---------- 4. Le flou seulement sur ce qui flotte ---------- */
html body *, html body *::before, html body *::after, html body ::backdrop {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
/* Barres toujours visibles (petite surface) */
html body .topbar, html body .pti-mobile-header, html body .pti-mobile-nav, html body .mobile-bottom-nav,
html body.lg-platform > header, html body .pti-shell .mobile-bottom,
/* Fenêtres, panneaux et menus ouverts par-dessus le contenu */
html body .lg-cmdk-panel, html body .lg-cmdk > div, html body .ps-sheet, html body .ps-ag-detail, html body .ps-quick, html body .ps-ev-zoom,
html body .pti-detail-dialog, html body .pti-pilotage-drawer, html body .pti-task-check-card, html body .modal-card,
html body .scanner-modal-dialog, html body .movement-journal-dialog, html body .push-dialog, html body .biz-modal,
html body .nav-dropdown-menu, html body .pti-mobile-options-menu, html body .mobile-nav-menu, html body dialog {
  -webkit-backdrop-filter: var(--verre-flou) !important; backdrop-filter: var(--verre-flou) !important;
}
html body .pti-detail-dialog, html body .pti-pilotage-drawer, html body .pti-task-check-card, html body .modal-card,
html body .scanner-modal-dialog, html body .movement-journal-dialog, html body .push-dialog, html body dialog,
html body .nav-dropdown-menu, html body .pti-mobile-options-menu, html body .mobile-nav-menu,
html body .ps-sheet, html body .ps-ag-detail, html body .ps-quick, html body .ps-ev-zoom, html body .lg-cmdk-panel {
  background: var(--verre-flottant) !important; background-color: var(--verre-flottant) !important;
}
/* Téléphone et tablette : la barre latérale devient un tiroir qui passe par-dessus la page. */
@media (max-width: 980px) {
  html body.pti-unified aside.pti-side { background: var(--verre-flottant) !important; }
  html body.pti-unified.pti-drawer-open aside.pti-side { -webkit-backdrop-filter: var(--verre-flou) !important; backdrop-filter: var(--verre-flou) !important; }
}
/* En-têtes qui restent collés en haut pendant que la liste défile dessous : presque opaques, sans flou. */
html body .ps-grid-head, html body thead th, html body .appointment-day-title, html body .analysis-subtabs, html body .pick-bar,
html body .biz-modal-head, html body .review-actions, html body .pti-detail-body .order-action-row, html body .pti-detail-body .entity-actions {
  background-color: var(--verre-colle) !important;
}
/* Fonds derrière une fenêtre : assombris, sans flou (un flou plein écran est ce qui coûte le plus) */
html body .ps-sheet-backdrop, html body .pti-pilotage-backdrop, html body .pti-drawer-backdrop, html body .inventory-modal-backdrop,
html body .scanner-modal-backdrop, html body .movement-journal-backdrop, html body .pti-detail-modal, html body .pti-task-check-modal,
html body .push-modal, html body dialog::backdrop {
  background: var(--verre-voile) !important;
}

/* ---------- 5. Verre des cartes : reflet en haut, liseré clair ----------
   Pas de dégradé de reflet sur toute la carte : mesuré, il coûtait ~3 ms par image sans carte graphique. */
html body .content .card, html body .content .utility-details, html body .content .entity-accordion-list, html body .ps-card,
html body .pilotage-tile, html body .pilotage-row, html body .lg-card, html body .lg-today, html body .lg-goal,
html body .request-card, html body .client-doc-card, html body .order-accordion {
  box-shadow: var(--verre-reflet), var(--lg-shadow-1) !important;
}

/* Puces de période (Aujourd'hui, 7 jours, Ce mois…) des pages de l'administration : en sombre, leur texte restait
   noir sur fond noir (défaut antérieur au verre, repéré par la sonde de contraste). */
html[data-pti-theme="dark"] body .range-chip:not(.is-active), html body.theme-dark .range-chip:not(.is-active) { color: var(--lg-muted) !important; }
html[data-pti-theme="dark"] body .range-chip:not(.is-active):hover, html body.theme-dark .range-chip:not(.is-active):hover { color: var(--lg-ink) !important; }

/* ---------- 6. Ce qu'on remplit ou ce qu'on choisit : plein, sans verre (0.31.1) ----------
   Clair, « Compte de charge » : la liste des comptes prenait la couleur des cartes (blanc à 54 %, sans flou) et les
   champs du formulaire se lisaient à travers les noms des comptes ; les champs eux-mêmes laissaient voir les halos.
   Les jetons de surface sont redéfinis sur ces éléments seulement : chaque feuille garde ses propres règles (fond
   « à contrôler », champ désactivé, champ sans fond voulu…), mais ce qui prenait la couleur du verre devient plein. */
html:root, html body {
  --verre-plein: #FFFFFF;
  --verre-plein-2: #FAFAFB;
  --verre-plein-3: #F1F2F4;
}
html[data-pti-theme="dark"], html[data-pti-theme="dark"] body, html body.theme-dark {
  --verre-plein: #16181D;
  --verre-plein-2: #1A1D22;
  --verre-plein-3: #22252B;
}
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
html body select, html body textarea,
html body [role="listbox"], html body [role="option"], html body .acct-list, html body .client-suggestion-box, html body .client-suggestion-list,
html body .cs-search, html body .pti-company-switch, html body .lg-cmdk > div, html body .lg-cmdk-panel {
  --lg-surface: var(--verre-plein) !important; --surface: var(--verre-plein) !important;
  --lg-surface-2: var(--verre-plein-2) !important; --lg-surface-3: var(--verre-plein-3) !important;
  --lg-glass: var(--verre-plein) !important; --verre-flottant: var(--verre-plein) !important;
  /* Mêmes couleurs sous d'autres noms (pti-lagon, espace, console) : calculées plus haut, elles garderaient le verre. */
  --c-surface: var(--verre-plein) !important; --g-surface: var(--verre-plein) !important; --biz-surface: var(--verre-plein) !important;
  --cs-surface: var(--verre-plein) !important; --c-soft: var(--verre-plein-2) !important; --g-soft: var(--verre-plein-2) !important;
  --input-bg: var(--verre-plein) !important; --pti-surface: var(--verre-plein) !important; --pti-surface-solid: var(--verre-plein) !important;
}
/* Champ dessiné par son cadre, le champ lui-même sans fond : recherche de la console, choix du dossier (menu latéral,
   visible surtout sur téléphone). C'est le cadre qui doit être plein. */
html body .cs-search, html body .pti-company-switch { background-color: var(--verre-plein) !important; }
/* Recherche rapide (Ctrl+K) : on y tape puis on choisit un résultat. Panneau plein, sans flou. */
html body .lg-cmdk > div, html body .lg-cmdk-panel {
  background: var(--verre-plein) !important; background-color: var(--verre-plein) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
/* Listes de choix ouvertes par-dessus le formulaire : fond plein, jamais de flou. */
html body [role="listbox"]:not(select), html body .acct-list, html body .client-suggestion-box {
  background-color: var(--verre-plein) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}

/* ---------- 7. Accessibilité : moins de transparence demandée, ou pas de flou disponible ---------- */
@media (prefers-reduced-transparency: reduce) {
  html:root, html body { --lg-surface: #FFFFFF !important; --lg-surface-2: #FAF9F6 !important; --lg-side: #FAF9F6 !important; --verre-flottant: #FFFFFF; --lg-glass: rgba(246, 246, 247, .96) !important; }
  html[data-pti-theme="dark"], html[data-pti-theme="dark"] body, html body.theme-dark { --lg-surface: #15171B !important; --lg-surface-2: #191C20 !important; --lg-side: #101215 !important; --verre-flottant: #15171B; --lg-glass: rgba(9, 10, 13, .96) !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html:root, html body { --verre-flottant: rgba(250, 250, 251, .97); --lg-glass: rgba(246, 246, 247, .97) !important; }
  html[data-pti-theme="dark"], html[data-pti-theme="dark"] body, html body.theme-dark { --verre-flottant: rgba(20, 22, 27, .97); --lg-glass: rgba(9, 10, 13, .97) !important; }
}

/* ---------- Section intégrée (Compta, Caisse, Consommation IA…) sur téléphone (0.32.12) ----------
   Le flou du tiroir et de la barre du bas passait par-dessus le cadre de la section : l'iPhone recalculait tout le cadre
   à chaque geste et le menu se figeait. Avec un cadre dessous : presque plein, sans flou. Le défilement du tiroir ne
   part plus vers la page de dessous. */
@media (max-width: 980px) {
  html body.pti-unified.pti-embed-active aside.pti-side, html body.pti-unified.pti-embed-active .pti-mobile-nav {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: var(--verre-colle) !important;
  }
  html body.pti-unified aside.pti-side { overscroll-behavior: contain; }
}

}
