LOS ANGELES – Don't mess with Elizabeth McCord. In an episode of CBS' "Madam Secretary" last year, she's groped by a foreign leader, prompting her to punch him in the face — then quickly hand him a tissue to dab his bloody nose. She eventually opts not to report the sexual assault, worried that going public would jeopardize a diplomatic agreement.

"That's the whole problem, isn't it?" the character, played by Téa Leoni, tells her husband one sleepless night. "We tell ourselves to suck it up just this once, be better for everyone. Like now, I'm thinking about the bigger picture. But just saying that, aren't I marginalizing a woman's right not to be harassed, not to be assaulted? When does that get to be the bigger picture?"

Maybe now. While women are making significant strides behind the scenes on television, their on-screen counterparts lag behind.

While women watch more TV on a daily basis than men, they accounted for just 43 percent of the speaking roles on broadcast shows last season, according to San Diego State's Center for the Study of Women in Television & Film. That's up just 4 percentage points from two decades ago, when the center began its annual study. Even on seemingly progressive series, formidable actresses such as Nicole Kidman and Kerry Washington usually play victims or hopeless romantics.

"I want to do a detective show where women get the bad guy every week and no one sleeps with each other," said Allison Schroeder, who earned an Oscar nomination for her "Hidden Figures" screenplay and is co-chairwoman of the Women's Committee of the Writers Guild.

Good luck pitching that concept to Shonda Rhimes.

While the producer deserves credit for the rise in female TV directors — 21 percent of TV episodes last year were directed by women, up by more than one-third from the previous year, according to the Directors Guild of America — the characters on Rhimes' shows continually seem to be auditioning for spots on "The Bachelor."

Her breakthrough hit, "Grey's Anatomy," premiered in 2005 with new intern Meredith Grey (Ellen Pompeo) sleeping with her McDreamy superior the night before her first shift, leading to on-the-clock dialogue that, in real life, would merit a trip to human resources, if not the unemployment line. Similar behavior is prevalent in Rhimes' subsequent series "Scandal" and "For the People."

Rhimes is well aware that such interactions wouldn't pass muster in an actual workplace; she just doesn't care.

"Work isn't the place to shoot people in the face, either," she said in January. "Seriously, I think there's a lot of things that happen on these shows that aren't appropriate for the real world."

But other showrunners following in Rhimes' footsteps would like TV to reflect more of the real world, one in which coming to the office doesn't feel like you've just logged into dating app Tinder.

On the Lifetime drama "UnReal," lead characters Quinn and Rachel don't have much time to flirt; they're too busy churning out a reality series.

"For a lot of women in their 20s and 30s, working is a big part of their lives, so making a show about that didn't seem revolutionary to us," said co-creator Sarah Gertrude Shapiro. "What's been interesting is the response from guys saying, 'Wow, nobody has really focused the lens on that before with such attention. It's so germane to our experience.' Well, it's incredibly relevant to women, too."

"UnReal" also confronts gender inequality. During its season opener in February, Quinn and Rachel feel they can't pitch a new concept to their network unless a white, middle-aged man comes along to sell it for them.

"I think that's the kind of stuff that we investigate on a very micro level, which is all the extra work you do as a woman at work, trying to be taken seriously," Shapiro said. "I think that's the way we will change the gender politics in this country. Get people into the hearts and minds of women to understand them better, in a more truthful way, and hopefully you increase the amount of respect."

Crazy ex-girlfriends

Quinn and Rachel's counterparts in the real film world appear to be making progress. The top-grossing films of 2017 — "Star Wars: The Last Jedi," "Wonder Woman," "Beauty and the Beast" — all featured strong heroines. It also didn't hurt when the Oscar winner for best actress, Frances McDormand, capped her acceptance speech with a call for "inclusion riders" to guarantee that films hire diverse casts.

"When I went into a room four years ago and pitched an action film in which one woman replaces another's identity and then kicks ass, they said, 'We love it. Can you change it to two men?' " Schroeder said. "They wouldn't dare say that to me now."

But in TV, it's still rare for a woman to take charge, unless it's seen as some kind of foreplay.

Priyanka Chopra may be a force to be reckoned with on ABC's "Quantico," but she's just as likely to be ripping the clothes off her fellow CIA agents as throwing punches at bad guys. Rachel Bloom's musical numbers on CW's "Crazy Ex-Girlfriend" are more empowering than a dozen Katy Perry videos, but most are inspired by a pretty boy whom she left a six-figure job to chase.

"Sex sells because we keep pushing it," said Erica Joy Baker, a founding member of Project Include, a nonprofit aimed at including diversity in the tech world. "I'm an avid watcher of 'Grey's Anatomy,' and it's a trope on the show that people are going to go into the on-call room for sex. What if we had an episode where that didn't happen?"

"Westworld," "Big Little Lies" and "The Handmaid's Tale" have all been critically acclaimed for spotlighting female characters with much more than flirting on their minds. One reason, though, is they're victims of sexual violence.

"For so much of the time, TV is presenting women in the position of being victimized in some way. It's a narrative I personally am so sick of," said Tara Armstrong. She's the creator of Lifetime's "Mary Kills People," a black comedy about an emergency-room doctor who moonlights as a mercy killer. She does have sexual urges, but they curdle once she discovers the object of her affections is a cop trying to bust her.

Sex also plays a part in BBC America's "Killing Eve," about an officer in Britain's domestic security service, but Eve (Sandra Oh) and the female assassin she's tracking (Jodie Comer) both are much more turned on by the chase.

"It immediately feels naughty and new. It's a shame that it feels new," said "Eve" creator Phoebe Waller-Bridge. She's also the mastermind behind "Fleabag," a comedy in which her self-loathing character more than lives up to her nickname.

In "Eve," the killer isn't just deplorable; she's downright pathological, finding sicker and sicker ways to carry out her assignments, if only to keep from dying of boredom. "There is something glorious about a woman existing without fear of the consequences of her actions, this huge, huge overblown sense of self-worth and arrogance," Waller-Bridge said. "She's not bridled with shame the way so many other female characters are."

Declarations of independence

Perhaps the most promising sign of progress is in a series set in the 1980s.

"The Americans" has lasted six seasons on FX, largely because of Keri Russell — an actress who got her big break on "Felicity" (1998-2002), playing a college student who majored in crushes. This time, though, she's a Russian spy who, unlike the heroines of "Alias" and "Dark Angel," doesn't spend every third episode going undercover as a sexpot. Her character, Elizabeth, is as tough as nails, while her husband is allowed to be the more sensitive partner.

"The show's stereotypical gender reversal doesn't get talked about enough," said co-star Holly Taylor. "It's not portrayed in any kind of negative light. That's just who they are, and it works for their family. They can also still get the job done. I think that's amazing."

But such roles are still in short supply.

"While we can point to some high-profile female characters who challenge stereotypes, they remain the exceptions as opposed to the rule," said Martha Lauzen, who led the research for the San Diego State study and teaches about film and media at the university. "Typically, we feel more progress is being made than may actually be the case because these exceptions tend to get a lot of attention."

Still, there are reasons to be optimistic, thanks to the wildly successful return of "Roseanne," as well as planned reboots of "Murphy Brown" and "Cagney & Lacey." And this summer "GLOW" and "The Unbreakable Kimmy Schmidt," both shining examples of female empowerment, return to Netflix.

And don't be surprised if "Madam Secretary" addresses sexual harassment again — but with McCord making other choices.

"We'll probably do another episode on it because the world has changed around this issue," creator Barbara Hall said in January, in the aftermath of the Harvey Weinstein scandal. "We'd take an entirely different approach."