If $|Z(G)|=6$ or $|Z(G)|=4$, then $G/Z(G)$ is nontrivial and cyclic: contradiction, as no such a group exists.
If $|Z(G)|=3$, then every noncentral element has centralizer of order $3$ or $6$, and hence the class equation yields:
$$12=3+4k+2l$$
contradiction, because $2\nmid 3$.
So we are left with ruling out the case $G$ centerless. Suppose it is; then, every nontrivial element has centralizer of order $2$, or $3$, or $4$, or $6$. The class equation then yields:
$$12=1+6k+4l+3m+2n \tag1$$
or, equivalently:
$$11-3m=2(3k+2l+n) \tag2$$
Therefore, $m=1$ or $m=3$. If $m=1$, then $(2)$ yields:
$$4=3k+2l+n$$
which is fulfilled by $(k,l,n)=$ $(1,0,1)$, $(0,0,4)$, $(0,1,2)$, $(0,2,0)$. If $m=3$, then $(2)$ yields:
$$1=3k+2l+n$$
which is fulfilled by $(k,l,n)=(0,0,1)$, only.
For $(m,k,l,n)=(1,1,0,1)$, $(1,0,0,4)$, $(1,0,1,2)$, $(1,0,2,0)$, the latter three 4-tuples lead to conjugacy classes setups which do not allow any union of size $6$, and hence not any normal subgroup of such an order is possible. The same conclusion holds for $(m,k,l,n)=(3,0,0,1)$. So, we are left to prove that the class equation $(1)$ gotten from $(m,k,l,n)=(1,1,0,1)$, namely $$12=1+6+3+2$$ contradicts some assumption. And in fact, $H$ must be the union of the conjugacy classes of size $1$, $2$ and $3$, and hence all the six elements of the other one conjugacy class (which is $G\setminus H$) have order $2$, because by assumption some has; but then $H$ must have odd order (see e.g. here): contradiction, because $H$ has order $6$.
So, finally, $|Z(G)|=12$ or $|Z(G)|=2$.