.wechat-panel {
  position: absolute;
  inset: 28px max(22px, calc((100vw - 760px) / 2));
  z-index: 45;
  display: grid;
  grid-template-rows: 66px 38px minmax(0, 1fr) auto 62px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 8px;
  background: #ededed;
  box-shadow: 0 20px 70px rgba(0,0,0,0.38);
  color: #171717;
}

.wechat-header {
  display: grid;
  grid-template-columns: 38px 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #d7d7d7;
  background: #f7f7f7;
}

.wechat-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #252525;
  font-size: 1.5rem;
  cursor: pointer;
}

.wechat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  object-fit: cover;
}

.wechat-contact {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wechat-contact strong { font-size: 1rem; }
.wechat-contact span { color: #888; font-size: 0.73rem; }

.wechat-api-badge {
  padding: 4px 7px;
  border-radius: 4px;
  background: #e4e4e4;
  color: #666;
  font-size: 0.68rem;
}

.wechat-api-badge.online { background: #dff4e7; color: #23794a; }
.wechat-api-badge.offline { background: #f3e4df; color: #925440; }

.wechat-relation {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 18px;
  background: #fafafa;
  color: #737373;
  font-size: 0.72rem;
}

.wechat-relation-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #d6d6d6;
}

.wechat-relation-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #07c160;
  transition: width 0.4s ease;
}

.wechat-messages {
  overflow-y: auto;
  padding: 20px 16px 26px;
}

.wechat-time {
  margin: 4px 0 18px;
  color: #999;
  font-size: 0.7rem;
  text-align: center;
}

.wechat-message {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0 0 16px;
}

.wechat-message.self { flex-direction: row-reverse; }

.wechat-message img {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 4px;
  object-fit: cover;
}

.wechat-player-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #576b95;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
}

.wechat-bubble {
  max-width: min(72%, 480px);
  padding: 10px 12px;
  border: 1px solid #dedede;
  border-radius: 5px;
  background: white;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.wechat-message.self .wechat-bubble {
  border-color: #89d969;
  background: #95ec69;
}

.wechat-quick-replies {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 14px;
  border-top: 1px solid #ddd;
  background: #f5f5f5;
}

.wechat-quick-replies button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #c9c9c9;
  border-radius: 5px;
  background: white;
  color: #555;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}

.wechat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #d2d2d2;
  background: #f7f7f7;
}

.wechat-composer input {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  outline: 0;
  background: white;
  font: inherit;
}

.wechat-composer input:focus { border-color: #07c160; }

.wechat-composer button {
  height: 40px;
  border: 0;
  border-radius: 5px;
  background: #07c160;
  color: white;
  font: inherit;
  cursor: pointer;
}

.wechat-composer button:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 768px) {
  .wechat-panel {
    inset: 0;
    border: 0;
    border-radius: 0;
  }

  .wechat-bubble { max-width: 78%; }
}
