/* Category nav buttons */
.category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  color: #334155;
  transition: background 0.15s;
}
.category-btn:hover { background: #f1f5f9; }
.category-btn.active { background: #d1fae5; color: #065f46; font-weight: 600; }
.badge {
  min-width: 1.5rem;
  padding: 0 0.4rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: #e2e8f0;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
}
.category-btn.active .badge { background: #10b981; color: #fff; }
.badge.has-unread { background: #10b981; color: #fff; }

.icon-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #64748b; transition: background .15s;
}
.icon-btn:hover { background: #f1f5f9; }

/* Conversation items (Google Messages style) */
.conversation-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; cursor: pointer;
  border-bottom: 1px solid #f1f5f9; transition: background .15s;
}
.conversation-item:hover { background: #f8fafc; }
.conversation-item.active { background: #ecfdf5; }
.avatar {
  width: 2.75rem; height: 2.75rem; border-radius: 9999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 1.1rem;
}
.conversation-item .name { font-weight: 500; font-size: 0.95rem; }
.conversation-item.unread .name,
.conversation-item.unread .preview { font-weight: 700; color: #0f172a; }
.preview { font-size: 0.8rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 0.7rem; color: #94a3b8; white-space: nowrap; }
.unread-dot {
  min-width: 1.25rem; height: 1.25rem; border-radius: 9999px; background: #10b981; color: #fff;
  font-size: 0.7rem; display: inline-flex; align-items: center; justify-content: center; padding: 0 0.3rem;
}
.cat-pill {
  font-size: 0.6rem; padding: 0.05rem 0.4rem; border-radius: 9999px; text-transform: uppercase; letter-spacing: .03em;
}
.cat-new { background: #dbeafe; color: #1d4ed8; }
.cat-accepted { background: #d1fae5; color: #047857; }
.cat-source { background: #fef3c7; color: #b45309; }
.cat-rejected { background: #ffe4e6; color: #be123c; }
.cat-distributor { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; }
.cat-wholesaler { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }
.cat-wholeseller { background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }

/* Chat bubbles */
.bubble {
  max-width: 75%; padding: 0.5rem 0.75rem; border-radius: 0.75rem;
  font-size: 0.9rem; line-height: 1.4; box-shadow: 0 1px 1px rgba(0,0,0,.08);
  white-space: pre-wrap; word-break: break-word; position: relative;
}
.bubble-row { display: flex; }
.bubble-row.in { justify-content: flex-start; }
.bubble-row.out { justify-content: flex-end; }
.bubble.in { background: #fff; border-top-left-radius: 0.2rem; }
.bubble.out.human { background: #d9fdd3; border-top-right-radius: 0.2rem; }
.bubble.out.bot { background: #e0e7ff; border-top-right-radius: 0.2rem; }
.bubble .meta {
  display: flex; gap: 0.4rem; justify-content: flex-end; align-items: center;
  font-size: 0.65rem; color: #64748b; margin-top: 0.2rem;
}
.bubble .sender-tag { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; }
.bubble.bot .sender-tag { color: #4338ca; }
.bubble.human .sender-tag { color: #047857; }
.day-divider {
  text-align: center; font-size: 0.7rem; color: #64748b; margin: 0.75rem 0;
}
.day-divider span { background: #fff; padding: 0.2rem 0.7rem; border-radius: 9999px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }

/* Modals */
.modal { border: none; border-radius: 1rem; padding: 1.5rem; width: 90%; max-width: 26rem; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.modal::backdrop { background: rgba(0,0,0,.4); }
.input { width: 100%; border: 1px solid #cbd5e1; border-radius: 0.6rem; padding: 0.55rem 0.75rem; font-size: 0.9rem; }
.input:focus { outline: none; box-shadow: 0 0 0 2px #6ee7b7; }
.btn-primary { background: #10b981; color: #fff; border-radius: 0.6rem; padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn-primary:hover { background: #059669; }
.btn-secondary { background: #f1f5f9; color: #334155; border-radius: 0.6rem; padding: 0.5rem 1rem; font-size: 0.9rem; }

#toast.show { opacity: 1; }

/* Mobile: show either list or chat */
@media (max-width: 767px) {
  #inbox-app.chat-open #conversation-panel { display: none; }
  #inbox-app.chat-open #chat-panel { display: flex; }
}


/* Human Team Category and Task Card */
.cat-human_team { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; font-weight: 600; }
.badge[data-count="human_team"].has-unread { background: #9333ea; color: #fff; }
.category-btn[data-category="human_team"].active { background: #f3e8ff; color: #7e22ce; font-weight: 600; }
.category-btn[data-category="human_team"].active .badge { background: #9333ea; color: #fff; }

/* ===== Human Team Prominent Red Mark Styling ===== */
.conversation-item.is-human-alert {
  background: #fff1f2 !important;
  border-left: 5px solid #dc2626 !important;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.12) !important;
}
.conversation-item.is-human-alert:hover {
  background: #fee2e2 !important;
}
.conversation-item.is-human-alert.active {
  background: #fecaca !important;
  border-left: 6px solid #b91c1c !important;
}

.human-red-badge {
  background: #dc2626 !important;
  color: #ffffff !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  padding: 0.15rem 0.6rem !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.45) !important;
  letter-spacing: 0.02em !important;
  animation: pulseRed 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseRed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(1.02); }
}

.category-btn[data-category="human_team"] {
  color: #be123c !important;
}
.category-btn[data-category="human_team"] i {
  color: #e11d48 !important;
}
.category-btn[data-category="human_team"]:hover {
  background: #ffe4e6 !important;
}
.category-btn[data-category="human_team"].active {
  background: #ffe4e6 !important;
  color: #9f1239 !important;
  border: 1px solid #fecdd3 !important;
}
.category-btn[data-category="human_team"].active .badge,
.badge[data-count="human_team"] {
  background: #e11d48 !important;
  color: #fff !important;
  font-weight: 700 !important;
}
.badge[data-count="human_team"].has-unread {
  background: #be123c !important;
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.6) !important;
}

/* Quick Task OK Button in Conversation Row */
.quick-task-ok-btn {
  font-size: 0.7rem !important;
  line-height: 1 !important;
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
}
.quick-task-ok-btn:hover {
  transform: scale(1.05);
}
.quick-task-ok-btn:active {
  transform: scale(0.96);
}
