/* Comms module styles: chat (threads + conversation), topbar bell/message icons, notification cards. */

/* ---------- topbar icons (message + bell) ---------- */
.tb-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted-fg);
  cursor: pointer;
  text-decoration: none;
}
.tb-btn:hover { background: var(--muted); color: var(--foreground); }
.tb-btn svg { width: 19px; height: 19px; }
.tb-btn-wrap { position: relative; display: inline-flex; }
.tb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--destructive);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.tb-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 420px;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 60;
}
.tb-panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
}
.tb-panel-list { display: grid; }
.tb-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.tb-item:hover { background: var(--muted); }
.tb-item.unread { background: var(--primary-5); }
.tb-item-t { font-size: 13px; font-weight: 600; }
.tb-item-b { font-size: 12px; color: var(--muted-fg); margin-top: 2px; }
.tb-item-time { font-size: 11px; color: var(--muted-fg); margin-top: 4px; }

/* ---------- avatar color variants (deterministic per employee/thread) ---------- */
.avatar.av0 { background: linear-gradient(135deg, #3b82f6, #4f46e5); }
.avatar.av1 { background: linear-gradient(135deg, #10b981, #059669); }
.avatar.av2 { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.avatar.av3 { background: linear-gradient(135deg, #f97316, #ea580c); }
.avatar.av4 { background: linear-gradient(135deg, #ec4899, #db2777); }
.avatar.av5 { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.avatar.av6 { background: linear-gradient(135deg, #eab308, #ca8a04); }
.avatar.av7 { background: linear-gradient(135deg, #6366f1, #4338ca); }

/* ---------- chat ---------- */
.chat-wrap {
  display: flex;
  gap: 16px;
  height: calc(100dvh - 180px);
  min-height: 420px;
}
.chat-list { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-list-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-threads { flex: 1; overflow-y: auto; }
.chat-thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.chat-thread-item:hover { background: var(--muted); }
.chat-thread-item.on { background: var(--primary-5); border-left-color: var(--primary); }
.chat-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.chat-pane-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--muted);
  align-self: flex-start;
  font-size: 13px;
}
.chat-bubble.mine { background: var(--primary-10); align-self: flex-end; }
.chat-bubble .mention { color: var(--primary); }
.chat-bubble .att-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--primary);
  text-decoration: underline;
  font-size: 12px;
}
.chat-bubble .att-dl svg { width: 14px; height: 14px; }
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chat-composer textarea.input { min-height: 38px; max-height: 120px; resize: none; }
.chat-mentions {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  max-height: 160px;
  overflow-y: auto;
  z-index: 10;
}
.mention-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}
.mention-opt:hover { background: var(--muted); }

@media (max-width: 767px) {
  .chat-wrap { flex-direction: column; height: calc(100dvh - 140px); }
  .chat-list { width: 100%; max-height: 40%; }
}

/* ---------- chat image previews ---------- */
.chat-bubble .att-img { display: block; text-decoration: none; margin-top: 4px; }
.chat-bubble .att-img img {
  display: block;
  max-width: 240px;
  max-height: 240px;
  min-width: 60px;
  min-height: 40px;
  border-radius: 8px;
  background: var(--muted);
  object-fit: cover;
}
@media (max-width: 767px) {
  .chat-bubble .att-img img { max-width: 100%; }
}
