.htaccess detect "/logged-in" at end of any URL and redirect to same URL

I'd like to know how to create a .htaccess rewrite rule that can check for "/logged-in" at the end of any pretty URL, and then pass a GET parameter back to that same page.

Essentially the user can log in on any page, then the page reloads with /logged-in attached to it. I need to run some PHP that checks:

if ($_GET['mode'] == 'logged-in') 

to display a modal on the page they were on confirming the login.

It can be any page on the site, any level deep.

So an example URL might be:

www.domain.com/shop/category-id/logged-in

which would need to rewrite to:

www.domain.com/shop/category-id/?mode=logged-in

Obviously the above URL is already being rewritten prior to this as it is actually loading:

www.domain.com/shop/category.php?id=category-id

So essentially need to know how to detect:

*/logged-in 

and get back to

*/?mode=logged-in

while keeping the URL pretty.

Scott