/* ── CHAT STYLES ── */

/* Chat Dock Panel */
.chat-panel-dock {
  --chat-shift-x: 0px;
  --chat-origin-x: 0px;
  --chat-origin-y: 0px;
  position: fixed;
  bottom: 10px;
  right: calc(84px + var(--chat-shift-x));
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 520px;
  border-radius: 22px;
  background: linear-gradient(170deg, rgba(16, 20, 36, .97), rgba(12, 16, 28, .95));
  border: 1.5px solid rgba(193, 226, 255, .22);
  backdrop-filter: blur(24px) saturate(1.18);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  box-shadow: 0 32px 64px rgba(0, 0, 0, .58), 0 0 0 1px rgba(255, 255, 255, .04) inset, inset 0 1px 1px rgba(255, 255, 255, .12);
  display: flex;
  flex-direction: column;
  z-index: 2500;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(var(--chat-origin-x), calc(var(--chat-origin-y) + 12px), 0) scale(.74);
  transform-origin: calc(100% - 20px) calc(100% - 16px);
  transition: right .26s cubic-bezier(.2, .8, .2, 1), opacity .24s cubic-bezier(.22, .9, .24, 1), transform .24s cubic-bezier(.22, .9, .24, 1), visibility .24s ease;
  visibility: hidden;
  pointer-events: none;
}

.chat-panel-dock:not(.hidden) {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  visibility: visible;
  pointer-events: all;
}

.chat-panel-dock.hidden {
  display: flex;
}

.chat-panel-dock.drag-over {
  border-color: rgba(122, 195, 255, .82);
  box-shadow: 0 32px 64px rgba(62, 128, 255, .38), inset 0 0 0 2px rgba(122, 195, 255, .32);
}

.chat-panel-dock.convos-open .chat-convos {
  display: flex;
}

.chat-panel-dock.convos-open .chat-convos,
.chat-panel-dock.friends-open .chat-friends,
.chat-panel-dock.groups-open .chat-groups {
  z-index: 12;
}

.chat-panel-dock.friends-open .chat-friends {
  display: flex;
}

body.dock-expanded .chat-panel-dock {
  --chat-shift-x: 150px;
}

@media (max-width: 600px) {
  .chat-panel-dock {
    bottom: 80px;
    right: 10px;
    width: calc(100vw - 20px);
    height: 72vh;
    max-height: 520px;
    --chat-shift-x: 0px;
    transform-origin: calc(100% - 20px) calc(100% - 20px);
  }

  body.dock-expanded .chat-panel-dock {
    --chat-shift-x: 0px;
  }
}

/* Chat Side Rail — hidden, kept for DOM compat */
.chat-side-rail {
  display: none;
}

/* Chat Head */
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-title-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #59f2a2;
  box-shadow: 0 0 0 4px rgba(89, 242, 162, .18);
  flex-shrink: 0;
}

.chat-title-main {
  font-size: 14px;
  font-weight: 800;
  color: #f2f7ff;
  line-height: 1.2;
}

.chat-title-sub {
  margin-top: 3px;
  font-size: 11px;
  color: rgba(220, 232, 255, .55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-mini-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 9px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, .09);
  color: rgba(233, 242, 255, .86);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}

.chat-mini-btn:hover {
  background: rgba(255, 255, 255, .18);
  transform: scale(1.05);
}

.chat-head-nav-btn {
  position: relative;
}

.chat-head-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(238, 90, 90, .45);
}

.chat-head-badge[hidden] {
  display: none !important;
}

.chat-nav-ico-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-nav-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b6b, #c94cff);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(200, 76, 255, .35);
}

.chat-nav-badge[hidden] {
  display: none !important;
}

.chat-friend-section {
  margin-bottom: 14px;
}

.chat-friend-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(180, 210, 255, .45);
  margin-bottom: 8px;
  padding: 0 2px;
}

.chat-friend-section-hint {
  font-size: 11px;
  color: rgba(200, 220, 255, .38);
  padding: 8px 4px 4px;
  line-height: 1.35;
}

.chat-friend-btn.cancel-out {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: rgba(230, 238, 255, .75);
  font-size: 11px;
  padding: 0 10px;
}

.chat-friend-btn.cancel-out:hover {
  background: rgba(255, 100, 120, .15);
  border-color: rgba(255, 120, 140, .35);
  color: #ffb8c0;
}

.chat-friend-item--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.chat-friend-item--stacked .chat-friend-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.chat-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .84);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close:hover {
  background: rgba(255, 80, 80, .18);
  color: #ff9090;
}

.chat-local-mode-banner {
  display: none;
  align-items: flex-start;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 230, 200, .92);
  background: rgba(255, 160, 60, .16);
  border: 1px solid rgba(255, 190, 120, .28);
}

.chat-local-mode-banner code {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .25);
}

/* Chat Messages List */
.chat-list {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-list::-webkit-scrollbar {
  width: 4px;
}

.chat-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 99px;
}

.chat-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .2);
}

/* Chat Message Styles */
.chat-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .08);
  align-self: flex-start;
  transition: background .15s;
}

.chat-msg:hover {
  background: rgba(255, 255, 255, .1);
}

.chat-msg.own {
  align-self: flex-end;
  background: linear-gradient(145deg, rgba(113, 182, 255, .32), rgba(87, 120, 255, .28));
  border-color: rgba(173, 218, 255, .2);
}

.chat-msg.own:hover {
  background: linear-gradient(145deg, rgba(113, 182, 255, .4), rgba(87, 120, 255, .36));
}

.chat-msg.board-item {
  background: linear-gradient(155deg, rgba(86, 161, 255, .22), rgba(150, 110, 255, .18));
  border-color: rgba(187, 218, 255, .22);
}

.chat-msg.system {
  max-width: 100%;
  align-self: center;
  background: linear-gradient(145deg, rgba(106, 246, 182, .1), rgba(57, 226, 214, .08));
  border-color: rgba(126, 244, 208, .18);
  padding: 8px 12px;
}

.chat-msg.request {
  background: linear-gradient(150deg, rgba(255, 196, 77, .16), rgba(255, 137, 61, .1));
  border-color: rgba(255, 196, 77, .24);
}

.chat-msg.new-incoming {
  animation: chatMsgIn .28s cubic-bezier(.2, .8, .2, 1);
}

@keyframes chatMsgIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-board-preview {
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  overflow: hidden;
  background: rgba(255, 255, 255, .05);
}

.chat-board-preview.postit-mini {
  background: transparent;
  border: none;
  overflow: visible;
}

.chat-mini-postit {
  position: relative;
  width: 138px;
  min-height: 108px;
  padding: 20px 11px 10px;
  border-radius: 2px;
  background: var(--note-tone, #FFE566);
  font-size: 12px;
  line-height: 1.35;
  color: #1c2032;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .28), inset 0 -2px 5px rgba(0, 0, 0, .08);
  transform: rotate(-2.2deg);
}

.chat-mini-postit::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  background: rgba(0, 0, 0, .1);
  opacity: .2;
}

.chat-board-planner {
  padding: 9px 10px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .93), rgba(242, 248, 255, .9));
}

.chat-board-planner-title {
  font-size: 12px;
  font-weight: 800;
  color: #1a2848;
  margin-bottom: 6px;
}

.chat-board-planner-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-board-planner-item {
  font-size: 11px;
  line-height: 1.3;
  color: #243356;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.chat-board-planner-item.done {
  opacity: .58;
  text-decoration: line-through;
}

.chat-auto-msg {
  margin-top: 6px;
  font-size: 10px;
  color: rgba(89, 242, 162, 0.92);
  font-weight: 700;
  padding: 5px 9px;
  background: rgba(89, 242, 162, 0.12);
  border-radius: 8px;
  border-left: 2px solid rgba(89, 242, 162, 0.4);
  display: inline-block;
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.chat-name {
  font-size: 10px;
  font-weight: 800;
  color: rgba(229, 239, 255, .82);
}

.chat-time {
  font-size: 10px;
  color: rgba(229, 239, 255, .42);
}

.chat-text {
  font-size: 13px;
  line-height: 1.45;
  color: #f8fbff;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-system-text {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(222, 255, 243, .92);
  text-align: center;
}

.chat-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  text-decoration: none;
  color: #e9f4ff;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  transition: background .15s;
}

.chat-file:hover {
  background: rgba(255, 255, 255, .14);
}

.chat-file-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-msg-actions {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.chat-reply-btn,
.chat-react-btn {
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #ddeaff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.chat-reply-btn:hover,
.chat-react-btn:hover {
  background: rgba(255, 255, 255, .16);
  transform: scale(1.05);
}

.chat-react-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  font-size: 10px;
  color: #f8fbff;
}

.chat-reply-preview {
  margin-bottom: 5px;
  padding: 6px 9px;
  border-left: 2px solid rgba(122, 195, 255, .55);
  border-radius: 8px;
  background: rgba(122, 195, 255, .1);
}

.chat-reply-title {
  font-size: 10px;
  font-weight: 800;
  color: rgba(210, 232, 255, .82);
}

.chat-reply-body {
  font-size: 11px;
  color: rgba(236, 246, 255, .72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Panels (Friends, Convos, Groups, Board) */
.chat-convos,
.chat-friends,
.chat-groups,
.chat-board-picker {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 56px; /* stops above the bottom nav */
  z-index: 3;
  border: none;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(170deg, rgba(16, 20, 36, .98), rgba(12, 16, 28, .96));
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
}

/* Groups panel visibility */
.chat-panel-dock.groups-open .chat-groups {
  display: flex;
}

.chat-convos-list {
  flex: 1;
  overflow: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-convo-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all .2s;
}

.chat-convo-item:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .16);
}

.chat-convo-item.active {
  border-color: rgba(122, 195, 255, .45);
  background: linear-gradient(145deg, rgba(90, 150, 255, .2), rgba(80, 110, 220, .12));
}

.chat-convo-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-convo-title {
  font-size: 12px;
  font-weight: 800;
  color: #eef5ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-convo-sub {
  font-size: 10px;
  color: rgba(210, 225, 248, .58);
}

.chat-convo-go {
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  color: #ecf4ff;
  font-size: 11px;
  font-weight: 800;
  padding: 7px 12px;
  cursor: pointer;
  transition: all .15s;
}

.chat-convo-go:hover {
  background: rgba(255, 255, 255, .18);
  transform: translateY(-1px);
}

.chat-convo-item--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.chat-convo-item--request-in {
  border-color: rgba(255, 200, 120, .38);
  background: linear-gradient(145deg, rgba(255, 190, 100, .12), rgba(255, 255, 255, .04));
}

.chat-convo-item--request-out {
  border-color: rgba(120, 185, 255, .35);
  background: linear-gradient(145deg, rgba(90, 150, 255, .12), rgba(255, 255, 255, .04));
}

.chat-convo-pill {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  vertical-align: middle;
  background: rgba(255, 200, 120, .25);
  color: #ffe8c4;
}

.chat-convo-pill--out {
  background: rgba(120, 185, 255, .28);
  color: #d4e8ff;
}

.chat-convo-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.chat-convo-actions-row .chat-friend-btn {
  padding: 6px 12px;
  font-size: 11px;
}

.chat-panel-dock.friends-open .chat-friends {
  display: flex;
}

.chat-panel-dock.friends-open {
  animation: sheetOpen .24s cubic-bezier(.22, .9, .24, 1);
}

@keyframes sheetOpen {
  from {
    opacity: .8;
    transform: translate3d(0, 8px, 0) scale(.97);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.chat-sheet-head {
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-size: 14px;
  font-weight: 800;
  color: #edf5ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent);
}

.chat-sheet-head .sheet-emoji {
  font-size: 16px;
  margin-right: 4px;
}

.chat-sheet-close {
  border: none;
  background: rgba(255, 255, 255, .1);
  color: #dfeeff;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  transition: all .2s;
}

.chat-sheet-close:hover {
  background: rgba(255, 255, 255, .18);
}

.chat-sheet-sub {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font-size: 11px;
  color: rgba(220, 232, 255, .5);
}

.chat-friend-add {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.chat-friend-input {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  padding: 0 12px;
  color: #edf4ff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}

.chat-friend-input:focus {
  border-color: rgba(122, 195, 255, .5);
}

.chat-friend-btn {
  height: 36px;
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  background: linear-gradient(140deg, #77c8ff, #7481ff);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}

.chat-friend-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(116, 129, 255, .35);
}

.chat-friend-list,
.chat-board-list {
  flex: 1;
  overflow: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-friend-list::-webkit-scrollbar {
  width: 4px;
}

.chat-friend-list::-webkit-scrollbar-track {
  background: transparent;
}

.chat-friend-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 99px;
}

.chat-friend-item,
.chat-board-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all .2s;
}

.chat-friend-item:hover {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .16);
}

.chat-friend-name {
  font-size: 13px;
  font-weight: 700;
  color: #eef5ff;
}

.chat-friend-tag {
  font-size: 10px;
  color: rgba(220, 232, 255, .55);
}

.chat-friend-item.pending {
  background: linear-gradient(145deg, rgba(255, 196, 77, .14), rgba(255, 137, 61, .1));
  border-color: rgba(255, 196, 77, .28);
}

.chat-friend-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chat-friend-btn.accept {
  background: linear-gradient(140deg, #77ffbb, #35cc98);
  color: #003d20;
}

.chat-friend-btn.accept:hover {
  box-shadow: 0 4px 12px rgba(53, 204, 152, .4);
}

.chat-friend-btn.reject {
  background: rgba(255, 90, 110, .15);
  border: 1px solid rgba(255, 90, 110, .3);
  color: #ff9090;
}

.chat-friend-btn.reject:hover {
  background: rgba(255, 90, 110, .25);
}

/* Delete contact button - visible & accessible */
.chat-friend-btn.remove {
  width: auto;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 70, 90, .1);
  border: 1px solid rgba(255, 70, 90, .28);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  color: #ff8a95;
  cursor: pointer;
  transition: all .2s ease;
}

.chat-friend-btn.remove:hover {
  background: rgba(255, 70, 90, .22);
  border-color: rgba(255, 70, 90, .5);
  color: #ffb0b8;
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(255, 70, 90, .25);
}

.chat-friend-btn.remove .remove-icon {
  font-size: 13px;
  line-height: 1;
}

.chat-friend-btn.remove .remove-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}

.chat-friend-presence {
  font-size: 10px;
  color: rgba(173, 255, 215, .75);
  margin-top: 2px;
}

.chat-board-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-board-title {
  font-size: 12px;
  font-weight: 700;
  color: #eef5ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-board-type {
  font-size: 10px;
  color: rgba(220, 232, 255, .56);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.chat-board-send {
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  color: #ecf4ff;
  font-size: 11px;
  font-weight: 800;
  padding: 7px 12px;
  cursor: pointer;
  transition: all .15s;
}

.chat-board-send:hover {
  background: rgba(255, 255, 255, .18);
  transform: translateY(-1px);
}

/* Delete Confirmation Dialog */
.chat-delete-confirm {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  border-radius: 16px;
  background: linear-gradient(170deg, rgba(22, 26, 42, .98), rgba(18, 20, 34, .96));
  border: 1px solid rgba(255, 100, 120, .25);
  padding: 20px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .6);
  animation: chatMsgIn .2s ease;
}

.chat-delete-confirm-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.chat-delete-confirm-sub {
  font-size: 12px;
  color: rgba(220, 232, 255, .6);
  margin-bottom: 16px;
  line-height: 1.45;
}

.chat-delete-confirm-name {
  color: #ff9aa0;
  font-weight: 700;
}

.chat-delete-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.chat-delete-confirm-actions button {
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.chat-delete-cancel {
  background: rgba(255, 255, 255, .1);
  color: #ddeaff;
}

.chat-delete-cancel:hover {
  background: rgba(255, 255, 255, .18);
}

.chat-delete-go {
  background: linear-gradient(135deg, #ff4466, #cc2244);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 68, 102, .35);
}

.chat-delete-go:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 68, 102, .45);
}

.chat-delete-backdrop {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: rgba(0, 0, 0, .45);
  border-radius: 22px;
}

/* Chat Compose Area */
.chat-compose {
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .035));
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input {
  flex: 1;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  color: #f3f7ff;
  padding: 0 13px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, background .2s;
}

.chat-input:focus {
  border-color: rgba(122, 195, 255, .4);
  background: rgba(255, 255, 255, .08);
}

.chat-input::placeholder {
  color: rgba(220, 232, 255, .38);
}

.chat-btn {
  height: 38px;
  min-width: 38px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, .08);
  color: #f7fbff;
  font-weight: 800;
  padding: 0 14px;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}

.chat-btn.send {
  background: linear-gradient(140deg, #7ac3ff, #6d7dff);
  box-shadow: 0 6px 16px rgba(93, 120, 255, .28);
}

.chat-btn.send:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(93, 120, 255, .4);
}

.chat-note {
  font-size: 10px;
  color: rgba(220, 232, 255, .42);
  line-height: 1.2;
}

.chat-presence-line {
  font-size: 10px;
  color: rgba(176, 233, 255, .68);
  line-height: 1.2;
}

.chat-typing {
  font-size: 10px;
  color: rgba(126, 244, 208, .88);
  font-weight: 700;
  min-height: 13px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .18s ease, transform .18s ease;
}

.chat-typing.show {
  opacity: 1;
  transform: translateY(0);
}

.chat-preview-send {
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-preview-send.show {
  display: flex;
  animation: chatMsgIn .2s ease;
}

.chat-preview-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-preview-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.chat-preview-txt {
  min-width: 0;
}

.chat-preview-title {
  font-size: 11px;
  font-weight: 800;
  color: #ecf6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview-sub {
  font-size: 10px;
  color: rgba(220, 232, 255, .55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-pill-btn {
  height: 28px;
  border: none;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, .1);
  color: #f0f8ff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s;
}

.chat-pill-btn:hover {
  background: rgba(255, 255, 255, .18);
}

.board-incoming-highlight {
  animation: boardPulse 1.8s ease;
}

@keyframes boardPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(102, 255, 204, .6);
  }

  35% {
    box-shadow: 0 0 0 10px rgba(102, 255, 204, 0);
  }

  100% {
    box-shadow: none;
  }
}

/* Floating Message Bubble */
#cf-bubble-stack {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 3500;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}

.cf-bubble {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px 18px 18px 4px;
  background: linear-gradient(145deg, rgba(18, 24, 42, .97), rgba(14, 18, 34, .95));
  border: 1.5px solid rgba(122, 195, 255, .28);
  backdrop-filter: blur(20px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  max-width: 300px;
  min-width: 200px;
  cursor: pointer;
  animation: bubbleIn .32s cubic-bezier(.22, .9, .24, 1);
  transition: transform .18s ease, box-shadow .18s ease;
}

.cf-bubble:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .6);
}

.cf-bubble.removing {
  animation: bubbleOut .28s cubic-bezier(.4, 0, .6, 1) forwards;
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.88);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bubbleOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(12px) scale(.9);
  }
}

.cf-bubble-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(255, 60, 172, .3);
}

.cf-bubble-avatar.req {
  background: linear-gradient(135deg, #ffc44d, #ff893d);
  box-shadow: 0 4px 10px rgba(255, 196, 77, .35);
}

.cf-bubble-avatar.board {
  background: linear-gradient(135deg, #59f2a2, #35cc98);
  box-shadow: 0 4px 10px rgba(89, 242, 162, .3);
  color: #003d20;
}

.cf-bubble-body {
  min-width: 0;
  flex: 1;
}

.cf-bubble-name {
  font-size: 11px;
  font-weight: 800;
  color: rgba(200, 230, 255, .9);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cf-bubble-text {
  font-size: 12px;
  color: #deeeff;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.cf-bubble-text.board-item {
  color: #a0ffd2;
  font-weight: 700;
}

.cf-bubble-actions {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.cf-bubble-btn {
  border: none;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}

.cf-bubble-btn.accept {
  background: linear-gradient(135deg, #59f2a2, #35cc98);
  color: #003d20;
}

.cf-bubble-btn.accept:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 10px rgba(89, 242, 162, .4);
}

.cf-bubble-btn.reply {
  background: rgba(122, 195, 255, .18);
  color: #c8e8ff;
  border: 1px solid rgba(122, 195, 255, .25);
}

.cf-bubble-btn.reply:hover {
  background: rgba(122, 195, 255, .28);
}

.cf-bubble-btn.dismiss {
  background: rgba(255, 255, 255, .07);
  color: rgba(200, 220, 255, .6);
}

.cf-bubble-btn.dismiss:hover {
  background: rgba(255, 255, 255, .13);
}

.cf-bubble-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: rgba(180, 210, 255, .4);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color .15s;
}

.cf-bubble-close:hover {
  color: #fff;
}

/* Chat Contacts Bar */
.chat-contact-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .02);
  min-height: 42px;
  cursor: pointer;
  transition: background .18s;
}

.chat-contact-strip:hover {
  background: rgba(255, 255, 255, .05);
}

.chat-contact-strip.empty {
  justify-content: center;
  cursor: default;
}

.chat-contact-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.chat-contact-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #59f2a2;
  border: 1.5px solid rgba(14, 18, 34, .95);
  box-shadow: 0 0 4px rgba(89, 242, 162, .5);
}

.chat-contact-name {
  font-size: 12px;
  font-weight: 700;
  color: #deeeff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-contact-status {
  font-size: 10px;
  color: rgba(173, 255, 215, .7);
}

.chat-contact-chevron {
  margin-left: auto;
  font-size: 11px;
  color: rgba(150, 200, 255, .4);
}

.chat-contacts-bar {
  display: flex;
  gap: 6px;
  padding: 8px 54px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-contacts-bar::-webkit-scrollbar {
  display: none;
}

.chat-contact-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px 6px;
  border-radius: 10px;
  transition: background .15s;
}

.chat-contact-pill:hover {
  background: rgba(255, 255, 255, .07);
}

.chat-contact-pill.active {
  background: rgba(122, 195, 255, .15);
  outline: 1px solid rgba(122, 195, 255, .3);
}

.chat-contact-pill-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  position: relative;
}

.chat-contact-pill-online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #59f2a2;
  border: 1.5px solid rgba(14, 18, 34, .95);
}

.chat-contact-pill-name {
  font-size: 9px;
  font-weight: 700;
  color: rgba(200, 230, 255, .7);
  max-width: 42px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.chat-contact-pill-unread {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff4444;
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 68, 68, .5);
}

/* Chat Button in Topbar */
.btn-chat {
  background: linear-gradient(140deg, rgba(100, 200, 255, .42), rgba(70, 180, 255, .32));
  box-shadow: 0 10px 22px rgba(100, 150, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative !important;
}

.btn-chat:hover {
  box-shadow: 0 12px 26px rgba(100, 180, 255, .32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-chat.hidden {
  display: none;
}

.btn-chat .chat-ico {
  font-size: 16px;
}

.dock-badge {
  position: absolute;
  right: 4px;
  top: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: #ff4444;
  box-shadow: 0 4px 10px rgba(255, 68, 68, .45);
  display: none;
  pointer-events: none;
}

.dock-badge.show {
  display: block;
  animation: bobble 0.4s ease;
}

@keyframes bobble {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* ── BOTTOM NAVIGATION BAR ── */
.chat-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  height: 56px;
  min-height: 56px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, rgba(16, 20, 36, .96), rgba(12, 16, 28, .98));
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  border-radius: 0 0 22px 22px;
  gap: 4px;
}

/* ── NAV TABS ── */
.chat-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  height: 44px;
  border: none;
  background: none;
  color: rgba(193, 220, 255, .45);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  border-radius: 12px;
  transition: color .2s ease, background .2s ease;
  padding: 5px 6px;
}

.chat-nav-tab i {
  font-size: 15px;
  transition: transform .2s ease;
}

.chat-nav-tab:hover {
  color: rgba(193, 220, 255, .8);
  background: rgba(255, 255, 255, .06);
}

.chat-nav-tab:hover i {
  transform: translateY(-1px);
}

.chat-nav-tab.active {
  color: #7ac3ff;
  background: rgba(122, 195, 255, .12);
}

.chat-nav-tab.active i {
  filter: drop-shadow(0 0 6px rgba(122, 195, 255, .5));
}

/* ── NAV FAB (+) ── */
.chat-nav-fab {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #FF3CAC, #784BA0, #2B86C5);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(255, 60, 172, .38), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .22s cubic-bezier(.22, .9, .24, 1), box-shadow .2s ease;
  flex-shrink: 0;
  margin-left: 4px;
}

.chat-nav-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 26px rgba(255, 60, 172, .52);
}

.chat-nav-fab.active {
  transform: rotate(45deg) scale(1.05);
  box-shadow: 0 8px 22px rgba(120, 75, 160, .5);
}

/* ── PLUS POPOVER ── */
.chat-plus-popover {
  position: absolute;
  bottom: 64px;
  right: 14px;
  width: 226px;
  background: linear-gradient(170deg, rgba(18, 22, 40, .99), rgba(14, 18, 32, .98));
  border: 1px solid rgba(193, 226, 255, .2);
  border-radius: 18px;
  padding: 8px;
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  animation: popoverIn .2s cubic-bezier(.22, .9, .24, 1);
}

.chat-plus-popover.open {
  display: flex;
}

@keyframes popoverIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Decorative arrow pointing down toward the + button */
.chat-plus-popover::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: rgba(18, 22, 40, .99);
  border-right: 1px solid rgba(193, 226, 255, .2);
  border-bottom: 1px solid rgba(193, 226, 255, .2);
  transform: rotate(45deg);
}

.chat-plus-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: none;
  color: rgba(220, 236, 255, .85);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border-radius: 12px;
  text-align: left;
  transition: background .15s, color .15s, transform .15s;
  width: 100%;
}

.chat-plus-item:hover {
  background: rgba(122, 195, 255, .12);
  color: #c8e8ff;
  transform: translateX(2px);
}

.chat-plus-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(122, 195, 255, .14);
  border: 1px solid rgba(122, 195, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  color: #7ac3ff;
  transition: background .15s;
}

.chat-plus-item:hover .chat-plus-item-icon {
  background: rgba(122, 195, 255, .22);
}

/* ── GROUPS PANEL ── */
.chat-groups-list {
  flex: 1;
  overflow: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-groups-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px 16px;
}

.chat-groups-empty i {
  font-size: 36px;
  color: rgba(193, 220, 255, .28);
}

.chat-groups-empty p {
  font-size: 13px;
  color: rgba(193, 220, 255, .45);
  line-height: 1.5;
  max-width: 200px;
}

.chat-new-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(140deg, rgba(122, 195, 255, .28), rgba(109, 125, 255, .2));
  color: #c8e8ff;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(122, 195, 255, .2);
  transition: all .2s;
}

.chat-new-group-btn:hover {
  background: linear-gradient(140deg, rgba(122, 195, 255, .38), rgba(109, 125, 255, .3));
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(122, 195, 255, .2);
}
