/*
 * Reader and compose additions (js/mail-reader-extras.js, js/mail-compose-extras.js). Linked last from
 * mail.html. Nothing here uses the important flag: the selectors are specific enough for the elements they introduce,
 * and the two controls that older important-flagged rules hide are shown from script instead.
 */

/* ---- Sender: name, address, unsubscribe ---------------------------------------------------------------- */

html body.mail-body .mail-message-primary-row .mail-sender-trigger {
  cursor: pointer;
  border-radius: 4px;
}

html body.mail-body .mail-message-primary-row .mail-sender-trigger:hover {
  text-decoration: underline;
}

html body.mail-body .mail-message-primary-row .mail-sender-trigger:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

html body.mail-body .mail-message-primary-row .mail-unsubscribe-link {
  flex: 0 0 auto;
  color: #5f6368;
  font-size: 12px;
  font-weight: 400;
  text-decoration: underline;
  white-space: nowrap;
}

html body.mail-body .mail-message-primary-row .mail-unsubscribe-link:hover,
html body.mail-body .mail-message-primary-row .mail-unsubscribe-link:focus-visible {
  color: #174ea6;
}

html body.mail-body .mail-message-primary-row .mail-unsubscribe-link:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---- Collapsed message: sender · snippet · time on one line -------------------------------------------- */

html body.mail-body .mail-message-primary-row .mail-message-snippet {
  display: none;
}

html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-primary-row {
  flex-wrap: nowrap;
  min-width: 0;
}

html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-primary-row .mail-message-snippet {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  color: #5f6368;
  font-size: 13px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-primary-row > strong {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-email,
html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-unsubscribe-link,
html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-recipient-summary,
html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-received-via,
html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-status > .pill,
html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-quick-actions {
  display: none;
}

html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) > .mail-message-head {
  cursor: pointer;
}

html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-persona,
html body.mail-body .mail-message-card:has(> [data-message-content-email-id][hidden]) .mail-message-copy {
  flex: 1 1 0;
  min-width: 0;
}

/* ---- One reply row per conversation -------------------------------------------------------------------- */

html body.mail-body .mail-thread-reply-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px;
  padding: 0 0 0 52px;
}

html body.mail-body .mail-thread-reply-row > button.secondary {
  min-height: 36px;
  padding: 0 20px;
  border: 1px solid #747775;
  border-radius: 18px;
  background: #fff;
  color: #444746;
  font-size: 14px;
  font-weight: 500;
}

html body.mail-body .mail-thread-reply-row > button.secondary:hover {
  background: #f1f3f4;
}

@media (max-width: 760px) {
  html body.mail-body .mail-thread-reply-row {
    padding-left: 0;
  }

  html body.mail-body .mail-thread-reply-row > button.secondary {
    flex: 1 1 0;
    min-height: 44px;
  }
}

/* ---- Attachments: download all ------------------------------------------------------------------------- */

html body.mail-body .mail-attachments-head .mail-attachments-download-all {
  margin-left: auto;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid #dadce0;
  border-radius: 14px;
  background: #fff;
  color: #1a73e8;
  font-size: 12px;
  font-weight: 500;
}

html body.mail-body .mail-attachments-head .mail-attachments-download-all:hover {
  background: #f1f6fe;
}

/* ---- Calendar invite card ------------------------------------------------------------------------------ */

html body.mail-body .mail-invite-slot:empty {
  display: none;
}

html body.mail-body .mail-invite-card {
  display: flex;
  gap: 16px;
  max-width: 560px;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
}

html body.mail-body .mail-invite-card.is-cancelled h3 {
  text-decoration: line-through;
}

html body.mail-body .mail-invite-date {
  display: flex;
  flex: 0 0 56px;
  flex-direction: column;
  align-items: center;
  align-self: flex-start;
  overflow: hidden;
  border: 1px solid #dadce0;
  border-radius: 8px;
  text-align: center;
}

html body.mail-body .mail-invite-date > span {
  width: 100%;
  padding: 2px 0;
  background: #1a73e8;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html body.mail-body .mail-invite-date > strong {
  padding: 4px 0 6px;
  color: #202124;
  font-size: 22px;
  line-height: 1.1;
}

html body.mail-body .mail-invite-copy {
  flex: 1 1 0;
  min-width: 0;
}

html body.mail-body .mail-invite-kicker {
  margin: 0;
  color: #5f6368;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

html body.mail-body .mail-invite-copy > h3 {
  margin: 2px 0 8px;
  color: #202124;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

html body.mail-body .mail-invite-details {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
}

html body.mail-body .mail-invite-details > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}

html body.mail-body .mail-invite-details dt {
  color: #5f6368;
}

html body.mail-body .mail-invite-details dd {
  margin: 0;
  color: #202124;
  overflow-wrap: anywhere;
}

html body.mail-body .mail-invite-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

html body.mail-body .mail-invite-actions > button {
  min-height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 13px;
}

html body.mail-body .mail-invite-status {
  color: #5f6368;
  font-size: 12px;
}

/* ---- Sender card --------------------------------------------------------------------------------------- */

.mail-sender-card {
  position: fixed;
  /* Over the reader and its sticky toolbar; under the composer (400) and dialogs. */
  z-index: 350;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.24);
  color: #202124;
}

.mail-sender-card[hidden] {
  display: none;
}

.mail-sender-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}

.mail-sender-card-head > div {
  display: grid;
  min-width: 0;
}

.mail-sender-card-head strong,
.mail-sender-card-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-sender-card-head > div > span {
  color: #5f6368;
  font-size: 13px;
}

.mail-sender-card .mail-sender-card-avatar {
  display: grid;
  flex: 0 0 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #e8f0fe;
  color: #174ea6;
  font-size: 16px;
  font-weight: 700;
}

.mail-sender-card-actions {
  display: grid;
  gap: 6px;
}

/* :not(#_) lifts these button resets above the app-wide button rules without the important flag. */
html body:not(#_) .mail-sender-card .mail-sender-card-actions > button {
  box-shadow: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  color: #1a73e8;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

html body:not(#_) .mail-sender-card .mail-sender-card-actions > button:hover {
  background: #f1f6fe;
}

html body:not(#_) .mail-sender-card .mail-sender-card-actions > button:disabled {
  color: #5f6368;
  cursor: default;
}

html body:not(#_) .mail-sender-card .mail-sender-card-actions > button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}

/* ---- Original message viewer --------------------------------------------------------------------------- */

.mail-original-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(32, 33, 36, 0.5);
}

.mail-original-card {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(880px, 100%);
  max-height: min(86vh, 900px);
  padding: 18px 20px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  color: #202124;
}

.mail-original-card > header,
.mail-original-card > footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.mail-original-card > header {
  justify-content: space-between;
}

.mail-original-card > header h2 {
  margin: 0;
  font-size: 18px;
}

.mail-original-card .mail-original-subject {
  margin: 6px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mail-original-card .mail-original-note {
  margin: 4px 0 10px;
  color: #5f6368;
  font-size: 13px;
}

.mail-original-card .mail-original-source {
  flex: 1 1 auto;
  min-height: 120px;
  margin: 0 0 12px;
  padding: 12px;
  overflow: auto;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #f8f9fa;
  color: #202124;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mail-original-card .mail-original-source:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}

.mail-original-card .mail-original-status {
  color: #5f6368;
  font-size: 13px;
}

/* ---- Label chooser ------------------------------------------------------------------------------------- */

/*
 * The "Apply labels" dialog is created by mail.js with aria-modal, but no stylesheet loaded by mail.html
 * laid it out, so it appeared as loose content at the end of the page. It is a centred modal here.
 */
html body.mail-body .mail-label-choice-dialog {
  position: fixed;
  inset: 0;
  z-index: 2800;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 40, 63, 0.4);
}

html body.mail-body .mail-label-choice-dialog .mail-label-choice-card {
  box-sizing: border-box;
  width: min(430px, 100%);
  max-height: min(620px, 90vh);
  padding: 18px;
  overflow: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 40, 63, 0.24);
}

html body.mail-body .mail-label-choice-dialog .mail-label-choice-list {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

html body.mail-body .mail-label-choice-dialog .mail-label-choice-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 8px;
  background: #f6f9fd;
}

html body.mail-body .mail-label-choice-dialog .mail-label-choice-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Upload progress ----------------------------------------------------------------------------------- */

/* The file card is narrow, so the bar runs along its bottom edge and Cancel takes the place of Remove. */
html body.mail-body .mail-compose-upload-card.is-uploading,
html body.mail-body .mail-inline-attachment.is-uploading {
  position: relative;
  overflow: hidden;
}

html body.mail-body .mail-upload-progress {
  font-variant-numeric: tabular-nums;
}

html body.mail-body .mail-upload-progress > progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  border: 0;
  accent-color: #1a73e8;
}

html body.mail-body .mail-compose-upload-card.is-uploading [data-compose-remove-attachment],
html body.mail-body .mail-inline-attachment.is-uploading [data-inline-attachment-remove] {
  display: none;
}

html body.mail-body .mail-compose-upload-status .mail-upload-cancel,
html body.mail-body .mail-inline-attachment .mail-upload-cancel {
  margin-left: 6px;
}

/* ---- Open-drafts dock ---------------------------------------------------------------------------------- */

/*
 * No other mail stylesheet lays the dock out. It sits on the bottom edge, to the left of the composer (the
 * script sets `right`), one layer under it so it can never cover a message being written.
 */
html body.mail-body #mail-compose-session-dock {
  position: fixed;
  right: 20px;
  bottom: 0;
  /* Under the composer (400) and the settings drawer (300), over the page header (90). */
  z-index: 290;
  display: none;
  box-sizing: border-box;
  align-items: center;
  gap: 8px;
  max-width: min(46vw, 640px);
  padding: 6px 8px;
  border: 1px solid #dadce0;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(60, 64, 67, 0.18);
}

html body.mail-body #mail-compose-session-dock #mail-compose-new-session {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 13px;
  white-space: nowrap;
}

html body.mail-body #mail-compose-session-dock #mail-compose-session-list {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

html body.mail-body #mail-compose-session-dock .mail-compose-session-chip {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 4px;
  max-width: 200px;
  min-height: 32px;
  padding: 0 4px 0 12px;
  border: 1px solid #dadce0;
  border-radius: 16px;
  background: #f8f9fa;
  color: #202124;
  font-size: 13px;
  cursor: pointer;
}

html body.mail-body #mail-compose-session-dock .mail-compose-session-chip.is-active {
  border-color: #aecbfa;
  background: #e8f0fe;
}

html body.mail-body #mail-compose-session-dock .mail-compose-session-chip:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}

html body.mail-body #mail-compose-session-dock .mail-compose-session-chip > strong {
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body.mail-body #mail-compose-session-dock .mail-compose-session-chip > button {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

html body.mail-body #mail-compose-session-dock .mail-compose-session-chip > button:hover {
  background: rgba(60, 64, 67, 0.12);
}

/* ---- Saved signatures ---------------------------------------------------------------------------------- */

html body.mail-body .mail-signature-manager {
  display: grid;
  gap: 10px;
  max-width: 640px;
}

html body.mail-body .mail-signature-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

html body.mail-body .mail-signature-manager .mail-signature-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

html body.mail-body .mail-signature-manager .mail-signature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
}

html body.mail-body .mail-signature-row-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

html body.mail-body .mail-signature-row-copy > span {
  overflow: hidden;
  color: #5f6368;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body.mail-body .mail-signature-row-copy > .mail-signature-badges {
  color: #174ea6;
  font-weight: 600;
}

html body.mail-body .mail-signature-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

html body.mail-body .mail-signature-manager .mail-signature-empty {
  margin: 0;
  color: #5f6368;
}

html body.mail-body .mail-signature-defaults {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

html body.mail-body .mail-signature-defaults > label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

html body.mail-body .mail-signature-editor {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #f8f9fa;
}

html body.mail-body .mail-signature-editor > label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

html body.mail-body .mail-signature-editor .mail-signature-content {
  min-height: 96px;
  max-height: 240px;
  padding: 10px;
  overflow: auto;
  border: 1px solid #c4c7c5;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

html body.mail-body .mail-signature-editor .mail-signature-content:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}

html body.mail-body .mail-signature-editor-actions {
  display: flex;
  gap: 8px;
}

html body.mail-body .mail-compose-signature-picks {
  display: grid;
}

/* ---- Emoji picker -------------------------------------------------------------------------------------- */

html body.mail-body #compose-emoji-menu.hidden {
  display: none;
}

html body.mail-body #compose-emoji-menu.mail-emoji-picker:not(.hidden) {
  position: fixed;
  /* Over the composer (400) it belongs to. */
  z-index: 410;
  display: grid;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(60, 64, 67, 0.24);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  box-sizing: border-box;
  width: min(336px, calc(100vw - 24px));
  height: 320px;
  padding: 10px;
}

html body.mail-body #compose-emoji-menu.mail-emoji-picker .mail-emoji-search > input {
  box-sizing: border-box;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #c4c7c5;
  border-radius: 16px;
  font-size: 13px;
}

html body.mail-body #compose-emoji-menu.mail-emoji-picker .mail-emoji-categories {
  display: flex;
  gap: 2px;
}

html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-categories > button {
  flex: 1 1 0;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-categories > button.is-active {
  border-bottom-color: #1a73e8;
  background: #e8f0fe;
}

html body.mail-body #compose-emoji-menu.mail-emoji-picker .mail-emoji-grid {
  min-height: 0;
  overflow-y: auto;
}

html body.mail-body #compose-emoji-menu.mail-emoji-picker .mail-emoji-section {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
}

html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-option {
  display: grid;
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-option:hover,
html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-categories > button:hover {
  background: #f1f3f4;
}

html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-option:focus-visible,
html body.mail-body:not(#_) #compose-emoji-menu.mail-emoji-picker .mail-emoji-categories > button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: -2px;
}

html body.mail-body #compose-emoji-menu.mail-emoji-picker .mail-emoji-empty {
  margin: 12px 4px;
  color: #5f6368;
  font-size: 13px;
}

/* ---- Reduced motion ------------------------------------------------------------------------------------ */

/*
 * The doubled :not(#_) raises specificity above every unflagged mail rule without the important flag, so one block
 * covers animations and transitions declared anywhere in the mail stylesheets. Declarations that carry the
 * important flag are not affected; see docs/MAIL_WORKSPACE_UX.md.
 */
/* The message menu opens from the ⋮ in the message header as a dropdown over the message, as in Gmail. Its
 * items are full-width rows; the older ai-review stylesheet that positioned it is not linked on this page. */
html body.mail-body .mail-message-quick-actions .mail-message-more-actions {
  position: relative;
}

html body.mail-body .mail-message-quick-actions .mail-message-more-actions > summary {
  list-style: none;
  cursor: pointer;
}

html body.mail-body .mail-message-quick-actions .mail-message-more-actions > summary::-webkit-details-marker {
  display: none;
}

html body.mail-body:not(#_) .mail-message-quick-actions .mail-message-more-actions > div {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 232px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
}

html body.mail-body:not(#_) .mail-message-quick-actions .mail-message-more-actions > div > button {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #202124;
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  box-shadow: none;
}

html body.mail-body:not(#_) .mail-message-quick-actions .mail-message-more-actions > div > button:hover,
html body.mail-body:not(#_) .mail-message-quick-actions .mail-message-more-actions > div > button:focus-visible {
  background: #f1f3f4;
}

html body.mail-body:not(#_) .mail-message-quick-actions .mail-message-more-actions > div > button.danger {
  color: #c5221f;
}

/* ---- Row menu (right-click on a conversation row; js/mail-row-menu.js) ------------------------------
 * Appended to <body> and fixed at the pointer, so no list or pane can clip it. Light colours only: the
 * dark theme inverts the page, this menu included. */
html body.mail-body:not(#_) .mail-row-menu {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  min-width: 236px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 6px 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
  color: #202124;
  font-size: 14px;
}

html body.mail-body:not(#_) .mail-row-menu[hidden] {
  display: none;
}

html body.mail-body:not(#_) .mail-row-menu > button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 0 24px 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #202124;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  box-shadow: none;
  transform: none;
  cursor: pointer;
}

html body.mail-body:not(#_) .mail-row-menu > button:hover,
html body.mail-body:not(#_) .mail-row-menu > button:focus-visible,
html body.mail-body:not(#_) .mail-row-menu > button[aria-expanded="true"] {
  background: #f1f3f4;
  outline: none;
}

html body.mail-body:not(#_) .mail-row-menu > button:focus-visible {
  box-shadow: inset 3px 0 0 #0b57d0;
}

html body.mail-body:not(#_) .mail-row-menu > button svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #444746;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html body.mail-body:not(#_) .mail-row-menu > button.has-submenu::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-top: 1.5px solid #444746;
  border-right: 1.5px solid #444746;
  transform: rotate(45deg);
}

html body.mail-body:not(#_) .mail-row-submenu {
  min-width: 168px;
}

html body.mail-body:not(#_) .mail-row-submenu > button {
  padding-left: 24px;
}

html body.mail-body:not(#_) .mail-row-menu > .mail-row-menu-divider {
  flex: 0 0 auto;
  height: 1px;
  margin: 6px 0;
  background: #e0e3e7;
}

/* The inversion turns a dark shadow into a light halo; author it light so it inverts to a dark one. */
html[data-mail-theme="dark"] body.mail-body:not(#_) .mail-row-menu {
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.5), 0 4px 8px 3px rgba(255, 255, 255, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  /* Three older transitions are pinned with their durations (mail-enterprise-final.css: the page, the
     pane stack and the row quick actions). They read these properties, so they stop here as well. */
  html {
    --mail-motion-fade: 0.01ms;
    --mail-motion-layout: 0.01ms;
  }

  html body.mail-body:not(#_):not(#_) *,
  html body.mail-body:not(#_):not(#_) *::before,
  html body.mail-body:not(#_):not(#_) *::after,
  html body:not(#_):not(#_) .mail-sender-card,
  html body:not(#_):not(#_) .mail-original-dialog,
  html body:not(#_):not(#_) .mail-original-dialog * {
    animation-delay: 0s;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    scroll-behavior: auto;
    transition-delay: 0s;
    transition-duration: 0.01ms;
  }
}

html body.mail-body .mail-signature-editor .mail-signature-flag { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; }
html body.mail-body .mail-signature-editor .mail-signature-flag input { width: auto; flex: 0 0 auto; margin-top: 3px; }
html body.mail-body .mail-signature-content { overflow-wrap: anywhere; }
