/* ==========================================================================
   Plan de Ferme — coquille d'interface (refonte, branche experimental)
   Barre du haut + barre de sections + panneau unique + légende + tiroir
   des résultats + fiche parcelle. Aucun ID existant n'est modifié : ce
   fichier ne fait que réorganiser visuellement les éléments existants.
   ========================================================================== */

:root {
  --pf-accent: #2e6a4c;
  --pf-accent-strong: #1f4d37;
  --pf-accent-soft: #e6f0ea;
  --pf-ink: #17211b;
  --pf-muted: #5b6660;
  --pf-line: #e3e6e1;
  --pf-line-soft: #eef0ec;
  --pf-ground: #f4f5f2;
  --pf-hover: #f7f8f5;
  --pf-top: 56px;
  --pf-rail: 64px;
  --pf-panel: 340px;
  --pf-left: calc(var(--pf-rail) + var(--pf-panel));
  --pf-fiche: 360px;
  --pf-shadow: 0 4px 14px rgba(23, 33, 27, 0.1);
  --pf-shadow-lg: 0 8px 24px rgba(23, 33, 27, 0.14);
}
body.pf-collapsed { --pf-left: var(--pf-rail); }

/* ---------- Couleur d'accent unique (bureau et mobile) ---------- */
input:checked + .switch-slider { background-color: var(--pf-accent); }
.seg-btn.active { color: var(--pf-ink); }
.pill-btn.active {
  background: var(--pf-accent-soft) !important;
  border-color: var(--pf-accent) !important;
  color: var(--pf-accent-strong) !important;
}
.slider, input[type="range"] { accent-color: var(--pf-accent); }

/* ---------- Lignes de couche : interrupteur · nom · réglages ---------- */
.pf-layer,
.tool-card.pf-layer,
.topo-sub-accordion.pf-layer {
  display: block;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 0;
  margin: 1px 0;
  box-shadow: none;
}
.pf-layer[open] { background: var(--pf-hover); }
.pf-layer > summary {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 4px 0 8px !important;
  margin: 0 !important;
  list-style: none;
  cursor: pointer;
  border-radius: 10px;
  background: transparent !important;
  border: none !important;
}
.pf-layer > summary::-webkit-details-marker { display: none; }
.pf-layer > summary:hover { background: var(--pf-hover) !important; }
.pf-layer > summary .switch-label { order: -1; flex-shrink: 0; }
.pf-layer > summary .tool-card-title,
.pf-layer > summary .topo-sub-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--pf-ink);
  text-transform: none;
  letter-spacing: normal;
}
.pf-layer > summary .tool-card-title span,
.pf-layer > summary .topo-sub-title span { color: var(--pf-ink) !important; font-weight: 500 !important; }
.pf-layer > summary svg { display: none; }
.pf-layer > summary::after {
  content: "";
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6660' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12'/%3E%3Ccircle cx='16' cy='6' r='2'/%3E%3Ccircle cx='10' cy='12' r='2'/%3E%3Ccircle cx='18' cy='18' r='2'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.pf-layer[open] > summary::after { background-color: var(--pf-accent-soft); }
.pf-layer > .pf-layer-body,
.pf-layer > .topo-sub-content,
.pf-layer > .topo-master-body {
  padding: 4px 12px 12px 52px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pf-flat-group { gap: 0 !important; padding: 0 !important; background: transparent !important; border: none !important; }

/* ---------- Sections du panneau ---------- */
.pf-section-head { padding: 18px 18px 6px; }
.pf-section-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--pf-ink); }
.pf-section-head p { margin: 4px 0 0; font-size: 12px; color: var(--pf-muted); }
.pf-group { padding: 12px 10px 8px; border-top: 1px solid var(--pf-line-soft); display: flex; flex-direction: column; gap: 2px; }
.pf-section-head + .pf-group { border-top: none; }
.pf-group-title {
  font-size: 11px; font-weight: 600; color: var(--pf-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin: 0 8px 6px;
}
.pf-hint { margin: 0 8px 10px; font-size: 12px; line-height: 1.5; color: var(--pf-muted); }
.pf-list-btn {
  width: 100%;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px !important;
  border-radius: 9px;
  text-align: left;
  color: var(--pf-ink);
}
.pf-list-btn:hover { background: var(--pf-hover) !important; }
.pf-list-name { font-size: 13px; font-weight: 600; }
.pf-list-desc { font-size: 12px; color: var(--pf-muted); }
body:not(:has(.pwa-install-bar.visible)) #pf-install-entry { display: none !important; }
.pf-hidden-shim { display: none !important; }

/* Fond de carte */
.pf-group-fond > .tool-card { background: transparent; border: none; padding: 0 8px; box-shadow: none; }
.pf-group-fond > .tool-card > .tool-card-title { display: none; }
.pf-group-fond .segmented-control { background: #f0f2ee; border-radius: 9px; padding: 3px; gap: 4px; }
.pf-group-fond .seg-btn { height: 32px; font-size: 12.5px; border-radius: 7px; }

/* Cartes neutres (WMS, couche perso, Agri-Réseau, diagnostic, LiDAR) */
.pf-section .tool-card:not(.pf-layer):not(.pf-group-fond > .tool-card),
.pf-section #card-custom-vectors,
.pf-tool-card {
  background: #ffffff !important;
  border: 1px solid var(--pf-line) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  margin: 2px 0 6px;
}
.pf-section #card-custom-vectors .tool-card-title span { color: var(--pf-ink) !important; }
.pf-section #btn-add-personal-layer { background: var(--pf-accent) !important; box-shadow: none !important; }
.pf-tool-card > summary { list-style: none; }
.pf-tool-card > summary::-webkit-details-marker { display: none; }
.pf-tool-card .topo-sub-chevron { display: none; }
.pf-section .profile-dock-btn { color: var(--pf-ink) !important; background: #fff !important; border-color: #d5d9d3 !important; }
#btn-trigger-cutfill-active { background: var(--pf-accent) !important; box-shadow: none !important; }
.pf-contact { padding: 8px 8px 0; font-size: 12px; }
.pf-contact a { color: var(--pf-accent); font-weight: 600; }

/* ==========================================================================
   BUREAU
   ========================================================================== */
@media (min-width: 769px) {
  body { background: var(--pf-ground); }

  /* Barre du haut */
  .pf-topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--pf-top);
    z-index: 1200;
    display: flex; align-items: center; gap: 16px;
    padding: 0 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--pf-line);
  }
  .pf-brand {
    width: calc(var(--pf-rail) + var(--pf-panel) - 32px);
    flex-shrink: 0;
    display: flex; align-items: center; gap: 10px;
    color: var(--pf-ink); text-decoration: none;
    font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
  }
  .pf-brand img { border-radius: 7px; }
  .pf-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .pf-btn {
    height: 36px; padding: 0 14px !important;
    display: inline-flex !important; align-items: center; gap: 7px;
    background: #fff !important; border: 1px solid #d5d9d3 !important; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--pf-ink);
  }
  .pf-btn:hover { background: var(--pf-hover) !important; }
  .pf-btn-primary { background: var(--pf-accent) !important; border-color: var(--pf-accent) !important; color: #fff; }
  .pf-btn-primary:hover { background: var(--pf-accent-strong) !important; }

  /* Recherche toujours visible dans la barre du haut */
  .pf-topbar .map-search-panel {
    display: block !important;
    position: relative; top: auto; right: auto; left: auto;
    flex: 1; width: auto; max-width: 520px;
    padding: 0; background: transparent; border: none; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .pf-topbar .map-search-panel .search-input {
    height: 38px; border-radius: 10px; background: var(--pf-ground); border-color: var(--pf-line);
  }
  .pf-topbar .map-search-panel .search-input:focus { border-color: var(--pf-accent); }
  .pf-topbar .map-search-panel .search-suggestions {
    position: absolute; top: 44px; left: 0; right: 0; margin: 0;
    background: #fff; border: 1px solid var(--pf-line); border-radius: 10px;
    box-shadow: var(--pf-shadow-lg); z-index: 1300;
  }
  #btn-toggle-search, #btn-quick-export, #btn-quick-rag { display: none !important; }

  /* Barre de sections */
  .pf-rail {
    position: fixed; top: var(--pf-top); left: 0; bottom: 0; width: var(--pf-rail);
    z-index: 1100;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 0;
    background: #fff; border-right: 1px solid var(--pf-line);
  }
  .pf-rail-btn {
    width: 56px !important; min-height: 58px;
    display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border-radius: 10px;
    font-size: 10.5px; font-weight: 600; color: var(--pf-muted);
  }
  .pf-rail-btn:hover { background: var(--pf-hover) !important; color: var(--pf-ink); }
  .pf-rail-btn[aria-pressed="true"] { background: var(--pf-accent-soft) !important; color: var(--pf-accent-strong); }

  /* Panneau latéral unique */
  .map-controls-panel {
    position: fixed;
    top: var(--pf-top); left: var(--pf-rail); bottom: 0;
    width: var(--pf-panel); max-width: none; max-height: none;
    padding: 0; gap: 0;
    border-radius: 0; border: none; border-right: 1px solid var(--pf-line);
    background: #fff; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    z-index: 1000;
  }
  body.pf-collapsed .map-controls-panel { display: none; }
  .panel-tools { display: block !important; padding-bottom: 24px; }
  .pf-section { display: none; }
  .pf-section.pf-active { display: block; }
  .pf-inline-legend { display: none !important; }
  .pf-actions-group #btn-panel-composer,
  .pf-actions-group #btn-panel-share { display: none !important; }
  #tools-backdrop, .mobile-tools-sheet, .mobile-tools-backdrop { display: none !important; }

  /* Carte : occupe l'espace restant */
  #map {
    top: var(--pf-top) !important;
    left: var(--pf-left) !important;
    right: 0; bottom: 0;
    width: auto !important; height: auto !important;
  }
  .site-footer { display: none; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 0 !important; }
  body.pf-fiche-open .maplibregl-ctrl-top-right { right: var(--pf-fiche); }

  /* Palette d'outils verticale */
  .map-profile-toolbar {
    top: calc(var(--pf-top) + 10px) !important;
    right: 52px !important;
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px !important;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--pf-line);
    border-radius: 12px;
    box-shadow: var(--pf-shadow);
    animation: none !important;
  }
  body.pf-fiche-open .map-profile-toolbar { right: calc(var(--pf-fiche) + 52px) !important; }
  .map-profile-toolbar > div { display: none !important; }
  .map-profile-toolbar .floating-profile-btn {
    width: 40px; height: 40px; padding: 0 !important;
    justify-content: center;
    border: none !important; box-shadow: none !important;
    border-radius: 8px !important;
    background: #fff;
    color: var(--pf-ink);
  }
  .map-profile-toolbar .floating-profile-btn:hover { background: var(--pf-hover) !important; }
  .map-profile-toolbar .floating-profile-btn > span { display: none; }
  .map-profile-toolbar .floating-profile-btn svg { width: 18px; height: 18px; stroke: currentColor !important; }
  .map-profile-toolbar .floating-profile-btn.active,
  .map-profile-toolbar .floating-profile-btn.btn-ndvi-mode.active,
  .map-profile-toolbar .floating-profile-btn.btn-3d-mode.active {
    background: var(--pf-accent-soft) !important;
    color: var(--pf-accent-strong) !important;
  }
  .map-profile-toolbar .floating-profile-btn.active svg { stroke: var(--pf-accent-strong) !important; }
  .map-profile-toolbar .floating-profile-btn.action-calc,
  .map-profile-toolbar .floating-profile-btn.action-clear { width: auto; padding: 0 12px !important; }
  .map-profile-toolbar .floating-profile-btn.action-calc { background: var(--pf-accent) !important; color: #fff !important; }
  .map-profile-toolbar .floating-profile-btn.action-calc > span { display: inline; }

  /* Légende unique */
  .pf-legend {
    position: fixed;
    left: calc(var(--pf-left) + 12px);
    top: calc(var(--pf-top) + 12px);
    z-index: 110;
    width: 250px;
    max-height: calc(100vh - var(--pf-top) - 24px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--pf-line);
    border-radius: 12px;
    box-shadow: var(--pf-shadow);
    font-size: 11.5px;
    color: var(--pf-ink);
  }
  .pf-legend[hidden] { display: none; }

  /* Tiroir des résultats : tous les docks au même endroit */
  .elevation-profile-dock {
    left: calc(var(--pf-left) + 12px) !important;
    right: 12px !important;
    bottom: 12px !important;
    border-top-width: 1px !important;
    border-color: var(--pf-line) !important;
    box-shadow: var(--pf-shadow-lg) !important;
  }
  body.pf-fiche-open .elevation-profile-dock { right: calc(var(--pf-fiche) + 12px) !important; }
  .pf-tray-hidden { display: none !important; }

  /* Panneaux flottants des outils (mesure, relief 3D) : à gauche de la palette */
  .measure-panel,
  .floating-3d-panel {
    top: calc(var(--pf-top) + 10px) !important;
    right: 104px !important;
    max-height: calc(100vh - var(--pf-top) - 24px);
    overflow-y: auto;
  }
  body.pf-fiche-open .measure-panel,
  body.pf-fiche-open .floating-3d-panel { right: calc(var(--pf-fiche) + 104px) !important; }
  .banner-3d-prompt { top: calc(var(--pf-top) + 12px) !important; left: calc(var(--pf-left) + (100vw - var(--pf-left)) / 2) !important; }

  /* Panneaux latéraux existants : sous la barre du haut */
  .rag-dock { top: calc(var(--pf-top) + 12px); }
  .share-toast { top: calc(var(--pf-top) + 12px); }
}

/* Éléments de la légende */
.pf-legend-head {
  width: 100%; height: 38px;
  display: flex !important; align-items: center; justify-content: space-between;
  padding: 0 12px !important;
  font-size: 12px; font-weight: 700; color: var(--pf-ink);
}
.pf-legend-head span:last-child { font-weight: 500; color: var(--pf-muted); }
.pf-legend-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.pf-legend.pf-legend-min .pf-legend-body { display: none; }
.pf-legend-item { display: flex; align-items: center; gap: 8px; line-height: 1.3; }
.pf-legend-item[hidden] { display: none; }
.pf-legend-col { flex-direction: column; align-items: stretch; gap: 4px; }
.pf-sw-row { display: inline-flex; gap: 2px; }
.pf-sw-row i, .pf-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.pf-inline { display: inline-flex; align-items: center; gap: 6px; }
.pf-line-dash { width: 30px; border-top: 2px dashed var(--pf-ink); }
.pf-line-solid { width: 30px; border-top: 1.5px solid #6b5434; }
.pf-ramp { height: 8px; border-radius: 4px; }
.pf-classes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.pf-classes i { height: 8px; display: block; }
.pf-ticks { display: flex; justify-content: space-between; color: var(--pf-muted); font-size: 10.5px; }

/* Onglets du tiroir (créés par shell.js quand plusieurs résultats sont ouverts) */
.pf-tray-tabs {
  display: flex; align-items: center; gap: 2px;
  margin: -4px -6px 4px; padding-bottom: 6px;
  border-bottom: 1px solid var(--pf-line-soft);
  overflow-x: auto;
}
.pf-tray-tab {
  display: inline-flex; align-items: center;
  border-radius: 8px;
  color: var(--pf-muted);
  white-space: nowrap;
}
.pf-tray-tab.pf-on { background: var(--pf-accent-soft); color: var(--pf-accent-strong); }
.pf-tray-tab > button:first-child { height: 30px; padding: 0 4px 0 10px !important; font-size: 12px; font-weight: 600; color: inherit; }
.pf-tray-tab > button:last-child { width: 24px; height: 24px; font-size: 15px; color: var(--pf-muted); border-radius: 6px; }
.pf-tray-tab > button:last-child:hover { background: rgba(0, 0, 0, 0.06) !important; }

/* ==========================================================================
   MOBILE : on garde la navigation mobile existante, sans les éléments bureau
   ========================================================================== */
@media (max-width: 768px) {
  .pf-rail, .pf-legend, .pf-brand, .pf-top-actions { display: none !important; }
  .pf-topbar { display: contents; }
  .pf-section { display: block; }
  .pf-section[data-section="analyses"] { display: none; }
  .pf-section-head { padding: 14px 4px 2px; }
  .pf-group { padding: 10px 0 6px; }
}

/* Cases à cocher à la couleur d'accent */
.map-controls-panel input[type="checkbox"],
.elevation-profile-dock input[type="checkbox"],
.maplibregl-popup input[type="checkbox"] { accent-color: var(--pf-accent); }

/* Données externes : même hiérarchie que les autres groupes */
.pf-section #card-wms { border: none !important; padding: 4px 8px 0 !important; margin: 0 !important; }
.pf-section #card-wms > .tool-card-header .tool-card-title { font-size: 11px; font-weight: 600; color: var(--pf-muted); letter-spacing: 0.06em; }
.pf-section #card-wms > .tool-card-header .tool-card-title svg { display: none; }
.pf-section #card-wms .wms-group-badge { background: var(--pf-accent-soft); color: var(--pf-accent-strong); }
.pf-section #btn-toggle-all-groups { color: var(--pf-accent); }

/* Mobile : boutons d'action alignés sur l'accent unique */
@media (max-width: 768px) {
  .pf-section[data-section="couches"] > .pf-section-head h2 { display: none; }
  #btn-panel-composer { background: var(--pf-accent) !important; border-color: var(--pf-accent) !important; }
  #btn-panel-share { background: #fff !important; border-color: #d5d9d3 !important; color: var(--pf-ink) !important; }
}

/* ==========================================================================
   Comparaison LiDAR (déblais / remblais) : même langage que les autres résultats
   ========================================================================== */
.pf-cf { gap: 10px; font-size: 12px; color: var(--pf-ink); }
.pf-cf .pf-cf-title { gap: 8px; font-size: 13px; color: var(--pf-ink); min-width: 0; }
.pf-cf .pf-cf-title svg { color: var(--pf-accent); flex-shrink: 0; }
.pf-cf-parcel { font-size: 12px; font-weight: 500; color: var(--pf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-cf-parcel:not(:empty)::before { content: "· "; }
.pf-cf .pf-cf-btn,
.pf-cf .profile-dock-btn {
  height: 30px; padding: 0 12px; border-radius: 8px;
  background: #fff; border: 1px solid #d5d9d3; color: var(--pf-ink);
  font-size: 12px; font-weight: 600;
}
.pf-cf .pf-cf-btn:hover { background: var(--pf-hover); border-color: var(--pf-accent); color: var(--pf-accent-strong); }
.pf-cf .pf-cf-swap { width: 30px; padding: 0; font-size: 14px; }

.pf-cf-loading {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--pf-ground); color: var(--pf-muted); font-weight: 600;
}
.pf-cf-loading[style*="block"] { display: flex !important; }
.pf-cf-spinner {
  display: inline-block; width: 12px; height: 12px; flex-shrink: 0;
  border: 2px solid var(--pf-line); border-top-color: var(--pf-accent); border-radius: 50%;
  animation: sim-spin 0.8s linear infinite;
}
.pf-cf-alert {
  padding: 8px 12px; border-radius: 8px; line-height: 1.45;
  background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12;
}

.pf-cf-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--pf-line-soft);
}
.pf-cf-field { display: inline-flex; align-items: center; gap: 6px; color: var(--pf-muted); font-weight: 500; }
.pf-cf-field select {
  height: 30px; max-width: 260px; padding: 0 8px;
  border: 1px solid #d5d9d3; border-radius: 8px; background: #fff;
  font: inherit; color: var(--pf-ink);
}
.pf-cf-field select:focus { outline: 2px solid var(--pf-accent-soft); border-color: var(--pf-accent); }
.pf-cf-opacity input[type="range"] { width: 80px; }
.pf-cf-num { font-variant-numeric: tabular-nums; color: var(--pf-ink); min-width: 32px; }
.pf-cf-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }
.pf-cf-check input { accent-color: var(--pf-accent); width: 15px; height: 15px; margin: 0; }
.pf-cf-chip {
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: var(--pf-accent-soft); color: var(--pf-accent-strong);
}
.pf-cf-sep { width: 1px; height: 18px; background: var(--pf-line); }

.pf-cf-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pf-cf-stat { background: var(--pf-ground); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.pf-cf-stat-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pf-muted); font-weight: 500; }
.pf-cf-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.pf-cf-stat-value { margin-top: 2px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--pf-ink); }
.pf-cf-stat-value small { font-size: 11px; font-weight: 600; color: var(--pf-muted); }
.pf-cf-stat-sub { font-size: 11px; color: var(--pf-muted); margin-top: 1px; }

.pf-cf-legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.pf-cf-ramp-wrap { flex: 1 1 260px; max-width: 460px; }
.pf-cf-ramp { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.pf-cf-ramp > div { flex: 1; }
.pf-cf-ramp-ticks { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10.5px; color: var(--pf-muted); }
.pf-cf-readout {
  flex: 1 1 240px; min-height: 30px; display: flex; align-items: center;
  padding: 0 10px; border-radius: 8px; background: var(--pf-ground);
  font-size: 11.5px; color: var(--pf-muted);
}
.pf-cf-table-wrap { max-height: 140px; overflow-y: auto; border: 1px solid var(--pf-line-soft); border-radius: 8px; }
.pf-cf-table { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.pf-cf-table th { position: sticky; top: 0; background: var(--pf-ground); color: var(--pf-muted); font-weight: 600; text-align: left; padding: 5px 8px; }
.pf-cf-table td { padding: 4px 8px; }

@media (max-width: 768px) {
  .pf-cf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-cf-field select { max-width: 180px; }
  .pf-cf-sep { display: none; }
}


/* ==========================================================================
   Fiche parcelle : panneau ancré sur toute la hauteur à droite
   ========================================================================== */
.pf-fiche { display: flex; flex-direction: column; min-height: 0; background: #fff; color: var(--pf-ink); font-size: 12.5px; }
.pf-fiche-head { padding: 16px 52px 12px 18px; border-bottom: 1px solid var(--pf-line-soft); }
.pf-fiche-kicker { font-size: 11px; font-weight: 600; color: var(--pf-accent); text-transform: uppercase; letter-spacing: 0.06em; }
.pf-fiche-title { margin-top: 3px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; color: var(--pf-ink); word-break: break-word; }
.pf-fiche-meta { margin-top: 4px; font-size: 12px; color: var(--pf-muted); }
.pf-fiche-muted { color: var(--pf-muted); font-weight: 400; }

/* Onglets */
.pf-fiche .popup-tabs-header {
  display: flex; gap: 2px; padding: 0 12px;
  background: #fff; border-bottom: 1px solid var(--pf-line-soft);
}
.pf-fiche .popup-tab-btn {
  flex: 0 0 auto; height: 40px; padding: 0 10px; gap: 6px;
  border: none; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px;
  background: transparent; color: var(--pf-muted); font-size: 12.5px; font-weight: 500;
}
.pf-fiche .popup-tab-btn svg { display: none; }
.pf-fiche .popup-tab-btn:hover { background: transparent; color: var(--pf-ink); }
.pf-fiche .popup-tab-btn.active { background: transparent; color: var(--pf-ink); font-weight: 700; border-bottom: 2px solid var(--pf-accent); }
.pf-fiche .popup-tab-btn:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: -2px; }
.pf-fiche .popup-tab-dot { background: var(--pf-accent) !important; }

/* Corps défilant */
.pf-fiche-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.pf-fiche .popup-tab-pane { padding: 14px 18px 18px; max-height: none; overflow: visible; font-size: 12.5px; gap: 12px; }

/* Faits clés (onglet Cultures) */
.pf-fiche-facts { margin: 0; display: grid; grid-template-columns: 110px 1fr; row-gap: 8px; column-gap: 10px; }
.pf-fiche-facts dt { color: var(--pf-muted); }
.pf-fiche-facts dd { margin: 0; font-weight: 600; }

/* Onglet Sols : contenu existant, styles harmonisés */
.pf-fiche .pedo-study-meta { gap: 8px; }
.pf-fiche .pedo-study-badge { background: var(--pf-accent-soft); color: var(--pf-accent-strong); font-weight: 600; border-radius: 10px; padding: 2px 8px; }
.pf-fiche .pedo-study-year { color: var(--pf-muted); }
.pf-fiche .pedo-popup-title { font-size: 14px; font-weight: 700; color: var(--pf-ink); }
.pf-fiche .pedo-appellation { font-family: inherit; font-size: 12px; font-weight: 600; background: var(--pf-ground); border: none; border-radius: 6px; padding: 3px 8px; color: var(--pf-ink); }
.pf-fiche .pedo-links-row { gap: 6px; }
.pf-fiche .pedo-study-link,
.pf-fiche .pedo-pdf-link {
  height: 30px; padding: 0 10px; border-radius: 8px;
  background: #fff; border: 1px solid #d5d9d3; color: var(--pf-ink); font-weight: 600;
}
.pf-fiche .pedo-study-link:hover,
.pf-fiche .pedo-pdf-link:hover { border-color: var(--pf-accent); color: var(--pf-accent-strong); background: var(--pf-hover); }
.pf-fiche .pedo-series-heading { font-size: 11px; font-weight: 600; color: var(--pf-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pf-fiche .pedo-series-card { background: var(--pf-ground); border: none; border-radius: 10px; padding: 10px 12px; box-shadow: none; }
.pf-fiche .pedo-series-card:hover { background: #eef1ec; box-shadow: none; transform: none; }
.pf-fiche .pedo-series-name { font-weight: 600; color: var(--pf-ink); }
.pf-fiche .pedo-series-pct { color: var(--pf-ink); background: transparent; font-variant-numeric: tabular-nums; }
.pf-fiche .pedo-progress-track { background: #e3e6e1; height: 5px; }
.pf-fiche .pedo-progress-fill { background: var(--pf-accent); }
.pf-fiche .pedo-series-link { color: var(--pf-accent); }

/* Boutons secondaires de la fiche (diagnostic, Agri-Réseau, NDVI, plans) */
.pf-fiche .btn-popup-ai,
.pf-fiche .btn-popup-rag,
.pf-fiche .btn-popup-ndvi {
  width: 100%; height: 36px; margin: 0; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: #fff; border: 1px solid #d5d9d3; border-radius: 9px;
  color: var(--pf-ink); font-size: 12.5px; font-weight: 600; box-shadow: none;
}
.pf-fiche .btn-popup-ai:hover,
.pf-fiche .btn-popup-rag:hover,
.pf-fiche .btn-popup-ndvi:hover { background: var(--pf-hover); border-color: var(--pf-accent); color: var(--pf-accent-strong); }
.pf-fiche .btn-popup-ndvi { background: var(--pf-accent-soft); border-color: var(--pf-accent); color: var(--pf-accent-strong); }
.pf-fiche .btn-popup-ai + .btn-popup-rag { margin-top: -4px; }
.pf-fiche .popup-tab-pane[data-tab="drainage"] a.pedo-study-link { background: var(--pf-accent) !important; color: #fff !important; border: none; height: 36px; }
.pf-fiche .popup-tab-pane[data-tab="drainage"] .parcel-info-badge { background: var(--pf-ground) !important; border: none !important; border-radius: 10px !important; }
.pf-fiche .popup-tab-pane[data-tab="drainage"] .parcel-info-badge * { color: var(--pf-ink) !important; }
.pf-fiche .popup-tab-pane[data-tab="drainage"] a[style*="#0284c7"] { background: var(--pf-accent) !important; }

/* Historique des rotations */
.pf-fiche .popup-crop-history { margin: 0; padding: 0; background: transparent; border: none; }
.pf-fiche .crop-history-header { margin-bottom: 6px; }
.pf-fiche .crop-history-title { font-size: 11px; font-weight: 600; color: var(--pf-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pf-fiche .crop-history-badge { background: var(--pf-ground); color: var(--pf-muted); border-radius: 10px; padding: 2px 8px; }
.pf-fiche .crop-history-list { max-height: none; }
.pf-fiche .crop-history-item { border-bottom: 1px solid var(--pf-line-soft); padding: 5px 2px; font-size: 12px; }

/* Actions : bloc fixe en bas de la fiche */
.pf-fiche-actions { flex-shrink: 0; padding: 12px 18px 16px; border-top: 1px solid var(--pf-line); background: #fff; }
.pf-fiche-actions-title { font-size: 11px; font-weight: 600; color: var(--pf-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.pf-fiche-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pf-fiche .btn-popup-parcel-action,
.pf-vec-lidar .btn-popup-parcel-action {
  min-height: 52px; padding: 7px 10px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  background: var(--pf-hover); border: 1px solid var(--pf-line); border-radius: 10px;
  color: var(--pf-ink); text-align: left; cursor: pointer; box-shadow: none;
  transition: background 0.15s, border-color 0.15s;
}
.pf-fiche .btn-popup-parcel-action:hover,
.pf-vec-lidar .btn-popup-parcel-action:hover { background: var(--pf-accent-soft); border-color: var(--pf-accent); }
.pf-fiche .btn-popup-parcel-action:focus-visible,
.pf-vec-lidar .btn-popup-parcel-action:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 1px; }
/* grille d'outils placée dans l'onglet « Outils » de la fiche */
.pf-fiche-actions.pf-fiche-tools { padding: 4px 0 2px; border-top: 0; background: transparent; }
.pf-fiche-tools .pf-fiche-actions-grid .btn-popup-parcel-action:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pf-fiche-tools-note { margin: 10px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--pf-muted); }
.pf-act-name { font-size: 12.5px; font-weight: 600; }
.pf-act-desc { font-size: 11px; color: var(--pf-muted); }

/* Bouton de fermeture */
.maplibregl-popup:has(.pf-fiche) .maplibregl-popup-close-button {
  top: 12px; right: 12px; width: 32px; height: 32px; padding: 0;
  border-radius: 8px; background: var(--pf-ground); color: var(--pf-muted);
  font-size: 18px; line-height: 32px; z-index: 2; transform: none;
}
.maplibregl-popup:has(.pf-fiche) .maplibregl-popup-close-button:hover { background: #e9ece7; color: var(--pf-ink); transform: none; }
.maplibregl-popup:has(.pf-fiche) .maplibregl-popup-tip { display: none; }

@media (min-width: 769px) {
  .maplibregl-popup:has(.pf-fiche) {
    position: fixed !important;
    top: var(--pf-top) !important; right: 0 !important; bottom: 0 !important; left: auto !important;
    transform: none !important;
    width: var(--pf-fiche); max-width: var(--pf-fiche) !important;
    display: flex; flex-direction: column;
    z-index: 1050;
    animation: pf-fiche-in 0.18s ease-out;
  }
  .maplibregl-popup:has(.pf-fiche) .maplibregl-popup-content {
    flex: 1 1 auto; min-height: 0; height: 100%; max-height: none;
    display: flex; flex-direction: column;
    padding: 0; border: none; border-left: 1px solid var(--pf-line); border-radius: 0;
    box-shadow: -10px 0 24px rgba(23, 33, 27, 0.08);
    overflow: hidden;
  }
  .maplibregl-popup:has(.pf-fiche) .pf-fiche { flex: 1 1 auto; height: 100%; }
}
@keyframes pf-fiche-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

@media (max-width: 768px) {
  .maplibregl-popup:has(.pf-fiche) {
    position: fixed !important;
    left: 0 !important; right: 0 !important; top: auto !important; bottom: 56px !important;
    transform: none !important;
    max-width: none !important; width: auto;
    z-index: 1500;
  }
  .maplibregl-popup:has(.pf-fiche) .maplibregl-popup-content {
    max-height: 62vh; display: flex; flex-direction: column; padding: 0;
    border: none; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px rgba(23, 33, 27, 0.14); overflow: hidden;
  }
  .maplibregl-popup:has(.pf-fiche) .pf-fiche { max-height: 62vh; }
  .pf-fiche .popup-tabs-header { overflow-x: auto; }
  .pf-fiche .popup-tab-btn { flex: 1 0 auto; height: 44px; }
  .pf-fiche .btn-popup-parcel-action { min-height: 48px; }
}

/* Correctifs fiche : rien ne rétrécit sauf le corps défilant */
.pf-fiche-head, .pf-fiche .popup-tabs-header, .pf-fiche-actions { flex-shrink: 0; }
.pf-fiche .popup-tabs-header { min-height: 40px; align-items: stretch; }
.pf-fiche .popup-tab-btn { display: inline-flex; align-items: center; }
.pf-fiche .popup-tab-btn:focus { outline: none; }
.pf-fiche .popup-tab-btn:focus-visible { outline: none; background: var(--pf-hover); }
.pf-fiche .crop-history-header { flex-wrap: wrap; gap: 4px 8px; }
.pf-fiche .crop-history-badge { white-space: nowrap; }
@media (max-width: 768px) {
  .pf-fiche .popup-tabs-header { min-height: 44px; }
}

/* ==========================================================================
   Mes données : bibliothèque de couches (dossiers, sauvegarde, export)
   ========================================================================== */
.pf-section #card-custom-vectors.pf-lib-card,
#card-custom-vectors.pf-lib-card {
  background: transparent !important; border: none !important; box-shadow: none !important;
  padding: 0 8px !important; margin: 0 !important;
  display: flex; flex-direction: column; gap: 10px;
}
.pf-lib-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pf-lib-add-wrap { position: relative; }
.pf-lib-add-wrap .personal-add-dropdown { left: 0; right: auto; min-width: 200px; }
.pf-lib-primary, .pf-lib-tool {
  height: 34px; padding: 0 12px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.pf-lib-primary { background: var(--pf-accent); border: 1px solid var(--pf-accent); color: #fff; }
.pf-lib-primary:hover { background: var(--pf-accent-strong); }
.pf-lib-tool { background: #fff; border: 1px solid #d5d9d3; color: var(--pf-ink); }
.pf-lib-tool:hover { background: var(--pf-hover); border-color: var(--pf-accent); color: var(--pf-accent-strong); }
.pf-lib-primary:focus-visible, .pf-lib-tool:focus-visible, .pf-lib-danger:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 2px; }

.pf-lib-target {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 6px 5px 10px; border-radius: 8px;
  background: var(--pf-accent-soft); color: var(--pf-accent-strong); font-size: 12px;
}
.pf-lib-target[hidden] { display: none; }
.pf-lib-target strong { font-weight: 700; }
.pf-lib-target button { width: 24px; height: 24px; border: none; border-radius: 6px; background: transparent; color: inherit; font-size: 16px; cursor: pointer; }
.pf-lib-target button:hover { background: rgba(46, 106, 76, 0.12); }

/* Arborescence */
.personal-layers-inline-list.pf-lib-tree { max-height: none; overflow: visible; gap: 1px; margin: 0; padding: 0; }
.pf-lib-empty { padding: 14px 10px; text-align: center; color: var(--pf-muted); font-size: 12px; line-height: 1.5; border: 1.5px dashed #c9cec6; border-radius: 10px; }
.pf-lib-row {
  display: flex; align-items: center; gap: 4px;
  min-height: 36px; padding: 0 4px 0 calc(4px + var(--pf-depth, 0) * 18px);
  border-radius: 8px; cursor: pointer; user-select: none;
  color: var(--pf-ink); font-size: 12.5px;
}
.pf-lib-row:hover { background: var(--pf-hover); }
.pf-lib-row.active { background: var(--pf-accent-soft); }
.pf-lib-row.dragging { opacity: 0.45; }
.pf-lib-row.pf-lib-drop-target { outline: 2px dashed var(--pf-accent); outline-offset: -2px; background: var(--pf-accent-soft); }
.pf-lib-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-lib-folder .pf-lib-name { font-weight: 600; }
.pf-lib-count {
  flex-shrink: 0; min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: var(--pf-ground); color: var(--pf-muted); font-size: 11px; text-align: center; font-variant-numeric: tabular-nums;
}
.pf-lib-btn, .pf-lib-chevron {
  flex-shrink: 0; width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 7px; background: transparent; color: var(--pf-muted); cursor: pointer;
}
.pf-lib-btn:hover, .pf-lib-chevron:hover { background: rgba(23, 33, 27, 0.07); color: var(--pf-ink); }
.pf-lib-btn:focus-visible, .pf-lib-chevron:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: -2px; }
.pf-lib-chevron svg { transition: transform 0.15s ease; }
.pf-lib-chevron.open svg { transform: rotate(90deg); }
.pf-lib-folder-icon { display: inline-flex; color: var(--pf-accent); flex-shrink: 0; }
.pf-lib-vis { color: var(--pf-accent); }
.pf-lib-vis.muted { color: #a3aaa5; }
.pf-lib-layer .pf-lib-draw, .pf-lib-layer .pf-lib-zoom { opacity: 0; }
.pf-lib-layer:hover .pf-lib-draw, .pf-lib-layer:hover .pf-lib-zoom,
.pf-lib-layer:focus-within .pf-lib-draw, .pf-lib-layer:focus-within .pf-lib-zoom,
.pf-lib-layer.active .pf-lib-draw, .pf-lib-layer.active .pf-lib-zoom { opacity: 1; }
@media (hover: none) { .pf-lib-layer .pf-lib-draw, .pf-lib-layer .pf-lib-zoom { opacity: 1; } }
.pf-lib-swatch { flex-shrink: 0; width: 12px; height: 12px; margin: 0 4px 0 2px; background: var(--pf-sw); border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.15); }
.pf-lib-swatch-line { height: 3px; width: 14px; border: none; border-radius: 2px; }
.pf-lib-swatch-point { border-radius: 50%; width: 10px; height: 10px; }

.pf-lib-hint { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--pf-muted); }

/* Stockage local */
.pf-lib-storage { padding: 10px 12px; border-radius: 10px; background: var(--pf-ground); display: flex; flex-direction: column; gap: 4px; }
.pf-lib-switch { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--pf-ink); cursor: pointer; }
.pf-lib-switch input { width: 16px; height: 16px; margin: 0; accent-color: var(--pf-accent); }
.pf-lib-storage-status { font-size: 11.5px; color: var(--pf-muted); padding-left: 24px; }

.pf-lib-danger {
  align-self: flex-start; height: 32px; padding: 0 12px; border-radius: 8px;
  background: #fff; border: 1px solid #f1c4c4; color: #b42318;
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.pf-lib-danger:hover { background: #fef3f2; border-color: #b42318; }

/* Menus contextuels */
.pf-lib-menu {
  position: fixed; z-index: 10050; min-width: 200px; max-width: 300px; max-height: 60vh; overflow-y: auto;
  padding: 5px; background: #fff; border: 1px solid var(--pf-line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(23, 33, 27, 0.16);
  font-family: Inter, system-ui, sans-serif;
}
.pf-lib-menu-item {
  display: block; width: 100%; padding: 8px 10px; border: none; border-radius: 7px;
  background: transparent; color: var(--pf-ink); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-lib-menu-item:hover:not(:disabled), .pf-lib-menu-item:focus-visible { background: var(--pf-hover); outline: none; }
.pf-lib-menu-item:disabled { color: #a3aaa5; cursor: default; }
.pf-lib-menu-item.danger { color: #b42318; }
.pf-lib-menu-item.danger:hover { background: #fef3f2; }
.pf-lib-menu-item.indent-1 { padding-left: 22px; }
.pf-lib-menu-item.indent-2 { padding-left: 34px; }
.pf-lib-menu-item.indent-3 { padding-left: 46px; }
.pf-lib-menu-item.indent-4, .pf-lib-menu-item.indent-5, .pf-lib-menu-item.indent-6 { padding-left: 58px; }
.pf-lib-menu-sep { height: 1px; margin: 4px 6px; background: var(--pf-line-soft); }

/* Fenêtre de confirmation */
.pf-lib-confirm { z-index: 10060; }
.pf-lib-confirm .vector-modal { max-width: 440px; }
.pf-lib-confirm .vector-modal-title { font-size: 15px; font-weight: 700; color: var(--pf-ink); }
.pf-lib-confirm-msg { margin: 0 0 16px; font-size: 13px; line-height: 1.55; color: #3b4540; }
.pf-lib-confirm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pf-lib-spacer { flex: 1; }
.pf-lib-confirm-actions button {
  height: 36px; padding: 0 14px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: #fff; border: 1px solid #d5d9d3; color: var(--pf-ink);
}
.pf-lib-confirm-actions button:hover { background: var(--pf-hover); }
.pf-lib-confirm-actions button:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: 2px; }
.pf-lib-confirm-actions .pf-lib-confirm-extra { border-color: transparent; color: var(--pf-accent); padding: 0 6px; }
.pf-lib-confirm-actions .pf-lib-confirm-ok { background: var(--pf-accent); border-color: var(--pf-accent); color: #fff; }
.pf-lib-confirm-actions .pf-lib-confirm-ok:hover { background: var(--pf-accent-strong); }
.pf-lib-confirm-actions .pf-lib-confirm-ok.danger { background: #b42318; border-color: #b42318; }
.pf-lib-confirm-actions .pf-lib-confirm-ok.danger:hover { background: #912018; }

/* Ajustements : barre d'outils sur une ligne, actions de confirmation */
.pf-lib-head { flex-wrap: nowrap; }
.pf-lib-primary, .pf-lib-tool { padding: 0 10px; font-size: 12px; gap: 5px; white-space: nowrap; }
.pf-lib-tool { flex: 0 1 auto; }
.pf-lib-confirm-actions { justify-content: flex-end; }
.pf-lib-confirm-actions .pf-lib-spacer { display: none; }
.pf-lib-confirm-actions .pf-lib-confirm-extra { flex-basis: 100%; order: -1; justify-content: flex-start; text-align: left; height: auto; padding: 0 0 6px; }
.pf-lib-confirm-actions .pf-lib-confirm-extra:hover { background: transparent; text-decoration: underline; }

/* Symbole de couche : double-clic pour le style */
.pf-lib-swatch-btn {
  flex-shrink: 0; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: transparent; cursor: pointer;
}
.pf-lib-swatch-btn:hover { background: rgba(23, 33, 27, 0.07); }
.pf-lib-swatch-btn:focus-visible { outline: 2px solid var(--pf-accent); outline-offset: -2px; }
.pf-lib-swatch-btn .pf-lib-swatch { margin: 0; }

/* ==========================================================================
   Données régionales hors Québec (France, États-Unis, autres provinces)
   ========================================================================== */
#pf-regional-group[hidden] { display: none !important; }
.pf-regional-list { display: flex; flex-direction: column; }
.pf-reg-sub { font-size: 11.5px; color: var(--pf-muted); line-height: 1.4; margin-bottom: 6px; }
.pf-reg-hint { margin: 6px 8px 0; font-size: 11.5px; color: var(--pf-muted); line-height: 1.4; }
.pf-reg-legend { display: block; max-width: 100%; margin-top: 8px; border-radius: 6px; border: 1px solid var(--pf-line-soft); }
.pf-reg-loading { display: flex; align-items: center; gap: 8px; color: var(--pf-muted); font-size: 12.5px; padding: 6px 0; }
.pf-reg-text { margin: 0; font-size: 12.5px; line-height: 1.5; color: #3b4540; }
.pf-reg-source { margin-top: 4px; font-size: 11px; color: var(--pf-muted); }
.pf-reg-empty { color: var(--pf-muted); font-size: 12.5px; padding: 10px 0; }
.pf-reg-series-extra { margin-top: 6px; font-size: 11.5px; color: #3b4540; line-height: 1.45; }
.pf-reg-note { margin: 8px 0 0; font-size: 11px; color: var(--pf-muted); line-height: 1.4; }
.pf-reg-fiche .pf-fiche-actions-grid .btn-popup-parcel-action { min-height: 46px; }
.pf-reg-muted { color: var(--pf-muted); font-size: 11px; }

/* Source du relief LiDAR hors Canada */
.pf-dem-note { margin: 10px 8px 4px; padding: 8px 10px; border-radius: 8px; background: var(--pf-accent-soft); color: var(--pf-ink); font-size: 11.5px; line-height: 1.4; display: flex; flex-direction: column; gap: 2px; }
.pf-dem-note[hidden] { display: none; }
.pf-dem-note strong { font-size: 12px; color: var(--pf-accent-strong); font-weight: 600; }
.pf-dem-note span { color: var(--pf-muted); }
.pf-vec-lidar { margin-top: 8px; min-width: 280px; }
/* dernier bouton seul sur sa rangée : pleine largeur */
.pf-vec-lidar .pf-fiche-actions-grid .btn-popup-parcel-action:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pf-vec-lidar .pf-fiche-actions { margin: 0; padding: 8px 0 0; border-top: 1px solid var(--pf-line-soft); }

/* ==========================================================================
   MOBILE — habillage complet (barre du bas, recherche, feuilles, docks)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --pf-nav-h: calc(60px + env(safe-area-inset-bottom, 0px));
    --pf-safe-top: env(safe-area-inset-top, 0px);
    --pf-sheet-shadow: 0 -10px 30px rgba(23, 33, 27, 0.16);
  }

  /* Barre de navigation */
  .mobile-bottom-bar {
    height: var(--pf-nav-h) !important;
    padding: 0 6px env(safe-area-inset-bottom, 0px) !important;
    background: rgba(255, 255, 255, 0.97) !important;
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--pf-line) !important;
    box-shadow: 0 -2px 14px rgba(23, 33, 27, 0.06) !important;
  }
  .mobile-nav-item {
    gap: 3px !important; padding: 6px 2px 4px !important;
    color: var(--pf-muted) !important; font-size: 11px !important; font-weight: 600 !important; letter-spacing: 0.01em;
  }
  .mobile-nav-item svg {
    width: 52px; height: 28px; padding: 4px 16px; box-sizing: border-box;
    border-radius: 14px; stroke-width: 1.9; transform: none !important;
    transition: background 0.18s ease, color 0.18s ease;
  }
  .mobile-nav-item.active, .mobile-nav-item.active-blue { color: var(--pf-accent-strong) !important; }
  .mobile-nav-item.active svg, .mobile-nav-item.active-blue svg { stroke: var(--pf-accent-strong) !important; background: var(--pf-accent-soft); }
  .mobile-nav-item:active { transform: none !important; }
  .mobile-nav-item:active svg { background: var(--pf-hover); }

  /* Recherche toujours visible, en pilule */
  .map-search-panel {
    display: block !important;
    top: calc(var(--pf-safe-top) + 10px) !important; left: 12px !important; right: 12px !important;
    padding: 0 !important; background: transparent !important; border: none !important; box-shadow: none !important;
    z-index: 1400 !important;
  }
  .map-search-panel .search-input-wrapper, .map-search-panel .search-box { border: none; }
  .map-search-panel .search-input {
    height: 46px !important; border-radius: 23px !important; padding-left: 42px !important;
    border: 1px solid transparent !important; background: #fff !important; font-size: 15px !important;
    box-shadow: 0 2px 10px rgba(23, 33, 27, 0.14), 0 0 0 1px rgba(23, 33, 27, 0.05) !important;
  }
  .map-search-panel .search-input:focus { border-color: var(--pf-accent) !important; box-shadow: 0 2px 12px rgba(46, 106, 76, 0.22) !important; }
  .map-search-panel .search-suggestions { border-radius: 14px !important; margin-top: 6px !important; box-shadow: 0 8px 24px rgba(23, 33, 27, 0.16) !important; border: none !important; }

  /* Contrôles de carte : sous la recherche, compacts ; la position est dans la barre du bas */
  .maplibregl-ctrl-top-right { top: calc(var(--pf-safe-top) + 66px) !important; }
  .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 12px 8px 0 !important; }
  .maplibregl-ctrl-group {
    border-radius: 12px !important; overflow: hidden;
    box-shadow: 0 2px 10px rgba(23, 33, 27, 0.14), 0 0 0 1px rgba(23, 33, 27, 0.05) !important;
  }
  .maplibregl-ctrl-group button { width: 40px !important; height: 40px !important; }
  .maplibregl-ctrl-group:has(.maplibregl-ctrl-geolocate) { display: none !important; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--pf-nav-h) + 4px) !important; }
  .maplibregl-ctrl-scale { border-radius: 4px; font-size: 10px !important; background: rgba(255, 255, 255, 0.8) !important; }
  .maplibregl-ctrl-attrib.maplibregl-compact { margin: 0 8px 4px 0 !important; }
  .site-footer { display: none !important; }

  /* Feuille « Affichage & couches » */
  .panel-tools.open {
    bottom: var(--pf-nav-h) !important; max-height: calc(88vh - var(--pf-nav-h)) !important;
    border-radius: 22px 22px 0 0 !important; border-top: none !important;
    box-shadow: var(--pf-sheet-shadow) !important;
    padding: 8px 16px 24px !important;
  }
  .panel-tools.open::before {
    content: ""; display: block; flex-shrink: 0; width: 40px; height: 5px; margin: 2px auto 4px;
    border-radius: 3px; background: #d5d9d3;
  }
  .panel-tools .tools-drawer-header {
    position: sticky; top: -8px; z-index: 2; margin: 0 -16px; padding: 6px 16px 10px !important;
    background: #fff; border-bottom: 1px solid var(--pf-line-soft) !important;
  }
  .panel-tools .tools-drawer-title { font-size: 16px !important; color: var(--pf-ink) !important; }

  /* Boîte à outils : feuille du bas, au style des fiches */
  .mobile-tools-sheet {
    left: 0 !important; right: 0 !important; bottom: var(--pf-nav-h) !important; max-width: none !important;
    max-height: calc(86vh - var(--pf-nav-h)); overflow-y: auto;
    border-radius: 22px 22px 0 0 !important; padding: 8px 16px 18px !important;
    box-shadow: var(--pf-sheet-shadow) !important; border: none !important;
    transform: translateY(24px) !important; transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease, visibility 0.18s ease !important;
  }
  .mobile-tools-sheet.open { transform: none !important; }
  .mobile-tools-sheet::before {
    content: ""; display: block; flex-shrink: 0; width: 40px; height: 5px; margin: 2px auto 2px;
    border-radius: 3px; background: #d5d9d3;
  }
  .mobile-tools-header { border-bottom: none !important; padding-bottom: 2px !important; }
  .mobile-tools-title { font-size: 16px !important; color: var(--pf-ink) !important; }
  .mobile-tools-title svg { color: var(--pf-accent) !important; }
  .mobile-tools-close-btn { width: 32px !important; height: 32px !important; background: var(--pf-ground) !important; color: var(--pf-muted) !important; }
  .mobile-tools-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .mobile-tool-card {
    flex-direction: column; align-items: flex-start !important; gap: 8px !important;
    padding: 12px !important; min-height: 104px;
    background: #fff !important; border: 1px solid var(--pf-line) !important; border-radius: 14px !important;
  }
  .mobile-tool-card:active { background: var(--pf-hover) !important; border-color: var(--pf-accent) !important; }
  .mobile-tool-icon {
    width: 36px !important; height: 36px !important; border-radius: 10px !important;
    background: var(--pf-accent-soft) !important; color: var(--pf-accent-strong) !important; border: none !important;
  }
  .mobile-tool-icon svg { stroke: currentColor !important; color: var(--pf-accent-strong) !important; }
  .mobile-tool-name { font-size: 13.5px !important; font-weight: 650 !important; color: var(--pf-ink) !important; line-height: 1.25; }
  .mobile-tool-desc { font-size: 11.5px !important; color: var(--pf-muted) !important; line-height: 1.3; }
  .mobile-tool-badge { position: absolute; top: 10px; right: 10px; background: var(--pf-accent) !important; color: #fff !important; border: none !important; }
  .mobile-tools-backdrop, .tools-backdrop { background: rgba(23, 33, 27, 0.32) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

  /* Fiche parcelle : feuille du bas avec poignée */
  .maplibregl-popup:has(.pf-fiche) { bottom: var(--pf-nav-h) !important; }
  .maplibregl-popup:has(.pf-fiche) .maplibregl-popup-content {
    max-height: calc(72vh - var(--pf-nav-h)); border-radius: 22px 22px 0 0 !important; box-shadow: var(--pf-sheet-shadow) !important;
  }
  .maplibregl-popup:has(.pf-fiche) .pf-fiche { max-height: calc(72vh - var(--pf-nav-h)); }
  .maplibregl-popup:has(.pf-fiche) .maplibregl-popup-content::before {
    content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
    border-radius: 3px; background: #d5d9d3; z-index: 3;
  }
  .maplibregl-popup:has(.pf-fiche) .maplibregl-popup-close-button { top: 14px; right: 14px; }
  .pf-fiche-head { padding-top: 22px !important; }
  .pf-fiche-actions-grid { gap: 8px !important; }

  /* Docks de résultats (profil, NDVI, pluie, comparaison LiDAR) : pleine largeur au-dessus de la barre */
  .elevation-profile-dock {
    left: 0 !important; right: 0 !important; bottom: var(--pf-nav-h) !important; width: auto !important;
    max-height: calc(70vh - var(--pf-nav-h)) !important; overflow-y: auto;
    border-radius: 22px 22px 0 0 !important; border: none !important; box-shadow: var(--pf-sheet-shadow) !important;
    padding: 14px 14px 16px !important;
  }
  .elevation-profile-dock .profile-dock-header { position: sticky; top: -14px; z-index: 2; background: #fff; margin: -14px -14px 6px; padding: 14px 14px 8px; }
  .pf-cf-controls { gap: 8px; }
  .pf-cf-field { flex: 1 1 calc(50% - 30px); min-width: 0; flex-direction: column; align-items: stretch; gap: 3px; font-size: 11px; }
  .pf-cf-field select { max-width: none !important; width: 100%; height: 36px; }
  .pf-cf-swap { align-self: flex-end; height: 36px !important; }
  .pf-cf-opacity { flex-direction: row; align-items: center; }
  .pf-cf-legend-row > * { flex-basis: 100% !important; max-width: none !important; }

  /* Actions de tracé (profil, mesure) */
  .mobile-drawing-actions { bottom: calc(var(--pf-nav-h) + 10px) !important; }
  .mobile-act-btn { border-radius: 22px !important; }
  .mobile-act-btn.btn-calc { background: var(--pf-accent) !important; border-color: var(--pf-accent) !important; }

  /* Bannière d'installation : carte flottante au-dessus de la barre */
  .pwa-install-bar {
    left: 12px !important; right: 12px !important; bottom: calc(var(--pf-nav-h) + 10px) !important;
    padding: 12px 12px 12px 16px !important; border-radius: 16px !important;
    background: #fff !important; color: var(--pf-ink) !important;
    border: 1px solid var(--pf-line); box-shadow: 0 10px 30px rgba(23, 33, 27, 0.18) !important;
    font-size: 13px !important;
  }
  .pwa-install-btn { background: var(--pf-accent) !important; border-radius: 10px !important; }
  .pwa-install-dismiss { color: var(--pf-muted) !important; }

  .share-toast { bottom: calc(var(--pf-nav-h) + 12px) !important; }
  .pf-dem-note { margin-left: 0; margin-right: 0; }
}
@media (max-width: 768px) {
  .map-search-panel .search-input-wrapper { position: relative; }
  .map-search-panel .search-icon { position: absolute; left: 16px !important; top: 50% !important; transform: translateY(-50%); width: 18px !important; height: 18px !important; color: var(--pf-muted); z-index: 1; }
}
@media (max-width: 768px) {
  .mobile-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .mobile-tool-card { min-width: 0; width: 100%; box-sizing: border-box; }
  .mobile-tool-info { min-width: 0; width: 100%; }
  .mobile-tool-name, .mobile-tool-desc { white-space: normal !important; overflow-wrap: anywhere; }
  .elevation-profile-dock .profile-dock-header { gap: 8px; align-items: flex-start; }
  .elevation-profile-dock .profile-dock-title { min-width: 0; flex: 1 1 auto; flex-wrap: wrap; line-height: 1.3; }
  .elevation-profile-dock .profile-dock-header-right { flex-shrink: 0; }
  .elevation-profile-dock .profile-dock-btn { white-space: nowrap; }
}

/* ==========================================================================
   Écran partagé (js/split.js)
   ========================================================================== */
.pf-split-mirror, .pf-split-mirror.maplibregl-map { position: absolute !important; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
.pf-split-mirror .maplibregl-control-container { display: none; }
.pf-split-mirror canvas { outline: none; }
.pf-split-handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 28px; margin-left: -14px;
  z-index: 3; cursor: ew-resize; touch-action: none; outline: none;
}
.pf-split-handle::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px;
  background: #fff; box-shadow: 0 0 0 1px rgba(23, 33, 27, 0.18), 0 0 10px rgba(23, 33, 27, 0.25);
}
.pf-split-knob {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%; background: #fff; color: var(--pf-accent-strong);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(23, 33, 27, 0.25), 0 0 0 1px rgba(23, 33, 27, 0.08);
  transition: transform 0.12s ease;
}
.pf-split-handle:hover .pf-split-knob, .pf-split-handle.pf-dragging .pf-split-knob, .pf-split-handle:focus-visible .pf-split-knob { transform: scale(1.08); color: var(--pf-accent); }
.pf-split-handle:focus-visible .pf-split-knob { box-shadow: 0 0 0 3px var(--pf-accent-soft), 0 2px 10px rgba(23, 33, 27, 0.25); }
.pf-split-tag {
  position: absolute; top: 12px; z-index: 3; max-width: 38%;
  padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 6px rgba(23, 33, 27, 0.16); color: var(--pf-ink);
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.pf-split-panel {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 4;
  width: 340px; max-width: calc(100% - 32px); max-height: 52vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 14px; border: 1px solid var(--pf-line);
  box-shadow: 0 10px 30px rgba(23, 33, 27, 0.18); font-size: 13px; color: var(--pf-ink);
}
.pf-split-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--pf-line-soft); }
.pf-split-title { flex: 1; font-weight: 700; font-size: 13.5px; }
.pf-split-head button { width: 28px; height: 28px; border-radius: 8px; border: none; background: var(--pf-ground); color: var(--pf-muted); font-size: 16px; line-height: 1; cursor: pointer; }
.pf-split-head button:hover { background: var(--pf-hover); color: var(--pf-ink); }
.pf-split-panel.pf-collapsed .pf-split-body { display: none; }
.pf-split-panel.pf-collapsed .pf-split-collapse { transform: rotate(180deg); }
.pf-split-body { overflow-y: auto; padding: 10px 14px 12px; }
.pf-split-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pf-split-presets button {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid #d5d9d3; background: #fff;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--pf-ink); cursor: pointer;
}
.pf-split-presets button:hover { border-color: var(--pf-accent); background: var(--pf-hover); color: var(--pf-accent-strong); }
.pf-split-presets button[data-split="lidar-ndvi"] { background: var(--pf-accent); border-color: var(--pf-accent); color: #fff; }
.pf-split-presets button[data-split="lidar-ndvi"]:hover { background: var(--pf-accent-strong); }
.pf-split-cols, .pf-split-row { display: grid; grid-template-columns: 1fr 58px 58px; align-items: center; }
.pf-split-cols { font-size: 11px; font-weight: 600; color: var(--pf-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 0 4px; }
.pf-split-cols span:not(:first-child), .pf-split-row label { text-align: center; }
.pf-split-row { padding: 6px 0; border-top: 1px solid var(--pf-line-soft); }
.pf-split-name { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-split-row input { width: 17px; height: 17px; accent-color: var(--pf-accent); cursor: pointer; margin: 0; }
.pf-split-empty { color: var(--pf-muted); padding: 6px 0; }
.pf-split-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--pf-muted); line-height: 1.4; }
.pf-list-btn.pf-on { background: var(--pf-accent-soft); }
.pf-list-btn.pf-on .pf-list-name { color: var(--pf-accent-strong); }
@media (max-width: 768px) {
  .pf-split-tag { top: calc(var(--pf-safe-top, 0px) + 66px); font-size: 11px; max-width: 34%; }
  .pf-split-panel {
    left: 12px; right: 12px; width: auto; max-width: none; transform: none;
    bottom: calc(var(--pf-nav-h) + 10px); max-height: 42vh;
  }
  .pf-split-knob { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
}
@media (max-width: 768px) { .pf-split-knob { top: 34%; } }

/* Tiroir des résultats : un seul visible à la fois, aussi sur mobile ; œil de visibilité */
.pf-tray-hidden { display: none !important; }
.pf-tray-tab > button.pf-tray-eye {
  width: 26px; height: 26px; margin-left: 4px; padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: inherit; background: transparent; border: none; cursor: pointer;
}
.pf-tray-tab > button.pf-tray-eye:hover { background: rgba(0, 0, 0, 0.06) !important; }
.pf-tray-tab > button.pf-tray-eye + button { padding-left: 4px !important; }
.pf-tray-tab.pf-layer-off > button:not(:last-child) { opacity: 0.55; }
.pf-tray-tab.pf-layer-off > button.pf-tray-eye { opacity: 1; color: var(--pf-muted); }
@media (max-width: 768px) {
  .pf-tray-tabs { margin: -2px -4px 6px; padding-bottom: 8px; gap: 4px; }
  .pf-tray-tab { border: 1px solid var(--pf-line); background: #fff; }
  .pf-tray-tab.pf-on { border-color: transparent; }
  .pf-tray-tab > button:first-child:not(.pf-tray-eye), .pf-tray-tab > button.pf-tray-eye + button { height: 34px; font-size: 12.5px; }
  .pf-tray-tab > button.pf-tray-eye { width: 30px; height: 30px; }
  .pf-tray-tab > button:last-child { width: 30px; height: 30px; }
}
.pf-tray-tab > button.pf-tray-eye + button { height: 30px; padding: 0 4px !important; font-size: 12px; font-weight: 600; color: inherit; background: transparent; border: none; cursor: pointer; }
#sim-dock { max-height: 210px !important; }

/* Écran partagé : panneau en haut de la carte, hors de portée du tiroir des résultats */
.pf-split-panel { top: 52px; bottom: auto; max-height: calc(100% - 140px); }
@media (max-width: 768px) {
  .pf-split-panel {
    top: calc(var(--pf-safe-top, 0px) + 104px); bottom: auto;
    left: 12px; right: 64px; max-height: calc(100% - var(--pf-safe-top, 0px) - 104px - var(--pf-nav-h) - 24px);
  }
  .pf-split-knob { top: 62%; }
}
@media (max-width: 768px) { .pf-split-handle { z-index: 5; } .pf-split-knob { top: 30%; } }

/* ---- Tuiles NDVI enregistrées (liens vers les COG Sentinel-2) ---- */
.ndvi-save-btn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px !important; font-weight: 600; color: #166534; background: #f0fdf4; border-color: #86efac; }
.ndvi-save-btn.saved { color: #fff; background: #16a34a; border-color: #15803d; }
.ndvi-save-btn.saved svg path { fill: currentColor; }
.pf-lib-swatch-raster { width: 14px; border-radius: 2px; background: linear-gradient(90deg, #a50026, #f46d43, #fee08b, #d9ef8b, #66bd63, #006837); }
@media (max-width: 768px) { .ndvi-save-btn span { display: none; } }

/* ==========================================================================
   Zones de gestion (SKATER) : réutilise le style du tiroir déblais / remblais
   ========================================================================== */
.pf-zn-controls { border-bottom: 0; padding-bottom: 0; }
.pf-zn-label { font-weight: 600; color: var(--pf-muted); }
.pf-zn-empty { font-size: 12px; color: var(--pf-muted); line-height: 1.45; }
/* bouton du menu : résumé des couches, ouvre la fenêtre */
.pf-zn .pf-zn-layers-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; max-width: 420px; padding: 0 10px;
  border: 1px solid #d5d9d3; border-radius: 8px; background: #fff; font: inherit; color: var(--pf-ink); cursor: pointer;
}
.pf-zn .pf-zn-layers-btn:hover { border-color: var(--pf-accent); background: var(--pf-hover); }
.pf-zn-layers-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pf-zn-layers-edit { flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--pf-accent-strong); }
/* fenêtre « Couches et pondération » */
.pf-zn-modal .vector-modal { max-width: 440px; font-size: 13px; color: var(--pf-ink); }
.pf-zn-modal-help { margin: 0; font-size: 12px; line-height: 1.45; color: var(--pf-muted); }
.pf-zn-modal-head {
  display: flex; justify-content: space-between; padding: 0 2px 5px; border-bottom: 1px solid var(--pf-line);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pf-muted);
}
.pf-zn-modal-list { display: flex; flex-direction: column; padding-top: 4px; }
.pf-zn-modal-list .pf-zn-empty { padding: 6px 2px; }
.pf-zn-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; padding: 0 2px; }
.pf-zn-item + .pf-zn-item { border-top: 1px solid var(--pf-line-soft); }
.pf-zn-item .pf-cf-check { flex: 1 1 auto; min-height: 34px; }
.pf-zn .pf-zn-w {
  width: 58px; height: 28px; padding: 0 6px; flex-shrink: 0;
  border: 1px solid #d5d9d3; border-radius: 6px; background: #fff;
  font: inherit; color: var(--pf-ink); font-variant-numeric: tabular-nums;
}
.pf-zn .pf-zn-w:focus { outline: 2px solid var(--pf-accent-soft); border-color: var(--pf-accent); }
.pf-zn .pf-zn-w:disabled { opacity: 0.4; background: transparent; }
.pf-zn-modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.pf-zn-modal .pf-zn-modal-secondary { height: 30px; padding: 0 12px; border-radius: 8px; background: #fff; border: 1px solid #d5d9d3; color: var(--pf-ink); font-size: 12px; font-weight: 600; cursor: pointer; }
.pf-zn .pf-cf-field input[type="number"] {
  width: 62px; height: 30px; padding: 0 6px;
  border: 1px solid #d5d9d3; border-radius: 8px; background: #fff;
  font: inherit; color: var(--pf-ink); font-variant-numeric: tabular-nums;
}
.pf-zn .pf-cf-field input[type="number"]:focus { outline: 2px solid var(--pf-accent-soft); border-color: var(--pf-accent); }
.pf-zn #zones-k { width: 48px; }
.pf-zn .pf-zn-run {
  height: 30px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--pf-accent-strong);
  background: var(--pf-accent); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer;
}
.pf-zn .pf-zn-run:hover { background: var(--pf-accent-strong); }
.pf-zn .pf-zn-run:disabled, .pf-zn .pf-cf-btn:disabled { opacity: 0.5; cursor: default; }
.pf-zn #zones-results { display: flex; flex-direction: column; gap: 6px; }
.pf-zn .pf-cf-table td:first-child { white-space: nowrap; font-weight: 600; }
.pf-zn .pf-cf-table .pf-cf-dot { width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; }
.pf-zn-summary { font-size: 11px; color: var(--pf-muted); line-height: 1.45; }
@media (max-width: 768px) {
  .pf-zn .pf-cf-field input[type="number"] { width: 54px; }
  .pf-zn .pf-zn-run { flex: 1 1 100%; }
  .pf-zn .pf-zn-layers-btn { flex: 1 1 100%; max-width: none; }
  .pf-zn-modal-actions .pf-zn-run { flex: 0 0 auto; }
}

/* ==========================================================================
   Menu de langue (i18n)
   ========================================================================== */
.pf-lang {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px 0 10px;
  border: 1px solid var(--pf-line); border-radius: 8px; background: #fff; color: var(--pf-muted); cursor: pointer;
}
.pf-lang:hover, .pf-lang:focus-within { border-color: var(--pf-accent); }
.pf-lang-select {
  height: 30px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--pf-ink); cursor: pointer;
}
.pf-lang-select:focus { outline: 2px solid var(--pf-accent-soft); }
.pf-lang-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.pf-lang-row .pf-lang-select { border: 1px solid #d5d9d3; background: #fff; padding: 0 8px; }

/* ==========================================================================
   Zone tampon : fenêtre posée à droite, sans voile, pour voir l'aperçu sur la carte
   ========================================================================== */
.pf-tp.vector-modal-overlay, .pf-tp.vector-modal-overlay.active { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; align-items: flex-start; justify-content: flex-end; padding: 76px 20px 20px; }
.pf-tp.vector-modal-overlay.active .vector-modal { pointer-events: auto; max-width: 360px; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28); border: 1px solid var(--pf-line); }
.pf-tp [hidden] { display: none !important; }
.pf-tp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; font-weight: 600; }
.pf-tp-row > span:last-child { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.pf-tp-choices { flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px !important; }
.pf-tp #tampon-distance {
  width: 84px; height: 32px; padding: 0 8px; border: 1px solid #d5d9d3; border-radius: 8px; background: #fff;
  font: inherit; font-weight: 600; color: var(--pf-ink); font-variant-numeric: tabular-nums;
}
.pf-tp #tampon-distance:focus { outline: 2px solid var(--pf-accent-soft); border-color: var(--pf-accent); }
.pf-tp #tampon-poly-options { display: flex; flex-direction: column; gap: 6px; }
.pf-tp-check { min-height: 28px; }
.pf-tp-note { margin: 0; min-height: 18px; font-size: 12px; font-weight: 600; color: var(--pf-accent-strong); }
.pf-tp-note.pf-tp-warn { color: #9a3412; }
@media (max-width: 768px) {
  .pf-tp.vector-modal-overlay { justify-content: center; align-items: flex-end; padding: 12px 12px 84px; }
}

/* ==========================================================================
   Visionneuse de plans numérisés (plans de drainage)
   ========================================================================== */
.pf-plan-viewer { position: fixed; inset: 0; z-index: 10050; display: none; flex-direction: column; background: rgba(15, 23, 20, 0.94); color: #fff; }
.pf-plan-viewer.open { display: flex; }
.pf-plan-bar { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: rgba(0, 0, 0, 0.35); }
.pf-plan-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.pf-plan-tools { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.pf-plan-btn {
  min-width: 36px; height: 36px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 8px; background: rgba(255, 255, 255, 0.08);
  color: #fff; font: inherit; font-size: 18px; line-height: 1; text-decoration: none; cursor: pointer;
}
.pf-plan-btn.pf-plan-text { padding: 0 12px; font-size: 12.5px; font-weight: 600; }
.pf-plan-btn:hover { background: rgba(255, 255, 255, 0.2); }
.pf-plan-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.pf-plan-stage { position: relative; flex: 1 1 auto; overflow: hidden; cursor: grab; touch-action: none; }
.pf-plan-stage.pf-plan-grab { cursor: grabbing; }
.pf-plan-img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; background: #fff; }
.pf-plan-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.pf-plan-status { position: absolute; left: 0; right: 0; top: 0; z-index: 1; padding: 10px 14px; text-align: center; font-size: 12.5px; color: rgba(255, 255, 255, 0.85); pointer-events: none; }
.pf-plan-status:empty { display: none; }
.pf-plan-framed .pf-plan-stage { cursor: default; touch-action: auto; }
.pf-plan-framed .pf-plan-status { background: rgba(15, 23, 20, 0.8); }
.pf-plan-framed [data-act="in"], .pf-plan-framed [data-act="out"], .pf-plan-framed [data-act="fit"] { display: none; }

/* NDVI : la ligne d'aide et de lecture au survol est plus lisible que les pastilles de la saison */
#ndvi-hover-info { font-size: 13.5px; line-height: 1.4; min-height: 22px; padding: 3px 0; font-style: normal; font-weight: 500; color: var(--pf-ink); }
#ndvi-hover-info strong { font-weight: 700; }
#ndvi-stats-bar { font-size: 11px; }

/* Grille d'échantillonnage : mêmes fenêtres latérales que la zone tampon */
.pf-tp .pf-tp-num {
  width: 72px; height: 32px; padding: 0 8px; border: 1px solid #d5d9d3; border-radius: 8px; background: #fff;
  font: inherit; font-weight: 600; color: var(--pf-ink); font-variant-numeric: tabular-nums;
}
.pf-tp .pf-tp-select { height: 32px; max-width: 190px; padding: 0 6px; border: 1px solid #d5d9d3; border-radius: 8px; background: #fff; font: inherit; color: var(--pf-ink); }
.pf-tp .pf-tp-num:focus, .pf-tp .pf-tp-select:focus { outline: 2px solid var(--pf-accent-soft); border-color: var(--pf-accent); }
.pf-tp .pf-tp-auto { height: 32px; white-space: nowrap; }
.pf-tp .pf-tp-auto.pf-on { background: var(--pf-accent-soft); border-color: var(--pf-accent); color: var(--pf-accent-strong); }
.pf-tp .pf-tp-draw { width: 100%; height: 34px; margin-top: -4px; }
.pf-tp .pf-tp-draw.pf-on { background: #fff7ed; border-color: #ea580c; color: #9a3412; }

/* Essai à la ferme */
.pf-es.vector-modal-overlay.active .vector-modal { max-width: 380px; }
.pf-es .vector-modal-body { max-height: calc(100vh - 150px); overflow-y: auto; }
.pf-es .pf-tp-row { min-height: 32px; }
.pf-es .pf-es-text { width: 110px; text-align: left; }
.pf-es .pf-es-unit { width: 64px; text-align: left; }
.pf-es .pf-es-sm { width: 58px; }
.pf-es-block { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.pf-es .pf-es-wide { width: 100%; text-align: left; box-sizing: border-box; }
.pf-es .pf-es-off { opacity: 0.45; pointer-events: none; }
.pf-es #btn-essai-shuffle { margin-top: 0; }
.pf-es-legend { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.pf-es-legend:empty { display: none; }
.pf-es-leg { display: flex; align-items: center; gap: 8px; }
.pf-es-leg i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(15, 23, 42, 0.25); flex: 0 0 auto; }
.pf-es-leg-n { margin-left: auto; color: var(--pf-muted); font-variant-numeric: tabular-nums; }
.pf-es .pf-zn-modal-actions { flex-wrap: wrap; }
.pf-es-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.pf-es .pf-es-unit[placeholder] { width: 104px; }
.pf-es .pf-tp-num:disabled { opacity: 0.5; }
.pf-es-power { border-top: 1px solid var(--pf-line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.pf-es-power > summary { cursor: pointer; font-weight: 700; font-size: 13px; padding: 2px 0 4px; }
.pf-es .pf-es-md { width: 84px; }
.pf-es-leg { flex-wrap: wrap; }
.pf-es-leg-p { flex: 0 0 100%; padding-left: 22px; font-size: 11.5px; color: var(--pf-accent-strong); }
.pf-es-leg-p.pf-es-low { color: #9a3412; }
.pf-es-sub { font-weight: 700; font-size: 12.5px; margin-top: 6px; color: var(--pf-muted); }
.pf-es #essai-curve-box { display: flex; flex-direction: column; gap: 4px; }
.pf-es #btn-essai-sim { margin-top: 2px; }
.pf-es #essai-sim { font-weight: 500; line-height: 1.45; }
.pf-es-sim-line { display: block; }
.pf-es-sim-title { font-weight: 700; }
.pf-es-sim-sub { color: var(--pf-muted); font-size: 11.5px; margin-bottom: 4px; }
.pf-es-sim-item { position: relative; padding-left: 12px; margin-top: 3px; color: var(--pf-ink); }
.pf-es-sim-item::before { content: "•"; position: absolute; left: 0; color: var(--pf-accent-strong); }
.pf-es-sim-item.pf-es-low { color: #9a3412; }

/* NDVI sur téléphone : panneau compact (environ 40 % de l'écran au lieu de 60 %), graphique visible sans défiler */
@media (max-width: 768px) {
  .ndvi-dock { max-height: 52vh !important; padding: 10px 12px 10px !important; }
  .ndvi-dock .profile-dock-header { top: -10px; margin: -10px -12px 4px; padding: 10px 12px 6px; align-items: center; flex-wrap: nowrap; }
  /* le titre long (année, coordonnées) répète les menus et les pastilles : masqué */
  .ndvi-dock #ndvi-dock-title { display: none; }
  .ndvi-dock .profile-dock-title { flex: 0 0 auto; flex-wrap: nowrap; }
  .ndvi-dock .profile-dock-header-right { flex: 1 1 auto; min-width: 0; justify-content: flex-end; gap: 5px; flex-wrap: nowrap; }
  .ndvi-dock #ndvi-sensor-select { min-width: 0; flex: 0 1 auto; max-width: 96px; }
  .ndvi-dock #ndvi-index-select { min-width: 0; flex: 0 1 auto; max-width: 74px; }
  .ndvi-dock #ndvi-orbit-select { min-width: 0; flex: 0 1 auto; max-width: 84px; }
  .ndvi-dock-body { gap: 4px; }
  /* pastilles sur une seule ligne, à faire glisser */
  .ndvi-dock #ndvi-stats-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 4px; }
  .ndvi-dock #ndvi-stats-bar::-webkit-scrollbar { display: none; }
  .ndvi-dock #ndvi-stats-bar .stat-chip { flex: 0 0 auto; white-space: nowrap; }
  /* ligne d'aide au survol : sans objet au doigt */
  .ndvi-dock #ndvi-hover-info { display: none; }
  .ndvi-dock .ndvi-active-controls { padding: 6px 8px; gap: 4px; }
  /* date sur une ligne ; opacité, nuancier et légende sur une seconde ligne à faire glisser */
  .ndvi-dock .ndvi-controls-main-bar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px; }
  .ndvi-dock .ndvi-controls-main-bar > div:first-child { min-width: 0; }
  .ndvi-dock .ndvi-controls-main-bar > div:first-child .ndvi-date-badge { flex: 1 1 auto; }
  .ndvi-dock .ndvi-controls-main-bar > div:nth-child(n+2) { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; gap: 12px !important; overflow-x: auto; scrollbar-width: none; }
  .ndvi-dock .ndvi-controls-main-bar > div:nth-child(n+2)::-webkit-scrollbar { display: none; }
  .ndvi-dock .ndvi-controls-main-bar > div:nth-child(n+2) > * { flex: 0 0 auto; }
  .ndvi-dock .ndvi-opacity-wrap, .ndvi-dock .ndvi-stretch-group, .ndvi-dock .ndvi-legend-mini { flex-wrap: nowrap; white-space: nowrap; }
  .ndvi-dock .ndvi-date-badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 12px; }
  .ndvi-dock .ndvi-date-badge > span[title] { display: none; }
  .ndvi-dock .profile-chart-container { height: 130px !important; min-height: 130px !important; }
}

/* Stabilité du NDVI */
.pf-st-years { display: flex; flex-direction: column; gap: 4px; }
.pf-st-years:empty { display: none; }
.pf-st-year { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.pf-st-year.pf-st-off { opacity: 0.55; }
.pf-st .pf-st-date { max-width: 232px; font-size: 12px; font-variant-numeric: tabular-nums; }
.pf-st-why { font-size: 11.5px; color: var(--pf-muted); }
.pf-stats-hint { margin: 2px 10px 0; font-size: 11.5px; }
.pf-lang-row .pf-stats-toggle { width: 18px; height: 18px; accent-color: var(--pf-accent); }
.pf-st .pf-st-see { height: 30px; padding: 0 8px; flex: 0 0 auto; white-space: nowrap; }
.pf-st .pf-st-see.pf-on { background: var(--pf-accent-soft); border-color: var(--pf-accent); color: var(--pf-accent-strong); }
.pf-st .pf-st-date { max-width: 190px; }
.pf-st #stab-view:empty { display: none; }
.pf-st-late { color: #9a3412; font-weight: 600; cursor: help; }
.pf-st .pf-st-date { max-width: 168px; }

/* ---------- Climat : tableau de bord des stations météo ---------- */
.pf-cl .vector-modal { max-width: 1040px; font-size: 13px; color: var(--pf-ink); }
.pf-cl .vector-modal-body { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.pf-cl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.pf-cl-where { flex: 1 1 200px; color: var(--pf-muted); }
.pf-cl-where strong { color: var(--pf-ink); }
.pf-cl-bar label { display: flex; align-items: center; gap: 6px; color: var(--pf-muted); font-weight: 500; }
.pf-cl-select { font: inherit; color: var(--pf-ink); padding: 6px 8px; border: 1px solid var(--pf-line); border-radius: 8px; background: #fff; max-width: 260px; }
.pf-cl-info { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 12px; font-size: 12px; color: var(--pf-muted); }
.pf-cl-info span:empty { display: none; }
.pf-cl-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pf-cl-tile { background: var(--pf-ground); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.pf-cl-tile-label { font-size: 11px; font-weight: 500; color: var(--pf-muted); }
.pf-cl-tile-value { margin-top: 2px; font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--pf-ink); }
.pf-cl-tile-value small { font-size: 12px; font-weight: 600; color: var(--pf-muted); }
.pf-cl-tile-sub { margin-top: 3px; font-size: 11px; line-height: 1.35; color: var(--pf-muted); }
.pf-cl-tile.pf-cl-warn { box-shadow: inset 3px 0 0 #c2410c; }
.pf-cl-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 16px 0 6px; font-size: 12px; color: var(--pf-muted); }
.pf-cl-legend span, .pf-cl-tip-row { display: flex; align-items: center; gap: 6px; }
.pf-cl-sw-cur, .pf-cl-sw-ref, .pf-cl-sw-band { display: inline-block; width: 18px; flex: none; }
.pf-cl-sw-cur { height: 0; border-top: 2px solid #1f6f42; }
.pf-cl-sw-ref { height: 0; border-top: 2px dashed #6f7771; }
.pf-cl-sw-band { height: 10px; border-radius: 2px; background: #dfe5de; }
.pf-cl-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pf-cl-chart { border: 1px solid var(--pf-line); border-radius: 10px; padding: 10px 10px 4px; min-width: 0; }
.pf-cl-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.pf-cl-unit { color: var(--pf-muted); font-size: 11px; }
.pf-cl-plot { position: relative; }
.pf-cl-svg { display: block; width: 100%; height: auto; overflow: visible; }
.pf-cl-grid { stroke: var(--pf-line); stroke-width: 1; }
.pf-cl-tick { font-size: 10px; fill: var(--pf-muted); font-variant-numeric: tabular-nums; }
.pf-cl-band { fill: #dfe5de; stroke: none; }
.pf-cl-ref { fill: none; stroke: #6f7771; stroke-width: 1.5; stroke-dasharray: 4 3; }
.pf-cl-cur { fill: none; stroke: #1f6f42; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pf-cl-dot { fill: #1f6f42; stroke: #fff; stroke-width: 2; }
.pf-cl-lab { font-size: 10px; fill: var(--pf-muted); }
.pf-cl-lab-cur { fill: var(--pf-ink); font-weight: 700; }
.pf-cl-cross { stroke: var(--pf-ink); stroke-width: 1; opacity: 0.45; pointer-events: none; }
.pf-cl-tip { position: absolute; top: 4px; width: 140px; padding: 6px 8px; background: #fff; border: 1px solid var(--pf-line); border-radius: 8px; box-shadow: var(--pf-shadow); font-size: 11px; pointer-events: none; z-index: 2; }
.pf-cl-tip strong { display: block; margin-bottom: 2px; }
.pf-cl-tip-row span { flex: 1; color: var(--pf-muted); }
.pf-cl-tip-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-cl-h { margin: 18px 0 6px; font-size: 13px; font-weight: 700; }
.pf-cl-stations { display: grid; gap: 4px; }
.pf-cl-st { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px 96px; gap: 8px; align-items: center; width: 100%; padding: 7px 10px; border: 1px solid var(--pf-line); border-radius: 8px; background: #fff; font: inherit; font-size: 12px; color: var(--pf-muted); text-align: left; cursor: pointer; }
.pf-cl-st strong { color: var(--pf-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-cl-st span { text-align: right; font-variant-numeric: tabular-nums; }
.pf-cl-st:hover { background: var(--pf-hover); }
.pf-cl-st.pf-on { border-color: var(--pf-accent); background: var(--pf-accent-soft); }
.pf-cl-src { margin: 12px 0 0; font-size: 11px; line-height: 1.4; color: var(--pf-muted); }
.pf-cl-loading { opacity: 0.5; pointer-events: none; }
@media (max-width: 900px) {
  .pf-cl-charts { grid-template-columns: minmax(0, 1fr); }
  .pf-cl-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pf-cl.vector-modal-overlay { padding: 0; align-items: stretch; }
  .pf-cl .vector-modal { max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .pf-cl-tile-value { font-size: 19px; }
  .pf-cl-st { grid-template-columns: minmax(0, 1fr) 52px 52px; }
  .pf-cl-st span:last-child { display: none; }
}
