/* Chat dock overflow hotfix: keep only fitting large cards and move the rest into compact side bubbles. */
.app-shell .global-chat-dock.open .global-chat-bubbles {
  box-sizing: border-box !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: stretch !important;
  gap: 12px !important;
  width: auto !important;
  max-width: calc(100vw - 96px) !important;
  margin-left: auto !important;
  margin-right: 16px !important;
  padding: 12px 0 12px 12px !important;
  overflow: visible !important;
  scrollbar-width: none !important;
}

.app-shell .global-chat-dock.open .global-chat-bubbles::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.app-shell .global-chat-dock.open .chat-bubble.mitera-dock-hidden {
  display: none !important;
}

.app-shell .global-chat-dock.open .chat-bubble {
  flex: 0 0 min(360px, calc(100vw - 112px)) !important;
  width: min(360px, calc(100vw - 112px)) !important;
  max-width: min(360px, calc(100vw - 112px)) !important;
  min-width: min(270px, calc(100vw - 112px)) !important;
  margin: 0 !important;
  overflow: visible !important;
  box-shadow: none !important;
}

.app-shell .global-chat-dock.open .chat-bubble-main {
  min-height: 72px !important;
  padding-right: 2.65rem !important;
}

.app-shell .global-chat-dock.open .chat-bubble-count {
  top: 0.34rem !important;
  left: 0.34rem !important;
  right: auto !important;
  z-index: 6 !important;
  min-width: 1.42rem !important;
  height: 1.42rem !important;
  padding: 0 0.36rem !important;
  border: 2px solid #fff !important;
  border-radius: 999px !important;
  background: #d73931 !important;
  color: #fff !important;
  box-shadow: none !important;
  font-size: 0.76rem !important;
  font-style: normal !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
}

.app-shell .mitera-chat-compact-rail {
  position: fixed;
  right: 14px;
  bottom: 104px;
  z-index: 95;
  display: grid;
  gap: 8px;
  width: min(178px, calc(100vw - 28px));
  pointer-events: none;
}

.app-shell .mitera-chat-compact-item {
  position: relative;
  min-height: 46px;
  width: 100%;
  border: 1px solid rgba(4, 100, 93, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: #151a21;
  box-shadow: 0 10px 24px rgba(21, 27, 34, 0.12);
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 34px 8px 10px;
  pointer-events: auto;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.app-shell .mitera-chat-compact-item:hover,
.app-shell .mitera-chat-compact-item:focus-visible {
  border-color: rgba(4, 100, 93, 0.42);
  background: #fff;
  transform: translateY(-1px);
  outline: none;
}

.app-shell .mitera-chat-compact-item svg {
  color: #0d6b64;
  width: 20px;
  height: 20px;
}

.app-shell .mitera-chat-compact-item.is-task svg {
  color: #f04412;
}

.app-shell .mitera-chat-compact-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 780;
  line-height: 1.1;
}

.app-shell .mitera-chat-compact-count {
  position: absolute;
  top: -7px;
  left: -7px;
  min-width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #d73931;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1;
}

.app-shell .mitera-chat-compact-close {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #e8f3f1;
  color: #075c57;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.14s ease, background 0.14s ease;
}

.app-shell .mitera-chat-compact-item:hover .mitera-chat-compact-close,
.app-shell .mitera-chat-compact-item:focus-within .mitera-chat-compact-close {
  opacity: 1;
}

.app-shell .mitera-chat-compact-close:hover,
.app-shell .mitera-chat-compact-close:focus-visible {
  opacity: 1;
  background: #d8eeeb;
  outline: none;
}

@media (max-width: 760px) {
  .app-shell .global-chat-dock.open .global-chat-bubbles {
    max-width: calc(100vw - 18px) !important;
    margin-right: 9px !important;
    padding-left: 8px !important;
  }

  .app-shell .global-chat-dock.open .chat-bubble {
    flex-basis: min(318px, calc(100vw - 34px)) !important;
    width: min(318px, calc(100vw - 34px)) !important;
    max-width: min(318px, calc(100vw - 34px)) !important;
    min-width: min(250px, calc(100vw - 34px)) !important;
  }

  .app-shell .mitera-chat-compact-rail {
    right: 10px;
    bottom: 92px;
    width: min(148px, calc(100vw - 20px));
  }
}
