*{box-sizing:border-box}

:root{
  --blue:#075fc7;
  --green:#2fa45a;
  --yellow:#d79b00;
  --purple:#8646c6;
  --orange:#e76513;
  --border:#dce5ef;
  --muted:#657386;
  --shadow:0 12px 30px rgba(24,39,75,.08);
}

html,body{
  margin:0;
  min-height:100%;
  font-family:Arial,Helvetica,sans-serif;
  color:#152033;
  background:#f8fbff;
}

.org-app{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.topbar{
  height:88px;
  display:grid;
  grid-template-columns:350px minmax(320px,560px) auto;
  gap:18px;
  align-items:center;
  padding:14px 28px;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:50;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.brand-icon{
  width:48px;
  height:48px;
  background:#0b64ce;
  color:#fff;
  border-radius:12px;
  display:grid;
  place-items:center;
  font-size:28px;
  font-weight:bold;
}

.brand h1{
  margin:0;
  font-size:26px;
  letter-spacing:.4px;
}

.brand p{
  margin:4px 0 0;
  color:var(--muted);
}

.searchbox{
  height:48px;
  display:flex;
  align-items:center;
  gap:10px;
  background:#fff;
  border:1px solid #cfd9e6;
  border-radius:8px;
  padding:0 14px;
}

.searchbox input{
  width:100%;
  border:0;
  outline:0;
  font-size:15px;
  background:transparent;
}

.actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:12px;
}

.actions button,.toolbar button{
  border:1px solid #ccd8e6;
  background:#fff;
  border-radius:8px;
  cursor:pointer;
  font-weight:700;
  color:#152033;
}

.actions button{
  height:46px;
  padding:0 20px;
  font-size:14px;
}

.edit-state{
  display:inline-flex;
  align-items:center;
  height:36px;
  padding:0 12px;
  border-radius:999px;
  background:#eef2f7;
  color:#475569;
  font-size:12px;
  font-weight:700;
}

.edit-state.on{
  background:#fff5d6;
  color:#8a6100;
  border:1px solid #f5cc4b;
}

.main{
  position:relative;
  flex:1;
  min-height:950px;
  overflow:hidden;
}

.canvas-wrap{
  position:absolute;
  inset:0 390px 70px 0;
  overflow:hidden;
  cursor:grab;
  background:
    radial-gradient(circle at 18% 22%,rgba(11,95,199,.08),transparent 25%),
    radial-gradient(circle at 75% 12%,rgba(47,164,90,.06),transparent 26%),
    #fbfdff;
}

.canvas-wrap.dragging{
  cursor:grabbing;
}

.canvas{
  position:absolute;
  left:40px;
  top:40px;
  transform-origin:0 0;
}

#linksSvg{
  position:absolute;
  inset:0;
  overflow:visible;
  pointer-events:none;
  z-index:1;
}

.chart{
  position:absolute;
  inset:0;
  z-index:2;
}

.node{
  position:absolute;
  border-radius:8px;
  border:1.8px solid var(--blue);
  background:linear-gradient(180deg,#fff,#f5faff);
  box-shadow:0 8px 20px rgba(8,75,160,.08);
  cursor:pointer;
  transition:box-shadow .18s ease, transform .18s ease, opacity .18s ease;
  display:flex;
  flex-direction:column;
  justify-content:center;
  text-align:center;
  padding:12px 14px;
  user-select:none;
}

.node:hover{
  transform:translateY(-3px);
  box-shadow:0 12px 26px rgba(8,75,160,.17);
}

.node.active{
  outline:3px solid rgba(11,95,199,.20);
}

.node.editable-node{
  cursor:move;
}

.node.editable-node::after{
  content:"mover";
  position:absolute;
  top:-9px;
  right:8px;
  background:#fff5d6;
  color:#8a6100;
  border:1px solid #f5cc4b;
  border-radius:999px;
  padding:2px 8px;
  font-size:9px;
  font-weight:700;
  display:none;
}

.edit-mode .node.editable-node::after{
  display:block;
}

.node.saving{
  opacity:.65;
}

.node .title{
  font-size:12px;
  line-height:1.28;
  font-weight:800;
  text-transform:uppercase;
}

.node .name{
  margin-top:6px;
  font-size:11px;
  line-height:1.25;
  color:#1d2b3c;
}

.node.general{
  border-color:var(--blue);
  color:var(--blue);
  background:linear-gradient(180deg,#fff,#eef6ff);
}

.node.operaciones{
  border-color:var(--green);
  color:#08642b;
  background:#ecfff2;
}

.node.corporativos{
  border-color:var(--yellow);
  color:#8a6100;
  background:#fff8df;
}

.node.concesiones{
  border-color:var(--purple);
  color:#4c1685;
  background:#f7efff;
}

.node.finanzas{
  border-color:var(--orange);
  color:#9b3500;
  background:#fff2e9;
}

.toolbar{
  position:absolute;
  left:22px;
  top:110px;
  z-index:30;
  width:62px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  box-shadow:var(--shadow);
  padding:8px;
  display:grid;
  gap:6px;
}

.toolbar button{
  height:62px;
  display:grid;
  place-items:center;
  font-size:20px;
}

.toolbar small{
  display:block;
  font-size:10px;
  font-weight:400;
  color:var(--muted);
}

.detail{
  position:absolute;
  right:22px;
  top:22px;
  bottom:92px;
  width:350px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow);
  padding:20px 16px;
  overflow:auto;
  z-index:20;
  display:block!important;
}

.detail-head{
  margin-bottom:20px;
}

.detail h2{
  color:var(--blue);
  font-size:19px;
  margin:0;
  text-transform:uppercase;
}

.detail-head p{
  margin:8px 0 0;
}

.area-line{
  color:var(--blue);
  font-size:13px;
}

.box{
  border:1px solid var(--border);
  border-radius:8px;
  padding:14px;
  margin-bottom:12px;
  background:#fff;
}

.box h3{
  margin:0 0 12px;
  font-size:13px;
}

.box p{
  font-size:14px;
  line-height:1.55;
  margin:0;
}

.edit-help{
  display:none;
  background:#fffdf3;
  border-color:#f5cc4b;
}

.edit-mode .edit-help{
  display:block;
}

.row{
  display:grid;
  grid-template-columns:135px 1fr;
  gap:10px;
  font-size:13px;
  margin:13px 0;
}

.row span{
  color:#48556a;
}

.row strong{
  font-weight:600;
}

.row a{
  color:var(--blue);
  text-decoration:none;
}

.legend{
  height:48px;
  display:flex;
  gap:28px;
  justify-content:center;
  align-items:center;
  background:#fff;
  border-top:1px solid var(--border);
  z-index:30;
}

.legend span{
  font-size:12px;
  white-space:nowrap;
}

.dot{
  display:inline-block;
  width:12px;
  height:12px;
  border-radius:50%;
  margin-right:8px;
  vertical-align:-1px;
}

.dot.general{background:var(--blue)}
.dot.operaciones{background:var(--green)}
.dot.corporativos{background:var(--yellow)}
.dot.concesiones{background:var(--purple)}
.dot.finanzas{background:var(--orange)}

.hint{
  height:28px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
  background:#fff;
  z-index:30;
}

@media(max-width:1100px){
  .topbar{
    grid-template-columns:1fr;
    height:auto;
  }

  .actions{
    justify-content:flex-start;
    flex-wrap:wrap;
  }

  .canvas-wrap{
    inset:180px 0 430px 0;
  }

  .detail{
    left:12px;
    right:12px;
    bottom:66px;
    top:auto;
    width:auto;
    height:350px;
  }

  .legend{
    overflow-x:auto;
    justify-content:flex-start;
    padding:0 12px;
  }
}
