I am confused about the exact/official time of Shabbat starting. Is it 18 minutes before sunset, when the candles are lit, or at sunset?
Shabbat starts at a split second notice that only Gd knows. The period this transition takes place we call this questionable period bein hashmashot - between the guards. During this period it is unknown to us whether it is part of the day (Friday) or part of the next day (shabbos). This period starts after shkiah/sunset. Thus, one should refrain from doing prohibited work during this period. The 18min here or the longer or shorter periods added in other locals are all customs that help to safeguard Shabbat.