.erp-wrapper {
  width: 100%;
  height: auto;
  box-sizing: border-box;
}

/* Layout principal : sidebar + zone de plan */
.erp-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  align-items: start;
  height: auto;
  background: #f5f6fa;
  color: #1c1f23;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Sidebar à gauche */
.erp-sidebar {
  background: #ffffff;
  border-right: 1px solid #d3d7e0;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: visible;
}

/* Zone principale (en haut : header, en bas : canvas) */
.erp-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header au-dessus du plan */
.erp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid #d3d7e0;
  padding: 8px 16px;
  box-sizing: border-box;
}

.erp-header-title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}

/* Badge d’info (échelle) */
.erp-badge {
  display: inline-block;
  background: #eef2ff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  border: 1px solid #c7d2fe;
  color: #3730a3;
}

/* Zone contenant les canvas (plan) */
.erp-canvas-wrap {
  position: relative;
  flex: 1;
  overflow: auto;
  background: #ffffff;
  min-height: 0;
}

/* Canvas principal géré par Fabric.js */
#erp-canvas {
  display: block;
  background: #ffffff;
}

/* Canvas de grille

   IMPORTANT : ne pas mettre de `display:none !important` ici.
   L’affichage est piloté en JS (bouton “Grille”).
*/
#erp-grid {
  display: none;
  background: transparent;
}

/* Cartes de la sidebar (blocs de contrôle) */
.erp-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e1e4ed;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.erp-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #111827;
}

/* Lignes / rangées dans les cartes */
.erp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* Labels des champs */
.erp-row label {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

/* Inputs et selects */
.erp-row input[type="number"],
.erp-row input[type="text"],
.erp-row select {
  flex: 1;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 6px 9px;
  font-size: 13px;
  color: #111827;
  box-sizing: border-box;
}

.erp-row input[type="number"]:focus,
.erp-row input[type="text"]:focus,
.erp-row select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

/* Color picker */
.erp-row input[type="color"] {
  width: 46px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
}

.erp-palette-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 32px; /* Ajout de 2 lignes d’espace */
}

/* Boutons génériques */
.erp-btn,
.erp-palette button {
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 6px 9px;
  font-size: 13px;
  color: #111827;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}

/* Boutons de catégories : bleu clair */
.erp-palette-toolbar button {
  background: #dbeafe;          /* bleu très clair */
  border-radius: 9999px;
  border: 1px solid #bfdbfe;    /* bleu clair */
  padding: 4px 10px;
  font-size: 12px;
  color: #1e3a8a;               /* bleu foncé pour le texte */
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}

/* Bouton actif : bleu un peu plus soutenu */
.erp-palette-toolbar button.is-active {
  background: #60a5fa;          /* bleu clair soutenu */
  border-color: #60a5fa;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}



.erp-btn:hover,
.erp-palette button:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.erp-btn:active,
.erp-palette button:active {
  transform: translateY(1px);
}

/* Bouton principal */
.erp-btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
}

/* Bouton toggle actif (ex : Grille) */
.erp-btn.is-active {
  background: #e0f2fe;     /* bleu très clair */
  border-color: #38bdf8;   /* bleu */
}

/* Bouton “danger” (supprimer) */
.erp-btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  font-weight: 600;
}

/* Palette d’équipements (boutons 2 colonnes) */
.erp-palette {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

/* Texte d’aide */
.erp-help {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.4;
}

/* Toolbars (groupes de boutons) */
.erp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 32px;
}

/* Bloc zoom dans le header */
.erp-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.erp-zoom input[type="range"] {
  width: 140px;
}

/* Responsive */
@media (max-width: 900px) {
  .erp-container {
    grid-template-columns: 1fr;
  }
  .erp-sidebar {
    border-right: none;
    border-bottom: 1px solid #d3d7e0;
  }
}



/* --- Grille métrique (overlay) : visible sans bloquer les interactions --- */
.canvas-container { position: relative; }
.canvas-container canvas.lower-canvas { position: absolute; left:0; top:0; z-index: 0; }
.canvas-container canvas.upper-canvas { position: absolute; left:0; top:0; z-index: 2; }
#erp-grid { position: absolute; left:0; top:0; z-index: 1; pointer-events: none !important; }
