/* ========================================================================
   用户 / 客服实时聊天系统  —  共用样式
   ======================================================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --primary-soft-2: #dbeafe;
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #172033;
  --text-2: #5b6474;
  --text-3: #96a0b3;
  --border: #e6eaf1;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 8px 30px rgba(15, 23, 42, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
}

input, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  border: none;
  outline: none;
  background: transparent;
}

.hidden { display: none !important; }

/* 滚动条 ---------------------------------------------------------------- */
.scroll-y { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c9d1de transparent; }
.scroll-y::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: #c9d1de; border-radius: 8px; }
.scroll-y::-webkit-scrollbar-thumb:hover { background: #aeb9ca; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------------------
   通用：头像
   ---------------------------------------------------------------------- */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  user-select: none;
  overflow: hidden;
}
.avatar.bot { background: linear-gradient(135deg, #34d399, #059669); }
.avatar.user { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }

/* ----------------------------------------------------------------------
   用户端整体布局
   ---------------------------------------------------------------------- */
.user-app {
  height: 100vh;
  height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  position: relative;
  box-shadow: 0 0 60px rgba(15, 23, 42, .07);
}

/* 顶部栏 */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  z-index: 5;
}
.chat-header .head-info { flex: 1; min-width: 0; }
.chat-header h1 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header .status {
  font-size: 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  display: inline-block;
  transition: background .2s;
}
.dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
.dot.offline { background: var(--text-3); }
.dot.connecting { background: var(--warning); animation: pulse 1.2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.head-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--text-2);
  transition: background .15s, color .15s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.active { background: var(--primary-soft); color: var(--primary); }

/* 消息区域 */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 8px;
  background:
    radial-gradient(circle at 15% 0%, rgba(37, 99, 235, .045), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(124, 58, 237, .035), transparent 40%),
    var(--surface-2);
  overflow-anchor: none;
  scrollbar-width: thin;
  scrollbar-color: #c9d1de transparent;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: #c9d1de; border-radius: 8px; }

/* 日期 / 系统提示 */
.sys-line {
  text-align: center;
  margin: 14px 0;
  font-size: 12px;
  color: var(--text-3);
}
.sys-line span {
  display: inline-block;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  max-width: 88%;
  line-height: 1.5;
}
.date-line {
  text-align: center;
  margin: 18px 0 10px;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: .5px;
}

/* 消息气泡 */
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 10px 0;
  animation: msgIn .18s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg .avatar { width: 32px; height: 32px; font-size: 12px; }
.msg .msg-body { max-width: min(74%, 560px); display: flex; flex-direction: column; gap: 3px; }
.msg.out { flex-direction: row-reverse; }
.msg.out .msg-body { align-items: flex-end; }
.msg-name { font-size: 11px; color: var(--text-3); padding: 0 4px; }

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 5px;
}
.msg.out .bubble {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff;
  border: none;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 5px;
  box-shadow: 0 3px 12px rgba(37, 99, 235, .22);
}
.bubble a { color: inherit; text-decoration: underline; }
.bubble.pending { opacity: .65; }
.bubble.failed { opacity: .9; border: 1px dashed var(--danger); }

.msg-meta {
  font-size: 11px;
  color: var(--text-3);
  padding: 0 4px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.msg-meta .read { color: var(--primary); }
.msg-meta .read.pending { color: var(--text-3); }

/* 图片 / 文件消息 */
.bubble.media {
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.msg.out .bubble.media { background: rgba(37, 99, 235, .08); border-color: rgba(37, 99, 235, .18); }
.photo {
  display: block;
  max-width: 240px;
  max-height: 300px;
  border-radius: 12px;
  cursor: zoom-in;
  object-fit: cover;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  min-width: 190px;
  max-width: 280px;
  text-decoration: none;
  color: inherit;
}
.file-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
}
.msg.out .file-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.file-info { min-width: 0; }
.file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.file-size { font-size: 11px; color: var(--text-3); }
.msg.out .file-size { color: rgba(255, 255, 255, .75); }

/* 底部新消息提示 */
.jump-bottom {
  position: absolute;
  bottom: 118px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 8;
  animation: msgIn .2s;
}

/* 输入区 */
.composer {
  flex: 0 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  position: relative;
}
.quick-replies {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 9px;
  scrollbar-width: none;
}
.quick-replies::-webkit-scrollbar { display: none; }
.quick-chip {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  border-radius: 999px;
  padding: 6px 12px;
  transition: background .15s;
}
.quick-chip:hover { background: var(--primary-soft-2); }

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.input-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 3px 6px 3px 10px;
  transition: border-color .15s, background .15s;
}
.input-box:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .09);
}
.input-box textarea {
  flex: 1;
  resize: none;
  border: none;
  padding: 9px 4px;
  max-height: 132px;
  line-height: 1.5;
  background: transparent;
  font-size: 14.5px;
}
.input-box textarea::placeholder { color: var(--text-3); }

.send-btn {
  height: 38px;
  min-width: 64px;
  padding: 0 18px;
  border-radius: 19px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, transform .1s, opacity .15s;
  margin-left: 6px;
  flex: 0 0 auto;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:active { transform: scale(.97); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; }

.typing-line {
  height: 20px;
  line-height: 20px;
  padding: 0 20px;
  font-size: 12px;
  color: var(--text-3);
  flex: 0 0 auto;
  background: var(--surface-2);
}
.typing-line .dots::after {
  content: '';
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* 表情面板 */
.emoji-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  animation: msgIn .15s;
}
.emoji-panel button {
  font-size: 22px;
  height: 38px;
  border-radius: 9px;
  transition: background .12s;
}
.emoji-panel button:hover { background: var(--surface-2); }

/* 拖拽上传遮罩 */
.drop-mask {
  position: absolute;
  inset: 0;
  background: rgba(37, 99, 235, .08);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--primary);
  font-weight: 500;
  z-index: 30;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

/* ----------------------------------------------------------------------
   弹窗 / Toast / 图片预览
   ---------------------------------------------------------------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn .16s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal h2 { margin: 0 0 6px; font-size: 18px; font-weight: 650; }
.modal p { margin: 0 0 18px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.field {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 14px;
  transition: border-color .15s, background .15s;
  margin-bottom: 12px;
}
.field:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text);
  transition: background .15s, transform .1s;
}
.btn:hover { background: #eef1f6; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: #fef2f2; color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(23, 32, 51, .92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: toastIn .2s;
  max-width: 86vw;
  text-align: center;
}
.toast.error { background: rgba(220, 38, 38, .95); }
.toast.success { background: rgba(5, 150, 105, .95); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 12, 22, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  cursor: zoom-out;
  animation: fadeIn .18s;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .5);
}

/* ----------------------------------------------------------------------
   客服端：布局
   ---------------------------------------------------------------------- */
.agent-app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 330px 1fr;
  background: var(--surface);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  min-height: 0;
  min-width: 0;
}

.side-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}
.side-head .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.brand-text { flex: 1; min-width: 0; }
.brand-text strong { display: block; font-size: 15px; font-weight: 650; }
.brand-text small { font-size: 11.5px; color: var(--text-3); }
.agent-badge {
  font-size: 11px;
  color: var(--success);
  background: rgba(16, 185, 129, .1);
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.search-box {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 11px;
  transition: border-color .15s, background .15s;
}
.search-box:focus-within { border-color: var(--primary); background: #fff; }
.search-box svg { flex: 0 0 auto; color: var(--text-3); }
.search-box input { flex: 1; font-size: 13px; }

.filters {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex: 0 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter-chip {
  font-size: 12.5px;
  color: var(--text-2);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.filter-chip:hover { background: rgba(15, 23, 42, .05); }
.filter-chip.active { background: var(--primary); color: #fff; }

.conv-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #c9d1de transparent;
}
.conv-list::-webkit-scrollbar { width: 6px; }
.conv-list::-webkit-scrollbar-thumb { background: #c9d1de; border-radius: 8px; }

.conv-item {
  display: flex;
  gap: 10px;
  padding: 11px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .13s;
  position: relative;
}
.conv-item:hover { background: rgba(15, 23, 42, .045); }
.conv-item.active { background: var(--primary-soft); }
.conv-item .avatar { position: relative; }
.conv-item .avatar .presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-3);
  border: 2px solid var(--surface-2);
}
.conv-item.active .avatar .presence-dot { border-color: var(--primary-soft); }
.conv-item .avatar .presence-dot.online { background: var(--success); }

.conv-main { flex: 1; min-width: 0; }
.conv-row1 { display: flex; align-items: baseline; gap: 6px; }
.conv-name {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time { font-size: 11px; color: var(--text-3); flex: 0 0 auto; }
.conv-row2 { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.conv-preview {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unread-badge {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.closed-tag {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--text-3);
  background: rgba(15, 23, 42, .06);
  border-radius: 4px;
  padding: 1px 5px;
}
.offline-tag { font-size: 11px; color: var(--text-3); }

.empty-list {
  padding: 50px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.7;
}

/* 客服端聊天区 */
.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--surface-2);
}
.chat-pane .chat-header { padding: 11px 18px; }
.chat-pane .chat-header .back-btn { display: none; }

.pane-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 13.5px;
  text-align: center;
  padding: 30px;
}
.pane-empty .big-icon {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 6px;
}

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

.header-sub { font-size: 12px; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.header-sub .sep { color: var(--border); }

.agent-app .messages { padding: 16px 20px 6px; }
.agent-app .msg .msg-body { max-width: min(68%, 620px); }

/* 快捷回复面板（客服端） */
.quick-panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 20;
  overflow: hidden;
  animation: msgIn .15s;
}
.quick-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}
.quick-panel-head button { font-size: 12px; color: var(--primary); }
.quick-list { max-height: 230px; overflow-y: auto; padding: 6px; }
.quick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}
.quick-item:hover { background: var(--surface-2); }
.quick-item .txt {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.quick-item .del { color: var(--text-3); font-size: 13px; padding: 2px 5px; border-radius: 5px; }
.quick-item .del:hover { color: var(--danger); background: #fef2f2; }
.quick-empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* 客服登录页 */
.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(37, 99, 235, .14), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(124, 58, 237, .12), transparent 45%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 22px;
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .14);
}
.login-card .brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 25px;
  margin: 0 auto 18px;
}
.login-card h1 { margin: 0 0 6px; font-size: 21px; text-align: center; font-weight: 700; letter-spacing: -.3px; }
.login-card .sub { margin: 0 0 26px; text-align: center; font-size: 13px; color: var(--text-3); }
.login-field { position: relative; margin-bottom: 12px; }
.login-field input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.login-field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); }
.login-error {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--danger);
  margin: 2px 0 6px;
  text-align: center;
}
.login-card .btn.primary { height: 46px; font-size: 14.5px; border-radius: 12px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 11.5px; color: var(--text-3); line-height: 1.7; }

/* 客服端会话操作按钮 */
.conv-actions { display: flex; gap: 6px; align-items: center; }
.chip-btn {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all .15s;
  white-space: nowrap;
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chip-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

/* ----------------------------------------------------------------------
   响应式
   ---------------------------------------------------------------------- */
@media (max-width: 860px) {
  .agent-app { grid-template-columns: 1fr; }
  .chat-pane { display: none; }
  .agent-app.chat-open .sidebar { display: none; }
  .agent-app.chat-open .chat-pane { display: flex; }
  .chat-pane .chat-header .back-btn { display: inline-flex; }
  .agent-app .messages { padding: 12px 12px 4px; }
  .agent-app .msg .msg-body { max-width: 78%; }
  .conv-list { padding: 6px; }
}

@media (max-width: 560px) {
  .user-app { box-shadow: none; }
  .messages { padding: 12px 10px 4px; }
  .msg .msg-body { max-width: 80%; }
  .bubble { font-size: 14px; }
  .chat-header { padding: 10px 12px; }
  .composer { padding-left: 10px; padding-right: 10px; }
  .send-btn { min-width: 56px; padding: 0 14px; }
  .photo { max-width: 200px; max-height: 250px; }
  .jump-bottom { bottom: 108px; }
  .login-card { padding: 28px 22px 22px; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
