/* ==================== 基础 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    --bg: #EDEDED;
    --panel: #FFFFFF;
    --border: #E5E5E5;
    --text: #191919;
    --text-secondary: #8C8C8C;
    --green: #07C160;
    --green-hover: #06AD56;
    --bubble-ai: #FFFFFF;
    --bubble-user: #95EC69;
    --hover: #F2F2F2;
    --active: #DEDEDE;
    --input-bg: #F5F5F5;
    --sidebar-width: 320px;
    --list-bg: #FFFFFF;
    --search-bg: #F2F2F2;
    --tab-bg: #F7F7F7;
    --tab-inactive: #191919;
    --info-bg: #EDEDED;
    --separator: rgba(0, 0, 0, 0.08);
    --chevron: #C7C7CC;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft YaHei", Tahoma, SimSun, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-size: 15px;
    font-weight: 400;
}

/* ==================== 布局 ==================== */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* ==================== 左侧微信列表 ==================== */
.wx-sidebar {
    position: relative;
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: var(--list-bg);
    border-right: 0.5px solid var(--border);
}

.wx-sidebar-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.wx-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* 列表头部 */
.wx-list-header {
    position: relative;
    flex-shrink: 0;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background-color: var(--list-bg);
    border-bottom: 0.5px solid var(--border);
}

.wx-list-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.wx-list-actions {
    position: absolute;
    right: 6px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.wx-icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.wx-icon-btn:hover {
    background-color: var(--hover);
}

.wx-icon-btn svg {
    width: 20px;
    height: 20px;
}

/* 微信式搜索页 */
.wx-search-page {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    background-color: var(--list-bg);
    animation: search-page-in .16s ease-out;
}

@keyframes search-page-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.search-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 12px 10px;
    background-color: var(--list-bg);
}

.search-back {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.search-back svg {
    width: 22px;
    height: 22px;
}

.search-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 4px 0 10px;
    border-radius: 8px;
    background-color: var(--search-bg);
}

.search-field-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    color: #B2B2B2;
}

#searchInput {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    outline: none;
}

#searchInput::placeholder {
    color: #B2B2B2;
}

.search-mic {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #7F7F7F;
    cursor: pointer;
}

.search-mic svg {
    width: 20px;
    height: 20px;
}

.search-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 16px 0;
}

.search-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px 8px;
    color: #999999;
    font-size: 14px;
}

.search-clear {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #B2B2B2;
    cursor: pointer;
}

.search-clear svg {
    width: 18px;
    height: 18px;
}

.search-recent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    row-gap: 2px;
}

.search-recent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.search-recent-item:hover {
    background-color: var(--hover);
}

.search-recent-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #B2B2B2;
}

.search-recent-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-results {
    padding-top: 4px;
}

.search-result {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.search-result:hover {
    background-color: var(--hover);
}

.search-result-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 5px;
    background-color: var(--search-bg);
    color: #B2B2B2;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-avatar svg {
    width: 24px;
    height: 24px;
}

.search-result-main {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-sub {
    margin-top: 2px;
    overflow: hidden;
    color: #999999;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-empty {
    padding: 32px 0;
    color: #B2B2B2;
    font-size: 13px;
    text-align: center;
}

.search-bottom {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
}

.search-ask {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 28px;
    border: none;
    border-radius: 999px;
    background-color: var(--list-bg);
    box-shadow: 0 2px 16px rgba(0, 0, 0, .08);
    cursor: pointer;
}

.search-ask-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.search-ask-dots {
    display: flex;
    gap: 3px;
}

.search-ask-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--text);
}

.search-ask-sub {
    color: #B2B2B2;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.3;
}

.search-page-settings {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: #576B95;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

/* 联系人列表 */
.wx-conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background-color: var(--list-bg);
}

.wx-conversation-list::-webkit-scrollbar,
.chat-info-body::-webkit-scrollbar {
    width: 6px;
}

.wx-conversation-list::-webkit-scrollbar-track,
.chat-info-body::-webkit-scrollbar-track {
    background: transparent;
}

.wx-conversation-list::-webkit-scrollbar-thumb,
.chat-info-body::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background-color: var(--border);
}

.wx-conversation {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.wx-conversation + .wx-conversation::before {
    content: "";
    position: absolute;
    top: 0;
    left: 76px;
    right: 0;
    height: 0.5px;
    background-color: var(--separator);
}

.wx-conversation:hover {
    background-color: var(--hover);
}

.wx-conversation.is-pinned {
    background-color: #F7F7F7;
}

.wx-conversation.is-active {
    background-color: var(--active);
}

.wx-conversation.is-pinned.is-active {
    background-color: var(--active);
}

.wx-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background-color: #E5E5E5;
}

.wx-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.wx-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--green);
    color: #FFFFFF;
}

.wx-avatar-fallback svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wx-conversation-main {
    flex: 1;
    min-width: 0;
}

.wx-conversation-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wx-conversation-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wx-conversation-time {
    flex-shrink: 0;
    font-size: 12px;
    color: #B2B2B2;
}

.wx-conversation-preview {
    margin-top: 3px;
    min-height: 1.3em;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    color: #999999;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 会话列表里的"正在输入…"：回复期间保持呼吸闪烁，离开聊天页也能看到 */
.wx-conversation-preview.is-typing {
    color: var(--green);
    animation: typing-blink 1.2s ease-in-out infinite;
}

@keyframes typing-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.wx-list-empty {
    padding: 40px 16px;
    color: #B2B2B2;
    font-size: 13px;
    text-align: center;
}

/* 占位页 */
.wx-placeholder-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #B2B2B2;
}

.wx-placeholder-body svg {
    width: 64px;
    height: 64px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wx-placeholder-title {
    font-size: 16px;
    color: #8C8C8C;
}

.wx-placeholder-sub {
    font-size: 12px;
    color: #B2B2B2;
}

/* 底部标签栏 */
.wx-tabbar {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 5px 0 calc(4px + env(safe-area-inset-bottom));
    background-color: var(--tab-bg);
    border-top: 0.5px solid var(--separator);
}

.wx-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 2px 0;
    border: none;
    background: transparent;
    color: var(--tab-inactive);
    font-family: inherit;
    font-size: 10px;
    line-height: 1.2;
    cursor: pointer;
}

.wx-tab svg {
    width: 24px;
    height: 24px;
}

.wx-tab[data-pane="chats"]:not(.is-active) svg :is(path, rect) {
    fill: var(--tab-inactive);
}

.wx-tab[data-pane="chats"]:not(.is-active) svg circle {
    fill: var(--tab-bg);
}

.wx-tab.is-active {
    color: var(--green);
}

/* ==================== 聊天主区域 ==================== */
.chat-container {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg);
}

/* 顶部导航栏 */
.chat-header {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    height: 56px;
    flex-shrink: 0;
    padding: 0 max(12px, calc((100% - 800px) / 2));
    background-color: var(--panel);
    border-bottom: 0.5px solid #E5E5E5;
}

.chat-title {
    overflow: hidden;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.header-btn:hover {
    background-color: var(--hover);
}

.header-btn svg {
    width: 22px;
    height: 22px;
}

.header-btn-back {
    visibility: hidden;
}

.chat-container:not(.has-chat) .header-btn-more {
    visibility: hidden;
}

/* 未选择聊天 */
.chat-empty-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #B2B2B2;
    user-select: none;
}

.chat-empty-pane svg {
    width: 64px;
    height: 64px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-empty-title {
    font-size: 14px;
}

.chat-container.has-chat .chat-empty-pane {
    display: none;
}

.chat-container:not(.has-chat) .chat-messages,
.chat-container:not(.has-chat) .chat-input-container {
    display: none;
}

/* ==================== 消息列表 ==================== */
.chat-messages {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 同一发送者连续消息间距更紧，不同发送者之间拉开 */
.message.assistant + .message.user,
.message.user + .message.assistant {
    margin-top: 8px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background-color: var(--border);
}

/* 时间戳：居中纯文本，无背景 */
.time-divider {
    align-self: center;
    margin: 8px 0;
    padding: 0 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #B2B2B2;
    text-align: center;
    user-select: none;
}

/* 消息行 */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 70%;
    animation: fadeIn 0.18s ease;
}

.message.assistant {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头像：小圆角矩形，顶部对齐 */
.message-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    overflow: hidden;
    color: #FFFFFF;
}

.message.assistant .message-avatar {
    background-color: var(--green);
}

.message.user .message-avatar {
    background-color: #A9B2BF;
}

.message-avatar svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.avatar-img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
    object-position: center top;
}

/* 消息内容列 */
.message-body {
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.message.user .message-body {
    align-items: flex-end;
}

/* 气泡：扁平、小圆角、尖角 */
.message-content {
    position: relative;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 4px;
    background-color: var(--bubble-ai);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    word-break: break-all;
    white-space: pre-wrap;
}

.message.user .message-content {
    background-color: var(--bubble-user);
}

.message.assistant .message-content::before {
    content: "";
    position: absolute;
    top: 12px;
    left: -6px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-right: 6px solid var(--bubble-ai);
    border-bottom: 5px solid transparent;
}

.message.user .message-content::after {
    content: "";
    position: absolute;
    top: 12px;
    right: -6px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--bubble-user);
}

/* 表情包：独立于气泡，裸图渲染 */
.sticker {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    animation: stickerIn 0.2s ease;
}

@keyframes stickerIn {
    from {
        opacity: 0;
        transform: scale(0.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 表情面板：4 列网格，点击直接发送 */
.input-tool-sticker {
    cursor: pointer;
    border-radius: 4px;
}

.input-tool-sticker.active {
    color: var(--green);
}

.sticker-panel {
    width: 100%;
    max-width: 768px;
    height: 248px;
    margin: 8px auto 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #F7F7F7;
    border-radius: 8px;
}

.sticker-panel[hidden] {
    display: none;
}

.sticker-tabs {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    padding: 8px 10px;
    overflow-x: auto;
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border);
}

.sticker-tabs::-webkit-scrollbar {
    display: none;
}

.sticker-tab {
    flex-shrink: 0;
    padding: 5px 12px;
    border: none;
    border-radius: 12px;
    background-color: transparent;
    color: #666666;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
}

.sticker-tab.active {
    background-color: var(--green);
    color: #FFFFFF;
}

.sticker-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    align-content: start;
}

.sticker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    border-radius: 6px;
    background-color: #FFFFFF;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.sticker-item:active {
    background-color: #ECECEC;
}

.sticker-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.sticker-empty {
    grid-column: 1 / -1;
    padding: 28px 0;
    color: #999999;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 480px) {
    .sticker-panel {
        height: 220px;
        margin-top: 6px;
    }

    .sticker-grid {
        gap: 6px;
        padding: 8px;
    }
}

/* ==================== 输入区域 ==================== */
.chat-input-container {
    flex-shrink: 0;
    width: 100%;
    padding: 10px 16px 14px;
    background-color: var(--input-bg);
    border-top: 1px solid var(--border);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
}

/* 仅作展示的语音、表情、更多图标 */
.input-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 38px;
    flex-shrink: 0;
    color: var(--text);
    user-select: none;
}

.input-tool svg {
    width: 30px;
    height: 30px;
}

.chat-input-field {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    background-color: var(--panel);
    border: none;
    border-radius: 5px;
    overflow: hidden;
}

.chat-input {
    flex: 1;
    min-width: 0;
    min-height: 38px;
    max-height: 120px;
    padding: 9px 38px 9px 12px;
    border: none;
    border-radius: 5px;
    background-color: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    line-height: 20px;
    outline: none;
    resize: none;
    overflow-y: auto;
    scrollbar-width: none;
}

.chat-input::-webkit-scrollbar {
    display: none;
}

.chat-input::placeholder {
    color: #B2B2B2;
}

.input-mic {
    position: absolute;
    right: 9px;
    bottom: 9px;
    display: inline-flex;
    color: var(--text-secondary);
    pointer-events: none;
    user-select: none;
}

.input-mic svg {
    width: 20px;
    height: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease, visibility 0.15s ease;
}

.btn-send {
    display: none;
    height: 38px;
    padding: 0 16px;
    flex-shrink: 0;
    background-color: var(--green);
    color: #FFFFFF;
    font-size: 15px;
}

.btn-send.is-visible {
    display: inline-flex;
}

.chat-input-wrapper.has-text .input-tool-plus {
    display: none;
}

.btn-send:hover {
    background-color: var(--green-hover);
}

/* ==================== 加载动画 ==================== */
.loading {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
}

.loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--green);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ==================== 空状态 ==================== */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #B2B2B2;
    text-align: center;
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state-text {
    font-size: 13px;
}

/* ==================== 聊天信息页 ==================== */
.chat-info {
    position: absolute;
    inset: 0;
    z-index: 120;
    display: flex;
    flex-direction: column;
    background-color: var(--info-bg);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s ease;
}

.chat-info.show {
    transform: translateX(0);
    visibility: visible;
}

.chat-info-header {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    height: 56px;
    padding: 0 6px;
    background-color: var(--info-bg);
    border-bottom: 0.5px solid var(--separator);
}

.chat-info-title {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}

.chat-info-spacer {
    width: 36px;
    height: 36px;
}

.chat-info-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-anchor: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 24px;
}

.info-group {
    width: 100%;
    max-width: 560px;
    flex-shrink: 0;
    background-color: var(--panel);
}

.info-group + .info-group {
    margin-top: 8px;
}

/* 头像 + 加号 */
.info-members {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
}

.member-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 60px;
    padding: 0;
    border: none;
    background: transparent;
    font-family: inherit;
}

.member-avatar {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    background-color: #E5E5E5;
    color: #FFFFFF;
}

.member-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.member-avatar svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.member-name {
    max-width: 64px;
    overflow: hidden;
    font-size: 12px;
    color: #999999;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-tile-add {
    cursor: pointer;
}

.member-add-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #C8C8CC;
    border-radius: 6px;
    color: #C8C8CC;
    font-size: 30px;
    font-weight: 200;
    line-height: 1;
}

.info-members-chevron {
    width: 18px;
    height: 18px;
    align-self: center;
    margin-left: auto;
    flex-shrink: 0;
    color: var(--chevron);
}

/* 信息行 */
.info-row {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 56px;
    padding: 0 16px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    text-align: left;
}

button.info-row {
    cursor: pointer;
}

button.info-row:active {
    background-color: rgba(0, 0, 0, 0.04);
}

.info-row + .info-row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 0;
    height: 0.5px;
    background-color: var(--separator);
}

.info-label {
    flex: 1;
    min-width: 0;
}

.info-value {
    margin-right: 8px;
    font-size: 15px;
    color: #B2B2B2;
}

.info-chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--chevron);
}

/* iOS 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    flex-shrink: 0;
}

.switch input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.switch-track {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background-color: #E5E5E5;
    transition: background-color 0.2s ease;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background-color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.switch input:checked + .switch-track {
    background-color: var(--green);
}

.switch input:checked + .switch-track::after {
    transform: translateX(20px);
}

/* ==================== 背景选择浮层 ==================== */
.wx-sheet-mask {
    position: absolute;
    inset: 0;
    z-index: 130;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.wx-sheet-mask.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wx-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 140;
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s ease;
}

.wx-sheet.show {
    transform: translateY(0);
    visibility: visible;
}

.wx-sheet-card {
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--panel);
}

.wx-sheet-title {
    padding: 14px 16px 10px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.wx-sheet-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    border: none;
    background-color: var(--panel);
    color: var(--text);
    font-family: inherit;
    font-size: 17px;
    cursor: pointer;
}

.wx-sheet-option + .wx-sheet-option::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 0.5px;
    background-color: var(--separator);
}

.wx-sheet-option:active {
    background-color: var(--hover);
}

.wx-sheet-check {
    position: absolute;
    right: 16px;
    width: 20px;
    height: 20px;
    color: var(--green);
    visibility: hidden;
}

.wx-sheet-option.active .wx-sheet-check {
    visibility: visible;
}

.wx-sheet-cancel {
    width: 100%;
    height: 52px;
    margin-top: 8px;
    border: none;
    border-radius: 12px;
    background-color: var(--panel);
    color: var(--text);
    font-family: inherit;
    font-size: 17px;
    cursor: pointer;
}

.wx-sheet-cancel:active {
    background-color: var(--hover);
}

/* ==================== 轻提示 ==================== */
.wx-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 300;
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.75);
    color: #FFFFFF;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.96);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    pointer-events: none;
}

.wx-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ==================== 深色主题 ==================== */
body.theme-dark {
    --bg: #111111;
    --panel: #1E1E1E;
    --border: #2C2C2C;
    --text: #EDEDED;
    --text-secondary: #8A8A8A;
    --bubble-ai: #2C2C2E;
    --bubble-user: #3E7B4F;
    --hover: #2A2A2A;
    --active: #333333;
    --input-bg: #1A1A1A;
    --list-bg: #1E1E1E;
    --search-bg: #2C2C2E;
    --tab-bg: #1A1A1A;
    --tab-inactive: #8A8A8A;
    --info-bg: #111111;
    --separator: rgba(255, 255, 255, 0.08);
    --chevron: #5A5A5E;
}

body.theme-dark .chat-header {
    border-bottom-color: #2C2C2C;
}

body.theme-dark .time-divider {
    color: #7F7F7F;
}

body.theme-dark .chat-input-field {
    background-color: #2C2C2E;
}

body.theme-dark .chat-input {
    color: #EDEDED;
}

body.theme-dark .wx-conversation.is-pinned {
    background-color: #242424;
}

body.theme-dark .wx-avatar {
    background-color: #2C2C2C;
}

body.theme-dark .member-avatar {
    background-color: #2C2C2C;
}

body.theme-dark .switch-track {
    background-color: #3A3A3C;
}

body.theme-dark .member-add-box {
    border-color: #4A4A4E;
    color: #6A6A6E;
}

body.theme-dark .chat-info {
    background-color: var(--info-bg);
}

body.theme-dark button.info-row:active {
    background-color: rgba(255, 255, 255, 0.05);
}

body.theme-dark .search-ask {
    box-shadow: 0 2px 16px rgba(0, 0, 0, .55);
}

body.theme-dark .search-page-settings {
    color: #7D90A9;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .wx-sidebar {
        width: 100%;
        border-right: none;
    }

    .chat-container {
        position: fixed;
        inset: 0;
        z-index: 150;
        transform: translateX(100%);
        transition: transform 0.25s ease;
    }

    .app-container.chat-open .chat-container {
        transform: translateX(0);
    }

    .chat-container.has-chat .header-btn-back {
        visibility: visible;
    }

    .chat-header {
        padding: 0 6px;
    }

    .chat-messages {
        padding: 16px 12px;
    }

    .chat-input-container {
        padding: 8px 12px 12px;
    }

    .chat-info-body {
        padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .sticker {
        width: 96px;
        height: 96px;
    }

    .chat-input-wrapper {
        gap: 6px;
    }

    .input-tool {
        width: 30px;
        height: 38px;
    }

    .input-tool svg {
        width: 26px;
        height: 26px;
    }

    .input-mic {
        right: 8px;
        bottom: 9px;
    }

    .btn-send {
        padding: 0 12px;
    }
}
