/* Plugins rail, mail navigation, chat area, status icons, chat wallpaper. */
/* Desktop: plugins rail swaps channel list for extensions inside chat-nav */
@media (min-width: 801px) {

  

  /* Mail rail swaps channel list for connected mailboxes */
  .app.mail-mode:not(.settings-open) #chat-nav { display: block; }
  .app.mail-mode:not(.settings-open) #mail-nav { display: block; }
  .app.mail-mode:not(.settings-open) #chat-nav > :not(#mail-nav) { display: none !important; }
  .app.mail-mode:not(.settings-open) #filter { display: none !important; }
}
#mail-nav .section-head { user-select: none; }
#mail-account-list .mail-account-block { margin-bottom: 6px; }
#mail-account-list .hash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#mail-account-list .hash svg { display: block; opacity: .9; }
#mail-account-list .nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#mail-account-list .mail-folder-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px;
  padding: 0 0 0 10px;
}
#mail-account-list .mail-folder-group-head {
  opacity: .85;
  font-weight: 600;
}
#mail-account-list .mail-folder-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 14px;
}
#mail-account-list .mail-folder-item {
  min-height: 28px;
  padding: 4px 10px 4px 14px;
  font-size: calc(13px * var(--text-scale, 1));
  opacity: .92;
}
#mail-account-list .mail-folder-item .badge {
  margin-left: auto;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
}
.app.mail-mode .feature-card {
  width: 100%;
  max-width: none;
  align-self: stretch;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.app.mail-mode .feature-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
}
.app.mail-mode #feature-back,
.app.mail-mode #feature-title,
.app.mail-mode .feature-lead {
  display: none !important;
}
.app.mail-mode #feature-toolbar.hidden {
  display: none !important;
}
.app.mail-mode #media-btn {
  display: none !important;
}
/* Mail header uses the same box as the main channel header. */
.app.mail-mode .channel-header {
  align-items: center;
  align-content: center;
}
.app.rail-feature-open.mail-mode.feature-chrome-open .channel-header {
  left: 18px;
  right: 18px;
  margin: 0;
  padding: 6px 8px 6px 6px;
  /* Collapsed search/notif rows must not add height under the title. */
  gap: 0 8px;
  min-height: 60px;
  align-items: center;
  align-content: center;
}
.app.mail-mode .channel-header > .header-actions {
  align-self: center;
  margin-left: auto;
}
.app.mail-mode #channel-heading-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: center;
  gap: 8px;
  min-width: 0;
  padding: 0 2px;
  margin: 0;
  line-height: 1.2;
}
.app.mail-mode #channel-heading-btn .channel-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: calc(16px * var(--text-scale, 1));
  line-height: 1.2;
  gap: 4px;
  align-items: center;
}
.app.mail-mode #channel-topic.mail-header-login {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  max-width: min(360px, 46vw);
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #2a2d35;
  font-size: calc(11px * var(--text-scale, 1));
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px rgba(42, 45, 53, 0.08);
}
.app.mail-mode .header-mail-search-slot,
.app.mail-mode .header-notif-slot {
  margin-top: 0;
}
.app.mail-mode .header-mail-search-panel {
  padding-top: 4px;
  padding-bottom: 2px;
}

@media (max-width: 800px) {

  

  

  

  

  

  
}

.nav-item.unread { color: #fff; font-weight: 700; }
.nav-item .avatar {
  width: 24px; height: 24px; min-width: 24px; min-height: 24px; max-width: 24px; max-height: 24px;
  flex: 0 0 24px; font-size: 11px;
}
.nav-item .avatar .presence { width: 10px; height: 10px; right: -1px; bottom: -1px; border-width: 1px; }
.hash { width: 18px; flex: none; text-align: center; font-weight: 700; opacity: .85; }
.hash.is-dock { opacity: .9; color: var(--accent, #1c58d9); }
.hash.is-private {
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .75;
}
.ico-lock {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 14px;
  flex: none;
  color: inherit;
  opacity: .85;
  vertical-align: -1px;
}
.ico-lock::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  width: 8px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  box-sizing: border-box;
  background: transparent;
}
.ico-lock::after {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-sizing: border-box;
  background: transparent;
}
#channel-prefix.is-lock {
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  width: 16px;
  opacity: .75;
}
#channel-prefix.is-lock .ico-lock {
  opacity: 1;
}
.forward-channel-mark.is-private {
  font-size: 0;
}
.forward-channel-mark.is-private .ico-lock {
  width: 14px;
  height: 16px;
  opacity: .7;
  color: #5b6170;
}
.forward-channel-mark.is-private .ico-lock::before {
  left: 3px;
  width: 8px;
  height: 7px;
}
.forward-channel-mark.is-private .ico-lock::after {
  width: 14px;
  height: 10px;
}
.nav-label {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  margin-left: auto; flex: 0 0 auto; background: rgba(255,255,255,.28); color: #fff; border-radius: 10px;
  min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-item .badge { background: var(--accent-mark); color: #0b1220; }
.badge.mention { background: #d24b4e; color: #fff; }
.section-head .badge {
  margin-left: 6px; margin-right: auto; background: var(--accent-mark); color: #0b1220;
}
.section-head .badge.hidden { display: none !important; }
.side-empty { font-size: 12px; opacity: .7; padding: 4px 16px 10px; }
#admin-users .side-empty { color: #6b7080; opacity: 1; padding-left: 0; }
.accounts-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  min-width: 0;
}
.accounts-panel-head h1 {
  margin: 0;
  min-width: 0;
  flex: 1;
}
.accounts-panel-head .accounts-add-user {
  flex: none;
  padding: 2px 0;
  margin: 0;
}
.accounts-add-user {
  appearance: none; border: 0; background: transparent; color: #6b7080;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 2px 4px;
  font: inherit; font-size: calc(14px * var(--text-scale, 1)); font-weight: 400;
  cursor: pointer; align-self: flex-start;
}
.accounts-add-user:hover { color: #1f2430; }
.accounts-add-user.hidden,
.accounts-add-user[hidden] { display: none !important; }
.accounts-add-user-ico {
  width: 20px; height: 20px; display: grid; place-items: center;
  font-size: 18px; line-height: 1; font-weight: 500;
}
.accounts-add-dialog { width: min(420px, 100%); }
.accounts-add-search {
  width: 100%; box-sizing: border-box; border: 1px solid #e4e7ec; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: calc(15px * var(--text-scale, 1));
  color: #1a1d26; background: #fff; margin-bottom: 10px;
}
.accounts-add-search:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, #fff); outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 40%, #d0d4dc);
}
.accounts-add-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: min(360px, 55vh); overflow: auto;
}
.accounts-add-option {
  appearance: none; border: 0; border-radius: 10px; background: transparent;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; padding: 10px 12px; margin: 0;
  cursor: pointer; font: inherit; color: #1a1d26; box-sizing: border-box;
}
.accounts-add-option:hover {
  background: color-mix(in srgb, var(--accent, #1c58d9) 10%, #fff);
}
.accounts-add-option strong {
  font-size: calc(14px * var(--text-scale, 1)); font-weight: 600;
}
.accounts-add-option span {
  color: #8b8e98; font-size: calc(12px * var(--text-scale, 1));
}
.sidebar-scroll::-webkit-scrollbar, .messages::-webkit-scrollbar, .rhs-list::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 4px; }
.rhs-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.messages {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
.messages:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}
.messages:hover {
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.me-bar { position: relative; }
.me-button {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  background: transparent; border: none; border-radius: 50%; color: var(--text-strong);
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}
.me-button:hover,
.me-button:focus,
.me-button:focus-visible,
.me-button:active {
  background: transparent;
  outline: none;
  box-shadow: none;
}
.me-button .avatar {
  width: 32px; height: 32px; min-width: 32px; min-height: 32px; max-width: 32px; max-height: 32px;
  flex: 0 0 32px; font-size: 12px;
}
.user-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 280px;
  background: #fff; color: var(--text-strong); border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
  padding: 6px 0; text-align: left; max-height: calc(100vh - 80px); overflow: auto;
}
.me-bar:hover .user-menu, .me-bar.menu-open .user-menu { display: block; }
.me-bar.menu-suppressed:hover .user-menu { display: none; }
.user-menu.in-panel { display: block; position: static; width: 100%; max-height: none; box-shadow: none; border-radius: 0; }
.account-host { overflow: auto; flex: 1; }
/* Rail avatar stays visible so it can toggle the profile card closed. */
.app.settings-open .user-menu { display: none !important; }
.user-menu-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px 14px; }
.user-menu-head .avatar {
  width: 52px; height: 52px; min-width: 52px; min-height: 52px; max-width: 52px; max-height: 52px;
  flex: 0 0 52px; font-size: 18px;
}
.user-menu-head .avatar .presence {
  width: 14px; height: 14px; right: 0; bottom: 0;
}
.rhs-head .user-menu-head { flex: 1; min-width: 0; padding: 0 8px 0 0; }
.rhs-head .user-menu-head .avatar {
  width: 36px; height: 36px; min-width: 36px; min-height: 36px; max-width: 36px; max-height: 36px;
  flex: 0 0 36px; font-size: 14px;
}
.user-menu-id { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.user-menu-ask {
  color: #8b8e98; font-size: 12px; font-weight: 500; line-height: 1.2;
}
.user-menu-id strong { font-size: 16px; line-height: 1.25; }
.user-menu-id span { color: #6b7080; font-size: 13px; }
.user-menu-custom:empty { display: none; }
.user-menu-row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border: none; border-top: 1px solid #f0f0f0; background: #fff; color: var(--text-strong); text-align: left; font-size: 15px;
}
.user-menu-row:hover { background: var(--accent-soft); }
.user-menu-row.selected { color: var(--accent); background: var(--accent-soft); }
#availability-toggle .chevron, #card-availability-toggle .chevron {
  margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #8b8e98; border-bottom: 2px solid #8b8e98;
  transform: rotate(45deg); transition: transform .15s ease;
}
#availability-toggle[aria-expanded="true"] .chevron,
#card-availability-toggle[aria-expanded="true"] .chevron { transform: rotate(-135deg); }
.availability-list .user-menu-row { padding-left: 28px; min-height: 44px; }
.status-ico {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  flex: none; position: relative; background: #e8eaef; color: #5b6070;
}
.status-ico.online { background: #3db887; }
.status-ico.away { background: #f5a623; }
.status-ico.dnd { background: #d24b4e; }
.status-ico.offline { background: transparent; border: 2px solid #c5c8d0; }
.status-ico.online::before {
  content: ""; width: 5px; height: 9px; border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}
.status-ico.away::before {
  content: ""; width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%;
  border-right-color: transparent; transform: rotate(-45deg);
}
.status-ico.dnd::before {
  content: ""; width: 10px; height: 2px; background: #fff; border-radius: 1px;
}
.status-ico.status-custom::before {
  content: ""; width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 50%;
  box-shadow: inset 0 -3px 0 currentColor;
}
.status-ico.status-profile::before {
  content: ""; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%;
  margin-top: -5px;
}
.status-ico.status-profile::after {
  content: ""; width: 12px; height: 6px; border: 2px solid currentColor; border-bottom: none;
  border-radius: 8px 8px 0 0; margin-top: 8px; position: absolute;
}
.status-ico.status-logout::before {
  content: ""; width: 8px; height: 8px; border: 2px solid currentColor; border-left: none;
  border-radius: 0 3px 3px 0; margin-left: 2px;
}
.status-ico.status-logout::after {
  content: ""; position: absolute; left: 4px; width: 8px; height: 2px; background: currentColor;
  box-shadow: 3px -3px 0 -0.5px currentColor, 3px 3px 0 -0.5px currentColor;
}
.user-menu-form { padding: 8px 16px 10px; border-top: 1px solid #f0f0f0; }
.user-menu-form input { width: 100%; border: 1px solid #d0d4dc; border-radius: 4px; padding: 8px 10px; }
.popover {
  position: absolute; left: 60px; bottom: 8px; background: #fff; color: #3f4350;
  border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.2); min-width: 180px; z-index: 13; padding: 6px 0;
}
.popover button {
  display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 14px; color: #3f4350;
}
.popover button:hover { background: #f2f4f8; }

.main {
  position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  overflow: hidden;
  background: transparent;
}
.chat-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--wallpaper-color, #d0e7f5);
  background-image: var(--wallpaper-gradient, none);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  overflow: hidden;
}
.chat-wallpaper::after {
  content: none;
  display: none;
}
html[data-wallpaper="pattern"] .chat-wallpaper::after {
  content: none;
  display: none;
}
html[data-wallpaper="custom"] .chat-wallpaper {
  background-image: var(--wallpaper-image-mobile, none);
  background-size: var(--wallpaper-size-mobile, cover);
  background-position: var(--wallpaper-pos-mobile, center center);
}
html[data-wallpaper="space"] .chat-wallpaper {
  background-color: var(--wallpaper-color, #d0e7f5);
  background-image:
    var(--wallpaper-image-mobile, none),
    var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
  background-size: var(--wallpaper-size-mobile, cover), cover;
  background-position: var(--wallpaper-pos-mobile, center center), center;
  background-repeat: no-repeat, no-repeat;
}
html[data-wallpaper="custom"] .chat-wallpaper::after,
html[data-wallpaper="space"] .chat-wallpaper::after {
  content: none;
  display: none;
}
@media (min-width: 801px) {
  html[data-wallpaper="custom"] .chat-wallpaper {
    background-image: var(--wallpaper-image-desktop, none);
    background-size: var(--wallpaper-size-desktop, cover);
    background-position: var(--wallpaper-pos-desktop, center center);
  }
  html[data-wallpaper="space"] .chat-wallpaper {
    background-image:
      var(--wallpaper-image-desktop, none),
      var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
    background-size: var(--wallpaper-size-desktop, cover), cover;
    background-position: var(--wallpaper-pos-desktop, center center), center;
  }
  html[data-wallpaper="custom"],
  html[data-wallpaper="custom"] body {
    background-image: var(--wallpaper-image-desktop, none);
    background-size: var(--wallpaper-size-desktop, cover);
    background-position: var(--wallpaper-pos-desktop, center center);
  }
  html[data-wallpaper="space"],
  html[data-wallpaper="space"] body {
    background-image:
      var(--wallpaper-image-desktop, none),
      var(--wallpaper-space-gradient, linear-gradient(135deg, #fff2ff 0%, #eed5f0 25%, #dbcdf8 50%, #81d1f5 75%, #72cbf1 100%));
    background-size: var(--wallpaper-size-desktop, cover), cover;
    background-position: var(--wallpaper-pos-desktop, center center), center;
  }
}
.main > *:not(.chat-wallpaper) {
  position: relative;
  z-index: 1;
}
/* Win over the rule above — settings/feature/TG Web overlays must be absolute. */
.main > .settings-screen,
.main > .feature-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
}
/* Reconnect strip kept in DOM for layout hooks; text banner removed. */
.banner { display: none !important; }
