/* Future Generators Gmail-style closeout.
 * This final layer keeps enterprise scope controls while restoring the compact,
 * predictable inbox and reader interaction model on desktop and mobile. */

/* Read state must be visible without relying on background color alone. */
html body.mail-body.mail-simple-mode #mail-threads .mail-gmail-row:not(.is-unread) .mail-gmail-row-sender,
html body.mail-body.mail-simple-mode #mail-threads .mail-gmail-row:not(.is-unread) .mail-gmail-row-copy > strong,
html body.mail-body.mail-simple-mode #mail-threads .mail-gmail-row:not(.is-unread) .mail-gmail-row-time {
  font-weight: 400 !important;
}

html body.mail-body.mail-simple-mode #mail-threads .mail-gmail-row.is-unread .mail-gmail-row-sender,
html body.mail-body.mail-simple-mode #mail-threads .mail-gmail-row.is-unread .mail-gmail-row-copy > strong,
html body.mail-body.mail-simple-mode #mail-threads .mail-gmail-row.is-unread .mail-gmail-row-time {
  font-weight: 700 !important;
}

/* The mailbox switcher belongs in the compact inbox toolbar only on mobile. */
html body.mail-body .mail-simple-mobile-scope {
  display: none !important;
}

/* Gmail reveals formatting deliberately. Keep advanced compose controls out of
 * the default writing surface until the Aa control is requested. */
html body.mail-body #mail-compose-modal:not(.is-formatting-open) .mail-compose-format-toolbar {
  display: none !important;
  visibility: hidden !important;
}

html body.mail-body #mail-compose-modal.is-formatting-open .mail-compose-format-toolbar {
  display: flex !important;
  visibility: visible !important;
}

html body.mail-body #mail-compose-modal #compose-origin-note[hidden] {
  display: none !important;
}

/* Keep the narrow workspace rail readable instead of clipping module names. */
@media (min-width: 801px) {
  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-workspace-sidebar > .tenant-nav .tenant-nav-btn > .tenant-nav-label-row > span:first-child {
    display: block !important;
    overflow: visible !important;
    max-width: 58px !important;
    color: #344054 !important;
    font-size: 9px !important;
    font-weight: 650 !important;
    line-height: 1.15 !important;
    text-align: center !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-workspace-sidebar > .tenant-nav .tenant-nav-btn > .tenant-nav-label-row {
    width: 60px !important;
    min-width: 0 !important;
    justify-content: center !important;
  }
}

@media (max-width: 900px) {
  /* Restore mailbox identity and everyday list commands inside the embedded
   * frame. The host still owns global search, account, and product navigation. */
  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads > .mail-simple-consensus-toolbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 45 !important;
    display: grid !important;
    visibility: visible !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    width: 100% !important;
    min-height: 52px !important;
    height: 52px !important;
    padding: 4px 8px !important;
    gap: 6px !important;
    align-items: center !important;
    border: 0 !important;
    border-bottom: 1px solid #e0e3e7 !important;
    background: #fff !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads > .mail-simple-consensus-toolbar .mail-simple-mobile-scope {
    position: relative !important;
    display: block !important;
    min-width: 0 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope > summary {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 4px 8px 4px 10px !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    list-style: none !important;
    border: 0 !important;
    border-radius: 20px !important;
    background: #edf2fa !important;
    color: #1f1f1f !important;
    cursor: pointer !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope > summary::-webkit-details-marker {
    display: none !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope > summary > span:first-child,
  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope-menu button > span:first-child {
    display: grid !important;
    min-width: 0 !important;
    text-align: left !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope :is(strong, small) {
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope strong {
    font-size: 13px !important;
    font-weight: 650 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope small {
    color: #5f6368 !important;
    font-size: 10px !important;
    font-weight: 400 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope-menu {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    z-index: 90 !important;
    display: grid !important;
    width: min(328px, calc(100vw - 24px)) !important;
    max-height: min(420px, calc(100dvh - 132px)) !important;
    padding: 6px !important;
    overflow-y: auto !important;
    border: 1px solid #dadce0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 8px 24px rgba(60, 64, 67, .24) !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope-menu button {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    width: 100% !important;
    min-height: 48px !important;
    padding: 6px 10px !important;
    align-items: center !important;
    gap: 10px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #202124 !important;
    text-align: left !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-mobile-scope-menu button[aria-checked="true"] {
    background: #d3e3fd !important;
    color: #041e49 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads > .mail-simple-consensus-toolbar .mail-simple-list-controls {
    display: inline-flex !important;
    visibility: visible !important;
    width: auto !important;
    min-width: 126px !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 2px !important;
    overflow: visible !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-list-controls :is(button, summary) {
    display: inline-grid !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #444746 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode .mail-simple-list-controls :is(.mail-simple-page-range, [data-mail-footer-page]) {
    display: none !important;
  }

  /* Category names stay visible at phone width; preview text remains a desktop
   * enhancement. */
  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-smart-category-strip {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(90px, 1fr)) !important;
    width: 100% !important;
    min-height: 48px !important;
    height: 48px !important;
    gap: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border-bottom: 1px solid #e0e3e7 !important;
    background: #fff !important;
    scrollbar-width: none !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-smart-category-strip button {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: auto !important;
    min-width: 90px !important;
    min-height: 48px !important;
    height: 48px !important;
    padding: 0 10px !important;
    place-items: center !important;
    border: 0 !important;
    border-bottom: 3px solid transparent !important;
    background: #fff !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-smart-category-strip button.is-active {
    border-bottom-color: #0b57d0 !important;
    color: #0b57d0 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-smart-category-strip :is(.mail-category-icon, .mail-category-copy small, .mail-category-count) {
    display: none !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-smart-category-strip .mail-category-copy,
  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-smart-category-strip .mail-category-copy strong {
    display: block !important;
    width: 100% !important;
    overflow: hidden !important;
    font-size: 11px !important;
    font-weight: 550 !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Mobile still needs explicit selection, star, and importance affordances.
   * Three compact controls preserve 44px row height without relying on hover. */
  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-gmail-row {
    display: grid !important;
    grid-template-columns: 84px minmax(0, 1fr) !important;
    min-height: 72px !important;
    height: 72px !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-gmail-row-select {
    display: grid !important;
    visibility: visible !important;
    grid-template-columns: 28px 30px 26px !important;
    width: 84px !important;
    min-width: 84px !important;
    height: 72px !important;
    align-items: center !important;
    justify-items: center !important;
    gap: 0 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-gmail-row-select button {
    display: inline-grid !important;
    visibility: visible !important;
    width: 28px !important;
    min-width: 28px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    place-items: center !important;
    pointer-events: auto !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-gmail-row-open {
    grid-template-columns: minmax(0, 1fr) 52px !important;
    grid-template-areas:
      "sender time"
      "copy copy" !important;
    min-height: 72px !important;
    height: 72px !important;
    padding: 7px 10px 7px 2px !important;
    gap: 3px 8px !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads .mail-gmail-row-avatar {
    display: none !important;
  }

  /* Reader navigation and disposition actions are invariants, not desktop-only
   * chrome. Keep them sticky and horizontally scrollable on narrow screens. */
  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] #mail-reader-primary-actions-slot {
    position: sticky !important;
    top: 0 !important;
    z-index: 70 !important;
    display: flex !important;
    visibility: visible !important;
    width: 100% !important;
    min-height: 48px !important;
    height: 48px !important;
    padding: 0 4px !important;
    align-items: center !important;
    gap: 0 !important;
    overflow: hidden !important;
    border-bottom: 1px solid #e0e3e7 !important;
    background: rgba(255, 255, 255, .98) !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] #mail-view-back-btn {
    display: inline-grid !important;
    visibility: visible !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-reader-primary-actions {
    position: static !important;
    display: flex !important;
    visibility: visible !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 48px !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2px !important;
    overflow: hidden !important;
    border: 0 !important;
    background: transparent !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-reader-action-group {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    height: 48px !important;
    align-items: center !important;
    gap: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-reader-primary-actions :is(button, summary) {
    display: inline-grid !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-reader-move-shell,
  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-reader-position {
    display: none !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-reader-navigation {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: 0 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-view-sticky-chrome > .mail-panel-header {
    display: flex !important;
    visibility: visible !important;
    width: 100% !important;
    min-height: 62px !important;
    height: auto !important;
    padding: 8px 12px !important;
    align-items: center !important;
    gap: 8px !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] #mail-view-subject {
    display: -webkit-box !important;
    height: auto !important;
    max-height: 44px !important;
    overflow: hidden !important;
    font-size: 18px !important;
    line-height: 22px !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] #mail-view-meta {
    display: none !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-message-primary-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2px 6px !important;
  }

  html body.mail-body.mail-embedded.mail-simple-mode[data-mail-pane="thread"] .mail-message-email {
    color: #5f6368 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
  }

  /* The host bottom navigation is a primary touch surface. */
  html body.tenant-app-body[data-app-surface="workspace"] #app-mobile-nav.communications-mobile-nav > button.tenant-mobile-nav-btn {
    display: flex !important;
    flex-direction: column !important;
    min-height: 64px !important;
    padding: 6px 2px 5px !important;
    gap: 4px !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"] #app-mobile-nav.communications-mobile-nav .tenant-mobile-nav-icon {
    width: 22px !important;
    height: 22px !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"] #app-mobile-nav.communications-mobile-nav .tenant-mobile-nav-icon svg {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"] #app-mobile-nav.communications-mobile-nav .tenant-mobile-nav-label {
    margin: 0 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"] #app-mobile-nav#app-mobile-nav.communications-mobile-nav > button.tenant-mobile-nav-btn::before {
    display: none !important;
    content: none !important;
  }
}

@media (max-width: 430px) {
  html body.mail-body.mail-embedded.mail-simple-mode #mail-threads > .mail-simple-consensus-toolbar {
    grid-template-columns: minmax(118px, 1fr) 122px !important;
  }
}
/* Honest initial state: avoid flashing a false empty inbox while the first page loads. */
.mail-list-loading {
  display: grid;
  gap: 10px;
  padding: 16px;
  color: #5f6368;
  font-size: 13px;
}

.mail-list-loading i {
  display: block;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f3f4 20%, #e8eaed 38%, #f1f3f4 56%);
  background-size: 220% 100%;
  animation: mail-list-loading-shimmer 1.2s ease-in-out infinite;
}

@keyframes mail-list-loading-shimmer {
  to { background-position-x: -220%; }
}

/* Mailbox switcher: the rail is under 200px wide, so a single-line, ellipsised
   address reads as "admin@fut…". Let the address and its status wrap instead
   so every mailbox is readable without hovering. */
@media (min-width: 801px) {
  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-mail-rail .tenant-mailbox-list .mailbox-chip-title,
  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-mail-rail .tenant-mailbox-list .mailbox-chip-subtitle {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-mail-rail .tenant-mailbox-list .mailbox-chip {
    align-items: flex-start !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-mail-rail .tenant-mailbox-list .mailbox-chip-count {
    margin-top: 2px !important;
    flex-shrink: 0 !important;
  }

  html body.tenant-app-body[data-app-surface="workspace"][data-active-tab="inbox"] #app-mail-rail .tenant-mailbox-list {
    max-height: 340px !important;
  }
}

/* Attachments: Gmail-style tiles under the message and a full-window viewer.
   Tiles keep the .attachment-card hooks that the e2e contracts count. */
html body .mail-attachments {
  margin: 20px 0 4px;
  padding-top: 16px;
  border-top: 1px solid #e0e3e7;
}

html body .mail-attachments .mail-attachments-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
}

html body .mail-attachments .mail-attachments-head h3 {
  margin: 0;
  color: #202124;
  font: 500 14px/20px Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .1px;
  text-transform: none;
}

html body .mail-attachments .mail-attachment-restricted {
  color: #5f6368;
  font-size: 12px;
}

html body .mail-attachments .attachment-list.mail-attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

html body .mail-attachments .attachment-card.mail-attachment-tile {
  position: relative;
  flex: 0 0 180px;
  width: 180px;
  height: 122px;
  padding: 0;
  gap: 0;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
  display: block;
}

html body .mail-attachments .mail-attachment-tile .mail-attachment-tile-open {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

html body .mail-attachments .mail-attachment-tile .mail-attachment-thumb {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f3f4;
  overflow: hidden;
}

html body .mail-attachments .mail-attachment-tile .mail-attachment-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

html body .mail-attachments .mail-attachment-caption {
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 10px;
  border-top: 1px solid #e0e3e7;
  background: #fff;
}

html body .mail-attachments .mail-attachment-name {
  min-width: 0;
  overflow: hidden;
  color: #3c4043;
  font: 500 13px/18px Roboto, "Helvetica Neue", Arial, sans-serif;
  white-space: nowrap;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}

html body .mail-attachment-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 16px;
  padding: 0 3px;
  border-radius: 3px;
  background: #5f6368;
  color: #fff;
  font: 700 9px/1 Roboto, Arial, sans-serif;
  letter-spacing: .3px;
}

html body .mail-attachment-glyph {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 52px;
  color: #5f6368;
}

html body .mail-attachment-glyph svg,
html body :is(.mail-attachments, #mail-attachment-preview-modal) button .mail-attachment-glyph svg {
  width: 100% !important;
  height: 100% !important;
  fill: #fff;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

html body .mail-attachment-glyph b {
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  padding: 1px 3px;
  border-radius: 2px;
  background: var(--kind, #5f6368);
  color: #fff;
  font: 700 8px/1.2 Roboto, Arial, sans-serif;
  letter-spacing: .3px;
  white-space: nowrap;
}

html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-pdf,
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-video { --kind: #d93025; }
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-doc { --kind: #1a73e8; }
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-sheet { --kind: #188038; }
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-slides { --kind: #e37400; }
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-image,
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-audio { --kind: #9334e6; }
html body :is(.mail-attachment-badge, .mail-attachment-glyph).is-calendar { --kind: #1967d2; }
html body .mail-attachment-badge[class*="is-"] { background: var(--kind, #5f6368); }
html body .mail-attachment-glyph[class*="is-"] { color: var(--kind, #5f6368); }

/* Hover layer: file name and size over the tile, with the actions along the bottom. */
html body .mail-attachments .mail-attachment-hover {
  position: absolute;
  inset: 0 0 36px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: rgba(32, 33, 36, .72);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}

html body .mail-attachments .mail-attachment-hover-name {
  display: -webkit-box;
  overflow: hidden;
  font: 500 13px/18px Roboto, Arial, sans-serif;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

html body .mail-attachments .mail-attachment-hover-size {
  color: #e8eaed;
  font: 400 12px/16px Roboto, Arial, sans-serif;
}

html body .mail-attachments .attachment-card-actions.mail-attachment-tile-actions {
  position: absolute;
  right: 8px;
  bottom: 44px;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}

html body .mail-attachments .mail-attachment-tile-actions .mail-attachment-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, .7) !important;
  border-radius: 50% !important;
  background: rgba(32, 33, 36, .6) !important;
  box-shadow: none !important;
  color: #fff !important;
  cursor: pointer;
}

html body .mail-attachments .mail-attachment-tile-actions .mail-attachment-action:hover,
html body .mail-attachments .mail-attachment-tile-actions .mail-attachment-action:focus-visible {
  background: rgba(255, 255, 255, .22) !important;
}

html body :is(.mail-attachments, #mail-attachment-preview-modal) button svg {
  width: 18px !important;
  height: 18px !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html body .mail-attachments .mail-attachment-tile:is(:hover, :focus-within) {
  border-color: #c4c7c5;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .3);
}

html body .mail-attachments .mail-attachment-tile:is(:hover, :focus-within) :is(.mail-attachment-hover, .mail-attachment-tile-actions) {
  opacity: 1;
}

html body .mail-attachments .mail-attachment-tile:is(:hover, :focus-within) .mail-attachment-tile-actions {
  pointer-events: auto;
}

html body .mail-attachments .mail-attachment-tile .mail-attachment-tile-open:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: -2px;
}

/* Touch screens have no hover: a tap opens the viewer, which carries the download action. */
@media (hover: none) {
  html body .mail-attachments .mail-attachment-hover,
  html body .mail-attachments .attachment-card-actions.mail-attachment-tile-actions {
    display: none;
  }
}

@media (max-width: 520px) {
  html body .mail-attachments .attachment-list.mail-attachment-grid { gap: 8px; }
  html body .mail-attachments .attachment-card.mail-attachment-tile {
    flex: 0 0 calc(50% - 4px);
    width: calc(50% - 4px);
    height: 112px;
  }
}

/* Viewer */
html body #mail-attachment-preview-modal.mail-attachment-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  flex-direction: column;
  background: rgba(20, 21, 23, .92);
  color: #e8eaed;
}

html body #mail-attachment-preview-modal.mail-attachment-viewer-modal.hidden {
  display: none;
}

html body.mail-attachment-viewer-open {
  overflow: hidden;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-bar {
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 12px 0 8px;
  background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, .35));
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

html body #mail-attachment-preview-modal #mail-attachment-preview-title {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font: 500 16px/22px Roboto, "Helvetica Neue", Arial, sans-serif;
  white-space: nowrap;
  text-overflow: ellipsis;
}

html body #mail-attachment-preview-modal #mail-attachment-preview-meta,
html body #mail-attachment-preview-modal .mail-attachment-viewer-count {
  color: #bdc1c6;
  font: 400 12px/16px Roboto, Arial, sans-serif;
  white-space: nowrap;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-actions {
  display: flex;
  gap: 4px;
}

html body #mail-attachment-preview-modal :is(.mail-attachment-viewer-icon, .mail-attachment-viewer-nav) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #e8eaed !important;
  cursor: pointer;
}

html body #mail-attachment-preview-modal :is(.mail-attachment-viewer-icon, .mail-attachment-viewer-nav).hidden {
  display: none;
}

html body #mail-attachment-preview-modal :is(.mail-attachment-viewer-icon, .mail-attachment-viewer-nav):is(:hover, :focus-visible) {
  background: rgba(255, 255, 255, .14) !important;
}

html body #mail-attachment-preview-modal :is(.mail-attachment-viewer-icon, .mail-attachment-viewer-nav) svg {
  width: 22px !important;
  height: 22px !important;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 72px 32px;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-nav {
  position: absolute;
  top: 50%;
  width: 48px !important;
  height: 48px !important;
  transform: translateY(-50%);
  background: rgba(32, 33, 36, .7) !important;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-nav.is-prev { left: 12px; }
html body #mail-attachment-preview-modal .mail-attachment-viewer-nav.is-next { right: 12px; }

html body #mail-attachment-preview-modal .mail-attachment-viewer-nav:disabled {
  visibility: hidden;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-primary.is-quiet {
  background: transparent !important;
  border: 1px solid #8e918f !important;
  color: #e8eaed !important;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-pdf {
  width: min(100%, 960px);
  height: 100%;
  border: 0;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}

html body #mail-attachment-preview-modal :is(.mail-attachment-viewer-fallback, .mail-attachment-viewer-loading) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  padding: 32px 36px;
  border-radius: 12px;
  background: #3c4043;
  color: #e8eaed;
  text-align: center;
  font: 400 14px/20px Roboto, Arial, sans-serif;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-fallback strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #fff;
  font-weight: 500;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-fallback p {
  margin: 0;
  color: #bdc1c6;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-fallback .mail-attachment-glyph {
  width: 64px;
  height: 76px;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px !important;
  margin-top: 4px;
  padding: 0 20px !important;
  border: 0 !important;
  border-radius: 20px !important;
  background: #a8c7fa !important;
  box-shadow: none !important;
  color: #062e6f !important;
  font: 500 14px/20px Roboto, Arial, sans-serif;
  cursor: pointer;
}

html body #mail-attachment-preview-modal .mail-attachment-viewer-loading span {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: #a8c7fa;
  border-radius: 50%;
  animation: mail-attachment-spin .8s linear infinite;
}

@keyframes mail-attachment-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  html body #mail-attachment-preview-modal .mail-attachment-viewer-stage { padding: 4px 8px 16px; }
  html body #mail-attachment-preview-modal .mail-attachment-viewer-nav { top: auto; bottom: 20px; transform: none; }
  html body #mail-attachment-preview-modal .mail-attachment-viewer-count { display: none; }
}
