Only Mirriam-Webster has a definition that includes a use case not attached to law. Oxford, dictionary.com, Cambridge, Collins all define it as, and I paraphrase "not allowed by law". I get what you mean anyway. Illegal has a very different meaning for many people, being strictly tied to laws.