/* Message chrome only: never style the sender's message body. */
html:root body #message-header {
  background: var(--bwp-surface); color: var(--bwp-text); border: 1px solid var(--bwp-border);
  border-radius: 14px; padding: 24px; margin: 4px 0 20px; overflow-wrap: anywhere;
}
html:root body #message-header > .subject { font-size: clamp(22px, 2vw, 28px); line-height: 1.3; margin: 0 0 24px; color: var(--bwp-text); }
html:root body #message-header .subject .extwin { color: var(--bwp-muted); margin-left: 8px; font-size: 16px; }
html:root body #message-header > .header { align-items: flex-start; gap: 16px; }
html:root body #message-header .header-content { min-width: 0; }
html:root body #message-header .bwp-sender-avatar { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; background: var(--bwp-selected); color: var(--bwp-selected-text); display: grid; place-items: center; overflow: hidden; }
html:root body #message-header .bwp-sender-initials { display: none; font-size: 16px; font-weight: 700; }
html:root body #message-header .bwp-sender-avatar img { width: 46px; height: 46px; margin: 0; background: transparent; }
html:root body #message-header .bwp-initials-avatar img { display: none; }
html:root body #message-header .bwp-initials-avatar .bwp-sender-initials { display: block; }
html:root body #message-header .bwp-message-summary { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px 18px; align-items: start; }
html:root body #message-header .bwp-sender { font-size: 16px; font-weight: 700; }
html:root body #message-header .bwp-sender a.rcmContactAddress { color: var(--bwp-text); text-decoration: none; }
html:root body #message-header .bwp-sender .adr { display: inline-block; max-width: 100%; vertical-align: top; }
html:root body #message-header .bwp-sender-address { display: block; font-size: 13px; line-height: 1.6; font-weight: 400; color: var(--bwp-muted); }
html:root body #message-header .bwp-message-date { font-size: 13px; color: var(--bwp-muted); padding-top: 2px; }
html:root body #message-header .bwp-message-to { grid-column: 1 / -1; font-size: 13px; color: var(--bwp-muted); }
html:root body #message-header .bwp-message-to a { color: var(--bwp-muted); }
html:root body #message-header .rcmaddcontact { margin-left: 5px; color: var(--bwp-muted); }
html:root body #message-header .header-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; }
html:root body #message-header .header-links a { color: var(--bwp-selected-text); font-size: 12px; line-height: 1.7; margin: 0; }
html:root body #message-header .header-links a::before { display: none; }
html:root body #message-header .header-links .headers-details,
html:root body #message-header .header-links .headers-summary { font-weight: 700; }
html:root body #message-header .header-links .headers-details::after { content: ' ⌄'; }
html:root body #message-header .header-links .headers-summary::after { content: ' ⌃'; }
html:root body #message-header .header-headers { margin-top: 16px; font-size: 13px; max-width: 100%; table-layout: fixed; }
html:root body #message-header .header-content.details-view .header-headers { display: table; width: 100%; }
html:root body #message-header .header-headers td { padding: 5px 8px 5px 0; vertical-align: top; overflow-wrap: anywhere; }
html:root body #message-header .header-headers .header-title { width: 90px; color: var(--bwp-muted); font-weight: 400; }
html:root body #message-header .header-headers a { color: var(--bwp-text); }
html:root body #message-header .bwp-message-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
html:root body #message-header .bwp-message-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--bwp-border); border-radius: 8px; background: var(--bwp-soft); color: var(--bwp-selected-text); font-size: 13px; line-height: 20px; text-decoration: none; font-weight: 600; }
html:root body #message-header .bwp-message-actions .bwp-reply { background: var(--bwp-gradient); color: white; border-color: transparent; font-weight: 700; }
html:root body #message-header .bwp-message-actions a:hover { filter: brightness(.95); }
html:root body #message-header .bwp-message-actions a:is(.bwp-reply,.bwp-reply-all,.bwp-forward)::before { content: ''; display: block; flex: 0 0 15px; width: 15px; height: 15px; background: currentColor; mask: url('../images/action-reply.svg') center / contain no-repeat; }
html:root body #message-header .bwp-message-actions a.bwp-reply-all::before { mask-image: url('../images/action-reply-all.svg'); }
html:root body #message-header .bwp-message-actions a.bwp-forward::before { mask-image: url('../images/action-forward.svg'); }
html:root body #message-header .bwp-message-actions a.disabled { opacity: .45; pointer-events: none; }
html:root body #message-header .bwp-action-group { display: inline-flex; border: 1px solid var(--bwp-border); border-radius: 8px; background: var(--bwp-soft); }
html:root body #message-header .bwp-action-group > a:first-child { border-radius: 7px 0 0 7px; border: 0; background: transparent; min-height: 34px; padding: 6px 10px; }
html:root body #message-header .bwp-message-actions a.bwp-action-options { border: 0; border-left: 1px solid var(--bwp-border); border-radius: 0 7px 7px 0; background: transparent; padding: 0; min-width: 28px; min-height: 34px; }
html:root body #message-header .bwp-chevron { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
html:root body #message-header .bwp-action-group > a:hover { background: var(--bwp-selected); filter: none; }
html:root body #message-header .bwp-action-options[aria-expanded="true"] { background: var(--bwp-selected); }
/* Reply controls live next to the sender; all other native toolbar actions stay. */
html:root body:is(.action-show,.action-preview) #mailtoolbar > a.reply,
html:root body:is(.action-show,.action-preview) #mailtoolbar > .dropbutton:has(> a.reply-all),
html:root body:is(.action-show,.action-preview) #mailtoolbar > .dropbutton:has(> a.forward) { display: none !important; }
html:root body:is(.action-show,.action-preview) #toolbar-menu > li:has(> a.reply[data-content-button]),
html:root body:is(.action-show,.action-preview) #toolbar-menu > li:has(> a.reply-all),
html:root body:is(.action-show,.action-preview) #toolbar-menu > li:has(> a.forward) { display: none !important; }
html:root body:is(.action-show,.action-preview) #message-content > .leftcol { margin-bottom: 20px; }
html:root body:is(.action-show,.action-preview) #message-content > .leftcol:not(:has(#attachment-list > li)) { display: none; }
html:root body:is(.action-show,.action-preview) .bwp-attachment-heading { color: var(--bwp-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; margin: 0 0 10px; }
html:root body:is(.action-show,.action-preview) #attachment-list { display: flex; flex-wrap: wrap; gap: 10px; background: transparent; border: 0; padding: 0; }
html:root body:is(.action-show,.action-preview) #attachment-list > li { background: var(--bwp-soft); border: 1px solid var(--bwp-border); border-radius: 8px; padding: 8px 10px; color: var(--bwp-selected-text); min-width: 0; max-width: 100%; }
html:root body:is(.action-show,.action-preview) #attachment-list > li a { color: var(--bwp-selected-text); }
html:root body:is(.action-show,.action-preview) #attachment-list > li a.filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  html:root body #message-header { padding: 18px 14px; margin-top: 0; }
  html:root body #message-header > .subject { margin-bottom: 20px; }
  html:root body #message-header > .header { gap: 10px; }
  html:root body #message-header .bwp-message-summary { grid-template-columns: minmax(0,1fr); gap: 8px; }
  html:root body #message-header .bwp-message-date { grid-row: 3; }
  html:root body #message-header .bwp-message-to { grid-row: 2; }
  html:root body #message-header .bwp-message-actions { gap: 6px; }
  html:root body #message-header .bwp-message-actions a { padding: 8px 10px; font-size: 13px; min-height: 44px; }
  html:root body #message-header .bwp-action-group > a:first-child { padding: 7px 10px; min-height: 42px; }
  html:root body #message-header .bwp-message-actions a.bwp-action-options { padding: 0; min-width: 36px; min-height: 42px; }
  html:root body #message-header .bwp-message-actions a:is(.bwp-reply-all,.bwp-forward)::before { display: none; }
  html:root body #message-header .header-headers .header-title { width: 64px; white-space: normal; }
}
