Suppose we wish to obtain the energy density of the free complex scalar field $\varphi$ as a Legendre transform of the corresponding action. From Wikipedia, writing the action of a free complex scalar field in Minkowski space as
$$S(\varphi)=\int d^4x \,\mathcal L(\partial_0\varphi,\partial_i\varphi,\,\varphi)$$ the energy density should be the Legendre transform of the Lagrangian density, where the Lagrangian density is defined as $$\mathcal L(\partial_0\varphi,\partial_i\varphi,\,\varphi)=\langle \varphi, \,(\Delta+m^2)\varphi\rangle.\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$$
Using the definition of Legendre transform from the Wikipedia page on the Legendre transformation (https://en.wikipedia.org/wiki/Legendre_transformation#Definition), $$\mathcal E(\partial_0\varphi^*,\partial_i\varphi,\,\varphi):=\max_{\partial_0\varphi}\,\,\langle\partial_0\varphi^*,\partial_0\varphi\rangle-\mathcal L(\partial_0\varphi,\partial_i\varphi,\,\varphi)$$ From which it may be obtained that (using the maximum condition to obtain a derivative formula for the conjugate variable $\,\partial_0\varphi^*$): $$\mathcal E(\partial_0\varphi^*,\partial_i\varphi,\,\varphi)=\langle\partial_0\varphi,\partial_0\varphi\rangle-\mathcal L(\partial_0\varphi,\partial_i\varphi,\,\varphi)$$ $$\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,=\langle\varphi,\,(\Delta_3+m^2)\varphi\rangle\,\,\,\,\,\,$$ where $\Delta_3$ is the induced Laplacian on a Cauchy surface inside the Lorentzian spacetime which includes the point at which the energy density is being evaluated.
Unfortunately, the formula obtained is not the energy density that matches anything I can find online. This is significant, because this means that the energy density is not the Legendre transform of the Lagrangian density for the case of complex variables. Is this a valid conclusion? Is there a natural redefinition of the energy density in the complex setting?