.chat-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.75rem 5vw 3rem;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1rem;
  align-items: stretch;
}

.chat-sidebar,
.chat-panel {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.chat-sidebar-head,
.chat-panel-head {
  padding: 1rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.chat-sidebar-head h1 {
  font-size: 1.15rem;
  margin: 0;
}

.chat-search,
.chat-find {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.chat-find {
  grid-template-columns: 1fr auto;
}

.chat-find-hint {
  margin: 0;
  padding: 0 1rem 0.75rem;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.78rem;
  line-height: 1.35;
}

.chat-search input,
.chat-find input,
.chat-compose input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
}

.chat-list {
  max-height: 70vh;
  overflow: auto;
  padding: 0.4rem;
}

.chat-item {
  padding: 0.75rem 0.75rem;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: 0.25rem;
}

.chat-item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.chat-item.active {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.chat-item-title {
  font-weight: 700;
}

.chat-item-sub {
  color: #94a3b8;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.chat-sub {
  color: #94a3b8;
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.chat-badge {
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

.chat-drop-zone {
  position: relative;
}

.chat-drop-zone.drop-active {
  outline: 2px dashed rgba(96, 165, 250, 0.9);
  outline-offset: -6px;
  background: rgba(37, 99, 235, 0.1);
}

.chat-drop-zone.drop-active .chat-drop-hint {
  display: block !important;
  position: absolute;
  inset: 0;
  margin: auto;
  height: fit-content;
  text-align: center;
  color: #93c5fd;
  font-weight: 700;
  pointer-events: none;
  z-index: 2;
}

.chat-messages {
  height: 70vh;
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.msg {
  max-width: 78%;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.75);
}

.msg.me {
  margin-left: auto;
  background: rgba(37, 99, 235, 0.20);
  border-color: rgba(37, 99, 235, 0.35);
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: #94a3b8;
  font-size: 0.74rem;
  margin-top: 0.25rem;
}

.chat-compose {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  align-items: center;
}

.msg-file { margin-top: 0.35rem; }
.msg-preview {
  display: block;
  max-width: 100%;
  max-height: 180px;
  width: auto;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  object-fit: contain;
  background: rgba(15, 23, 42, 0.35);
}
.msg-file-name {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}
.msg-file-dl {
  border: 0;
  background: transparent;
  color: #93c5fd;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.chat-msg {
  padding: 0.75rem 1rem;
  margin: 0;
  color: #94a3b8;
}

.chat-msg.err { color: #fca5a5; }
.chat-msg.ok { color: #86efac; }

@media (max-width: 980px) {
  .chat-shell { grid-template-columns: 1fr; }
  .chat-messages { height: 56vh; }
  .chat-list { max-height: 32vh; }
}

