It may seem bizarre and unfair, but no California law requires employers to treat all employees equally and fairly. Accordingly, unfair treatment at work generally is not illegal. Employers are allowed to engage in favoritism and treat employees differently for many reasons.
For example, an employer arguably may allow John to show up to work 30 minutes later than John’s scheduled start time every day without issuing any discipline, but then fire Frank for being 10 minutes late on only one occasion, because the employer likes John and does not care for Frank. It also does not matter if Frank objectively is a much better employee with higher performance than John.
However employers are not allowed to treat employees unfairly or unequally specifically because employees are members of a protected class (e.g., race, nationality, gender, sex, sexual orientation, age over 40, disability, military service, religion, etc.) or because employees engaged in protected activity (e.g., complaining about illegal discrimination or harassment, disclosing a believed violation of the law to an employer or government agency, complaining about unpaid wages, or filing a lawsuit or administrative claim against an employer for unpaid wages, etc.).
(See Link: Labor Code Sections 98.6, 1102.5, and 2922; Government Code Section 12940)