.chatPanel {
  margin-top: 18px;
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 22px;
  padding: 16px;
  background: rgba(2, 12, 24, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.chatHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.chatHeader h3 {
  margin-bottom: 4px;
}

.chatHeader p:last-child {
  margin-bottom: 0;
  color: #cbd5e1;
  line-height: 1.45;
}

.chatMessages {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 12px;
  background: rgba(2, 6, 23, 0.34);
}

.chatBubble {
  width: min(100%, 620px);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 11px 12px;
  background: rgba(15, 23, 42, 0.72);
}

.chatBubble.teacher {
  justify-self: end;
  border-color: rgba(103, 232, 249, 0.26);
  background: rgba(8, 47, 73, 0.58);
}

.chatBubble.student {
  justify-self: start;
  border-color: rgba(167, 243, 208, 0.22);
  background: rgba(20, 83, 45, 0.22);
}

.chatBubble.admin,
.chatBubble.system {
  justify-self: center;
  border-color: rgba(196, 181, 253, 0.24);
  background: rgba(76, 29, 149, 0.2);
}

.chatBubble div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.chatBubble strong {
  font-size: 0.88rem;
  font-weight: 650;
}

.chatBubble span {
  color: #93a4b8;
  font-size: 0.72rem;
  white-space: nowrap;
}

.chatBubble p {
  margin-bottom: 0;
  color: #eef6ff;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chatForm {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.chatForm textarea {
  min-height: 86px;
}

@media (max-width: 640px) {
  .chatHeader,
  .chatBubble div {
    align-items: flex-start;
    flex-direction: column;
  }

  .chatBubble {
    width: 100%;
  }

  .chatBubble.teacher,
  .chatBubble.student,
  .chatBubble.admin,
  .chatBubble.system {
    justify-self: stretch;
  }
}
