:root {
  --bg: #eef0f3;
  --panel: #f7f8fa;
  --panel-2: #ffffff;
  --border: #e4e7ec;
  --text: #1f2329;
  --muted: #8c94a1;
  --soft: #a6adb8;
  --green: #07c160;
  --green-soft: #e7f7ef;
  --red: #fa5151;
  --bubble-mine: #95ec69;
  --bubble-other: #ffffff;
  --rail: #2b2b2d;
  --rail-text: #a6a6aa;
  --shadow: 0 12px 40px rgba(22, 32, 48, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  user-select: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

svg {
  display: block;
}

.hidden {
  display: none !important;
}

.titlebar {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  background: #f5f6f8;
  border-bottom: 1px solid var(--border);
}

.titlebar-drag {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  -webkit-app-region: drag;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(145deg, #19db7d, #009e5b);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: #59616e;
}

.brand-copy strong {
  font-size: 12px;
  color: #39404b;
}

.brand-copy span {
  font-size: 10px;
  color: #a0a7b2;
}

.window-controls {
  display: flex;
  height: 100%;
  -webkit-app-region: no-drag;
}

.window-controls button {
  width: 46px;
  height: 100%;
  color: #7c8490;
  font-size: 15px;
}

.window-controls button:hover {
  background: #e8eaee;
}

.window-controls button.close:hover {
  background: #e81123;
  color: #fff;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 22% 20%, rgba(7, 193, 96, 0.12), transparent 34%),
    radial-gradient(circle at 80% 82%, rgba(91, 124, 250, 0.1), transparent 36%),
    linear-gradient(145deg, #eef2f6, #e5e9ef);
}

.login-card {
  width: 380px;
  padding: 42px 38px 26px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 26px 70px rgba(28, 39, 58, 0.16);
  backdrop-filter: blur(22px);
  text-align: center;
}

.login-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, #17d978, #009e5b);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 30px rgba(0, 180, 90, 0.3);
}

.login-card h1 {
  font-size: 27px;
  letter-spacing: 0.4px;
}

.login-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.login-card form {
  margin-top: 30px;
  text-align: left;
}

.login-card label {
  display: block;
  margin-bottom: 15px;
}

.login-card label span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: #6d7582;
}

.login-card input {
  width: 100%;
  height: 44px;
  border: 1px solid #dfe3e9;
  border-radius: 10px;
  padding: 0 13px;
  outline: none;
  background: #fff;
  transition: 0.15s ease;
}

.login-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.login-error {
  min-height: 18px;
  margin: -2px 0 8px;
  color: var(--red);
  font-size: 12px;
}

.primary-btn {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  letter-spacing: 1px;
}

.primary-btn:hover {
  background: #06ad56;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.login-foot {
  margin-top: 22px;
  color: #adb4be;
  font-size: 10px;
}

.install-btn {
  margin-top: 14px;
  width: 100%;
}

.main {
  position: fixed;
  inset: 0;
  display: flex;
  overflow: hidden;
  background: var(--bg);
}

.rail {
  width: 74px;
  flex-shrink: 0;
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 16px;
  order: 1;
}

.rail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.rail-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  color: var(--rail-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-btn svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.rail-btn:hover {
  background: #37373a;
  color: #e8e8ea;
}

.rail-btn.active {
  background: #3a3a3d;
  color: #fff;
}

.rail-btn.active::after {
  content: "";
  position: absolute;
  left: -13px;
  top: 13px;
  width: 4px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}

.rail-badge {
  position: absolute;
  right: 3px;
  top: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rail);
}

.rail-bottom {
  margin-top: auto;
}

.rail-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #e6a23c;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.list-panel {
  width: 326px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  order: 2;
}

.list-head {
  height: 70px;
  flex-shrink: 0;
  padding: 18px 18px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.list-head h2 {
  font-size: 20px;
  font-weight: 600;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #5b6472;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.icon-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.search-box {
  flex-shrink: 0;
  height: 36px;
  margin: 2px 16px 10px;
  border-radius: 9px;
  background: #eceef2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: #9aa1ad;
}

.search-box svg {
  width: 15px;
  height: 15px;
  fill: #9aa1ad;
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12.5px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 10px;
}

.conversation-list::-webkit-scrollbar,
.message-scroll::-webkit-scrollbar {
  width: 5px;
}

.conversation-list::-webkit-scrollbar-thumb,
.message-scroll::-webkit-scrollbar-thumb {
  background: #cfd4dc;
  border-radius: 3px;
}

.conv-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
}

.conv-item:hover {
  background: rgba(0, 0, 0, 0.035);
}

.conv-item.active {
  background: #e8ebef;
}

.conv-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}

.avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #65748a;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.conv-main {
  flex: 1;
  min-width: 0;
}

.conv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.conv-name {
  min-width: 0;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-name .bot-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--green-soft);
  color: #07a45b;
  font-size: 9px;
  font-weight: 400;
  vertical-align: 1px;
}

.conv-time {
  flex-shrink: 0;
  color: var(--soft);
  font-size: 10.5px;
}

.conv-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.conv-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f2f3f5;
  position: relative;
  order: 3;
}

.drop-hint {
  position: absolute;
  inset: 12px;
  z-index: 30;
  border: 2px dashed var(--green);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--green);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}

.empty-logo {
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
  border-radius: 22px;
  background: linear-gradient(145deg, #1be080, #009e5b);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  box-shadow: 0 18px 42px rgba(0, 170, 90, 0.2);
}

.chat-empty h3 {
  font-size: 18px;
  color: #4d5562;
  font-weight: 500;
}

.chat-empty p {
  font-size: 12px;
  color: #a1a8b3;
}

.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-head {
  height: 66px;
  flex-shrink: 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 20px 0 22px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #65748a;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.chat-head-copy {
  min-width: 0;
}

.chat-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sub {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
}

.chat-tools {
  margin-left: auto;
  display: flex;
  gap: 5px;
}

.chat-tools .icon-btn {
  width: 36px;
  height: 36px;
}

.chat-tools img {
  width: 21px;
  height: 21px;
}

.message-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 30px 10px;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.time-tip {
  align-self: center;
  margin: 4px 0;
  color: #a4abb5;
  font-size: 10.5px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 78%;
}

.msg-row.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.recall-btn {
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.recall-btn:hover {
  color: var(--red);
}

.msg-row .avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
}

.msg-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.msg-row.mine .msg-body {
  align-items: flex-end;
}

.bubble {
  position: relative;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--bubble-other);
  color: #1f2329;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
}

.bubble.mine {
  background: var(--bubble-mine);
}

.bubble::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 13px;
  border: 6px solid transparent;
  border-right-color: var(--bubble-other);
  border-left: 0;
}

.bubble.mine::before {
  left: auto;
  right: -5px;
  border-right: 0;
  border-left-color: var(--bubble-mine);
}

.msg-image {
  max-width: 260px;
  max-height: 220px;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
  object-fit: cover;
}

.audio-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
  cursor: pointer;
}

.audio-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
}

.audio-bars i {
  width: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.7;
}

.audio-bars i:nth-child(1) { height: 7px; }
.audio-bars i:nth-child(2) { height: 14px; }
.audio-bars i:nth-child(3) { height: 9px; }
.audio-bars i:nth-child(4) { height: 17px; }
.audio-bars i:nth-child(5) { height: 11px; }

.bubble.file-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  max-width: 300px;
  text-decoration: none;
  color: var(--text);
}

.file-icon {
  width: 38px;
  height: 44px;
  border-radius: 7px;
  background: #eef3ff;
  color: #3d6ee8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.file-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-copy strong {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.file-copy small {
  color: var(--muted);
  font-size: 11px;
}

.msg-video {
  display: block;
  max-width: 360px;
  max-height: 280px;
  border-radius: 10px;
  background: #000;
}

.msg-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a4abb5;
  font-size: 10px;
}

.msg-meta .read {
  color: var(--green);
}

.msg-meta .read.unread {
  color: #b0b6bf;
}

.call-tip {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.045);
  color: #8f96a1;
  font-size: 11px;
}

.typing-line {
  padding: 0 4px 6px;
  color: #939aa5;
  font-size: 11px;
}

.composer {
  flex-shrink: 0;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  padding: 8px 20px 12px;
  position: relative;
}

.composer-tools {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: #6f7784;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.tool-btn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

#voice-btn.recording {
  background: #ffe8e8;
  color: #e53935;
}

.composer-hint {
  margin-left: auto;
  color: #b3b9c3;
  font-size: 9.5px;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.composer-row textarea {
  flex: 1;
  height: 66px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  background: var(--panel-2);
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 13.5px;
}

.composer-row textarea:focus {
  border-color: rgba(7, 193, 96, 0.5);
}

.send-btn {
  width: 82px;
  height: 36px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}

.send-btn:disabled {
  background: #d9dde3;
  color: #fff;
  cursor: default;
}

.emoji-panel {
  position: absolute;
  left: 18px;
  bottom: 118px;
  width: 330px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  z-index: 12;
}

.emoji-panel button {
  height: 28px;
  border-radius: 6px;
  font-size: 18px;
}

.emoji-panel button:hover {
  background: rgba(0, 0, 0, 0.05);
}

.side-panel {
  display: none;
  order: 2;
}

.side-tabs {
  display: flex;
  gap: 4px;
  margin: 2px 16px 8px;
  padding: 3px;
  border-radius: 8px;
  background: #eceef2;
}

.side-tab {
  flex: 1;
  height: 29px;
  border-radius: 6px;
  color: #7a828e;
  font-size: 11.5px;
}

.side-tab.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.mini-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 3px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0 34px 40px;
  background: var(--bg);
  order: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.settings-head,
.profile-card,
.settings-group,
.danger-btn {
  width: 100%;
  max-width: 780px;
}

.settings-head {
  padding: 28px 0 16px;
  align-self: center;
  max-width: 780px;
  margin: 0 auto;
}

.settings-head h2 {
  font-size: 22px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.profile-avatar {
  width: 66px;
  height: 66px;
  border-radius: 16px;
  background: #e6a23c;
  color: #fff;
  font-size: 25px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
}

.profile-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-copy strong {
  font-size: 19px;
}

.profile-copy span {
  color: var(--muted);
  font-size: 12px;
}

.ghost-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: #5d6572;
  font-size: 11.5px;
}

.ghost-btn:hover {
  border-color: #cfd4dc;
}

.settings-group {
  margin-top: 16px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
}

.setting-row + .setting-row {
  border-top: 1px solid var(--border);
}

.setting-row div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-row strong {
  font-size: 13.5px;
  font-weight: 500;
}

.setting-row span {
  color: var(--muted);
  font-size: 11px;
}

.switch {
  width: 42px;
  height: 24px;
  border-radius: 13px;
  background: #d6dae1;
  padding: 3px;
  transition: 0.15s ease;
}

.switch span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: 0.15s ease;
}

.switch.on {
  background: var(--green);
}

.switch.on span {
  transform: translateX(18px);
}

.danger-btn {
  margin-top: 22px;
  width: 100%;
  height: 42px;
  border-radius: 10px;
  background: #fff1f1;
  color: #d94343;
  font-size: 12.5px;
}

.danger-btn:hover {
  background: #ffe7e7;
}

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: #0b0b0d;
  color: #fff;
  overflow: hidden;
}

.call-video-stage {
  position: absolute;
  inset: 0;
  background: #000;
}

.call-video-stage > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.call-video-info {
  position: absolute;
  z-index: 3;
  left: 26px;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.call-video-name {
  font-size: 18px;
  font-weight: 600;
}

.call-video-state {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.call-video-timer {
  color: #fff;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.call-local-video-wrap {
  position: absolute;
  right: 22px;
  top: 22px;
  width: 180px;
  height: 240px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: #111;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.call-local-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.call-avatar-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.call-video-stage:not(.hidden) + .call-avatar-stage {
  display: none;
}

.call-avatar {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  background: #e75b5b;
  color: #fff;
  font-size: 42px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

.call-peer-name {
  font-size: 24px;
  font-weight: 600;
}

.call-status {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}

.call-timer {
  color: #fff;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.call-controls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 44px;
  margin-top: auto;
  padding: 0 30px 52px;
}

.call-control {
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.call-control .circle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-control .circle.green {
  background: var(--green);
}

.call-control .circle.red {
  background: var(--red);
}

.call-control .circle.active {
  background: rgba(7, 193, 96, 0.28);
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.7);
}

.call-control img {
  width: 27px;
  height: 27px;
  object-fit: contain;
}

.call-control span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 10.5px;
}

.modal-backdrop {
  position: fixed;
  inset: 40px 0 0;
  z-index: 300;
  background: rgba(18, 24, 34, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal {
  width: 420px;
  padding: 22px;
  border-radius: 14px;
  background: var(--panel-2);
  box-shadow: 0 24px 80px rgba(20, 30, 45, 0.28);
}

.modal h3 {
  font-size: 16px;
  margin-bottom: 15px;
}

.modal input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 11px;
  outline: none;
  background: var(--panel-2);
}

.modal input:focus {
  border-color: var(--green);
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions button {
  height: 34px;
  padding: 0 15px;
  border-radius: 8px;
  background: #eef0f3;
  color: #5e6673;
  font-size: 12px;
}

.modal-actions button.primary {
  background: var(--green);
  color: #fff;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.search-result .avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
}

.search-result .copy {
  flex: 1;
  min-width: 0;
}

.search-result .copy strong {
  display: block;
  font-size: 13px;
}

.search-result .copy span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}

.search-result button {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--green-soft);
  color: #07a45b;
  font-size: 10.5px;
}

.search-empty {
  padding: 20px 0 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.friend-item,
.request-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px;
  cursor: pointer;
}

.friend-item:hover,
.request-item:hover {
  background: rgba(0, 0, 0, 0.035);
}

.friend-item .avatar,
.request-item .avatar {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  font-size: 14px;
}

.friend-copy,
.request-copy {
  flex: 1;
  min-width: 0;
}

.friend-copy strong,
.request-copy strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-copy span,
.request-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.request-actions {
  display: flex;
  gap: 6px;
}

.request-actions button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef0f3;
  color: #737b88;
}

.request-actions button.accept {
  background: var(--green);
  color: #fff;
}

.toast {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 9px;
  background: rgba(28, 34, 44, 0.88);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.image-viewer {
  position: fixed;
  inset: 40px 0 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer img {
  max-width: 86%;
  max-height: 86%;
  border-radius: 6px;
}

.recording-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  background: #fff0f0;
  color: #d94343;
  font-size: 11px;
}

.recording-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e53935;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

body.dark {
  --bg: #141518;
  --panel: #1c1d21;
  --panel-2: #232429;
  --border: #2f3036;
  --text: #e7e8eb;
  --muted: #8f96a2;
  --soft: #6d737e;
  --green-soft: #123828;
  --bubble-other: #2b2c31;
  --bubble-mine: #1f7a4d;
  --rail: #101114;
}

body.dark .titlebar {
  background: #1a1b1f;
}

body.dark .login-screen {
  background:
    radial-gradient(circle at 22% 20%, rgba(7, 193, 96, 0.12), transparent 34%),
    linear-gradient(145deg, #141518, #1b1c21);
}

body.dark .login-card {
  background: rgba(32, 33, 38, 0.94);
}

body.dark .login-card input {
  background: #26272c;
  border-color: #34353b;
  color: #e7e8eb;
}

body.dark .search-box,
body.dark .side-tabs,
body.dark .modal-actions button,
body.dark .request-actions button {
  background: #2a2b31;
}

body.dark .conv-item.active {
  background: #2a2c32;
}

body.dark .chat-panel {
  background: #17181c;
}

body.dark .bubble {
  color: #e7e8eb;
}

body.dark .bubble.mine {
  color: #fff;
}

body.dark .msg-image {
  box-shadow: 0 0 0 1px #34353b;
}

body.dark .emoji-panel {
  background: #24252a;
}

@media (max-width: 1100px) {
  .list-panel {
    width: 290px;
  }
  .composer-hint {
    display: none;
  }
}

.friend-more {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--muted);
  opacity: 0;
}

.friend-item:hover .friend-more {
  opacity: 1;
}

.friend-more:hover {
  background: rgba(0, 0, 0, 0.05);
}

.modal-field {
  display: block;
  margin: 14px 0;
}

.modal-field span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--muted);
}

.modal-field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
}

.modal-actions .danger {
  color: var(--red);
}

.group-member-list {
  max-height: 320px;
  overflow-y: auto;
  margin: 12px 0;
}

.search-result-list {
  max-height: 320px;
  overflow-y: auto;
  margin: 12px 0;
}

.group-add-title {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.link-danger {
  margin-left: auto;
  color: var(--red);
  font-size: 12px;
}

.group-member small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.group-member {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 4px;
  cursor: pointer;
}

.search-result-list .search-result {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.search-result-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.search-result-main strong {
  font-size: 13px;
}

.search-result-main span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* 图片查看器：左右切换 */
.image-viewer { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.image-viewer img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); cursor: default; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 56px;
  border: none; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff;
  font-size: 34px; line-height: 1; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background .15s; }
.viewer-nav:hover { background: rgba(255,255,255,.34); }
.viewer-prev { left: 18px; }
.viewer-next { right: 18px; }
.viewer-count { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 15px; background: rgba(0,0,0,.45); padding: 4px 14px; border-radius: 20px; }
