:root {
  --navy: #34355f;
  --primary: #45467c;
  --primary-2: #555791;
  --green: #21ae79;
  --pink: #d75795;
  --purple: #7b58c8;
  --text: #33374b;
  --muted: #8c91a5;
  --line: #eceef4;
  --soft: #f7f8fb;
  --shadow: 0 12px 36px rgba(41, 43, 78, .16);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif; color: var(--text); background: #fff; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* 登录 */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.04fr) minmax(390px, .96fr); background: #f7f8fc; }
.login-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; color: white; background: linear-gradient(145deg, #363864, #4c4d84 60%, #60619b); }
.login-hero::before, .login-hero::after { content:""; position:absolute; border-radius:50%; border:1px solid rgba(255,255,255,.08); width:560px; height:560px; }
.login-hero::before { left:-220px; top:-120px; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018); }
.login-hero::after { right:-260px; bottom:-300px; }
.hero-inner { position:relative; z-index:1; width:min(520px,80%); }
.hero-logo { font-size:30px; font-weight:800; letter-spacing:2px; display:flex; gap:15px; align-items:center; margin-bottom:12px; }
.hero-logo .bubble, .top-logo .bubble { position:relative; width:35px; height:28px; }
.bubble::before,.bubble::after { content:"";position:absolute;border-radius:50%;background:currentColor; }
.bubble::before { width:24px;height:20px;left:0;top:0; }
.bubble::after { width:19px;height:16px;right:0;bottom:0;box-shadow: -2px 12px 0 -7px currentColor; }
.hero-subtitle { opacity:.7; margin:0 0 54px 51px; font-size:15px; letter-spacing:4px; }
.feature { display:flex; align-items:center; gap:16px; margin:25px 0; font-size:16px; }
.feature-icon { width:42px;height:42px;border-radius:12px;background:rgba(255,255,255,.1);display:grid;place-items:center;font-size:20px; }
.login-pane { display:flex; align-items:center; justify-content:center; padding:40px; }
.login-card { width:min(390px,100%); }
.login-card h1 { color:var(--navy); text-align:center; font-size:28px; margin:0 0 42px; letter-spacing:2px; }
.input-wrap { position:relative; margin-bottom:18px; }
.input-wrap .input-icon { position:absolute;left:16px;top:50%;transform:translateY(-50%);color:#a2a7b7; }
.login-input { width:100%;height:48px;border:1px solid #e1e4ec;border-radius:7px;background:#fff;padding:0 48px;color:#333;outline:none;transition:.2s; }
.login-input:focus { border-color:#7779aa;box-shadow:0 0 0 3px rgba(79,81,137,.1); }
.eye-btn { position:absolute;right:6px;top:5px;width:38px;height:38px;border:0;background:transparent;color:#a0a5b4; }
.captcha-row { display:grid;grid-template-columns:1fr 115px;gap:10px; }
.captcha-btn { border:1px solid #e1e4ec;background:#f7f8fb;border-radius:7px;color:#555a70;font-weight:600; }
.primary-btn { width:100%;height:48px;border:0;border-radius:7px;color:#fff;background:linear-gradient(135deg,#444675,#5b5d94);box-shadow:0 8px 20px rgba(64,67,119,.2);font-weight:700;letter-spacing:5px; }
.login-error { min-height:24px;color:#e25566;font-size:13px;padding:2px 4px; }

/* 工作台 */
.workspace { height:100vh;min-width:900px;display:flex;flex-direction:column;overflow:hidden;background:#fff; }
.topbar { height:48px;flex:0 0 48px;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 18px;justify-content:space-between;background:#fff; }
.top-left,.top-actions { display:flex;align-items:center;gap:14px; }
.top-logo { display:flex;align-items:center;gap:9px;font-weight:800;color:var(--navy);font-size:15px; }
.top-logo .bubble { width:25px;height:21px;color:var(--navy);transform:scale(.72);transform-origin:left center;margin-right:-5px; }
.reception { height:28px;border:1px solid #b8eed9;background:#e9fbf4;color:#169765;border-radius:16px;padding:0 12px;font-size:12px;font-weight:700; }
.reception.off { color:#b26e17;border-color:#f0d6aa;background:#fff8e9; }
.top-action { border:0;background:transparent;color:#9ba0af;font-size:12px;padding:5px 3px; }
.top-action:hover { color:var(--primary); }
.top-action.danger { color:#e66c78; }
.workbody { flex:1;display:grid;grid-template-columns:270px minmax(400px,1fr);min-height:0; }
.sidebar { border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0;background:#fff; }
.profile-block { padding:9px 15px 8px;border-bottom:1px solid var(--line); }
.assistant-title { font-size:16px;font-weight:800;margin-bottom:8px; }
.shortcode-line { display:flex;align-items:center;gap:7px;font-size:12px;color:#6e7387;margin-bottom:7px; }
.shortcode-line strong { color:var(--navy); }
.mini-btn { border:1px solid #e2e5ed;background:#fff;border-radius:4px;color:#656a7c;padding:3px 8px;font-size:11px; }
.agent-row { display:grid;grid-template-columns:41px 1fr auto;gap:8px;align-items:center; }
.qr-avatar { width:41px;height:41px;border:1px solid #e5e6ec;border-radius:3px;display:grid;place-items:center;background:#fff;color:#ff7f50;font-size:20px;overflow:hidden;padding:2px;cursor:pointer; }
.qr-avatar img { display:block;width:100%;height:100%;image-rendering:pixelated; }
.qr-preview { display:grid;place-items:center;padding:4px 0 12px; }
.qr-preview img { width:min(280px,72vw);height:min(280px,72vw);image-rendering:pixelated;border:12px solid #fff;box-shadow:0 7px 28px rgba(42,44,75,.12); }
.qr-url { padding:10px 12px;border:1px solid #e4e6ec;border-radius:5px;background:#f7f8fb;color:#666c7f;font-size:12px;word-break:break-all;text-align:center; }
.wechat-tip { margin:12px 0 0;color:#29a675;font-size:12px;text-align:center; }
.agent-main { min-width:0; }
.agent-name { display:flex;align-items:center;gap:7px;font-weight:700;font-size:14px;white-space:nowrap; }
.status-tag { background:#eafaf3;color:#13a66f;border-radius:3px;padding:2px 5px;font-size:10px; }
.icon-strip { display:flex;gap:4px;margin-top:5px; }
.icon-btn { width:23px;height:23px;border:1px solid #e8eaf0;border-radius:4px;background:#fff;color:#9ca1b0;font-size:12px;padding:0; }
.short-link { font-size:10px;color:#8f94a5;margin-top:4px;display:flex;align-items:center;gap:5px;white-space:nowrap;overflow:hidden; }
.short-link span { overflow:hidden;text-overflow:ellipsis; }
.quick-actions { display:grid;grid-template-columns:1fr 1.25fr 1fr;gap:5px;padding:8px;border-bottom:1px solid var(--line); }
.action-chip { height:33px;border:0;border-radius:5px;font-weight:700;font-size:12px; }
.action-chip.green { color:#078c62;background:#e6faf2; }
.action-chip.indigo { color:#50527e;background:#f0f1f8; }
.action-chip.purple { color:#6f42bd;background:#f1ebfb; }
.filter-tabs { display:grid;grid-template-columns:repeat(3,1fr);height:42px;border-bottom:1px solid var(--line); }
.filter-tab { border:0;background:#fff;color:#7f8497;font-size:12px;position:relative; }
.filter-tab.active { color:var(--pink);font-weight:700; }
.filter-tab.active::after { content:"";height:3px;background:var(--pink);position:absolute;left:0;right:0;bottom:0; }
.settings-line { display:flex;flex-wrap:wrap;gap:16px 22px;padding:11px 12px 8px;border-bottom:1px solid var(--line);font-size:11px;font-weight:600; }
.switch-pair { display:flex;align-items:center;gap:6px;white-space:nowrap; }
.switch { width:30px;height:17px;border-radius:10px;border:0;background:#dfe2e9;padding:2px;transition:.2s; }
.switch::before { content:"";display:block;width:13px;height:13px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.2);transition:.2s; }
.switch.on { background:#3ebf8a; }
.switch.on::before { transform:translateX(13px); }
.search-wrap { padding:9px 15px 7px; }
.search { width:100%;height:27px;border:1px solid #dedfe5;border-radius:3px;padding:0 9px;font-size:11px;outline:none; }
.list-meta { display:flex;justify-content:space-between;align-items:center;padding:2px 15px 8px;color:#798092;font-size:11px; }
.group-btn { height:26px;border:0;border-radius:3px;background:var(--primary);color:#fff;padding:0 13px;font-size:11px; }
.conversation-list { flex:1;overflow:auto;border-top:1px solid #f3f4f7; }
.empty-list { text-align:center;color:#aeb3bf;padding-top:82px;font-size:13px; }
.empty-box { width:52px;height:38px;margin:0 auto 20px;background:linear-gradient(145deg,#f2f3f7,#fff);clip-path:polygon(15% 22%,35% 0,65% 0,85% 22%,100% 32%,80% 100%,20% 100%,0 32%);opacity:.8; }
.conversation { display:grid;grid-template-columns:40px 1fr auto;gap:8px;padding:10px 13px;border-bottom:1px solid #f1f2f6;cursor:pointer; }
.conversation:hover,.conversation.active { background:#f7f8fc; }
.conv-avatar { width:38px;height:38px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:800;background:linear-gradient(135deg,#63669a,#9799bf); }
.conv-name { font-size:13px;font-weight:700;margin:2px 0 5px; }
.conv-last { color:#9ba0ae;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:145px; }
.conv-time { color:#afb3bf;font-size:9px;text-align:right; }
.unread { margin-top:7px;margin-left:auto;background:#e65b73;color:#fff;font-size:9px;min-width:17px;height:17px;border-radius:9px;display:grid;place-items:center; }

.chat-panel { min-width:0;display:flex;flex-direction:column;position:relative;background:#f7f8fb; }
.chat-empty { flex:1;display:grid;place-items:center;background:#fff;color:#9da2b2;text-align:center; }
.chat-empty-icon { width:66px;height:66px;border-radius:50%;background:#f5f7fa;display:grid;place-items:center;margin:0 auto 15px;font-size:29px;color:#c8cdd7; }
.chat-empty strong { display:block;font-size:14px;font-weight:500;margin-bottom:8px; }
.chat-empty span { font-size:11px;color:#c2c6d0; }
.chat-view { height:100%;display:flex;flex-direction:column; }
.chat-header { height:54px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 18px; }
.chat-title { font-weight:700;font-size:14px; }
.chat-subtitle { color:#9ca1af;font-size:10px;margin-top:3px; }
.chat-tools button { border:0;background:transparent;color:#949aaa;font-size:18px; }
.messages { flex:1;overflow:auto;padding:18px 24px; }
.message-row { display:flex;margin:9px 0;gap:8px;align-items:flex-end; }
.message-row.agent { justify-content:flex-end; }
.message-row.system { justify-content:center; }
.message-bubble { max-width:62%;padding:9px 12px;border-radius:7px;background:#fff;box-shadow:0 1px 2px rgba(20,22,40,.04);font-size:13px;line-height:1.55;word-break:break-word; }
.message-row.agent .message-bubble { color:#fff;background:var(--primary); }
.message-row.agent .message-bubble.image-bubble,.message-bubble.image-bubble { padding:3px;background:#fff;color:inherit;overflow:hidden; }
.chat-image-link { display:block;line-height:0; }
.chat-image { display:block;max-width:min(260px,58vw);max-height:330px;border-radius:5px;object-fit:contain; }
.message-text { padding:0; }
.image-bubble .message-text { padding:7px 8px 5px; }
.message-row.system .message-bubble { font-size:10px;color:#999;background:#eceef3;padding:4px 10px;border-radius:12px; }
.message-time { font-size:9px;color:#b0b4c0;margin-bottom:2px; }
.composer { background:#fff;border-top:1px solid var(--line);padding:9px 14px 13px; }
.composer-tools { display:flex;gap:12px;color:#868b9a;height:26px;align-items:center; }
.composer-tools button { border:0;background:transparent;color:inherit;padding:0;font-size:16px; }
.compose-row { display:flex;gap:10px;align-items:flex-end; }
.compose-input { flex:1;resize:none;border:0;outline:none;min-height:60px;max-height:120px;padding:5px;font-size:13px; }
.send-btn { border:0;border-radius:5px;background:var(--primary);color:#fff;padding:8px 19px; }

/* 弹窗 */
.modal-mask { position:fixed;inset:0;background:rgba(24,25,45,.32);display:grid;place-items:center;z-index:30;padding:20px; }
.modal { width:min(520px,94vw);max-height:90vh;background:#fff;border-radius:8px;box-shadow:var(--shadow);overflow:hidden;display:flex;flex-direction:column; }
.modal.wide { width:min(760px,94vw); }
.modal-header { height:50px;display:flex;align-items:center;justify-content:space-between;padding:0 18px;border-bottom:1px solid var(--line);font-size:16px;font-weight:700;color:var(--navy); }
.modal-close { border:0;background:transparent;color:#a3a8b6;font-size:19px; }
.modal-body { padding:18px;overflow:auto; }
.modal-footer { display:flex;justify-content:flex-end;gap:10px;padding:12px 18px;border-top:1px solid var(--line); }
.btn { border:1px solid #dedfe7;background:#fff;color:#626778;border-radius:5px;padding:8px 16px; }
.btn.primary { border-color:var(--primary);background:var(--primary);color:#fff; }
.btn.danger { border-color:#ed9aa3;color:#df5a69; }
.field { margin-bottom:16px; }
.field label { display:block;font-size:12px;color:#5e6375;margin-bottom:7px;font-weight:600; }
.field input,.field textarea { width:100%;border:1px solid #dfe2e8;border-radius:5px;padding:9px 11px;outline:none; }
.field textarea { min-height:95px;resize:vertical; }
.hint { color:#9da2b1;font-size:11px;margin-top:6px;line-height:1.5; }
.setting-card { display:flex;align-items:center;justify-content:space-between;padding:13px 0;border-bottom:1px solid #f0f1f5; }
.setting-card:last-child { border:0; }
.setting-title { font-size:13px;font-weight:600; }
.setting-note { font-size:11px;color:#979cab;margin-top:5px; }
.quick-list { display:grid;gap:8px;margin-top:13px; }
.quick-item { border:1px solid #eceef3;border-radius:6px;padding:10px 12px;display:flex;justify-content:space-between;gap:15px; }
.quick-item strong { font-size:12px;display:block;margin-bottom:4px; }
.quick-item p { margin:0;color:#858a9b;font-size:11px; }
.quick-item button { border:0;background:transparent;color:#df6d7a; }
.member-list { border:1px solid #eceef3;border-radius:5px;max-height:190px;overflow:auto; }
.member { display:flex;align-items:center;gap:9px;padding:9px 11px;border-bottom:1px solid #f1f2f5;font-size:12px; }
.member:last-child { border:0; }
.stat-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:12px; }
.stat { padding:18px;border-radius:7px;background:#f7f8fc;text-align:center; }
.stat strong { display:block;color:var(--primary);font-size:25px;margin-bottom:4px; }
.stat span { font-size:11px;color:#8e93a3; }
.toast-root { position:fixed;z-index:100;top:65px;right:18px;display:grid;gap:8px; }
.toast { color:#fff;background:#34364f;padding:10px 15px;border-radius:5px;box-shadow:0 7px 24px rgba(0,0,0,.15);font-size:12px;animation:toastIn .2s ease; }
.toast.error { background:#d95567; }
@keyframes toastIn { from { transform:translateY(-8px);opacity:0 } }

/* 访客端 */
.client-page { min-height:100%;background:linear-gradient(145deg,#f1f3fa,#fff); }
.client-shell { width:min(430px,100%);height:100vh;margin:auto;background:#fff;display:flex;flex-direction:column;box-shadow:0 0 45px rgba(53,55,90,.13); }
.client-header { height:61px;background:var(--navy);color:#fff;display:flex;align-items:center;padding:0 17px;gap:11px; }
.client-avatar { width:38px;height:38px;border-radius:50%;background:#fff;color:var(--navy);display:grid;place-items:center;font-weight:800; }
.client-head strong { display:block;font-size:14px; }
.client-head small { opacity:.72;font-size:10px; }
.client-messages { flex:1;overflow:auto;background:#f5f6fa;padding:16px; }
.client-join { flex:1;display:grid;place-items:center;padding:30px; }
.join-card { width:100%;text-align:center; }
.join-logo { width:74px;height:74px;border-radius:23px;margin:0 auto 20px;background:var(--navy);color:#fff;display:grid;place-items:center;font-size:34px; }
.join-card h1 { font-size:21px;margin:0 0 8px;color:var(--navy); }
.join-card p { color:#959aaa;font-size:12px;margin:0 0 28px; }
.join-card input { width:100%;height:45px;border:1px solid #dfe2e9;border-radius:7px;padding:0 13px;margin-bottom:12px; }
.client-composer { display:flex;gap:8px;padding:10px;background:#fff;border-top:1px solid #eceef3;align-items:center; }
.client-composer input#clientInput { flex:1;min-width:0;height:40px;border:1px solid #dfe2e8;border-radius:20px;padding:0 15px;outline:none;font-size:14px; }
.client-composer .client-send-btn { width:62px;height:40px;border:0;border-radius:20px;background:var(--navy);color:#fff;flex:none; }
.client-photo-btn { width:43px;height:40px;border:1px solid #dfe2e8;border-radius:20px;color:#596174;background:#f8f9fc;display:grid;place-items:center;flex:none;font-size:17px;line-height:1;cursor:pointer;position:relative; }
.client-photo-btn span { position:absolute;font-size:8px;bottom:3px;right:5px;background:#fff;color:#747b8c;border-radius:5px;padding:1px 2px; }
.client-photo-btn.sending { opacity:.45;pointer-events:none; }
.client-file-input { display:none !important; }
.client-page .message-bubble.image-bubble { max-width:75%; }
@media (max-width:760px) {
  .login-shell { grid-template-columns:1fr; }
  .login-hero { display:none; }
  .workspace { min-width:0; }
  .workbody { grid-template-columns:100%; }
  .sidebar { width:100%; }
  .chat-panel { position:fixed;inset:48px 0 0 0;z-index:10;transform:translateX(100%);transition:.25s; }
  .chat-panel.mobile-open { transform:none; }
  .top-actions .top-action:not(.danger) { display:none; }
}
