/* ========== Outlook 365 exact polish (token-driven, light + dark) ========== */

html, body, input, button, select, textarea, .form-control, #layout {
  font-family: var(--fm-font) !important;
  -webkit-font-smoothing: antialiased;
}

body:not(.task-login) {
  background: var(--fm-bg) !important;
  color: var(--fm-text) !important;
}

/* ---- Top bar ---- */
.fluent-topbar {
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 8px 0 0 !important;
  background: var(--fm-topbar) !important;
  box-shadow: none !important;
  border-bottom: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.fluent-topbar-left {
  display: flex !important;
  align-items: center !important;
  position: relative !important;
  flex: 0 0 auto !important;
}

.fluent-waffle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 48px !important;
  height: 48px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #fff !important;
  cursor: pointer !important;
}
.fluent-waffle:hover,
.fluent-waffle.is-open {
  background: rgba(255, 255, 255, 0.12) !important;
}

/* Microsoft 365 app launcher (waffle panel) */
.fluent-app-launcher {
  position: absolute !important;
  top: calc(100% + 4px) !important;
  left: 4px !important;
  z-index: 20000 !important;
  width: 328px !important;
  max-width: calc(100vw - 16px) !important;
}
.fluent-app-launcher[hidden] {
  display: none !important;
}
.fluent-app-launcher-card {
  background: #fff !important;
  color: #242424 !important;
  border-radius: 8px !important;
  border: 1px solid #e1dfdd !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12) !important;
  padding: 12px 12px 10px !important;
}
html.dark-mode .fluent-app-launcher-card {
  background: #292929 !important;
  color: #fff !important;
  border-color: #3b3a39 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}
.fluent-app-launcher-title {
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 4px 8px 10px !important;
  color: inherit !important;
}
.fluent-app-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 4px !important;
}
.fluent-app-tile {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 12px 6px 10px !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  color: inherit !important;
  min-height: 88px !important;
}
.fluent-app-tile:hover {
  background: #f5f5f5 !important;
}
html.dark-mode .fluent-app-tile:hover {
  background: #333 !important;
}
.fluent-app-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #fff !important;
  letter-spacing: 0 !important;
}
.fluent-app-icon span {
  line-height: 1 !important;
}
.fluent-app-outlook { background: #0078d4 !important; }
.fluent-app-people { background: #0078d4 !important; }
.fluent-app-settings { background: #742774 !important; }
.fluent-app-onedrive { background: #094ab2 !important; }
.fluent-app-word { background: #185abd !important; }
.fluent-app-excel { background: #107c41 !important; }
.fluent-app-powerpoint { background: #c43e1c !important; }
.fluent-app-teams { background: #6264a7 !important; }
.fluent-app-onenote { background: #7719aa !important; }
.fluent-app-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  text-align: center !important;
  line-height: 1.2 !important;
  color: inherit !important;
}
.fluent-app-all {
  display: block !important;
  margin-top: 8px !important;
  padding: 10px 8px 4px !important;
  text-align: center !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #0f6cbd !important;
  text-decoration: none !important;
  border-top: 1px solid #e1dfdd !important;
}
html.dark-mode .fluent-app-all {
  color: #479ef5 !important;
  border-top-color: #3b3a39 !important;
}
.fluent-app-all:hover {
  text-decoration: underline !important;
}

.fluent-topbar-brand {
  font-size: 16px !important;
  font-weight: 600 !important;
  gap: 8px !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  color: #fff !important;
}
.fluent-topbar-brand:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.fluent-topbar-search {
  max-width: 468px !important;
  margin: 0 auto 0 24px !important;
  flex: 1 1 auto !important;
}

.fluent-topbar-search-input {
  height: 32px !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  padding-left: 36px !important;
  background: #fff !important;
  color: #242424 !important;
  border: 0 !important;
  box-shadow: none !important;
}
.fluent-topbar-search-input::placeholder {
  color: #616161 !important;
}
.fluent-topbar-search-input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.65) !important;
  outline-offset: 0 !important;
}

.fluent-topbar-search-icon {
  color: #616161 !important;
}

.fluent-topbar-right {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  margin-left: auto !important;
  padding-right: 8px !important;
  min-width: 88px !important;
  flex: 0 0 auto !important;
  gap: 2px !important;
  position: relative !important;
}

.fluent-topbar-iconbtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #fff !important;
  cursor: pointer !important;
}
.fluent-topbar-iconbtn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

.fluent-topbar-user {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  margin: 0 4px 0 2px !important;
  padding: 0 !important;
  border: 2px solid transparent !important;
  border-radius: 50% !important;
  background: var(--fm-avatar) !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-align: center !important;
  cursor: pointer !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) !important;
}
.fluent-topbar-user:hover,
.fluent-topbar-user[aria-expanded="true"] {
  box-shadow: 0 0 0 2px #fff !important;
}
.fluent-topbar-user-initial {
  pointer-events: none !important;
}

/* Outlook Me Control flyout */
.fluent-account-flyout {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  right: 4px !important;
  z-index: 20000 !important;
  width: 340px !important;
  max-width: calc(100vw - 16px) !important;
}
.fluent-account-flyout[hidden] {
  display: none !important;
}
.fluent-account-flyout-card {
  background: #fff !important;
  color: #242424 !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14), 0 0 2px rgba(0, 0, 0, 0.12) !important;
  border: 1px solid #e1dfdd !important;
  overflow: hidden !important;
  padding: 0 0 8px !important;
}
html.dark-mode .fluent-account-flyout-card {
  background: #292929 !important;
  color: #fff !important;
  border-color: #3b3a39 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}
.fluent-account-hero {
  display: flex !important;
  gap: 12px !important;
  padding: 16px 16px 12px !important;
  background: linear-gradient(180deg, #deecf9 0%, #fff 70%) !important;
}
html.dark-mode .fluent-account-hero {
  background: linear-gradient(180deg, #0c3b5e 0%, #292929 75%) !important;
}
.fluent-account-hero-avatar {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: var(--fm-avatar) !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  font-weight: 600 !important;
  flex: 0 0 auto !important;
}
.fluent-account-hero-meta {
  min-width: 0 !important;
  padding-top: 2px !important;
}
.fluent-account-hero-name {
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 22px !important;
  color: inherit !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.fluent-account-hero-email {
  font-size: 12px !important;
  color: #616161 !important;
  line-height: 16px !important;
  margin: 2px 0 6px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html.dark-mode .fluent-account-hero-email {
  color: #adadad !important;
}
.fluent-account-hero-link {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #0f6cbd !important;
  text-decoration: none !important;
}
html.dark-mode .fluent-account-hero-link {
  color: #479ef5 !important;
}
.fluent-account-hero-link:hover {
  text-decoration: underline !important;
}
.fluent-account-section-label {
  padding: 8px 16px 4px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #616161 !important;
}
html.dark-mode .fluent-account-section-label {
  color: #adadad !important;
}
.fluent-account-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 8px !important;
}
.fluent-account-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px !important;
  border-radius: 4px !important;
  margin: 0 !important;
}
.fluent-account-item.is-current {
  background: #cfe4fa !important;
}
html.dark-mode .fluent-account-item.is-current {
  background: #0c3b5e !important;
}
.fluent-account-item-avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: var(--fm-avatar) !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  flex: 0 0 auto !important;
}
.fluent-account-item-meta {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
}
.fluent-account-item-name {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: inherit !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.fluent-account-item-email {
  font-size: 11px !important;
  color: #616161 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
html.dark-mode .fluent-account-item-email {
  color: #adadad !important;
}
.fluent-account-item-check {
  color: #0f6cbd !important;
  font-weight: 700 !important;
  font-size: 14px !important;
}
html.dark-mode .fluent-account-item-check {
  color: #479ef5 !important;
}
.fluent-account-action {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: calc(100% - 16px) !important;
  margin: 2px 8px !important;
  padding: 10px 8px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: inherit !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: left !important;
  cursor: pointer !important;
}
.fluent-account-action:hover {
  background: #f0f0f0 !important;
}
html.dark-mode .fluent-account-action:hover {
  background: #333 !important;
}
.fluent-account-action-icon {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: 1px dashed #616161 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  color: #0f6cbd !important;
}
html.dark-mode .fluent-account-action-icon {
  border-color: #adadad !important;
  color: #479ef5 !important;
}
.fluent-account-divider {
  height: 1px !important;
  margin: 6px 0 !important;
  background: #e1dfdd !important;
}
html.dark-mode .fluent-account-divider {
  background: #3b3a39 !important;
}
.fluent-account-signout {
  color: #242424 !important;
}
html.dark-mode .fluent-account-signout {
  color: #fff !important;
}

/* ---- App rail ---- */
@media screen and (min-width: 481px) {
  body:not(.task-login) #layout-menu,
  body:not(.task-login) #layout-menu.fluent-appbar {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    background: var(--fm-rail) !important;
    border-right: 1px solid var(--fm-border) !important;
  }

  body:not(.task-login) #layout-menu .popover-header {
    height: 48px !important;
    min-height: 48px !important;
    background: var(--fm-rail) !important;
    border-bottom: 1px solid var(--fm-border) !important;
  }

  body:not(.task-login) #taskmenu .action-buttons,
  body.task-mail #taskmenu .action-buttons,
  body.action-compose #taskmenu .action-buttons {
    display: none !important;
  }

  body:not(.task-login) #taskmenu a.about {
    display: none !important;
  }

  body:not(.task-login) #taskmenu a,
  body:not(.task-login) #taskmenu .button {
    height: 48px !important;
    min-height: 48px !important;
    width: 48px !important;
    color: var(--fm-icon) !important;
    border-radius: 0 !important;
  }

  body:not(.task-login) #taskmenu a:before {
    line-height: 48px !important;
    font-size: 20px !important;
  }

  body:not(.task-login) #taskmenu a .inner {
    display: none !important;
  }

  body:not(.task-login) #taskmenu a.selected {
    background: var(--fm-rail-selected) !important;
    color: var(--fm-accent) !important;
    box-shadow: inset 3px 0 0 var(--fm-accent) !important;
  }

  body:not(.task-login) #taskmenu a:hover {
    background: var(--fm-rail-hover) !important;
  }

  body:not(.task-login) #taskmenu .special-buttons {
    background: var(--fm-rail) !important;
    border-top: 1px solid var(--fm-border) !important;
    padding: 4px 0 8px !important;
  }

  body:not(.task-login) #taskmenu .special-buttons a {
    color: var(--fm-icon) !important;
  }
}

/* ---- Folder pane ---- */
body:not(.task-login) #layout-sidebar,
body:not(.task-login) #layout-sidebar.fluent-folderpane {
  width: var(--fm-sidebar-w) !important;
  min-width: 220px !important;
  max-width: 300px !important;
  background: var(--fm-surface-2) !important;
  border-right: 1px solid var(--fm-border) !important;
}

body:not(.task-login) #layout-sidebar > .header {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 4px 0 16px !important;
  border-bottom: 0 !important;
  background: transparent !important;
}

body:not(.task-login) #layout-sidebar .header-title.username {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--fm-text) !important;
}

body:not(.task-login) #layout-sidebar .sidebar-menu {
  color: var(--fm-icon) !important;
}

.fluent-newmail {
  padding: 0 12px 10px !important;
}

.fluent-newmail-btn,
a.fluent-newmail-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 12px !important;
  border-radius: 4px !important;
  background: var(--fm-accent) !important;
  border: 1px solid var(--fm-accent) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #fff !important;
}
html.dark-mode .fluent-newmail-btn,
html.dark-mode a.fluent-newmail-btn {
  background: #115ea3 !important;
  border-color: #115ea3 !important;
  color: #fff !important;
}

.fluent-newmail-btn:hover {
  background: var(--fm-accent-hover) !important;
  border-color: var(--fm-accent-hover) !important;
}

.fluent-folderpane-section {
  padding: 4px 16px 6px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--fm-text-muted) !important;
}

body:not(.task-login) #folderlist-content {
  padding: 0 8px 12px !important;
}

body:not(.task-login) #mailboxlist li {
  margin: 1px 0 !important;
}

body:not(.task-login) #mailboxlist li > a,
body:not(.task-login) #mailboxlist li > div > a {
  padding: 6px 10px 6px 36px !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  line-height: 20px !important;
  color: var(--fm-text) !important;
}

body:not(.task-login) #mailboxlist li > a:before {
  left: 10px !important;
  font-size: 16px !important;
  color: var(--fm-text-muted) !important;
}

body:not(.task-login) #mailboxlist li > a:hover {
  background: var(--fm-hover) !important;
}

body:not(.task-login) #mailboxlist li.selected > a,
body:not(.task-login) #mailboxlist li.selected > div > a,
body:not(.task-login) #mailboxlist li > a.selected {
  background: var(--fm-accent-soft) !important;
  font-weight: 600 !important;
  color: var(--fm-text) !important;
  box-shadow: inset 3px 0 0 var(--fm-accent) !important;
}

body:not(.task-login) #mailboxlist .unreadcount {
  background: var(--fm-accent) !important;
  color: #fff !important;
  min-width: 18px !important;
  height: 18px !important;
  line-height: 18px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  margin-top: 0 !important;
  padding: 0 5px !important;
}
html.dark-mode body:not(.task-login) #mailboxlist .unreadcount {
  background: #115ea3 !important;
}

body:not(.task-login) #layout-sidebar > .footer {
  border-top: 1px solid var(--fm-border) !important;
  color: var(--fm-text-muted) !important;
  background: transparent !important;
}

/* ---- Message list ---- */
body:not(.task-login) #layout-list {
  width: var(--fm-list-w) !important;
  min-width: 280px !important;
  max-width: 420px !important;
  border-right: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
}

body.task-mail #messagelist-header.fluent-messagelist-header {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 8px 0 16px !important;
  border-bottom: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
  display: flex !important;
  align-items: center !important;
}

body.task-mail #messagelist-header .fluent-list-heading,
body.task-mail #messagelist-header .header-title {
  display: block !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: var(--fm-text) !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1 1 auto !important;
  text-align: left !important;
}

body.task-mail #messagelist-header .fluent-list-toolbar,
body.task-mail #messagelist-header #toolbar-list-menu,
body.task-mail #messagelist-header .toolbar-menu-button,
body.task-mail #messagelist-header .menu.toolbar.listing,
body.task-mail #messagelist-header ul.menu {
  display: none !important;
}

body.task-mail #messagelist-header .button.refresh {
  width: 32px !important;
  height: 32px !important;
  border-radius: 4px !important;
  margin-left: auto !important;
  color: var(--fm-icon) !important;
  flex: 0 0 auto !important;
}
body.task-mail #messagelist-header .button.refresh:hover {
  background: var(--fm-hover) !important;
}
body.task-mail #messagelist-header .button.refresh .inner {
  display: none !important;
}

body.task-mail #messagelist-header .searchbar,
body.task-mail #mailsearchform,
body.task-mail #layout-list > .searchbar {
  display: none !important;
}

@media screen and (min-width: 769px) {
  body.task-mail #messagelist-header .task-menu-button,
  body.task-mail #messagelist-header .back-sidebar-button {
    display: none !important;
  }
}

/* Compact Outlook rows */
body.task-mail #messagelist {
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
}

body.task-mail #messagelist thead {
  display: none !important;
}

body.task-mail #messagelist tr td {
  padding: 7px 10px !important;
  border-bottom: 1px solid var(--fm-row-border) !important;
  vertical-align: top !important;
  background: transparent !important;
  color: var(--fm-text) !important;
}

body.task-mail #messagelist tr td.subject {
  padding-left: 4px !important;
  padding-right: 10px !important;
}

body.task-mail #messagelist tr td.subject .fromto {
  display: block !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--fm-text) !important;
  line-height: 18px !important;
  margin: 0 64px 1px 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.task-mail #messagelist tr.unread td.subject .fromto {
  font-weight: 700 !important;
}

body.task-mail #messagelist tr td.subject .date {
  float: right !important;
  margin: 0 0 0 8px !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--fm-text-muted) !important;
  line-height: 18px !important;
}

body.task-mail #messagelist tr td.subject .size {
  display: none !important;
}

body.task-mail #messagelist tr td.subject span.subject {
  display: block !important;
  clear: both !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--fm-text-muted) !important;
  line-height: 16px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  padding-left: 16px !important;
  position: relative !important;
}

body.task-mail #messagelist tr.unread td.subject span.subject {
  color: var(--fm-text) !important;
  font-weight: 600 !important;
}

body.task-mail #messagelist tr td.subject span.subject a,
body.task-mail #messagelist tr td.subject span.subject a span {
  color: inherit !important;
  font-weight: inherit !important;
  text-decoration: none !important;
}

body.task-mail #messagelist tr td.subject .msgicon {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
}

body.task-mail #messagelist tr:hover td {
  background: var(--fm-hover) !important;
}

body.task-mail #messagelist tr.selected td,
body.task-mail #messagelist tr.focused td,
body.task-mail #messagelist tr.selected:hover td {
  background: var(--fm-accent-soft) !important;
}

body.task-mail #messagelist tr.selected td.flags,
body.task-mail #messagelist tr.focused td.flags {
  box-shadow: inset 3px 0 0 var(--fm-accent) !important;
}

body.task-mail #messagelist tr td.flags {
  width: 24px !important;
  padding: 7px 2px !important;
}

body.task-mail #messagelist-content {
  background: var(--fm-surface) !important;
}

body.task-mail #layout-list > .footer {
  border-top: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
  color: var(--fm-text-muted) !important;
  font-size: 12px !important;
}

/* ---- Reading pane command bar ---- */
body.task-mail #layout-content {
  background: var(--fm-surface) !important;
}

body.task-mail #layout-content > .header.fluent-readingpane-header,
body.task-mail #layout-content > .header {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 0 8px !important;
  background: var(--fm-surface) !important;
  border-bottom: 1px solid var(--fm-border) !important;
  justify-content: flex-start !important;
  align-items: center !important;
  overflow: hidden !important;
  display: flex !important;
  flex-wrap: nowrap !important;
}

body.task-mail #layout-content > .header > .header-title,
body.task-mail #layout-content > .header > .back-list-button,
body.task-mail #layout-content > .header > .toolbar-menu-button {
  display: none !important;
}

body.task-mail #layout-content > .header > .popupmenu {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  visibility: hidden !important;
}

body.task-mail #layout-content > .header #toolbar-menu,
body.task-mail #toolbar-menu.menu.toolbar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 44px !important;
  max-height: 44px !important;
  width: auto !important;
  max-width: 100% !important;
  overflow: hidden !important;
  list-style: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  position: static !important;
}

body.task-mail #toolbar-menu > li {
  display: inline-flex !important;
  align-items: center !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 44px !important;
  width: auto !important;
  border: 0 !important;
  background: transparent !important;
}

body.task-mail #toolbar-menu > li > a.compose,
body.task-mail #toolbar-menu a.compose {
  display: none !important;
}

body.task-mail #toolbar-menu a.fluent-cmd,
body.task-mail #toolbar-menu a.reply,
body.task-mail #toolbar-menu a.reply-all,
body.task-mail #toolbar-menu a.forward,
body.task-mail #toolbar-menu a.delete {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: auto !important;
  width: auto !important;
  height: 32px !important;
  padding: 0 8px !important;
  margin: 0 !important;
  border-radius: 4px !important;
  color: var(--fm-text) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  background: transparent !important;
  border: 0 !important;
}

body.task-mail #toolbar-menu a.fluent-cmd:before,
body.task-mail #toolbar-menu a.reply:before,
body.task-mail #toolbar-menu a.reply-all:before,
body.task-mail #toolbar-menu a.forward:before,
body.task-mail #toolbar-menu a.delete:before {
  font-size: 16px !important;
  margin: 0 !important;
  line-height: 1 !important;
  color: inherit !important;
}

body.task-mail #toolbar-menu a.fluent-cmd .inner,
body.task-mail #toolbar-menu a.reply .inner,
body.task-mail #toolbar-menu a.reply-all .inner,
body.task-mail #toolbar-menu a.forward .inner,
body.task-mail #toolbar-menu a.delete .inner {
  display: inline !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.task-mail #toolbar-menu a.fluent-cmd-icon,
body.task-mail #toolbar-menu a.markmessage,
body.task-mail #toolbar-menu a.more,
body.task-mail #toolbar-menu a.junk,
body.task-mail #toolbar-menu a.archive,
body.task-mail #toolbar-menu a.move {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  color: var(--fm-icon) !important;
}

body.task-mail #toolbar-menu a.fluent-cmd-icon .inner,
body.task-mail #toolbar-menu a.markmessage .inner,
body.task-mail #toolbar-menu a.more .inner,
body.task-mail #toolbar-menu a.junk .inner,
body.task-mail #toolbar-menu a.archive .inner,
body.task-mail #toolbar-menu a.move .inner {
  display: none !important;
}

body.task-mail #toolbar-menu span.dropbutton {
  display: inline-flex !important;
  align-items: center !important;
  height: 32px !important;
}

body.task-mail #toolbar-menu span.dropbutton > a.dropdown {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  min-width: 16px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  color: var(--fm-text-muted) !important;
}

body.task-mail #toolbar-menu span.dropbutton > a.dropdown .inner {
  display: none !important;
}

body.task-mail #toolbar-menu .fluent-cmd-divider {
  display: block !important;
  width: 1px !important;
  height: 20px !important;
  margin: 0 4px !important;
  background: var(--fm-border) !important;
}

body.task-mail #toolbar-menu a:hover,
body.task-mail #toolbar-menu a.fluent-cmd:hover {
  background: var(--fm-hover) !important;
  color: var(--fm-text) !important;
}

body.task-mail #toolbar-menu a.disabled {
  opacity: 0.4 !important;
}

body.task-mail #layout-content .iframe-wrapper {
  background: var(--fm-surface) !important;
  position: relative !important;
}

body:not(.task-login) #message-header {
  padding: 16px 28px 12px !important;
  border-bottom: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
}

body:not(.task-login) #message-header .subject,
body:not(.task-login) h2.subject,
html.iframe #message-header .subject,
html.iframe h2.subject {
  font-size: 20px !important;
  font-weight: 600 !important;
  line-height: 28px !important;
  margin-bottom: 10px !important;
  color: var(--fm-text) !important;
}

html.iframe #message-header,
html.iframe #messagebody,
html.iframe .frame-content {
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
}

body:not(.task-login) #messagebody {
  padding: 12px 28px 28px !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
  color: var(--fm-text) !important;
  background: var(--fm-surface) !important;
}

/* ---- Compose ---- */
body.action-compose #layout-content {
  background: var(--fm-surface) !important;
}

body.action-compose .fluent-compose-header {
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  padding: 0 12px !important;
  border-bottom: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
  display: flex !important;
  align-items: center !important;
  overflow: hidden !important;
}

body.action-compose .fluent-compose-header > .task-menu-button,
body.action-compose .fluent-compose-header > .toolbar-menu-button,
body.action-compose .fluent-compose-header > .header-title {
  display: none !important;
}

body.action-compose #toolbar-menu,
body.action-compose .fluent-compose-header #toolbar-menu {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 2px !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 48px !important;
  max-height: 48px !important;
  width: auto !important;
  list-style: none !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

body.action-compose #toolbar-menu > li {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 48px !important;
  width: auto !important;
  border: 0 !important;
  background: transparent !important;
  float: none !important;
}

body.action-compose #toolbar-menu > li.spacer {
  width: 10px !important;
  min-width: 10px !important;
}

body.action-compose #toolbar-menu > li.hidden-big {
  display: none !important;
}

a.fluent-send-btn,
.fluent-send-btn,
body.action-compose #toolbar-menu a.fluent-send-btn,
body.action-compose #toolbar-menu a.send {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 72px !important;
  height: 32px !important;
  padding: 0 14px !important;
  border-radius: 4px !important;
  background: #0f6cbd !important;
  border: 1px solid #0f6cbd !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

body.action-compose #toolbar-menu a.fluent-send-btn:before,
body.action-compose #toolbar-menu a.send:before {
  display: none !important;
}

body.action-compose #toolbar-menu a.fluent-send-btn .inner,
body.action-compose #toolbar-menu a.send .inner {
  display: inline !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  overflow: visible !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

a.fluent-discard-btn,
body.action-compose #toolbar-menu a.fluent-discard-btn {
  display: inline-flex !important;
  align-items: center !important;
  height: 32px !important;
  padding: 0 10px !important;
  border-radius: 4px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  color: var(--fm-text) !important;
  background: transparent !important;
}

body.action-compose #toolbar-menu a.fluent-discard-btn:before {
  display: none !important;
}

body.action-compose #toolbar-menu a.fluent-discard-btn .inner {
  display: inline !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  overflow: visible !important;
  color: inherit !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

a.fluent-discard-btn:hover,
body.action-compose #toolbar-menu a.fluent-discard-btn:hover {
  background: var(--fm-hover) !important;
}

body.action-compose #toolbar-menu a.attach,
body.action-compose #toolbar-menu a.save,
body.action-compose #toolbar-menu a.signature,
body.action-compose #toolbar-menu a.responses,
body.action-compose #toolbar-menu a.options,
body.action-compose #toolbar-menu a.encrypt,
body.action-compose #toolbar-menu a.spellcheck {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  color: var(--fm-icon) !important;
}

body.action-compose #toolbar-menu a.attach .inner,
body.action-compose #toolbar-menu a.save .inner,
body.action-compose #toolbar-menu a.signature .inner,
body.action-compose #toolbar-menu a.responses .inner,
body.action-compose #toolbar-menu a.options .inner,
body.action-compose #toolbar-menu a.encrypt .inner,
body.action-compose #toolbar-menu a.spellcheck .inner {
  display: none !important;
}

body.action-compose #toolbar-menu a.attach:hover,
body.action-compose #toolbar-menu a.save:hover,
body.action-compose #toolbar-menu a.signature:hover,
body.action-compose #toolbar-menu a.responses:hover,
body.action-compose #toolbar-menu a.encrypt:hover {
  background: var(--fm-hover) !important;
}

body.action-compose #compose-headers {
  padding: 8px 20px 0 !important;
  border-bottom: 1px solid var(--fm-border) !important;
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
}

body.action-compose #compose-headers .col-form-label {
  font-size: 13px !important;
  color: var(--fm-text-muted) !important;
  font-weight: 600 !important;
  width: 64px !important;
  max-width: 64px !important;
  flex: 0 0 64px !important;
}

body.action-compose #compose-headers .form-group.row {
  margin-bottom: 0 !important;
  min-height: 36px !important;
  border-bottom: 1px solid var(--fm-row-border) !important;
  align-items: center !important;
}

body.action-compose #compose-headers .form-control,
body.action-compose #compose-headers input,
body.action-compose #compose-subject {
  border: 0 !important;
  background: transparent !important;
  color: var(--fm-text) !important;
  font-size: 14px !important;
  min-height: 32px !important;
  box-shadow: none !important;
}

body.action-compose #composebodycontainer {
  padding: 12px 20px !important;
  background: var(--fm-surface) !important;
}

body.action-compose #composebody,
body.action-compose .tox-tinymce,
body.action-compose .tox-edit-area,
body.action-compose .tox-edit-area__iframe {
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
  border: 0 !important;
}

body.action-compose #layout-sidebar {
  border-left: 1px solid var(--fm-border) !important;
  background: var(--fm-surface-2) !important;
  color: var(--fm-text) !important;
}

body.task-mail .pagenav,
body.task-mail #countcontrols {
  font-size: 12px !important;
  color: var(--fm-text-muted) !important;
}

body:not(.task-login) #layout-menu,
body:not(.task-login) #layout-sidebar,
body:not(.task-login) #layout-list {
  border-right-color: var(--fm-border) !important;
}

/* Popovers / menus */
body:not(.task-login) .popupmenu,
body:not(.task-login) .popover,
body:not(.task-login) .ui-dialog,
body:not(.task-login) .modal-content {
  background: var(--fm-surface-2) !important;
  color: var(--fm-text) !important;
  border: 1px solid var(--fm-border) !important;
  box-shadow: var(--fm-shadow) !important;
}

body:not(.task-login) .popupmenu a,
body:not(.task-login) .popupmenu .menuitem,
body:not(.task-login) .menu.listing a {
  color: var(--fm-text) !important;
}

body:not(.task-login) .popupmenu a:hover,
body:not(.task-login) .menu.listing a:hover {
  background: var(--fm-hover) !important;
}

/* ========== Dark mode extras (Elastic leftovers + iframe chrome) ========== */
html.dark-mode body,
html.dark-mode #layout,
html.dark-mode #layout-content,
html.dark-mode #messagelist,
html.dark-mode #messagelist-content,
html.dark-mode .listing,
html.dark-mode .scroller,
html.dark-mode .iframe-wrapper,
html.dark-mode .frame-content,
html.dark-mode #message-header,
html.dark-mode #messagebody {
  background: var(--fm-surface) !important;
  color: var(--fm-text) !important;
}

html.dark-mode #layout-sidebar {
  background: var(--fm-surface-2) !important;
}

html.dark-mode .fluent-appbar-mark {
  opacity: 0.9;
}

html.dark-mode body.task-mail #messagelist tr td,
html.dark-mode body.task-mail #messagelist tr td * {
  border-color: var(--fm-row-border) !important;
}

html.dark-mode body.task-mail #messagelist tr td.subject .fromto,
html.dark-mode body.task-mail #messagelist tr.unread td.subject span.subject,
html.dark-mode body.task-mail #messagelist-header .fluent-list-heading {
  color: #fff !important;
}

html.dark-mode body.task-mail #messagelist tr td.subject span.subject,
html.dark-mode body.task-mail #messagelist tr td.subject .date {
  color: #adadad !important;
}

html.dark-mode body.task-mail #messagelist tr.selected td,
html.dark-mode body.task-mail #messagelist tr.focused td {
  background: #0c3b5e !important;
}

html.dark-mode body.task-mail #messagelist tr:hover td {
  background: #333 !important;
}

html.dark-mode body.task-mail #messagelist tr.selected:hover td {
  background: #0f4a75 !important;
}

html.dark-mode body:not(.task-login) #mailboxlist li.selected > a,
html.dark-mode body:not(.task-login) #mailboxlist li > a.selected {
  background: #0c3b5e !important;
  color: #fff !important;
}

html.dark-mode .fluent-topbar-search-input {
  background: #292929 !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px #3b3a39 !important;
}
html.dark-mode .fluent-topbar-search-input::placeholder {
  color: #adadad !important;
}
html.dark-mode .fluent-topbar-search-icon {
  color: #adadad !important;
}

html.dark-mode body.task-mail #toolbar-menu a.disabled {
  opacity: 0.35 !important;
}

html.dark-mode body.action-compose #compose-headers .form-control,
html.dark-mode body.action-compose #compose-headers input,
html.dark-mode body.action-compose #compose-subject,
html.dark-mode body.action-compose select {
  background: transparent !important;
  color: #fff !important;
}

html.dark-mode body.action-compose .tox .tox-toolbar,
html.dark-mode body.action-compose .tox .tox-toolbar__primary,
html.dark-mode body.action-compose .tox .tox-menubar {
  background: var(--fm-surface-2) !important;
  border-color: var(--fm-border) !important;
}

html.dark-mode body.task-login,
html.dark-mode body.task-login #layout,
html.dark-mode body.task-login #layout-content {
  background: #141414 !important;
}

html.dark-mode body.task-login .fluent-login-card-inner,
html.dark-mode body.task-login .fluent-login-card {
  background: #292929 !important;
  color: #fff !important;
  border-color: #3b3a39 !important;
}

/* ---- Extra Outlook micro-details ---- */
body:not(.task-login) #layout {
  background: var(--fm-bg) !important;
}

body.task-mail #messagelist tr td.flags .unread,
body.task-mail #messagelist tr.unread td.flags span.status,
body.task-mail #messagelist .msgicon.status.unread:before {
  color: var(--fm-unread-dot) !important;
}

body:not(.task-login) #taskmenu a.logout {
  /* keep available but quieter — primary sign-out is account flyout */
  opacity: 0.85 !important;
}


body.task-mail #layout-list {
  box-shadow: inset -1px 0 0 var(--fm-border) !important;
}

body.task-mail #layout-content > .header {
  box-shadow: 0 1px 0 var(--fm-border) !important;
}

body.action-compose #compose-headers .form-group.row:last-child {
  border-bottom: 0 !important;
}

/* Avatar colors vary slightly by initial for nicer Outlook feel */
.fluent-topbar-user[data-email^="a"],
.fluent-topbar-user[data-email^="A"],
.fluent-account-item-avatar:first-letter { }

/* Hide native Elastic username ellipsis overflow glitches */
body:not(.task-login) #layout-sidebar .header-title.username {
  max-width: calc(100% - 40px) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
