/* TRÒ CHUYỆN: trang cao vừa màn (hoặc cột phải trang chủ), chỉ khung tin cuộn DỌC; ô gõ luôn ở đáy. Không cuộn ngang. */
.tro-chuyen {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  height: calc(100dvh - 52px - 44px - var(--chieu-cao-nav) - env(safe-area-inset-bottom)); min-height: 320px;
}
@media (min-width: 760px) { .trang.tro-chuyen { height: calc(100dvh - 52px - 64px); max-width: 860px; margin-inline: auto; } }

.dau-chat { display: flex; align-items: center; gap: 10px; min-width: 0; padding-bottom: 10px; border-bottom: 1px solid var(--vien); }
.ten-chat { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.hang-duoi .model { font-size: 11px; font-family: ui-monospace, Consolas, monospace; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hang-duoi .model:empty { display: none; }
.anh-dai-dien {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f6cf7c, var(--gold) 60%, #a9761f); color: #1a1205; font-weight: 800; font-size: 12px;
}
.anh-dai-dien.nho { width: 22px; height: 22px; font-size: 9px; }

.o-tt-doi:empty { display: none; }
.tt-doi { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--mist-300); min-width: 0; margin: 0; }
.tt-doi .bieu-tuong { width: 16px; height: 16px; flex: none; }
.tt-doi.loi { color: var(--bad); }
.tt-doi.dang { color: var(--signal-strong); }

/* Bong bóng chung (khung Dạy nhân sự cũng dùng) */
.khung-tin {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  border: 1px solid var(--vien); border-radius: var(--bk); background: var(--ink-900); padding: 12px;
}
.ds-tin { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ds-tin .trong { border: 0; }
.tin { display: flex; flex-direction: column; gap: 3px; max-width: min(78%, 720px); min-width: 0; }
.tin.anh { align-self: flex-end; align-items: flex-end; }
.tin.doi { align-self: flex-start; }
.than-tin { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 12px; border-radius: 12px; line-height: 1.45; max-width: 100%; }
.tin.anh .than-tin { background: rgba(124, 196, 214, .16); border-bottom-right-radius: 4px; }
.tin.doi .than-tin { background: var(--ink-800); border: 1px solid var(--vien); border-bottom-left-radius: 4px; }
.tin.dang-gui .than-tin { opacity: .7; }
.tin .meta { font-size: 11px; padding: 0 4px; }
.tin .meta.tt-viec { width: 20px; height: 20px; padding: 0; }
.tin .meta.tt-viec .bieu-tuong { width: 14px; height: 14px; }
.form-tin { flex-wrap: nowrap; }
.form-tin textarea { flex: 1 1 auto; min-width: 0; resize: none; max-height: 30vh; }

/* Mạch trò chuyện với đội: tin đội là chữ trần có tên + ảnh đại diện (không bong bóng), tin anh bong bóng phải */
.tro-chuyen .khung-tin { border: 0; background: transparent; padding: 4px 2px; }
.tro-chuyen .ds-tin { gap: 10px; }
.tro-chuyen .tin { max-width: min(86%, 720px); gap: 4px; }
.tro-chuyen .tin.doi { max-width: 100%; }
.tro-chuyen .tin.doi.noi-tiep { margin-top: -4px; }
.tro-chuyen .tin.anh .than-tin { border-radius: 14px 14px 4px 14px; }
.tro-chuyen .tin.doi .than-tin { background: none; border: 0; padding: 0 0 0 30px; line-height: 1.5; color: var(--mist-100); }
.ten-gui { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ten-gui time { font-size: 11px; }
.tin.vet {
  flex-direction: row; align-items: center; gap: 6px; max-width: 100%; margin-left: 30px; padding: 3px 8px; border-radius: 8px;
  font: 11.5px/1.4 ui-monospace, Consolas, monospace; color: var(--mist-500); background: rgba(150, 175, 230, .05);
  position: relative;
}
/* Vệt việc như mẫu: nối với tin đội phía trên bằng đường chấm. */
.tin.vet::before { content: ''; position: absolute; left: -14px; top: -10px; bottom: 50%; width: 10px; border-left: 1px dotted var(--mist-500); border-bottom: 1px dotted var(--mist-500); border-bottom-left-radius: 6px; opacity: .6; }
.tin.vet .bieu-tuong { width: 12px; height: 12px; flex: none; color: var(--signal); }
.tin.vet time { margin-left: auto; flex: none; }

.hang-cho:empty { display: none; }
.hang-cho { border: 1px solid var(--vien); border-radius: 14px; padding: 9px 11px; background: rgba(7, 11, 28, .5); font-size: 13px; }
.dau-hang-cho { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.dau-hang-cho .bieu-tuong { width: 14px; height: 14px; color: var(--warn); flex: none; }
.hang-cho ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: cho; max-height: 8.5em; overflow-y: auto; overflow-x: hidden; }
.hang-cho li { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--mist-300); counter-increment: cho; }
.hang-cho li::before { content: counter(cho); flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--ink-700); color: var(--mist-300); }
.hang-cho .tt-viec { margin-left: auto; flex: none; display: grid; place-items: center; width: 18px; height: 18px; }
.hang-cho .tt-viec .bieu-tuong { width: 14px; height: 14px; }
.hang-cho .tt-viec.cho { color: var(--warn); }
.hang-cho .tt-viec.loi { color: var(--bad); }

.o-go {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--vien); border-radius: 16px; background: rgba(7, 11, 28, .55);
  transition: border-color .15s;
}
.o-go:focus-within { border-color: rgba(124, 196, 214, .45); }
.o-go textarea { width: 100%; min-width: 0; resize: none; max-height: 30vh; border: 0; background: transparent; color: inherit; font: inherit; outline: none; padding: 2px; }
.hang-duoi { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11.5px; }
.nut-gui {
  margin-left: auto; flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--gold); color: #1a1205;
}
.nut-tep {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--mist-500);
}
.nut-tep:hover { filter: brightness(1.3); }
.nut-tep .bieu-tuong { width: 16px; height: 16px; }
.nut-gui:hover { filter: brightness(1.1); }
.nut-gui:disabled { opacity: .5; cursor: default; }
.nut-gui .bieu-tuong { width: 16px; height: 16px; }
.tro-chuyen .bao-loi:empty { display: none; }
@media (max-width: 759px) { .tin { max-width: 92%; } }

.quay { animation: quay 1s linear infinite; }
@keyframes quay { to { transform: rotate(360deg); } }
