.cab-chat-tab {
  display: none;
  flex-direction: column;
  min-height: calc(100dvh - 120px);
}

.cab-chat-tab[style*="block"] {
  display: flex !important;
}

.cab-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #eef2f7;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #dde3ec;
}

.cab-chat__topbar {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5eaf0;
}

.cab-chat__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #050505;
}

.cab-chat__status {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: #64748b;
}

.cab-chat__feed {
  flex: 1;
  min-height: 280px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.cab-chat__bubble {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cab-chat__bubble--out {
  align-self: flex-end;
}

.cab-chat__bubble--in {
  align-self: flex-start;
}

.cab-chat__bubble-text {
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.cab-chat__bubble--out .cab-chat__bubble-text {
  background: #dbeafe;
  color: #0f172a;
  border-bottom-right-radius: 4px;
}

.cab-chat__bubble--in .cab-chat__bubble-text {
  background: #fff;
  color: #111;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.cab-chat__bubble-author {
  font-size: 0.68rem;
  font-weight: 700;
  color: #6c47ff;
  padding-left: 4px;
}

.cab-chat__bubble-meta {
  font-size: 0.62rem;
  color: #94a3b8;
  text-align: right;
  padding-right: 4px;
}

.cab-chat__bubble--pending {
  align-self: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #92400e;
  font-size: 0.72rem;
}

.cab-chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #e5eaf0;
}

.cab-chat__composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: #f8fafc;
  color: #111;
  font: inherit;
  font-size: 0.88rem;
  resize: none;
  outline: none;
}

.cab-chat__composer textarea:focus {
  border-color: #6c47ff;
}

.cab-chat__send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #6c47ff;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cab-chat__feed .empty-state {
  margin: auto;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}

@media (max-width: 768px) {
  .cab-chat-tab {
    min-height: calc(100dvh - 108px);
  }

  .cab-chat {
    border-radius: 14px;
  }

  .cab-chat__feed {
    max-height: min(58vh, 460px);
    min-height: 220px;
  }
}
