/* Dibujo EGV — app de esquemas/organigramas rápidos (04/12/2026) */

body[data-page="dibujo"]{padding-bottom:46px;}

/* ---------- Barra inferior: estilo vestíbulo (copiada y renombrada de player.egv.es) ---------- */
.dibujo-bar-unificada{
  position:fixed;left:0;right:0;bottom:0;z-index:190;
  background:var(--surface);border-top:1px solid var(--border);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:9px 24px;min-height:38px;font-size:12.5px;color:var(--text-muted);
}
.dibujo-bar-izq{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0;}
.dibujo-bar-der{display:flex;align-items:center;gap:8px;margin-left:auto;}
.dibujo-bar-egv,.dibujo-bar-tiempo,.dibujo-bar-legal,.dibujo-bar-reloj{display:none;}
.dibujo-bar-legal-movil{display:block;}
.scroll-top{bottom:62px;opacity:1;visibility:visible;transform:none;}
@media (max-width:640px){ .scroll-top{bottom:54px;} }

@media (min-width:861px){
  body[data-page="dibujo"]{padding-bottom:64px;}
  .dibujo-bar-unificada{
    height:44px;min-height:44px;padding:0 12px;flex-wrap:nowrap;
    display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;
  }
  .dibujo-bar-izq{flex-wrap:nowrap;}
  .dibujo-bar-egv{display:flex;align-items:center;gap:8px;height:34px;padding:0 10px;border-radius:var(--radius-sm);font-weight:800;font-size:14px;color:var(--text);}
  .dibujo-bar-egv:hover,.dibujo-bar-egv:focus-visible{background:var(--surface-2);}
  .dibujo-bar-egv .logo-mark{width:22px;height:22px;border-radius:6px;font-size:12px;}
  .dibujo-bar-tiempo{display:flex;position:relative;}
  .dibujo-bar-tiempo .tiempo-btn{
    display:flex;align-items:center;gap:8px;height:34px;padding:0 12px;border-radius:var(--radius-sm);
    background:none;border:0;color:var(--text);font:inherit;font-size:13.5px;cursor:pointer;
  }
  .dibujo-bar-tiempo .tiempo-btn:hover,.dibujo-bar-tiempo .tiempo-btn[aria-expanded="true"]{background:var(--surface-2);}
  .dibujo-bar-tiempo .tiempo-ico{font-size:18px;line-height:1;}
  .dibujo-bar-tiempo .tiempo-grados{font-weight:800;}
  .dibujo-bar-tiempo .tiempo-ciudad{color:var(--text-muted);}
  .dibujo-bar-tiempo .tiempo-menu{
    position:absolute;left:0;bottom:calc(100% + 8px);min-width:170px;max-height:60vh;overflow-y:auto;scrollbar-width:none;
    display:flex;flex-direction:column;padding:6px;
    background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);
  }
  .dibujo-bar-tiempo .tiempo-menu::-webkit-scrollbar{display:none;}
  .dibujo-bar-tiempo .tiempo-menu[hidden]{display:none;}
  .dibujo-bar-tiempo .tiempo-menu button{
    text-align:left;padding:8px 10px;border-radius:var(--radius-sm);background:none;border:0;
    color:var(--text);font:inherit;font-size:13.5px;cursor:pointer;
  }
  .dibujo-bar-tiempo .tiempo-menu button:hover{background:var(--surface-2);}
  .dibujo-bar-tiempo .tiempo-menu button[aria-checked="true"]{font-weight:800;color:var(--primary-2);}
  .dibujo-bar-tiempo .tiempo-menu button[aria-checked="true"]::after{content:" ✓";}
  .dibujo-bar-legal{display:block;margin:0;font-size:12px;color:var(--text-muted);text-align:center;white-space:nowrap;}
  .dibujo-bar-legal a{color:inherit;}
  .dibujo-bar-legal a:hover{color:var(--primary-2);text-decoration:underline;}
  .dibujo-bar-der{justify-self:end;}
  .dibujo-bar-reloj{display:flex;flex-direction:column;align-items:flex-end;justify-content:center;line-height:1.15;padding:0 6px;}
  .dibujo-bar-reloj .reloj-hora{font-size:14px;font-weight:800;font-variant-numeric:tabular-nums;}
  .dibujo-bar-reloj .reloj-fecha{font-size:11.5px;color:var(--text-muted);}
  .dibujo-bar-legal-movil{display:none;}
}

/* ---------- App: cabecera ---------- */
.recurso-cabecera{display:flex;align-items:center;gap:14px;margin-bottom:16px;}
.recurso-ico{font-size:34px;line-height:1;}

/* ---------- Layout: barra de herramientas plegable + lienzo ---------- */
.d-app{
  display:grid;grid-template-columns:240px 1fr;gap:16px;align-items:start;
  max-width:1400px;margin:0 auto;
}
.d-app.d-app-plegada{grid-template-columns:0 1fr;}
.d-herramientas{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:14px;display:flex;flex-direction:column;gap:14px;overflow:hidden;transition:padding .15s;
}
.d-app-plegada .d-herramientas{padding:0;border:0;}
.d-herramientas-cabecera{display:flex;align-items:center;justify-content:space-between;gap:8px;}
.d-herramientas-titulo{font-weight:800;font-size:13.5px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.04em;}
.d-plegar-btn{
  position:sticky;top:12px;align-self:flex-start;flex:0 0 auto;
  width:34px;height:34px;border-radius:var(--radius-sm);border:1px solid var(--border);
  background:var(--surface);color:var(--text);font-size:15px;cursor:pointer;z-index:5;
}
.d-plegar-btn:hover{background:var(--surface-2);}
.d-grupo{display:flex;flex-direction:column;gap:6px;}
.d-grupo-titulo{font-size:11.5px;color:var(--text-muted);font-weight:700;text-transform:uppercase;letter-spacing:.04em;margin:4px 0 0;}
.d-tool{
  display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:var(--radius-sm);
  border:1px solid transparent;background:none;color:var(--text);font:inherit;font-size:13.5px;
  cursor:pointer;text-align:left;width:100%;
}
.d-tool:hover{background:var(--surface-2);}
.d-tool[aria-pressed="true"]{background:var(--surface-2);border-color:var(--border);font-weight:700;}
.d-tool-ico{font-size:17px;width:22px;text-align:center;flex:0 0 auto;}
.d-tool-plantilla{border:1px solid var(--border);}

/* ---------- Lienzo ---------- */
.d-lienzo-envoltura{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  overflow:hidden;position:relative;
}
.d-lienzo{display:block;width:100%;height:min(70vh,640px);background:var(--bg,var(--surface));cursor:crosshair;touch-action:none;}
html[data-theme="light"] .d-lienzo{background:#fff;}
.d-shape{cursor:move;}
.d-shape rect,.d-shape ellipse,.d-shape polygon{fill:var(--surface-2);stroke:var(--primary-2,#6c63ff);stroke-width:2;}
.d-shape.d-shape-seleccionada rect,.d-shape.d-shape-seleccionada ellipse,.d-shape.d-shape-seleccionada polygon{stroke-width:3;stroke:#e0a100;}
.d-shape text{fill:var(--text);font-size:13px;font-family:Inter,Arial,sans-serif;text-anchor:middle;dominant-baseline:middle;pointer-events:none;user-select:none;}
.d-linea{stroke:var(--text-muted);stroke-width:2;fill:none;marker-end:url(#d-flecha);}
.d-linea.d-linea-seleccionada{stroke:#e0a100;stroke-width:3;}
.d-pendiente-origen rect,.d-pendiente-origen ellipse,.d-pendiente-origen polygon{stroke:#2e9e4f;stroke-width:3;}

.d-ayuda-rapida{font-size:12.5px;color:var(--text-muted);margin:10px 0 0;}
.d-barra-acciones{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px;}

@media (max-width:860px){
  .d-app{grid-template-columns:1fr;}
  .d-app:not(.d-app-plegada) .d-herramientas{margin-bottom:4px;}
  .d-plegar-btn{position:static;}
  .d-lienzo{height:60vh;}
}
