/* =====================================================================
   在线客服系统 · 前台聊天样式
   响应式：PC / 移动端自适应
   ===================================================================== */
:root{
  --brand:#2f6fed;
  --brand-dark:#1f56c9;
  --brand-light:#eaf1ff;
  --brand-grad:linear-gradient(135deg,#3b7bff 0%,#2f6fed 55%,#1f56c9 100%);
  --text:#0f172a;
  --text-2:#5b6b82;
  --text-3:#94a3b8;
  --line:#e8edf5;
  --bg:#f4f7fc;
  --card:#ffffff;
  --ok:#16a34a;
  --warn:#f59e0b;
  --danger:#e5484d;
  --radius:16px;
  --shadow:0 10px 34px rgba(23,48,102,.10);
  --shadow-lg:0 22px 60px rgba(23,48,102,.16);
  --font:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,"Segoe UI",Roboto,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;height:100%}
body{
  font-family:var(--font);color:var(--text);background:var(--bg);
  -webkit-font-smoothing:antialiased;font-size:14px;
  overflow:hidden;
}
button,input,textarea{font-family:inherit;font-size:inherit;outline:none;border:none}
button{cursor:pointer;background:none}
img{display:block;max-width:100%}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:99px}
::-webkit-scrollbar-thumb:hover{background:#94a3b8}
::-webkit-scrollbar-track{background:transparent}

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

/* ---------------- 侧栏 ---------------- */
.side{
  width:320px;flex:0 0 320px;background:var(--card);border-right:1px solid var(--line);
  display:flex;flex-direction:column;position:relative;z-index:5;
}
.side-head{
  padding:18px 20px 16px;background:var(--brand-grad);color:#fff;position:relative;overflow:hidden;
}
.side-head::after{
  content:"";position:absolute;right:-40px;top:-50px;width:160px;height:160px;border-radius:50%;
  background:rgba(255,255,255,.10);
}
.side-head::before{
  content:"";position:absolute;right:30px;bottom:-60px;width:110px;height:110px;border-radius:50%;
  background:rgba(255,255,255,.07);
}
.sh-top{display:flex;align-items:center;gap:10px;position:relative;z-index:2}
.logo{
  width:38px;height:38px;border-radius:11px;background:rgba(255,255,255,.20);
  display:flex;align-items:center;justify-content:center;font-size:19px;backdrop-filter:blur(6px);
}
.sh-title{font-size:16px;font-weight:600;letter-spacing:.3px}
.sh-sub{font-size:11.5px;opacity:.85;margin-top:2px;display:flex;align-items:center;gap:5px}
.dot{width:6px;height:6px;border-radius:50%;background:#4ade80;box-shadow:0 0 0 3px rgba(74,222,128,.28)}
.dot.off{background:#fbbf24;box-shadow:0 0 0 3px rgba(251,191,36,.28)}

.sh-card{
  margin-top:14px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.18);
  border-radius:12px;padding:11px 13px;display:flex;align-items:center;gap:11px;
  position:relative;z-index:2;backdrop-filter:blur(6px);
}
.sh-card img{width:40px;height:40px;border-radius:10px;object-fit:cover;border:2px solid rgba(255,255,255,.5)}
.sh-card .n{font-size:13.5px;font-weight:600}
.sh-card .r{font-size:11px;opacity:.85;margin-top:2px}

.side-body{flex:1;overflow-y:auto;padding:14px 0 18px}
.sec-title{
  font-size:11.5px;color:var(--text-3);font-weight:600;letter-spacing:.6px;
  padding:12px 20px 8px;text-transform:uppercase;
}
.quick-item{
  display:flex;align-items:flex-start;gap:11px;padding:12px 18px;margin:2px 8px;border-radius:11px;
  cursor:pointer;transition:.18s;border:1px solid transparent;
}
.quick-item:hover{background:var(--brand-light);border-color:#d6e2ff;transform:translateX(2px)}
.quick-item .ic{
  width:32px;height:32px;flex:0 0 32px;border-radius:9px;background:var(--brand-light);
  display:flex;align-items:center;justify-content:center;font-size:16px;
}
.quick-item .q{font-size:13.5px;font-weight:500;line-height:1.45;color:var(--text)}
.quick-item .a{font-size:11.5px;color:var(--text-3);margin-top:3px;line-height:1.5;
  display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}

.side-foot{padding:12px 16px;border-top:1px solid var(--line);display:flex;gap:8px}
.btn-ghost{
  flex:1;padding:9px 10px;border-radius:10px;border:1px solid var(--line);background:#fff;
  color:var(--text-2);font-size:12.5px;font-weight:500;transition:.18s;text-align:center;
}
.btn-ghost:hover{border-color:var(--brand);color:var(--brand);background:var(--brand-light)}

/* ---------------- 聊天主区 ---------------- */
.main{flex:1;display:flex;flex-direction:column;background:#f7f9fd;position:relative;min-width:0}
.chat-head{
  height:66px;flex:0 0 66px;background:rgba(255,255,255,.92);backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px;padding:0 20px;
}
.menu-btn{display:none;width:36px;height:36px;border-radius:10px;align-items:center;justify-content:center;
  font-size:18px;color:var(--text-2);transition:.18s}
.menu-btn:hover{background:var(--brand-light);color:var(--brand)}
.ch-avatar{position:relative}
.ch-avatar img{width:40px;height:40px;border-radius:12px;object-fit:cover}
.ch-avatar .st{
  position:absolute;right:-1px;bottom:-1px;width:12px;height:12px;border-radius:50%;
  border:2.5px solid #fff;background:var(--ok);
}
.ch-avatar .st.off{background:#f59e0b}
.ch-info{flex:1;min-width:0}
.ch-name{font-size:15px;font-weight:600;display:flex;align-items:center;gap:7px}
.ch-name .tag{
  font-size:10.5px;font-weight:500;padding:2px 7px;border-radius:6px;background:var(--brand-light);
  color:var(--brand);
}
.ch-desc{font-size:11.5px;color:var(--text-3);margin-top:3px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ch-desc .sep{width:1px;height:10px;background:var(--line)}
.ch-actions{display:flex;gap:6px}
.icon-btn{
  width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;
  color:var(--text-2);transition:.18s;font-size:16px;
  border:1px solid var(--line);background:#fff;
}
.icon-btn:hover{background:var(--brand-light);color:var(--brand);border-color:var(--brand)}
/* ★ 结束会话：默认就是红色描边，一眼能认出是「结束」而不是白色方块 */
.icon-btn.danger{color:var(--danger);border-color:#fecaca;background:#fff5f5}
/* ★ 结束按钮直接用文字（⏻ 符号部分手机字体不渲染会变空白块） */
.icon-btn.end-txt{width:auto;padding:0 13px;font-size:13px;font-weight:600;letter-spacing:1px}
.icon-btn.danger:hover{background:var(--danger);color:#fff;border-color:var(--danger)}
/* ★ 评价按钮：高亮成主色，方便用户找到 */
.icon-btn.judge{color:var(--brand);border-color:#c7d9ff;background:var(--brand-light)}
.icon-btn.judge:hover{background:var(--brand);color:#fff;border-color:var(--brand)}
/* 已评价过的状态（灰色不可点） */
.icon-btn.judge.done{color:#94a3b8;border-color:var(--line);background:#f1f5f9;cursor:default}

/* ---------------- 消息区 ---------------- */
.msg-wrap{flex:1;overflow-y:auto;padding:22px 20px 20px;scroll-behavior:smooth}
.msg-wrap::before{
  content:"";position:fixed;pointer-events:none;
}
.day-tag{text-align:center;margin:8px 0 18px}
.day-tag span{
  font-size:11.5px;color:var(--text-3);background:rgba(255,255,255,.9);
  padding:4px 12px;border-radius:99px;border:1px solid var(--line);
}
.sys-msg{text-align:center;margin:14px 0}
.sys-msg span{
  font-size:12px;color:#7b8aa3;background:#eef2f9;padding:5px 14px;border-radius:99px;display:inline-block;
  max-width:80%;line-height:1.5;
}

.msg{display:flex;gap:10px;margin-bottom:16px;align-items:flex-start;animation:fadeUp .3s ease both}
@keyframes fadeUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.msg .ava{width:38px;height:38px;flex:0 0 38px;border-radius:11px;object-fit:cover;background:#e2e8f0}
.msg .body{max-width:min(560px,72%);min-width:0}
.msg .meta{display:flex;align-items:center;gap:7px;margin-bottom:5px;font-size:11.5px;color:var(--text-3)}
.msg .meta .nm{font-weight:600;color:var(--text-2);font-size:12.5px}
.msg .meta .role-tag{font-size:10px;padding:1px 6px;border-radius:5px;background:var(--brand-light);color:var(--brand);font-weight:600}
.bubble{
  padding:11px 15px;border-radius:4px 14px 14px 14px;background:#fff;color:var(--text);
  font-size:14px;line-height:1.68;word-break:break-word;white-space:pre-wrap;
  box-shadow:0 2px 10px rgba(23,48,102,.055);border:1px solid #eef2f8;
}
.bubble.emoji{font-size:30px;line-height:1.25;background:transparent;box-shadow:none;border:none;padding:2px 0}
.bubble img{border-radius:12px;max-width:230px;cursor:zoom-in;border:1px solid var(--line)}

/* ---- 富媒体气泡：视频 / 语音 / 文件 ---- */
.bubble-media{padding:5px !important;background:#fff !important;line-height:0}
.bubble-media video{
  display:block;border-radius:12px;max-width:240px;max-height:280px;background:#000;
  border:1px solid var(--line);
}
.bubble-audio{
  display:flex;align-items:center;gap:9px;min-width:190px;padding:9px 12px !important;
}
.bubble-audio .va-ic{
  width:30px;height:30px;border-radius:50%;background:var(--brand-light);color:var(--brand);
  display:flex;align-items:center;justify-content:center;font-size:15px;flex:0 0 auto;
}
.bubble-audio audio{height:34px;width:100%;min-width:150px;outline:none}

/* ===== ★ 微信风格语音条（替代浏览器原生 audio 控件） ===== */
.voice-bar{
  display:flex;align-items:center;gap:9px;min-width:88px;max-width:210px;
  padding:10px 13px;border-radius:14px 4px 14px 14px;
  background:#fff;border:1px solid var(--line);cursor:pointer;
  transition:.16s;user-select:none;-webkit-tap-highlight-color:transparent;
}
.voice-bar:hover{border-color:#d3e0ff;box-shadow:var(--shadow-sm)}
.voice-bar:active{transform:scale(.985)}

/* 声波：三条竖线，播放时依次跳动 */
.voice-bar .vb-wave{display:flex;align-items:center;gap:2.5px;flex:0 0 auto;height:16px}
.voice-bar .vb-wave i{
  width:2.5px;border-radius:2px;background:var(--brand);
  height:6px;transition:.2s;
}
.voice-bar .vb-wave i:nth-child(2){height:12px}
.voice-bar .vb-wave i:nth-child(3){height:8px}
.voice-bar.playing .vb-wave i{animation:vbWave .85s ease-in-out infinite}
.voice-bar.playing .vb-wave i:nth-child(2){animation-delay:.16s}
.voice-bar.playing .vb-wave i:nth-child(3){animation-delay:.32s}
@keyframes vbWave{
  0%,100%{transform:scaleY(.5)}
  50%    {transform:scaleY(1.5)}
}

.voice-bar .vb-time{font-size:13px;color:var(--text-2);font-weight:500;margin-left:auto;white-space:nowrap}

/* 自己发的：蓝底白字，方向镜像 */
.msg.mine .voice-bar{
  background:var(--brand-grad);border:none;color:#fff;
  border-radius:4px 14px 14px 14px;flex-direction:row-reverse;
  box-shadow:0 6px 18px rgba(47,111,237,.28);
}
.msg.mine .voice-bar .vb-wave i{background:#fff}
.msg.mine .voice-bar .vb-time{color:rgba(255,255,255,.92);margin-left:0;margin-right:auto}
.bubble-file{
  display:flex;align-items:center;gap:10px;min-width:196px;max-width:250px;
  padding:11px 13px !important;text-decoration:none;cursor:pointer;transition:.18s;
}
.bubble-file:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
.bubble-file .fi-ic{
  width:38px;height:38px;border-radius:10px;background:linear-gradient(135deg,#eef2ff,#e0e7ff);
  color:#4f46e5;font-size:10px;font-weight:800;letter-spacing:.3px;
  display:flex;align-items:center;justify-content:center;flex:0 0 auto;
}
.bubble-file .fi-tx{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.bubble-file .fi-nm{
  font-size:13px;font-weight:600;color:var(--text);white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;
}
.bubble-file .fi-ds{font-size:11px;color:var(--text-3)}
.bubble-file .fi-dl{
  width:26px;height:26px;border-radius:50%;background:var(--brand-light);color:var(--brand);
  display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;flex:0 0 auto;
}
.msg.mine .bubble-file .fi-ic{background:rgba(255,255,255,.22);color:#fff}
.msg.mine .bubble-file .fi-nm{color:#fff}
.msg.mine .bubble-file .fi-ds{color:rgba(255,255,255,.82)}
.msg.mine .bubble-file .fi-dl{background:rgba(255,255,255,.22);color:#fff}

.msg.mine{flex-direction:row-reverse}
.msg.mine .body{display:flex;flex-direction:column;align-items:flex-end}
.msg.mine .meta{flex-direction:row-reverse}
.msg.mine .meta .role-tag{background:#dcfce7;color:#15803d}
.msg.mine .bubble{
  border-radius:14px 4px 14px 14px;background:var(--brand-grad);color:#fff;border:none;
  box-shadow:0 6px 18px rgba(47,111,237,.28);
}
.msg-consecutive{margin-top:-8px}
.msg-consecutive .ava{visibility:hidden;height:0}
.msg-consecutive .meta{display:none}

.typing{display:flex;gap:10px;align-items:center;color:var(--text-3);font-size:12.5px;margin-bottom:14px}
.typing .d{display:flex;gap:3px}
.typing .d i{width:6px;height:6px;border-radius:50%;background:#b8c4d6;animation:bounce 1.2s infinite}
.typing .d i:nth-child(2){animation-delay:.18s}
.typing .d i:nth-child(3){animation-delay:.36s}
@keyframes bounce{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-5px);opacity:1}}

/* ---------------- 输入区 ---------------- */
.editor{
  flex:0 0 auto;background:rgba(255,255,255,.95);backdrop-filter:blur(14px);
  border-top:1px solid var(--line);padding:10px 20px 14px;
  position:relative;   /* ★ 表情/快捷面板以其为定位基准，缺了这行面板会飞出屏幕 */
}
.tool-bar{display:flex;align-items:center;gap:2px;margin-bottom:6px}
.tool{
  width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;
  color:var(--text-3);font-size:17px;transition:.18s;
}
.tool svg{display:block;pointer-events:none}
.tool:hover{background:var(--brand-light);color:var(--brand);transform:translateY(-1px)}
.tool.active{background:var(--brand-light);color:var(--brand)}
.tool.recording{background:#fee2e2;color:#dc2626;animation:recPulse 1.1s infinite}
.tool .badge{position:absolute}
.spacer{flex:1}
.hint-key{font-size:11px;color:var(--text-3)}

/* ---------------- 录音条 ---------------- */
.rec-bar{
  display:none;align-items:center;gap:10px;margin:0 0 8px;padding:9px 14px;
  background:linear-gradient(90deg,#fff1f2,#fff);border:1px solid #fecdd3;
  border-radius:11px;font-size:13px;color:#be123c;
}
.rec-bar.show{display:flex;animation:popIn .18s ease}
.rec-dot{
  width:9px;height:9px;border-radius:50%;background:#ef4444;flex:0 0 auto;
  animation:recPulse 1s infinite;
}
@keyframes recPulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.82)}}
.rec-time{font-variant-numeric:tabular-nums;font-weight:700;letter-spacing:.5px}
.rec-tip{flex:1;min-width:0;color:#f43f5e;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rec-bar button{
  height:28px;padding:0 14px;border-radius:8px;font-size:12.5px;font-weight:600;transition:.16s;
}
.rec-stop{background:#ef4444;color:#fff}
.rec-stop:hover{background:#dc2626}
.rec-cancel{background:#fff;color:#64748b;border:1px solid var(--line)}
.rec-cancel:hover{background:#f1f5f9}

/* ---------------- 上传进度条 ---------------- */
.up-bar{
  display:none;position:relative;height:26px;margin:0 0 8px;border-radius:9px;
  background:#eef2f7;overflow:hidden;
}
.up-bar.show{display:block;animation:popIn .16s ease}
.up-fill{
  height:100%;width:0;border-radius:9px;transition:width .2s ease;
  background:linear-gradient(90deg,#3b82f6,#6366f1);
}
.up-txt{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:600;color:#334155;letter-spacing:.3px;
}
.input-row{display:flex;gap:10px;align-items:flex-end}
textarea#ta{
  flex:1;min-height:42px;max-height:130px;resize:none;border:1px solid var(--line);
  border-radius:12px;padding:11px 14px;line-height:1.6;background:#fbfcfe;transition:.2s;
  font-size:14px;color:var(--text);
}
textarea#ta:focus{border-color:var(--brand);background:#fff;box-shadow:0 0 0 4px rgba(47,111,237,.10)}
textarea#ta::placeholder{color:#a9b6c9}
.btn-send{
  height:42px;padding:0 22px;border-radius:12px;background:var(--brand-grad);color:#fff;
  font-size:14px;font-weight:600;box-shadow:0 6px 18px rgba(47,111,237,.30);transition:.2s;
  display:flex;align-items:center;gap:6px;flex:0 0 auto;
}
.btn-send:hover{transform:translateY(-1px);box-shadow:0 9px 24px rgba(47,111,237,.38)}
.btn-send:active{transform:translateY(0) scale(.98)}
.btn-send:disabled{opacity:.5;cursor:not-allowed;transform:none;box-shadow:none}

/* ---------------- 表情面板 ---------------- */
.emoji-panel{
  position:absolute;bottom:100%;left:20px;margin-bottom:8px;width:308px;background:#fff;
  border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-lg);padding:12px;
  display:none;z-index:30;max-height:230px;overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.emoji-panel.show{display:block;animation:popIn .18s ease}
@keyframes popIn{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:4px}
.emoji-grid button{
  font-size:21px;padding:5px 0;border-radius:8px;transition:.14s;line-height:1.2;
  /* ★ emoji 专用字体栈：覆盖 Windows/macOS/Android/iOS，避免在缺字体环境渲染成方块 */
  font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",
              "Android Emoji","EmojiOne Color","Twemoji Mozilla",sans-serif;
}
.emoji-grid button:hover{background:var(--brand-light);transform:scale(1.16)}

/* ---------------- 引导弹窗 ---------------- */
.mask{
  position:fixed;inset:0;background:rgba(15,23,42,.46);backdrop-filter:blur(3px);
  display:none;align-items:center;justify-content:center;z-index:100;padding:20px;
}
.mask.show{display:flex;animation:fadeIn .2s ease}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.guide-modal{
  width:100%;max-width:520px;background:#fff;border-radius:20px;overflow:hidden;
  box-shadow:var(--shadow-lg);animation:popUp .28s cubic-bezier(.2,.9,.3,1.1) both;
  max-height:86vh;display:flex;flex-direction:column;
}
@keyframes popUp{from{opacity:0;transform:translateY(20px) scale(.96)}to{opacity:1;transform:none}}
.gm-head{
  padding:22px 24px 18px;background:var(--brand-grad);color:#fff;position:relative;overflow:hidden;
}
.gm-head::after{content:"";position:absolute;right:-30px;top:-40px;width:140px;height:140px;border-radius:50%;background:rgba(255,255,255,.10)}
.gm-close{
  position:absolute;right:14px;top:14px;width:30px;height:30px;border-radius:9px;
  display:flex;align-items:center;justify-content:center;color:#fff;font-size:17px;
  background:rgba(255,255,255,.16);z-index:3;transition:.18s;
}
.gm-close:hover{background:rgba(255,255,255,.3);transform:rotate(90deg)}
.gm-hi{display:flex;align-items:center;gap:13px;position:relative;z-index:2}
.gm-hi img{width:52px;height:52px;border-radius:15px;object-fit:cover;border:2.5px solid rgba(255,255,255,.65);box-shadow:0 6px 16px rgba(0,0,0,.16)}
.gm-hi .t1{font-size:17px;font-weight:700;letter-spacing:.2px}
.gm-hi .t2{font-size:12.5px;opacity:.9;margin-top:4px;line-height:1.5}
.gm-body{padding:18px 22px 20px;overflow-y:auto}
.gm-label{font-size:12px;color:var(--text-3);font-weight:600;margin-bottom:11px;letter-spacing:.4px}
.gm-list{display:flex;flex-direction:column;gap:9px}
.gm-item{
  display:flex;align-items:center;gap:12px;padding:13px 15px;border:1px solid var(--line);
  border-radius:13px;cursor:pointer;transition:.18s;background:#fbfcfe;
}
.gm-item:hover{border-color:var(--brand);background:var(--brand-light);transform:translateX(3px)}
.gm-item .ic{
  width:34px;height:34px;flex:0 0 34px;border-radius:10px;background:#fff;border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;font-size:16px;
}
.gm-item:hover .ic{border-color:#c7d9ff}
.gm-item .tx{flex:1;font-size:13.5px;font-weight:500;line-height:1.5}
.gm-item .ar{color:var(--text-3);font-size:15px;transition:.18s}
.gm-item:hover .ar{color:var(--brand);transform:translateX(3px)}
.gm-foot{padding:0 22px 20px;display:flex;gap:10px}
.btn-primary{
  flex:1;padding:12px;border-radius:12px;background:var(--brand-grad);color:#fff;font-size:14px;
  font-weight:600;box-shadow:0 6px 18px rgba(47,111,237,.28);transition:.2s;
}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 9px 24px rgba(47,111,237,.36)}
.btn-line{
  padding:12px 20px;border-radius:12px;border:1px solid var(--line);background:#fff;
  color:var(--text-2);font-size:14px;font-weight:500;transition:.18s;
}
.btn-line:hover{border-color:var(--brand);color:var(--brand)}

/* ---------------- 图片预览 ---------------- */
.lightbox{
  position:fixed;inset:0;background:rgba(8,14,28,.88);z-index:200;display:none;
  align-items:center;justify-content:center;padding:30px;
}
.lightbox.show{display:flex;animation:fadeIn .2s}
.lightbox img{max-width:92vw;max-height:88vh;border-radius:12px;box-shadow:0 30px 80px rgba(0,0,0,.5)}

/* ---------------- Toast ---------------- */
.toast-box{position:fixed;top:20px;left:50%;transform:translateX(-50%);z-index:300;display:flex;flex-direction:column;gap:9px;align-items:center}
.toast{
  padding:10px 20px;border-radius:11px;background:rgba(15,23,42,.90);color:#fff;font-size:13.5px;
  box-shadow:0 10px 30px rgba(0,0,0,.24);animation:toastIn .26s ease both;backdrop-filter:blur(10px);
  max-width:80vw;text-align:center;
}
.toast.ok{background:rgba(22,163,74,.94)}
.toast.err{background:rgba(220,38,38,.94)}
@keyframes toastIn{from{opacity:0;transform:translateY(-12px)}to{opacity:1;transform:none}}

/* ---------------- 遮罩（移动端侧栏） ---------------- */
.side-mask{position:fixed;inset:0;background:rgba(15,23,42,.42);z-index:4;display:none}
.side-mask.show{display:block;animation:fadeIn .2s}

/* ---------------- 登录弹窗 ---------------- */
.login-modal{width:100%;max-width:400px;background:#fff;border-radius:18px;padding:30px 28px 26px;box-shadow:var(--shadow-lg);animation:popUp .28s cubic-bezier(.2,.9,.3,1.1) both}
.login-modal h3{margin:0 0 6px;font-size:19px;font-weight:700}
.login-modal p.s{margin:0 0 20px;font-size:12.5px;color:var(--text-3);line-height:1.6}
.field{margin-bottom:13px}
.field label{display:block;font-size:12.5px;color:var(--text-2);font-weight:500;margin-bottom:6px}
.field input{
  width:100%;padding:11px 14px;border:1px solid var(--line);border-radius:11px;background:#fbfcfe;
  transition:.2s;font-size:14px;
}
.field input:focus{border-color:var(--brand);background:#fff;box-shadow:0 0 0 4px rgba(47,111,237,.10)}
.field label i{color:#ef4444;font-style:normal}

/* 登录 / 注册 分段切换 */
.seg-tabs{
  display:flex;gap:4px;padding:4px;background:#f1f5fb;border-radius:12px;margin:0 0 18px;
}
.seg-tabs .seg{
  flex:1;height:36px;border-radius:9px;font-size:13.5px;font-weight:600;color:var(--text-3);
  transition:.18s;
}
.seg-tabs .seg:hover{color:var(--text-2)}
.seg-tabs .seg.active{
  background:#fff;color:var(--brand);box-shadow:0 2px 8px rgba(47,111,237,.14);
}

/* 两列字段（注册表单用） */
.row-2{display:grid;grid-template-columns:1fr 1fr;gap:11px}
@media (max-width:520px){
  .row-2{grid-template-columns:1fr}
}

/* =====================================================================
   响应式
   ===================================================================== */
@media (max-width:900px){
  .side{width:280px;flex-basis:280px}
  .msg .body{max-width:78%}
}
@media (max-width:768px){
  .side{
    position:fixed;left:0;top:0;bottom:0;width:82%;max-width:330px;z-index:20;
    transform:translateX(-104%);transition:transform .28s cubic-bezier(.3,.8,.3,1);
    box-shadow:0 0 60px rgba(15,23,42,.2);
  }
  .side.open{transform:none}
  .menu-btn{display:flex}
  .chat-head{height:60px;flex-basis:60px;padding:0 12px;gap:8px}
  .ch-avatar img{width:36px;height:36px;border-radius:10px}
  .ch-name{font-size:14.5px}
  .ch-desc .hide-m{display:none}
  .msg-wrap{padding:16px 12px 18px}
  .msg .ava{width:34px;height:34px;flex-basis:34px;border-radius:9px}
  .msg .body{max-width:82%}
  .bubble{font-size:14.5px;padding:10px 13px}
  .bubble img{max-width:180px}
  .editor{padding:8px 10px calc(10px + env(safe-area-inset-bottom))}
  .tool-bar{gap:0}
  .hint-key{display:none}
  .btn-send{padding:0 16px}
  .btn-send .txt{display:none}
  .emoji-panel{left:10px;right:10px;width:auto}
  .emoji-grid{grid-template-columns:repeat(8,1fr)}
  .guide-modal{max-width:100%;border-radius:18px}
  .gm-head{padding:20px 18px 16px}
  .gm-body{padding:16px 16px 18px}
  .gm-foot{padding:0 16px 18px}
}
@media (max-width:380px){
  .emoji-grid{grid-template-columns:repeat(7,1fr)}
  .ch-desc{font-size:11px}
}
/* 横屏小高度 */
@media (max-height:520px) and (max-width:900px){
  .side-head{padding:12px 16px}
  .sh-card{display:none}
}
