:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --text: #1f1f1f;
  --muted: #5f6368;
  --line: #e0e0e0;
  --primary: #202124;
  --primary-dark: #000;
  --compose: #fff;
  --teal: #202124;
  --shadow: 0 8px 28px rgba(60, 64, 67, 0.13);
  font-family:
    "Google Sans",
    Roboto,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

@keyframes mobile-message-loading-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@media (max-width: 700px) {
  .mobile-message-loading-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #6f747a;
    font-size: 0.76rem;
    font-weight: 600;
  }

  .mobile-message-loading-status > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5f6368;
    animation: mobile-message-loading-pulse 900ms ease-in-out infinite;
  }

  .mobile-message-loading-line {
    width: min(170px, 58vw);
    height: 7px;
    margin-top: 0.42rem;
    border-radius: 999px;
    background: #eceff1;
    animation: mobile-message-loading-pulse 900ms ease-in-out infinite;
  }

  .mobile-message-loading-footer {
    min-height: calc(58px + env(safe-area-inset-bottom, 0px));
  }
}

body {
  background: var(--bg);
}

.startup-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 2rem;
  background: #f7f8fb;
  color: #202124;
  text-align: center;
}
.startup-screen img {
  width: 52px;
  height: 52px;
  margin-bottom: 0.35rem;
  border-radius: 14px;
}
.startup-screen strong {
  font-size: 1.05rem;
}
.startup-screen p {
  margin: 0;
  color: #6b7280;
  font-size: 0.82rem;
}
.startup-retry {
  min-height: 38px;
  margin-top: 0.65rem;
  padding: 0.5rem 1rem;
  border: 1px solid #d8dce2;
  border-radius: 10px;
  background: #fff;
  color: #202124;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #9aa0a6;
  box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.1);
}
.button.primary {
  box-shadow: 0 5px 14px rgba(32, 33, 36, 0.18);
}
.app-shell {
  grid-template-columns: 256px minmax(0, 1fr);
}
.sidebar {
  padding: 1rem 0.8rem;
  background: var(--bg);
  border-right: 0;
  backdrop-filter: none;
}
.compose {
  width: auto;
  align-self: flex-start;
  margin: 0.25rem 0 0.85rem 0.25rem;
  padding: 1rem 1.35rem;
  border: 1px solid rgba(32, 33, 36, 0.22);
  border-radius: 16px;
  background: #fff !important;
  color: #202124 !important;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12) !important;
}
.compose:hover {
  border-color: rgba(32, 33, 36, 0.32);
  background: #f8f9fa !important;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.16) !important;
}
.nav button {
  padding: 0.46rem 1rem;
  border-radius: 0 18px 18px 0;
  color: #444746;
}
.nav {
  gap: 0.08rem;
}
.block-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.nav button.active {
  background: #e8eaed;
  color: #202124;
}
.nav button b {
  background: transparent;
  color: #202124;
}
.topbar {
  min-height: 84px;
  padding: 1rem 1.5rem;
  border-bottom: 0;
  background: var(--bg);
  backdrop-filter: none;
}
.content {
  padding: 0 1rem 1.5rem 0;
}
.search {
  min-width: min(44vw, 620px);
  border: 1px solid rgba(32, 33, 36, 0.22);
  background: #fff;
}
.search input {
  background: transparent;
}
.search input:focus {
  box-shadow: none;
}
.search:focus-within {
  border-color: rgba(32, 33, 36, 0.42);
  box-shadow: 0 0 0 2px rgba(32, 33, 36, 0.06);
}

.gmail-shell {
  min-height: calc(100vh - 102px);
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}
.list-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  border-bottom: 1px solid #edf0f3;
  color: #5f6368;
}
.list-toolbar .spacer {
  flex: 1;
}
.list-toolbar small {
  font-size: 0.72rem;
}
.list-status:empty {
  display: none;
}
.list-pagination {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  font-size: 0.72rem;
}
.list-pagination span {
  margin-right: 0.35rem;
}
.list-pagination .page-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  color: #3c4043;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}
.list-pagination .page-button:hover:not(:disabled) {
  background: #f1f3f4;
}
.list-pagination .page-button:disabled {
  color: #bdc1c6;
  cursor: default;
}
.batch-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.empty-trash-button {
  min-height: 34px;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(32, 33, 36, 0.22);
  border-radius: 18px;
  background: #fff;
  color: #202124;
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}
.empty-trash-button:hover {
  border-color: rgba(32, 33, 36, 0.34);
  background: #f1f3f4;
}
.list-toolbar.selection-active .empty-trash-button {
  display: none;
}
.toolbar-action {
  border: 0;
  border-radius: 8px;
  padding: 0.42rem 0.65rem;
  background: transparent;
  color: #3c4043;
  font: inherit;
  cursor: pointer;
}
.batch-actions .toolbar-action.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
}
.batch-actions .toolbar-svg {
  width: 20px;
  height: 20px;
}
.batch-actions .trash-icon {
  width: 18px;
  height: 18px;
}
.toolbar-action:hover {
  background: #eef2f7;
}
.toolbar-action:disabled {
  opacity: 0.5;
  cursor: wait;
}
.trash-icon {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.gmail-list {
  width: 100%;
}
.gmail-row {
  display: grid;
  grid-template-columns:
    24px 24px minmax(125px, 155px) minmax(110px, 150px)
    minmax(260px, 1fr) 72px;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 42px;
  padding: 0 1rem;
  border: 0;
  border-bottom: 1px solid #e8eaed;
  background: #f2f6fc;
  color: #202124;
  text-align: left;
  cursor: pointer;
}
@media (min-width: 1051px) {
  .gmail-row.alias-mailbox-row .mail-line {
    grid-column: 4 / 6;
  }
  .gmail-row.alias-mailbox-row time {
    grid-column: 6;
  }
}
.gmail-row:hover {
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 7px rgba(60, 64, 67, 0.24);
}
.gmail-row.unread {
  background: #fff;
  font-weight: 700;
}
.gmail-row:not(.unread) {
  color: #3c4043;
}
.gmail-row.unread .sender,
.gmail-row.unread .mail-subject-line strong {
  color: #202124;
  font-weight: 700;
}
.gmail-row:not(.unread) .sender,
.gmail-row:not(.unread) .mail-subject-line strong {
  color: #3c4043;
  font-weight: 400;
}
.select-box {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #9aa0a6;
  border-radius: 2px;
  background: transparent;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}
.select-box.checked,
.select-box.partial {
  border-color: #202124;
  background: #202124;
}
.gmail-row.selected {
  background: #e8eaed;
}
.gmail-row .star {
  width: 24px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa0a6;
  font-size: 1.05rem;
  cursor: pointer;
}
.gmail-row .star.active {
  color: #f4b400;
}
.gmail-row .sender-avatar {
  display: none;
}
.gmail-row .select-box {
  position: relative;
  overflow: hidden;
}
.gmail-row .selection-mark {
  font-size: 0.7rem;
  line-height: 1;
}
.replied-marker {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-right: 0.24rem;
  color: #5f6368;
  vertical-align: -0.25rem;
}
.replied-icon {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}
.gmail-row .sender,
.gmail-row .recipient,
.gmail-row .mail-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gmail-row .recipient-chip {
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.12rem 0.45rem;
  border-radius: 8px;
  background: #e8eaed;
  color: #202124;
  font-size: 0.68rem;
  vertical-align: middle;
}
.gmail-row .recipient-copy-button {
  appearance: none;
  margin: 0;
  border: 0;
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.gmail-row .recipient-copy-button:hover {
  background: #dfe3e7;
}
.gmail-row .recipient-copy-button:active {
  background: #d5d9dd;
}
.gmail-row .recipient-copy-button:focus-visible {
  outline: 2px solid #5f6368;
  outline-offset: 1px;
}
.gmail-row .mail-line {
  font-size: 0.82rem;
}
.row-attachment-marker {
  display: inline-flex;
  align-items: center;
  margin-right: 0.3rem;
  color: #4f5965;
  vertical-align: -0.2rem;
}
.row-attachment-marker .paperclip-icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}
.gmail-row.unread .row-attachment-marker {
  color: #202124;
}
.gmail-row .mail-preview {
  color: #5f6368;
  font-weight: 400;
}
.search-folder-chip {
  display: inline-block;
  margin-right: 0.2rem;
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
  background: #e8eaed;
  color: #5f6368;
  font-size: 0.66rem;
  font-weight: 500;
  vertical-align: 0.08rem;
}
.search-highlight {
  padding: 0 0.04em;
  border-radius: 2px;
  background: #ffeb3b;
  color: inherit;
}
.gmail-row time {
  text-align: right;
  color: #5f6368;
  font-size: 0.7rem;
  font-weight: 500;
}
.gmail-row.admin-mailbox-row time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.gmail-row.unread time {
  color: #202124;
  font-weight: 700;
}
.gmail-row:not(.unread) time {
  color: #5f6368;
  font-weight: 400;
}
.gmail-empty {
  min-height: 340px;
  display: grid;
  place-items: center;
  color: #5f6368;
}

.message-page {
  position: relative;
  height: calc(100vh - 102px);
  min-height: calc(100vh - 102px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}
.address-dismiss-layer {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: none;
  background: transparent;
}
.message-page.address-card-open .address-dismiss-layer {
  display: block;
}
.message-page .detail-toolbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid #edf0f3;
}
.message-page .detail-toolbar .icon-button {
  width: 30px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: #3c4043;
  font-size: 1.5rem;
  cursor: pointer;
}
.message-page .detail-toolbar .icon-button:hover {
  background: #f1f3f4;
}
.message-page .detail-toolbar .detail-back {
  font-size: 1.65rem;
}
.detail-more-menu {
  position: relative;
  margin-left: auto;
}
.detail-more-menu > summary {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #3c4043;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.detail-more-menu > summary::-webkit-details-marker {
  display: none;
}
.detail-more-menu > summary:hover,
.detail-more-menu[open] > summary {
  background: #f1f3f4;
}
.detail-more-menu > summary:focus-visible {
  outline: 2px solid #5f6368;
  outline-offset: 2px;
}
.detail-more-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 5px);
  right: 0;
  width: max-content;
  min-width: 0;
  padding: 0.25rem;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(32, 33, 36, 0.18);
}
.detail-more-popover button {
  width: auto;
  min-width: 64px;
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #202124;
  font: inherit;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}
.detail-more-popover button:hover {
  background: #f1f3f4;
}
.detail-more-popover button:disabled {
  color: #9aa0a6;
  cursor: wait;
}
.toolbar-separator {
  width: 1px;
  height: 24px;
  margin: 0 0.15rem 0 -0.15rem;
  background: #e0e0e0;
}
.toolbar-svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.unread-icon circle {
  fill: currentColor;
  stroke: #fff;
  stroke-width: 1.5;
}
.message-page .detail-toolbar .trash-icon {
  width: 20px;
  height: 20px;
}
.detail-toolbar-star {
  color: #5f6368 !important;
}
.detail-toolbar-star.active {
  color: #f4b400 !important;
}
.detail-translate.active {
  color: #202124 !important;
  background: #e8eaed;
}
.not-junk-button {
  min-height: 34px;
  margin-left: 0.2rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid #dadce0;
  border-radius: 18px;
  background: #fff;
  color: #3c4043;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.not-junk-button:hover {
  background: #f1f3f4;
}
.translate-glyph {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1;
}
.message-page .detail-header {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 1.35rem 1rem 0.8rem;
  border: 0;
}
.detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 50px;
  margin-bottom: 1.35rem;
}
.message-page .detail-title-row h3 {
  font-size: 1.45rem;
  font-weight: 500;
  margin: 0;
  color: #202124;
}
.mailbox-tag {
  flex: 0 0 auto;
  border-radius: 4px;
  padding: 0.12rem 0.42rem;
  background: #e0e0e0;
  color: #4d5156;
  font-size: 0.68rem;
}
.detail-meta-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
}
.detail-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8eaed;
  color: #202124;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}
.avatar-initial {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: translateY(2px);
}
.detail-avatar-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 3px;
  border-radius: inherit;
  background: #fff;
  object-fit: contain;
  pointer-events: none;
}
.detail-correspondents {
  min-width: 0;
  position: relative;
}
.detail-sender-line {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #202124;
  font-size: 0.86rem;
}
.detail-replied-marker {
  margin-right: 0.32rem;
  vertical-align: -0.3rem;
}
.detail-sender-email {
  margin-left: 0.25rem;
  color: #5f6368;
  font-size: 0.76rem;
}
.message-address-details {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.2rem;
  color: #5f6368;
  font-size: 0.73rem;
}
.message-address-details[open] {
  z-index: 10;
}
.message-address-details summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
}
.message-address-details summary::-webkit-details-marker {
  display: none;
}
.address-card {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.45rem);
  left: 0;
  width: min(540px, 72vw);
  padding: 0.9rem 1rem;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
  color: #3c4043;
  box-shadow: 0 4px 12px rgba(60, 64, 67, 0.24);
  font-size: 0.78rem;
}
.address-card > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 0.5rem;
  margin: 0.34rem 0;
  overflow-wrap: anywhere;
}
.address-card > div > span:first-child {
  color: #5f6368;
  text-align: right;
}
.address-copy-button {
  appearance: none;
  max-width: 100%;
  margin: -0.15rem -0.28rem;
  padding: 0.15rem 0.28rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.address-copy-button.sender-address {
  font-weight: 700;
}
.address-copy-button:hover {
  background: #f1f3f4;
  color: #202124;
}
.address-copy-button:active {
  background: #e8eaed;
}
.address-copy-button:focus-visible {
  outline: 2px solid #5f6368;
  outline-offset: 1px;
}
.detail-meta-row time {
  padding-top: 0.15rem;
  color: #5f6368;
  font-size: 0.7rem;
  white-space: nowrap;
}
.message-page .detail-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1rem 1rem 4.15rem;
}
.message-page .attachment-list {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem 1rem 4.15rem;
}
.message-page .mail-frame {
  display: block;
  height: 100%;
  min-height: 320px;
}
.message-footer-actions {
  max-width: none;
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  gap: 0.65rem;
  margin: auto auto 0;
  padding: 0.8rem 1rem 0.9rem 4.15rem;
  border-top: 1px solid #edf0f3;
  background: #fff;
  box-shadow: 0 -1px 3px rgba(60, 64, 67, 0.06);
}
.gmail-action-pill {
  min-width: 104px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.58rem 1rem;
  border: 1px solid #747775;
  border-radius: 999px;
  background: #fff;
  color: #3c4043;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.gmail-action-pill:hover {
  background: #f8fafd;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
}
.action-svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}
.compose-quote {
  margin-top: -0.35rem;
  padding: 0 0.15rem 0.25rem 1rem;
  border-left: 1px solid #c7c7c7;
  color: #202124;
  font-weight: 400;
}
.compose-quote-heading {
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.45;
}
.compose-quote-frame {
  width: 100%;
  height: 260px;
  display: block;
  border: 0;
  background: #fff;
}

@media (max-width: 1050px) {
  .gmail-row {
    grid-template-columns:
      20px 20px minmax(115px, 155px) minmax(220px, 1fr)
      60px;
  }
  .gmail-row .recipient {
    display: none;
  }
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 78px 1fr;
  }
  .content {
    padding-right: 0.65rem;
  }
  .gmail-row {
    grid-template-columns: 18px 18px minmax(100px, 135px) minmax(180px, 1fr) 54px;
  }
  .message-page .detail-header,
  .message-page .detail-body,
  .message-page .attachment-list,
  .message-footer-actions {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .detail-title-row {
    padding-left: 50px;
  }
}
@media (max-width: 700px) {
  .detail-title-row {
    padding-left: 0;
  }
  .detail-meta-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .detail-meta-row time {
    display: none;
  }
  .detail-sender-email {
    display: none;
  }
}
@media (max-width: 600px) {
  .topbar {
    padding: 0.75rem;
  }
  .content {
    padding: 0 0.5rem 0.5rem;
  }
  .gmail-row {
    grid-template-columns: 18px 18px 1fr 48px;
    gap: 0.35rem;
    min-height: 58px;
    padding: 0.4rem 0.7rem;
  }
  .gmail-row .sender {
    grid-column: 3;
  }
  .gmail-row .mail-line {
    grid-column: 3 / 5;
  }
  .gmail-row .star {
    grid-column: 2;
    grid-row: 1;
  }
  .gmail-row time {
    grid-column: 4;
    grid-row: 1;
  }
}

/* Mobile-only controls stay completely outside the locked desktop layout. */
.mobile-nav-trigger,
.mobile-nav-backdrop,
.mobile-compose-button,
.mobile-account-trigger,
.mobile-account-backdrop,
.mobile-account-menu,
.mobile-pull-refresh {
  display: none;
}
.mobile-action-menu {
  display: none;
}

/* Headquarters-only desktop theme switch. Mobile and alias accounts never enable it. */
@media (min-width: 901px) {
  .sidebar > .account-card .account-menu .desktop-dark-mode-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }
  .desktop-dark-mode-label {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 0.52rem;
  }
  .desktop-dark-mode-label svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
  }
  .desktop-dark-mode-label svg path {
    fill: currentColor;
    stroke: none;
  }
  .desktop-dark-mode-switch {
    position: relative;
    width: 30px;
    height: 18px;
    flex: 0 0 30px;
    border: 1px solid #c5c9ce;
    border-radius: 999px;
    background: #e5e7e9;
    transition: background-color 150ms ease, border-color 150ms ease;
  }
  .desktop-dark-mode-switch span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(32, 33, 36, 0.24);
    transition: transform 150ms ease;
  }
  .desktop-dark-mode-control[aria-checked="true"] .desktop-dark-mode-switch {
    border-color: #202124;
    background: #202124;
  }
  .desktop-dark-mode-control[aria-checked="true"] .desktop-dark-mode-switch span {
    transform: translateX(12px);
  }
}

@media (max-width: 900px) {
  .desktop-dark-mode-control {
    display: none !important;
  }
}

@media (min-width: 701px) {
  html,
  body {
    height: 100%;
  }
  body:has(#app:not(.hidden)) {
    overflow: hidden;
  }
  .app-shell:not(.hidden) {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }
  .workspace {
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .topbar {
    flex: 0 0 84px;
  }
  .content {
    min-height: 0;
    flex: 1 1 auto;
    overflow: auto;
  }
  .content:has(> .message-page) {
    overflow: hidden;
  }
  .gmail-shell {
    min-height: 100%;
    overflow: clip;
  }
  .list-toolbar {
    position: sticky;
    z-index: 20;
    top: 0;
    background: #fff;
  }
  .message-page {
    height: 100%;
    min-height: 0;
  }
  /* Sender initials are mobile avatars. Keep them out of desktop hit testing. */
  .gmail-row .sender-avatar-initial {
    display: none;
  }
  /* Keep the small checkbox visual while making its full desktop column easy to click. */
  .gmail-row .select-box {
    width: 36px;
    height: 42px;
    justify-self: center;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .gmail-row .select-box::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border: 1px solid #9aa0a6;
    border-radius: 2px;
    background: transparent;
  }
  .gmail-row .select-box.checked,
  .gmail-row .select-box.partial {
    background: transparent;
  }
  .gmail-row .select-box.checked::before,
  .gmail-row .select-box.partial::before {
    border-color: #202124;
    background: #202124;
  }
  .gmail-row .select-box .selection-mark {
    position: relative;
    z-index: 1;
  }
}

@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    display: block;
    min-height: 0;
    overflow: hidden;
  }
  .workspace {
    height: 100dvh;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
  }
  .workspace:has(.content > .message-page) .topbar {
    display: none;
  }
  .sidebar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    width: 65vw;
    height: 100dvh;
    padding: 1rem 0.8rem;
    border-right: 1px solid #dfe3e9;
    background: #f6f8fc;
    box-shadow: 8px 0 30px rgba(32, 33, 36, 0.16);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }
  .app-shell.mobile-nav-open .sidebar {
    transform: translateX(0);
  }
  .mobile-nav-backdrop {
    position: fixed;
    z-index: 55;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(32, 33, 36, 0.34);
  }
  .app-shell.mobile-nav-open .mobile-nav-backdrop {
    display: block;
  }
  .sidebar .brand {
    justify-content: flex-start;
    gap: 0.55rem;
    font-size: 1rem;
    padding: 0.2rem 0.5rem 1.1rem;
  }
  .sidebar .brand span:last-child,
  .sidebar .compose:not(:focus),
  .sidebar .nav button span,
  .sidebar .admin-nav small,
  .sidebar .account-copy,
  .sidebar .account-menu-chevron {
    display: initial;
    font-size: inherit;
  }
  .sidebar .account-card {
    display: none;
  }
  .sidebar .compose {
    display: inline-flex;
    justify-content: center;
    width: auto;
    min-width: 116px;
    margin: 0 0.25rem 0.75rem;
    font-size: 0.95rem;
  }
  .sidebar .compose span {
    display: inline !important;
    font-size: 0.95rem !important;
  }
  .sidebar .compose::after,
  .sidebar .nav button::before {
    content: none !important;
  }
  .sidebar .nav button {
    justify-content: space-between;
  }
  .topbar {
    min-height: 76px;
    flex: 0 0 76px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 0.55rem;
    padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 0.75rem 0.55rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(60, 64, 67, 0.14);
  }
  .mobile-nav-trigger {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #3c4043;
  }
  .mobile-nav-trigger:active {
    background: #e9eef6;
  }
  .mobile-nav-trigger svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
  .search {
    width: 100%;
    min-width: 0;
    height: 48px;
    border-radius: 24px;
    background: #fff;
  }
  .search.hidden {
    display: flex !important;
    visibility: hidden;
  }
  .search input {
    min-width: 0;
    font-size: 1rem;
  }
  .topbar-actions {
    position: relative;
    margin: 0;
  }
  .topbar-refresh {
    display: none;
  }
  .mobile-account-trigger {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
  }
  .mobile-account-trigger .avatar {
    width: 36px;
    height: 36px;
  }
  .mobile-account-backdrop {
    position: fixed;
    z-index: 70;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(60, 64, 67, 0.2);
    cursor: default;
  }
  .mobile-account-backdrop:not(.hidden) {
    display: block;
  }
  .mobile-account-menu {
    position: absolute;
    z-index: 75;
    top: calc(100% + 0.5rem);
    right: 0;
    width: min(280px, calc(100vw - 1.5rem));
    padding: 0.4rem;
    border: 1px solid #dfe3e9;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 38px rgba(32, 33, 36, 0.22);
  }
  .mobile-account-menu:not(.hidden) {
    display: block;
  }
  .mobile-account-identity {
    display: grid;
    gap: 0.18rem;
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid #edf0f3;
  }
  .mobile-account-identity strong,
  .mobile-account-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-account-identity small {
    color: #5f6368;
  }
  .mobile-account-menu > button {
    width: 100%;
    padding: 0.75rem 0.8rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #303846;
    text-align: left;
    font-weight: 700;
  }
  .mobile-account-menu > button:active {
    background: #f1f3f4;
  }
  .content {
    min-height: 0;
    flex: 1 1 auto;
    padding: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .gmail-shell {
    position: relative;
    min-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .mobile-pull-refresh {
    --pull-distance: 0px;
    position: absolute;
    z-index: 12;
    top: 0;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0.4rem 0.8rem;
    border: 1px solid #dfe3e9;
    border-radius: 18px;
    background: #fff;
    color: #5f6368;
    box-shadow: 0 2px 8px rgba(60, 64, 67, 0.2);
    font-size: 0.78rem;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(-52px + var(--pull-distance)));
    transition: opacity 120ms ease;
    white-space: nowrap;
  }
  .mobile-pull-refresh.active {
    opacity: 1;
  }
  .mobile-pull-refresh.ready {
    border-color: #9aa0a6;
    color: #202124;
  }
  .mobile-pull-refresh-icon {
    display: inline-block;
    font-size: 1.05rem;
    line-height: 1;
  }
  .mobile-pull-refresh.refreshing .mobile-pull-refresh-icon {
    animation: mobile-pull-refresh-spin 700ms linear infinite;
  }
  .list-toolbar {
    display: none;
    min-height: 46px;
    padding: 0 0.75rem;
  }
  .list-toolbar.has-pages,
  .list-toolbar.empty-trash-available,
  .list-toolbar.selection-active {
    display: flex;
  }
  .list-toolbar #list-refresh,
  .list-toolbar .list-status {
    display: none;
  }
  .list-toolbar:not(.selection-active) .toolbar-select {
    display: none;
  }
  .batch-actions {
    min-width: 0;
    overflow-x: auto;
  }
  .batch-actions .toolbar-action {
    flex: 0 0 auto;
  }
  .gmail-row {
    grid-template-columns: 46px minmax(0, 1fr) 42px;
    grid-template-rows: 25px 25px 25px;
    gap: 0 0.65rem;
    min-height: 86px;
    padding: 0.35rem 0.65rem;
    background: #fff;
    color: #3c4043;
    font-weight: 400;
  }
  .gmail-row.unread {
    background: #fff;
  }
  .gmail-row.unread .sender,
  .gmail-row.unread .mail-subject-line strong {
    color: #202124;
    font-weight: 700;
  }
  .gmail-row:not(.unread) .sender,
  .gmail-row:not(.unread) .mail-subject-line strong {
    color: #3c4043;
    font-weight: 400;
  }
  .gmail-row .mail-preview {
    color: #5f6368;
    font-weight: 400;
  }
  .gmail-row.unread time {
    color: #202124;
    font-weight: 700;
  }
  .gmail-row:not(.unread) time {
    color: #5f6368;
    font-weight: 400;
  }
  .gmail-row:hover {
    box-shadow: none;
  }
  .gmail-row.selected {
    background: #e8eaed;
  }
  .gmail-row .select-box {
    position: relative;
    grid-column: 1;
    grid-row: 1 / 4;
    align-self: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #e8eaed;
    color: #202124;
    font-size: 0;
    font-weight: 700;
    overflow: hidden;
  }
  .gmail-row .select-box .sender-avatar-initial {
    font-size: 1rem;
  }
  .gmail-row .select-box.checked,
  .gmail-row .select-box.partial {
    background: #202124;
    color: #fff;
    font-size: 0.9rem;
  }
  .gmail-row .select-box.checked .sender-avatar-initial,
  .gmail-row .select-box.partial .sender-avatar-initial {
    display: none;
  }
  .gmail-row .select-box .sender-avatar {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 3px;
    border-radius: inherit;
    background: #fff;
    object-fit: contain;
    pointer-events: none;
  }
  .gmail-row .select-box.checked .sender-avatar,
  .gmail-row .select-box.partial .sender-avatar {
    display: none;
  }
  .gmail-row .select-box .selection-mark {
    position: relative;
    z-index: 1;
    font-size: 0.9rem;
  }
  .gmail-row .sender {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 1rem;
    line-height: 1.25;
  }
  .gmail-row .recipient {
    display: none;
  }
  .gmail-row .mail-line {
    grid-column: 2 / 4;
    grid-row: 2 / 4;
    display: grid;
    align-self: start;
    padding-right: 2.7rem;
    font-size: 0.9rem;
    line-height: 1.4;
  }
  .gmail-row .mail-subject-line,
  .gmail-row .mail-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .gmail-row .mail-subject-line strong {
    display: inline;
  }
  .gmail-row .mail-preview {
    color: #5f6368;
  }
  .gmail-row .star {
    grid-column: 3;
    grid-row: 1 / 4;
    align-self: stretch;
    justify-self: end;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 58px;
    height: auto;
    margin-right: -0.65rem;
    padding: 0 0.65rem 0.25rem 0;
    font-size: 1.55rem;
    touch-action: manipulation;
  }
  .gmail-row.admin-mailbox-row .star {
    transform: translateX(5px);
  }
  .gmail-row time {
    grid-column: 3;
    grid-row: 1;
    align-self: end;
    position: relative;
    z-index: 3;
    pointer-events: none;
    font-size: 0.75rem;
  }
  .gmail-row.admin-mailbox-row time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 1px;
    line-height: 1;
    transform: translateY(10px);
    white-space: normal;
  }
  .gmail-row.admin-mailbox-row .admin-time-separator {
    display: none;
  }
  .gmail-row.admin-mailbox-row .admin-time-date,
  .gmail-row.admin-mailbox-row .admin-time-clock {
    display: block;
  }
  .row-attachment-marker {
    margin-right: 0.2rem;
  }
  .alias-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
    padding: 0.9rem 0.9rem 0.75rem;
  }
  .alias-toolbar .muted {
    margin: 0;
    line-height: 1.45;
  }
  .alias-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .alias-search {
    width: 100%;
    min-width: 0;
  }
  .alias-toolbar-actions .button {
    width: 100%;
    white-space: nowrap;
  }
  .app-shell[data-view="aliases"] .content {
    overflow-y: auto;
    padding: 0;
  }
  .app-shell[data-view="aliases"] .table-card {
    margin: 0 0.65rem 0.65rem;
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .app-shell[data-view="aliases"] .data-table,
  .app-shell[data-view="aliases"] .data-table tbody,
  .app-shell[data-view="aliases"] .data-table tr,
  .app-shell[data-view="aliases"] .data-table td {
    display: block;
    width: 100%;
  }
  .app-shell[data-view="aliases"] .data-table thead {
    display: none;
  }
  .app-shell[data-view="aliases"] .data-table tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem 0.65rem;
    margin-bottom: 0.55rem;
    padding: 0.75rem;
    overflow: visible;
    border: 1px solid #dde3ea;
    border-radius: 14px;
    background: #fff;
  }
  .app-shell[data-view="aliases"] .data-table tr:has(.mobile-action-menu[open]) {
    z-index: 25;
  }
  .app-shell[data-view="aliases"] .data-table td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    white-space: normal;
  }
  .app-shell[data-view="aliases"] .data-table td::before {
    content: none;
  }
  .app-shell[data-view="aliases"] .alias-identity {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .app-shell[data-view="aliases"] .alias-identity strong,
  .app-shell[data-view="aliases"] .alias-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-shell[data-view="aliases"] .alias-identity strong {
    font-size: 0.95rem;
  }
  .app-shell[data-view="aliases"] .alias-identity small {
    margin-top: 0.12rem;
    font-size: 0.72rem;
  }
  .app-shell[data-view="aliases"] .alias-permission {
    grid-column: 1;
  }
  .app-shell[data-view="aliases"] .alias-state {
    grid-column: 2;
  }
  .app-shell[data-view="aliases"] .alias-note {
    grid-column: 3;
    max-width: 120px;
    overflow: hidden;
    color: #6b7280;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .app-shell[data-view="aliases"] .alias-note.alias-note-empty {
    display: none;
  }
  .app-shell[data-view="aliases"] .alias-note::before {
    content: "备注 ";
    font-weight: 700;
  }
  .app-shell[data-view="aliases"] .alias-actions-cell {
    grid-column: 1 / -1;
    justify-self: end;
  }
  .app-shell[data-view="aliases"] .data-table td[colspan] {
    grid-column: 1 / -1;
    display: block;
    padding: 1.8rem 0.5rem;
    text-align: center;
  }
  .app-shell[data-view="aliases"] .data-table td[colspan]::before {
    content: none;
  }
  .desktop-management-actions {
    display: none !important;
  }
  .mobile-action-menu {
    position: relative;
    display: block;
  }
  .mobile-action-menu summary {
    min-width: 78px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0 0.65rem;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    background: #fff;
    color: #394150;
    font-size: 0.74rem;
    font-weight: 750;
    cursor: pointer;
    list-style: none;
  }
  .mobile-action-menu summary::-webkit-details-marker {
    display: none;
  }
  .mobile-action-menu[open] summary {
    border-color: #9aa0a6;
    background: #f1f3f4;
    color: #202124;
  }
  .mobile-action-menu-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 190px;
    display: grid;
    gap: 0.35rem;
    padding: 0.5rem;
    border: 1px solid #d9dee6;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(32, 33, 36, 0.2);
  }
  .mobile-action-menu-panel .button {
    width: 100%;
    min-height: 36px;
    justify-content: flex-start;
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  .app-shell[data-view="domains"] .content {
    overflow-y: auto;
    padding: 0.55rem;
  }
  .app-shell[data-view="domains"] .toolbar {
    margin: 0 0 0.45rem;
    padding: 0 0.15rem;
  }
  .app-shell[data-view="domains"] .toolbar .muted {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .app-shell[data-view="domains"] .domain-list {
    gap: 0.45rem;
  }
  .app-shell[data-view="domains"] .domain-row {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem 0.65rem;
    padding: 0.7rem 0.75rem;
    border-radius: 13px;
  }
  .app-shell[data-view="domains"] .domain-identity {
    grid-column: 1;
  }
  .app-shell[data-view="domains"] .domain-identity h3 {
    font-size: 0.94rem;
  }
  .app-shell[data-view="domains"] .domain-row > .status {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .app-shell[data-view="domains"] .domain-fact {
    grid-column: auto;
    grid-row: 2;
    font-size: 0.72rem;
  }
  .app-shell[data-view="domains"] .domain-fact + .domain-fact {
    justify-self: end;
  }
  .app-shell[data-view="domains"] .domain-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    gap: 0.35rem;
    margin: 0;
    padding-top: 0.45rem;
    border-top: 1px solid #edf0f4;
  }
  .app-shell[data-view="domains"] .domain-actions:empty {
    display: none;
  }
  .app-shell[data-view="domains"] .domain-actions .button {
    min-height: 32px;
    width: auto;
    max-width: 100%;
    padding: 0.38rem 0.6rem;
    overflow: hidden;
    font-size: 0.7rem;
    text-overflow: ellipsis;
  }
  .app-shell[data-view="blocked"] .content {
    padding: 0.8rem;
    overflow-y: auto;
  }
  .blocked-senders-heading {
    flex-direction: column;
    align-items: start;
    gap: 0.7rem;
    margin-bottom: 0.75rem;
  }
  .blocked-senders-heading > .button {
    width: 100%;
  }
  .blocked-senders-heading h2 {
    font-size: 1.05rem;
  }
  .blocked-senders-heading p {
    font-size: 0.75rem;
    line-height: 1.45;
  }
  .blocked-sender-list {
    gap: 0.55rem;
  }
  .blocked-sender-row {
    grid-template-columns: 1fr auto;
    gap: 0.7rem;
    padding: 0.8rem;
  }
  .blocked-sender-stats {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }
  .blocked-sender-row > .button {
    grid-column: 2;
    grid-row: 1;
    min-height: 34px;
    padding: 0.4rem 0.65rem;
    font-size: 0.72rem;
  }
  .message-page {
    height: 100%;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .message-page .detail-toolbar {
    height: calc(68px + env(safe-area-inset-top, 0px));
    min-height: calc(68px + env(safe-area-inset-top, 0px));
    flex: 0 0 calc(68px + env(safe-area-inset-top, 0px));
    gap: 0.75rem;
    padding: env(safe-area-inset-top, 0px) 0.65rem 0;
  }
  .message-page .detail-toolbar .icon-button {
    width: 42px;
    height: 42px;
  }
  .message-page .detail-toolbar.has-detail-more {
    gap: 0.25rem;
    justify-content: flex-start;
  }
  .message-page .detail-toolbar.has-detail-more .detail-more-menu {
    margin-left: auto;
  }
  .message-page .detail-toolbar .detail-more-menu > summary {
    width: 42px;
    height: 42px;
  }
  .not-junk-button {
    min-height: 32px;
    margin-left: 0;
    padding: 0.35rem 0.68rem;
    font-size: 0.78rem;
  }
  .message-page .detail-header {
    padding: 1rem 0.9rem 0.65rem;
  }
  .detail-title-row {
    margin-bottom: 1rem;
  }
  .message-page .detail-title-row h3 {
    font-size: 1.2rem;
  }
  .detail-meta-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .message-page .detail-body {
    padding: 0.65rem 0.75rem 1rem;
    overflow-x: hidden;
    overflow-y: hidden;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
  }
  .message-page .mail-frame {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: auto;
  }
  .message-page .attachment-list {
    padding: 0 0.75rem 0.75rem;
  }
  .message-footer-actions {
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  }
  .address-card {
    position: fixed;
    top: 50%;
    left: 50%;
    width: calc(100vw - 2rem);
    transform: translate(-50%, -50%);
  }
  .compose-modal {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }
  .compose-modal .compose-body {
    padding-right: 0.9rem;
    padding-left: 0.9rem;
  }
  .compose-modal .compose-footer {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    top: auto;
    right: 1rem;
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
    left: 1rem;
    text-align: center;
  }
}

@keyframes mobile-pull-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Keep the desktop topbar and content origin identical across every view. */
@media (min-width: 701px) {
  .workspace .topbar {
    min-height: 60px;
    flex-basis: 60px;
    padding: 0.5rem 1rem;
  }
  .workspace .search input {
    padding-top: 0.48rem;
    padding-bottom: 0.48rem;
  }
  .message-page .detail-toolbar {
    height: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    gap: 0.55rem;
    padding: 0 0.85rem;
  }
  .message-page .detail-toolbar .icon-button {
    width: 32px;
    height: 32px;
  }
  .message-page .detail-toolbar .detail-more-menu > summary {
    width: 32px;
    height: 32px;
  }
  .toolbar-separator {
    height: 20px;
    margin-left: 0;
  }
  .message-page .detail-header {
    padding-top: 0.7rem;
    padding-bottom: 0.5rem;
  }
  .detail-title-row {
    margin-bottom: 0.5rem;
  }
  .message-address-details {
    margin-top: 0.1rem;
  }
  .detail-meta-row time {
    padding-top: 0;
  }
  .message-page .detail-body {
    padding-top: 0.35rem;
  }
  .app-shell[data-view="aliases"] .data-table th,
  .app-shell[data-view="aliases"] .data-table td {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
  .app-shell[data-view="aliases"] .desktop-management-actions {
    flex-wrap: nowrap;
    gap: 0.3rem;
    margin-top: 0;
  }
  .app-shell[data-view="aliases"] .desktop-management-actions .button {
    min-height: 34px;
    padding: 0.42rem 0.68rem;
  }
}

.password-visibility {
  display: none;
}

.modal header > .alias-delete-desktop-close {
  display: none;
}

/* Desktop navigation: quiet monochrome hierarchy with a compact active state. */
@media (min-width: 901px) {
  #password-dialog {
    width: min(540px, calc(100vw - 3rem));
    overflow: hidden;
    border: 1px solid rgba(32, 33, 36, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
      0 32px 90px rgba(15, 23, 42, 0.2),
      0 8px 24px rgba(15, 23, 42, 0.08);
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
    animation: password-dialog-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #password-dialog::backdrop {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(10px) saturate(0.85);
  }
  #password-dialog form {
    background: #fff;
  }
  #password-dialog header {
    align-items: flex-start;
    padding: 1.4rem 1.65rem 0.68rem;
    border-bottom: 0;
  }
  #password-dialog header h3 {
    color: #202124;
    font-size: 1.12rem;
    font-weight: 720;
    line-height: 1.18;
    letter-spacing: -0.018em;
  }
  #password-dialog header .muted {
    display: none;
  }
  #password-dialog header > .icon-button.close-dialog {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    margin: -0.25rem -0.25rem 0 0;
    border: 0;
    background: #f3f4f5;
    box-shadow: none;
  }
  #password-dialog header > .icon-button.close-dialog:hover {
    border-color: transparent;
    background: #e8eaed;
    box-shadow: none;
  }
  #password-dialog .modal-body {
    gap: 0.85rem;
    padding: 0.55rem 1.65rem 1.15rem;
    overflow: visible;
  }
  #password-dialog .modal-body label {
    position: relative;
    gap: 0.42rem;
    color: #42474d;
    font-size: 0.74rem;
    font-weight: 660;
    letter-spacing: 0.006em;
  }
  #password-dialog .modal-body input {
    min-height: 44px;
    padding: 0.68rem 3rem 0.68rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f5f6f7;
    color: #202124;
    font-size: 0.82rem;
    font-weight: 450;
    letter-spacing: 0.002em;
    box-shadow: inset 0 0 0 1px rgba(32, 33, 36, 0.035);
    transition:
      background 0.16s ease,
      border-color 0.16s ease,
      box-shadow 0.16s ease;
  }
  #password-dialog .modal-body input:hover {
    background: #f0f1f2;
  }
  #password-dialog .modal-body input:focus {
    border-color: #202124;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.08);
  }
  #password-dialog .password-visibility {
    position: absolute;
    right: 6px;
    bottom: 4px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: #5f6368;
    background: transparent;
    transition:
      color 0.15s ease,
      background 0.15s ease,
      transform 0.12s ease;
  }
  #password-dialog .password-visibility:hover {
    color: #202124;
    background: #e8eaed;
  }
  #password-dialog .password-visibility:active {
    transform: scale(0.94);
  }
  #password-dialog .password-visibility:focus-visible {
    outline: 2px solid rgba(32, 33, 36, 0.3);
    outline-offset: 1px;
  }
  #password-dialog .password-visibility svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  #password-dialog .password-visibility .eye-slash {
    display: none;
  }
  #password-dialog .password-visibility.is-revealed .eye-slash {
    display: block;
  }
  #password-dialog footer {
    padding: 0 1.65rem 1.35rem;
    border-top: 0;
    gap: 0.5rem;
    background: #fff;
  }
  #password-dialog footer .button {
    min-height: 40px;
    padding: 0.66rem 1rem;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.006em;
  }
  #password-dialog footer .button.ghost {
    border-color: transparent;
    background: #f3f4f5;
    color: #30343a;
  }
  #password-dialog footer .button.ghost:hover {
    background: #e8eaed;
  }
  #password-dialog footer .button.primary {
    background: #202124;
    box-shadow: 0 7px 18px rgba(32, 33, 36, 0.16);
  }
  #password-dialog footer .button.primary:hover {
    background: #090a0b;
    box-shadow: 0 9px 22px rgba(32, 33, 36, 0.2);
  }
  @keyframes password-dialog-enter {
    from {
      opacity: 0;
      transform: translateY(8px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    #password-dialog {
      animation: none;
    }
  }
  #alias-dialog {
    width: min(580px, calc(100vw - 3rem));
    overflow: hidden;
    border: 1px solid rgba(32, 33, 36, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
      0 32px 90px rgba(15, 23, 42, 0.2),
      0 8px 24px rgba(15, 23, 42, 0.08);
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
    animation: password-dialog-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #alias-dialog::backdrop {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(10px) saturate(0.85);
  }
  #alias-dialog form {
    background: #fff;
  }
  #alias-dialog header {
    align-items: flex-start;
    padding: 1.35rem 1.55rem 0.65rem;
    border-bottom: 0;
  }
  #alias-dialog header h3 {
    color: #202124;
    font-size: 1.12rem;
    font-weight: 720;
    line-height: 1.18;
    letter-spacing: -0.018em;
  }
  #alias-dialog header .muted {
    display: none;
  }
  #alias-dialog header > .icon-button.close-dialog {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    margin: -0.25rem -0.25rem 0 0;
    border: 0;
    background: #f3f4f5;
    box-shadow: none;
  }
  #alias-dialog header > .icon-button.close-dialog:hover {
    border-color: transparent;
    background: #e8eaed;
    box-shadow: none;
  }
  #alias-dialog .modal-body {
    gap: 0.78rem;
    max-height: calc(100vh - 170px);
    padding: 0.55rem 1.55rem 1.05rem;
    scrollbar-width: thin;
  }
  #alias-dialog .modal-body label {
    gap: 0.4rem;
    color: #42474d;
    font-size: 0.74rem;
    font-weight: 660;
    letter-spacing: 0.006em;
  }
  #alias-dialog .modal-body input:not([type="checkbox"]),
  #alias-dialog .modal-body textarea {
    min-height: 44px;
    padding: 0.68rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f5f6f7;
    color: #202124;
    font-size: 0.82rem;
    font-weight: 450;
    letter-spacing: 0.002em;
    box-shadow: inset 0 0 0 1px rgba(32, 33, 36, 0.035);
    transition:
      background 0.16s ease,
      border-color 0.16s ease,
      box-shadow 0.16s ease;
  }
  #alias-dialog .modal-body input::placeholder {
    color: transparent;
  }
  #alias-dialog .modal-body input:not([type="checkbox"]):hover,
  #alias-dialog .modal-body textarea:hover {
    background: #f0f1f2;
  }
  #alias-dialog .modal-body input:not([type="checkbox"]):focus,
  #alias-dialog .modal-body textarea:focus {
    border-color: #202124;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.08);
  }
  #alias-dialog .modal-body textarea {
    min-height: 64px;
    resize: vertical;
  }
  #alias-dialog .inline-input {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
  }
  #alias-dialog #generate-password {
    min-height: 44px;
    padding: 0.68rem 0.9rem;
    border-color: transparent;
    border-radius: 12px;
    background: #f3f4f5;
    color: #30343a;
    font-size: 0.76rem;
    font-weight: 620;
    box-shadow: none;
  }
  #alias-dialog #generate-password:hover {
    background: #e8eaed;
  }
  #alias-dialog .switch-row {
    flex-direction: row;
    align-items: center;
    gap: 0.52rem;
    min-height: 22px;
    color: #30343a;
    font-size: 0.78rem;
    font-weight: 560;
  }
  #alias-dialog .switch-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    accent-color: #202124;
    box-shadow: none;
  }
  #alias-dialog footer {
    padding: 0 1.55rem 1.35rem;
    border-top: 0;
    gap: 0.5rem;
    background: #fff;
  }
  #alias-dialog footer .button {
    min-height: 40px;
    padding: 0.66rem 1rem;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.006em;
  }
  #alias-dialog footer .button.ghost {
    border-color: transparent;
    background: #f3f4f5;
    color: #30343a;
  }
  #alias-dialog footer .button.ghost:hover {
    background: #e8eaed;
  }
  #alias-dialog footer .button.primary {
    background: #202124;
    box-shadow: 0 7px 18px rgba(32, 33, 36, 0.16);
  }
  #alias-dialog footer .button.primary:hover {
    background: #090a0b;
    box-shadow: 0 9px 22px rgba(32, 33, 36, 0.2);
  }
  @media (prefers-reduced-motion: reduce) {
    #alias-dialog {
      animation: none;
    }
  }
  #alias-password-dialog,
  #alias-name-dialog {
    overflow: hidden;
    border: 1px solid rgba(32, 33, 36, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
      0 32px 90px rgba(15, 23, 42, 0.2),
      0 8px 24px rgba(15, 23, 42, 0.08);
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
    animation: password-dialog-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #alias-password-dialog {
    width: min(540px, calc(100vw - 3rem));
  }
  #alias-name-dialog {
    width: min(500px, calc(100vw - 3rem));
  }
  #alias-password-dialog::backdrop,
  #alias-name-dialog::backdrop {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(10px) saturate(0.85);
  }
  #alias-password-dialog form,
  #alias-name-dialog form {
    background: #fff;
  }
  #alias-password-dialog header,
  #alias-name-dialog header {
    align-items: flex-start;
    padding: 1.35rem 1.55rem 0.72rem;
    border-bottom: 0;
  }
  #alias-password-dialog header h3,
  #alias-name-dialog header h3 {
    color: #202124;
    font-size: 1.08rem;
    font-weight: 720;
    line-height: 1.18;
    letter-spacing: -0.018em;
  }
  #alias-password-dialog header .muted,
  #alias-name-dialog header .muted {
    margin: 0.24rem 0 0;
    color: #6f747a;
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.002em;
  }
  #alias-password-dialog header > .icon-button.close-dialog,
  #alias-name-dialog header > .icon-button.close-dialog {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    margin: -0.25rem -0.25rem 0 0;
    border: 0;
    background: #f3f4f5;
    box-shadow: none;
  }
  #alias-password-dialog header > .icon-button.close-dialog:hover,
  #alias-name-dialog header > .icon-button.close-dialog:hover {
    border-color: transparent;
    background: #e8eaed;
    box-shadow: none;
  }
  #alias-password-dialog .modal-body,
  #alias-name-dialog .modal-body {
    gap: 0.82rem;
    padding: 0.55rem 1.55rem 1.08rem;
    overflow: visible;
  }
  #alias-password-dialog .modal-body label,
  #alias-name-dialog .modal-body label {
    gap: 0.4rem;
    color: #42474d;
    font-size: 0.74rem;
    font-weight: 660;
    letter-spacing: 0.006em;
  }
  #alias-password-dialog .modal-body input:not([type="hidden"]),
  #alias-name-dialog .modal-body input:not([type="hidden"]) {
    min-height: 44px;
    padding: 0.68rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f5f6f7;
    color: #202124;
    font-size: 0.82rem;
    font-weight: 450;
    letter-spacing: 0.002em;
    box-shadow: inset 0 0 0 1px rgba(32, 33, 36, 0.035);
    transition:
      background 0.16s ease,
      border-color 0.16s ease,
      box-shadow 0.16s ease;
  }
  #alias-name-dialog .modal-body input::placeholder {
    color: transparent;
  }
  #alias-password-dialog .modal-body input:not([type="hidden"]):hover,
  #alias-name-dialog .modal-body input:not([type="hidden"]):hover {
    background: #f0f1f2;
  }
  #alias-password-dialog .modal-body input:not([type="hidden"]):focus,
  #alias-name-dialog .modal-body input:not([type="hidden"]):focus {
    border-color: #202124;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.08);
  }
  #alias-password-dialog .inline-input {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
  }
  #alias-password-dialog #generate-reset-password {
    min-height: 44px;
    padding: 0.68rem 0.9rem;
    border-color: transparent;
    border-radius: 12px;
    background: #f3f4f5;
    color: #30343a;
    font-size: 0.76rem;
    font-weight: 620;
    box-shadow: none;
  }
  #alias-password-dialog #generate-reset-password:hover {
    background: #e8eaed;
  }
  #alias-password-dialog footer,
  #alias-name-dialog footer {
    padding: 0 1.55rem 1.35rem;
    border-top: 0;
    gap: 0.5rem;
    background: #fff;
  }
  #alias-password-dialog footer .button,
  #alias-name-dialog footer .button {
    min-height: 40px;
    padding: 0.66rem 1rem;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.006em;
  }
  #alias-password-dialog footer .button.ghost,
  #alias-name-dialog footer .button.ghost {
    border-color: transparent;
    background: #f3f4f5;
    color: #30343a;
  }
  #alias-password-dialog footer .button.ghost:hover,
  #alias-name-dialog footer .button.ghost:hover {
    background: #e8eaed;
  }
  #alias-password-dialog footer .button.primary,
  #alias-name-dialog footer .button.primary {
    background: #202124;
    box-shadow: 0 7px 18px rgba(32, 33, 36, 0.16);
  }
  #alias-password-dialog footer .button.primary:hover,
  #alias-name-dialog footer .button.primary:hover {
    background: #090a0b;
    box-shadow: 0 9px 22px rgba(32, 33, 36, 0.2);
  }
  @media (prefers-reduced-motion: reduce) {
    #alias-password-dialog,
    #alias-name-dialog {
      animation: none;
    }
  }
  #alias-delete-dialog {
    width: min(460px, calc(100vw - 3rem));
    overflow: hidden;
    border: 1px solid rgba(32, 33, 36, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
      0 32px 90px rgba(15, 23, 42, 0.2),
      0 8px 24px rgba(15, 23, 42, 0.08);
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
    animation: password-dialog-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #alias-delete-dialog::backdrop {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(10px) saturate(0.85);
  }
  #alias-delete-dialog form {
    background: #fff;
  }
  #alias-delete-dialog .confirm-modal-header {
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.55rem 0.72rem;
    border-bottom: 0;
  }
  #alias-delete-dialog .confirm-modal-icon,
  #alias-delete-dialog .confirm-modal-header .muted,
  #alias-delete-dialog .confirm-modal-body > p {
    display: none;
  }
  #alias-delete-dialog .alias-delete-desktop-close {
    display: grid;
  }
  #alias-delete-dialog .confirm-modal-header h3 {
    margin: 0;
    color: #202124;
    font-size: 1.08rem;
    font-weight: 720;
    line-height: 1.2;
    letter-spacing: -0.018em;
  }
  #alias-delete-dialog header > .icon-button.close-dialog {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    margin: -0.25rem -0.25rem 0 0;
    border: 0;
    background: #f3f4f5;
    box-shadow: none;
  }
  #alias-delete-dialog header > .icon-button.close-dialog:hover {
    border-color: transparent;
    background: #e8eaed;
    box-shadow: none;
  }
  #alias-delete-dialog .confirm-modal-body {
    padding: 0.58rem 1.55rem 1.15rem;
    overflow: visible;
  }
  #alias-delete-dialog .confirm-address {
    color: #202124;
    font-size: 0.9rem;
    font-weight: 660;
    line-height: 1.35;
    letter-spacing: -0.006em;
  }
  #alias-delete-dialog footer {
    padding: 0 1.55rem 1.35rem;
    border-top: 0;
    gap: 0.5rem;
    background: #fff;
  }
  #alias-delete-dialog footer .button {
    min-height: 40px;
    padding: 0.66rem 1rem;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.006em;
  }
  #alias-delete-dialog footer .button.ghost {
    border-color: transparent;
    background: #f3f4f5;
    color: #30343a;
  }
  #alias-delete-dialog footer .button.ghost:hover {
    background: #e8eaed;
  }
  #alias-delete-dialog footer .button.danger {
    background: #c5221f;
    box-shadow: 0 7px 18px rgba(197, 34, 31, 0.18);
  }
  #alias-delete-dialog footer .button.danger:hover {
    background: #a50e0e;
    box-shadow: 0 9px 22px rgba(197, 34, 31, 0.22);
  }
  @media (prefers-reduced-motion: reduce) {
    #alias-delete-dialog {
      animation: none;
    }
  }
  #blocked-sender-dialog {
    width: min(500px, calc(100vw - 3rem));
    overflow: hidden;
    border: 1px solid rgba(32, 33, 36, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
      0 32px 90px rgba(15, 23, 42, 0.2),
      0 8px 24px rgba(15, 23, 42, 0.08);
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
    animation: password-dialog-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #blocked-sender-dialog::backdrop,
  #action-confirm-dialog.desktop-compact-confirm::backdrop {
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(10px) saturate(0.85);
  }
  #blocked-sender-dialog form {
    background: #fff;
  }
  #blocked-sender-dialog header {
    align-items: flex-start;
    padding: 1.35rem 1.55rem 0.7rem;
    border-bottom: 0;
  }
  #blocked-sender-dialog header h3 {
    color: #202124;
    font-size: 1.08rem;
    font-weight: 720;
    line-height: 1.18;
    letter-spacing: -0.018em;
  }
  #blocked-sender-dialog header .muted,
  #blocked-sender-dialog .blocked-sender-scope {
    display: none;
  }
  #blocked-sender-dialog header > .icon-button.close-dialog {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    margin: -0.25rem -0.25rem 0 0;
    border: 0;
    background: #f3f4f5;
    box-shadow: none;
  }
  #blocked-sender-dialog header > .icon-button.close-dialog:hover {
    border-color: transparent;
    background: #e8eaed;
    box-shadow: none;
  }
  #blocked-sender-dialog .modal-body {
    gap: 0.75rem;
    padding: 0.58rem 1.55rem 1.08rem;
    overflow: visible;
  }
  #blocked-sender-dialog .modal-body label {
    gap: 0.4rem;
    color: #42474d;
    font-size: 0.74rem;
    font-weight: 660;
    letter-spacing: 0.006em;
  }
  #blocked-sender-dialog .modal-body input {
    min-height: 44px;
    padding: 0.68rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f5f6f7;
    color: #202124;
    font-size: 0.82rem;
    font-weight: 450;
    letter-spacing: 0.002em;
    box-shadow: inset 0 0 0 1px rgba(32, 33, 36, 0.035);
  }
  #blocked-sender-dialog .modal-body input::placeholder {
    color: transparent;
  }
  #blocked-sender-dialog .modal-body input:hover {
    background: #f0f1f2;
  }
  #blocked-sender-dialog .modal-body input:focus {
    border-color: #202124;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.08);
  }
  #blocked-sender-dialog footer {
    padding: 0 1.55rem 1.35rem;
    border-top: 0;
    gap: 0.5rem;
    background: #fff;
  }
  #blocked-sender-dialog footer .button {
    min-height: 40px;
    padding: 0.66rem 1rem;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 620;
    line-height: 1;
  }
  #blocked-sender-dialog footer .button.ghost {
    border-color: transparent;
    background: #f3f4f5;
    color: #30343a;
  }
  #blocked-sender-dialog footer .button.primary {
    background: #202124;
    box-shadow: 0 7px 18px rgba(32, 33, 36, 0.16);
  }
  #action-confirm-dialog.desktop-compact-confirm {
    width: min(440px, calc(100vw - 3rem));
    overflow: hidden;
    border: 1px solid rgba(32, 33, 36, 0.08);
    border-radius: 22px;
    background: #fff;
    box-shadow:
      0 32px 90px rgba(15, 23, 42, 0.2),
      0 8px 24px rgba(15, 23, 42, 0.08);
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    animation: password-dialog-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  #action-confirm-dialog.desktop-compact-confirm .confirm-modal-header {
    padding: 1.35rem 1.55rem 0.72rem;
    border-bottom: 0;
  }
  #action-confirm-dialog.desktop-compact-confirm .confirm-modal-icon,
  #action-confirm-dialog.desktop-compact-confirm .confirm-modal-header .muted,
  #action-confirm-dialog.desktop-compact-confirm .confirm-modal-body {
    display: none;
  }
  #action-confirm-dialog.desktop-compact-confirm .confirm-modal-header h3 {
    margin: 0;
    color: #202124;
    font-size: 1.08rem;
    font-weight: 720;
    line-height: 1.2;
    letter-spacing: -0.018em;
  }
  #action-confirm-dialog.desktop-compact-confirm.desktop-keep-subtitle .confirm-modal-header .muted {
    display: block;
    margin: 0.24rem 0 0;
    color: #6f747a;
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.002em;
  }
  #action-confirm-dialog.desktop-compact-confirm footer {
    padding: 0.45rem 1.55rem 1.35rem;
    border-top: 0;
    gap: 0.5rem;
    background: #fff;
  }
  #action-confirm-dialog.desktop-compact-confirm footer .button {
    min-height: 40px;
    padding: 0.66rem 1rem;
    border-radius: 11px;
    font-size: 0.78rem;
    font-weight: 620;
    line-height: 1;
  }
  #action-confirm-dialog.desktop-compact-confirm footer .button.ghost {
    border-color: transparent;
    background: #f3f4f5;
    color: #30343a;
  }
  #action-confirm-dialog.desktop-compact-confirm footer .button.danger {
    background: #c5221f;
    box-shadow: 0 7px 18px rgba(197, 34, 31, 0.18);
  }
  @media (prefers-reduced-motion: reduce) {
    #blocked-sender-dialog,
    #action-confirm-dialog.desktop-compact-confirm {
      animation: none;
    }
  }
  .app-shell[data-view="blocked"] .content {
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
  }
  .app-shell[data-view="blocked"] .blocked-senders-heading h2 {
    color: #202124;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
  }
  .app-shell[data-view="blocked"] .blocked-senders-heading p {
    color: #555b62;
    font-size: 0.8rem;
    font-weight: 480;
    line-height: 1.45;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="blocked"] .blocked-senders-heading > .button {
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.004em;
  }
  .app-shell[data-view="blocked"] .blocked-sender-identity strong {
    color: #202124;
    font-size: 0.86rem;
    font-weight: 680;
    line-height: 1.2;
    letter-spacing: -0.008em;
  }
  .app-shell[data-view="blocked"] .blocked-sender-identity small {
    color: #70757b;
    font-size: 0.66rem;
    font-weight: 450;
    line-height: 1.3;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="blocked"] .blocked-sender-stats {
    color: #62686f;
    font-size: 0.7rem;
    font-weight: 450;
    letter-spacing: 0.004em;
  }
  .app-shell[data-view="blocked"] .blocked-sender-stats strong {
    color: #30353b;
    font-weight: 650;
    letter-spacing: 0;
  }
  .app-shell[data-view="blocked"] .blocked-sender-row > .button {
    color: #353a40;
    font-size: 0.74rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.008em;
  }
  .app-shell[data-view="aliases"] .content {
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
  }
  .app-shell[data-view="aliases"] .alias-toolbar .muted {
    color: #555b62;
    font-size: 0.8rem;
    font-weight: 480;
    line-height: 1.45;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="aliases"] .alias-search {
    color: #34383d;
    font-size: 0.8rem;
    font-weight: 450;
    letter-spacing: 0.002em;
  }
  .app-shell[data-view="aliases"] .alias-toolbar-actions .button {
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.004em;
  }
  .app-shell[data-view="aliases"] .data-table th {
    color: #62686f;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.025em;
  }
  .app-shell[data-view="aliases"] .alias-identity strong {
    color: #202124;
    font-size: 0.82rem;
    font-weight: 680;
    line-height: 1.2;
    letter-spacing: -0.008em;
  }
  .app-shell[data-view="aliases"] .alias-identity small {
    color: #70757b;
    font-size: 0.66rem;
    font-weight: 450;
    line-height: 1.3;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="aliases"] .alias-permission .status,
  .app-shell[data-view="aliases"] .alias-state .status {
    font-size: 0.68rem;
    font-weight: 680;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="aliases"] .alias-note {
    color: #353a40;
    font-size: 0.73rem;
    font-weight: 450;
    letter-spacing: 0.004em;
  }
  .app-shell[data-view="aliases"] .desktop-management-actions .button {
    color: #353a40;
    font-size: 0.71rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.008em;
  }
  .app-shell[data-view="aliases"] .desktop-management-actions .danger-ghost {
    color: #c5221f;
  }
  .app-shell[data-view="domains"] .content {
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-kerning: normal;
  }
  .app-shell[data-view="domains"] .toolbar .muted {
    color: #555b62;
    font-size: 0.8rem;
    font-weight: 480;
    line-height: 1.45;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="domains"] .domain-identity h3 {
    color: #202124;
    font-size: 0.9rem;
    font-weight: 680;
    line-height: 1.2;
    letter-spacing: -0.012em;
  }
  .app-shell[data-view="domains"] .domain-identity .muted {
    color: #70757b;
    font-size: 0.66rem;
    font-weight: 450;
    line-height: 1.3;
    letter-spacing: 0.008em;
  }
  .app-shell[data-view="domains"] .domain-fact {
    color: #4f555b;
    font-size: 0.73rem;
    font-weight: 450;
    letter-spacing: 0.004em;
  }
  .app-shell[data-view="domains"] .domain-fact strong {
    color: #2f3337;
    font-weight: 650;
    letter-spacing: 0;
  }
  .app-shell[data-view="domains"] .domain-row > .status {
    font-size: 0.68rem;
    font-weight: 680;
    letter-spacing: 0.006em;
  }
  .app-shell[data-view="domains"] .domain-actions .button {
    color: #353a40;
    font-size: 0.71rem;
    font-weight: 620;
    line-height: 1;
    letter-spacing: 0.008em;
  }
  .sidebar .brand {
    width: 100%;
    min-height: 54px;
    margin: 0 0 0.75rem;
    padding: 0.42rem 0.55rem;
    gap: 0.62rem;
    border: 1px solid rgba(32, 33, 36, 0.075);
    border-radius: 15px;
    background: linear-gradient(145deg, #fff 0%, #fafafa 100%);
    box-shadow:
      0 3px 12px rgba(32, 33, 36, 0.055),
      0 1px 2px rgba(32, 33, 36, 0.04);
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -0.015em;
  }
  .sidebar .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: 0 3px 9px rgba(17, 24, 39, 0.13);
  }
  .sidebar .compose {
    min-height: 48px;
    margin: 0.2rem 0 1rem 0.25rem;
    padding: 0.72rem 1.05rem;
    border-color: rgba(32, 33, 36, 0.17);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #fbfbfb 100%) !important;
    box-shadow:
      0 3px 10px rgba(32, 33, 36, 0.07),
      0 1px 2px rgba(32, 33, 36, 0.06) !important;
    font-size: 0.92rem;
    font-weight: 750;
    letter-spacing: 0.005em;
    word-spacing: 0.12em;
    transition:
      border-color 140ms ease,
      box-shadow 140ms ease,
      transform 100ms ease;
  }
  .sidebar .compose:hover {
    border-color: rgba(32, 33, 36, 0.3);
    background: #fff !important;
    box-shadow:
      0 5px 14px rgba(32, 33, 36, 0.09),
      0 1px 2px rgba(32, 33, 36, 0.06) !important;
  }
  .sidebar .compose:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(32, 33, 36, 0.1) !important;
  }
  .sidebar .nav {
    gap: 0.12rem;
  }
  .sidebar .nav button {
    position: relative;
    min-height: 38px;
    padding: 0.5rem 0.78rem 0.5rem 1rem;
    border-radius: 10px;
    color: #4f5358;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.005em;
    transition:
      background-color 140ms ease,
      color 140ms ease,
      box-shadow 140ms ease;
  }
  .sidebar .nav button:hover {
    background: rgba(32, 33, 36, 0.045);
    color: #202124;
  }
  .sidebar .nav button.active {
    background: #fff;
    color: #161719;
    font-weight: 700;
    box-shadow:
      0 1px 2px rgba(32, 33, 36, 0.08),
      inset 0 0 0 1px rgba(32, 33, 36, 0.075);
  }
  .sidebar .nav button.active::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.5rem;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #202124;
    transform: translateY(-50%);
  }
  .sidebar .admin-nav {
    gap: 0.12rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top-color: rgba(32, 33, 36, 0.11);
  }
  .sidebar .admin-nav small {
    padding: 0.08rem 1rem 0.34rem;
    color: #8a9098;
    font-weight: 700;
    letter-spacing: 0.14em;
  }

  /* Merge the desktop brand and account controls into one compact top card. */
  .sidebar > .brand {
    display: none;
  }
  .sidebar > .account-card {
    order: -1;
    z-index: 35;
    width: calc(100% - 1.1rem);
    margin: 0 0 0.72rem -0.8rem;
    padding: 0;
    border: 0;
  }
  .sidebar > .account-card .account-menu-trigger {
    display: flex;
    width: 100%;
    min-height: 54px;
    align-items: center;
    gap: 0.62rem;
    padding: 0.42rem 0.55rem;
    border: 1px solid rgba(32, 33, 36, 0.085);
    border-radius: 0 18px 18px 0;
    background: linear-gradient(145deg, #fff 0%, #fbfbfa 100%);
    box-shadow:
      0 3px 11px rgba(32, 33, 36, 0.055),
      0 1px 2px rgba(32, 33, 36, 0.035),
      inset 0 1px 0 rgba(255, 255, 255, 0.92);
    transition:
      border-color 130ms ease,
      box-shadow 130ms ease;
  }
  .sidebar > .account-card .account-menu-trigger:hover,
  .sidebar > .account-card .account-menu-trigger[aria-expanded="true"] {
    border-color: rgba(32, 33, 36, 0.16);
    background: linear-gradient(145deg, #fff 0%, #fbfbfa 100%);
    box-shadow:
      0 5px 14px rgba(32, 33, 36, 0.07),
      0 1px 2px rgba(32, 33, 36, 0.04),
      inset 0 1px 0 rgba(255, 255, 255, 0.94);
  }
  .sidebar > .account-card .account-menu-trigger[aria-expanded="true"] {
    border-bottom-right-radius: 0;
  }
  .sidebar > .account-card .avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    overflow: hidden;
    padding: 0;
    border-radius: 9px;
    background: #fff url("/yanse-mail-icon-512.png") center / cover no-repeat;
    color: transparent;
    font-size: 0;
    box-shadow: 0 2px 8px rgba(17, 24, 39, 0.12);
  }
  .sidebar > .account-card .account-copy {
    min-width: 0;
    flex: 1;
  }
  .sidebar > .account-card .account-copy strong {
    display: none;
  }
  .sidebar > .account-card .account-copy small {
    display: block;
    max-width: none;
    margin: 0;
    overflow: hidden;
    color: #303338;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.005em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sidebar > .account-card .account-menu-chevron {
    position: relative;
    display: grid;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    place-items: center;
    margin-left: auto;
    color: transparent;
    font-size: 0;
  }
  .sidebar > .account-card .account-menu-chevron::before {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid #72767c;
    border-bottom: 1.5px solid #72767c;
    transform: translateY(-1px) rotate(45deg);
  }
  .sidebar > .account-card .account-menu {
    top: calc(100% - 1px);
    right: 0;
    bottom: auto;
    left: 0;
    padding: 0.35rem;
    border-color: rgba(32, 33, 36, 0.11);
    border-radius: 0 0 18px 0;
    box-shadow: 0 10px 26px rgba(32, 33, 36, 0.13);
  }
  .sidebar > .account-card .account-menu button {
    min-height: 36px;
    padding: 0.45rem 0.62rem;
    border-radius: 8px;
    color: #34373b;
    font-size: 0.76rem;
    font-weight: 600;
  }
  .sidebar > .account-card .account-menu button:last-child {
    color: #a32620;
  }
}

/* The icon navigation is desktop-only; compact and mobile layouts keep their existing UI. */
.desktop-nav-icon,
.desktop-mail-nav-label,
.desktop-compose-mark,
.desktop-compose-label,
.desktop-search-icon {
  display: none;
}

@media (min-width: 901px) {
  .sidebar .desktop-mail-nav-label {
    display: block;
    padding: 0.15rem 0.72rem 0.38rem;
    color: #8a8e94;
    font-size: 0.57rem;
    font-weight: 760;
    letter-spacing: 0.16em;
  }
  .sidebar .nav {
    gap: 0.1rem;
  }
  .sidebar .nav button {
    min-height: 38px;
    padding: 0.42rem 0.62rem;
    border-radius: 10px;
    color: #55595f;
    font-size: 0.84rem;
    font-weight: 510;
  }
  .sidebar .desktop-nav-entry {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.68rem;
  }
  .sidebar .desktop-nav-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
    opacity: 0.82;
    transition:
      opacity 130ms ease,
      transform 130ms ease;
  }
  .sidebar .nav button:hover .desktop-nav-icon {
    opacity: 1;
    transform: translateX(1px);
  }
  .sidebar .nav button.active {
    background: #e8e8e4;
    color: #17181a;
    font-weight: 650;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.72),
      0 1px 2px rgba(32, 33, 36, 0.035);
  }
  .sidebar .nav button.active::before {
    content: none;
  }
  .sidebar .nav button.active .desktop-nav-icon {
    stroke-width: 2;
    opacity: 1;
  }
  .sidebar .nav button b {
    display: grid;
    min-width: 21px;
    height: 20px;
    place-items: center;
    padding: 0 0.38rem;
    border-radius: 10px;
    background: #202124;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 650;
  }
  .sidebar .nav button b:empty {
    display: none;
  }
  .sidebar .admin-nav {
    gap: 0.1rem;
    margin-top: 0.68rem;
    padding-top: 0.68rem;
  }
  .sidebar .admin-nav small {
    padding: 0.15rem 0.72rem 0.38rem;
    color: #8a8e94;
    font-size: 0.57rem;
    font-weight: 760;
    letter-spacing: 0.16em;
  }
  .sidebar > .compose-dock {
    order: 5;
    width: 100%;
    margin-top: auto;
    padding-top: 0.62rem;
    border-top: 1px solid rgba(32, 33, 36, 0.1);
  }
  .sidebar > .compose-dock .compose {
    display: flex;
    width: auto;
    min-height: 38px;
    align-items: center;
    justify-content: flex-start;
    gap: 0.58rem;
    margin: 0;
    padding: 0.24rem 0.45rem;
    border: 0;
    border-radius: 10px;
    background: transparent !important;
    color: #202124 !important;
    box-shadow: none !important;
    font-size: 0.84rem;
    font-weight: 650;
  }
  .sidebar > .compose-dock .compose:hover {
    border: 0;
    background: rgba(32, 33, 36, 0.05) !important;
    box-shadow: none !important;
  }
  .sidebar > .compose-dock .desktop-compose-mark {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(145deg, #303236 0%, #17181a 100%);
    color: #fff;
    box-shadow: 0 2px 5px rgba(17, 24, 39, 0.18);
  }
  .sidebar > .compose-dock .desktop-compose-mark svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
  }
  .sidebar > .compose-dock .desktop-compose-label {
    display: inline;
  }
  .sidebar > .compose-dock .default-compose-label {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar > .compose-dock {
    display: contents;
  }
  .sidebar .compose .desktop-compose-mark,
  .sidebar .compose .desktop-compose-label {
    display: none !important;
  }
}

@media (min-width: 901px) {
  .toast,
  .toast[popover] {
    top: 1.2rem;
    right: 1.5rem;
    max-width: min(360px, calc(100vw - 3rem));
    min-height: 22px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #4f555b;
    box-shadow: none;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.01em;
    transform: translateY(-5px);
    transition:
      opacity 160ms ease,
      transform 160ms ease;
  }
  .toast::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #22a65a;
    box-shadow: 0 0 0 3px rgba(34, 166, 90, 0.1);
  }
  .toast.show {
    transform: none;
  }
  .toast.error,
  .toast.error[popover] {
    background: transparent;
    color: #a12b24;
  }
  .toast.error::before {
    background: #d33b32;
    box-shadow: 0 0 0 3px rgba(211, 59, 50, 0.1);
  }
  .workspace .message-page .detail-toolbar {
    height: 48px;
    min-height: 48px;
    flex: 0 0 48px;
    gap: 2px;
    padding: 0 1rem;
    color: #555b61;
  }
  .workspace .message-page .detail-toolbar .icon-button {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    color: inherit;
    transition:
      background-color 120ms ease,
      color 120ms ease,
      transform 90ms ease;
  }
  .workspace .message-page .detail-toolbar .icon-button:hover {
    background: #f0f1f2;
    color: #202124;
  }
  .workspace .message-page .detail-toolbar .icon-button:active {
    transform: scale(0.92);
  }
  .workspace .message-page .detail-toolbar .toolbar-svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.7;
  }
  .workspace .message-page .detail-toolbar .trash-icon {
    width: 16px;
    height: 16px;
  }
  .workspace .message-page .detail-toolbar .detail-back {
    margin-right: 0.15rem;
    font-size: 1.35rem;
    line-height: 1;
  }
  .workspace .message-page .detail-toolbar .toolbar-separator {
    height: 18px;
    margin: 0 0.25rem 0 0.1rem;
    background: #e4e7ea;
  }
  .workspace .message-page .detail-toolbar-star,
  .workspace .message-page .detail-toolbar-star.active {
    color: #a6abb1 !important;
    font-size: 1.08rem;
  }
  .workspace .message-page .detail-toolbar-star:hover,
  .workspace .message-page .detail-toolbar-star.active:hover {
    color: #6f747a !important;
  }
  .workspace .message-page .detail-translate.active {
    background: #f0f1f2;
    color: #202124 !important;
  }
  .workspace .message-page .detail-more-menu {
    display: flex;
    align-items: center;
  }
  .workspace .message-page .detail-more-menu > summary {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #60656b;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.06em;
    transition:
      background-color 120ms ease,
      color 120ms ease,
      transform 90ms ease;
  }
  .workspace .message-page .detail-more-menu > summary span {
    display: block;
    transform: translateY(-2px);
  }
  .workspace .message-page .detail-more-menu > summary:hover,
  .workspace .message-page .detail-more-menu[open] > summary {
    background: #f0f1f2;
    color: #202124;
  }
  .workspace .message-page .detail-more-menu > summary:active {
    transform: scale(0.92);
  }
  .workspace .message-page .detail-more-popover {
    top: calc(100% + 4px);
    right: 0;
    min-width: 78px;
    padding: 3px;
    border-color: rgba(32, 33, 36, 0.13);
    border-radius: 9px;
    box-shadow:
      0 7px 18px rgba(32, 33, 36, 0.13),
      0 1px 3px rgba(32, 33, 36, 0.07);
  }
  .workspace .message-page .detail-more-popover button {
    width: 100%;
    min-width: 72px;
    min-height: 30px;
    padding: 0.32rem 0.7rem;
    border-radius: 6px;
    color: #303338;
    font-size: 0.74rem;
    font-weight: 650;
    letter-spacing: 0.02em;
  }
  .workspace .message-page .detail-more-popover button:hover {
    background: #f3f4f5;
  }
  .workspace .message-page {
    font-family:
      -apple-system,
      BlinkMacSystemFont,
      "SF Pro Text",
      "Segoe UI",
      "Helvetica Neue",
      "PingFang SC",
      "Microsoft YaHei",
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  .workspace .message-page .detail-header {
    padding: 0.75rem 1rem 0.65rem;
  }
  .workspace .message-page .detail-title-row {
    gap: 0.45rem;
    padding-left: 50px;
    margin-bottom: 0.55rem;
  }
  .workspace .message-page .detail-title-row h3 {
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.012em;
  }
  .workspace .message-page .mailbox-tag {
    padding: 0.1rem 0.36rem;
    font-size: 0.62rem;
  }
  .workspace .message-page .detail-meta-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 0.6rem;
  }
  .workspace .message-page .detail-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.82rem;
  }
  .workspace .message-page .detail-sender-line {
    font-size: 0.78rem;
    line-height: 1.35;
  }
  .workspace .message-page .detail-sender-email {
    font-size: 0.7rem;
  }
  .workspace .message-page .message-address-details {
    margin-top: 0.08rem;
    font-size: 0.68rem;
    line-height: 1.35;
  }
  .workspace .message-page .detail-meta-row time {
    padding-top: 0.08rem;
    font-size: 0.66rem;
  }
  .workspace .message-page .detail-body {
    display: block;
    padding: 0.75rem 1rem 1rem;
    background: #fff;
    overflow-anchor: none;
  }
  .workspace .message-page .mail-frame {
    width: 100%;
    max-width: none;
    margin: 0;
    flex: 0 0 auto;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .workspace .message-page .attachment-list {
    width: 100%;
    margin: 0;
    padding: 0 1rem 0.65rem;
  }
  .workspace .message-page .message-footer-actions {
    gap: 0.45rem;
    padding: 0.65rem 1rem;
    box-shadow: none;
  }
  .workspace .message-page .gmail-action-pill {
    min-width: 0;
    min-height: 34px;
    gap: 0.38rem;
    padding: 0.42rem 0.72rem;
    border-color: #d6dadd;
    border-radius: 9px;
    font-size: 0.72rem;
    font-weight: 500;
  }
  .workspace .message-page .gmail-action-pill .action-svg {
    width: 14px;
    height: 14px;
  }
  .workspace .topbar {
    justify-content: flex-start;
    padding: 0.5rem 1rem 0.5rem calc(1rem + 0.3cm);
  }
  .workspace .search {
    width: min(620px, 54vw);
    min-width: 0;
    height: 36px;
    box-sizing: border-box;
    gap: 0.65rem;
    padding: 0 0.35rem 0 0.85rem;
    border-color: rgba(32, 33, 36, 0.18);
    border-radius: 11px;
  }
  .workspace .search-field {
    height: 100%;
    gap: 0.65rem;
    color: #2f3236;
    font-size: inherit;
    font-weight: 400;
  }
  .workspace .default-search-icon {
    display: none;
  }
  .workspace .desktop-search-icon {
    display: block;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: none;
    stroke: #555;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }
  .workspace .search input {
    width: auto;
    height: 100%;
    margin: 0;
    padding: 0;
    color: #2f3236;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1;
  }
  .workspace .search-clear {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
  }
  .workspace .search-clear > span {
    font-size: 1.12rem;
    font-weight: 400;
    transform: none;
  }
  .workspace .topbar-refresh {
    display: none;
  }

  /* Desktop mail list mirrors the approved compact preview; mobile stays unchanged. */
  .workspace .gmail-shell {
    border-radius: 15px;
    box-shadow: 0 1px 2px rgba(32, 33, 36, 0.07);
  }
  .workspace .list-toolbar {
    min-height: 48px;
    gap: 0.35rem;
    padding: 0 1rem;
    border-bottom-color: #eceff2;
    color: #65696f;
  }
  .workspace .list-toolbar #list-refresh {
    width: 32px;
    height: 32px;
    display: grid;
    flex: 0 0 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
  }
  .workspace .list-toolbar #list-refresh:hover,
  .workspace .list-toolbar #list-refresh.is-refreshing {
    background: #f0f1f2;
    color: #202124;
  }
  .workspace .list-refresh-icon {
    width: 17px;
    height: 17px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }
  .workspace #list-refresh.is-refreshing .list-refresh-icon {
    animation: desktop-list-refresh-spin 540ms cubic-bezier(0.4, 0, 0.2, 1);
  }
  .workspace .list-toolbar .toolbar-select {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border-color: #aeb4bb;
  }
  .workspace .batch-actions {
    gap: 0;
    margin-left: -2px;
  }
  .workspace .batch-actions .toolbar-action.icon-button {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
  }
  .workspace .batch-actions .toolbar-svg {
    width: 17px;
    height: 17px;
  }
  .workspace .batch-actions .trash-icon {
    width: 16px;
    height: 16px;
  }
  .workspace .batch-actions #selected-count {
    margin-left: 0.25rem;
    padding-right: 0.2rem;
    color: #62676d;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
  }
  .workspace .list-pagination {
    height: 32px;
    gap: 2px;
    font-size: 0.7rem;
    color: #62676d;
    font-variant-numeric: tabular-nums;
  }
  .workspace .list-pagination span {
    margin-right: 0.35rem;
  }
  .workspace .list-pagination .page-button {
    position: relative;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #555b61;
    font-size: 0;
    transition:
      border-color 120ms ease,
      background-color 120ms ease,
      color 120ms ease,
      transform 90ms ease;
  }
  .workspace .list-pagination .page-button::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform-origin: center;
  }
  .workspace .list-pagination #page-previous::before {
    transform: translate(-50%, -50%) rotate(-135deg);
  }
  .workspace .list-pagination #page-next::before {
    transform: translate(-50%, -50%) rotate(45deg);
  }
  .workspace .list-pagination .page-button:hover:not(:disabled) {
    border-color: #e1e4e7;
    background: #f3f4f5;
    color: #202124;
  }
  .workspace .list-pagination .page-button:active:not(:disabled) {
    transform: scale(0.92);
  }
  .workspace .list-pagination .page-button:focus-visible {
    outline: 2px solid rgba(32, 33, 36, 0.18);
    outline-offset: 1px;
  }
  .workspace .list-pagination .page-button:disabled {
    color: #c2c6ca;
    opacity: 1;
  }
  .workspace .gmail-row {
    grid-template-columns: 24px 24px 150px 145px minmax(0, 1fr) 58px;
    gap: 0.4rem;
    min-height: 43px;
    padding: 0 1rem;
    border-bottom-color: #edf0f3;
    background: #fff;
    color: #45484d;
    font-size: 0.78rem;
    font-weight: 400;
  }
  .workspace .gmail-row.admin-mailbox-row {
    grid-template-columns: 24px 24px 150px 145px minmax(0, 1fr) 96px;
  }
  .workspace .gmail-row:hover {
    box-shadow: 0 1px 5px rgba(32, 33, 36, 0.13);
  }
  .workspace .gmail-row.unread {
    background: #f1f5fb;
    color: #25272a;
    font-weight: 620;
  }
  .workspace .gmail-row.selected {
    background: #e6e8ea;
  }
  .workspace .gmail-row .select-box {
    width: 36px;
    height: 43px;
    justify-self: start;
    margin-left: -6px;
  }
  .workspace .gmail-row .select-box::before {
    top: 50%;
    left: 6px;
    width: 14px;
    height: 14px;
    border-color: #aeb4bb;
    transform: translateY(-50%);
  }
  .workspace .gmail-row .select-box .selection-mark {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 6px;
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-50%);
  }
  .workspace .gmail-row .star,
  .workspace .gmail-row .star.active {
    color: #a6abb1;
  }
  .workspace .gmail-row .star:hover {
    color: #6f747a;
  }
  .workspace .gmail-row .sender,
  .workspace .gmail-row .mail-subject-line strong,
  .workspace .gmail-row .mail-preview {
    color: inherit;
    font-weight: 400;
  }
  .workspace .gmail-row.unread .sender,
  .workspace .gmail-row.unread .mail-subject-line strong,
  .workspace .gmail-row.unread .mail-preview {
    color: inherit;
    font-weight: 620;
  }
  .workspace .gmail-row .recipient-chip {
    max-width: 130px;
    padding: 0.15rem 0.48rem;
    border-radius: 10px;
    background: #eceff2;
    font-size: 0.62rem;
  }
  .workspace .gmail-row .mail-line {
    font-size: inherit;
  }
  .workspace .gmail-row time,
  .workspace .gmail-row:not(.unread) time {
    color: #6f747a;
    font-size: 0.68rem;
    font-weight: 400;
  }
  .workspace .gmail-row.unread time {
    color: #6f747a;
    font-weight: 620;
  }
}

@keyframes desktop-list-refresh-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/*
 * Real dark theme for the desktop headquarters account only.
 * Every rule is scoped to the runtime class so the existing white theme remains byte-for-byte
 * unchanged visually. Message iframe contents are deliberately excluded and stay sender-owned.
 */
@media (min-width: 901px) {
  html.desktop-dark-mode {
    --bg: #111315;
    --surface: #1a1c20;
    --surface-2: #202328;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --line: #30343a;
    --primary: #e8eaed;
    --primary-dark: #fff;
    --compose: #1a1c20;
    --teal: #e8eaed;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    background: #111315;
  }

  html.desktop-dark-mode body,
  html.desktop-dark-mode .app-shell,
  html.desktop-dark-mode .workspace,
  html.desktop-dark-mode .content {
    background: #111315;
    color: #e8eaed;
  }

  html.desktop-dark-mode .sidebar,
  html.desktop-dark-mode .topbar {
    background: #15171a;
    color: #e8eaed;
  }

  html.desktop-dark-mode .sidebar {
    border-right-color: #292d32;
  }

  html.desktop-dark-mode .sidebar > .account-card .account-menu-trigger,
  html.desktop-dark-mode .sidebar > .account-card .account-menu-trigger:hover,
  html.desktop-dark-mode .sidebar > .account-card .account-menu-trigger[aria-expanded="true"] {
    border-color: #34383e;
    background: linear-gradient(145deg, #22252a 0%, #1b1d21 100%);
    box-shadow:
      0 5px 16px rgba(0, 0, 0, 0.26),
      inset 0 1px 0 rgba(255, 255, 255, 0.035);
  }

  html.desktop-dark-mode .sidebar > .account-card .account-copy small {
    color: #e8eaed;
  }

  html.desktop-dark-mode .sidebar > .account-card .account-menu-chevron::before {
    border-color: #aeb4bb;
  }

  html.desktop-dark-mode .sidebar > .account-card .account-menu {
    border-color: #34383e;
    background: #202328;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
  }

  html.desktop-dark-mode .sidebar > .account-card .account-menu button,
  html.desktop-dark-mode .account-language-item {
    color: #e2e5e9;
  }

  html.desktop-dark-mode .sidebar > .account-card .account-menu button:hover {
    background: #2b2f35;
  }

  html.desktop-dark-mode .sidebar > .account-card .account-menu button:last-child {
    color: #ff8a80;
  }

  html.desktop-dark-mode .desktop-dark-mode-switch {
    border-color: #575d65;
    background: #35393f;
  }

  html.desktop-dark-mode .desktop-dark-mode-control[aria-checked="true"] .desktop-dark-mode-switch {
    border-color: #d8dce1;
    background: #d8dce1;
  }

  html.desktop-dark-mode .desktop-dark-mode-control[aria-checked="true"] .desktop-dark-mode-switch span {
    background: #17191c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  }

  html.desktop-dark-mode .sidebar .desktop-mail-nav-label,
  html.desktop-dark-mode .sidebar .admin-nav small {
    color: #777d85;
  }

  html.desktop-dark-mode .sidebar .nav button {
    color: #aeb4bb;
  }

  html.desktop-dark-mode .sidebar .nav button:hover {
    background: #22252a;
    color: #f1f3f4;
  }

  html.desktop-dark-mode .sidebar .nav button.active {
    background: #2a2e33;
    color: #fff;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 1px 2px rgba(0, 0, 0, 0.2);
  }

  html.desktop-dark-mode .sidebar .nav button b {
    background: #e8eaed;
    color: #202124;
  }

  html.desktop-dark-mode .sidebar .admin-nav,
  html.desktop-dark-mode .sidebar > .compose-dock {
    border-color: #2c3035;
  }

  html.desktop-dark-mode .sidebar > .compose-dock .compose {
    color: #e8eaed !important;
  }

  html.desktop-dark-mode .sidebar > .compose-dock .compose:hover {
    background: #22252a !important;
  }

  html.desktop-dark-mode .sidebar > .compose-dock .desktop-compose-mark {
    background: linear-gradient(145deg, #f1f3f4 0%, #c8cdd3 100%);
    color: #17191c;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35);
  }

  html.desktop-dark-mode .workspace .search,
  html.desktop-dark-mode .alias-search {
    border-color: #3a3f46;
    background: #1d2024;
    box-shadow: none;
  }

  html.desktop-dark-mode .workspace .search:focus-within,
  html.desktop-dark-mode .alias-search:focus {
    border-color: #6f767f;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
  }

  html.desktop-dark-mode .workspace .search-field,
  html.desktop-dark-mode .workspace .search input,
  html.desktop-dark-mode .workspace .desktop-search-icon,
  html.desktop-dark-mode .search-clear > span {
    color: #dfe3e7;
    stroke: #aeb4bb;
  }

  html.desktop-dark-mode input::placeholder,
  html.desktop-dark-mode textarea::placeholder {
    color: #777d85;
  }

  html.desktop-dark-mode .workspace .gmail-shell,
  html.desktop-dark-mode .message-page {
    background: #191b1f;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }

  html.desktop-dark-mode .workspace .list-toolbar,
  html.desktop-dark-mode .workspace .message-page .detail-toolbar,
  html.desktop-dark-mode .workspace .message-page .detail-header,
  html.desktop-dark-mode .workspace .message-page .message-footer-actions {
    border-color: #2d3136;
    background: #191b1f;
    color: #aeb4bb;
  }

  html.desktop-dark-mode .workspace .list-toolbar #list-refresh:hover,
  html.desktop-dark-mode .workspace .list-toolbar #list-refresh.is-refreshing,
  html.desktop-dark-mode .workspace .message-page .detail-toolbar .icon-button:hover,
  html.desktop-dark-mode .workspace .message-page .detail-more-menu > summary:hover,
  html.desktop-dark-mode .workspace .message-page .detail-more-menu[open] > summary,
  html.desktop-dark-mode .toolbar-action:hover {
    background: #2a2e33;
    color: #f1f3f4;
  }

  html.desktop-dark-mode .workspace .list-pagination,
  html.desktop-dark-mode .workspace .list-pagination .page-button,
  html.desktop-dark-mode .workspace .batch-actions #selected-count {
    color: #9aa0a6;
  }

  html.desktop-dark-mode .workspace .list-pagination .page-button:hover:not(:disabled) {
    border-color: #3b4046;
    background: #272a2f;
    color: #fff;
  }

  html.desktop-dark-mode .workspace .list-pagination .page-button:disabled {
    color: #555b62;
  }

  html.desktop-dark-mode .workspace .gmail-row {
    border-bottom-color: #2b2f34;
    background: #191b1f;
    color: #bdc1c6;
  }

  html.desktop-dark-mode .workspace .gmail-row.unread {
    background: #242a32;
    color: #f1f3f4;
  }

  html.desktop-dark-mode .workspace .gmail-row:hover {
    z-index: 1;
    background: #25292e;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.46);
  }

  html.desktop-dark-mode .workspace .gmail-row.selected {
    background: #30353b;
  }

  html.desktop-dark-mode .workspace .gmail-row .recipient-chip,
  html.desktop-dark-mode .recipient-pill,
  html.desktop-dark-mode .search-folder-chip,
  html.desktop-dark-mode .pill {
    background: #2b3036;
    color: #d2d6da;
  }

  html.desktop-dark-mode .workspace .gmail-row .recipient-copy-button:hover,
  html.desktop-dark-mode .workspace .gmail-row .recipient-copy-button:active {
    background: #3a4047;
    color: #f1f3f4;
  }

  html.desktop-dark-mode .workspace .gmail-row .recipient-copy-button:focus-visible {
    outline-color: #bdc1c6;
  }

  html.desktop-dark-mode .workspace .gmail-row .mail-preview,
  html.desktop-dark-mode .workspace .gmail-row time,
  html.desktop-dark-mode .workspace .gmail-row:not(.unread) time,
  html.desktop-dark-mode .replied-marker,
  html.desktop-dark-mode .row-attachment-marker {
    color: #969ca3;
  }

  html.desktop-dark-mode .workspace .gmail-row.unread time,
  html.desktop-dark-mode .workspace .gmail-row.unread .row-attachment-marker {
    color: #dfe3e7;
  }

  html.desktop-dark-mode .workspace .gmail-row .star,
  html.desktop-dark-mode .workspace .gmail-row .star.active,
  html.desktop-dark-mode .workspace .message-page .detail-toolbar-star,
  html.desktop-dark-mode .workspace .message-page .detail-toolbar-star.active {
    color: #8d939a !important;
  }

  html.desktop-dark-mode .workspace .gmail-row .star:hover,
  html.desktop-dark-mode .workspace .message-page .detail-toolbar-star:hover,
  html.desktop-dark-mode .workspace .message-page .detail-toolbar-star.active:hover {
    color: #d5d9dd !important;
  }

  html.desktop-dark-mode .workspace .gmail-row .select-box::before,
  html.desktop-dark-mode .workspace .list-toolbar .toolbar-select {
    border-color: #737a83;
  }

  html.desktop-dark-mode .select-box.checked,
  html.desktop-dark-mode .select-box.partial,
  html.desktop-dark-mode .workspace .gmail-row .select-box.checked::before,
  html.desktop-dark-mode .workspace .gmail-row .select-box.partial::before {
    border-color: #e8eaed;
    background: #e8eaed;
  }

  html.desktop-dark-mode .select-box.checked,
  html.desktop-dark-mode .select-box.partial,
  html.desktop-dark-mode .workspace .gmail-row .select-box .selection-mark {
    color: #17191c;
  }

  html.desktop-dark-mode .workspace .message-page .detail-title-row h3,
  html.desktop-dark-mode .detail-sender-line,
  html.desktop-dark-mode .confirm-modal-body .confirm-message,
  html.desktop-dark-mode .confirm-address {
    color: #e8eaed;
  }

  html.desktop-dark-mode .detail-sender-email,
  html.desktop-dark-mode .message-address-details,
  html.desktop-dark-mode .detail-meta-row time,
  html.desktop-dark-mode .gmail-empty,
  html.desktop-dark-mode .muted {
    color: #9aa0a6;
  }

  html.desktop-dark-mode .detail-avatar {
    background: #2b3036;
    color: #f1f3f4;
  }

  html.desktop-dark-mode .detail-avatar-image {
    background: #fff;
  }

  html.desktop-dark-mode .mailbox-tag {
    background: #30343a;
    color: #bdc1c6;
  }

  html.desktop-dark-mode .workspace .message-page .detail-body {
    background: #191b1f;
  }

  html.desktop-dark-mode .workspace .message-page .mail-frame,
  html.desktop-dark-mode .compose-quote-frame {
    background: #fff;
    color-scheme: light;
  }

  html.desktop-dark-mode .workspace .message-page .gmail-action-pill,
  html.desktop-dark-mode .not-junk-button,
  html.desktop-dark-mode .empty-trash-button {
    border-color: #4b5159;
    background: #202328;
    color: #dfe3e7;
  }

  html.desktop-dark-mode .workspace .message-page .gmail-action-pill:hover,
  html.desktop-dark-mode .not-junk-button:hover,
  html.desktop-dark-mode .empty-trash-button:hover {
    background: #2a2e33;
    box-shadow: none;
  }

  html.desktop-dark-mode .detail-more-popover,
  html.desktop-dark-mode .address-card {
    border-color: #3a3f46;
    background: #24272c;
    color: #e0e3e7;
    box-shadow: 0 9px 26px rgba(0, 0, 0, 0.42);
  }

  html.desktop-dark-mode .address-copy-button:hover,
  html.desktop-dark-mode .address-copy-button:active {
    background: #30343a;
    color: #f1f3f4;
  }

  html.desktop-dark-mode .address-copy-button:focus-visible {
    outline-color: #bdc1c6;
  }

  html.desktop-dark-mode .workspace .message-page .detail-more-popover button {
    color: #e0e3e7;
  }

  html.desktop-dark-mode .workspace .message-page .detail-more-popover button:hover {
    background: #30343a;
  }

  html.desktop-dark-mode .card,
  html.desktop-dark-mode .domain-row,
  html.desktop-dark-mode .blocked-sender-row,
  html.desktop-dark-mode .table-card {
    border-color: #30343a;
    background: #1a1c20;
    color: #e3e6ea;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18);
  }

  html.desktop-dark-mode .data-table th {
    border-color: #30343a;
    background: #202328;
    color: #9aa0a6;
  }

  html.desktop-dark-mode .data-table td {
    border-color: #30343a;
    color: #e3e6ea;
  }

  html.desktop-dark-mode .domain-identity h3,
  html.desktop-dark-mode .domain-fact strong,
  html.desktop-dark-mode .alias-identity strong,
  html.desktop-dark-mode .blocked-sender-identity strong,
  html.desktop-dark-mode .blocked-sender-stats strong {
    color: #e8eaed;
  }

  html.desktop-dark-mode .button {
    background: #2b2f35;
    color: #e2e5e9;
  }

  html.desktop-dark-mode .button.ghost,
  html.desktop-dark-mode .button.danger-ghost,
  html.desktop-dark-mode .domain-actions .button,
  html.desktop-dark-mode .desktop-management-actions .button {
    border-color: #41464d;
    background: #202328;
    color: #dfe3e7;
  }

  html.desktop-dark-mode .button.primary {
    background: #e8eaed;
    color: #17191c;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.28);
  }

  html.desktop-dark-mode .button.primary:hover {
    background: #fff;
  }

  html.desktop-dark-mode .button.danger,
  html.desktop-dark-mode .button.danger-ghost,
  html.desktop-dark-mode .domain-actions .button.danger-ghost,
  html.desktop-dark-mode .desktop-management-actions .button.danger-ghost {
    border-color: #7f3c39;
    background: #3b2222;
    color: #ff8a80;
  }

  html.desktop-dark-mode .status.on {
    background: #163a2b;
    color: #7bdca8;
  }

  html.desktop-dark-mode .status.off {
    background: #2c3035;
    color: #a9afb6;
  }

  html.desktop-dark-mode .blocked-sender-scope,
  html.desktop-dark-mode .confirm-safe-note {
    background: #23272c;
    color: #aeb4bb;
  }

  html.desktop-dark-mode .modal,
  html.desktop-dark-mode .modal form,
  html.desktop-dark-mode #password-dialog form,
  html.desktop-dark-mode #alias-dialog form,
  html.desktop-dark-mode #alias-password-dialog form,
  html.desktop-dark-mode #alias-name-dialog form,
  html.desktop-dark-mode #alias-delete-dialog form,
  html.desktop-dark-mode #blocked-sender-dialog form,
  html.desktop-dark-mode #action-confirm-dialog.desktop-compact-confirm {
    border-color: #34383e;
    background: #1d2024 !important;
    color: #e8eaed;
  }

  html.desktop-dark-mode .modal::backdrop {
    background: rgba(0, 0, 0, 0.64);
  }

  html.desktop-dark-mode .modal header,
  html.desktop-dark-mode .modal footer,
  html.desktop-dark-mode #password-dialog footer,
  html.desktop-dark-mode #alias-dialog footer,
  html.desktop-dark-mode #alias-password-dialog footer,
  html.desktop-dark-mode #alias-name-dialog footer,
  html.desktop-dark-mode #alias-delete-dialog footer,
  html.desktop-dark-mode #blocked-sender-dialog footer,
  html.desktop-dark-mode #action-confirm-dialog.desktop-compact-confirm footer,
  html.desktop-dark-mode .compose-modal .compose-footer {
    border-color: #34383e;
    background: #1d2024;
  }

  html.desktop-dark-mode .modal header h3,
  html.desktop-dark-mode .modal label,
  html.desktop-dark-mode .compose-modal .compose-header h3 {
    color: #e8eaed;
  }

  html.desktop-dark-mode #compose-dialog .compose-error.pending {
    border-color: #444a51;
    color: #d5d9dd;
    background: #292d32;
  }

  html.desktop-dark-mode .modal header > .icon-button.close-dialog,
  html.desktop-dark-mode #password-dialog header > .icon-button.close-dialog,
  html.desktop-dark-mode #alias-dialog header > .icon-button.close-dialog,
  html.desktop-dark-mode #alias-password-dialog header > .icon-button.close-dialog,
  html.desktop-dark-mode #alias-name-dialog header > .icon-button.close-dialog,
  html.desktop-dark-mode #alias-delete-dialog header > .icon-button.close-dialog,
  html.desktop-dark-mode #blocked-sender-dialog header > .icon-button.close-dialog {
    border-color: #444a51;
    background: #292d32;
    box-shadow: none;
  }

  html.desktop-dark-mode .modal header > .icon-button.close-dialog::before,
  html.desktop-dark-mode .modal header > .icon-button.close-dialog::after {
    background: #dfe3e7;
  }

  html.desktop-dark-mode .modal header > .icon-button.close-dialog:hover {
    border-color: #60676f;
    background: #34383e;
  }

  html.desktop-dark-mode input,
  html.desktop-dark-mode select,
  html.desktop-dark-mode textarea,
  html.desktop-dark-mode #password-dialog .modal-body input,
  html.desktop-dark-mode #alias-dialog .modal-body input:not([type="checkbox"]),
  html.desktop-dark-mode #alias-dialog .modal-body textarea,
  html.desktop-dark-mode #alias-password-dialog .modal-body input:not([type="hidden"]),
  html.desktop-dark-mode #alias-name-dialog .modal-body input:not([type="hidden"]),
  html.desktop-dark-mode #blocked-sender-dialog .modal-body input {
    border-color: #41464d;
    background: #24272c;
    color: #eef0f2;
  }

  html.desktop-dark-mode input:focus,
  html.desktop-dark-mode select:focus,
  html.desktop-dark-mode textarea:focus,
  html.desktop-dark-mode #password-dialog .modal-body input:focus,
  html.desktop-dark-mode #alias-dialog .modal-body input:not([type="checkbox"]):focus,
  html.desktop-dark-mode #alias-dialog .modal-body textarea:focus,
  html.desktop-dark-mode #alias-password-dialog .modal-body input:not([type="hidden"]):focus,
  html.desktop-dark-mode #alias-name-dialog .modal-body input:not([type="hidden"]):focus,
  html.desktop-dark-mode #blocked-sender-dialog .modal-body input:focus {
    border-color: #8b929a;
    background: #282c31;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
  }

  html.desktop-dark-mode .compose-modal form,
  html.desktop-dark-mode .compose-modal .compose-body,
  html.desktop-dark-mode .compose-modal .compose-footer {
    background: #1d2024;
    color: #e8eaed;
  }

  html.desktop-dark-mode .compose-modal .compose-header {
    background: #24282d;
  }

  html.desktop-dark-mode .compose-field,
  html.desktop-dark-mode .compose-recipient-block,
  html.desktop-dark-mode .compose-copy-options .split input,
  html.desktop-dark-mode .compose-attachments {
    border-color: #34383e;
    color: #9fa5ac;
  }

  html.desktop-dark-mode .compose-field > input,
  html.desktop-dark-mode .compose-message-field textarea,
  html.desktop-dark-mode .compose-copy-options .split input {
    border-color: #34383e;
    background: transparent;
    color: #eef0f2;
  }

  html.desktop-dark-mode .compose-copy-options > summary,
  html.desktop-dark-mode details summary {
    color: #bdc1c6;
  }

  html.desktop-dark-mode .compose-attachments .file-picker-button,
  html.desktop-dark-mode .file-picker-button {
    border-color: #41464d;
    background: #2a2e33;
    color: #dfe3e7;
  }

  html.desktop-dark-mode .compose-footer .button.ghost {
    color: #bdc1c6;
    background: transparent;
  }

  html.desktop-dark-mode .compose-footer .button.ghost:hover {
    background: #2a2e33;
  }

  html.desktop-dark-mode .toast,
  html.desktop-dark-mode .toast[popover] {
    color: #d8dce1;
  }

  html.desktop-dark-mode .toast.error,
  html.desktop-dark-mode .toast.error[popover] {
    color: #ff8a80;
  }

  /* Management pages use desktop-specific light-theme text colors with higher
   * selector specificity. Override those colors only while the admin desktop
   * dark theme is active so the original light theme remains byte-for-byte
   * unchanged. */
  html.desktop-dark-mode .app-shell[data-view="aliases"] .alias-toolbar .muted,
  html.desktop-dark-mode .app-shell[data-view="domains"] .toolbar .muted,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-senders-heading p {
    color: #b4bac1;
  }

  html.desktop-dark-mode .app-shell[data-view="aliases"] .data-table th,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-sender-stats {
    color: #a8afb7;
  }

  html.desktop-dark-mode .app-shell[data-view="aliases"] .alias-identity strong,
  html.desktop-dark-mode .app-shell[data-view="domains"] .domain-identity h3,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-senders-heading h2,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-sender-identity strong,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-sender-stats strong {
    color: #f0f2f4;
  }

  html.desktop-dark-mode .app-shell[data-view="aliases"] .alias-identity small,
  html.desktop-dark-mode .app-shell[data-view="domains"] .domain-identity .muted,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-sender-identity small {
    color: #9fa6ae;
  }

  html.desktop-dark-mode .app-shell[data-view="aliases"] .alias-note,
  html.desktop-dark-mode .app-shell[data-view="domains"] .domain-fact,
  html.desktop-dark-mode .app-shell[data-view="domains"] .domain-fact span {
    color: #c0c5cb;
  }

  html.desktop-dark-mode .app-shell[data-view="domains"] .domain-fact strong {
    color: #e3e6ea;
  }

  html.desktop-dark-mode .app-shell[data-view="aliases"] .desktop-management-actions .button,
  html.desktop-dark-mode .app-shell[data-view="domains"] .domain-actions .button,
  html.desktop-dark-mode .app-shell[data-view="blocked"] .blocked-sender-row > .button {
    border-color: #454b53;
    background: #202328;
    color: #dfe3e7;
  }

  html.desktop-dark-mode .app-shell[data-view="aliases"] .desktop-management-actions .danger-ghost {
    border-color: #7f3c39;
    background: #3b2222;
    color: #ff8a80;
  }

  /* Every desktop modal has an ID-scoped light-theme design. Match that
   * specificity inside dark mode so titles, labels and actions never become
   * dark text on a dark surface. Display/spacing rules are intentionally left
   * untouched. */
  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal,
  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal form,
  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal header,
  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal footer {
    border-color: #34383e;
    background: #1a1c20;
    color: #e8eaed;
  }

  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal :is(header h3, .modal-body label, .confirm-message, .confirm-address, .confirm-modal-body > p, .switch-row, .compose-field > span) {
    color: #edf0f2;
  }

  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal :is(.muted, small, .blocked-sender-scope, .file-picker-status) {
    color: #aeb4bb;
  }

  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal :is(input:not([type="checkbox"]), textarea, select) {
    border-color: #3d4249;
    background: #22262b;
    color: #f1f3f4;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  }

  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal :is(input:not([type="checkbox"]), textarea, select):focus {
    border-color: #9aa0a6;
    background: #272b30;
    box-shadow: 0 0 0 3px rgba(154, 160, 166, 0.16);
  }

  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal footer .button.ghost,
  html.desktop-dark-mode #alias-dialog #generate-password,
  html.desktop-dark-mode #alias-password-dialog #generate-reset-password {
    border-color: #42474e;
    background: #292d32;
    color: #e3e6ea;
  }

  html.desktop-dark-mode :is(
      #compose-dialog,
      #password-dialog,
      #alias-dialog,
      #alias-password-dialog,
      #alias-name-dialog,
      #alias-delete-dialog,
      #blocked-sender-dialog,
      #action-confirm-dialog
    ).modal footer .button.primary {
    border-color: #e8eaed;
    background: #e8eaed;
    color: #17191c;
  }

  html.desktop-dark-mode #password-dialog .password-visibility {
    color: #bdc1c6;
  }

  html.desktop-dark-mode #password-dialog .password-visibility:hover {
    background: #34383e;
    color: #fff;
  }

  html.desktop-dark-mode #action-confirm-dialog.desktop-compact-confirm.desktop-keep-subtitle .confirm-modal-header .muted {
    color: #aeb4bb;
  }
}
