.chat-entry {
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding-inline: max(24px, calc((100vw - 1152px) / 2));
  background: #101923;
}

.chat-entry p {
  margin: 0 0 5px;
  color: var(--cyan);
  font: 800 11px/1.3 Consolas, monospace;
  letter-spacing: .08em;
}

.chat-entry h2 { margin: 0 0 6px; font-size: 28px; }
.chat-entry span { color: var(--muted); font-size: 13px; }
.chat-entry > button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 16px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  color: #071517;
  background: var(--cyan);
  font-weight: 900;
  cursor: pointer;
}
.chat-entry > button:hover { background: #7cebed; transform: translateY(-2px); }

.chat-launcher {
  position: fixed;
  z-index: 70;
  right: 24px;
  bottom: 22px;
  width: 280px;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 13px;
  border: 1px solid #385064;
  border-radius: 8px;
  color: #f2f6f8;
  background: #14212d;
  box-shadow: 0 18px 46px rgba(0,0,0,.42);
  text-align: left;
  cursor: pointer;
}
.chat-launcher:hover { border-color: var(--cyan); transform: translateY(-2px); }
.launcher-faces { position: relative; width: 66px; height: 42px; flex: 0 0 66px; }
.launcher-faces img {
  position: absolute;
  top: 1px;
  width: 40px;
  height: 40px;
  border: 2px solid #14212d;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 24%;
}
.launcher-faces img:nth-child(1) { left: 0; z-index: 3; }
.launcher-faces img:nth-child(2) { left: 14px; z-index: 2; }
.launcher-faces img:nth-child(3) { left: 28px; }
.chat-launcher > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.chat-launcher b { font-size: 13px; white-space: nowrap; }
.chat-launcher small { color: #9eacb8; font-size: 10px; }
.chat-launcher small i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #67dc8a; }
.chat-launcher em { margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; color: white; background: #f05252; font: 800 10px/19px Consolas, monospace; text-align: center; }

.chat-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: end;
  padding: 20px;
  background: rgba(3,6,9,.38);
  backdrop-filter: blur(3px);
}
.chat-overlay[hidden] { display: none; }
.company-chat {
  width: min(920px, calc(100vw - 40px));
  height: min(680px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid #344b5e;
  border-radius: 8px;
  background: #0e161f;
  box-shadow: 0 28px 80px rgba(0,0,0,.58);
}
.chat-window-head {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid #2b3b49;
  background: #15232f;
}
.chat-window-head > div { display: flex; align-items: center; gap: 9px; }
.chat-window-head img { width: 32px; height: 32px; object-fit: contain; }
.chat-window-head span { display: flex; flex-direction: column; line-height: 1.25; }
.chat-window-head b { font-size: 13px; }
.chat-window-head small { color: #91a0ad; font-size: 9px; }
.chat-window-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 5px;
  color: #b8c3cc;
  background: transparent;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}
.chat-window-head button:hover { color: white; background: #253543; }
.chat-window-head #closeChat:hover { background: #b54848; }

.chat-window-body { height: calc(100% - 58px); display: grid; grid-template-columns: 214px 1fr; }
.chat-contacts { min-width: 0; padding: 15px 9px; border-right: 1px solid #293a48; background: #111b25; }
.chat-contacts > p { margin: 0 10px 10px; color: #778894; font-size: 10px; font-weight: 800; }
.contact-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  color: #c4cdd4;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.contact-item:hover { background: #1b2a36; }
.contact-item[aria-current="true"] { color: white; background: #223746; }
.contact-avatar { position: relative; width: 40px; height: 40px; flex: 0 0 40px; }
.contact-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: center 24%; }
.contact-avatar i { position: absolute; right: 0; bottom: 1px; width: 9px; height: 9px; border: 2px solid #111b25; border-radius: 50%; background: #63d986; }
.group-avatar { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; overflow: hidden; border-radius: 8px; background: #293a48; }
.group-avatar img { width: 19px; height: 19px; border-radius: 0; }
.contact-item > span:last-child { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.contact-item b { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.contact-item small { overflow: hidden; color: #7f909d; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }

.chat-room { position: relative; min-width: 0; display: grid; grid-template-rows: 58px minmax(0,1fr) auto auto; background: #0b1219; }
.room-head { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid #293946; }
.room-head > div { display: flex; flex-direction: column; }
.room-head strong { font-size: 14px; }
.room-head span { color: #84949f; font-size: 10px; }
.room-messages { overflow-y: auto; padding: 18px 22px 12px; scroll-behavior: smooth; }
.chat-message { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; }
.chat-message.mine { flex-direction: row-reverse; }
.chat-message.system { justify-content: center; }
.message-avatar { width: 38px; height: 38px; flex: 0 0 38px; padding: 0; overflow: hidden; border: 0; border-radius: 50%; background: #243645; cursor: pointer; }
.message-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 24%; }
.chat-message-content { min-width: 0; max-width: min(72%, 560px); }
.chat-message.mine .chat-message-content { display: flex; align-items: flex-end; flex-direction: column; }
.message-meta { display: flex; gap: 8px; margin: 0 3px 4px; color: #7f909d; font-size: 9px; }
.message-bubble { padding: 9px 12px; border: 1px solid #2b4050; border-radius: 3px 8px 8px; color: #dbe2e7; background: #172532; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.mine .message-bubble { border-color: #2a625c; border-radius: 8px 3px 8px 8px; color: #ecfffd; background: #16453f; }
.chat-message.system .message-bubble { padding: 5px 11px; border: 0; border-radius: 12px; color: #80909c; background: #121c25; font-size: 10px; }
.typing .message-bubble { color: #9aabb7; }
.typing-dots { display: inline-flex; gap: 3px; margin-left: 5px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: #8ca0ad; animation: typing 1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 50% { opacity: .25; transform: translateY(-2px); } }

.mention-menu { position: absolute; right: 22px; bottom: 138px; width: 220px; padding: 6px; border: 1px solid #395063; border-radius: 6px; background: #182631; box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.mention-menu[hidden] { display: none; }
.mention-menu button { width: 100%; padding: 7px 9px; border: 0; border-radius: 4px; color: #d8e1e7; background: transparent; text-align: left; font-size: 11px; cursor: pointer; }
.mention-menu button:hover { background: #263b4a; }
.mention-shortcuts { display: flex; align-items: center; gap: 6px; padding: 8px 14px 0; border-top: 1px solid #263642; }
.mention-shortcuts > span { margin-right: 2px; color: #71828f; font-size: 9px; }
.mention-shortcuts button { padding: 3px 7px; border: 1px solid #334857; border-radius: 4px; color: #9fb0bb; background: transparent; font-size: 9px; cursor: pointer; }
.mention-shortcuts button:hover { border-color: var(--cyan); color: white; }
.room-composer { padding: 8px 14px 12px; }
.room-composer textarea { width: 100%; height: 72px; padding: 8px 10px; border: 0; color: #e4e9ed; background: transparent; resize: none; outline: none; }
.room-composer > div { display: flex; align-items: center; justify-content: space-between; }
.room-composer > div span { color: #667784; font-size: 9px; }
.room-composer button { min-width: 74px; padding: 7px 14px; border: 0; border-radius: 5px; color: #071517; background: var(--cyan); font-size: 11px; font-weight: 900; cursor: pointer; }
.room-composer button:disabled { opacity: .45; cursor: wait; }

@media (max-width: 760px) {
  .chat-entry { align-items: flex-start; flex-direction: column; }
  .chat-launcher { right: 12px; bottom: 12px; width: 240px; }
  .chat-overlay { padding: 0; }
  .company-chat { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .chat-window-body { grid-template-columns: 72px 1fr; }
  .chat-contacts { padding-inline: 6px; }
  .chat-contacts > p { text-align: center; margin-inline: 0; }
  .contact-item { justify-content: center; padding: 7px 5px; }
  .contact-item > span:last-child { display: none; }
  .room-head { padding-inline: 12px; }
  .room-head > span { display: none; }
  .room-messages { padding-inline: 12px; }
  .chat-message-content { max-width: 82%; }
  .mention-shortcuts { overflow-x: auto; }
  .mention-shortcuts > span { display: none; }
  .room-composer > div span { display: none; }
}
