.floating-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147482600;
  font-size: 14px;
}

.floating-chat__toggle {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: #0f766e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.28);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.floating-chat.is-dragging .floating-chat__toggle {
  cursor: grabbing;
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.38);
}

.floating-chat__toggle i {
  font-size: 1.45rem;
}

.floating-chat__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 12px;
  line-height: 22px;
  font-weight: 700;
}

.floating-chat__panel {
  position: fixed;
  width: min(820px, calc(100vw - 24px));
  height: min(620px, calc(100vh - 96px));
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.floating-chat__header {
  min-height: 64px;
  padding: 12px 14px;
  background: #0f766e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: grab;
  touch-action: none;
}

.floating-chat__header:active { cursor: grabbing; }

.floating-chat__body {
  height: calc(100% - 64px);
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 0;
}

.floating-chat__rooms {
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 10px;
  min-height: 0;
  overflow-y: auto;
}

.floating-chat__tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}


.floating-chat__tab {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-weight: 700;
  padding: 7px 4px;
  white-space: nowrap;
}

.floating-chat__search {
  margin-bottom: 8px;
}

.floating-chat__tab.is-active {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.floating-chat__room-list,
.floating-chat__people-list,
.floating-chat__friends {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.floating-chat__friend-form {
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  background: #ecfdf5;
}

.floating-chat__friend-section + .floating-chat__friend-section {
  margin-top: 10px;
}

.floating-chat__friend-heading {
  margin-bottom: 5px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.floating-chat__friend-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}


.floating-chat__people-group {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.floating-chat__people-group + .floating-chat__people-group {
  margin-top: 6px;
}

.floating-chat__people-heading {
  align-items: center;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  grid-template-columns: 14px 1fr auto;
  list-style: none;
  padding: 8px;
}

.floating-chat__people-heading::-webkit-details-marker {
  display: none;
}

.floating-chat__people-heading i {
  transition: transform .16s ease;
}

.floating-chat__people-group[open] .floating-chat__people-heading i {
  transform: rotate(90deg);
}

.floating-chat__people-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}

.floating-chat__person {
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  display: flex;
  gap: 8px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.floating-chat__person:hover {
  border-color: #0f766e;
  background: #ecfdf5;
}

.floating-chat__person-avatar {
  align-items: center;
  background: #e2e8f0;
  border-radius: 999px;
  color: #334155;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.floating-chat__person-body {
  min-width: 0;
}

.floating-chat__person-name,
.floating-chat__person-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat__person-name {
  color: #0f172a;
  font-weight: 700;
}

.floating-chat__person-meta {
  color: #64748b;
  font-size: 12px;
}

.floating-chat__room {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
  text-align: left;
  display: block;
  width: 100%;
}

.floating-chat__room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 4px;
}

.floating-chat__recent-remove {
  width: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #94a3b8;
}

.floating-chat__recent-remove:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #dc2626;
}

.floating-chat__room:hover,
.floating-chat__room.is-active {
  border-color: #0f766e;
  background: #ecfdf5;
}

.floating-chat__room-name {
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat__room-meta {
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.floating-chat__conversation {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.floating-chat__empty {
  margin: auto;
  color: #64748b;
}

.floating-chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.floating-chat__message {
  max-width: 82%;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.floating-chat__message.is-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.floating-chat__bubble {
  border-radius: 8px;
  padding: 8px 10px;
  background: #f1f5f9;
  color: #0f172a;
  max-width: 100%;
  width: fit-content;
  white-space: pre-wrap;
  word-break: break-word;
}

.floating-chat__message.is-mine .floating-chat__bubble {
  background: #0f766e;
  color: #ffffff;
}

.floating-chat__message-meta {
  margin-bottom: 3px;
  color: #64748b;
  font-size: 12px;
}

.floating-chat__message.is-mine .floating-chat__message-meta {
  text-align: right;
}

.floating-chat__manage-bar {
  border-top: 1px solid #e2e8f0;
  padding: 8px 10px 0;
  display: flex;
  justify-content: flex-end;
}

.floating-chat__composer {
  border-top: 1px solid #e2e8f0;
  padding: 10px;
  display: flex;
  gap: 8px;
}

.floating-chat__members-panel,
.floating-chat__new-room {
  position: absolute;
  left: 10px;
  top: 74px;
  width: 220px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
}



.floating-chat__file-list {
  border-top: 1px solid #e2e8f0;
  padding: 0 10px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.floating-chat__attach {
  flex: 0 0 auto;
}

.floating-chat__attachments {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.floating-chat__attachment-image {
  display: block;
  max-width: min(260px, 72vw);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.floating-chat__attachment-image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.floating-chat__attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(300px, 76vw);
  padding: 7px 9px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  text-decoration: none;
}

.floating-chat__attachment-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat__member-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.floating-chat__member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.floating-chat__room-meta > span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


[data-chat-full-title] {
  position: relative;
}

[data-chat-full-title]:hover::after {
  background: #0f172a;
  border-radius: 6px;
  bottom: calc(100% + 6px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .22);
  color: #ffffff;
  content: attr(data-chat-full-title);
  font-size: 12px;
  left: 8px;
  line-height: 1.4;
  max-width: 320px;
  padding: 7px 9px;
  position: absolute;
  white-space: normal;
  width: max-content;
  z-index: 10;
}

.floating-chat__member span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .floating-chat {
    right: 12px;
    bottom: 12px;
  }

  .floating-chat__panel {
    height: min(680px, calc(100vh - 88px));
  }

  .floating-chat__body {
    grid-template-columns: 1fr;
    grid-template-rows: 168px 1fr;
  }

  .floating-chat__rooms {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .floating-chat__room-list,
  .floating-chat__people-list,
  .floating-chat__friends {
    max-height: 108px;
    overflow-y: auto;
  }

  [data-chat-full-title]:hover::after {
    left: 0;
    max-width: 260px;
  }

  .floating-chat__members-panel,
  .floating-chat__new-room {
    left: 10px;
    right: 10px;
    width: auto;
  }
}
