:root{
  /* Identidad GEOres */
  --vino:#8f2333;
  --vino-2:#6f1b27;
  --violeta:#6b4c7a;
  --dorado:#d4a61d;

  /* Sistema UI (QGIS-ish) */
  --bg:#f2f2f3;
  --panel:#ffffff;
  --panel2:#fbfbfc;
  --text:#1c1c1e;
  --muted:#5d6167;

  --line:rgba(0,0,0,.10);
  --line-2:rgba(0,0,0,.14);
  --line-soft:rgba(0,0,0,.06);

  --shadow:0 10px 30px rgba(0,0,0,.08);
  --shadow-2:0 16px 40px rgba(0,0,0,.12);

  --radius:14px;

  /* Layout */
  --topbar-h:92px;
  --sidebar-w:360px;

  /* Inputs */
  --focus:rgba(212,166,29,.45);
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  font-family:"Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

html, body{ height:100%; }

body{
  background:var(--bg);
  color:var(--text);
  overflow:hidden;
}

/* =========================
   Utils
========================= */
.is-hidden{ display:none !important; }
a{ color:inherit; }
button, input, select, textarea{ font:inherit; }
::selection{ background:rgba(212,166,29,.35); }

:focus-visible{
  outline:3px solid var(--focus);
  outline-offset:2px;
  border-radius:10px;
}

/* =========================
   Topbar
========================= */
.topbar{
  height:var(--topbar-h);
  background:rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 22px;
  position:sticky;
  top:0;
  z-index:60;
}

.topbar-left{
  display:flex;
  align-items:center;
  gap:16px;
  min-width:320px;
}

.topbar-logo{
  height:58px;
  width:auto;
  display:block;
  padding:0;
  background:transparent;
  border:none;
  border-radius:0;
}

.topbar-meta{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.topbar-title{
  font-weight:950;
  letter-spacing:.2px;
  color:var(--vino);
  font-size:18px;
  line-height:1.05;
}

.topbar-sub{
  font-weight:800;
  color:var(--muted);
  font-size:12.5px;
}

.topbar-center{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 14px;
}

.mode-chip{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.95);
  box-shadow:0 12px 22px rgba(0,0,0,.06);
  font-weight:950;
  color:var(--text);
}
.mode-chip i{ color:var(--vino); }

.topbar-right{
  position:relative;
  display:flex;
  align-items:center;
  gap:10px;
}

.menu-btn{
  border:1px solid var(--line);
  background:#fff;
  padding:11px 14px;
  border-radius:999px;
  font-weight:950;
  cursor:pointer;
  transition:.15s;
}
.menu-btn:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 22px rgba(0,0,0,.08);
}

.menu-dd{
  position:absolute;
  top:62px;
  right:0;
  width:240px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:8px;
  display:none;
}
.menu-dd.is-open{ display:block; }

.menu-item{
  display:block;
  padding:12px 12px;
  border-radius:12px;
  text-decoration:none;
  color:var(--text);
  font-weight:900;
  transition:.12s;
}
.menu-item:hover{ background:rgba(143,35,51,.08); }
.menu-sep{ height:1px; background:var(--line); margin:6px 6px; }
.menu-item-ores{ color:var(--vino); }

/* =========================
   App Layout
========================= */
.app{
  display:flex;
  height:calc(100vh - var(--topbar-h));
}

/* =========================
   Sidebar (QGIS-like)
========================= */
.sidebar{
  width:var(--sidebar-w);
  min-width:320px;
  padding:14px 12px;
  border-right:1px solid var(--line-soft);
  overflow:auto;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(245,246,248,.92));
}

/* Scrollbar clean */
.sidebar::-webkit-scrollbar{ width:10px; }
.sidebar::-webkit-scrollbar-track{ background:transparent; }
.sidebar::-webkit-scrollbar-thumb{
  background:rgba(0,0,0,.12);
  border-radius:999px;
  border:2px solid rgba(255,255,255,.65);
}
.sidebar::-webkit-scrollbar-thumb:hover{ background:rgba(0,0,0,.18); }

.panel{
  background:var(--panel);
  border:1px solid var(--line-soft);
  border-radius:16px;
  box-shadow:0 10px 22px rgba(0,0,0,.06);
  overflow:hidden;
  margin-bottom:12px;
}

.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 12px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-bottom:1px solid var(--line-soft);
}

.panel-head h3{
  margin:0;
  font-size:.98rem;
  font-weight:900;
  letter-spacing:-.01em;
  color:var(--text);
}

.pill{
  font-size:.78rem;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.08);
  background:rgba(143,35,51,.06);
  color:rgba(143,35,51,.95);
}

/* padding interno consistente */
.panel > *:not(.panel-head){
  padding-left:12px;
  padding-right:12px;
}

.label{
  font-size:.82rem;
  font-weight:900;
  color:rgba(0,0,0,.72);
  display:block;
  margin:10px 0 6px;
}

.mini-help{
  margin:10px 0 12px;
  padding:10px;
  border-radius:12px;
  background:rgba(0,0,0,.03);
  border:1px dashed rgba(0,0,0,.10);
  color:rgba(0,0,0,.72);
  line-height:1.25rem;
}

.join-report{
  margin-top:10px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.10);
  background:rgba(255,255,255,.92);
  padding:10px;
  box-shadow: inset 0 1px 0 rgba(0,0,0,.03);
  color:rgba(0,0,0,.80);
}

/* =========================
   Buttons
========================= */
.btn-primary,
.btn-soft,
.btn-danger{
  width:100%;
  border-radius:12px;
  padding:11px 12px;
  font-weight:950;
  border:1px solid rgba(0,0,0,.10);
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease;
}

.btn-primary{
  background:linear-gradient(180deg, var(--vino), var(--vino-2));
  color:#fff;
  box-shadow:0 10px 18px rgba(143,35,51,.22);
  border-color:rgba(143,35,51,.18);
}
.btn-primary:hover{ transform:translateY(-1px); filter:brightness(1.02); }
.btn-primary:active{ transform:translateY(0); }

.btn-soft{
  background:linear-gradient(180deg, #ffffff, #f4f5f7);
  color:rgba(0,0,0,.85);
}
.btn-soft:hover{ transform:translateY(-1px); box-shadow:0 10px 18px rgba(0,0,0,.08); }
.btn-soft:active{ transform:translateY(0); }

.btn-danger{
  background:#fff;
  border:1px solid rgba(143,35,51,.35);
  color:var(--vino);
  margin-top:8px;
}
.btn-danger:hover{ background:rgba(143,35,51,.07); transform:translateY(-1px); }
.btn-danger:active{ transform:translateY(0); }

/* Rows: sin :has() (compatible total) */
.row{
  display:flex;
  gap:10px;
  margin:10px 0;
}
.row > *{ flex:1; }

/* =========================
   Inputs
========================= */
.file,
.select,
input[type="text"],
input[type="number"],
textarea,
select{
  width:100%;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  padding:10px 11px;
  font-weight:800;
  color:rgba(0,0,0,.85);
  outline:none;
  box-shadow:0 1px 0 rgba(0,0,0,.03);
  transition: box-shadow .14s ease, border-color .14s ease;
}

.file:focus,
input:focus,
textarea:focus,
select:focus{
  border-color: rgba(143,35,51,.35);
  box-shadow: 0 0 0 4px rgba(212,166,29,.18);
}

/* =========================
   Tabs (QGIS style)
========================= */
.tabs{
  display:flex;
  gap:8px;
  margin:6px 0 10px;
  padding:0 12px;
}
.tab{
  flex:1;
  border:1px solid var(--line);
  background:#fff;
  padding:10px 10px;
  border-radius:12px;
  cursor:pointer;
  font-weight:950;
  color:var(--muted);
  transition:.12s;
}
.tab:hover{ border-color:var(--line-2); transform:translateY(-1px); }
.tab.is-active{
  border-color:rgba(143,35,51,.35);
  color:var(--vino);
  background:rgba(143,35,51,.06);
  box-shadow:0 10px 18px rgba(143,35,51,.08);
  transform:none;
}
.tabpane{ display:none; padding:0 12px 12px; }
.tabpane.is-active{ display:block; }

/* =========================
   Map
========================= */
.map-wrap{
  position:relative;
  flex:1;
  background:#ddd;
  overflow:hidden;
}

#map{ width:100%; height:100%; }

/* HUD */
.hud{
  position:absolute;
  left:14px;
  bottom:14px;
  background:rgba(255,255,255,.92);
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  font-size:12px;
  font-weight:950;
  color:var(--vino);
  box-shadow:0 10px 22px rgba(0,0,0,.08);
  max-width:min(520px, calc(100% - 28px));
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* MapLibre UI */
.maplibregl-ctrl-group{
  border-radius:12px !important;
  overflow:hidden;
  box-shadow:0 12px 22px rgba(0,0,0,.10);
}
.maplibregl-ctrl button{
  width:34px !important;
  height:34px !important;
}

/* Asegura overlays visibles por encima */
.maplibregl-marker{ z-index: 40; }

/* =========================
   Draw toolbar
========================= */
.ign-toolbar{
  position:absolute;
  left:12px;
  top:12px;
  z-index:45;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.ign-toolgroup{
  background:rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:var(--shadow-2);
  padding:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.ign-tool{
  width:36px;
  height:36px;
  border-radius:10px;
  border:1px solid rgba(0,0,0,.10);
  background:#fff;
  display:grid;
  place-items:center;
  cursor:pointer;
  transition:.12s;
  color:var(--text);
}

.ign-tool:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 18px rgba(0,0,0,.10);
  border-color:rgba(0,0,0,.16);
}

.ign-tool.is-active{
  background:rgba(143,35,51,.10);
  border-color:rgba(143,35,51,.35);
  color:var(--vino);
  box-shadow:0 12px 18px rgba(143,35,51,.12);
}

.ign-tool-danger{
  border-color:rgba(143,35,51,.35);
  color:var(--vino);
}
.ign-tool-danger:hover{ background:rgba(143,35,51,.07); }

.ign-tool-main{
  width:42px;
  height:42px;
  border-radius:14px;
  background:linear-gradient(135deg, var(--vino), var(--vino-2));
  color:#fff;
  border:none;
  box-shadow:0 12px 22px rgba(143,35,51,.22);
}

.ign-tool-file{ position:relative; }
.ign-tool-file input{
  position:absolute;
  inset:0;
  opacity:0;
  cursor:pointer;
}
.ign-sep{
  height:1px;
  background:rgba(0,0,0,.10);
  margin:4px 2px;
  border-radius:999px;
}

/* Legend overlay inside map */
#mapLegendOverlay{ border-radius:16px !important; }

/* =========================
   Composition modal
========================= */
.modal{
  position:absolute;
  inset:0;
  display:none;
  z-index:80;
}
.modal[aria-hidden="false"]{ display:block; }

.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
}

.modal-card{
  position:absolute;
  inset:18px;
  background:#fff;
  border-radius:18px;
  border:1px solid var(--line);
  box-shadow:0 24px 70px rgba(0,0,0,.25);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.modal-head{
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
}

.modal-title{ display:flex; flex-direction:column; gap:2px; }
.modal-title b{ color:var(--vino); font-weight:950; }
.modal-sub{ font-size:12px; color:var(--muted); font-weight:800; }

.modal-close{
  border:1px solid var(--line);
  background:#fff;
  width:40px;
  height:40px;
  border-radius:12px;
  cursor:pointer;
  font-weight:950;
}
.modal-close:hover{ background:rgba(0,0,0,.03); transform:translateY(-1px); }

.modal-body{ padding:14px; overflow:auto; }

/* =========================
   Responsive
========================= */
@media (max-width: 980px){
  :root{ --sidebar-w: 340px; }
  .topbar-left{ min-width:260px; }
}

@media (max-width: 860px){
  body{ overflow:auto; }
  .app{
    height:auto;
    min-height:calc(100vh - var(--topbar-h));
    flex-direction:column;
  }
  .sidebar{
    width:100%;
    min-width:unset;
    border-right:none;
    border-bottom:1px solid var(--line);
    max-height:48vh;
  }
  .map-wrap{
    height:52vh;
    min-height:420px;
  }
}
/* =========================================================
   FIX #1 — Panel "Capa base": Cartografía en columna (pro)
   - Select arriba (100%)
   - Ayuda abajo (100%)
   - Sin afectar otras filas de botones
   ========================================================= */

/* Aplica SOLO al panel que contiene el select de cartografía */
.panel:has(#baseLayerSelect) .row{
  flex-wrap: wrap;          /* permite que “baje” el siguiente bloque */
  align-items: flex-start;
}

/* El select ocupa toda la línea */
.panel:has(#baseLayerSelect) .row #baseLayerSelect,
.panel:has(#baseLayerSelect) .row select{
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
}

/* La ayuda también abajo, ancho completo */
.panel:has(#baseLayerSelect) .row .mini-help{
  flex: 1 0 100%;
  width: 100%;
  margin-top: 10px;
}

/* =========================================================
   FIX #2 — Overlays (texto/imagen): aseguramos que se puedan arrastrar
   ========================================================= */
.maplibregl-marker,
.maplibregl-marker *{
  pointer-events: auto !important;
}

.maplibregl-marker{
  cursor: grab;
}
.maplibregl-marker:active{
  cursor: grabbing;
}

/* =========================
   Zócalo / Branding (FIX PRO)
   - compacto
   - no gigante
   - siempre prolijo
========================= */

/* el zócalo NO debe crecer como póster */
.zocalo{
  margin-top:12px;
  padding:0;
}

/* tarjeta chica */
.zocalo-brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.08);
  background:rgba(255,255,255,.88);
  box-shadow:0 10px 18px rgba(0,0,0,.06);
}

/* contenedor del logo: tamaño fijo, no se pasa */
.zocalo-logo{
  width:886px;
  height:56px;
  object-fit:contain;
  flex:0 0 56px;
  background:rgba(143,35,51,.06);
  border:1px solid rgba(143,35,51,.12);
  border-radius:12px;
  padding:6px;
}

/* texto: compacto, no empuja */
.zocalo-name{
  font-weight:950;
  color:var(--vino);
  line-height:1.1;
  font-size:13px;
  margin:0;
}

.zocalo-tag{
  margin-top:2px;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
  line-height:1.2;
}

/* por si el nombre es muy largo, que no rompa */
.zocalo-text{
  min-width:0;
}
.zocalo-name, .zocalo-tag{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}




/* ===========================
   COMPOSICIÓN: MAP PREVIEW PRO
   (no cambia IDs ni estructura)
=========================== */
#composeMapPreview{
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.12);
  background: #f3f4f6;
  min-height: 360px; /* ajustá a gusto */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* El snapshot del mapa */
#composeMapImg{
  width: 100%;
  height: auto;
  display: none;      /* se mostrará cuando tenga src */
  user-select: none;
  pointer-events: none;
}

/* Placeholder bonito cuando aún no hay mapa */
#composeMapEmpty{
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(0,0,0,.18);
  background: rgba(255,255,255,.72);
  font-weight: 900;
  opacity: .75;
  text-align: center;
  max-width: 420px;
}

/* Cuando el img tiene src, ocultamos placeholder y mostramos img */
#composeMapImg[src]:not([src=""]){
  display: block;
}
#composeMapImg[src]:not([src=""]) + #composeMapEmpty{
  display: none;
}

/* La hoja de composición: un poco más “hoja” */
#composePaper{
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.12);
  box-shadow: 0 18px 45px rgba(0,0,0,.10);
}

/* Para que html2canvas no haga cosas raras con fuentes/espaciado */
#composePaper, #composePaper *{
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}




/* ============================
   FIX COMPOSICIÓN (sin romper IDs)
   - Logo gigante
   - Layout hoja + preview mapa
   ============================ */

#compositionModal .modal-card{
  max-width: min(1280px, 96vw);
}

.compose-grid{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  align-items: start;
}

@media (max-width: 1100px){
  .compose-grid{ grid-template-columns: 1fr; }
}

/* Hoja */
.compose-paper{
  background: #fff;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.12);
  padding: 14px;
  min-height: 72vh;
}

/* Cabecera hoja */
.compose-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.compose-h1{
  font-weight: 900;
  font-size: 20px;
  line-height: 1.15;
  outline: none;
}
.compose-h2{
  font-weight: 800;
  font-size: 13px;
  opacity: .75;
  outline: none;
}

/* ✅ LOGOS (evita “gigante”) */
.compose-logos{
  display:flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.compose-logo{
  display:block;
  width: auto;
  height: 42px;          /* <- clave */
  max-height: 42px;      /* <- clave */
  max-width: 180px;
  object-fit: contain;
}
@media (max-width: 520px){
  .compose-logo{ height: 34px; max-height:34px; max-width: 150px; }
}

/* Cuerpo hoja */
.compose-main{
  display:grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  align-items: start;
}

@media (max-width: 1100px){
  .compose-main{ grid-template-columns: 1fr; }
}

/* ✅ Preview mapa: caja lista para que JS inyecte IMG o background */
.compose-map{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 16px;
  background: #f4f5f6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.40);
  min-height: 440px;
  position: relative;
  overflow: hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px;
  color: rgba(0,0,0,.55);
  font-weight: 900;
}

/* Si el JS mete un <img> adentro, esto lo deja perfecto */
.compose-map img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  display:block;
}

/* Leyenda */
.compose-legend{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 16px;
  background: rgba(250,250,251,.98);
  padding: 12px;
}

.compose-legend-box{
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  background: #fff;
}

/* Pie */
.compose-foot{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,.10);
  display:flex;
  justify-content:space-between;
  gap: 10px;
  font-weight: 800;
  font-size: 12px;
  opacity: .75;
}

/* Panel controles derecha */
.compose-controls .compose-card{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
}



/* ===========================
   FIX Composición: logos y preview
   (no rompe nada: solo limita tamaños)
=========================== */

/* Logos de la hoja */
.compose-logos{
  display:flex;
  align-items:center;
  gap:10px;
}
.compose-logo{
  height:34px;       /* <- acá se arregla lo “gigante” */
  width:auto;
  max-width:140px;
  object-fit:contain;
  display:block;
}

/* Caja de mapa preview: evita deformes */
#composeMapPreview{
  overflow:hidden;
}
#composeMapPreview img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}



/* ===== Zócalo mejorado ===== */

.zocalo {
  padding: 14px 24px;
}

.zocalo-brand {
  display: flex;
  align-items: center;
  gap: 8px; /* espacio entre logos */
}

.zocalo-logo {
  height: 80px;     /* tamaño principal */
  width: auto;
  object-fit: contain;
}

.zocalo-logo.secundario {
  height: 60px;     /* ligeramente más chico */
}


/* =========================
   COMPOSICIÓN · Layout tipo “Imagen 2”
   ========================= */

.compose-main{
  display:flex;
  flex-direction:column;
  gap:16px;
}

/* Contenedor del mapa + overlay */
.compose-stage{
  position:relative;
}

/* Mapa grande y protagonista */
.compose-map{
  width:100%;
  min-height:520px;           /* subilo si querés más “paper-like” */
  border-radius:22px;
  overflow:hidden;
  background:#f1f1f2;
}

/* El IMG que pega el screenshot del mapa */
#composeMapImg{
  width:100%;
  height:100%;
  display:block;
  object-fit:contain;          /* evita recortes raros */
}

/* Leyenda flotante (overlay) */
.compose-legend--overlay{
  position:absolute;
  top:18px;
  right:18px;
  width:320px;                 /* ajustá según gusto */
  max-width:40%;
  z-index:10;

  background:rgba(255,255,255,.94);
  border:1px solid rgba(0,0,0,.10);
  border-radius:18px;
  padding:14px 14px;
  box-shadow:0 14px 34px rgba(0,0,0,.14);
  backdrop-filter: blur(6px);
}

/* Caja interna de leyenda */
.compose-legend--overlay .compose-legend-box{
  margin-top:10px;
  border-radius:14px;
  padding:10px 10px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(0,0,0,.10);
}

/* Notas abajo */
.compose-notes-block{
  border-radius:18px;
  border:1px solid rgba(0,0,0,.10);
  background:rgba(255,255,255,.92);
  padding:14px 14px;
}

/* Responsive: en pantallas chicas, la leyenda deja de flotar */
@media (max-width: 900px){
  .compose-legend--overlay{
    position:static;
    width:100%;
    max-width:100%;
    margin-top:12px;
  }
}


/* ✅ La “escena” del mapa tiene que ser el contenedor relativo */
.compose-stage{
  position: relative;
}

/* ✅ Leyenda overlay FIJA en esquina (como tu captura) */
#composeLegend.compose-legend--overlay{
  position: absolute;
  right: 28px;   /* ajustá fino */
  bottom: 28px;  /* ajustá fino */
  z-index: 50;
  width: 340px;  /* o el ancho que quieras */
  max-width: 38%;
}

/* (opcional) para que no se “achate” raro con mucho contenido */
#composeLegend .compose-legend-box{
  max-height: 260px;
  overflow: auto;
}


/* ================================
   GEOres · COMPOSICIÓN
   Leyenda flotante + drag + resize
   ================================ */

/* el mapa de composición debe ser referencia */
#composeMapPreview{ position: relative !important; }

/* modo flotante (lo activa el JS agregando .legend-float) */
#composeLegend.legend-float{
  position:absolute !important;
  z-index: 50 !important;
  right: 24px;
  top: 24px;

  /* tamaño inicial “paper” */
  width: 360px;
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);

  background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,.14);
  backdrop-filter: blur(6px);
  padding: 14px 14px 12px 14px;

  /* evita selección rara mientras arrastrás */
  user-select: none;
}

/* barra para agarrar (drag handle) */
#composeLegend .legend-grab{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;

  font-weight: 900;
  font-size: 1.05rem;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(250,250,251,.98);
  cursor: grab;
}
#composeLegend.dragging .legend-grab{ cursor: grabbing; }

/* el contenido vuelve a permitir seleccionar/copiar */
#composeLegend .legend-body{
  margin-top: 10px;
  user-select: text;
}

/* scrolleo interno si crece mucho */
#composeLegend .compose-legend-box{
  max-height: 240px;
  overflow:auto;
  padding-right: 6px;
}

/* notas compactas para que no “tiren” el panel */
#composeLegend #composeNotes{
  min-height: 64px;
}

/* ==================
   Handles (puntos)
   ================== */
#composeLegend .legend-handle{
  position:absolute;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,0,0,.18);
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
  z-index: 60;
}

/* posiciones */
#composeLegend .h-n { top:-6px; left:50%; transform:translateX(-50%); cursor:ns-resize; }
#composeLegend .h-s { bottom:-6px; left:50%; transform:translateX(-50%); cursor:ns-resize; }
#composeLegend .h-e { right:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }
#composeLegend .h-w { left:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }

#composeLegend .h-ne{ top:-6px; right:-6px; cursor:nesw-resize; }
#composeLegend .h-nw{ top:-6px; left:-6px; cursor:nwse-resize; }
#composeLegend .h-se{ bottom:-6px; right:-6px; cursor:nwse-resize; }
#composeLegend .h-sw{ bottom:-6px; left:-6px; cursor:nesw-resize; }

/* en pantallas chicas: menos invasiva */
@media (max-width: 980px){
  #composeLegend.legend-float{
    width: 320px;
    right: 16px;
    top: 16px;
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);
  }
}


#composeLegend{
  overflow: hidden;
  resize: both;
  min-width: 140px;     /* antes 220 */
  min-height: 110px;    /* antes 160 */
}