/* ===== Toast 通知系统 ===== */
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2000; padding: 10px 24px; border-radius: 8px; font-size: 14px; line-height: 1.5; box-shadow: 0 4px 12px rgba(0,0,0,0.15); transition: opacity 0.3s ease; max-width: 90vw; text-align: center; pointer-events: none; }
.toast.hidden { opacity: 0; pointer-events: none; }
.toast-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }
.toast-error { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }
.toast-warning { background: #fffbe6; border: 1px solid #ffe58f; color: #faad14; }

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif; font-size: 14px; line-height: 1.5; color: var(--text-primary); background: var(--bg-page); }
a { color: var(--primary); text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* ===== Design Tokens ===== */
:root {
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #e8f0ff;
  --primary-border: #a9c3f4;
  --text-primary: #111827;
  --text-secondary: #475569;
  --text-tertiary: #6b778c;
  --border: #cbd5e1;
  --border-soft: #dce3eb;
  --bg-page: #e4eaf2;
  --bg-surface: #fbfcfe;
  --bg-subtle: #eef3f8;
  --shadow-sm: 0 1px 3px rgba(37, 99, 235, 0.06), 0 8px 24px rgba(23, 32, 51, 0.04);
  --shadow-md: 0 14px 36px rgba(37, 99, 235, 0.12), 0 3px 10px rgba(23, 32, 51, 0.06);
  --shadow-lg: 0 24px 64px rgba(37, 99, 235, 0.16), 0 8px 24px rgba(23, 32, 51, 0.08);
  /* 圆角体系 — 4 档 */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-full: 50%;
  /* 字号体系 — 5 级 */
  --fs-h1: 16px;
  --fs-h2: 14px;
  --fs-body: 14px;
  --fs-small: 12px;
  --fs-micro: 11px;
  /* 过渡统一 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease-out;
}

/* ===== Login Page ===== */
.login-page { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; padding: 40px 32px; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12); }
.login-title { text-align: center; font-size: 28px; font-weight: 700; color: #1677ff; margin-bottom: 4px; }
.login-subtitle { text-align: center; font-size: 14px; color: #999; margin-bottom: 32px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; color: #333; margin-bottom: 6px; }
.form-group input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; outline: none; transition: border-color 0.2s; }
.form-group input:focus { border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1); }
.form-error { color: #ff4d4f; font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fff2f0; border: 1px solid #ffccc7; border-radius: 6px; }

/* ===== Buttons ===== */
.btn-primary { min-height: 40px; border: none; border-radius: var(--radius-sm); padding: 0 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-base); background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.login-btn { width: 100%; height: 40px; background: #1677ff; color: #fff; }
.login-btn:hover { background: #4096ff; }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { background: #a0c4ff; cursor: not-allowed; transform: none; }
.send-btn { height: 40px; padding: 0 24px; background: #1677ff; color: #fff; white-space: nowrap; }
.send-btn:hover { background: #4096ff; }
.send-btn:active { transform: scale(0.97); }
.send-btn:disabled { background: #a0c4ff; cursor: not-allowed; transform: none; }
.btn-text { min-height: 36px; background: none; border: none; color: var(--primary); cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm); }
.btn-text:hover { color: #4096ff; }
.btn-text:active { opacity: 0.75; }
.btn-icon { min-width: 36px; min-height: 36px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; padding: 7px; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base), transform var(--transition-fast); }
.btn-icon:hover { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.btn-icon:active { transform: scale(0.96); background: #dbeafe; }
.btn-icon svg { width: 16px; height: 16px; display: block; }
.btn-secondary { background: #fff; border: 1px solid #d9d9d9; border-radius: 4px; padding: 6px 16px; cursor: pointer; }
.btn-secondary:hover { border-color: #1677ff; color: #1677ff; }
.btn-secondary:active { transform: scale(0.98); }
.btn-outline { background: #fff; border: 1px solid #d9d9d9; border-radius: 4px; padding: 6px 16px; cursor: pointer; }
.btn-outline:hover { border-color: #1677ff; color: #1677ff; }
.btn-outline:active { transform: scale(0.98); }
.btn-sm { font-size: 12px; padding: 4px 12px; margin: 4px 4px 0 0; }

/* ===== App Layout ===== */
.app-layout { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }

/* Header */
.app-header { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 24px; background: rgba(248,250,252,0.96); color: var(--text-primary); border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(15,23,42,0.04); backdrop-filter: blur(18px); flex-shrink: 0; z-index: 400; }
.header-left { display: flex; align-items: center; gap: 8px; }
.app-brand { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.app-brand::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 9px; border-radius: 3px; background: linear-gradient(135deg, #2563eb, #60a5fa); box-shadow: 0 4px 10px rgba(37,99,235,0.28); vertical-align: 1px; }
.header-divider { color: var(--border); }
.header-title { font-size: 13px; color: var(--text-tertiary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: background var(--transition-base); }
.header-user:hover { background: var(--bg-subtle); }
.header-right .btn-text { color: #ff7875; }
.header-right .btn-text:hover { color: #ff4d4f; }

/* Body */
.app-body { display: flex; flex: 1; min-height: 0; gap: 12px; padding: 12px; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
    width: clamp(280px, 22vw, 320px);
    min-width: 0;
    background: var(--bg-surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); display: flex; flex-direction: column; flex-shrink: 0; overflow: visible; position: relative; z-index: 10; box-shadow: var(--shadow-sm);
}
.sidebar-header { min-height: 58px; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--bg-surface); position: relative; z-index: 1; }
.sidebar-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.sidebar-search { padding: 10px 12px; }
.sidebar-search input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid transparent; background: var(--bg-subtle); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary); outline: none; transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base); }
.sidebar-search input:focus { background: #fff; border-color: var(--primary-border); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.sidebar-list { flex: 1; min-height: 0; overflow-y: auto; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.group-item { margin: 2px 8px; padding: 10px 10px; min-height: 68px; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius-sm); transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast); position: relative; display: flex; align-items: center; gap: 11px; }
.group-item-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }
.group-item-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.group-item-content { flex: 1; min-width: 0; }
.chat-header-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover; background: #e6f4ff; color: #1677ff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.chat-header-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.group-item:hover { background: var(--bg-subtle); }
.group-item:active { background: #eaf1fb; transform: scale(0.99); }
.group-item.active { background: var(--primary-soft); border-color: var(--primary-border); }
.group-item-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.group-item-id { font-size: 12px; color: var(--text-tertiary); }
.group-item-empty { padding: 24px; text-align: center; color: #999; }
.unread-badge { position: absolute; top: 8px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; background: #ff4d4f; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; border-radius: 9px; }
.domain-tag { display: inline-block; padding: 0 4px; margin-right: 3px; font-size: 10px; font-weight: 600; border-radius: 3px; vertical-align: middle; line-height: 16px; }
.domain-user { background: #e6f4ff; color: #1677ff; }

/* ── 通讯录 Tab 栏 ── */
.contact-tabs { display: flex; border-bottom: 1px solid #e8e8e8; background: #fff; padding: 0 8px; flex-shrink: 0; }
.contact-tab { padding: 8px 12px; font-size: 13px; color: #666; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; user-select: none; white-space: nowrap; }
.contact-tab:hover { color: #333; background: #f5f5f5; }
.contact-tab.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 500; }
.contact-filters { display: flex; gap: 6px; padding: 6px 8px; background: #fafafa; border-bottom: 1px solid #e8e8e8; flex-shrink: 0; }
.contact-filters.hidden { display: none; }
.contact-filter-select { flex: 1; padding: 4px 6px; font-size: 12px; border: 1px solid #d9d9d9; border-radius: 4px; background: #fff; }

/* ── Chat Main ── */
.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--bg-subtle); min-width: 0; border: 1px solid var(--border-soft); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }

/* Chat Header */
.chat-header { min-height: 58px; display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 9px 14px; background: rgba(248,250,252,0.97); border-bottom: 1px solid var(--border); flex-shrink: 0; backdrop-filter: blur(14px); }
.btn-back-mobile { display: none; }
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-customer-name { font-size: 15px; font-weight: 600; }
.chat-status-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.chat-status-badge.connected { color: #52c41a; }
.chat-status-badge.disconnected { color: #999; }
.chat-header-actions { display: flex; gap: 6px; margin-left: auto; }

/* Messages */
.chat-messages { flex: 1; overflow-y: auto; padding: 20px clamp(16px, 3vw, 40px); scroll-padding-bottom: 24px; }
.chat-empty { text-align: center; padding: 60px 20px; color: #999; font-size: 14px; }

/* 消息淡入动画 */
@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.msg { margin-bottom: 14px; max-width: min(72%, 720px); animation: msgFadeIn 0.25s ease-out; animation-delay: calc(var(--idx, 0) * 40ms); }
.msg.no-animation { animation: none; }

/* 消息时间分隔条 */
.msg-date-separator { text-align: center; margin: 16px 0; font-size: 12px; color: #999; position: relative; }
.msg-date-separator::before,
.msg-date-separator::after { content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: #e8e8e8; }
.msg-date-separator::before { left: 0; }
.msg-date-separator::after { right: 0; }
.msg-date-separator span { display: inline-block; padding: 0 12px; background: #f5f5f5; border-radius: 8px; }

/* Message styles */
.msg-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.msg-sender { font-size: 12px; font-weight: 600; color: #666; }
.msg-time { font-size: 11px; color: #bbb; }
.msg-body { padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.6; word-break: break-word; white-space: pre-wrap; }

/* Customer messages — left aligned */
.msg-customer { margin-right: auto; }
.msg-customer .msg-body { background: #fff; border: 1px solid #e8e8e8; color: #333; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative; }
.msg-customer .msg-body::before { content: ''; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; background: #fff; border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; transform: rotate(45deg); }

/* AI messages — right aligned (我方消息) */
.msg-ai { margin-left: auto; width: fit-content; }
.msg-ai .msg-header { justify-content: flex-end; }
.msg-ai .msg-body { background: #f6ffed; border: 1px solid #b7eb8f; color: #333; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative; }
.msg-ai.msg-draft .msg-body { background: #fffbe6; border: 1px solid #ffe58f; color: #666; }

/* Employee messages — right aligned (我方消息) */
.msg-employee { margin-left: auto; width: fit-content; }
.msg-employee .msg-header { justify-content: flex-end; }
.msg-employee .msg-body { background: #e6f4ff; border: 1px solid #91caff; color: #333; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative; }
.msg-employee .msg-body::before, .msg-ai .msg-body::before { content: ''; position: absolute; right: -5px; top: 10px; width: 8px; height: 8px; background: #e6f4ff; border-right: 1px solid #91caff; border-top: 1px solid #91caff; transform: rotate(45deg); }
.msg-ai .msg-body::before { background: #f6ffed; border-right-color: #b7eb8f; border-top-color: #b7eb8f; }

/* 同事回复——左侧展示，中性底色 */
.msg-other-employee { margin-right: auto; }
.msg-other-employee .msg-header { justify-content: flex-start; }
.msg-other-employee .msg-body { background: #f5f5f5; border: 1px solid #e0e0e0; color: #333; box-shadow: 0 1px 2px rgba(0,0,0,0.05); position: relative; }
.msg-other-employee .msg-body::before { content: ''; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; background: #f5f5f5; border-left: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; transform: rotate(45deg); }

/* Internal messages — centered, subtle */
.msg-internal { text-align: center; max-width: 100%; }
.msg-internal .msg-body { display: inline-block; background: #fafafa; border: 1px dashed #d9d9d9; color: #999; font-size: 12px; padding: 4px 12px; border-radius: 12px; }

/* System messages — centered */
.msg-system { text-align: center; max-width: 100%; }
.msg-system .msg-body { display: inline-block; background: #fff7e6; border: 1px solid #ffd591; color: #d46b08; font-size: 12px; padding: 4px 12px; border-radius: 12px; }

/* Recalled messages — retain original content for internal traceability */
.msg-wrapper.msg-recalled .msg-body {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
    color: #8c8c8c !important;
    box-shadow: none !important;
}
.msg-wrapper.msg-recalled .msg-body::before {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
}
.msg-wrapper.msg-recalled .msg-media,
.msg-wrapper.msg-recalled .msg-translation,
.msg-wrapper.msg-recalled .msg-caption { opacity: 0.58; filter: grayscale(0.45); }
.msg-recalled-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #f3f4f6;
    color: #8c8c8c;
    font-size: 11px;
    font-weight: 400;
    line-height: 17px;
    white-space: nowrap;
}
.msg-context-divider { height: 1px; background: #eee; margin: 4px 8px; }

/* Media messages */
.msg-media img { max-width: 100%; max-height: 300px; border-radius: 6px; cursor: pointer; display: block; margin-top: 4px; }
.msg-media .media-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: #f5f5f5; border: 1px solid #d9d9d9; border-radius: 6px; margin-top: 4px; font-size: 13px; color: #1677ff; text-decoration: none; }
.msg-media .media-link:hover { background: #e6f4ff; }
.media-file-card { display: flex; align-items: center; gap: 10px; width: min(360px, 100%); padding: 10px 12px; margin-top: 4px; background: rgba(255,255,255,0.82); border: 1px solid var(--border-soft); border-radius: 10px; color: var(--text-primary); text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
.media-file-card:hover { background: #f0f7ff; border-color: var(--primary-border); transform: translateY(-1px); }
.media-file-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 46px; flex: 0 0 42px; border-radius: 8px; background: #e8f0ff; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.media-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.media-file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.media-file-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-tertiary); font-size: 11px; }
.media-file-action { color: var(--primary); font-size: 20px; line-height: 1; }
.media-audio-card { display: flex; flex-direction: column; gap: 5px; padding-top: 5px; }
.media-audio-title { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); font-size: 12px; }
.media-audio-card audio { width: min(320px, 100%); height: 34px; }
.msg-media .media-summary { font-size: 12px; color: #999; margin-top: 4px; }
.msg-media video { max-width: 100%; max-height: 300px; border-radius: 6px; margin-top: 4px; }
.msg-media.media-video-ready .media-loading-overlay { display: none; }
.msg-media-wrap { position: relative; display: inline-block; max-width: 100%; }
.msg-media-wrap .media-summary { font-size: 12px; color: #999; margin-top: 4px; }
.drive-star-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.72);
    border-radius: 50%;
    background: rgba(22,28,45,0.66);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15,23,42,0.2);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, color 0.15s;
    backdrop-filter: blur(4px);
}
.drive-star-btn:hover { background: rgba(22,28,45,0.82); transform: scale(1.08); }
.drive-star-btn:focus-visible { outline: 3px solid rgba(22,119,255,0.35); outline-offset: 2px; }
.drive-star-btn.active { background: rgba(120,84,0,0.82); color: #ffd84d; }
.msg-caption { font-size: 13px; color: #333; margin-top: 6px; line-height: 1.5; word-break: break-word; }
.msg-text-link { color: var(--primary); text-decoration: underline; text-decoration-color: rgba(29,78,216,.35); text-underline-offset: 2px; overflow-wrap: anywhere; }
.link-preview-slot:empty { display: none; }
.link-preview-card { display: flex; width: min(380px, 100%); margin-top: 9px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(255,255,255,.84); color: var(--text-primary); text-decoration: none; white-space: normal; transition: border-color .15s, transform .15s, box-shadow .15s; }
.link-preview-card:hover { border-color: var(--primary-border); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.link-preview-image { width: 112px; min-height: 92px; flex: 0 0 112px; object-fit: cover; background: var(--bg-subtle); }
.link-preview-content { display: flex; min-width: 0; padding: 10px 12px; flex: 1; flex-direction: column; gap: 4px; }
.link-preview-content strong { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.link-preview-content > span { display: -webkit-box; overflow: hidden; color: var(--text-secondary); font-size: 12px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.link-preview-content small { overflow: hidden; margin-top: auto; color: var(--text-tertiary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

/* ── 统一联系人名片 ── */
.msg-customer:has(.contact-card) { max-width: min(92%, 390px); }
.msg-customer:has(.contact-card) .msg-content { width: 100%; min-width: 0; }
.msg-body.msg-body-contact { width: min(340px, 100%); padding: 0; overflow: hidden; border: 0; background: transparent; box-shadow: 0 6px 20px rgba(15, 23, 42, 0.10); white-space: normal; }
.msg-customer .msg-body.msg-body-contact::before { display: none; }
.contact-card { width: 100%; overflow: hidden; border: 1px solid #dfe4ea; border-radius: 14px; background: #fff; color: #17202a; }
.contact-card-main { display: flex; align-items: center; gap: 13px; min-height: 86px; padding: 15px 16px; }
.contact-card-avatar { display: flex; flex: 0 0 52px; width: 52px; height: 52px; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; background: linear-gradient(145deg, #176b58, #23a37d); color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.contact-card-avatar { position: relative; }
.contact-card-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.contact-card-system .contact-card-avatar { background: linear-gradient(145deg, #1558b0, #3287ee); }
.contact-card-wework .contact-card-avatar { background: linear-gradient(145deg, #1769aa, #2f9ad1); }
.contact-card-info { flex: 1; min-width: 0; }
.contact-card-title-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.contact-card-name { overflow: hidden; color: #111827; font-size: 15px; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-source { flex: 0 0 auto; padding: 2px 7px; border-radius: 999px; background: #eef2f6; color: #536171; font-size: 10px; font-weight: 650; line-height: 17px; }
.contact-card-whatsapp .contact-card-source { background: #e6f7f0; color: #08795c; }
.contact-card-system .contact-card-source { background: #eaf3ff; color: #1769c2; }
.contact-card-wework .contact-card-source { background: #e9f7fc; color: #17749d; }
.contact-card-subtitle { margin-top: 5px; overflow: hidden; color: #697586; font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #e8ebef; }
.contact-card-btn { display: inline-flex; min-width: 0; min-height: 46px; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 0; background: #fff; color: #08795c; font: inherit; font-size: 13px; font-weight: 620; cursor: pointer; transition: background .16s ease, color .16s ease; }
.contact-card-btn + .contact-card-btn { border-left: 1px solid #e8ebef; }
.contact-card-btn:hover:not(:disabled) { background: #f0faf6; }
.contact-card-btn:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(20, 141, 107, .25); outline-offset: -3px; }
.contact-card-btn svg { width: 17px; height: 17px; fill: currentColor; }
.contact-card-system .contact-card-btn { color: #1769c2; }
.contact-card-system .contact-card-btn:hover:not(:disabled) { background: #f1f7ff; }
.contact-card-btn:disabled { cursor: default; opacity: .58; }
.contact-card-btn.is-added { color: #667085; background: #f7f8fa; opacity: 1; }
.contact-card-spinner { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: contactCardSpin .7s linear infinite; }
@keyframes contactCardSpin { to { transform: rotate(360deg); } }

/* Media download progress bar */
.media-progress-container { padding: 20px 12px; text-align: center; }
.media-progress-bar { height: 6px; background: #e8e8e8; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.media-progress-fill { height: 100%; background: linear-gradient(90deg, #1677ff, #4096ff); border-radius: 3px; transition: width 0.2s ease; }
.media-progress-text { font-size: 12px; color: #999; }

/* Video loading overlay */
.media-loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f5f5f5; border-radius: 6px; gap: 8px; color: #999; font-size: 12px; }
.media-spinner { width: 24px; height: 24px; border: 3px solid #e8e8e8; border-top-color: #1677ff; border-radius: 50%; animation: media-spin 0.8s linear infinite; }
@keyframes media-spin { to { transform: rotate(360deg); } }

/* Media error state */
.media-error { padding: 12px; text-align: center; color: #ff4d4f; font-size: 13px; background: #fff2f0; border-radius: 6px; }

/* Translated text */
.msg-translation { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #d9d9d9; font-size: 13px; color: #888; line-height: 1.5; }
.trans-tag { display: inline-block; font-size: 10px; padding: 0 4px; border: 1px solid #bbb; border-radius: 3px; color: #999; margin-right: 4px; vertical-align: middle; }
.msg-translating { border-top-color: #91caff; color: #666; }
.translating-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid #91caff; border-top-color: #1677ff; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 4px; }
.translating-text { vertical-align: middle; font-size: 12px; color: #999; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Employee reply status indicators */
.msg-status { display: block; font-size: 11px; text-align: right; margin-top: 2px; }
.msg-status-sending { color: #bbb; font-style: italic; }
.msg-status-translating { color: #1677ff; font-style: italic; }
.msg-status-sent { color: #52c41a; font-weight: 500; }
.msg-status-failed { color: #ff4d4f; }
.msg-retry-btn { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 4px; background: #ff4d4f; color: #fff; border-radius: 50%; font-size: 10px; font-weight: 700; cursor: pointer; line-height: 1; vertical-align: middle; transition: background 0.15s; }
.msg-retry-btn:hover { background: #ff7875; }

/* Quoted/replied message */
.msg-quote { display: flex; gap: 6px; margin-bottom: 4px; padding: 4px 0; }
.quote-line { width: 3px; background: #73d13d; border-radius: 2px; flex-shrink: 0; }
.quote-content { flex: 1; min-width: 0; }
.quote-text { font-size: 12px; color: #999; line-height: 1.5; white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Input area */
.chat-input { background: rgba(248,250,252,0.98); border-top: 1px solid var(--border); padding: 10px 14px 14px; flex-shrink: 0; position: relative; }
.input-status { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.input-status-right { display: flex; align-items: center; gap: 8px; }
.ai-status { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.ai-status.active { color: #52c41a; }
.ai-status.inactive { color: #faad14; }
.ai-reply-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; }
.toggle-label { color: #666; white-space: nowrap; }
.switch-small { position: relative; display: inline-block; width: 28px; height: 16px; }
.switch-small input { opacity: 0; width: 0; height: 0; }
.switch-small .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 16px; transition: 0.3s; }
.switch-small .slider::before { content: ""; position: absolute; height: 12px; width: 12px; left: 2px; bottom: 2px; background: #fff; border-radius: 50%; transition: 0.3s; }
.switch-small input:checked + .slider { background: #1677ff; }
.switch-small input:checked + .slider::before { transform: translateX(12px); }
.input-toolbar { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); align-items: center; margin-bottom: 8px; padding: 7px 8px; position: relative; gap: 10px; background: #e8edf4; border: 1px solid var(--border); border-radius: 12px; }
.toolbar-left { width: 100%; min-width: 0; display: flex; gap: 5px; flex-shrink: 0; overflow: hidden; }
.toolbar-center { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.btn-toolbar { background: var(--bg-surface); border: 1px solid #bcc8d6; border-radius: var(--radius-sm); width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1; color: #35445a; box-shadow: 0 1px 2px rgba(15,23,42,0.06); transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base), transform var(--transition-fast), box-shadow var(--transition-base); }
.btn-toolbar:hover { background: #fff; border-color: var(--primary-border); color: var(--primary); box-shadow: 0 3px 8px rgba(29,78,216,0.12); }
.btn-toolbar:active { transform: scale(0.95); }
.btn-toolbar:disabled { opacity: 0.5; cursor: wait; transform: none; box-shadow: none; }
.btn-toolbar svg { width: 18px; height: 18px; display: block; }
.toolbar-more-btn { flex: 0 0 auto; font-size: 20px; font-weight: 600; }
.toolbar-more-menu { position: absolute; top: calc(100% + 4px); left: 8px; z-index: 900; display: flex; flex-wrap: wrap; gap: 6px; max-width: min(360px, calc(100% - 16px)); padding: 8px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.toolbar-more-menu.hidden { display: none; }
.btn-translate { font-size: 14px; }
.btn-translate.active { background: #e6f4ff; border-color: #1677ff; color: #1677ff; }
/* Toolbar checkbox chips (AI 回复、审核、回复建议、自动翻译) */
.toolbar-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; height: 34px; padding: 0 9px; border: 1px solid #bcc8d6; border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-secondary); box-shadow: 0 1px 2px rgba(15,23,42,0.04); transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base), box-shadow var(--transition-base); }
.toolbar-toggle:hover { background: #fff; border-color: var(--primary-border); color: var(--primary); }
.toolbar-toggle:has(.toolbar-toggle-input:checked) { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); box-shadow: 0 2px 6px rgba(29,78,216,0.1); }
.toolbar-toggle:has(.toolbar-toggle-input:disabled) { opacity: 0.48; cursor: not-allowed; box-shadow: none; }
.toolbar-toggle-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toolbar-toggle-input:focus-visible + .toolbar-check { outline: 2px solid var(--primary); outline-offset: 2px; }
.toolbar-check { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; border: 1.5px solid #9aa8b8; border-radius: 5px; background: #fff; color: transparent; font-size: 11px; font-weight: 800; line-height: 1; transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast); }
.toolbar-toggle-input:checked + .toolbar-check { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(1.03); }
.toolbar-toggle .toggle-label { font-size: 12px; font-weight: 500; color: inherit; white-space: nowrap; }
.translate-lang-select { height: 34px; padding: 0 26px 0 9px; border: 1px solid #bcc8d6; border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-secondary); font-size: 12px; outline: none; cursor: pointer; }
.translate-lang-select:hover, .translate-lang-select:focus { border-color: var(--primary-border); color: var(--primary); }
.input-row { display: flex; gap: 8px; align-items: flex-end; background: var(--bg-subtle); border: 1px solid transparent; border-radius: 14px; padding: 7px 8px 7px 12px; transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base); }
.input-row:focus-within { background: #fff; border-color: var(--primary-border); box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.input-row textarea { flex: 1; resize: none; border: none; padding: 6px 4px; font-size: 14px; font-family: inherit; outline: none; background: transparent; min-height: 20px; max-height: 120px; }
.input-row textarea:disabled { background: transparent; cursor: not-allowed; opacity: 0.6; }

/* 粘贴图片预览 */
.paste-preview { padding: 0 0 4px; }
.paste-preview-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 200px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px 8px 4px 4px;
}
.paste-preview-item img {
    width: 36px; height: 36px;
    object-fit: cover;
    border-radius: 4px;
}
.paste-preview-name {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}
.paste-preview-remove {
    position: absolute; top: -8px; right: -8px;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #999;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.paste-preview-remove:hover { color: #ff4d4f; border-color: #ff4d4f; }

/* ── Side Panel ── */
.side-panel { width: 300px; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-md); overflow-y: auto; flex-shrink: 0; transition: transform 0.25s ease, opacity 0.25s ease; box-shadow: var(--shadow-md); }
.side-panel.hidden { display: none; }
@media (min-width: 768px) {
    .side-panel.hidden { display: block; transform: translateX(100%); opacity: 0; pointer-events: none; position: absolute; right: 0; top: 0; bottom: 0; }
    .side-panel { position: relative; }
}
@media (min-width: 1200px) {
    .app-body { gap: 16px; padding: 16px; }
    .sidebar { width: 304px; }
    .chat-messages { padding-left: clamp(24px, 4vw, 64px); padding-right: clamp(24px, 4vw, 64px); }
    .side-panel { width: 320px; }
}
@media (max-width: 767px) {
    .side-panel { position: fixed; right: 0; top: 48px; bottom: 0; width: 85%; max-width: 320px; z-index: 300; transform: translateX(0); }
    .side-panel.hidden { display: block; transform: translateX(100%); opacity: 0; pointer-events: none; }
}
.side-overlay { transition: opacity 0.25s ease; }
.side-overlay.hidden { display: none; }
@media (min-width: 768px) {
    .side-overlay.hidden { display: block; opacity: 0; pointer-events: none; position: fixed; inset: 0; z-index: 299; }
}
.panel-section { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.panel-section h4 { font-size: 13px; font-weight: 600; color: #666; margin-bottom: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.input-small { width: 60px; height: 28px; border: 1px solid #d9d9d9; border-radius: 4px; padding: 0 6px; text-align: center; outline: none; }
.input-small:focus { border-color: #1677ff; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 20px; transition: 0.3s; }
.slider::before { content: ""; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.switch input:checked + .slider { background: #1677ff; }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* Member list */
.member-list { list-style: none; }
.member-item { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 13px; }
.member-role { font-size: 11px; padding: 0 6px; border-radius: 3px; }
.member-admin { background: #f5222d; color: #fff; }
.member-formal_employee { background: #1677ff; color: #fff; }
.member-ai_employee { background: #52c41a; color: #fff; }
.member-customer { background: #faad14; color: #fff; }
.member-member { background: #722ed1; color: #fff; }

/* ===== WhatsApp Group Panel ===== */
.wa-group-info { font-size: 13px; color: #666; margin-bottom: 8px; line-height: 1.6; }
.wa-group-info .info-row { display: flex; justify-content: space-between; padding: 2px 0; }
.wa-group-info .info-label { color: #999; }
.wa-group-info .info-value { color: #333; font-weight: 500; }
.wa-participant-list { list-style: none; max-height: 300px; overflow-y: auto; }
.wa-participant-item { display: flex; align-items: center; gap: 8px; padding: 8px 6px; font-size: 13px; border-bottom: 1px solid #f0f0f0; cursor: pointer; border-radius: 4px; transition: background 0.15s; }
.wa-participant-item:hover { background: #f5f7fa; }
.wa-participant-item:last-child { border-bottom: none; }

/* 群操作按钮组 */
.group-actions { display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid #f0f0f0; padding-top: 8px; }
.group-actions .btn-text { font-size: 12px; padding: 4px 10px; border: 1px solid #d9d9d9; border-radius: 4px; color: #333; background: #fff; }
.group-actions .btn-text:hover { border-color: #1677ff; color: #1677ff; }
.wa-participant-name { font-weight: 500; color: #222; }
.wa-participant-jid { font-size: 11px; color: #999; margin-left: auto; }
.wa-participant-badge { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #f0f0f0; color: #666; white-space: nowrap; margin-left: 4px; }

/* ===== WhatsApp 成员区块（侧栏） ===== */
.channel-member-item { cursor: pointer; }
.channel-member-item:hover { background: #f5f7fa; }
.channel-member-name { font-weight: 500; color: #222; flex: 1; }
.channel-kick-btn { color: #ff4d4f; cursor: pointer; font-size: 14px; padding: 0 4px; opacity: 0.6; }
.channel-kick-btn:hover { opacity: 1; }
.channel-add-member { cursor: pointer; color: #1677ff; font-size: 13px; margin-top: 4px; }
.channel-add-member:hover { background: #f5f7fa; }

/* ===== WhatsApp 成员弹窗 ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(23,32,51,0.48); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 1; transition: opacity 0.2s ease; backdrop-filter: blur(5px); }
.modal-overlay.hidden { display: none; opacity: 0; }
.modal-content { background: #fff; border-radius: 16px; width: min(100%, 420px); max-width: 420px; max-height: min(84vh, 760px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn 0.22s cubic-bezier(0.34, 1.3, 0.64, 1); }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.modal-header h4 { font-size: 16px; font-weight: 600; color: #333; margin: 0; }
.modal-close { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: none; border: none; border-radius: var(--radius-sm); font-size: 24px; color: var(--text-tertiary); cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: #333; }
.modal-body { padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-footer { padding: 12px 20px 18px; text-align: center; border-top: 1px solid var(--border-soft); flex-shrink: 0; }
.modal-footer .btn-primary { width: 100%; padding: 10px; font-size: 15px; }

.wa-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.wa-profile-avatar { width: 48px; height: 48px; border-radius: 50%; background: #1677ff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; flex-shrink: 0; }
.wa-profile-info { flex: 1; min-width: 0; }
.wa-profile-name { font-size: 16px; font-weight: 600; color: #222; }
.wa-profile-phone { font-size: 12px; color: #999; margin-top: 2px; word-break: break-all; }
.wa-profile-role { margin-top: 4px; }
.wa-profile-role .member-role { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #e6f4ff; color: #1677ff; }

.wa-detail-grid { display: flex; flex-direction: column; gap: 8px; }
.wa-detail-grid .detail-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.wa-detail-grid .detail-label { color: #999; }
.wa-detail-grid .detail-value { color: #333; font-weight: 500; }

/* ===== Admin Pages ===== */
.admin-main { flex: 1; overflow-y: auto; padding: 24px; }
.admin-nav { display: flex; background: #fff; border-bottom: 1px solid #e8e8e8; flex-shrink: 0; padding: 0 24px; }
.admin-nav-item { padding: 12px 20px; font-size: 14px; color: #666; border-bottom: 2px solid transparent; transition: all 0.2s; }
.admin-nav-item:hover { color: #1677ff; }
.admin-nav-item.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 600; }

.admin-section { background: #fff; border-radius: 8px; padding: 20px 24px; margin-bottom: 20px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h2 { font-size: 18px; font-weight: 600; }
.admin-desc { font-size: 13px; color: #999; margin-bottom: 16px; line-height: 1.5; }

/* Config section */
.config-section { margin-bottom: 20px; }
.config-section .section-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.config-card { padding: 16px; border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 12px; }
.config-card.config-card-disabled { opacity: 0.55; background: #fafafa; }
.config-card.config-card-disabled .checkbox-label { cursor: not-allowed; color: #aaa; }
.config-card.config-card-disabled input[type="checkbox"] { cursor: not-allowed; }
.config-card-row { display: flex; align-items: center; margin-bottom: 8px; }
.config-card-desc { font-size: 13px; color: #888; margin-bottom: 8px; padding: 0 2px; }
.config-card-controls { padding: 4px 2px 0; }
.config-sub-area { padding: 12px; border-radius: 6px; background: #fafafa; margin-top: 8px; transition: opacity 0.2s; }
.config-sub-area.disabled { opacity: 0.5; pointer-events: none; }
.config-sub-label { font-size: 13px; font-weight: 500; color: #555; margin-bottom: 8px; }
.config-sub-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e8e8e8; }
.config-sub-item .hint-text { display: block; margin-top: 4px; }
.config-sub-area .radio-label { margin-right: 20px; cursor: pointer; font-size: 13px; }
.config-sub-area .radio-label input { margin-right: 4px; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { padding: 10px 12px; text-align: left; font-weight: 600; font-size: 13px; color: #666; border-bottom: 2px solid #e8e8e8; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.admin-table tr:hover td { background: #fafafa; }

/* Channel cards */
.channel-card { border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.channel-card-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fafafa; border-bottom: 1px solid #e8e8e8; }
.channel-card-title { font-size: 14px; font-weight: 600; }
.channel-card-actions { display: flex; align-items: center; gap: 8px; }
.channel-card-body { padding: 16px; }

/* Channel tag */
.channel-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; margin-right: 2px; vertical-align: middle; line-height: 1.4; }
.channel-tag.WA { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.channel-tag.WX { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.channel-tag.QWX { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }

/* Mute indicator — 群静音状态图标 */
/* 发送模式图标 — 侧栏群列表 */
.mode-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; font-size: 12px; margin-left: 3px; vertical-align: middle; cursor: help; }
.mode-badge.mode-meeting { color: #faad14; }
.mode-badge.mode-muted { color: #ff4d4f; }

/* 发送模式图标 — 标题栏 */
.mode-badge-header { display: inline-flex; align-items: center; font-size: 12px; margin-left: 6px; padding: 2px 6px; border-radius: 4px; cursor: pointer; vertical-align: middle; }
.mode-badge-header.mode-meeting { color: #d48806; background: #fffbe6; }
.mode-badge-header.mode-muted { color: #ff4d4f; background: #fff2f0; }

/* 成员身份标签 */
.tag-role { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 3px; margin-left: 4px; line-height: 18px; vertical-align: middle; }
.tag-tenant { color: #1890ff; background: #e6f7ff; }
.tag-supplier { color: #fa8c16; background: #fff7e6; }
.tag-external { color: #909090; background: #f5f5f5; }
.tag-cross { color: #52c41a; background: #f6ffed; }
.tag-channel { color: #999; background: #f5f5f5; }
.tag-ai { color: #722ed1; background: #f9f0ff; }

/* Loading / Error / Hint */
.loading-msg { padding: 20px; text-align: center; color: #999; font-size: 14px; }
.error-msg { padding: 20px; text-align: center; color: #ff4d4f; font-size: 14px; }
.hint-text { font-size: 12px; color: #999; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(23,32,51,0.48); z-index: 500; opacity: 1; transition: opacity 0.2s ease; }
.modal-overlay.hidden { opacity: 0; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 440px; max-width: calc(100vw - 48px); background: #fff; border-radius: 16px; padding: 24px; z-index: 501; max-height: min(84vh, 760px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalSlideIn 0.25s ease-out; }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal .form-actions { margin-top: 20px; }
.input-full { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; outline: none; }
.input-full:focus { border-color: #1677ff; }
select.input-full { background: #fff; }
.hidden { display: none !important; }

/* 重新匹配 WhatsApp：固定账号摘要 + 单一主操作 */
.pair-modal { width: 520px; padding: 0; overflow: hidden; background: var(--bg-surface); }
.pair-modal .modal-header { align-items: flex-start; min-height: 0; padding: 22px 24px 18px; }
.pair-modal-heading { min-width: 0; padding-right: 16px; }
.pair-modal-eyebrow { display: block; margin-bottom: 4px; color: var(--primary); font-size: var(--fs-micro); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.pair-modal .modal-header h3 { margin: 0; color: var(--text-primary); font-size: 18px; line-height: 1.4; }
.pair-modal-heading p { margin-top: 4px; color: var(--text-tertiary); font-size: var(--fs-small); line-height: 1.5; }
.pair-modal-close { display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-tertiary); cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast); }
.pair-modal-close:hover { background: var(--bg-subtle); color: var(--text-primary); }
.pair-modal-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pair-modal-close:active { transform: scale(.96); }
.pair-modal-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.pair-modal .modal-body { padding: 20px 24px 24px; }
.pair-account-card { position: relative; display: flex; min-height: 84px; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--bg-subtle); }
.pair-account-icon { display: inline-flex; width: 44px; height: 44px; flex: 0 0 44px; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); }
.pair-account-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pair-account-details { display: grid; min-width: 0; flex: 1; gap: 6px; }
.pair-account-details > div { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: baseline; gap: 8px; }
.pair-account-details dt { color: var(--text-tertiary); font-size: var(--fs-small); }
.pair-account-details dd { overflow: hidden; color: var(--text-primary); font-size: var(--fs-body); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.pair-readonly-badge { position: absolute; top: 12px; right: 12px; padding: 3px 8px; border: 1px solid var(--primary-border); border-radius: 999px; background: rgba(255,255,255,.72); color: var(--primary); font-size: var(--fs-micro); line-height: 1.3; }
.pair-readonly-note { display: flex; align-items: flex-start; gap: 7px; margin: 10px 2px 22px; color: var(--text-tertiary); font-size: var(--fs-small); line-height: 1.5; }
.pair-readonly-note svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pair-mode-selector { min-width: 0; margin: 0; padding: 0; border: 0; }
.pair-mode-selector legend { margin-bottom: 10px; color: var(--text-primary); font-size: var(--fs-h2); font-weight: 600; }
.pair-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pair-mode-option { position: relative; display: grid; min-height: 112px; grid-template-columns: 36px minmax(0, 1fr); align-content: center; align-items: start; gap: 10px; padding: 16px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); text-align: left; cursor: pointer; transition: border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast); }
.pair-mode-option:hover { border-color: var(--primary-border); background: #f5f8ff; }
.pair-mode-option:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pair-mode-option:active { transform: scale(.98); }
.pair-mode-option.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(29,78,216,.09); }
.pair-mode-option:disabled { border-color: var(--border-soft); background: var(--bg-subtle); color: rgba(0,0,0,.3); cursor: not-allowed; box-shadow: none; transform: none; }
.pair-mode-icon { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-subtle); color: var(--text-secondary); }
.pair-mode-option.active .pair-mode-icon { background: rgba(255,255,255,.72); color: var(--primary); }
.pair-mode-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pair-mode-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.pair-mode-copy strong { font-size: var(--fs-body); font-weight: 600; line-height: 1.4; }
.pair-mode-copy small { color: var(--text-tertiary); font-size: var(--fs-small); line-height: 1.45; }
.pair-mode-badge { position: absolute; top: 9px; right: 9px; color: var(--primary); font-size: var(--fs-micro); font-weight: 600; }
.pair-result-card { margin-top: 20px; padding: 16px; border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--bg-subtle); }
.pair-result-card > label { display: block; margin-bottom: 10px; color: var(--text-primary); font-size: var(--fs-small); font-weight: 600; }
.pair-code-value { padding: 16px; border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-primary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 28px; font-weight: 700; letter-spacing: 4px; text-align: center; }
.pair-qr-frame { display: flex; justify-content: center; padding: 12px; }
.pair-qr-frame img { width: min(240px, 100%); height: auto; aspect-ratio: 1; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--bg-surface); }
.pair-modal .error-msg { padding: 12px 14px; border: 1px solid #ffccc7; border-radius: var(--radius-sm); background: #fff2f0; text-align: left; }
.pair-modal .modal-footer { display: flex; flex-direction: column; gap: 10px; padding: 14px 24px 20px; background: var(--bg-surface); }
.pair-footer-actions { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
.pair-footer-actions.single-action { grid-template-columns: 1fr; }
.pair-footer-actions .btn-primary, .pair-footer-actions .btn-secondary { width: auto; min-height: 44px; border-radius: var(--radius-sm); }
.pair-footer-actions .btn-secondary:disabled, .pair-footer-actions .btn-primary:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.pair-reset-action { min-height: 44px; border: 1px solid #ffccc7; border-radius: var(--radius-sm); background: #fff2f0; color: #cf1322; font-weight: 600; cursor: pointer; transition: background var(--transition-base), transform var(--transition-fast); }
.pair-reset-action:hover { background: #ffe7e3; }
.pair-reset-action:focus-visible { outline: 2px solid #cf1322; outline-offset: 2px; }
.pair-reset-action:active { transform: scale(.98); }

/* Radio group */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 13px; }

/* Checkbox label */
.checkbox-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.checkbox-label-large { font-size: 14px; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* Employee select */
.employee-select { max-height: 150px; overflow-y: auto; }
.employee-select .checkbox-label { display: block; padding: 4px 0; }

/* Status dot */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.active { background: #52c41a; }
.status-dot.inactive { background: #d9d9d9; }

/* Text colors */
.text-danger { color: #ff4d4f !important; }
.text-danger:hover { color: #ff7875 !important; }

/* ===== Task List ===== */
.task-item { padding: 8px 0; cursor: pointer; border-bottom: 1px solid #f5f5f5; }
.task-item:last-child { border-bottom: none; }
.task-item-header { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.task-name { flex: 1; font-weight: 500; }
.task-status-tag { font-size: 10px; padding: 1px 6px; border-radius: 8px; }
.task-status-pending { background: #f5f5f5; color: #999; }
.task-status-in_progress { background: #e6f7ff; color: #1890ff; }
.task-status-completed { background: #f6ffed; color: #52c41a; }
.task-status-failed { background: #fff2f0; color: #ff4d4f; }
.task-status-blocked { background: #fff7e6; color: #fa8c16; }
.task-progress { font-size: 11px; color: #999; }
.task-progress-bar { height: 4px; background: #f0f0f0; border-radius: 2px; margin: 6px 0; overflow: hidden; }
.task-progress-fill { height: 100%; background: #1677ff; border-radius: 2px; transition: width 0.3s; }
.task-subtasks { display: none; padding: 6px 0 2px 12px; }
.task-subtasks.expanded { display: block; }
.task-subtask { display: flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 0; color: #666; }
.task-status-icon { width: 14px; text-align: center; font-size: 11px; }
.task-status-icon.task-status-completed { color: #52c41a; }
.task-status-icon.task-status-in_progress { color: #1890ff; }
.task-status-icon.task-status-pending { color: #bfbfbf; }
.task-status-icon.task-status-failed { color: #ff4d4f; }
.task-status-icon.task-status-blocked { color: #fa8c16; }
.task-subtask-value { color: #999; }

/* ===== Tag Badges ===== */
.tag-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; color: #fff; margin: 2px 2px; line-height: 1.6; }
.tag-add-btn { display: inline-block; font-size: 12px; color: #1677ff; cursor: pointer; padding: 2px 6px; border: 1px dashed #91caff; border-radius: 10px; margin: 2px; }
.tag-add-btn:hover { background: #e6f4ff; }
.tag-select-popup { background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); padding: 8px; z-index: 600; min-width: 140px; }
.tag-option { padding: 6px 8px; cursor: pointer; border-radius: 4px; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tag-option:hover { background: #f5f5f5; }
.tag-option.active { background: #f0f7ff; }

/* ===== Rating Stars ===== */
.rating-star { font-size: 20px; color: #e8e8e8; cursor: pointer; transition: color 0.15s; }
.rating-star.filled { color: #fadb14; }
.rating-star:hover { color: #fadb14; }
.rating-stars.rating-readonly { pointer-events: none; color: #fadb14; }

/* ===== Customer Info ===== */
.customer-section { margin-top: 8px; }
.customer-section-label { font-size: 12px; font-weight: 600; color: #888; margin-bottom: 4px; }
.remark-label, .memo-label { font-size: 12px; font-weight: 600; color: #888; }
.remark-text { font-size: 12px; color: #1677ff; cursor: pointer; }
.remark-input { width: 100%; font-size: 12px; padding: 2px 6px; border: 1px solid #d9d9d9; border-radius: 4px; outline: none; }
.remark-input:focus { border-color: #1677ff; }
.memo-text { font-size: 12px; color: #666; cursor: pointer; line-height: 1.5; white-space: pre-wrap; word-break: break-word; padding: 4px 6px; border-radius: 4px; min-height: 20px; }
.memo-text:hover { background: #f5f5f5; }
.memo-text.empty { color: #bbb; }
.memo-textarea { width: 100%; font-size: 12px; padding: 6px; border: 1px solid #d9d9d9; border-radius: 4px; outline: none; resize: vertical; min-height: 48px; font-family: inherit; }
.memo-textarea:focus { border-color: #1677ff; }
.memo-actions { display: flex; gap: 4px; margin-top: 4px; }
.memo-actions .btn-sm { margin: 0; font-size: 11px; }

/* ===== Audit Suggestions ===== */
.audit-suggestions { margin-bottom: 6px; }
.audit-card { background: #fffbe6; border: 1px solid #ffe58f; border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; animation: auditSlideIn 0.2s ease-out; }
@keyframes auditSlideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.audit-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.audit-card-title { font-size: 12px; font-weight: 600; color: #d46b08; }
.audit-card-timer { font-size: 11px; color: #d46b08; font-weight: 600; }
.audit-card-body { margin-bottom: 6px; }
.audit-text { background: #fff; border: 1px solid #d9d9d9; border-radius: 4px; padding: 6px 8px; font-size: 13px; min-height: 32px; outline: none; white-space: pre-wrap; }
.audit-text:focus { border-color: #1677ff; }
.audit-file-info { padding: 4px 0; font-size: 13px; color: #333; }
.audit-card-actions { display: flex; gap: 6px; }
.audit-card-actions .btn-sm { margin: 0; }

/* ===== Group list preview and meta ===== */
.group-item-meta { display: flex; justify-content: space-between; align-items: center; font-size: clamp(12px, calc(6px + 0.6vw), 18px); }
.group-item-preview { color: #999; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.group-item-time { color: #bbb; flex-shrink: 0; margin-left: 8px; }

/* ===== Message avatar layout ===== */
.msg { display: flex; gap: 8px; margin-bottom: 16px; }
.msg-customer, .msg-other-employee { flex-direction: row; }
.msg-ai, .msg-employee { flex-direction: row-reverse; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.msg-avatar-customer { background: #e8e8e8; color: #666; }
.msg-avatar-ai { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.msg-avatar-employee { background: #e6f4ff; color: #1677ff; border: 1px solid #91caff; }
.msg-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.msg-content { min-width: 0; max-width: 100%; }
.msg-customer .msg-content { text-align: left; }
.msg-ai .msg-content, .msg-employee .msg-content { text-align: left; }

/* ===== Contact Book ===== */
.contact-filters { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid #f0f0f0; }
.contact-filter-select { flex: 1; height: 28px; padding: 0 4px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 12px; outline: none; background: #fff; }
.contact-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid #f5f5f5; transition: background 0.15s; }
.contact-item:hover { background: #f5f5f5; }
.contact-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e6f4ff; color: #1677ff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.contact-meta { font-size: 12px; color: #999; }
.contact-tags { margin-top: 2px; }
.contact-book-btn.active { background: #e6f4ff; border-color: #1677ff; }

/* ===== Search Panel ===== */
.search-panel { background: #fff; border-left: 1px solid #e8e8e8; width: 320px; flex-shrink: 0; display: flex; flex-direction: column; }
.search-panel-header { padding: 12px 16px; border-bottom: 1px solid #e8e8e8; }
.search-panel-header h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.search-panel-header input { width: 100%; height: 32px; padding: 0 8px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; outline: none; }
.search-panel-header input:focus { border-color: #1677ff; }
.search-panel-results { flex: 1; overflow-y: auto; }
.search-result-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid #f5f5f5; font-size: 13px; }
.search-result-item:hover { background: #f5f5f5; }
.search-result-item.active { background: #e6f4ff; }
.search-result-match em { background: #fff3cd; font-style: normal; padding: 0 2px; border-radius: 2px; }
.search-result-context { color: #999; font-size: 11px; margin-top: 2px; }
.search-result-time { font-size: 11px; color: #bbb; margin-left: 8px; }

/* ===== Search highlight pulse ===== */
@keyframes highlightPulse {
    0%, 100% { background-color: transparent; }
    50% { background-color: #fff3cd; }
}
.msg-highlight { animation: highlightPulse 2s ease-in-out 3; }

/* ── 系统状态指示器 ── */
.status-dot { font-size: 16px; cursor: pointer; margin-right: 8px; }
.status-ok { color: #52c41a; }
.status-err { color: #ff4d4f; }

/* ===== Dropdown Menu (sidebar +) ===== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; z-index: 800; min-width: 160px; background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); padding: 4px 0; }
.dropdown-menu.hidden { display: none; }
.dropdown-up .dropdown-menu { bottom: 100%; left: 0; margin-bottom: 4px; }
.dropdown-down .dropdown-menu { top: 100%; left: 0; margin-top: 4px; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 14px; color: #333; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.dropdown-item svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-secondary); }
.dropdown-item:hover { background: #f5f7fa; }
.dropdown-item:first-child { border-radius: 8px 8px 0 0; }
.dropdown-item:last-child { border-radius: 0 0 8px 8px; }

/* ===== Action Modal (添加联系人 / 创建群组) ===== */
.modal-form .form-group { margin-bottom: 16px; }
.modal-form .form-group label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 6px; }
.modal-form .input-full { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.modal-form .input-full:focus { border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,0.1); }
.modal-form .hint-text { display: block; font-size: 12px; color: #999; margin-top: 4px; }
.modal-form .form-error { color: #ff4d4f; font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fff2f0; border: 1px solid #ffccc7; border-radius: var(--radius-sm); display: none; }
.modal-form .btn-primary { width: 100%; height: 44px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s, transform 0.15s; }
.modal-form .btn-primary:hover { background: #4096ff; }
.modal-form .btn-primary:disabled { background: #a0c4ff; cursor: not-allowed; }
.modal-form .btn-secondary { width: 100%; height: 44px; background: #fff; color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; transition: border-color 0.2s, color 0.2s, transform 0.15s; }
.modal-form .btn-secondary:hover { border-color: #1677ff; color: #1677ff; }
.modal-form .form-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-form .form-actions .btn-primary,
.modal-form .form-actions .btn-secondary { flex: 1; }

/* ===== Message "more" button ===== */
.msg-more-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: #bbb; cursor: pointer; font-size: 16px; font-weight: 700; padding: 0 2px; line-height: 1; border-radius: 3px; transition: all 0.15s; vertical-align: middle; }
.msg-more-btn:hover { color: #1677ff; background: #f0f0f0; }
/* 客户消息 header 是 flex-start，按钮 margin-left:auto 推到右边缘 */
.msg-customer .msg-header .msg-more-btn { margin-left: auto; }
.msg-wrapper { position: relative; }

/* ===== Message Context Menu (回复/转发) ===== */
.msg-context-menu { position: absolute; z-index: 900; min-width: 140px; background: #fff; border: 1px solid #e8e8e8; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); padding: 4px 0; display: none; }
.msg-context-menu.visible { display: block; }
.msg-context-item { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 13px; color: #333; cursor: pointer; transition: background 0.15s; }
.msg-context-item:hover { background: #f5f7fa; }
.msg-context-item:first-child { border-radius: 8px 8px 0 0; }
.msg-context-item:last-child { border-radius: 0 0 8px 8px; }
.msg-wrapper { position: relative; }

/* ===== Forward Mode (多选转发) ===== */
.forward-bar { display: none; align-items: center; justify-content: space-between; padding: 8px 16px; background: #e6f4ff; border-bottom: 1px solid #91caff; flex-shrink: 0; }
.forward-bar.visible { display: flex; }
.forward-bar-info { font-size: 13px; color: #1677ff; font-weight: 500; }
.forward-bar-actions { display: flex; gap: 8px; }
.forward-bar .btn-primary { height: 32px; padding: 0 16px; background: #1677ff; color: #fff; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; }
.forward-bar .btn-primary:hover { background: #4096ff; }
.forward-bar .btn-secondary { height: 32px; padding: 0 16px; background: #fff; color: #333; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; cursor: pointer; }
.forward-bar .btn-secondary:hover { border-color: #1677ff; color: #1677ff; }
.msg-forward-check { display: none; position: absolute; top: 4px; left: 4px; z-index: 5; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #1677ff; background: #fff; cursor: pointer; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.msg-forward-check.visible { display: flex; }
.msg-forward-check.checked { background: #1677ff; }
.msg-forward-check.checked::after { content: "✓"; }
.forward-mode .msg-forward-check { display: flex; }

/* ============================================================
   WhatsApp 风格添加联系人 & 创建群组弹窗
   ============================================================ */
.required { color: #ff4d4f; }

.phone-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.country-code-select {
  width: 130px;
  min-width: 130px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  outline: none;
}
.country-code-select:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}
.phone-number-input {
  flex: 1;
  height: 40px !important;
}

.form-status {
  display: none;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 6px;
}
.form-status.visible { display: block; }
.form-status.info    { background: #e6f7ff; border: 1px solid #91d5ff; color: #1890ff; }
.form-status.success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }
.form-status.warning { background: #fffbe6; border: 1px solid #ffe58f; color: #faad14; }
.form-status.error   { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }

/* ═══════════════════════════════════
   添加成员弹窗 — 三页签
   ═══════════════════════════════════ */
.modal-add-member .modal-content { max-width: 520px; }

.add-member-tab-bar {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
  margin: 0 -20px 12px;
  padding: 0 20px;
  background: #fafafa;
}
.add-member-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  user-select: none;
}
.add-member-tab:hover { color: #555; background: #f0f0f0; }
.add-member-tab.active {
  color: #1677ff;
  border-bottom-color: #1677ff;
  background: transparent;
}
.add-member-tab .tab-badge {
  display: inline-block;
  font-size: 11px;
  background: #e6f4ff;
  color: #1677ff;
  padding: 0 6px;
  border-radius: 8px;
  margin-left: 2px;
  font-weight: 400;
}
.add-member-tab.active .tab-badge { background: #1677ff; color: #fff; }

.contact-picker-section {
  margin-bottom: 4px;
}
.contact-picker-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  padding: 8px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.contact-picker-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  margin-top: 8px;
}
.contact-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}
.contact-picker-item:last-child { border-bottom: none; }
.contact-picker-item:hover { background: #f5f7fa; }
.contact-picker-item.selected { background: #e6f7ff; }
.contact-picker-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #1677ff;
  cursor: pointer;
  flex-shrink: 0;
}
.contact-picker-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1677ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.contact-picker-avatar.employee { background: #52c41a; }
.contact-picker-avatar.phonebook { background: #1677ff; }
.contact-picker-info { flex: 1; min-width: 0; }
.contact-picker-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-picker-role,
.contact-picker-phone {
  display: block;
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}
.contact-picker-meta {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.contact-picker-empty {
  padding: 24px;
  text-align: center;
  color: #999;
  font-size: 14px;
}
.contact-picker-wrapper {
  margin-top: 8px;
}
.contact-picker-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 0;
}
.selected-count {
  font-size: 13px;
  color: #999;
}
.modal-participant-count {
  font-size: 12px;
  color: #999;
  font-weight: normal;
  margin-left: 8px;
}

/* ===== Tenant Branding — Login Page ===== */
.login-system-brand {
    position: fixed;
    top: 16px;
    left: 24px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    z-index: 10;
    user-select: none;
}
.login-tenant-brand {
    text-align: center;
    margin-bottom: 24px;
}
.login-tenant-logo {
    max-width: 180px;
    max-height: 80px;
    object-fit: contain;
    margin: 0 auto 12px;
    display: block;
}
.login-tenant-name {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== Admin — Branding Settings Page ===== */
.branding-preview {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    min-height: 160px;
}
.branding-preview-header {
    position: absolute;
    top: 12px;
    left: 16px;
}
.branding-preview-system {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}
.branding-preview-body {
    padding-top: 16px;
}
.branding-preview-logo {
    max-width: 160px;
    max-height: 72px;
    object-fit: contain;
    margin: 0 auto 12px;
}
.branding-preview-name {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.logo-upload-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.logo-upload-hint {
    font-size: 12px;
    color: #999;
}
.logo-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}
.logo-preview img {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    padding: 4px;
}
.save-status {
    font-size: 13px;
    margin-left: 12px;
}
.save-success { color: #52c41a; }
.save-error { color: #ff4d4f; }
.form-input {
    width: 100%;
    max-width: 400px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

/* ============================================================
   内联搜索栏（会话界面顶部）
   ============================================================ */
.chat-search-bar {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 8px 12px;
    animation: searchBarSlideIn 0.2s ease-out;
}
@keyframes searchBarSlideIn {
    from { opacity: 0; max-height: 0; padding: 0 12px; }
    to   { opacity: 1; max-height: 80px; padding: 8px 12px; }
}
.chat-search-input-wrap {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 0 8px;
    transition: border-color 0.2s;
}
.chat-search-input-wrap:focus-within {
    border-color: #1677ff;
    background: #fff;
}
.chat-search-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    height: 36px;
    padding: 0 4px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.chat-search-clear {
    background: none;
    border: none;
    font-size: 18px;
    color: #bbb;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.chat-search-clear:hover { color: #999; }
.chat-search-loading {
    text-align: center;
    padding: 12px;
    color: #999;
    font-size: 13px;
}
.chat-search-loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    border: 2px solid #e8e8e8;
    border-top-color: #1677ff;
    border-radius: 50%;
    animation: searchSpin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes searchSpin { to { transform: rotate(360deg); } }

/* ── 搜索结果容器 ── */
.chat-search-results {
    max-height: 380px;
    overflow-y: auto;
    margin-top: 4px;
}
.chat-search-results:empty { display: none; }

/* ── 分类区块 ── */
.search-category-section { margin-bottom: 8px; }
.search-category-header {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    padding: 6px 4px 4px;
    border-bottom: 1px solid #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── 客户结果 ── */
.search-customer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.search-customer-item:hover { background: #f5f7fa; }
.search-customer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #e6f4ff;
    color: #1677ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.search-customer-info { flex: 1; min-width: 0; }
.search-customer-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}
.search-customer-phone {
    font-size: 12px;
    color: #999;
    margin-top: 1px;
}
.search-customer-preview {
    font-size: 12px;
    color: #bbb;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 匹配标签 ── */
.search-match-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
}
.search-match-badge.name { background: #e6f7ff; color: #1890ff; }
.search-match-badge.phone { background: #f6ffed; color: #52c41a; }
.search-match-badge.both { background: #fff7e6; color: #fa8c16; }

/* ── 消息结果 ── */
.search-message-item {
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}
.search-message-item:last-child { border-bottom: none; }
.search-message-item:hover { background: #f5f7fa; }
.search-message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    font-size: 12px;
    color: #999;
}
.search-message-sender {
    font-weight: 500;
    color: #666;
}
.search-message-text {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-message-text em {
    background: #fff3cd;
    font-style: normal;
    padding: 0 2px;
    border-radius: 2px;
}
.search-message-time {
    font-size: 11px;
    color: #bbb;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── 查看更多 ── */
.search-more-link {
    text-align: center;
    padding: 8px 0 4px;
    font-size: 13px;
    color: #1677ff;
    cursor: pointer;
    transition: color 0.15s;
}
.search-more-link:hover { color: #4096ff; text-decoration: underline; }

/* ── 空结果 ── */
.search-empty-state {
    text-align: center;
    padding: 20px 0;
    color: #bbb;
    font-size: 13px;
}

/* ── 搜索结果高亮 ── */
.search-highlight em {
    background: #fff3cd;
    font-style: normal;
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================================
   全量搜索弹窗
   ============================================================ */
.search-full-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 48px;
    animation: modalFadeIn 0.2s ease;
}
.search-full-modal.hidden { display: none; }
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.search-full-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    animation: modalSlideIn 0.2s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.search-full-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}
.search-full-modal-header .search-full-input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.search-full-modal-header .search-full-input:focus {
    border-color: #1677ff;
}
.search-full-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.search-full-modal-close:hover { color: #333; }
.search-full-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
    min-height: 200px;
}
.search-full-modal-footer {
    padding: 12px 20px 16px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    font-size: 13px;
    color: #999;
    flex-shrink: 0;
}
.search-full-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.search-full-pagination button {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
}
.search-full-pagination button:hover { border-color: #1677ff; color: #1677ff; }
.search-full-pagination button:disabled { color: #ccc; border-color: #e8e8e8; cursor: not-allowed; }
.search-full-pagination .page-info { font-size: 13px; color: #999; }

/* ── 全量弹窗中的消息项 ── */
.search-full-item {
    padding: 10px 0;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 0 -10px;
}
.search-full-item:hover { background: #f5f7fa; }
.search-full-item:last-child { border-bottom: none; }
.search-full-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}
.search-full-item-name { font-weight: 500; color: #666; }
.search-full-item-text {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.search-full-item-text em {
    background: #fff3cd;
    font-style: normal;
    padding: 0 2px;
    border-radius: 2px;
}
.search-full-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 11px;
    color: #bbb;
}

/* ===== Contact Book Tabs ===== */
.contact-tabs { display: flex; border-bottom: 1px solid #f0f0f0; background: #fff; }
.contact-tab { flex: 1; text-align: center; padding: 8px 4px; font-size: 13px; cursor: pointer; color: #666; border-bottom: 2px solid transparent; transition: all 0.2s; user-select: none; }
.contact-tab:hover { color: #1677ff; background: #f5f5f5; }
.contact-tab.active { color: #1677ff; border-bottom-color: #1677ff; font-weight: 500; }

/* ===== Contact List Header ===== */
.contact-list-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-bottom: 1px solid #f0f0f0; font-size: 12px; color: #999; }

/* ===== Favorite Star ===== */
.favorite-star { color: #ddd; cursor: pointer; font-size: 16px; margin-left: 4px; transition: color 0.2s; }
.favorite-star.active { color: #faad14; }
.favorite-star:hover { color: #faad14; }

/* ===== Contact Delete Button ===== */
.contact-delete-btn { opacity: 0; transition: opacity 0.2s; border: none; background: none; cursor: pointer; padding: 2px 4px; font-size: 14px; color: #999; }
.contact-item:hover .contact-delete-btn { opacity: 0.6; }
.contact-delete-btn:hover { opacity: 1 !important; color: #ff4d4f; }

/* ════════════════════════════════════════
   Canvas 图片编辑器
   ════════════════════════════════════════ */
.canvas-editor-modal {
    width: 80vw;
    max-width: 80vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
}
.canvas-editor-body {
    position: relative;
    overflow: auto;
    flex: 1;
    min-height: 200px;
    max-height: calc(90vh - 180px);
    background: #f0f0f0;
}
.canvas-editor-body canvas { display: block; margin: 8px auto; }
.canvas-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    align-items: center;
    border-top: 1px solid #f0f0f0;
}
.ce-tools { display: flex; gap: 3px; align-items: center; }
.ce-sep { width: 1px; height: 20px; background: #e8e8e8; margin: 0 4px; }
.ce-tool {
    width: 32px; height: 32px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: all 0.2s;
}
.ce-tool:hover { border-color: #1677ff; color: #1677ff; }
.ce-tool.active { background: #e6f4ff; border-color: #1677ff; }
.ce-colors { display: flex; gap: 4px; align-items: center; }
.ce-color {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}
.ce-color:hover { transform: scale(1.2); }
.ce-color.active { border-color: #333; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #333; }
.ce-brush { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #666; }
.ce-brush-value { font-size: 12px; color: #666; min-width: 16px; text-align: center; }
.ce-size-slider { width: 60px; vertical-align: middle; }
.ce-zoom-label { font-size: 12px; color: #666; min-width: 36px; text-align: center; user-select: none; }
.ce-footer { display: flex; gap: 12px; justify-content: center; align-items: center; padding: 10px 16px; }
.ce-footer .btn-primary,
.ce-footer .btn-secondary,
.ce-footer .btn-text { width: auto; padding: 6px 20px; font-size: 14px; border-radius: 6px; }
.ce-text-input {
    position: absolute;
    border: 1px dashed #1677ff;
    background: rgba(255,255,255,0.95);
    padding: 6px;
    font-size: 16px;
    font-family: sans-serif;
    outline: none;
    min-width: 80px;
    min-height: 30px;
    z-index: 10;
    resize: both;
    overflow: hidden;
}

/* 裁剪覆盖层 */
.ce-crop-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 5;
    cursor: crosshair;
}
.ce-crop-sel {
    position: absolute;
    border: 2px dashed #fff;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
    display: none;
    z-index: 6;
    pointer-events: none;
}

/* ── 渠道徽标（公司通讯录员工条目） ── */
.channel-badge-wa {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #25D366;
    color: #fff;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: bold;
    line-height: 1.4;
}

/* ── 表单错误可见（用于 modal 内错误显示） ── */
.form-error.visible { display: block; }

/* ── @mention 联想下拉 ── */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    z-index: 900;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.12);
    padding: 4px 0;
    display: none;
    margin-bottom: 4px;
}
.mention-dropdown.active { display: block; }
.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mention-item:hover,
.mention-item.active { background: #e6f4ff; }
.mention-tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
    min-width: 24px;
    text-align: center;
}
.mention-tag-yj { background: #1677ff; }
.mention-tag-wa { background: #25D366; }
.mention-no-result {
    padding: 12px 14px;
    color: #999;
    font-size: 12px;
    text-align: center;
}
.cloud-drive-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 24px rgba(22,119,255,0.12);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    animation: slideInRight 0.25s ease;
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.cloud-drive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f1f5;
}
.cloud-drive-header h3 { margin: 0; font-size: 16px; }
.cloud-drive-tabs {
    display: flex;
    border-bottom: 2px solid #f0f1f5;
}
.cd-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-size: 13px;
    cursor: pointer;
    color: #888;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.cd-tab:hover { color: #6c5ce7; }
.cd-tab.active {
    color: #6c5ce7;
    border-bottom-color: #6c5ce7;
    font-weight: 600;
}
.cloud-drive-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #f0f1f5;
    flex-wrap: wrap;
}
.cd-btn {
    padding: 5px 12px;
    border: 1px solid #e4e6ed;
    border-radius: var(--radius-sm);
    background: #fafbfc;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.cd-btn:hover { background: #f0f2ff; border-color: #d5d8ee; }
.cd-breadcrumb {
    font-size: 12px;
    color: #888;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.cd-crumb {
    cursor: pointer;
    color: #6c5ce7;
}
.cd-crumb:hover { text-decoration: underline; }
.cd-sep { color: #ccc; }
.cloud-drive-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.cd-grid {
    display: flex;
    flex-direction: column;
}
.cd-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f8f8fa;
    transition: background 0.15s;
}
.cd-item:hover { background: #f5f5f8; }
.cd-folder { cursor: pointer; }
.cd-folder:hover { background: #f0edff; }
.cd-icon { font-size: 18px; margin-right: 10px; flex-shrink: 0; }
.cd-name { flex: 1; font-size: 13px; color: #2d3436; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-size { font-size: 11px; color: #999; margin-right: 12px; flex-shrink: 0; }
.cd-actions { display: flex; gap: 4px; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.cd-item:hover .cd-actions { opacity: 1; }
.cd-actions button {
    width: 26px; height: 26px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cd-actions button:hover { background: #e8e8f0; }
.cd-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 14px;
}
.cd-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* ☁️ 云盘文件选择器（发送用） */
.cd-picker-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}
.cd-picker-item:hover {
    background: #f0edff;
}
.cd-picker-section { border-bottom: 1px solid #f0f1f5; }
.cd-picker-section-title {
    display: flex; align-items: center; gap: 6px; padding: 10px 4px;
    cursor: pointer; font-size: 13px; user-select: none;
}
.cd-picker-section-title:hover { background: #f5f5f8; border-radius: var(--radius-sm); }
.cd-picker-section-body { padding: 0 4px 4px; }
.cd-picker-toggle { font-size: 10px; width: 14px; text-align: center; color: #888; }
.cd-picker-group { margin-bottom: 2px; }
.cd-picker-group-title {
    display: flex; align-items: center; gap: 6px; padding: 6px 8px;
    cursor: pointer; font-size: 12px; border-radius: 4px;
}
.cd-picker-group-title:hover { background: #f5f5f8; }
.cd-picker-group-body { padding-left: 16px; }
.cd-picker-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: var(--radius-sm); cursor: pointer; transition: background 0.15s;
}
.cd-picker-item:hover { background: #f0edff; }
.cd-picker-folder { font-size: 13px; padding: 6px 10px; }
.cd-picker-item-icon { font-size: 15px; flex-shrink: 0; }
.cd-picker-item-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-picker-item-size { font-size: 11px; color: #999; flex-shrink: 0; }
.cd-picker-sub { border-left: 2px solid #f0f1f5; margin-left: 6px; }

/* ════════════════════════════════════════
   无障碍：偏好减少动效
   ════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .msg { animation: none !important; }
}

.camera-modal { position: fixed; top:0; left:0; right:0; bottom:0; z-index:1200; background:#000; display:flex; flex-direction:column; }
.camera-modal.hidden { display:none; }
.camera-topbar { display:flex; align-items:center; padding:8px 16px; color:#fff; z-index:2; }
.camera-close { background:none; border:none; color:#fff; font-size:28px; cursor:pointer; padding:4px; line-height:1; }
.camera-timer { margin-left:16px; font-size:16px; font-family:monospace; display:flex; align-items:center; gap:6px; }
.camera-timer-dot { width:10px; height:10px; border-radius:50%; background:#ff4d4f; display:inline-block; animation:pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.camera-video-wrap { flex:1; position:relative; overflow:hidden; display:flex; align-items:center; justify-content:center; background:#000; }
.camera-video-wrap video { width:100%; height:100%; object-fit:contain; }
.camera-bottombar { display:flex; align-items:center; justify-content:center; padding:24px 16px; background:#1a1a1a; position:relative; }
.camera-capture-btn { width:68px; height:68px; border-radius:50%; border:4px solid #fff; background:transparent; cursor:pointer; position:relative; transition:all 0.15s; }
.camera-capture-btn:active { transform:scale(0.92); }
.camera-capture-btn-inner { position:absolute; top:4px; left:4px; right:4px; bottom:4px; border-radius:50%; background:#fff; transition:all 0.2s; }
.camera-capture-btn.recording .camera-capture-btn-inner { background:#ff4d4f; border-radius:6px; top:16px; left:16px; right:16px; bottom:16px; }
.camera-capture-btn.recording { border-color:#ff4d4f; animation:pulse 1s infinite; }
.camera-switch-btn { position:absolute; right:24px; top:50%; transform:translateY(-50%); background:rgba(255,255,255,0.2); border:none; color:#fff; width:44px; height:44px; border-radius:50%; font-size:20px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.camera-switch-btn:active { background:rgba(255,255,255,0.35); }
/* 预览模式 */
.camera-preview { position:absolute; top:0; left:0; right:0; bottom:0; background:#000; display:flex; flex-direction:column; z-index:3; }
.camera-preview.hidden { display:none; }
.camera-preview video, .camera-preview img { flex:1; object-fit:contain; width:100%; }
.camera-preview-actions { display:flex; gap:16px; justify-content:center; padding:20px; background:#1a1a1a; }
.camera-preview-actions button { padding:10px 32px; border-radius:8px; font-size:15px; font-weight:500; cursor:pointer; border:none; }
.camera-btn-retake { background:#555; color:#fff; }
.camera-btn-confirm { background:#1677ff; color:#fff; }
/* 移动端适配 */
@media (max-width:768px) {
  .drive-star-btn { width: 38px; height: 38px; right: 6px; bottom: 6px; font-size: 23px; }
  .camera-topbar { padding:4px 12px; }
  .camera-capture-btn { width:60px; height:60px; }
  .camera-capture-btn-inner { top:3px; left:3px; right:3px; bottom:3px; }
  .camera-capture-btn.recording .camera-capture-btn-inner { top:14px; left:14px; right:14px; bottom:14px; }
  .camera-bottombar { padding:16px 12px; }
}

/* ── @AI 内部咨询消息样式（2026-08-01）── */
.internal-msg-wrap {
    margin: 4px 8px;
}
.internal-msg {
    background: #f0f0f0;
    border-left: 3px solid #aaa;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #555;
}
.internal-msg.internal-msg-ai {
    background: #f0f0ff;
    border-left-color: #7c5cbf;
}
.internal-badge {
    font-size: 11px;
    color: #888;
    margin-right: 4px;
}
.internal-sender {
    font-size: 12px;
    color: #666;
}
.internal-content {
    margin: 4px 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: #333;
}
.use-reply-btn {
    margin-top: 6px;
    padding: 3px 10px;
    font-size: 12px;
    background: #7c5cbf;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.use-reply-btn:hover { background: #6a4db0; }
