lei = she
lui = he
Lei = you formal
It can be confusing, but once you get the hang of it, it becomes easy. However, in that dialogue, I believe you would use “tu” instead of “Lei” because of the usages of all other informal words. With the context of “ciao”, which is informal, and “stai”, which is also informal, I think the correct word would be “tu” so that the dialogue would be:
A: Ciao. Come stai?
B: Sto bene, grazie, e tu?
A: Sto molto bene. Grazie.
B: Buona giornata!
A: Buona giornata anche tu!