﻿:root {
  --wc-green: #07c160;
  --wc-green-dark: #05a84f;
  --wc-bg: #ededed;
  --wc-panel: #f7f7f7;
  --wc-white: #ffffff;
  --wc-line: #d9d9d9;
  --wc-text: #1f1f1f;
  --wc-muted: #7a7a7a;
  --wc-bubble-mine: #95ec69;
  --wc-bubble-other: #ffffff;
  --wc-danger: #d93025;
  --wc-ok: #1f8e4d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans", sans-serif;
  color: var(--wc-text);
  background: var(--wc-bg);
}

.container {
  width: min(1220px, calc(100% - 1.4rem));
  margin: 0.9rem auto 1.2rem;
}

.header {
  background: var(--wc-white);
  border: 1px solid var(--wc-line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}

.header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.header p {
  margin: 0.32rem 0 0;
  color: var(--wc-muted);
  line-height: 1.35;
}

a {
  color: #2e6da4;
}

a:hover {
  color: var(--wc-green-dark);
}

.card {
  background: var(--wc-white);
  border: 1px solid var(--wc-line);
  border-radius: 10px;
  padding: 0.95rem;
}

.card + .card {
  margin-top: 0.85rem;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.auth-landing {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.1rem;
  background: linear-gradient(165deg, #ffffff 0%, #f7fff9 65%, #eefbf3 100%);
}

.auth-hero {
  margin-bottom: 0.95rem;
  padding: 0.9rem;
  border-radius: 10px;
  border: 1px solid #d9f0e2;
  background: #fbfffd;
}

.auth-hero h2 {
  margin: 0 0 0.35rem;
  font-size: 1.18rem;
}

.auth-hero p {
  margin: 0;
  color: #5f6f66;
  line-height: 1.35;
}

.auth-single {
  border-color: #d5eadf;
  background: #ffffff;
}

.auth-single h3 {
  margin: 0 0 0.75rem;
  font-size: 1.03rem;
}

.auth-links {
  margin-top: 0.82rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.auth-links a {
  font-size: 0.9rem;
  text-decoration: none;
  color: #1d7f4d;
  font-weight: 600;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-block {
  background: #fafafa;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  padding: 0.9rem;
}

.auth-block h2 {
  margin: 0 0 0.72rem;
  font-size: 1.02rem;
}

.auth-form {
  display: grid;
  gap: 0.58rem;
}

label {
  color: #555;
  font-size: 0.88rem;
  font-weight: 600;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.48rem;
  color: #444;
  font-weight: 500;
}

.check-row span {
  line-height: 1.35;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 7px;
  padding: 0.58rem 0.68rem;
  color: var(--wc-text);
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus-visible {
  outline: none;
  border-color: var(--wc-green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.16);
}

input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
}

button {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.55rem 0.78rem;
  background: var(--wc-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 130ms ease;
}

button:hover {
  background: var(--wc-green-dark);
}

.error {
  color: var(--wc-danger);
  margin: 0;
  font-weight: 700;
}

.ok {
  color: var(--wc-ok);
  margin: 0;
  font-weight: 700;
}

.muted {
  color: var(--wc-muted);
}

.is-hidden {
  display: none !important;
}

.chat-card {
  padding: 0;
  overflow: hidden;
}

.chat-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.95rem;
  background: var(--wc-green);
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-topbar button {
  background: #fff;
  color: #277a4b;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.chat-topbar button:hover {
  background: #f3fff8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.48rem;
}

.ws-status {
  font-size: 0.74rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
}

.ws-online {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.ws-offline {
  background: rgba(255, 255, 255, 0.2);
  color: #ffe9e9;
}

.messenger-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  min-height: 72vh;
}

.users-panel {
  background: var(--wc-panel);
  border-right: 1px solid var(--wc-line);
  padding: 0.86rem;
  overflow-y: auto;
}

.users-panel h2 {
  margin: 0 0 0.52rem;
  font-size: 0.98rem;
  letter-spacing: 0.1px;
}

.dialogs-title {
  margin-top: 1rem !important;
}

.users-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.34rem;
}

.user-item {
  width: 100%;
  text-align: left;
  background: #fff;
  color: #2a2a2a;
  border: 1px solid #dfdfdf;
  border-radius: 8px;
  padding: 0.52rem 0.58rem;
}

.user-item:hover {
  background: #f4fdf8;
  border-color: #b8eacb;
}

.user-item.active {
  background: #ecfbf2;
  border-color: #8fdeb1;
  color: #1f643f;
}

.dialog-item {
  padding: 0.54rem 0.6rem;
}

.dialog-title {
  font-weight: 700;
  margin-bottom: 0.17rem;
}

.dialog-preview {
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-meta {
  margin-top: 0.25rem;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.16rem;
  height: 1.16rem;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 0.32rem;
}

.dialog-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
}

.dialog-placeholder {
  margin: auto;
  color: #8b8b8b;
  font-size: 0.98rem;
  text-align: center;
}

.dialog-box {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.62rem;
  padding: 0.72rem 0.92rem;
  border-bottom: 1px solid var(--wc-line);
  background: #fafafa;
}

.dialog-header-main {
  min-width: 0;
  font-weight: 700;
}

.dialog-tools {
  display: flex;
  gap: 0.4rem;
}

.tool-btn {
  background: #fff;
  color: #4a4a4a;
  border: 1px solid #dcdcdc;
  padding: 0.36rem 0.52rem;
  border-radius: 7px;
  font-size: 0.81rem;
  font-weight: 700;
}

.tool-btn:hover {
  background: #effaf4;
  border-color: #b9e6cb;
}

.dialog-tools-panel {
  border-bottom: 1px solid #dcdcdc;
  background: #fafafa;
  padding: 0.56rem 0.78rem;
}

.dialog-tools-title {
  font-weight: 700;
  margin-bottom: 0.42rem;
}

.panel-item {
  width: 100%;
  text-align: left;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #2a2a2a;
  border-radius: 8px;
  margin-bottom: 0.36rem;
}

.panel-item:hover {
  background: #f8fff9;
}

.panel-item-top {
  display: flex;
  justify-content: space-between;
  color: #747474;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
}

.messages {
  background: #f5f5f5;
  padding: 0.96rem 0.95rem;
  overflow-y: auto;
  flex: 1;
}

.messages::-webkit-scrollbar,
.users-panel::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb,
.users-panel::-webkit-scrollbar-thumb {
  background: #cfcfcf;
  border-radius: 999px;
}

.message {
  max-width: 78%;
  background: var(--wc-bubble-other);
  border: 1px solid #dedede;
  border-radius: 8px;
  padding: 0.52rem 0.6rem;
  margin-bottom: 0.52rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.message.mine {
  margin-left: auto;
  background: var(--wc-bubble-mine);
  border-color: #7bc95a;
}

.message-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.26rem;
}

.username {
  font-weight: 700;
  font-size: 0.87rem;
}

.time {
  font-size: 0.74rem;
  color: #7f7f7f;
}

.reply-hint {
  margin-bottom: 0.26rem;
  font-size: 0.76rem;
  color: #737373;
}

.text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.33;
}

.attachment-link {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: #2a6ca1;
  text-decoration: none;
}

.attachment-link:hover {
  text-decoration: underline;
}

.message-actions {
  margin-top: 0.38rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pin-btn {
  padding: 0.26rem 0.48rem;
  border-radius: 999px;
  background: #fff;
  color: #4a4a4a;
  border: 1px solid #d8d8d8;
  font-size: 0.74rem;
}

.pin-btn.active {
  background: #fff8e6;
  border-color: #f1cf7a;
  color: #916100;
}

.pin-btn:hover {
  background: #f3fff8;
}

.message-reactions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.reaction-btn {
  padding: 0.26rem 0.48rem;
  border-radius: 999px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #4f4f4f;
  font-size: 0.74rem;
}

.reaction-btn.active {
  background: #e9f9f0;
  border-color: #98deb6;
  color: #1f7a4c;
}

.reaction-btn:hover {
  background: #f4fff8;
}

.status {
  display: block;
  margin-top: 0.3rem;
  text-align: right;
  font-size: 0.72rem;
  color: #747474;
}

.send-stack {
  border-top: 1px solid var(--wc-line);
  background: #fafafa;
}

.send-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  padding: 0.72rem 0.78rem;
}

.send-form input[type="file"] {
  width: 220px;
}

.send-form button {
  min-width: 110px;
}

.mention-suggest {
  border-top: 1px dashed #dbdbdb;
  padding: 0.45rem 0.75rem 0.65rem;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  background: #fafafa;
}

.mention-option {
  padding: 0.27rem 0.47rem;
  border-radius: 999px;
  background: #fff;
  color: #3d5a4a;
  border: 1px solid #c7e4d2;
  font-size: 0.76rem;
}

.mention-option:hover {
  background: #effaf4;
}

@media (max-width: 980px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .messenger-layout {
    grid-template-columns: 1fr;
  }

  .users-panel {
    border-right: 0;
    border-bottom: 1px solid var(--wc-line);
    max-height: 42vh;
  }

  .message {
    max-width: 92%;
  }

  .dialog-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .send-form {
    grid-template-columns: 1fr;
  }

  .send-form input[type="file"] {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 0.7rem);
    margin-top: 0.5rem;
  }

  .header,
  .card {
    border-radius: 8px;
  }

  .chat-topbar {
    padding: 0.66rem 0.72rem;
  }

  .users-panel,
  .messages {
    padding: 0.72rem;
  }

  .dialog-tools {
    width: 100%;
  }

  .tool-btn {
    flex: 1;
    text-align: center;
  }
}

.sidebar-tools {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.sidebar-tab {
  background: #fff;
  color: #4c4c4c;
  border: 1px solid #d8d8d8;
  padding: 0.35rem 0.45rem;
}

.sidebar-tab.active {
  background: #e9f9f0;
  color: #17653f;
  border-color: #8fdab0;
}

#sidebar-search {
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
}

.dialog-title-row {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  align-items: baseline;
}

.dialog-time {
  font-size: 0.72rem;
  color: #8f8f8f;
  white-space: nowrap;
}

.typing-indicator {
  display: inline-block;
  margin-left: 0.42rem;
  font-size: 0.74rem;
  color: #4b8b64;
  font-weight: 600;
}

.back-btn {
  margin-right: 0.3rem;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.emoji-toggle {
  min-width: 48px;
}

.emoji-toggle.active {
  background: #e9f9f0;
  border-color: #8fdab0;
  color: #17653f;
}

.emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  padding: 0.45rem 0.72rem;
  border-bottom: 1px dashed #dbdbdb;
  background: #fafafa;
}

.emoji-item {
  min-width: 34px;
  padding: 0.22rem 0.3rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d8d8d8;
  color: #2f2f2f;
}

.emoji-item:hover {
  background: #f3fff8;
}

.dialog-header-main {
  display: flex;
  align-items: center;
  min-width: 0;
}

.send-form {
  grid-template-columns: 1fr auto auto auto;
}

@media (max-width: 980px) {
  body.chat-open-mobile .users-panel {
    display: none;
  }

  body.chat-open-mobile .dialog-panel {
    display: flex;
  }

  body:not(.chat-open-mobile) .dialog-box {
    display: none;
  }

  body:not(.chat-open-mobile) #dialog-placeholder {
    display: flex;
    margin: 1.2rem auto;
  }
}
