:root {
  --message-blue: #245aa7;
  --message-blue-deep: #1b4a8b;
  --message-ink: #2f4559;
  --message-muted: #718190;
  --message-line: #dce4ec;
  --message-bg: #f2f5f8;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  overflow: hidden;
  color: var(--message-ink);
  background: var(--message-bg);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

button,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.message-topbar {
  height: 54px;
  color: white;
  background: var(--message-blue);
  box-shadow: 0 2px 7px rgba(29, 61, 100, 0.16);
}

.message-container {
  width: min(1100px, calc(100% - 28px));
  margin-inline: auto;
}

.message-nav {
  display: flex;
  height: 54px;
  align-items: center;
  gap: 12px;
}

.message-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  color: white;
  text-decoration: none;
}

.message-brand-mark {
  display: grid;
  width: 28px;
  height: 25px;
  color: var(--message-blue);
  background: white;
  border-radius: 6px 6px 6px 2px;
  font-weight: 700;
  place-items: center;
}

.message-brand-name {
  font-size: 17px;
  font-weight: 700;
}

.message-brand-en {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.message-nav-title {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 12px;
}

.message-nav-spacer {
  flex: 1;
}

.message-nav-link {
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  text-decoration: none;
}

.message-nav-link:hover {
  color: white;
}

.message-nav-user {
  overflow: hidden;
  max-width: 150px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-main {
  padding-block: 18px 28px;
}

.message-loading,
.message-denied {
  min-height: 420px;
}

.message-loading {
  display: grid;
  color: var(--message-muted);
  background: white;
  border: 1px solid var(--message-line);
  border-radius: 4px;
  font-size: 12px;
  place-items: center;
}

.message-denied {
  padding: 70px 20px;
  text-align: center;
  background: white;
  border: 1px solid var(--message-line);
  border-radius: 4px;
}

.message-denied > span {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  color: white;
  background: var(--message-blue);
  border-radius: 16px 16px 16px 4px;
  font-family: "STSong", "SimSun", serif;
  font-size: 25px;
  place-items: center;
}

.message-denied h1 {
  margin: 0;
  font-size: 21px;
}

.message-denied p {
  margin: 8px 0 18px;
  color: var(--message-muted);
  font-size: 12px;
}

.message-denied a {
  display: inline-flex;
  height: 36px;
  align-items: center;
  padding: 0 16px;
  color: white;
  background: var(--message-blue);
  border-radius: 3px;
  font-size: 12px;
  text-decoration: none;
}

.message-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100vh - 100px);
  min-height: 540px;
  overflow: hidden;
  background: white;
  border: 1px solid var(--message-line);
  border-radius: 5px;
  box-shadow: 0 3px 12px rgba(30, 57, 87, 0.06);
}

.conversation-sidebar {
  min-width: 0;
  background: #fbfcfd;
  border-right: 1px solid var(--message-line);
}

.conversation-head {
  display: flex;
  height: 65px;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  background: white;
  border-bottom: 1px solid var(--message-line);
}

.conversation-head h1 {
  margin: 0;
  color: #294a68;
  font-size: 18px;
}

.conversation-head p {
  margin: 3px 0 0;
  color: var(--message-muted);
  font-size: 10px;
}

.conversation-head button {
  padding: 4px 7px;
  color: #4e6e8e;
  background: #f6f9fc;
  border: 1px solid #d8e5f2;
  border-radius: 3px;
  font-size: 10px;
}

.conversation-list {
  height: calc(100% - 65px);
  overflow-y: auto;
}

.conversation-empty {
  padding: 45px 20px;
  color: var(--message-muted);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.conversation-item {
  display: grid;
  width: 100%;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 12px 14px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
}

.conversation-item:hover,
.conversation-item.active {
  background: #edf5ff;
}

.conversation-avatar,
.chat-user-avatar,
.chat-message-avatar {
  display: grid;
  color: white;
  background: #4d7cb1;
  border-radius: 5px;
  font-weight: 600;
  place-items: center;
}

.conversation-avatar {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.conversation-copy {
  min-width: 0;
}

.conversation-name {
  display: block;
  overflow: hidden;
  color: #35516b;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-preview {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #7a8895;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-side-meta {
  display: flex;
  align-self: stretch;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  color: #95a1ac;
  font-size: 9px;
}

.conversation-unread {
  display: grid;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  color: white;
  background: #d9564a;
  border-radius: 9px;
  font-size: 9px;
  place-items: center;
}

.chat-panel {
  min-width: 0;
  background: #f5f8fb;
}

.chat-empty {
  display: grid;
  height: 100%;
  align-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--message-muted);
  text-align: center;
}

.chat-empty-icon {
  display: grid;
  width: 60px;
  height: 60px;
  margin-bottom: 13px;
  color: #6f9bd0;
  background: #e6f1ff;
  border-radius: 50%;
  font-size: 26px;
  place-items: center;
}

.chat-empty h2 {
  margin: 0;
  color: #546e86;
  font-size: 16px;
}

.chat-empty p {
  margin: 8px 0 0;
  font-size: 11px;
}

.chat-active {
  display: grid;
  height: 100%;
  grid-template-rows: 62px minmax(0, 1fr) auto;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  background: white;
  border-bottom: 1px solid var(--message-line);
}

.chat-back {
  display: none;
  padding: 0;
  color: #476783;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
}

.chat-user-avatar {
  width: 36px;
  height: 36px;
  font-size: 12px;
  text-decoration: none;
}

.chat-user-name {
  display: block;
  color: #31526f;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.chat-head div > span {
  display: block;
  margin-top: 2px;
  color: #8794a0;
  font-size: 9px;
}

.chat-messages {
  overflow-y: auto;
  padding: 18px 17px;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 14px;
}

.chat-message.mine {
  flex-direction: row-reverse;
}

.chat-message-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  font-size: 10px;
}

.chat-message-body {
  max-width: min(68%, 520px);
}

.chat-message-bubble {
  padding: 9px 11px;
  color: #3f5366;
  background: white;
  border: 1px solid #dfe7ee;
  border-radius: 4px 10px 10px 10px;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.mine .chat-message-bubble {
  color: white;
  background: var(--message-blue);
  border-color: var(--message-blue);
  border-radius: 10px 4px 10px 10px;
}

.chat-message-time {
  display: block;
  margin-top: 3px;
  color: #99a4ad;
  font-size: 9px;
  text-align: left;
}

.chat-message.mine .chat-message-time {
  text-align: right;
}

.chat-messages-empty {
  padding: 70px 20px;
  color: #84929e;
  font-size: 11px;
  text-align: center;
}

.chat-composer {
  padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
  background: white;
  border-top: 1px solid var(--message-line);
}

.chat-composer textarea {
  width: 100%;
  min-height: 66px;
  max-height: 150px;
  padding: 9px 10px;
  color: #3f5366;
  background: #f8fafc;
  border: 1px solid #d5dfe8;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.65;
  outline: 0;
  resize: vertical;
}

.chat-composer textarea:focus {
  background: white;
  border-color: #79a9d7;
}

.chat-compose-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 6px;
  color: #8996a1;
  font-size: 9px;
}

.chat-compose-footer > span:first-child {
  flex: 1;
}

.chat-compose-footer button {
  height: 30px;
  padding: 0 18px;
  color: white;
  background: var(--message-blue);
  border: 1px solid var(--message-blue-deep);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.chat-compose-footer button:disabled {
  opacity: 0.6;
}

.chat-error {
  min-height: 15px;
  margin: 5px 0 0;
  color: #b45649;
  font-size: 10px;
}

.message-toast {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: 30px;
  padding: 8px 14px;
  color: white;
  background: rgba(38, 53, 68, 0.92);
  border-radius: 3px;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.message-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .message-container {
    width: 100%;
  }

  .message-nav {
    padding-inline: 10px;
    gap: 8px;
  }

  .message-brand-en,
  .message-nav-link:first-of-type,
  .message-nav-user {
    display: none;
  }

  .message-nav-title {
    padding-left: 8px;
    font-size: 11px;
  }

  .message-main {
    padding: 0;
    height: calc(100vh - 54px);
  }

  .message-shell {
    display: block;
    height: calc(100vh - 54px);
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .conversation-sidebar {
    height: 100%;
    border-right: 0;
  }

  .conversation-head {
    height: 58px;
    padding-inline: 13px;
  }

  .conversation-list {
    height: calc(100% - 58px);
  }

  .chat-panel {
    display: none;
    height: 100%;
  }

  .message-shell.chat-open .conversation-sidebar {
    display: none;
  }

  .message-shell.chat-open .chat-panel {
    display: block;
  }

  .chat-active {
    grid-template-rows: 56px minmax(0, 1fr) auto;
  }

  .chat-head {
    padding-inline: 10px;
  }

  .chat-back {
    display: block;
  }

  .chat-messages {
    padding: 14px 10px;
  }

  .chat-message-body {
    max-width: 78%;
  }

  .chat-composer {
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  }

  .chat-compose-footer > span:first-child {
    display: none;
  }

  .chat-compose-footer b + * {
    margin-left: auto;
  }

  .chat-compose-footer button {
    margin-left: auto;
  }
}
