/* ===== GLOBAL ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }

/* ===== SIDEBAR ===== */
#sidebar {
  background: #1c3d2b;
  width: 220px;
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
#main-content {
  margin-left: 220px;
  min-height: 100vh;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  margin: 2px 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 500;
}
.sidebar-nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.sidebar-nav-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
}
.sidebar-nav-item svg { flex-shrink: 0; }

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}
.card-sm { border-radius: 12px; }

/* ===== STATUS BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-healthy { background: #dcfce7; color: #166534; }
.badge-watch { background: #fed7aa; color: #9a3412; }
.badge-alert { background: #fee2e2; color: #991b1b; }
.badge-incomplete { background: #f3f4f6; color: #374151; }
.badge-recent { background: #dbeafe; color: #1e40af; }
.badge-parfait { background: #dcfce7; color: #166534; }

/* ===== STATUS DOTS ===== */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-healthy { background: #16a34a; }
.dot-watch { background: #ea580c; }
.dot-alert { background: #dc2626; }
.dot-incomplete { background: #9ca3af; }
.dot-recent { background: #2563eb; }

/* ===== MAP ELEMENT DOTS ===== */
.map-point {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.15s;
  z-index: 10;
}
.map-point:hover { z-index: 20; }
.map-point-inner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: all 0.15s;
}
.map-point-inner.healthy { background: #16a34a; }
.map-point-inner.watch { background: #ea580c; }
.map-point-inner.alert { background: #dc2626; }
.map-point-inner.incomplete { background: #9ca3af; }
.map-point-inner.recent { background: #2563eb; }
.map-point.selected .map-point-inner {
  width: 36px; height: 36px;
  font-size: 12px;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.4), 0 4px 12px rgba(0,0,0,0.4);
}

/* Delete button on points in edit mode */
.map-point-delete {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  background: #dc2626;
  color: white;
  border-radius: 50%;
  border: 1.5px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  z-index: 15;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.map-point-delete:hover { background: #b91c1c; transform: scale(1.15); }

/* Label d'espèce affiché sous le point (bouton "Noms" activé) */
.map-point-label {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 6px;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.02em;
}


/* ===== MAP CONTAINER ===== */
#map-viewport {
  overflow: hidden;
  position: absolute;
  inset: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: #2d5a3d;
}
#map-viewport.grabbing { cursor: grabbing; }
#map-canvas {
  position: absolute;
  transform-origin: 0 0;
  width: 100%;
  height: 100%;
}
#map-bg {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: #1c3d2b;
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn-primary:hover { background: #2d5a3d; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: white;
  color: #1c3d2b;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  border: 1.5px solid #1c3d2b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-secondary:hover { background: #f0f7f2; }
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}
.btn-ghost {
  background: transparent;
  color: #374151;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.btn-ghost:hover { background: #f9fafb; }

/* ===== FORM INPUTS ===== */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  color: #111827;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus {
  border-color: #1c3d2b;
  box-shadow: 0 0 0 3px rgba(28,61,43,0.1);
}
.input::placeholder { color: #9ca3af; }
textarea.input { resize: vertical; min-height: 90px; }
select.input { cursor: pointer; }
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.label .required { color: #dc2626; margin-left: 2px; }
.form-group { margin-bottom: 18px; }

/* ===== TABS ===== */
.tabs-bar {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  gap: 0;
}
.tab-item {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-item:hover { color: #1c3d2b; }
.tab-item.active { color: #1c3d2b; border-bottom-color: #1c3d2b; font-weight: 600; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal-box {
  background: white;
  border-radius: 20px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== INFO BLOCK ===== */
.info-block {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: #1e40af;
  display: flex;
  gap: 10px;
}
.warning-block {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: #92400e;
  display: flex;
  gap: 10px;
}

/* ===== CHART ===== */
.chart-container { position: relative; }

/* ===== PHOTOS GRID ===== */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.photo-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .remove-btn {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px; height: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}

/* ===== FILE DROP ZONE ===== */
.dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: #6b7280;
  font-size: 13px;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: #1c3d2b;
  background: #f0f7f2;
  color: #1c3d2b;
}

/* ===== BOTTOM NAV MOBILE ===== */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid #e5e7eb;
  z-index: 40;
  display: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 6px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  gap: 4px;
  transition: color 0.15s;
}
.bottom-nav-item.active { color: #1c3d2b; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #main-content { margin-left: 0; padding-bottom: 80px; }
  #bottom-nav { display: flex; }
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  animation: slideInRight 0.2s ease;
  max-width: 320px;
}
.toast.success { border-left: 4px solid #16a34a; }
.toast.error { border-left: 4px solid #dc2626; }
.toast.info { border-left: 4px solid #2563eb; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.search-bar input {
  padding-left: 36px !important;
}
.search-bar .search-icon {
  position: absolute;
  left: 10px;
  color: #9ca3af;
  pointer-events: none;
}

/* ===== STAT CARDS ===== */
.stat-card {
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-value { font-size: 28px; font-weight: 700; color: #111827; line-height: 1.1; }
.stat-label { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* ===== LIST ITEMS ===== */
.list-item {
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #f9fafb; }

/* ===== PANEL DETAIL ===== */
.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #6b7280; font-weight: 500; min-width: 150px; flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
.detail-value { color: #111827; font-weight: 500; flex: 1; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== TOPBAR ===== */
#topbar {
  background: white;
  border-bottom: 1px solid #f3f4f6;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ===== PAGE CONTENT ===== */
.page-content {
  padding: 24px;
  max-width: 1400px;
}
@media (max-width: 768px) {
  .page-content { padding: 16px; }
  #topbar { padding: 0 16px; }
}

/* ===== MAP CONTROLS ===== */
.map-control-btn {
  width: 36px;
  height: 36px;
  background: white;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: all 0.15s;
  font-size: 18px;
  font-weight: 300;
  color: #374151;
}
.map-control-btn:hover { background: #f9fafb; transform: scale(1.05); }

/* ===== EVOLUTION CHART ===== */
.chart-tooltip {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ===== RIGHT PANEL ===== */
.right-panel {
  width: 320px;
  flex-shrink: 0;
}
@media (max-width: 1100px) {
  .right-panel { width: 280px; }
}

/* ===== DRAGGABLE CUSTOM FIELDS ===== */
.custom-field-item {
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: default;
}
.custom-field-item.dragging { opacity: 0.5; border-style: dashed; }
.drag-handle { cursor: grab; color: #9ca3af; }

/* ===== HOVER CARD on map ===== */
.map-popup {
  position: absolute;
  background: white;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 16px;
  min-width: 240px;
  z-index: 50;
  pointer-events: none;
  animation: fadeIn 0.15s ease;
}

/* ===== FOREST CARD ===== */
.forest-card-map {
  width: 100%;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #2d5a3d 0%, #1c3d2b 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.forest-card-map svg { opacity: 0.3; }

/* ===== GRADIENT SECTION ===== */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}
.section-subtitle { font-size: 13px; color: #6b7280; }

/* ===== PROGRESS BAR ===== */
.progress-bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease; }

/* ===== STEP INDICATOR ===== */
.step-badge {
  width: 28px; height: 28px;
  background: #1c3d2b;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ===== MISC ===== */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: #f3f4f6; margin: 16px 0; }
.text-muted { color: #6b7280; }
.text-small { font-size: 12px; }

/* ===== NOTIFICATION PANEL ===== */
#notif-panel {
  position: fixed;
  top: 64px;
  right: 16px;
  width: 340px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
  max-width: calc(100vw - 32px);
}

/* ===== IDENTIFICATION PAGE ===== */
/* Boutons catégorie */
.id-cat-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.id-cat-btn:hover { background: #f0f7f2; border-color: #1c3d2b; color: #1c3d2b; }
.id-cat-btn.active { background: #1c3d2b; color: white; border-color: #1c3d2b; }

/* Badge catégorie dans la fiche */
.id-cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* Carte accordion */
.id-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.id-card.expanded {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.id-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.1s;
}
.id-card-header:hover { background: #f9fafb; }
.id-card-emoji { font-size: 28px; flex-shrink: 0; }
.id-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid #f3f4f6;
}
.id-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 0;
}
.id-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.id-detail-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.id-detail-val {
  font-size: 13px;
  color: #111827;
  line-height: 1.5;
}
.id-interet {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f0f7f2;
  border-left: 3px solid #16a34a;
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  font-size: 13px;
  color: #166534;
  margin-top: 14px;
  line-height: 1.5;
}
.id-expand-icon { flex-shrink: 0; }

/* ===== MAP POLYGON OVERLAY ===== */
/* Position et dimensions gérées par syncPointsOverlay() en JS */
#map-polygons-svg {
  pointer-events: none;
  overflow: visible;
}
.map-polygon-group:hover polygon { fill-opacity: 0.35; }

/* ===== GUILDE LINES ===== */
/* Position et dimensions gérées par syncPointsOverlay() en JS */
#map-guildes-svg {
  pointer-events: none;
  overflow: visible;
}

/* ===== DASHBOARD — grilles de base (sans inline style) ===== */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.dash-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.dash-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* ===== TABLETTE (≤ 1024px) ===== */
@media (max-width: 1024px) {
  /* Page forêt : colonne latérale passe en dessous */
  .foret-detail-grid { grid-template-columns: 1fr !important; }
  /* Carte : barre de recherche sur tablette — cachée */
  #map-search-wrapper { display: none; }
}

/* ===== TABLETTE ≤ 900px ===== */
@media (max-width: 900px) {
  /* Page forêt — KPI en 2 colonnes */
  .foret-kpi-grid { grid-template-columns: 1fr 1fr !important; }
  /* Dashboard — KPI passe en 2×2 */
  .dash-kpi-grid { grid-template-columns: 1fr 1fr !important; }
  /* Dashboard — contenu passe en colonne unique */
  .dash-content-grid { grid-template-columns: 1fr !important; }
}

/* ===== MOBILE (≤ 768px) ===== */
@media (max-width: 768px) {

  /* Empêche le scroll horizontal global */
  body { overflow-x: hidden; }

  /* ---- TOPBAR ---- */
  #topbar .flex-1 { display: none; }
  #topbar { justify-content: space-between; }

  /* ---- SIDEBAR / BOTTOM NAV ---- */
  /* (already handled by Tailwind hide-mobile class) */

  /* ---- CARTE ---- */
  #carte-container { left: 0 !important; bottom: 56px !important; }

  /* Barre de recherche carte : cachée sur mobile (la recherche globale topbar suffit) */
  #map-search-wrapper { display: none !important; }

  /* Toolbar principale carte : mode toggle plus compact */
  .mode-btn { font-size: 11px !important; padding: 5px 8px !important; }

  /* Toolbar carte : scroll horizontal, toutes les options visibles */
  #filter-panel {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px !important;
    gap: 6px !important;
    scrollbar-width: none;
  }
  #filter-panel::-webkit-scrollbar { display: none; }

  /* Masque le label "Afficher :" sur mobile (trop verbeux) */
  #filter-panel > span:first-child { display: none; }

  /* ── Edit toolbar 2 lignes sur mobile ──────────────────────────────── */

  /* Ligne 1 : actions + Quitter → padding compact, gap réduit */
  #edit-toolbar-row1 {
    padding: 6px 10px !important;
    gap: 6px !important;
  }
  /* Boutons d'action (Élément, Zone, Carte) : plus compacts */
  #edit-toolbar-row1 > button,
  #edit-toolbar-row1 > label {
    padding: 5px 10px !important;
    font-size: 11px !important;
  }
  /* Bouton Quitter */
  #exit-edit-btn {
    padding: 5px 10px !important;
    font-size: 11px !important;
  }

  /* Ligne 2 : contrôles config — scroll horizontal natif, sans barre */
  #edit-toolbar-row2 {
    padding: 0 10px 6px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    /* Dégradé fade-out à droite pour signaler qu'il y a plus de contenu */
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
  #edit-toolbar-row2::-webkit-scrollbar { display: none; }

  /* Groupes de contrôles dans la ligne 2 : compacts */
  #edit-toolbar-row2 > div {
    padding: 4px 7px !important;
    gap: 4px !important;
    flex-shrink: 0;
  }
  /* Bouton Noms */
  #show-labels-btn {
    padding: 4px 9px !important;
    font-size: 11px !important;
  }

  /* Sliders */
  #polygon-opacity-input { width: 44px !important; }
  #bg-scale-slider { width: 56px !important; }

  /* Labels numériques */
  #guilde-width-label, #poly-font-label, #point-size-label, #bg-scale-value {
    font-size: 11px !important;
    min-width: 22px !important;
  }

  /* Touch targets corrects pour les − et + */
  #guilde-width-down, #guilde-width-up,
  #poly-font-down, #poly-font-up,
  #point-size-down, #point-size-up {
    width: 24px !important;
    height: 24px !important;
    font-size: 16px !important;
  }

  /* Labels de section ("Pts :", "Guildes :", etc.) */
  #edit-toolbar-row2 .text-white\/70 {
    font-size: 10px !important;
    white-space: nowrap;
  }

  /* ---- ONGLETS (element fiche) ---- */
  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    white-space: nowrap;
  }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tab-item { white-space: nowrap; flex-shrink: 0; }

  /* ---- FORMULAIRE NOUVEAU SUIVI ---- */

  /* Layout principal : empiler le formulaire et le panneau info en colonne */
  .suivi-layout {
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* Panneau info (Élément sélectionné) : pleine largeur, en dessous du formulaire */
  .suivi-layout .right-panel {
    width: 100% !important;
    flex-shrink: 1 !important;
  }

  /* Grilles 2 et 3 colonnes → 1 colonne dans le formulaire suivi */
  #suivi-form .grid-3,
  #suivi-form .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Dropzone photos : pleine largeur, hauteur réduite */
  #suivi-photo-dropzone {
    padding: 20px 12px !important;
    text-align: center;
  }

  /* Boutons du formulaire : empilés pleine largeur, plus grands pour le toucher */
  .suivi-form-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding-bottom: 16px !important;
  }
  .suivi-form-actions > button,
  .suivi-form-actions > a {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 14px 16px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
  }
  /* Ordre visuel : action principale en haut, Annuler en bas */
  #save-suivi-update { order: -3; }
  #save-suivi-only   { order: -2; }
  #duplicate-suivi-btn { order: -1; }

  /* Sections numérotées : badge + titre sur même ligne sans débordement */
  #suivi-form .step-badge {
    flex-shrink: 0;
  }

  /* Champs date, textarea : pleine largeur */
  #suivi-form .input {
    width: 100% !important;
  }

  /* ---- FICHE ÉLÉMENT ---- */
  .el-fiche-title { font-size: 18px !important; }
  .el-header-hide-mobile { display: none !important; }

  /* Header de la fiche : wrap les boutons */
  .el-header-actions { flex-wrap: wrap !important; gap: 6px !important; }

  /* Overview : colonnes empilées */
  .el-overview-layout { flex-direction: column !important; gap: 16px !important; }
  .el-overview-layout .right-panel { width: 100% !important; }

  /* Infos générales : label réduit, pas de débordement */
  .detail-label { min-width: 90px !important; font-size: 12px !important; }
  .detail-row { flex-wrap: wrap; gap: 4px; }
  .detail-value { font-size: 13px; word-break: break-word; }

  /* ---- DASHBOARD ---- */
  .dash-kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .dash-content-grid { grid-template-columns: 1fr !important; }
  .dash-actions-grid { grid-template-columns: 1fr 1fr !important; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  /* ---- PAGE FORÊT LISTE (forets.js) ---- */
  /* Card forêt : image au-dessus, contenu en dessous */
  .forest-list-card-inner {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .forest-list-card-inner .forest-card-map {
    width: 100% !important;
    height: 140px !important;
    border-radius: 12px !important;
  }

  /* ---- PAGE FORÊT DÉTAIL (foret.js) ---- */
  .foret-detail-grid { grid-template-columns: 1fr !important; }
  .foret-kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .foret-header { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
  .foret-header-actions { width: 100%; justify-content: flex-start !important; }

  /* ---- PANNEAU LATÉRAL CARTE ---- */
  #map-side-panel {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 56px !important;
    max-height: 60vh;
    z-index: 40 !important;
  }

  /* ---- MODALS ---- */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-box {
    border-radius: 20px 20px 0 0 !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    overflow-y: auto;
  }

  /* ---- WIDTHS ---- */
  .max-w-5xl, .max-w-3xl, .max-w-2xl { max-width: 100% !important; }

  /* ---- FORMS ---- */
  .suivi-form-container { padding: 16px !important; }
  .modal-box .modal-body { padding: 16px !important; }
  .grid-2 { grid-template-columns: 1fr !important; }

  /* ---- UTILISATEURS ---- */
  .role-cards-grid { grid-template-columns: 1fr !important; }

  /* ---- IDENTIFICATION ---- */
  .id-details-grid { grid-template-columns: 1fr !important; }
  .id-card-header { padding: 12px 14px; }
  .id-card-emoji { font-size: 24px; }

  /* ---- BOUTON MODIFIER fiche élément ---- */
  .el-modify-btn { font-size: 12px !important; padding: 6px 10px !important; }
}

/* ===== TRÈS PETIT MOBILE (≤ 375px) ===== */
@media (max-width: 375px) {
  .dash-kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .dash-actions-grid { grid-template-columns: 1fr !important; }
  .tabs-bar .tab-item { font-size: 12px; padding: 8px 10px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  #topbar { padding: 0 10px; }
  .page-content { padding: 10px; }
  .el-fiche-title { font-size: 16px !important; }
  /* Carte: mode toggle encore plus compact */
  .mode-btn { font-size: 10px !important; padding: 4px 6px !important; }
}
