How to style main sidebar and SubPage sidebar differently using CSS?

I have a main sidebar

/sidebar.mdwn

and a SubPage sidebar

/blog/sidebar.mdwn

How to style the two differently using CSS?

For example I'd like the sidebar shown on any page inside /blog to have a blue border and any other page outside of /blog to have a sidebar with red border.