/* Éditeur de topologie — rendu de l'écran d'origine, sans CDN. */

[hidden] { display: none !important; }

body.ges-page {
  --fond: #f8fafc;
  --papier: #ffffff;
  --encre: #0f172a;
  --doux: #64748b;
  --pale: #94a3b8;
  --ligne: #e2e8f0;
  --puce: #f8fafc;
  --indigo: #4f46e5;
  --indigo-2: #4338ca;
  --indigo-3: #eef2ff;
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--encre);
  font-family: Outfit, "Segoe UI", sans-serif;
}

body.ges-page.topo-nuit {
  --fond: #020617;
  --papier: #0f172a;
  --encre: #f8fafc;
  --doux: #94a3b8;
  --pale: #64748b;
  --ligne: #1e293b;
  --puce: #1e293b;
  --indigo-3: rgba(49, 46, 129, 0.45);
}

.topo-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #1e1b4b;
  position: relative;
  overflow: hidden;
}

.topo-login__grille {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 40px 40px;
}

.topo-login__carte {
  position: relative;
  width: min(100%, 28rem);
  background: var(--papier);
  color: var(--encre);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
}

.topo-login__marque {
  text-align: center;
  margin-bottom: 2rem;
}

.topo-login__marque img {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid var(--ligne);
}

.topo-login__marque h1 {
  margin: 1rem 0 0;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.topo-login__marque h1 span { color: var(--indigo); }

.topo-login__marque p {
  margin: 0.4rem 0 0;
  color: var(--pale);
  font-weight: 600;
}

#login-legende:empty { display: none; }

.topo-login label {
  display: block;
  margin-bottom: 1rem;
}

.topo-login label span {
  display: block;
  margin: 0 0 0.4rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--doux);
}

.topo-login input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #f1f5f9;
  background: #f8fafc;
  border-radius: 1rem;
  padding: 0.9rem 1.1rem;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--encre);
}

.topo-login input:focus { outline: none; border-color: var(--indigo); background: #fff; }

.topo-login button[type="submit"] {
  width: 100%;
  margin-top: 0.4rem;
  border: 0;
  border-radius: 1rem;
  background: var(--indigo);
  color: #fff;
  font: inherit;
  font-weight: 800;
  padding: 1rem;
  cursor: pointer;
}

.topo-login button[type="submit"]:hover { background: var(--indigo-2); }

#login-erreur {
  background: #fef2f2;
  color: #dc2626;
  border-radius: 1rem;
  padding: 0.8rem 1rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.editeur {
  height: 100vh;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--fond);
}

.editeur-barre {
  box-sizing: border-box;
  width: 100%;
  min-height: 5rem;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--papier);
  border-bottom: 1px solid var(--ligne);
  z-index: 20;
}

.editeur-titre {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.editeur-titre img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--ligne);
}

.editeur-titre h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.editeur-titre h1 span { color: var(--indigo); }

.editeur-titre p {
  margin: 0.2rem 0 0;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pale);
}

.editeur-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }

.x-icone, .x-lien {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--ligne);
  background: var(--puce);
  color: var(--doux);
  border-radius: 0.75rem;
  min-height: 2.4rem;
  padding: 0 0.7rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.x-icone { width: 2.4rem; padding: 0; }
.x-icone svg, .x-lien svg { width: 1rem; height: 1rem; }

.x-groupe {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  background: var(--puce);
  border: 1px solid var(--ligne);
  border-radius: 0.75rem;
  padding: 0.15rem;
}

.x-groupe .x-icone { border: 0; background: transparent; }

.x-sync {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--puce);
  border: 1px solid var(--ligne);
  border-radius: 0.75rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--doux);
}

.x-sync i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #10b981;
}

.x-sync.est-sale i { background: #f59e0b; }

.x-sauver {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  background: var(--indigo);
  color: #fff;
  border-radius: 0.75rem;
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.18);
}

.x-sauver:hover { background: var(--indigo-2); }

.x-sortir {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid #fee2e2;
  background: #fef2f2;
  color: #dc2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#flash {
  margin: 0.75rem 1.5rem 0;
  border-radius: 1rem;
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
}

#flash.is-ok { background: #ecfdf5; color: #047857; }
#flash.is-err { background: #fef2f2; color: #b91c1c; }

.editeur-corps {
  flex: 1;
  min-height: 0;
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.col-outils, .col-plan {
  min-width: 0;
  max-height: calc(100vh - 8rem);
  overflow: auto;
}

.col-outils { display: flex; flex-direction: column; gap: 0.75rem; padding-right: 0.3rem; }
.col-plan { display: flex; flex-direction: column; gap: 1.25rem; }

.editeur-corps.est-plan {
  width: 100%;
  padding: 0.35rem 0.5rem 0.5rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0.35rem;
}

.editeur-corps.est-plan.outils-ouverts { grid-template-columns: 260px minmax(0, 1fr); }

.editeur-corps.est-plan:not(.outils-ouverts) .col-outils { display: none; }

.editeur-corps.est-plan .col-plan {
  height: 100%;
  max-height: none;
  gap: 0.35rem;
  overflow: hidden;
}

.editeur-corps.est-plan .barre-vues { padding: 0.3rem 0.55rem; border-radius: 0.75rem; }

.editeur-corps.est-plan .plan-cadre {
  flex: 1;
  min-height: 0;
  border-radius: 0.75rem;
}

.editeur-corps.est-plan .plan-scroll { min-height: 0; }

.editeur-corps.est-plan #filtre-types,
.editeur-corps.est-plan #filtre-texte { display: none; }

.editeur-corps.est-etage #btn-fond,
.editeur-corps.est-etage #topo-palette { display: none; }

#btn-outils {
  border: 1px solid var(--ligne);
  background: var(--puce);
  color: var(--doux);
  border-radius: 0.8rem;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.carte-total {
  background: #1e1b4b;
  color: #fff;
  border: 1px solid #312e81;
  border-radius: 1rem;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 8px 18px rgba(30, 27, 75, 0.18);
}

.carte-total h2 {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a5b4fc;
}

.carte-total .chiffre {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.carte-total .types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.carte-total .types div {
  background: rgba(49, 46, 129, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.55rem;
  padding: 0.2rem 0.3rem;
  text-align: center;
}

.carte-total .types span {
  display: block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #a5b4fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carte-total .types strong {
  display: block;
  margin-top: 0.05rem;
  font-size: 0.85rem;
}

.carte-arbre {
  flex-shrink: 0;
  background: var(--papier);
  border: 1px solid var(--ligne);
  border-radius: 1rem;
  overflow: hidden;
}

.carte-arbre > summary {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0.7rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--puce);
}

.carte-arbre > summary::-webkit-details-marker { display: none; }

.carte-arbre > summary::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  vertical-align: 0.1rem;
}

.carte-arbre[open] > summary::before { transform: rotate(45deg); }

#arbre-lateral {
  max-height: min(42vh, 26rem);
  overflow: auto;
  padding: 0.35rem 0.5rem 0.6rem;
}

.arbre { list-style: none; margin: 0; padding: 0; }

.arbre-secteur, .arbre-local { margin: 0.25rem 0; }

.arbre-local > summary { font-weight: 900; }

.arbre-secteur > summary, .arbre-local > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.2rem;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.arbre-secteur > summary::-webkit-details-marker,
.arbre-local > summary::-webkit-details-marker { display: none; }

.arbre-secteur > summary em,
.arbre-local > summary em {
  font-style: normal;
  color: var(--pale);
  font-size: 0.68rem;
}

.arbre-enfants { list-style: none; margin: 0; padding: 0 0 0.2rem 0.85rem; }

.arbre-ligne {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0.1rem 0;
}

.arbre-noeud {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--encre);
  border-radius: 0.4rem;
  padding: 0.22rem 0.35rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arbre-noeud.is-choisi { background: var(--indigo-3); color: var(--indigo-2); }

.arbre-actes { display: flex; flex-shrink: 0; }

.arbre-actes button {
  border: 0;
  background: transparent;
  color: var(--pale);
  border-radius: 0.35rem;
  padding: 0.15rem 0.3rem;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
}

.arbre-actes button:hover { background: var(--puce); color: var(--encre); }

.carte-gen {
  background: var(--papier);
  border: 1px solid var(--ligne);
  border-radius: 1rem;
  padding: 0.9rem 0.85rem;
}

.carte-gen h2 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.carte-gen .sous {
  margin: 0.15rem 0 1rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pale);
}

.x-champ { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }

.x-champ > span, .x-champ legend {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pale);
}

.x-champ input, .x-champ select, .palette input {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid var(--ligne);
  background: var(--puce);
  color: var(--encre);
  border-radius: 1rem;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

.x-champ input:focus, .x-champ select:focus, .palette input:focus {
  outline: none;
  border-color: var(--indigo);
  background: var(--papier);
}

.x-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }

.x-primaire {
  width: 100%;
  border: 0;
  border-radius: 1rem;
  background: var(--indigo);
  color: #fff;
  font: inherit;
  font-weight: 900;
  padding: 0.9rem;
  cursor: pointer;
}

.x-primaire:hover { background: var(--indigo-2); }

.x-second {
  width: 100%;
  margin-top: 0.7rem;
  border: 2px solid var(--ligne);
  background: transparent;
  color: var(--doux);
  border-radius: 1rem;
  font: inherit;
  font-weight: 800;
  padding: 0.7rem;
  cursor: pointer;
}

.barre-vues {
  background: var(--papier);
  border: 1px solid var(--ligne);
  border-radius: 2rem;
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.seg {
  display: flex;
  gap: 0.2rem;
  background: var(--puce);
  border: 1px solid var(--ligne);
  border-radius: 1rem;
  padding: 0.3rem;
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--doux);
  border-radius: 0.7rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

#btn-fond {
  border: 1px solid var(--ligne);
  background: var(--puce);
  color: var(--doux);
  border-radius: 0.8rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

#btn-reinit {
  border: 1px solid rgba(180, 35, 24, 0.25);
  background: #fef3f2;
  color: #b42318;
  border-radius: 0.8rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

#btn-fond:disabled { opacity: 0.45; cursor: default; }
#btn-fond.est-actif { background: var(--indigo-3); color: var(--indigo); border-color: var(--indigo); }

.choix-local {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--doux);
}

.choix-local select,
.choix-local input,
.modal label.champ-bloc input,
.modal label.champ-bloc select {
  border: 1px solid var(--ligne);
  background: var(--puce);
  color: var(--encre);
  border-radius: 0.7rem;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
}

.choix-local input { width: 4.2rem; }

.modal label.champ-bloc {
  display: block;
  margin: 0.7rem 0;
}

.modal label.champ-bloc span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pale);
}

.modal label.champ-bloc input,
.modal label.champ-bloc select { width: 100%; box-sizing: border-box; }

.plan-fond {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
  object-fit: contain;
}

.plan-zone { z-index: 1; }

.poignee-taille {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: #4f46e5;
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  z-index: 4;
}

.seg button.est-actif {
  background: var(--papier);
  color: var(--indigo);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.recherche {
  background: var(--puce);
  border: 0;
  border-radius: 0.8rem;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-weight: 700;
  color: var(--encre);
  width: 12rem;
}

.puces { display: flex; gap: 0.4rem; overflow: auto; padding-bottom: 0.2rem; }

.puces button {
  border: 2px solid transparent;
  background: var(--puce);
  color: var(--doux);
  border-radius: 0.75rem;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.puces button.est-actif {
  border-color: var(--indigo);
  background: var(--indigo-3);
  color: #4338ca;
}

.accordeon {
  background: var(--papier);
  border: 1px solid var(--ligne);
  border-radius: 1.5rem;
  margin-bottom: 1.1rem;
  overflow: hidden;
}

.accordeon summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  background: color-mix(in srgb, var(--puce) 70%, transparent);
}

.accordeon summary::-webkit-details-marker { display: none; }

.accordeon summary h3 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.accordeon summary p {
  margin: 0.15rem 0 0;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pale);
}

.accordeon .pastille {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.75rem;
  background: var(--papier);
  border: 1px solid var(--ligne);
  color: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.accordeon .actes { display: flex; gap: 0.15rem; }
.accordeon .actes button {
  border: 0;
  background: transparent;
  color: var(--pale);
  border-radius: 0.6rem;
  padding: 0.35rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
}

.tuiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1.1rem;
  border-top: 1px solid var(--ligne);
}

.topo-ligne {
  width: 220px;
  text-align: left;
  border: 2px solid var(--ligne);
  background: var(--puce);
  color: var(--encre);
  border-radius: 1rem;
  padding: 0.85rem;
  cursor: pointer;
  font: inherit;
}

.topo-ligne.is-choisi { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }

.topo-ligne .code {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--indigo);
  text-transform: uppercase;
}

.topo-ligne .nom {
  margin: 0.35rem 0;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.25;
  min-height: 2rem;
}

.topo-ligne .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.topo-ligne .badge {
  max-width: 100%;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--indigo-3);
  color: var(--indigo-2);
  font-size: 0.62rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topo-ligne .type {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--ligne);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pale);
}

.plan-cadre {
  position: relative;
  flex: 1;
  min-height: 68vh;
  border-radius: 2rem;
  border: 2px solid var(--ligne);
  background: var(--puce);
  overflow: hidden;
}

.plan-scroll { width: 100%; height: 100%; min-height: 68vh; overflow: hidden; cursor: grab; }
.plan-scroll.est-agrippe { cursor: grabbing; }

.plan {
  position: relative;
  min-width: 0;
  min-height: 0;
  background-color: var(--puce);
  background-image: radial-gradient(rgba(148, 163, 184, 0.9) 1.3px, transparent 1.4px);
  background-size: 40px 40px;
  cursor: grab;
}

.plan-local {
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  border: 2px solid #3d8fc4;
  background: transparent;
  cursor: grab;
  overflow: hidden;
}

.plan-local-feuille {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

.plan-local.is-choisi { outline: 3px solid #4f46e5; }

.plan-local .plan-zone.est-fige { pointer-events: none; }

.plan-local-nom {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: calc(100% - 0.8rem);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #163a5c;
  box-shadow: 0 1px 4px rgba(22, 58, 92, 0.15);
}

.plan-local-nom strong { font-size: 0.75rem; }
.plan-local-nom select {
  border: 0;
  background: transparent;
  color: #163a5c;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  max-width: 9rem;
}
.plan-etage-vide { margin: 2rem; color: var(--doux); font-weight: 800; }

.plan-zone {
  position: absolute;
  width: 90px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 2px solid #818cf8;
  background: #eef2ff;
  color: #312e81;
  padding: 0 0.2rem;
  overflow: hidden;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.plan-zone.is-mural { border-style: dashed; }
.plan-zone.is-choisi { outline: 3px solid #4f46e5; z-index: 3; }
.plan-zone.teinte-emeraude { background: #ecfdf5; border-color: #34d399; color: #065f46; }
.plan-zone.teinte-ciel { background: #f0f9ff; border-color: #38bdf8; color: #0c4a6e; }
.plan-zone.teinte-ambre { background: #fffbeb; border-color: #fbbf24; color: #78350f; }
.plan-zone.teinte-rose { background: #fdf2f8; border-color: #f472b6; color: #831843; }
.plan-zone.teinte-ardoise { background: #f8fafc; border-color: #94a3b8; color: #334155; }

.plan-info {
  position: absolute;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 4;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
}

.palette {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 6;
  width: 18rem;
  max-height: calc(100% - 2.4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

body.topo-nuit .palette { background: rgba(15, 23, 42, 0.96); color: #f8fafc; border-color: #334155; }

.palette-poignee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.palette-poignee:active { cursor: grabbing; }

.palette-actes { display: flex; gap: 0.15rem; }

.palette-actes button {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.palette-actes button:hover { background: rgba(15, 23, 42, 0.08); }

.palette.est-reduite .champs,
.palette.est-reduite .topo-outils,
.palette.est-reduite .icone-reduire,
.palette:not(.est-reduite) .icone-agrandir { display: none; }

.palette.est-reduite { height: auto; max-height: none; }

body.topo-nuit .palette-poignee { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.topo-nuit .palette-actes button:hover { background: rgba(255, 255, 255, 0.08); }

.palette .champs { padding: 0.8rem 0.8rem 0; }
.palette .x-deux { margin-bottom: 0.4rem; }

.topo-outils {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.7rem;
  overflow: auto;
}

.topo-groupe {
  grid-column: 1 / -1;
  margin: 0.35rem 0 0;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.topo-outil {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  border-radius: 0.7rem;
  min-height: 3.1rem;
  padding: 0.3rem;
  font: inherit;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  cursor: grab;
}

.topo-outil:hover { border-color: #818cf8; }

.vide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 16rem;
  color: var(--pale);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.menu {
  position: fixed;
  z-index: 40;
  min-width: 13rem;
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  border: 1px solid #334155;
  border-radius: 1rem;
  padding: 0.35rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 0.55rem;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.menu button:hover { background: rgba(255, 255, 255, 0.08); }
.menu button.danger { color: #fda4af; }

.voile {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  width: min(100%, 28rem);
  background: var(--papier);
  color: var(--encre);
  border-radius: 1.6rem;
  padding: 1.4rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.modal h2 { margin: 0 0 0.4rem; font-size: 1.15rem; font-weight: 900; }

.mappage {
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow: hidden;
}

.mappage-barre { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; min-width: 0; flex-wrap: wrap; }
.mappage-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.mappage-legende, #mappage-legende {
  margin: 0;
  color: var(--doux);
  font-weight: 700;
}

.mappage-grille {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
}

.mappage-grille section {
  box-sizing: border-box;
  background: var(--papier);
  border: 1px solid var(--ligne);
  border-radius: 1rem;
  padding: 1rem;
  overflow: auto;
  min-height: 0;
  min-width: 0;
}

.mappage-grille h2 {
  margin: 0 0 0.8rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doux);
}

.mappage-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.mappage-entete h2 { margin: 0; }

.mappage-arbre .arbre-ligne { display: block; }

.mappage-arbre .mappage-carte { width: 100%; }

.mappage-carte {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--ligne);
}

.mappage-carte strong { display: block; }
.mappage-carte span { color: var(--doux); font-size: 0.8rem; }

.mappage-bac, .mappage-puits {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.4rem;
  min-height: 3.2rem;
  min-width: 0;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.5rem;
  border: 1px dashed var(--ligne);
  border-radius: 0.8rem;
  background: var(--puce);
}

.mappage-bac { min-height: 12rem; }

.mappage-bac.est-survole, .mappage-puits.est-survole {
  border-color: var(--indigo);
  background: var(--indigo-3);
}

.jeton {
  box-sizing: border-box;
  max-width: 100%;
  border: 1px solid var(--ligne);
  background: var(--papier);
  color: var(--encre);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: grab;
  overflow-wrap: anywhere;
}

.jeton:active { cursor: grabbing; }
.jeton.est-choisi {
  border-color: var(--indigo);
  background: var(--indigo-3);
  color: var(--indigo-2);
}
.jeton.est-pris { opacity: 0.55; }

#mappage-filtre { box-sizing: border-box; width: 100%; max-width: 100%; margin-bottom: 0.6rem; }

.mappage-vide {
  margin: 0;
  color: var(--doux);
  font-weight: 700;
}

@media (max-width: 800px) {
  .mappage-grille { grid-template-columns: 1fr; }
}
.modal p { margin: 0 0 0.8rem; color: #c026d3; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.modal label { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; font-size: 0.85rem; font-weight: 700; }
.modal .rang { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.modal .x-texte {
  border: 0;
  background: transparent;
  color: var(--doux);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.68rem;
  cursor: pointer;
}

@media (max-width: 820px) {
  .editeur-corps { grid-template-columns: 1fr; }
  .col-outils, .col-plan { max-height: none; }
}
