:root {
  color-scheme: light;
  --rail: #4548e8;
  --rail-deep: #383bd8;
  --rail-soft: #5b5df0;
  --panel: #ffffff;
  --page: #f5f6f8;
  --chat: #f4f5f7;
  --line: #e5e7ef;
  --line-strong: #dcdfea;
  --text: #1f2329;
  --muted: #818796;
  --accent: #4148f2;
  --accent-dark: #3037d9;
  --danger: #f45b5b;
  --success: #22c55e;
  --warning: #f59e0b;
  --bubble: #ffffff;
  --self-bubble: #587ff0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8fa3ff;
  box-shadow: 0 0 0 2px rgba(65, 72, 242, 0.08);
}

.hidden {
  display: none !important;
}

.auth-view {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(65, 72, 242, 0.12), rgba(41, 171, 226, 0.08)),
    #eef4ff;
}

.auth-card {
  width: min(420px, calc(100vw - 40px));
  padding: 32px;
  border: 1px solid #dfe5f2;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 56px rgba(56, 72, 112, 0.18);
}

.brand {
  text-align: center;
}

.brand-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

.brand p {
  margin: 8px 0 24px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.auth-tab {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8f9fc;
  color: #626a7c;
}

.auth-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: #4f5666;
}

.auth-form input {
  height: 42px;
  padding: 0 12px;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-demo-button {
  width: 100%;
  margin-top: -4px;
}

.demo-login-panel {
  display: grid;
  gap: 12px;
}

.demo-login-panel p {
  margin: 0;
  color: var(--muted);
}

.demo-account-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.demo-account-grid button {
  min-width: 0;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 92px 348px minmax(0, 1fr);
  overflow: hidden;
}

.nav-rail {
  display: grid;
  grid-template-rows: 116px minmax(0, 1fr) 134px;
  background: var(--rail);
  color: #fff;
}

.rail-avatar {
  width: 56px;
  height: 56px;
  margin: 28px auto 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(18, 22, 83, 0.2);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding-top: 20px;
}

.rail-item,
.rail-action {
  position: relative;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
}

.rail-item:hover,
.rail-item.active,
.rail-action:hover {
  background: var(--rail-deep);
  color: #fff;
}

.rail-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: white;
}

.rail-icon {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
  font-size: 0;
  font-weight: 800;
}

.rail-icon::before,
.rail-icon::after {
  content: "";
  position: absolute;
  display: block;
  box-sizing: border-box;
}

#navChats .rail-icon::before {
  left: 1px;
  top: 3px;
  width: 22px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

#navChats .rail-icon::after {
  left: 7px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: skewX(-18deg);
}

#navFriends .rail-icon::before {
  left: 7px;
  top: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

#navFriends .rail-icon::after {
  left: 3px;
  top: 14px;
  width: 18px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

#navGroups .rail-icon::before {
  left: 7px;
  top: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: -8px 5px 0 -3px currentColor, 8px 5px 0 -3px currentColor;
}

#navGroups .rail-icon::after {
  left: 2px;
  top: 15px;
  width: 20px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

#navSettings .rail-icon::before {
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -5px 0 -3px currentColor, 0 5px 0 -3px currentColor, 5px 0 0 -3px currentColor,
    -5px 0 0 -3px currentColor;
}

#navSettings .rail-icon::after {
  left: 9px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.nav-badge {
  position: absolute;
  right: -7px;
  top: 5px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
}

.rail-bottom {
  display: grid;
  place-items: center;
  align-content: end;
  gap: 12px;
  padding-bottom: 26px;
}

.rail-action {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 22px;
}

.side-pane {
  min-width: 0;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  border-right: 1px solid var(--line-strong);
  background: var(--panel);
}

.side-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 10px;
}

.side-header.no-action {
  grid-template-columns: 1fr;
}

.side-header input {
  height: 42px;
  padding: 0 14px;
  border-radius: 9px;
  background: #fbfcff;
}

.round-action {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f0f2ff;
  color: var(--accent);
  font-size: 28px;
  line-height: 1;
}

.side-list {
  overflow: auto;
  padding: 0 14px 20px;
}

.alpha-title,
.section-label {
  margin: 18px 6px 8px;
  color: #8a8f9d;
  font-size: 20px;
  font-weight: 500;
}

.section-label {
  font-size: 16px;
}

.list-empty {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.list-card {
  position: relative;
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid #f0f1f5;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.list-card:hover,
.list-card.active {
  background: #f6f7fd;
}

.list-card.active {
  margin-inline: -8px;
  padding-inline: 10px;
  border-radius: 8px;
  border-bottom-color: transparent;
  background: #ecebff;
}

.avatar,
.small-avatar,
.chat-avatar,
.member-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #7460d4, #0aa0c8);
  color: white;
  font-weight: 800;
}

.avatar {
  width: 52px;
  height: 52px;
  font-size: 17px;
}

.small-avatar {
  width: 44px;
  height: 44px;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  font-size: 14px;
}

.member-avatar {
  width: 48px;
  height: 48px;
}

.avatar img,
.small-avatar img,
.chat-avatar img,
.member-avatar img,
.rail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-button {
  width: fit-content;
  height: fit-content;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: inherit;
}

.avatar-button:hover {
  filter: brightness(0.95);
}

.message.self .avatar-button {
  grid-column: 2;
}

.list-main {
  min-width: 0;
}

.list-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
}

.list-time {
  color: var(--muted);
  font-size: 13px;
}

.list-subtitle {
  margin-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #777d8a;
  font-size: 14px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: #6670f0;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.badge.danger {
  position: absolute;
  left: 46px;
  top: 9px;
  border: 1px solid #fff;
  background: var(--danger);
}

.badge.pin {
  background: #f4a42b;
}

.online-dot {
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--success);
}

.friend-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.main-panel {
  min-width: 0;
  min-height: 0;
  background: var(--page);
  overflow: hidden;
}

.blank-panel {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #b1b6c2;
}

.blank-card {
  min-width: 280px;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 34px 42px;
  border: 1px solid rgba(225, 230, 239, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 34px rgba(31, 42, 68, 0.08);
  color: #8a92a3;
}

.blank-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #4953f0, #22a7c7);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(63, 70, 232, 0.24);
}

.blank-card strong {
  color: var(--text);
  font-size: 18px;
}

.blank-card span {
  font-size: 14px;
}

.profile-page,
.detail-page,
.settings-page {
  height: 100%;
  overflow: auto;
  padding: 22px 28px 36px;
}

.hero-card,
.content-card {
  width: min(100%, 1320px);
  margin: 0 auto 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(28, 35, 60, 0.08);
}

.hero-card {
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px 34px;
}

.hero-card .avatar {
  width: 76px;
  height: 76px;
  font-size: 24px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.hero-meta {
  color: #969ba8;
  font-family: Consolas, monospace;
}

.content-card {
  padding: 22px 24px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf0f5;
  font-size: 22px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.form-row input,
.form-row textarea,
.form-row select {
  min-height: 40px;
  padding: 8px 12px;
}

.form-row textarea {
  min-height: 92px;
  resize: vertical;
}

.radio-row {
  display: flex;
  gap: 22px;
  align-items: center;
}

.radio-row label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.radio-row input {
  width: auto;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.primary,
.secondary,
.danger-button,
.plain-button {
  min-width: 92px;
  height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 18px;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  border-color: var(--line);
  background: #f8f9fc;
  color: #4d5668;
}

.danger-button {
  border-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

.plain-button {
  border-color: var(--line);
  background: #fff;
  color: var(--accent);
}

.search-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 42px 24px;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.search-box input {
  height: 42px;
  padding: 0 12px;
}

.result-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-item,
.member-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-name,
.member-name {
  font-weight: 700;
}

.result-meta,
.member-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.chat-page {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) 236px;
  background: var(--chat);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.chat-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.chat-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-menu {
  width: 42px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #777d88;
  font-size: 24px;
}

.chat-menu:hover {
  background: #f1f2f7;
  color: var(--accent);
}

.messages {
  overflow: auto;
  padding: 22px 28px;
}

.time-tip,
.system-tip {
  margin: 16px auto;
  color: #888e9c;
  text-align: center;
  font-size: 14px;
}

.message {
  max-width: min(76%, 760px);
  display: grid;
  grid-template-columns: 42px minmax(0, auto);
  gap: 12px;
  margin: 13px 0;
  align-items: start;
}

.message.self {
  margin-left: auto;
  grid-template-columns: minmax(0, auto) 42px;
}

.message.self .chat-avatar {
  grid-column: 2;
}

.message.self .message-content {
  grid-column: 1;
  grid-row: 1;
  text-align: right;
}

.message-meta {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #686d78;
  font-size: 13px;
}

.message.self .message-meta {
  justify-content: flex-end;
}

.bubble {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--bubble);
  color: #1f2329;
  line-height: 1.75;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 1px 1px 2px rgba(155, 158, 178, 0.35);
}

.bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 12px;
  border-style: solid;
  border-width: 7px 8px 7px 0;
  border-color: transparent var(--bubble) transparent transparent;
}

.message.self .bubble {
  background: var(--self-bubble);
  color: #fff;
}

.message.self .bubble::before {
  left: auto;
  right: -7px;
  border-width: 7px 0 7px 8px;
  border-color: transparent transparent transparent var(--self-bubble);
}

.recall-tip {
  max-width: 80%;
  margin: 14px auto;
  color: #858996;
  text-align: center;
}

.read-state {
  color: #f23c0f;
  font-size: 12px;
  font-weight: 700;
}

.read-state.read {
  color: #858996;
}

.message-action {
  border: 0;
  background: transparent;
  color: #858996;
  padding: 0;
  font-size: 12px;
}

.message-action:hover {
  color: var(--danger);
}

.message-actions {
  display: inline-flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.message:hover .message-actions {
  opacity: 1;
  pointer-events: auto;
}

.message-action.copy-action:hover {
  color: var(--accent);
}

.message-action.recall-action:hover {
  color: var(--danger);
}

.chat-image {
  display: block;
  max-width: 280px;
  max-height: 280px;
  border: 4px solid #d7d7df;
  border-radius: 6px;
  object-fit: cover;
}

.image-preview-button {
  position: relative;
  max-width: 100%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

.image-preview-button span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.68);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.image-preview-button:hover span {
  opacity: 1;
}

.file-card {
  min-width: 260px;
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #e1e3ea;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  box-shadow: 5px 5px 12px rgba(166, 170, 184, 0.22);
}

.file-card:hover {
  border-color: rgba(63, 70, 232, 0.28);
  box-shadow: 0 12px 30px rgba(31, 42, 68, 0.12);
}

.file-main {
  min-width: 0;
}

.file-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #204ce8;
}

.file-card span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.file-icon {
  color: #d42e07;
  font-size: 38px;
  font-weight: 800;
}

.image-preview-modal {
  width: min(78vw, 920px);
  display: grid;
  gap: 16px;
}

.image-preview-modal img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 8px;
  background: #0f172a;
}

.modal-card.wide-modal {
  width: min(960px, calc(100vw - 48px));
}

.image-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.image-preview-actions a {
  display: inline-grid;
  place-items: center;
  min-width: 112px;
  height: 42px;
  text-decoration: none;
}

.composer {
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr) 54px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 20px;
  border-bottom: 1px solid #eef0f5;
}

.tool-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #262b35;
  font-size: 20px;
}

.tool-button:hover {
  background: #f0f2f7;
  color: var(--accent);
}

.emoji-panel {
  position: absolute;
  left: 18px;
  bottom: 244px;
  z-index: 6;
  width: min(374px, calc(100% - 36px));
  max-height: 190px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(25, 32, 56, 0.16);
}

.emoji-option {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.emoji-option:hover {
  background: #f0f2ff;
}

.composer textarea {
  border: 0;
  resize: none;
  padding: 12px 14px;
  line-height: 1.7;
  font-size: 15px;
}

.composer textarea:focus {
  box-shadow: none;
}

.send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
}

.send-hint {
  color: var(--muted);
  font-size: 12px;
}

.send-button {
  min-width: 126px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.member-item {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f7;
  color: #777d8a;
  font-size: 12px;
  font-weight: 700;
}

.tag.online {
  background: #e7f8ef;
  color: var(--success);
}

.tag.owner {
  background: #fff2d9;
  color: #a86500;
}

.tag.admin {
  background: #e9efff;
  color: var(--accent);
}

.tag.danger {
  background: #ffe9ee;
  color: var(--danger);
}

.compact-list {
  margin-top: 12px;
}

.compact-actions {
  margin: 0;
}

.invite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.check-card input {
  width: auto;
}

.profile-avatar-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-card {
  display: grid;
  gap: 18px;
}

.profile-card-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-card-hero h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.profile-card-hero p {
  margin: 0;
  color: var(--muted);
}

.profile-card-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #7460d4, #0aa0c8);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.profile-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card-info {
  display: grid;
  gap: 10px;
}

.profile-card-info div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.profile-card-info span {
  color: var(--muted);
}

.profile-card-info strong {
  min-width: 0;
  font-weight: 500;
  word-break: break-word;
}

.profile-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.private-tools {
  display: grid;
  gap: 18px;
}

.private-tools-hero {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.private-tools-hero h4 {
  margin: 0 0 4px;
  font-size: 21px;
}

.private-tools-hero p,
.private-tools-hero span {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

.private-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.private-tools-grid button {
  width: 100%;
}

.settings-menu {
  padding: 10px 0;
}

.settings-link {
  width: 100%;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border: 0;
  border-left: 4px solid transparent;
  background: #fff;
  color: #6d7482;
  text-align: left;
  font-size: 17px;
}

.settings-link.active {
  border-left-color: var(--accent);
  background: #ededff;
  color: var(--accent);
  font-weight: 700;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 15px;
  border-radius: 8px;
  background: #1f2329;
  color: #fff;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
}

.modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 22, 37, 0.3);
}

.modal-card {
  width: min(520px, calc(100vw - 50px));
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(16, 22, 45, 0.24);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  padding: 18px;
}

.call-layer {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 14, 28, 0.48);
}

.call-card {
  position: relative;
  width: min(760px, calc(100vw - 40px));
  height: min(520px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: 8px;
  background: #151a27;
  color: #fff;
  box-shadow: 0 24px 80px rgba(10, 16, 40, 0.36);
}

.call-remote {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0f1320;
}

.call-remote video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-peer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  pointer-events: none;
}

.call-peer strong {
  font-size: 24px;
}

.call-peer span {
  color: rgba(255, 255, 255, 0.72);
}

.call-avatar {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #7460d4, #0aa0c8);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-local {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 168px;
  height: 112px;
  border: 2px solid rgba(255, 255, 255, 0.56);
  border-radius: 8px;
  background: #242b3c;
  object-fit: cover;
}

.audio-call .call-local {
  display: none;
}

.call-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
}

.call-actions .primary,
.call-actions .secondary,
.call-actions .danger-button {
  min-width: 104px;
  border-color: transparent;
}

.close-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #697080;
  font-size: 22px;
}

.close-button:hover {
  background: #f1f2f7;
  color: var(--danger);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 78px 314px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-width: 820px;
  }
}

.settings-stack {
  display: grid;
  gap: 12px;
}

.settings-option {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.settings-option strong {
  display: block;
  font-size: 15px;
}

.settings-option span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-option input {
  width: 42px;
  height: 24px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #c7ccd8;
  position: relative;
}

.settings-option input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s ease;
}

.settings-option input:checked {
  background: var(--accent);
}

.settings-option input:checked::before {
  transform: translateX(18px);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding-top: 8px;
}

.placeholder-panel {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.placeholder-panel strong {
  color: var(--text);
  font-size: 18px;
}

/* 2026-05 UI polish: quiet desktop-client style */
:root {
  --rail: #3f46e8;
  --rail-deep: #3038cc;
  --rail-soft: #5962f3;
  --page: #f3f5f9;
  --panel: #ffffff;
  --chat: #f6f7fa;
  --line: #e7eaf1;
  --line-strong: #dfe3ec;
  --text: #1d2430;
  --muted: #818898;
  --accent: #3f46e8;
  --accent-dark: #3038cc;
  --danger: #ef4444;
  --success: #20c46b;
  --warning: #f59e0b;
  --bubble: #ffffff;
  --self-bubble: #4658e8;
  --shadow-soft: 0 10px 28px rgba(31, 42, 68, 0.08);
  --shadow-float: 0 18px 48px rgba(31, 42, 68, 0.16);
}

body {
  background: var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
textarea,
select {
  letter-spacing: 0;
}

button {
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:active {
  transform: translateY(1px);
}

input,
textarea,
select {
  border-radius: 8px;
  border-color: #dfe4ee;
  background: #fbfcff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:hover,
textarea:hover,
select:hover {
  background: #fff;
  border-color: #cfd6e5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(63, 70, 232, 0.72);
  box-shadow: 0 0 0 3px rgba(63, 70, 232, 0.11);
}

.auth-view {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(63, 70, 232, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(63, 70, 232, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #eef3ff 0%, #f8fbff 48%, #eef8f5 100%);
  background-size: 44px 44px, 44px 44px, auto;
}

.auth-card {
  width: min(448px, calc(100vw - 40px));
  padding: 34px 34px 32px;
  border-radius: 8px;
  border: 1px solid rgba(224, 229, 239, 0.92);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-float);
}

.brand-mark {
  width: 66px;
  height: 66px;
  margin-bottom: 14px;
  background: linear-gradient(145deg, #4953f0, #22a7c7);
  box-shadow: 0 14px 30px rgba(63, 70, 232, 0.28);
}

.brand h1 {
  font-size: 34px;
  font-weight: 800;
}

.brand p {
  margin-bottom: 26px;
  color: #758096;
}

.auth-tabs {
  padding: 4px;
  gap: 4px;
  border: 1px solid #e5e9f2;
  border-radius: 8px;
  background: #f7f8fc;
}

.auth-tab {
  height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-weight: 700;
}

.auth-tab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(34, 42, 70, 0.09);
}

.auth-form input {
  height: 46px;
  padding: 0 14px;
}

.auth-form label span {
  color: #4c5567;
  font-weight: 700;
}

.primary,
.secondary,
.danger-button,
.plain-button {
  height: 42px;
  border-radius: 8px;
  font-weight: 700;
}

.primary {
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(63, 70, 232, 0.2);
}

.primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 22px rgba(63, 70, 232, 0.26);
}

.secondary {
  background: #f8f9fd;
  border-color: #dfe4ee;
}

.secondary:hover,
.plain-button:hover {
  border-color: rgba(63, 70, 232, 0.28);
  background: #eef1ff;
  color: var(--accent);
}

.danger-button:hover {
  background: #fff1f2;
}

.app-shell {
  grid-template-columns: 86px 352px minmax(0, 1fr);
  background: #eef1f6;
}

.nav-rail {
  background: linear-gradient(180deg, #4750ee 0%, #3f46e8 56%, #3540d4 100%);
}

.rail-avatar {
  width: 58px;
  height: 58px;
  margin-top: 26px;
  border-width: 3px;
  box-shadow: 0 12px 26px rgba(15, 22, 90, 0.24);
}

.rail-nav {
  gap: 22px;
}

.rail-item,
.rail-action {
  border-radius: 8px;
}

.rail-item:hover,
.rail-item.active,
.rail-action:hover {
  background: rgba(255, 255, 255, 0.16);
}

.rail-item.active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rail-item.active::before {
  left: -13px;
  height: 32px;
}

.side-pane {
  border-right: 1px solid #dfe3ec;
  box-shadow: 8px 0 24px rgba(22, 31, 54, 0.035);
}

.side-header {
  grid-template-columns: minmax(0, 1fr) 42px;
  padding: 14px 14px 10px;
}

.side-header input {
  height: 42px;
  border-radius: 8px;
  background: #f8f9fd;
}

.round-action {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-size: 25px;
}

.side-list {
  padding: 4px 12px 20px;
}

.alpha-title,
.section-label {
  margin: 18px 8px 8px;
  font-size: 15px;
  font-weight: 800;
  color: #9aa1af;
}

.list-card {
  min-height: 74px;
  padding: 10px 10px;
  border-radius: 8px;
  border-bottom: 0;
}

.list-card:hover {
  background: #f5f7fc;
}

.list-card.active {
  margin-inline: 0;
  padding-inline: 10px;
  background: #eef0ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.list-title {
  font-size: 16px;
  font-weight: 800;
}

.list-subtitle {
  color: #7b8393;
  line-height: 1.35;
}

.avatar,
.small-avatar,
.chat-avatar,
.member-avatar,
.profile-card-avatar,
.call-avatar {
  box-shadow: 0 8px 18px rgba(31, 42, 68, 0.1);
}

.badge {
  min-width: 20px;
  height: 20px;
  font-size: 11px;
}

.main-panel {
  background: #f2f4f8;
}

.profile-page,
.detail-page,
.settings-page {
  padding: 24px 30px 40px;
}

.hero-card,
.content-card {
  border: 1px solid rgba(225, 230, 239, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.hero-card {
  min-height: 126px;
  padding: 24px 32px;
}

.hero-title {
  font-size: 30px;
  font-weight: 800;
}

.hero-meta {
  color: #8991a3;
}

.content-card {
  padding: 24px 26px;
}

.card-title {
  font-size: 21px;
  font-weight: 800;
}

.result-item,
.member-item,
.check-card,
.settings-option {
  border-color: #e3e7ef;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(31, 42, 68, 0.045);
}

.result-item:hover,
.member-item:hover,
.check-card:hover {
  border-color: #d3d9e7;
  background: #fcfdff;
}

.chat-page {
  grid-template-rows: 72px minmax(0, 1fr) 220px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(246, 247, 250, 0.82)),
    var(--chat);
}

.chat-header {
  border-bottom-color: #e4e8f0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 20px rgba(28, 38, 65, 0.04);
}

.chat-header h2 {
  font-size: 21px;
  font-weight: 800;
}

.chat-menu {
  border-radius: 8px;
  font-weight: 800;
}

.messages {
  padding: 24px 30px;
}

.time-tip,
.system-tip {
  font-size: 13px;
}

.message {
  max-width: min(74%, 760px);
  margin: 14px 0;
}

.message-meta {
  color: #697386;
}

.bubble {
  margin-top: 5px;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31, 42, 68, 0.08);
}

.message.self .bubble {
  background: linear-gradient(135deg, #5662f2, #3f46e8);
}

.bubble::before,
.message.self .bubble::before {
  top: 13px;
}

.chat-image {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.12);
}

.file-card {
  border-radius: 8px;
  border-color: #e4e8f0;
  box-shadow: 0 10px 24px rgba(31, 42, 68, 0.08);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: #fff1ed;
  color: #d6421e;
  font-size: 13px;
}

.composer {
  border-top-color: #e2e6ee;
  box-shadow: 0 -10px 28px rgba(31, 42, 68, 0.06);
}

.composer-tools {
  gap: 10px;
  padding-inline: 22px;
}

.tool-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.tool-button:hover {
  background: #eef1ff;
}

.composer textarea {
  padding: 13px 16px;
  background: #fff;
}

.send-row {
  padding-inline: 22px;
}

.send-button {
  min-width: 128px;
}

.emoji-panel {
  border-radius: 8px;
  box-shadow: var(--shadow-float);
}

.modal {
  background: rgba(17, 24, 39, 0.38);
  backdrop-filter: blur(4px);
}

.modal-card {
  border-radius: 8px;
  border: 1px solid rgba(225, 230, 239, 0.72);
  box-shadow: 0 28px 80px rgba(16, 24, 42, 0.28);
}

.modal-header {
  height: 58px;
  background: #fbfcff;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
}

.close-button {
  border-radius: 8px;
}

.toast {
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(16, 24, 42, 0.24);
}

.side-list::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.profile-page::-webkit-scrollbar,
.detail-page::-webkit-scrollbar,
.settings-page::-webkit-scrollbar,
.emoji-panel::-webkit-scrollbar {
  width: 8px;
}

.side-list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.profile-page::-webkit-scrollbar-thumb,
.detail-page::-webkit-scrollbar-thumb,
.settings-page::-webkit-scrollbar-thumb,
.emoji-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(130, 140, 158, 0.36);
}

.side-list::-webkit-scrollbar-thumb:hover,
.messages::-webkit-scrollbar-thumb:hover,
.profile-page::-webkit-scrollbar-thumb:hover,
.detail-page::-webkit-scrollbar-thumb:hover,
.settings-page::-webkit-scrollbar-thumb:hover,
.emoji-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(130, 140, 158, 0.54);
}

/* Comprehensive polish pack */
.avatar,
.small-avatar,
.chat-avatar,
.member-avatar,
.profile-card-avatar,
.call-avatar {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.36), transparent 34%),
    linear-gradient(145deg, hsl(var(--avatar-hue, 236deg) 72% 58%), hsl(calc(var(--avatar-hue, 236deg) + 42deg) 74% 42%));
}

.rail-avatar {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.4), transparent 34%),
    linear-gradient(145deg, hsl(var(--avatar-hue, 236deg) 72% 58%), hsl(calc(var(--avatar-hue, 236deg) + 42deg) 74% 42%));
}

.hero-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.friend-detail-page,
.group-detail-page {
  display: grid;
  align-content: start;
  gap: 18px;
}

.friend-detail-page {
  grid-template-columns: minmax(0, 1fr);
}

.group-detail-page {
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
}

.friend-detail-page .hero-card,
.group-detail-page .hero-card,
.group-members-card,
.group-files-card {
  grid-column: 1 / -1;
}

.group-info-card {
  align-self: start;
}

.section-toolbar,
.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-toolbar .card-title {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.compact-search {
  width: min(280px, 100%);
  height: 38px;
  padding: 0 12px;
  background: #f8f9fd;
}

.detail-toolbar .compact-search {
  flex: 1;
  min-width: 180px;
}

.group-members-card .group-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.member-item {
  min-height: 76px;
}

.member-item.hidden,
.group-file-item.hidden {
  display: none !important;
}

.group-file-item .file-icon {
  width: 46px;
  height: 46px;
  font-size: 12px;
}

.drop-hint {
  position: absolute;
  inset: 10px;
  z-index: 3;
  display: none;
  place-items: center;
  border: 2px dashed rgba(63, 70, 232, 0.42);
  border-radius: 8px;
  background: rgba(246, 248, 255, 0.9);
  color: var(--accent);
  font-weight: 800;
  pointer-events: none;
}

.composer {
  position: relative;
}

.composer.drag-over .drop-hint {
  display: grid;
}

.composer textarea {
  min-height: 84px;
  max-height: 150px;
}

.message-actions {
  min-width: 52px;
}

.profile-card {
  min-width: min(420px, calc(100vw - 88px));
}

.profile-card-info div {
  grid-template-columns: 92px minmax(0, 1fr);
}

.private-tools-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-page .content-card,
.detail-page .content-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.settings-page .content-card:hover,
.detail-page .content-card:hover {
  border-color: #d9deea;
  box-shadow: 0 14px 34px rgba(31, 42, 68, 0.09);
}

.auth-card,
.hero-card,
.content-card,
.modal-card {
  backdrop-filter: saturate(1.08);
}

@media (max-width: 1280px) {
  .group-detail-page {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .private-tools-grid {
    grid-template-columns: 1fr;
  }

  .section-toolbar,
  .detail-toolbar,
  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-search {
    width: 100%;
  }
}

