Given the two definitions of $\vec E$ and $\vec B$ by scalar potential $\phi$ and vector potential $\vec A$:
$$\vec B=\vec \nabla \times \vec A$$ $$\vec E=-\vec \nabla \phi -\frac 1 c\frac {\partial \vec A} {\partial t}.$$
It is not so hard to show that the Lorentz force acting on a charged particle in the electric field is:
$$\vec F=Q\bigg(-\vec \nabla\phi-\frac 1 c \frac {d\vec A} {dt}+ \frac 1 c \vec \nabla(\vec v \cdot \vec A)\bigg).$$
After showing this part, several sources I've been looking at claim that the Lagrangian of that particle is given by:
$$L=\frac 1 2 mv^2 -Q\phi(\vec x, t)+\frac Q c\vec v \cdot \vec A$$
but I couldn't find a full derivation showing how you get this Lagrangian and two things bother me about it:
1) From my understanding, since the Lagrangian is defined as $L=T-V$ where $V$ is the potential energy and only related to the position, whereas in this Lagrangian $V$ is also velocity dependent.
2) Assuming I will try to make a line integral of the force from some arbitrary zero potential point to $\vec x$ while ignoring the velocity - it will indeed proved $L$'s $(-V)$ but with another term which relates to the $-\frac Q c \frac {d\vec A} {dt}$ part that is missing from $L$.
Can anybody please show a full derivation of the Lagrangian or explain what am I missing?