/* ============================================================
   BlueChat 全局样式
   主色 #2563EB / 亮蓝 #3B82F6 / 深蓝 #1D4ED8
   背景 #F8FAFC / 卡片 #FFFFFF / 文字 #1E293B、#64748B
   边框 #E2E8F0 / 圆角 12px、8px
   ============================================================ */
:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-gray: #64748B;
  --border: #E2E8F0;
  --bubble-visitor: #2563EB;
  --bubble-agent: #F1F5F9;
  --radius-lg: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; outline: none; }

/* ==================== 顶部居中横幅（新消息提醒） ==================== */
.banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-24px);
  max-width: min(80vw, 420px);
  padding: 10px 22px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 13px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 显示期间允许交互（可选择复制文本）：默认 pointer-events:none 是为了不挡页面操作 */
.banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

/* ==================== 自定义右键菜单 ==================== */
.ctx-menu {
  position: fixed;
  min-width: 120px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 4px;
  z-index: 10001;
  display: none;
  animation: popIn 0.12s ease;
}
.ctx-menu.show { display: block; }
.ctx-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  border-radius: 6px;
  text-align: left;
}
.ctx-menu .ctx-item:hover { background: #EFF6FF; color: var(--primary); }
@keyframes popIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==================== 复制成功提示 ==================== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 10002;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ==================== 通用消息气泡（访客端 / 客服端共用） ==================== */
/* 聊天消息区：flex 纵向布局 + margin-top:auto 实现底部锚定——
   消息少时贴底部显示，消息多时滚动到底部固定显示 */
.chat-body {
  flex: 1;
  overflow-y: auto;
  background: var(--card);
  display: flex;
  flex-direction: column;
}
.chat-inner {
  margin-top: auto;
  width: 100%;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.msg-row { display: flex; margin-bottom: 12px; }
.msg-row.from-visitor { justify-content: flex-end; }
.msg-row.from-agent { justify-content: flex-start; }

.msg-col { max-width: 78%; display: flex; flex-direction: column; }
.from-visitor .msg-col { align-items: flex-end; }
.from-agent .msg-col { align-items: flex-start; }

.msg-bubble {
  padding: 9px 13px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  border-radius: 12px;
}
.from-visitor .msg-bubble {
  background: var(--bubble-visitor);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.from-agent .msg-bubble {
  background: var(--bubble-agent);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-image { display: block; max-width: 220px; max-height: 260px; border-radius: 10px; cursor: pointer; }
.msg-image:hover { opacity: 0.92; }

/* 图片加载占位（大图解码期间显示，避免"发送了但没显示"的错觉） */
.msg-image-wrap { position: relative; }
.img-loading {
  width: 200px;
  height: 150px;
  background: var(--bubble-agent);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-gray);
  font-size: 12px;
}
.spinner.small { width: 20px; height: 20px; border-width: 2px; }

/* 图片上传进度条 */
.msg-image-upload {
  width: 200px;
  padding: 16px;
  background: var(--bubble-agent);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.msg-image-upload.error .upload-fill { background: #DC2626; }
.msg-image-upload.error { border: 1px solid #FECACA; }
.upload-bar {
  width: 100%;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
}
.upload-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.2s;
}
.upload-text { font-size: 12px; color: var(--text-gray); }

.msg-meta { font-size: 11px; color: #94A3B8; margin-top: 4px; padding: 0 2px; }
.from-visitor .msg-meta { text-align: right; }

/* 时间分隔线 */
.time-divider {
  text-align: center;
  margin: 14px 0;
  font-size: 11px;
  color: #94A3B8;
}

/* ==================== 聊天输入区 ==================== */
.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.chat-input .input-box {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
}
.chat-input .input-box:focus { border-color: var(--primary); }
.chat-input .input-box::placeholder { color: #94A3B8; }

.icon-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-gray);
  transition: all 0.2s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: #EFF6FF; }

.send-btn {
  height: 38px;
  padding: 0 18px;
  flex-shrink: 0;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: background 0.2s, transform 0.1s;
}
.send-btn:hover { background: var(--primary-dark); }
.send-btn:active { transform: scale(0.97); }
.send-btn:disabled { background: #93C5FD; cursor: not-allowed; }

/* ==================== 访客端：悬浮按钮 ==================== */
.fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.fab:hover { transform: scale(1.1); box-shadow: 0 12px 32px rgba(37, 99, 235, 0.5); }
.fab svg { width: 28px; height: 28px; }

/* 未读角标 */
.fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #EF4444;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.fab-badge.show { display: flex; }

/* ==================== 访客端：聊天窗口 ==================== */
.chat-window {
  position: fixed;
  right: 28px;
  bottom: 104px;
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 130px);
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9991;
  transform-origin: bottom right;
  animation: windowIn 0.25s ease;
}
.chat-window.hidden { display: none; }
@keyframes windowIn { from { opacity: 0; transform: scale(0.92) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* 头部 */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
}
.chat-header .head-title { font-size: 15px; font-weight: 600; flex: 1; }
.chat-header .head-sub { font-size: 11px; opacity: 0.85; display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; display: inline-block; }
.close-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.close-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* 头部"在浏览器打开"按钮（与关闭按钮同风格） */
.head-open-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.head-open-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* 加载状态 */
.loading-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-gray);
  font-size: 13px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 客服端：登录页 ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #EFF6FF 0%, var(--bg) 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}
.brand {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.login-card h1 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.login-card .login-sub { text-align: center; color: var(--text-gray); font-size: 13px; margin-bottom: 24px; }

.field {
  position: relative;
  margin-bottom: 14px;
}
.field svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: #94A3B8;
}
.field input {
  width: 100%;
  padding: 11px 12px 11px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

.login-btn {
  width: 100%;
  padding: 11px;
  margin-top: 6px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.login-btn:hover { background: var(--primary-dark); }
.login-error { color: #DC2626; font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }

/* ==================== 客服端：主界面布局 ==================== */
.admin-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 300px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-head .side-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sidebar-head .side-title svg { width: 18px; height: 18px; color: var(--primary); }
.agent-count {
  font-size: 12px;
  color: #22C55E;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  padding: 3px 10px;
  border-radius: 999px;
}
.logout-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-gray);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.logout-btn:hover { color: #DC2626; border-color: #FCA5A5; background: #FEF2F2; }

.search-box { padding: 12px 14px; }
.search-box input {
  width: 100%;
  padding: 9px 12px;
  background: #F1F5F9;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.2s;
}
.search-box input:focus { background: #fff; border-color: var(--primary); }
.search-box input::placeholder { color: #94A3B8; }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.conv-empty { text-align: center; color: #94A3B8; font-size: 13px; padding: 40px 0; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.conv-item:hover { background: #F1F5F9; }
.conv-item.active { background: var(--primary); }
.conv-item.active .conv-name, .conv-item.active .conv-preview, .conv-item.active .conv-time { color: #fff; }

.conv-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conv-main { flex: 1; min-width: 0; }
.conv-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.conv-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: #94A3B8; flex-shrink: 0; }
.conv-item.active .conv-time { color: rgba(255, 255, 255, 0.75); }
.conv-row2 { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 3px; }
.conv-preview {
  font-size: 12px;
  color: var(--text-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item.active .conv-preview { color: rgba(255, 255, 255, 0.85); }
.unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #EF4444;
  color: #fff;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.unread-badge.show { display: flex; }
.conv-item.active .unread-badge { display: none; }

/* 会话条目 hover 删除按钮 */
.conv-del {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #94A3B8;
  font-size: 13px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.conv-del:hover { background: #FEE2E2; color: #DC2626; }
.conv-item:hover .conv-del { display: flex; }
.conv-item.active .conv-del { color: rgba(255, 255, 255, 0.8); }
.conv-item.active .conv-del:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* ==================== 确认弹窗 ==================== */
.confirm-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10006;
  animation: fadeIn 0.15s ease;
}
.confirm-mask.show { display: flex; }
.confirm-box {
  width: min(88vw, 340px);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  text-align: center;
  animation: popIn 0.15s ease;
}
.confirm-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.confirm-text { font-size: 13px; color: var(--text-gray); line-height: 1.7; margin-bottom: 18px; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns button {
  flex: 1;
  padding: 9px 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: none;
  transition: all 0.15s;
}
.btn-ghost { background: #F1F5F9; color: var(--text); }
.btn-ghost:hover { background: #E2E8F0; }
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; }

/* 右侧聊天面板 */
.chat-panel { flex: 1; display: flex; flex-direction: column; background: var(--card); min-width: 0; }
.chat-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.back-btn {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  color: var(--text-gray);
  /* 箭头已换成 SVG（与右侧删除按钮同规格），flex 居中保证光学居中 */
  align-items: center;
  justify-content: center;
}
.panel-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-name { font-size: 15px; font-weight: 600; }
.panel-status { font-size: 12px; color: var(--text-gray); display: flex; align-items: center; gap: 5px; }
.panel-status .dot { width: 7px; height: 7px; }
.panel-status .dot.offline { background: #CBD5E1; }

/* 聊天区头部删除按钮 */
.head-del-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  color: var(--text-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.head-del-btn:hover { color: #DC2626; border-color: #FCA5A5; background: #FEF2F2; }

.chat-panel-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #94A3B8;
  font-size: 14px;
}
.chat-panel-empty svg { width: 64px; height: 64px; color: #E2E8F0; }

/* ==================== 访客端落地页（模拟站点内容） ==================== */
.site-hero {
  padding: 72px 20px 56px;
  text-align: center;
  background: linear-gradient(160deg, #EFF6FF 0%, var(--bg) 100%);
}
.site-hero h1 { font-size: 34px; color: var(--text); margin-bottom: 12px; }
.site-hero h1 span { color: var(--primary); }
.site-hero p { color: var(--text-gray); max-width: 560px; margin: 0 auto 24px; font-size: 15px; line-height: 1.7; }
.site-cta {
  display: inline-block;
  padding: 11px 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
  transition: all 0.2s;
}
.site-cta:hover { background: var(--primary-dark); transform: translateY(-1px); }

.site-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin: -24px auto 60px;
  padding: 0 20px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}
.feature-card .fc-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #EFF6FF;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 20px;
}
.feature-card h3 { font-size: 15px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-gray); line-height: 1.6; }

/* ==================== 独立聊天页（/chat 全屏模式） ==================== */
.chat-window.fullscreen {
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
}
body.fullchat { overflow: hidden; }
body.fullchat .site-hero,
body.fullchat .site-features { display: none; }

/* ==================== 滚动条美化 ==================== */
.chat-body::-webkit-scrollbar, .conv-list::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb, .conv-list::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.chat-body::-webkit-scrollbar-track, .conv-list::-webkit-scrollbar-track { background: transparent; }

/* ==================== 响应式 ==================== */
/* 平板及以下（≤768px）：客服端切换为"列表 / 聊天区"单栏模式（.show-chat 由 JS 控制） */
@media (max-width: 768px) {
  .sidebar { width: 100%; }
  .chat-panel { display: none; }
  .admin-layout.show-chat .sidebar { display: none; }
  .admin-layout.show-chat .chat-panel { display: flex; width: 100%; }
  .back-btn { display: flex; margin-right: 10px; }

  /* 访客端：桌面窄窗口自适应宽度，避免溢出 */
  .chat-window {
    width: min(380px, calc(100vw - 32px));
  }

  /* 移动端输入框 16px：iOS Safari 对 <16px 的输入框聚焦会自动放大页面，必须设为 16px */
  .chat-input .input-box,
  .search-box input,
  .field input {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  /* 访客端聊天窗口占满屏幕 + iPhone 刘海安全区适配 */
  .chat-window {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    right: 0;
    bottom: 0;
    border-radius: 0;
  }
  /* 头部渐变延伸到刘海安全区 */
  .chat-header { padding-top: calc(14px + env(safe-area-inset-top)); }
  /* 输入区避开底部 home 指示条 */
  .chat-input { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }

  /* 触摸目标加大（44px 触控标准） */
  .icon-btn { width: 44px; height: 44px; }
  .send-btn { height: 44px; padding: 0 20px; }
  .close-btn, .head-open-btn { width: 34px; height: 34px; }
  .msg-image { max-width: 200px; }
  .msg-col { max-width: 85%; }
}

/* 聊天窗口打开时锁定页面滚动（移动端体验） */
body.chat-open-lock { overflow: hidden; }
