/* public/styles/netmep-fluent-studio.css
 * Restructuration UI Fluent Windows 11 de NetMEP à l'image de VisioMEP
 * - 1 barre supérieure épurée (fond clair translucide, contraste élevé)
 * - Sous-barre d'outils 3D avancés escamotable (masquée par défaut pour libérer 100 % du viewport)
 * - Panneau Inspecteur (#n-panel) fermé par défaut, fond blanc lisible, organisé en 4 onglets (Arbo / Tracé 3D / Synthèse / 4D-5D)
 * - Dock flottant centré en bas en pilule blanche (identique à VisioMEP)
 * - Zéro fonctionnalité supprimée : tous les IDs et actions natifs restent actifs
 */

body.netmep-fluent-ui {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif !important;
}

/* 1. BARRE SUPÉRIEURE UNIQUE & ÉPURÉE (STYLE VISIOMEP) */
body.netmep-fluent-ui .bl-topbar {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 0 12px !important;
  gap: 6px !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  z-index: 10000 !important;
}

body.netmep-fluent-ui .bl-menus,
body.netmep-fluent-ui .bl-menu-group,
body.netmep-fluent-ui .bl-view-menus {
  overflow: visible !important;
}

body.netmep-fluent-ui .bl-brand-btn {
  color: #0f172a !important;
  font-weight: 600;
  padding: 4px 8px;
}

/* Masque le doublon de logo "NetMEP" quand ouvert dans le Bureau /app ou l'Espace Projet (iframe) */
body.netmep-fluent-ui.nm-embedded .bl-brand-btn {
  display: none !important;
}

body.netmep-fluent-ui .bl-menu-item {
  color: #1e293b !important;
  height: 28px !important;
  line-height: 28px !important;
  padding: 0 9px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

body.netmep-fluent-ui .bl-menu-item:hover,
body.netmep-fluent-ui .bl-menu-item.active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

body.netmep-fluent-ui .bl-topbar-sep {
  background: #cbd5e1 !important;
  height: 18px !important;
}

/* Menus déroulants clairs, lisibles et jamais coupés */
body.netmep-fluent-ui .bl-dropdown {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18) !important;
  padding: 5px !important;
  z-index: 999999 !important;
  min-width: 245px !important;
  max-height: calc(100vh - 70px);
  overflow-y: auto !important;
}

body.netmep-fluent-ui .bl-dd-item {
  color: #0f172a !important;
  border-radius: 5px !important;
  height: 28px !important;
  font-size: 12px !important;
  gap: 14px !important;
}

body.netmep-fluent-ui .bl-dd-item:hover {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

body.netmep-fluent-ui .bl-dd-item.active {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
}

body.netmep-fluent-ui .bl-dd-shortcut {
  color: #64748b !important;
}

body.netmep-fluent-ui .bl-dd-sep {
  background: #e2e8f0 !important;
}

/* Onglets Workspaces centrés façon pilules Fluent */
body.netmep-fluent-ui .bl-workspaces {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 2px !important;
  height: 30px !important;
  max-height: 30px !important;
  gap: 2px !important;
}

body.netmep-fluent-ui .bl-ws-tab {
  color: #475569 !important;
  border-bottom: none !important;
  border-radius: 6px !important;
  height: 24px !important;
  line-height: 24px !important;
  padding: 0 10px !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
}

body.netmep-fluent-ui .bl-ws-tab:hover:not(.active) {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.netmep-fluent-ui .bl-ws-tab.active {
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  font-weight: 600 !important;
}

/* Boutons d'action barre droite (Style VisioMEP) */
body.netmep-fluent-ui .bl-topbar-right {
  gap: 6px !important;
}

body.netmep-fluent-ui #btn-switch-visionneuse {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  border-radius: 7px !important;
  padding: 5px 11px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body.netmep-fluent-ui #btn-switch-visionneuse:hover {
  background: #0369a1 !important;
}

body.netmep-fluent-ui #btn-open-netmep-balancing {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 7px !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

body.netmep-fluent-ui #btn-open-netmep-balancing:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

body.netmep-fluent-ui #btn-toggle-netmep-dock,
body.netmep-fluent-ui .nm-top-pill-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 7px !important;
  padding: 4px 10px !important;
  height: 28px;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

body.netmep-fluent-ui #btn-toggle-netmep-dock:hover,
body.netmep-fluent-ui .nm-top-pill-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

body.netmep-fluent-ui .nm-top-pill-btn.is-active,
body.netmep-fluent-ui #btn-toggle-netmep-dock[aria-expanded="true"] {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}

body.netmep-fluent-ui .bl-badge-ifc {
  display: none !important;
}

/* 2. ESPACE DE TRAVAIL 100 % PLEIN ÉCRAN */
body.netmep-fluent-ui .bl-workspace-body {
  height: calc(100vh - 44px) !important;
  position: relative;
  background: #e2e8f0 !important;
}

/* Sous-barre d'outils 3D avancés : masquée par défaut, ouvrable via "⚙ Outils 3D" */
body.netmep-fluent-ui .bl-viewport-header {
  display: none !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 4px 10px !important;
  min-height: 36px !important;
  height: auto !important;
  color: #0f172a !important;
  z-index: 9500 !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  flex-wrap: wrap !important;
}

body.netmep-fluent-ui.nm-advanced-bar-open .bl-viewport-header {
  display: flex !important;
}

body.netmep-fluent-ui .bl-viewport-header .bl-hdr-btn,
body.netmep-fluent-ui .bl-viewport-header .bl-mode-pill {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 3px 8px !important;
  font-size: 11.5px !important;
  height: 26px !important;
}

body.netmep-fluent-ui .bl-viewport-header .bl-hdr-btn.active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}

body.netmep-fluent-ui .bl-viewport-header .bl-shd-btn {
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

body.netmep-fluent-ui .bl-viewport-header .bl-shd-btn.active {
  background: #1d4ed8 !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
}

/* 3. TIROIR INSPECTEUR NETMEP (#n-panel) : FLOTTANT, CLAIR, LISIBLE, À ONGLETS */
body.netmep-fluent-ui .bl-side-dock {
  display: block !important;
  position: fixed !important;
  top: 86px !important;
  right: 14px !important;
  bottom: 128px !important;
  z-index: 9800 !important;
  background: transparent !important;
  border: none !important;
  pointer-events: none;
  width: auto !important;
}

body.netmep-fluent-ui .bl-vertical-tabs {
  display: none !important;
}

body.netmep-fluent-ui:not(.nm-inspector-open) #n-panel.bl-sidebar {
  display: none !important;
}

body.netmep-fluent-ui.nm-inspector-open #n-panel.bl-sidebar {
  display: flex !important;
  flex-direction: column !important;
  pointer-events: auto;
  width: 356px !important;
  max-width: calc(100vw - 28px);
  height: 100% !important;
  max-height: 100% !important;
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(18px);
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18) !important;
  color: #0f172a !important;
  overflow-y: auto !important;
  padding: 0 0 12px 0 !important;
}

/* Barre d'onglets en tête de l'Inspecteur */
.nm-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 8px 6px 6px 6px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
  border-radius: 12px 12px 0 0;
}

.nm-itab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
}

.nm-itab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.nm-itab.is-active {
  background: #ffffff;
  color: #1d4ed8;
  border-color: #cbd5e1;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* Contrastes parfaits à l'intérieur du panneau Inspecteur */
body.netmep-fluent-ui #n-panel .bl-outliner,
body.netmep-fluent-ui #n-panel .bl-box {
  background: #ffffff !important;
  border: none !important;
  border-bottom: 1px solid #e2e8f0 !important;
  margin: 0 !important;
  padding: 12px !important;
  color: #0f172a !important;
}

body.netmep-fluent-ui #n-panel .bl-outliner-hdr,
body.netmep-fluent-ui #n-panel .bl-box-title {
  background: transparent !important;
  color: #0f172a !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  padding: 0 0 8px 0 !important;
  border-bottom: 1px solid #f1f5f9 !important;
  margin-bottom: 10px !important;
}

body.netmep-fluent-ui #n-panel .bl-tree-list {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  max-height: 55vh !important;
  color: #0f172a !important;
}

body.netmep-fluent-ui #n-panel .bl-tree-empty strong {
  color: #0f172a !important;
}

body.netmep-fluent-ui #n-panel .bl-row {
  color: #0f172a !important;
  margin-bottom: 8px !important;
}

body.netmep-fluent-ui #n-panel .bl-row label,
body.netmep-fluent-ui #n-panel .bl-row span {
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

body.netmep-fluent-ui #n-panel .bl-select,
body.netmep-fluent-ui #n-panel .bl-input {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 5px 8px !important;
  font-size: 12px !important;
}

body.netmep-fluent-ui #n-panel .bl-metric {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 10px !important;
}

body.netmep-fluent-ui #n-panel .bl-metric small {
  color: #64748b !important;
  font-size: 10.5px !important;
}

body.netmep-fluent-ui #n-panel .bl-metric strong {
  color: #0f172a !important;
  font-size: 14px !important;
}

body.netmep-fluent-ui #n-panel .bl-btn-act {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 7px !important;
  padding: 8px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  margin-top: 6px !important;
  transition: all 0.12s ease;
}

body.netmep-fluent-ui #n-panel .bl-btn-act:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

body.netmep-fluent-ui #n-panel .bl-btn-act.orange,
body.netmep-fluent-ui #n-panel .bl-btn-act.blue {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

body.netmep-fluent-ui #n-panel .bl-btn-act.orange:hover,
body.netmep-fluent-ui #n-panel .bl-btn-act.blue:hover {
  background: #0369a1 !important;
}

.nm-pane-hidden {
  display: none !important;
}

/* 4. DOCK FLOTTANT CENTRÉ EN BAS (PILULE BLANCHE FIXE STYLE VISIOMEP — JAMAIS COUPÉ) */
.nm-floating-dock {
  position: fixed !important;
  left: 50% !important;
  bottom: 14px !important;
  transform: translateX(-50%) !important;
  z-index: 9600 !important;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.15);
  max-width: calc(100vw - 120px);
  overflow-x: auto;
  scrollbar-width: none;
}

.nm-floating-dock::-webkit-scrollbar {
  display: none;
}

.nm-dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #0f172a;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.nm-dock-btn:hover {
  background: #f1f5f9;
}

.nm-dock-btn.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 600;
}

.nm-dock-sep {
  width: 1px;
  height: 18px;
  background: #e2e8f0;
  margin: 0 2px;
  flex-shrink: 0;
}

/* 5. BARRE DE STATUT -> MINI-PILULE AU-DESSUS DU DOCK EN BAS À GAUCHE (0 CHEVAUCHEMENT) */
body.netmep-fluent-ui .bl-statusbar {
  position: fixed !important;
  left: 14px !important;
  bottom: 64px !important;
  width: auto !important;
  max-width: 240px !important;
  height: auto !important;
  background: rgba(255, 255, 255, 0.94) !important;
  backdrop-filter: blur(12px);
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 5px 10px !important;
  color: #334155 !important;
  font-size: 11px !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  z-index: 9400 !important;
}

body.netmep-fluent-ui .bl-statusbar .bl-sb-keys {
  display: none !important;
}

body.netmep-fluent-ui .bl-statusbar .bl-sb-stats {
  gap: 8px !important;
}

/* Ne garder que Schéma IFC4 + compteur éléments dans la mini-pilule pour éviter tout chevauchement */
body.netmep-fluent-ui .bl-statusbar .bl-sb-stats > span:nth-child(2),
body.netmep-fluent-ui .bl-statusbar .bl-sb-stats > span:nth-child(4),
body.netmep-fluent-ui .bl-statusbar .bl-sb-stats > span:nth-child(5) {
  display: none !important;
}

body.netmep-fluent-ui .bl-statusbar strong {
  color: #0f172a !important;
}

body.netmep-fluent-ui .bl-statusbar #sb-schema-badge {
  color: #1d4ed8 !important;
}

/* 6. BOUTONS ZOOM (+ / ⊙ / −) & TOASTS EN CONTRASTE CLAIR PARFAIT */
body.netmep-fluent-ui .bl-innerscene-nav-tools {
  position: fixed !important;
  right: 16px !important;
  bottom: 16px !important;
  z-index: 9500 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12) !important;
  padding: 3px !important;
}

body.netmep-fluent-ui .bl-innerscene-nav-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 7px !important;
  font-weight: 600 !important;
}

body.netmep-fluent-ui .bl-innerscene-nav-btn:hover {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

body.netmep-fluent-ui .bl-toast,
body.netmep-fluent-ui #bl-toast,
body.netmep-fluent-ui #toast {
  background: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
}

/* 7. MENU CONTEXTUEL CLIC DROIT AUTOCAD (WIN11 FLUENT, STRICT CSP) */
.nm-ctx-menu {
  position: fixed;
  z-index: 1000000;
  min-width: 280px;
  max-width: 340px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(18px);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
  padding: 5px;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: #0f172a;
}

.nm-ctx-menu[hidden] {
  display: none !important;
}

.nm-ctx-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #475569;
  padding: 5px 10px 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 4px;
}

.nm-ctx-row {
  position: relative;
}

.nm-ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 400;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.nm-ctx-item:hover:not(.is-disabled) {
  background: #eff6ff;
  color: #1d4ed8;
}

.nm-ctx-item.is-primary {
  font-weight: 600;
  color: #1e3a8a;
}

.nm-ctx-item.is-danger {
  color: #b91c1c;
}

.nm-ctx-item.is-danger:hover:not(.is-disabled) {
  background: #fef2f2;
  color: #991b1b;
}

.nm-ctx-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nm-ctx-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nm-ctx-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  font-size: 12px;
}

.nm-ctx-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nm-ctx-shortcut {
  font-size: 10.5px;
  color: #64748b;
  font-family: Consolas, "Segoe UI", monospace;
  flex-shrink: 0;
}

.nm-ctx-item:hover:not(.is-disabled) .nm-ctx-shortcut {
  color: #1d4ed8;
}

.nm-ctx-sep {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 6px;
}

.nm-ctx-submenu {
  display: none;
  position: absolute;
  top: -4px;
  left: calc(100% + 4px);
  min-width: 240px;
  background: rgba(255, 255, 255, 0.99);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
  padding: 5px;
  z-index: 1000001;
}

.nm-ctx-row.has-submenu:hover > .nm-ctx-submenu {
  display: block;
}

.nm-pref-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #334155;
  cursor: pointer;
}

.nm-ctx-toast {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000002;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
}

/* 8. PANNEAU GÉORÉFÉRENCEMENT PROJET & BARRE D'ÉTAT COORDONNÉES ABSOLUES */
.nm-georef-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nm-geo-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nm-geo-label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}

.nm-geo-mode-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  margin: 4px 0;
}

.nm-geo-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
}

.nm-geo-mode-btn.is-active {
  background: #ffffff;
  color: #1d4ed8;
  border-color: #cbd5e1;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.nm-geo-pane {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nm-geo-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: #0f172a;
}

.nm-geo-card-title {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
  font-size: 11px;
}

.nm-geo-kv {
  font-family: Consolas, "Segoe UI", monospace;
  font-size: 11px;
  color: #0369a1;
  font-weight: 600;
}

.nm-geo-sub {
  font-size: 10.5px;
  color: #475569;
  margin-top: 2px;
}

.nm-geo-hint {
  margin: 0;
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
}

.nm-geo-primary-btn {
  background: #0284c7;
  color: #ffffff;
  border: 1px solid #0284c7;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.nm-geo-primary-btn:hover:not(:disabled) {
  background: #0369a1;
}

.nm-geo-primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.nm-geo-secondary-btn {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.nm-geo-secondary-btn:hover,
.nm-geo-secondary-btn.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.nm-geo-file-input {
  font-size: 11px;
  color: #334155;
}

.nm-geo-status {
  font-size: 11px;
  color: #0f766e;
  min-height: 16px;
}

.nm-georef-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 8px;
  font-family: Consolas, "Segoe UI", monospace;
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
  white-space: nowrap;
}

/* 9. MINI-CARTE DE VÉRIFICATION CARTOGRAPHIQUE & CADASTRALE (OSM / IGN GÉOPLATEFORME) */
.nm-geo-map-wrap {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nm-geo-map-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nm-geo-layer-btn {
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.nm-geo-layer-btn.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  font-weight: 600;
}

.nm-geo-cadastre-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
}

.nm-geo-map-canvas {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #e2e8f0;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.nm-geo-map-canvas.is-dragging {
  cursor: grabbing;
}

.nm-geo-tile-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.nm-geo-cadastre-layer {
  opacity: 0.78;
}

.nm-geo-tile-img {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.nm-geo-svg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.nm-geo-footprint-poly {
  fill: rgba(2, 132, 199, 0.28);
  stroke: #0284c7;
  stroke-width: 2;
}

.nm-geo-north-line {
  stroke: #f59e0b;
  stroke-width: 2.2;
}

.nm-geo-north-head {
  fill: #f59e0b;
  stroke: #0f172a;
  stroke-width: 0.6;
}

.nm-geo-north-label {
  fill: #ffffff;
  stroke: #0f172a;
  stroke-width: 2.5px;
  paint-order: stroke;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
}

.nm-geo-basepoint-dot {
  fill: #ef4444;
  stroke: #ffffff;
  stroke-width: 2;
  cursor: move;
  pointer-events: all;
}

.nm-geo-map-controls {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nm-geo-map-ctrl-btn {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nm-geo-map-ctrl-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.nm-geo-map-attrib {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.86);
  color: #334155;
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
}

.nm-geo-map-hint {
  font-size: 10.5px;
  color: #475569;
  line-height: 1.3;
}

/* 10. RECHERCHE ADRESSE / PARCELLE CADASTRALE & ALTIMÉTRIE RGE ALTI IGN */
.nm-geo-addr-wrap {
  position: relative;
}

.nm-geo-addr-input {
  width: 100%;
  box-sizing: border-box;
}

.nm-geo-addr-suggestions {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  max-height: 190px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nm-geo-addr-suggestions[hidden] {
  display: none !important;
}

.nm-geo-addr-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 7px;
  text-align: left;
  cursor: pointer;
  color: #0f172a;
}

.nm-geo-addr-item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.nm-geo-addr-badge {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-top: 1px;
}

.nm-geo-addr-badge.is-addr {
  background: #dbeafe;
  color: #1d4ed8;
}

.nm-geo-addr-badge.is-parcel {
  background: #fef3c7;
  color: #92400e;
}

.nm-geo-addr-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nm-geo-addr-main {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.nm-geo-addr-ctx {
  font-size: 10px;
  color: #64748b;
}

.nm-geo-inline-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nm-geo-inline-row .bl-input {
  flex: 1 1 auto;
  min-width: 0;
}

.nm-geo-alti-btn {
  flex-shrink: 0;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.nm-geo-alti-btn:hover:not(:disabled) {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.nm-geo-alti-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.nm-geo-alti-source {
  font-size: 10px;
  color: #0f766e;
  min-height: 13px;
}

/* 11. CONTRÔLES PROJECTION CARTE AU SOL 3D */
.nm-geo-3d-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
}

.nm-geo-3d-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}

.nm-geo-3d-opts {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nm-geo-3d-lbl {
  font-size: 10.5px;
  color: #475569;
  white-space: nowrap;
}

.nm-geo-3d-slider {
  flex: 1 1 auto;
  min-width: 60px;
  accent-color: #0284c7;
}

.nm-geo-3d-val {
  font-size: 10.5px;
  font-family: Consolas, "Segoe UI", monospace;
  color: #0369a1;
  width: 32px;
  text-align: right;
}

.nm-geo-3d-select {
  width: auto !important;
  font-size: 10.5px !important;
  padding: 2px 6px !important;
  height: 24px !important;
}

/* 12. ONGLET THERMIQUE (THERMMEP) DANS L'INSPECTEUR NETMEP */
.nm-therm-spaces-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 210px;
  overflow-y: auto;
}

.nm-therm-space-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 6px 8px;
}

.nm-therm-space-left {
  min-width: 0;
}

.nm-therm-space-name {
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nm-therm-power-badge {
  flex-shrink: 0;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: Consolas, "Segoe UI", monospace;
}

.nm-therm-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.nm-therm-link-btn {
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 13. HARMONISATION WIN11 PRO CLAIR & SOMBRE — ZÉRO NOIR SUR NOIR (NIVEAUX, TIROIR GED, MODALES) */
html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar {
  background: rgba(255, 255, 255, 0.96) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14) !important;
  color: #0f172a !important;
  backdrop-filter: blur(12px);
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar .bl-level-pill,
html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar button {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar .bl-level-pill:hover,
html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar button:hover {
  background: #eff6ff !important;
  border-color: #005fb8 !important;
  color: #005fb8 !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar .bl-level-pill.active,
html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-level-bar button.active {
  background: #005fb8 !important;
  border-color: #005fb8 !important;
  color: #ffffff !important;
}

/* Tiroir droit GED / Équipement 3D Détecté */
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-bcf-drawer,
html:not([data-theme="dark"]) body.netmep-fluent-ui .bl-drawer {
  background: #ffffff !important;
  color: #0f172a !important;
  border-left: 1px solid #cbd5e1 !important;
  box-shadow: -10px 0 32px rgba(15, 23, 42, 0.14) !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer > div,
html:not([data-theme="dark"]) body.netmep-fluent-ui #ged-drawer-content > div,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer [style*="background:#1"],
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer [style*="background:#0"],
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer [style*="background: #1"],
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer [style*="background: #0"] {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer span,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer div,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer p,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer strong,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer h3,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer h4 {
  color: #0f172a !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer button {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #005fb8 !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-ged-drawer button:hover {
  background: #005fb8 !important;
  border-color: #005fb8 !important;
  color: #ffffff !important;
}

/* Badge info maquette et modales flottantes en mode clair */
html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-info-tag {
  background: rgba(255, 255, 255, 0.96) !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12) !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #innerscene-info-tag * {
  color: #0f172a !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-models-ref-modal > div,
html:not([data-theme="dark"]) body.netmep-fluent-ui #netmep-balancing-modal > div {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-models-ref-modal [style*="background:#0"],
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-models-ref-modal [style*="background:#1"],
html:not([data-theme="dark"]) body.netmep-fluent-ui #netmep-balancing-modal [style*="background:#0"],
html:not([data-theme="dark"]) body.netmep-fluent-ui #netmep-balancing-modal [style*="background:#1"] {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

/* Mode Sombre : texte toujours clair (#f1f5f9) sur fond sombre (#1e293b) */
html[data-theme="dark"] body.netmep-fluent-ui #innerscene-level-bar,
html[data-theme="dark"] body.netmep-fluent-ui #bl-ged-drawer,
html[data-theme="dark"] body.netmep-fluent-ui #innerscene-info-tag {
  background: rgba(15, 23, 42, 0.95) !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html[data-theme="dark"] body.netmep-fluent-ui #innerscene-level-bar .bl-level-pill,
html[data-theme="dark"] body.netmep-fluent-ui #innerscene-level-bar button,
html[data-theme="dark"] body.netmep-fluent-ui #bl-ged-drawer span,
html[data-theme="dark"] body.netmep-fluent-ui #bl-ged-drawer div {
  color: #f1f5f9 !important;
}

/* 14. CALAGE VERTICAL & Z-INDEX DE TOUTES LES FENÊTRES FLOTTANTES, MODALES & TIROIRS (SOUS LES 2 BARRES 88px) */
body.netmep-fluent-ui #bl-dwg-floating-modal {
  top: 96px !important;
  z-index: 10050 !important;
  max-height: calc(100vh - 160px) !important;
}

body.netmep-fluent-ui #bl-dwg-floating-modal.maximized {
  top: 94px !important;
  left: 12px !important;
  right: 12px !important;
  bottom: 64px !important;
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 158px) !important;
  max-height: calc(100vh - 158px) !important;
}

/* Harmonisation Win11 Pro de l'en-tête Plan 2D en mode clair (toujours parfaitement lisible) */
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-dwg-floating-modal .bl-dwg-hdr {
  background: #f8fafc !important;
  border-bottom: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-dwg-floating-modal .bl-dwg-hdr-title,
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-dwg-floating-modal .bl-dwg-hdr span {
  color: #0f172a !important;
}
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-dwg-floating-modal .bl-dwg-hdr .bl-dwg-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-dwg-floating-modal .bl-dwg-hdr .bl-dwg-btn.active {
  background: #005fb8 !important;
  border-color: #005fb8 !important;
  color: #ffffff !important;
}
html:not([data-theme="dark"]) body.netmep-fluent-ui #bl-dwg-floating-modal .bl-dwg-zcut-group {
  background: #eef2f7 !important;
  border-color: #cbd5e1 !important;
}
html:not([data-theme="dark"]) body.netmep-fluent-ui #dropdown-dwg-level {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Toutes les modales centrées : toujours au-dessus des barres, jamais coupées en haut */
body.netmep-fluent-ui #synoptic-modal,
body.netmep-fluent-ui #help-modal,
body.netmep-fluent-ui #prefs-modal,
body.netmep-fluent-ui #bl-models-ref-modal,
body.netmep-fluent-ui #netmep-balancing-modal {
  z-index: 10080 !important;
  padding: 96px 16px 24px !important;
  box-sizing: border-box !important;
}

body.netmep-fluent-ui .bl-modal-frame {
  max-height: calc(100vh - 130px) !important;
}

/* Tous les tiroirs latéraux : calés exactement sous les 2 barres supérieures */
body.netmep-fluent-ui #bl-ged-drawer,
body.netmep-fluent-ui #bl-bcf-drawer,
body.netmep-fluent-ui .bl-drawer {
  top: 90px !important;
  height: calc(100vh - 90px) !important;
  z-index: 10040 !important;
}

/* 15. DIALOGUE D'ATTENTE / COMPILATION IFC (dialog.calculation-wait) — ZÉRO NOIR SUR NOIR */
html:not([data-theme="dark"]) dialog.calculation-wait {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22) !important;
}
html:not([data-theme="dark"]) dialog.calculation-wait strong,
html:not([data-theme="dark"]) dialog.calculation-wait h3,
html:not([data-theme="dark"]) dialog.calculation-wait p {
  color: #0f172a !important;
}
html:not([data-theme="dark"]) dialog.calculation-wait span:not(.calculation-wait-spinner) {
  color: #475569 !important;
}
html[data-theme="dark"] dialog.calculation-wait {
  background: rgba(15, 23, 42, 0.97) !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
}
html[data-theme="dark"] dialog.calculation-wait strong,
html[data-theme="dark"] dialog.calculation-wait h3,
html[data-theme="dark"] dialog.calculation-wait p {
  color: #f8fafc !important;
}
html[data-theme="dark"] dialog.calculation-wait span:not(.calculation-wait-spinner) {
  color: #cbd5e1 !important;
}
