* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f2f2f2;
    color: #333;
}
a { color: #129611; text-decoration: none; }
a:hover { text-decoration: underline; }
.bg-gray { background: #d8d8d8; }

/* 登录页 */
.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
.auth-container { max-width: 420px; }
.logo-title { text-align: center; margin-bottom: 20px; font-size: 22px; }

.auth-tabs {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dedede;
    margin-bottom: 20px;
}
.auth-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
}
.auth-tab.active {
    background: #1aad19;
    color: #fff;
}
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.auth-form label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    gap: 4px;
}
.auth-form input {
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    font-size: 14px;
}
.auth-form button {
    padding: 10px 0;
    border-radius: 4px;
    border: none;
    background: #1aad19;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}
.auth-form button:hover { background: #11b016; }
.tip-text { font-size: 12px; color: #888; }
.error {
    padding: 8px 10px;
    background: #fff1f0;
    color: #cf1322;
    border: 1px solid #ffa39e;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}

/* 手机 WeChat H5 外壳 */
.wx-body { background: #000; }
.wx-app {
    position: relative;
    margin: 0 auto;
    max-width: 480px;
    height: 100vh;
    background: #efeff4;
    display: flex;
    flex-direction: column;
}
.wx-status-bar {
    height: 24px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #fff;
    background: #000;
}
.wx-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.wx-page {
    position: absolute;
    inset: 0;
    display: none;
    background: #efeff4;
}
.wx-page.active {
    display: flex;
    flex-direction: column;
}
.wx-nav-bar {
    height: 44px;
    padding: 0 12px;
    background: #ededed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d5d5d5;
}
.wx-nav-title {
    font-size: 17px;
    font-weight: 500;
}
.wx-nav-tools { font-size: 20px; color: #333; }
.wx-nav-icon { padding: 0 4px; cursor: pointer; }
.wx-nav-back { font-size: 18px; margin-right: 8px; cursor: pointer; }

.wx-search-bar {
    padding: 6px 8px;
    background: #ededed;
    border-bottom: 1px solid #d5d5d5;
}
.wx-search-inner {
    background: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.wx-search-inner input {
    border: none;
    outline: none;
    font-size: 14px;
    flex: 1;
}

/* 会话列表 */
.wx-chat-list {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}
.wx-chat-item {
    display: flex;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
}
.wx-chat-item:hover { background: #f5f5f5; }
.wx-chat-avatar { margin-right: 10px; }
.wx-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background: #5cb85c;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.wx-chat-main { flex: 1; display: flex; flex-direction: column; }
.wx-chat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wx-chat-name { font-size: 16px; }
.wx-chat-time { font-size: 12px; color: #999; }
.wx-chat-bottom {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

/* 聊天详情 */
.wx-page-chat-detail { background: #e5e5e5; }
.wx-chat-detail-main {
    flex: 1;
    padding: 8px 8px 4px;
    overflow-y: auto;
}

/* 输入条 */
.wx-input-bar {
    height: 52px;
    background: #f7f7f7;
    border-top: 1px solid #d5d5d5;
    display: flex;
    align-items: center;
    padding: 6px 8px;
}
.wx-input-left {
    width: 40px;
    text-align: center;
}
.wx-input-right {
    width: 90px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.wx-input-icon { font-size: 20px; }
.wx-input-center { flex: 1; padding: 0 4px; }
.wx-input-center textarea {
    width: 100%;
    height: 36px;
    border-radius: 4px;
    border: 1px solid #d8d8d8;
    resize: none;
    padding: 4px 6px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

/* 加号按钮 */
.wx-plus-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #07c160;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wx-plus-btn:active { opacity: .8; }

.wx-send-btn {
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
    background: #1aad19;
    color: #fff;
    font-size: 14px;
}

/* TabBar */
.wx-tabbar {
    height: 50px;
    background: #f7f7f7;
    border-top: 1px solid #d0d0d0;
    display: flex;
}
.wx-tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #888;
}
.wx-tab-item.active { color: #07c160; }
.wx-tab-icon { font-size: 18px; margin-bottom: 2px; }
.wx-placeholder {
    flex: 1;
    padding: 16px;
    font-size: 14px;
    color: #888;
}

/* 我页 */
.wx-me-panel {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #fff;
    margin-top: 10px;
}
.wx-me-avatar { margin-right: 12px; }
.wx-me-name { font-size: 16px; margin-bottom: 4px; }
.wx-me-sub { font-size: 12px; color: #999; }

/* 气泡样式 */
.msg-row {
    display: flex;
    margin-bottom: 10px;
}
.msg-row.self { justify-content: flex-end; }
.msg-avatar {
    width: 32px;
    margin: 0 6px;
}
.msg-main {
    max-width: 72%;
    display: flex;
    flex-direction: column;
}
.msg-nick {
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
}
.msg-nick.self { text-align: right; }
.msg-bubble {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}
.msg-row.self .msg-bubble { background: #9eea6a; }
.msg-bubble img {
    max-width: 220px;
    max-height: 220px;
    display: block;
    border-radius: 4px;
}
.msg-bubble video,
.msg-bubble audio {
    max-width: 220px;
    display: block;
}
.msg-time {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}
.msg-row.self .msg-time { text-align: right; }

/* 通讯录 & 好友 */
.wx-add-friend-panel {
    display: none;
    padding: 8px 10px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    gap: 8px;
}
.wx-add-friend-panel.active { display: flex; }
.wx-add-friend-panel input {
    flex: 1;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    font-size: 14px;
}
.wx-add-friend-panel button {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    background: #1aad19;
    color: #fff;
    font-size: 14px;
}
.wx-contacts-section-title {
    font-size: 13px;
    color: #888;
    padding: 6px 12px;
}
.wx-contact-list {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}
.wx-contact-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
}
.wx-contact-item:hover { background: #f5f5f5; }
.wx-contact-name {
    font-size: 15px;
}

/* 简单圆角头像 */
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #5cadff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}
.avatar-small {
    width: 26px;
    height: 26px;
    font-size: 13px;
}

/* PC 客服工作台样式（沿用之前） */
.wechat-frame {
    width: 920px;
    height: 620px;
    margin: 30px auto;
    background: #ededed;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0 0 1px #ccc, 0 4px 16px rgba(0,0,0,.2);
    display: flex;
    flex-direction: column;
}
.wechat-header {
    height: 50px;
    background: #2e2e2e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 13px;
}
.wechat-app-name { font-size: 14px; font-weight: 500; }
.wechat-user-info { display: flex; align-items: center; gap: 8px; }
.nickname-input,
.status-select {
    border-radius: 4px;
    border: 1px solid #444;
    background: #3a3a3a;
    color: #fff;
    font-size: 12px;
    padding: 4px 6px;
}
.admin-link { font-size: 12px; color: #ffe58f; }
.logout-link { color: #ddd; font-size: 12px; }
.logout-link:hover { color: #fff; }

.wechat-main {
    flex: 1;
    display: flex;
    background: #ececec;
}
.wechat-sidebar {
    width: 260px;
    border-right: 1px solid #d6d6d6;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 13px;
    border-bottom: 1px solid #dedede;
    color: #666;
}
.chat-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}
.chat-item {
    display: flex;
    padding: 8px 10px;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}
.chat-item.active { background: #d9d9d9; }
.chat-item:hover { background: #e6e6e6; }
.chat-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}
.chat-name { font-weight: 500; color: #333; }
.chat-time { font-size: 11px; color: #999; }
.chat-item-bottom {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.wechat-chat { flex: 1; display: flex; flex-direction: column; }
.chat-header {
    height: 56px;
    background: #f5f5f5;
    border-bottom: 1px solid #d6d6d6;
    padding: 0 14px;
    display: flex;
    align-items: center;
}
.chat-peer-info { display: flex; align-items: center; gap: 10px; }
.peer-text { display: flex; flex-direction: column; }
.peer-name { font-size: 15px; font-weight: 500; }
.peer-status { font-size: 12px; color: #999; display: flex; gap: 4px; align-items: center; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-online { background: #52c41a; }
.status-busy { background: #faad14; }
.status-offline { background: #bfbfbf; }

.chat-messages {
    flex: 1;
    background: #e5e5e5;
    padding: 12px 16px;
    overflow-y: auto;
}
.chat-input-area {
    border-top: 1px solid #d6d6d6;
    background: #f5f5f5;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
}
.message-form { display: flex; flex-direction: column; gap: 6px; }
.message-form textarea {
    width: 100%;
    min-height: 70px;
    max-height: 120px;
    resize: vertical;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    font-size: 14px;
    background: #fff;
}
.message-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.file-label { font-size: 13px; color: #555; cursor: pointer; }
.file-label input[type="file"] { display: none; }
.send-btn {
    padding: 6px 18px;
    border-radius: 4px;
    border: none;
    background: #1aad19;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.send-btn:hover { background: #11b016; }

/* 管理页面 */
.admin-container .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}
.admin-section { margin-top: 20px; }
.admin-create-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 10px;
}
.admin-create-form label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    gap: 4px;
}
.admin-create-form input,
.admin-create-form select {
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    font-size: 14px;
    min-width: 140px;
}
.admin-create-form button {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    background: #1aad19;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    height: 36px;
    align-self: flex-end;
}
.table-wrapper { overflow-x: auto; margin-top: 10px; }
.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th,
.user-table td {
    border: 1px solid #f0f0f0;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
}
.user-table th { background: #fafafa; }

@media (max-width: 768px) {
    .container {
        margin: 10px;
    }
    .wechat-frame {
        width: 100%;
        height: calc(100vh - 20px);
        margin: 10px auto;
    }
}
