@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ===== Reset & Base ===== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

/* ============================================================
   YW Theme Adaptation —— 贴合 ymmovo.cn（小羊臻选）主题
   色板来源：wp-content/themes/yy-mall/style.css
   sage #7a9e7e / coral #e8a87c / bg-base #faf7f2 / text-primary #3d3530
   ============================================================ */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f5f0ea;
  --border: #ece5dd;
  --border-light: #f0ebe3;
  --border-soft: #f0ebe3;
  --text: #3d3530;
  --text-2: #7a6e64;
  --text-3: #a89e94;
  --primary: #7a9e7e;
  --primary-light: #a3c0a7;
  --primary-dark: #5d8462;
  --accent: #e8a87c;
  --accent-light: #f0c4a4;
  --accent-dark: #d4895f;
  --green: #7a9e7e;
  --shadow-sm: 0 2px 8px rgba(122,110,100,.05);
  --shadow-md: 0 4px 16px rgba(122,110,100,.07);
  --shadow-lg: 0 12px 40px rgba(122,110,100,.10);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --radius-pill: 50px;
  --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-sans: 'Plus Jakarta Sans', 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --sidebar-w: 280px;
}

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

/* ===== Auth Pages ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9fc 0%, #eef1f8 50%, #f0eeff 100%);
}

/* Decorative Background */
.bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-decoration .circle {
  position: absolute;
  border-radius: 50%;
  opacity: .35;
}
.bg-decoration .c1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--primary-light), transparent 70%);
  top: -150px; right: -100px;
  animation: floatA 12s ease-in-out infinite;
}
.bg-decoration .c2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  bottom: -100px; left: -80px;
  animation: floatB 15s ease-in-out infinite;
}
.bg-decoration .c3 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, #74b9ff, transparent 70%);
  top: 40%; left: 5%;
  animation: floatA 10s ease-in-out infinite reverse;
}
.bg-decoration .c4 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--green), transparent 70%);
  bottom: 20%; right: 10%;
  animation: floatB 13s ease-in-out infinite;
}
.bg-decoration .dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--primary) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: .05;
}

@keyframes floatA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(30px, -30px) scale(1.05); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-25px, 25px) scale(1.08); }
}

/* Auth Card */
.auth-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 44px 40px 36px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(108,92,231,.08);
  animation: cardIn .5s ease;
}
@keyframes cardIn {
  from { opacity:0; transform:translateY(24px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(108,92,231,.25);
}
.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.auth-header p {
  color: var(--text-2);
  font-size: 14px;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  border: 1px solid;
}
.alert-error {
  background: #fff0f0;
  color: #e74c3c;
  border-color: #ffd5d5;
}

/* Form */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  opacity: .6;
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108,92,231,.1);
}
.input-wrap input::placeholder { color: var(--text-3); }

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(108,92,231,.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(108,92,231,.35);
}
.btn-primary:active { transform: translateY(0); }

.auth-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 14px;
  color: var(--text-2);
}
.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* ===== Chat Layout ===== */
.app-container {
  display: flex;
  height: 100vh;
  background: var(--bg);
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  transition: transform .3s ease;
}
.sidebar-brand {
  padding: 28px 24px 20px;
  text-align: center;
  position: relative;
}
.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.brand-icon {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.16);
  /* 白色细环模拟玻璃切边，替代原紫色渐变底（侧栏本身已是紫色渐变） */
  box-shadow: 0 6px 18px rgba(60,40,80,.22), inset 0 0 0 2px rgba(255,255,255,.78);
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-brand h2 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.online-section {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.online-section.collapsed .user-list {
  display: none;
}
.online-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px 12px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.online-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}
.online-header strong { color: var(--text); }

.user-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px;
}
.user-list::-webkit-scrollbar { width: 4px; }
.user-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.user-list::-webkit-scrollbar-track { background: transparent; }

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  transition: background .2s;
  cursor: pointer;
}
.user-item:hover { background: var(--surface-2); }
/* 在线弹框「发消息」按钮：小号主色描边，hover 填充 */
.user-item-chat-btn {
  flex-shrink: 0;
  border: 1px solid var(--primary-light);
  background: transparent;
  color: var(--primary-dark);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 12px;
  border-radius: 99px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.user-item-chat-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.user-item-chat-btn:active { transform: scale(.95); }
.user-avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.user-item-info { flex: 1; min-width: 0; }
.user-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.user-item-status {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}
.current-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.current-user-info {
  display: flex;
  flex-direction: column;
}
.current-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.current-user-status {
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}
.logout-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  text-decoration: none;
  transition: background .2s;
  opacity: .5;
}
.logout-btn:hover {
  background: var(--border);
  opacity: 1;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* 拖拽文件到会话区：高亮提示层 */
.main-content.drag-over::after {
  content: "松开即可发送文件";
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #7a9e7e;
  background: rgba(122, 158, 126, .14);
  border: 3px dashed #7a9e7e;
  border-radius: 14px;
  pointer-events: none;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.chat-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-2);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: var(--surface-2); color: var(--text); }
.chat-header-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.chat-header-meta {
  font-size: 12px;
  color: var(--text-3);
}
.chat-header-actions {
  margin-left: auto;
  position: relative;
}
.status-indicator {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

/* ---- Messages ---- */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(108,92,231,.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(253,121,168,.03) 0%, transparent 50%),
    var(--bg);
}
.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }

.loading-msg {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 40px 0;
}

/* Message */
.msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
  animation: msgIn .3s ease;
}
@keyframes msgIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}
.msg.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.msg-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.msg.own .msg-body { align-items: flex-end; }
.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  padding: 0 4px;
}
.msg.own .msg-head { flex-direction: row-reverse; }
.msg-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.msg-time {
  font-size: 11px;
  color: var(--text-3);
}
.msg-bubble {
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.msg:not(.own) .msg-bubble {
  border-bottom-left-radius: 4px;
}
.msg.own .msg-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(108,92,231,.2);
}

/* ---- 需求B：消息引用摘要（气泡内的引用块） ---- */
.msg-quote {
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 3px solid var(--primary, #6c5ce7);
  background: rgba(108, 92, 231, .08);
  font-size: 12px;
  line-height: 1.45;
  max-width: 320px;
  overflow: hidden;
  cursor: pointer;            /* 单击引用可定位到原消息 */
  user-select: none;
  transition: background .15s, border-color .15s;
}
.msg-quote:hover { background: rgba(108, 92, 231, .16); }
.msg.own .msg-quote:hover { background: rgba(255, 255, 255, .28); }

/* 引用定位高亮脉冲：珊瑚橙描边光环（复用主题 --coral token），不侵入气泡背景 */
.msg-flash {
  animation: msgFlash 1.8s ease-out;
  border-radius: var(--radius-md, 12px);
}
@keyframes msgFlash {
  0%   { box-shadow: 0 0 0 0 rgba(232, 168, 124, .9); }
  70%  { box-shadow: 0 0 0 4px rgba(232, 168, 124, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 168, 124, 0); }
}
.msg-quote .mq-name { font-weight: 600; color: var(--primary, #6c5ce7); margin-right: 4px; }
.msg-quote .mq-text {
  color: var(--text-2, #6b625c);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.msg-quote .mq-recalled { color: var(--text-3, #9a918a); font-style: italic; }
.msg.own .msg-quote {
  border-left-color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .18);
}
.msg.own .msg-quote .mq-name { color: #fff; }
.msg.own .msg-quote .mq-text { color: rgba(255, 255, 255, .88); }
.msg.own .msg-quote .mq-recalled { color: rgba(255, 255, 255, .7); }

/* ---- 需求B：已撤回消息 ---- */
.msg-text.is-recalled {
  color: var(--text-3, #9a918a);
  font-style: italic;
  font-size: 13px;
}
.msg.own .msg-text.is-recalled { color: rgba(255, 255, 255, .78); }
/* 商品卡片被撤回：整块替换为「已撤回」文案，样式与文本撤回一致 */
.msg-product.is-recalled {
  font-style: italic; font-size: 13px; color: var(--text-3, #9a918a);
  padding: 4px 0; display: block;
}
.msg.own .msg-product.is-recalled { color: rgba(255, 255, 255, .78); }

/* ---- 坐席视角：已撤回但可见原文（软撤回） ---- */
.recalled-staff { opacity: .92; }
.recalled-banner {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-style: italic;
  color: #b0685a; background: rgba(217, 122, 108, .10);
  border: 1px dashed rgba(217, 122, 108, .35);
  border-radius: 8px;
  padding: 4px 10px; margin-bottom: 6px;
}
.recalled-banner .rb-icon { font-style: normal; }
.msg.own .recalled-banner {
  color: #ffd9d2; background: rgba(0, 0, 0, .18);
  border-color: rgba(255, 217, 210, .4);
}
/* 原内容整体降透明度 + 斜体化，与正常消息视觉区分 */
.recalled-staff .msg-text { font-style: italic; opacity: .78; }
.recalled-staff .msg-image { opacity: .78; }
.recalled-staff .msg-product { opacity: .78; }

/* ---- 需求B：输入区引用条 ---- */
.quote-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; padding: 8px 12px;
  border-radius: var(--radius-md, 12px);
  background: var(--surface-2, #f5f0ea);
  border-left: 3px solid var(--primary, #6c5ce7);
}
.quote-bar-inner { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.quote-bar-label { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--primary, #6c5ce7); }
.quote-bar-text {
  font-size: 12px; color: var(--text-2, #6b625c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quote-bar-close {
  flex-shrink: 0; width: 24px; height: 24px;
  border: none; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--text-3, #9a918a);
  font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.quote-bar-close:hover { background: var(--border, #ece5dd); color: var(--text, #3d3530); }

/* System message */
.system-msg {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 8px 0;
  font-weight: 500;
  position: relative;
}
.system-msg::before,
.system-msg::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 24px;
  height: 1px;
  background: var(--border);
}
.system-msg::before { left: calc(50% + 60px); }
.system-msg::after { right: calc(50% + 60px); }

/* ---- Input Area ---- */
.input-area {
  padding: 16px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: relative;
}
.input-area::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 18px;
  border: 2px solid var(--border);
  transition: border-color .25s, box-shadow .25s;
}
.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108,92,231,.08);
}
.input-wrapper textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  outline: none;
  line-height: 1.5;
  padding: 8px 0;
  min-height: 24px;
  max-height: 96px;
}
.input-wrapper textarea::placeholder { color: var(--text-3); }
.input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.char-count {
  font-size: 11px;
  color: var(--text-3);
  min-width: 20px;
  text-align: center;
  font-weight: 500;
}
.send-btn {
  width: 40px; height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  flex-shrink: 0;
}
.send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,92,231,.3);
}
.send-btn:active { transform: translateY(0); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Tool Buttons ---- */
.tool-btn {
  width: 36px; height: 36px;
  border: none; border-radius: var(--radius-sm);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
  line-height: 1;
}
.tool-btn:hover {
  background: var(--border);
}

/* ---- Emoji Picker ---- */
.emoji-picker {
  position: absolute;
  bottom: 80px;
  left: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: none;
  z-index: 30;
  max-width: 320px;
}
.emoji-picker.open { display: block; animation: pickerIn .2s ease; }
@keyframes pickerIn {
  from { opacity:0; transform:translateY(8px) scale(.96); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.emoji-grid::-webkit-scrollbar { width: 4px; }
.emoji-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.emoji-item {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.emoji-item:hover { background: var(--surface-2); }

/* ---- Image Preview ---- */
.image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.image-preview img {
  max-height: 80px;
  max-width: 140px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}
.preview-close {
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.preview-close:hover { background: var(--border); }

/* ---- Image in message ---- */
.msg-bubble { padding: 10px 16px; }
.msg.own .msg-bubble { padding: 10px 16px; }
.msg-text { line-height: 1.55; }
.msg-image { margin-top: 6px; }
.msg-image img {
  max-width: 220px;
  max-height: 220px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: block;
  transition: opacity .2s;
  box-shadow: var(--shadow-sm);
}
.msg-image img:hover { opacity: .85; }

/* 视频消息：气泡内内联播放器（点击放大复用相册弹窗） */
.msg-video-wrap { margin-top: 6px; max-width: 240px; }
.msg-video {
  width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
  display: block;
  background: #000;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.msg.own .msg-video-wrap { margin-left: auto; }

/* 非图片文件卡片 */
.msg-file {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e7e0d6;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s;
}
.msg-file:hover { background: #faf6f1; border-color: var(--primary, #7a9e7e); }
.mf-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #9b8fb0, #7a9e7e);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .3px;
}
.mf-info { flex: 1 1 auto; min-width: 0; }
.mf-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mf-size { font-size: 12px; color: #8a8175; margin-top: 2px; }
.mf-dl {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--primary, #7a9e7e);
  font-weight: 600;
}
.msg.own .msg-image img {
  box-shadow: 0 2px 10px rgba(108,92,231,.25);
}

/* ---- Sidebar Search ---- */
.sidebar-search {
  padding: 8px 16px 12px;
}
.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0 4px 0 12px;
  border: 2px solid transparent;
  transition: border-color .25s, box-shadow .25s;
}
.search-wrap:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(108,92,231,.15);
}
.search-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
}
.search-wrap input::placeholder { color: var(--text-3); }
.search-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, transform .1s;
  line-height: 1.4;
}
.search-btn:hover { background: #5d8462; }
.search-btn:active { transform: scale(.96); }

/* ---- Conversation List ---- */
.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.conv-section { margin-bottom: 4px; }
.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--surface-2); }
.conv-item.active .conv-name { color: var(--primary); font-weight: 700; }

.conv-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.conv-info { flex: 1; min-width: 0; }
.conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-preview {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity .3s, visibility .3s;
}
.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 92vw;
  animation: modalIn .3s ease;
}
.modal-box.sm { width: 400px; }
.modal-box.md { width: 520px; }
@keyframes modalIn {
  from { opacity:0; transform:translateY(16px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  width: 30px; height: 30px;
  border: none; border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 18px 20px 20px; }
.modal-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 20px 0;
}

/* ---- Color Picker ---- */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.color-swatch {
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color .2s, transform .2s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--text); transform: scale(1.15); }

/* ---- Group Settings ---- */
#gsBody .form-group { margin-bottom: 12px; }
#gsBody .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
#gsBody .form-group input[type="text"],
#gsBody .form-group input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
}
#gsBody .form-group input:focus { border-color: var(--primary); }
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500 !important;
}
.checkbox-label input { width: auto !important; }

/* ---- Request Items ---- */
.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  margin-bottom: 6px;
}
.request-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}
.req-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.request-user small { color: var(--text-3); font-size: 12px; }
.request-actions { display: flex; gap: 4px; }
.req-btn {
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.req-btn.approve { background: #d4edda; color: #155724; }
.req-btn.approve:hover { background: #b8dfc6; }
.req-btn.reject { background: #f8d7da; color: #721c24; }
.req-btn.reject:hover { background: #f1c0c0; }

/* ---- Form inside modals ---- */
#profileForm .form-group,
#groupForm .form-group {
  margin-bottom: 14px;
}
#profileForm .form-group label,
#groupForm .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
#profileForm input[type="text"],
#profileForm textarea,
#groupForm input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .25s;
}
#profileForm input:focus,
#profileForm textarea:focus,
#groupForm input:focus {
  border-color: var(--primary);
}
#profileForm textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}
#profileForm input[disabled] { opacity: .7; }
.hint {
  font-size: 12px;
  color: var(--text-3);
  margin: -6px 0 14px;
}

/* ---- Responsive ---- */
/* ===== Friend Request Bar ===== */
.friend-request-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin: 0 8px 8px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  color: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity .2s;
}
.friend-request-bar:hover {
  opacity: .9;
}
.req-badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ===== Search Result Cards ===== */
.search-section { margin-bottom: 4px; }
.search-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 4px 6px;
}
.search-user-card,
.search-group-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  transition: background .2s;
  cursor: default;
}
.search-user-card:hover,
.search-group-card:hover {
  background: var(--border);
}
.search-group-card { cursor: pointer; }
.search-card-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.search-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.search-card-info {
  flex: 1;
  min-width: 0;
}
.search-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.search-card-code {
  font-size: 12px;
  color: var(--text-3);
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.search-card-bio {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.search-add-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108,92,231,.3);
}
.search-card-self {
  font-size: 12px;
  color: var(--text-3);
  background: var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.search-empty {
  text-align: center;
  padding: 24px 0;
}
.search-empty-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
  opacity: .5;
}
.search-empty p {
  font-size: 14px;
  color: var(--text-3);
}

/* ===== Friend Picker (create group) ===== */
.friend-picker {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
}
.friend-picker::-webkit-scrollbar { width: 4px; }
.friend-picker::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.friend-pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  font-size: 14px;
}
.friend-pick-item:hover {
  background: var(--surface-2);
}
.friend-pick-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
}
.pick-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

/* ===== Profile Card Improvements ===== */
.profile-card {
  text-align: center;
}
.profile-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  border: 3px solid var(--surface);
  outline: 2px solid var(--border);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.profile-code {
  font-size: 14px;
  color: var(--text-3);
  margin: 2px 0 8px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--surface-2);
  display: inline-block;
  padding: 2px 12px;
  border-radius: 12px;
}
.profile-bio {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 280px;
  margin: 4px auto 12px;
  padding: 8px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.profile-bio-empty {
  color: var(--text-3);
  font-style: italic;
  background: transparent;
}
.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.profile-add-btn {
  width: 100%;
  margin-top: 12px;
}

/* ===== Header Online Popover ===== */
.header-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .2s;
  position: relative;
}
.header-online:hover {
  background: var(--border);
}
.online-dot-sm {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
.header-online-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
  animation: popoverIn .2s ease;
}
@keyframes popoverIn {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}
.header-online-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s;
  border-bottom: 1px solid var(--border-light);
}
.header-online-item:last-child { border-bottom: none; }
.header-online-item:hover { background: var(--surface-2); }
.hop-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.hop-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hop-name {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ===== Group create button ===== */
.conv-add-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.conv-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108,92,231,.3);
}
.group-gear {
  margin-left: auto;
  font-size: 14px;
  opacity: 0;
  transition: opacity .2s;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.conv-item:hover .group-gear {
  opacity: .6;
}
.group-gear:hover {
  opacity: 1 !important;
  background: var(--border);
}
.conv-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding: 8px 12px 4px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.conv-section-title span {
  text-transform: uppercase;
  letter-spacing: .3px;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .msg { max-width: 92%; }
  .msg-image img { max-width: 160px; max-height: 160px; }
  .emoji-picker { left: 12px; max-width: 280px; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .auth-card { padding: 32px 24px 28px; }
}

/* ============================================================
   YW Skin —— 与 ymmovo.cn（小羊臻选）主题保持一致的细节打磨
   仅做视觉层覆盖，不改变任何原有布局与交互
   ============================================================ */

/* 顶部品牌条：青绿 → 珊瑚 渐变，呼应主题 hero */
.sidebar-brand {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--accent) 100%);
  color: var(--text-on-dark, #faf7f2);
}
.sidebar-brand::after { opacity: .18; }
/* ⚠ 可读性修复：基础规则里 h2 用了 background-clip:text + -webkit-text-fill-color:transparent，
   渐变文字叠在同色渐变底上几乎看不见；此处强制回退为实心近白。 */
.sidebar-brand h2 {
  color: #fffdf9;
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  letter-spacing: .02em;
}
.sidebar-brand .brand-subtitle { color: rgba(255,255,255,.82); }

/* 侧栏与主区：暖白底 + 柔和描边 */
.sidebar { border-right: 1px solid var(--border); background: var(--surface); }
.main-content { background: var(--bg); }

/* 会话项：圆角卡片感 + 选中态用青绿浅底 */
.conv-item { border-radius: var(--radius-md); }
.conv-item:hover { background: rgba(243, 247, 243, 0.9); }
.conv-item.active { background: rgba(122, 158, 126, 0.14); }
.conv-item.active .conv-name { color: var(--primary-dark); }

/* 聊天头部：毛玻璃 + 细描边 */
.chat-header {
  background: rgba(250, 247, 242, 0.86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

/* 消息气泡：更柔和的圆角与阴影 */
.message-bubble, .msg-bubble {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* 输入区与发送按钮 */
.msg-input, #msgInput {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}
.msg-input:focus, #msgInput:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(122, 158, 126, 0.16);
  outline: none;
}
.send-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(122, 158, 126, 0.28);
}
.send-btn:hover { filter: brightness(1.05); box-shadow: 0 6px 18px rgba(122, 158, 126, 0.34); }
.send-btn:disabled { filter: grayscale(.5); opacity: .55; box-shadow: none; }

/* 主按钮 */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-pill, 50px);
  box-shadow: 0 4px 14px rgba(122, 158, 126, 0.24);
}
.btn-primary:hover { filter: brightness(1.05); }

/* 弹窗：暖白卡片 + 大圆角 */
.modal-overlay { background: rgba(61, 53, 48, 0.34); backdrop-filter: blur(3px); }
.modal-box {
  background: #fffdf9;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border-soft, var(--border-light)); }
.modal-close { border-radius: var(--radius-full); }
.modal-close:hover { background: var(--surface-2); color: var(--primary-dark); }

/* 滚动条：主题色细条 */
.messages-container::-webkit-scrollbar-thumb { background: rgba(122, 158, 126, 0.28); border-radius: var(--radius-full); }
.messages-container::-webkit-scrollbar-thumb:hover { background: rgba(122, 158, 126, 0.42); }
.messages-container::-webkit-scrollbar-track { background: transparent; }

/* 在线点 / 未读角标 */
.online-dot, .online-dot-sm { background: var(--primary); }
.badge, .friend-req-badge { background: var(--accent); }

/* 退出按钮 */
.logout-btn { border-radius: var(--radius-full); }
.logout-btn:hover { background: rgba(232, 168, 124, 0.16); color: var(--coral-dark, var(--primary-dark)); }

/* 登录跳转遮罩（YW 未登录时由 WP 接管，此处仅兜底） */
.yw-auth-notice {
  max-width: 420px;
  margin: 18vh auto;
  padding: var(--space-lg, 40px) var(--space-md, 24px);
  background: #fffdf9;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  text-align: center;
  font-family: var(--font);
  color: var(--text);
}
.yw-auth-notice h2 { font-size: 20px; margin-bottom: 10px; }
.yw-auth-notice p  { font-size: 14px; color: var(--text-2); margin-bottom: 18px; }
.yw-auth-notice a {
  display: inline-block;
  padding: 11px 26px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-pill, 50px);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

/* ============================================================
   需求「相册集」+ 资料卡扩展（UA / IP / 商品）
   ============================================================ */

/* chat-header 相册按钮 */
.header-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-full, 999px);
  background: var(--surface); color: var(--text);
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.header-btn:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); }
.header-btn-icon { font-size: 15px; line-height: 1; }

/* 相册悬浮窗 */
.album-box { width: min(900px, 94vw); height: min(86vh, 760px); display: flex; flex-direction: column; }
.album-body { display: flex; gap: 16px; padding: 16px; flex: 1; min-height: 0; }
.album-side {
  width: 220px; flex-shrink: 0;
  border-right: 1px solid var(--border); padding-right: 12px;
  overflow-y: auto;
}
.album-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.album-item {
  padding: 10px 12px; border-radius: var(--radius-md, 12px);
  cursor: pointer; font-size: 14px; color: var(--text); transition: background .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.album-item:hover { background: var(--surface-2); }
.album-item.active { background: var(--primary); color: #fff; }
.album-empty { color: var(--text-3, #9a918a); font-size: 13px; padding: 12px; text-align: center; }

.album-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.album-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.album-cur-name { font-size: 15px; font-weight: 600; color: var(--text); }
.album-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.album-btn {
  height: 32px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-md, 12px);
  background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; transition: all .15s;
}
.album-btn:hover:not(:disabled) { background: var(--surface-2); }
.album-btn:disabled { opacity: .45; cursor: not-allowed; }
.album-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.album-btn.primary:hover:not(:disabled) { background: var(--primary-dark); }
.album-btn.danger { color: #e35d5d; border-color: rgba(227,93,93,.4); }
.album-btn.danger:hover:not(:disabled) { background: rgba(227,93,93,.1); }
.album-new-btn { height: 32px; padding: 0 14px; border: 1px dashed var(--primary); border-radius: var(--radius-md, 12px); background: transparent; color: var(--primary); font-size: 13px; cursor: pointer; }
.album-new-btn:hover { background: rgba(122,158,126,.10); }

.album-grid {
  flex: 1; overflow-y: auto; min-height: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
  padding: 4px; align-content: start;
}
/* ★ 尺寸完全不用 aspect-ratio：改用 padding-top 百分比撑高（基于列宽，全浏览器通用）。
   height:0 + padding-top:133.33% ⇒ 格子高 = 列宽 × 1.333（3:4 竖版）。
   图片绝对定位铺满 ⇒ 脱离文档流，行高只由 padding 决定，既不会变扁条也不会重叠。 */
.album-cell {
  position: relative; height: 0; padding-top: 133.33%;
  border-radius: var(--radius-md, 12px); overflow: hidden;
  background: var(--surface-2); cursor: pointer; border: 1px solid var(--border);
}
.album-thumb {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.album-cell-send {
  position: absolute; right: 6px; bottom: 6px;
  padding: 4px 10px; border: none; border-radius: 999px;
  background: rgba(122,158,126,.94); color: #fff; font-size: 12px; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.album-cell:hover .album-cell-send { opacity: 1; }
/* 视频素材：居中播放箭头标记（不挡点击，pointer-events:none） */
.album-play-badge {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0, 0, 0, .42); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; padding-left: 3px; /* 光学居中 ▶ */
  pointer-events: none; z-index: 2;
}
.album-cell.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.album-cell-check {
  position: absolute; left: 6px; top: 6px; width: 18px; height: 18px; z-index: 3;
  accent-color: var(--primary); cursor: pointer; margin: 0;
}
.album-select-bar { display: flex; align-items: center; gap: 10px; padding: 6px 4px; flex-wrap: wrap; }
.album-sel-count { font-size: 13px; color: var(--text-2); }

/* 上传进度浮层 */
.album-upload-bar {
  border-top: 1px solid var(--border); padding: 12px 16px; background: var(--surface-2);
  font-size: 13px; color: var(--text-2);
}
.aub-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.aub-line.sub { margin-bottom: 0; color: var(--text-3); font-size: 12px; }
.aub-file { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aub-count { color: var(--text-3); }
.aub-cancel { border: none; background: transparent; color: var(--text-3); cursor: pointer; font-size: 12px; }
.aub-cancel:hover { color: #e35d5d; }
.aub-track { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.aub-fill { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* 相册大图预览 */
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center;
}
/* 修复：默认隐藏相册大图遮罩（否则全屏黑遮罩常驻，吞掉所有点击） */
.lightbox.hidden { display: none !important; }

/* 相册弹窗头部布局修复 */
.album-head-actions { display: flex; align-items: center; gap: 10px; }
.album-box .modal-close { width: 32px; height: 32px; border-radius: var(--radius-md, 12px); }
.lightbox-close {
  position: absolute; top: 20px; right: 24px; width: 40px; height: 40px;
  border: none; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; font-size: 18px; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.lightbox-body img, .lightbox-body video { border-radius: 8px; }

/* 资料卡扩展：UA / IP */
.profile-extra { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 14px; }
.pe-row { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 13px; }
.pe-row.sub { padding-top: 0; }
.pe-label { flex-shrink: 0; color: var(--text-2); font-weight: 600; min-width: 52px; }
.pe-val { color: var(--text); word-break: break-all; }
.pe-val.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); }

/* 资料卡：商品画像 */
.profile-products { margin-top: 14px; }
.pp-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.pp-sub { font-size: 12px; color: var(--text-3); margin: 10px 0 6px; }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.pp-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius-md, 12px);
  overflow: hidden; text-decoration: none; background: var(--surface); transition: transform .15s, box-shadow .15s;
}
.pp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pp-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: var(--surface-2); }
.pp-name { padding: 6px 8px 2px; font-size: 12px; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pp-price { padding: 0 8px 8px; font-size: 13px; font-weight: 600; color: var(--primary); }

/* ===== 右侧用户信息栏 infoPanel（参照旧版 yy-customer-chat .yy-a-info 三段式） ===== */
.info-panel {
  flex: 0 0 320px; min-width: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
.info-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; color: var(--text);
}
.info-panel-close {
  border: none; background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--text-3, #9a918a);
  padding: 2px 6px; border-radius: 8px;
}
.info-panel-close:hover { background: var(--surface-2); color: var(--text); }
.info-panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.info-block { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.info-block h4 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-2, #7a6e64);
  display: flex; align-items: center; justify-content: space-between;
}
.info-empty { color: var(--text-3, #9a918a); font-size: 13px; }
.info-album-manage {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 12px; padding: 2px 10px; border-radius: 999px; cursor: pointer;
}
.info-album-manage:hover { border-color: var(--primary); color: var(--primary-dark); }

/* 资料键值对 */
.info-avatar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.info-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; background: var(--surface-2); }
.info-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.info-name { font-weight: 600; font-size: 14px; color: var(--text); }
.info-code { font-size: 12px; color: var(--text-3, #9a918a); }
.info-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.info-kv .k { color: var(--text-3, #9a918a); flex: 0 0 auto; }
.info-kv .v { color: var(--text); text-align: right; word-break: break-word; }
.info-kv .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* 右侧栏内联相册网格（点击发送） */
.info-album-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px; margin-top: 4px;
}
.info-album-cell {
  position: relative; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
}
.info-album-cell img, .info-album-cell video {
  width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block;
}
.info-album-send {
  position: absolute; right: 4px; bottom: 4px;
  padding: 3px 8px; border: none; border-radius: 999px;
  background: rgba(122,158,126,.94); color: #fff; font-size: 11px; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.info-album-cell:hover .info-album-send { opacity: 1; }

/* 客户信息开关按钮：桌面端常驻面板 → 按钮隐藏 */
.info-toggle-btn { display: none; }

/* 客户信息抽屉遮罩（仅窄屏使用） */
.info-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(61, 53, 48, .30);
  z-index: 65;
}

/* 窄屏（≤1100px）：客户信息栏不再是常驻栏，改为「右侧抽屉」
   —— 原先直接 display:none，导致手机端坐席完全看不到顾客资料/订单/相册 */
@media (max-width: 1100px) {
  .info-toggle-btn { display: inline-flex; }

  .info-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(340px, 88vw);
    z-index: 70;
    display: flex;
    transform: translateX(102%);
    transition: transform .26s cubic-bezier(.22, .61, .36, 1);
    box-shadow: -10px 0 32px rgba(61, 53, 48, .18);
    border-left: 1px solid var(--border);
    background: var(--surface);
  }
  .info-panel.open { transform: translateX(0); }
  .info-mask.show { display: block; }
}

/* ===== 首页（返回商城）按钮：桌面隐藏，移动端置于聊天 header 右侧 ===== */
.header-home-btn {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm, 10px);
  font-size: 16px; line-height: 1; text-decoration: none;
  color: var(--text-2); background: var(--surface);
  transition: background .15s, color .15s, border-color .15s;
}
.header-home-btn:hover { background: var(--surface-2); color: var(--primary); border-color: var(--primary); }

/* ===== 移动端聊天界面优化 ===== */
@media (max-width: 768px) {
  /* 首页按钮上车 header（移动端抽屉关闭后也能随时返回商城） */
  .header-home-btn { display: flex; }
  /* 侧栏抽屉里的返回商城重复，移动端隐藏避免双入口 */
  .sidebar-footer a.logout-btn[href="/"] { display: none; }

  /* header 紧凑化，避免按钮拥挤（含新增的 👤 客户信息按钮） */
  .chat-header { padding: 8px 10px; gap: 6px; }
  .chat-header-actions { gap: 4px; }
  .header-btn { padding: 5px 7px; }
  .header-btn-label { display: none; }     /* 相册按钮仅留图标 */
  .online-label { display: none; }         /* 在线状态仅留 dot + 数字 */
  .status-indicator { margin-left: 0 !important; }

  /* 标题与副标题收敛 */
  .chat-header-info h3 { font-size: 15px; }
  .chat-header-meta { font-size: 11px; }

  /* 消息区留白收敛，小屏更透气 */
  .messages-container { padding: 14px 12px; }

  /* 输入区贴合小屏；输入框 16px 防止 iOS 聚焦缩放 */
  .input-area { padding: 10px 12px; }
  .input-wrapper { gap: 6px; }
  #msgInput { font-size: 16px; }

  /* 消息气泡：小屏更省横向空间 */
  .msg { max-width: 94%; }
  .msg-bubble { padding: 9px 13px; }
}


/* ============================================================
   控制台总控（Webhook 推送 + 聊天背景）
   ============================================================ */
.ctrl-box { width: min(760px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
.ctrl-body { padding: 16px 18px 18px; overflow-y: auto; min-height: 0; }
.ctrl-section { margin-bottom: 18px; }
.ctrl-section h4 {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--border);
}
.ctrl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.ctrl-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.ctrl-block { margin-top: 10px; }
.ctrl-input, .ctrl-textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-md, 12px);
  background: var(--surface); color: var(--text); font-size: 13px;
  padding: 8px 10px; font-family: inherit;
}
.ctrl-textarea {
  resize: vertical; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
}
.ctrl-input:focus, .ctrl-textarea:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(122, 158, 126, .16);
}
.ctrl-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.ctrl-hint { font-size: 12px; color: var(--text-3); }

.ctrl-bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.ctrl-bg-cell {
  position: relative; aspect-ratio: 1 / 1; min-width: 0; min-height: 0;
  border-radius: var(--radius-md, 12px); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.ctrl-bg-cell.is-current { outline: 2px solid var(--primary); outline-offset: 1px; }
.ctrl-bg-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ctrl-bg-del {
  position: absolute; right: 4px; bottom: 4px;
  border: none; border-radius: 999px; padding: 3px 8px;
  font-size: 11px; color: #fff; background: rgba(227, 93, 93, .94); cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.ctrl-bg-cell:hover .ctrl-bg-del { opacity: 1; }

/* 聊天背景：有图时铺满消息区（可读性靠内联的浅色蒙版渐变保证） */
.messages-container.has-chat-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 相册弹窗：窄屏适配（避免左侧栏把网格挤爆导致格子重叠） */
@media (max-width: 640px) {
  .album-box { width: 96vw; height: 90vh; }
  .album-body { gap: 10px; padding: 10px; }
  .album-side { width: 112px; padding-right: 8px; }
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
}

/* ============================================================
   客户订单：资料卡「下单」栏列表 + 订单详情 + 直接改状态
   ============================================================ */
.pp-order-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.order-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; transition: background .15s, border-color .15s;
  font-size: 12px; color: var(--text);
}
.order-row:hover { background: rgba(122, 158, 126, .10); border-color: var(--primary-light); }
.order-row .or-id { font-weight: 600; color: var(--primary-dark); }
.order-row .or-st {
  padding: 1px 8px; border-radius: 999px; font-size: 11px; color: #fff; background: #a89e94;
}
.order-row .or-st.st-pending    { background: #b98b4e; }
.order-row .or-st.st-processing { background: #5d8462; }
.order-row .or-st.st-shipped    { background: #4a7fb5; }
.order-row .or-st.st-cancelled  { background: #a8564f; }
.order-row .or-st.st-refunded   { background: #8a6fae; }
.order-row .or-total { margin-left: auto; font-weight: 600; }
.order-row .or-date  { color: var(--text-3); }
.order-row .or-go    { color: var(--primary); font-size: 11px; }
.order-loading { font-size: 12px; color: var(--text-3); padding: 6px 2px; }

/* 订单详情弹窗 */
.order-box { width: min(560px, 94vw); max-height: 84vh; display: flex; flex-direction: column; }
.order-body { padding: 14px 18px 18px; overflow-y: auto; min-height: 0; }
.order-ctrl {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border);
}
.order-ctrl label { font-size: 13px; font-weight: 600; color: var(--text); }
#orderStatusSel {
  height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; min-width: 110px;
}
#orderStatusSel:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(122,158,126,.16); }
.order-hint { font-size: 12px; color: var(--text-3); }

.order-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px 12px; }
.order-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.order-kv .ok-k { color: var(--text-3); flex: 0 0 auto; }
.order-kv .ok-v { color: var(--text); text-align: right; word-break: break-all; }

.order-block { margin-top: 14px; }
.order-block h5 { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.order-addr { font-size: 13px; color: var(--text); line-height: 1.6; }
.order-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--border); font-size: 13px; color: var(--text);
}
.order-item .oi-name  { flex: 1; min-width: 0; }
.order-item .oi-qty   { color: var(--text-3); }
.order-item .oi-price { font-weight: 600; }

/* 总控：QQ 头像同步区块 */
.ctrl-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.ctrl-switch input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.ctrl-field.inline { flex-direction: row; align-items: center; gap: 8px; }
.ctrl-field.inline span { white-space: nowrap; }
.ctrl-hint code {
  background: var(--surface-2); padding: 1px 5px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px;
}

/* ---- 会话置顶标记（右键菜单 → 置顶） ---- */
.conv-pin {
    font-size: 11px;
    line-height: 1;
    margin-right: 4px;
    vertical-align: 1px;
    opacity: .9;
    flex: 0 0 auto;
}

/* ===== 需求「发送商品」：🛍 按钮 + 贴着输入框上方的商品条 + 商品气泡（迁移自旧控制台）===== */
.tool-btn.product-btn { color: var(--primary-dark); }
.tool-btn.product-btn:hover { background: rgba(122, 158, 126, .14); }
.tool-btn.product-btn.active { background: rgba(122, 158, 126, .18); color: var(--primary-dark); }

/* 商品条：贴着输入框上方（对照旧控制台 .yy-prod-bar） */
.prod-bar {
    margin: 0 -24px 10px;
    padding: 8px 24px 6px;
    background: #fff;
    border-bottom: 1px solid var(--border-soft, #f0ebe3);
}
.prod-tabs {
    display: flex; gap: 6px;
    overflow-x: auto;
    padding-bottom: 7px;
    scrollbar-width: thin;
}
.prod-tabs::-webkit-scrollbar { height: 3px; }
.prod-tabs::-webkit-scrollbar-thumb { background: #e6ded4; border-radius: 2px; }
.prod-tab {
    flex: 0 0 auto;
    border: 1px solid var(--border-light, #ece5dd);
    background: #faf8f5;
    color: #6f655c;
    border-radius: 999px;
    padding: 5px 13px; font-size: 12.5px; cursor: pointer;
    white-space: nowrap; transition: all .15s;
}
.prod-tab:hover { background: #f3f7f3; border-color: #cfe0d1; }
.prod-tab.active { background: var(--primary, #7a9e7e); border-color: var(--primary, #7a9e7e); color: #fff; font-weight: 600; }

.prod-list {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 2px 0 4px;
    min-height: 76px;
    scrollbar-width: thin;
}
.prod-list::-webkit-scrollbar { height: 4px; }
.prod-list::-webkit-scrollbar-thumb { background: #e6ded4; border-radius: 2px; }
.prod-item {
    flex: 0 0 auto;
    width: 152px;
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px;
    border: 1px solid var(--border-light, #ece5dd);
    border-radius: 12px;
    background: #fff; cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.prod-item:hover { background: #f3f7f3; border-color: var(--primary, #7a9e7e); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(122, 158, 126, .14); }
.prod-item:active { transform: translateY(0) scale(.98); }
.prod-thumb {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border-radius: 9px; object-fit: cover;
    background: var(--surface-2, #f0ebe3);
}
.prod-meta { flex: 1 1 auto; min-width: 0; }
.prod-title {
    font-size: 12.5px; color: var(--text, #3d3530); line-height: 1.35;
    max-height: 34px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.prod-price { margin-top: 3px; font-size: 13px; font-weight: 700; color: var(--accent-dark, #d4895f); }
.prod-empty { padding: 24px 12px; color: #a89e94; font-size: 13px; }

/* 商品消息气泡 */
.msg-product { margin-top: 2px; }
.msg-product-card {
    display: flex; align-items: stretch; gap: 10px;
    width: 240px; max-width: 100%;
    padding: 8px; text-decoration: none;
    background: #fff; border: 1px solid var(--border-light);
    border-radius: var(--radius-md, 14px);
    transition: box-shadow .15s, border-color .15s;
}
.msg-product-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.mpc-img {
    width: 64px; height: 64px; flex: 0 0 64px;
    object-fit: cover; border-radius: 10px; background: var(--surface-2, #f6f2ec);
}
.mpc-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.mpc-title {
    font-size: 12.5px; color: var(--text); line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mpc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.mpc-price { font-size: 13px; font-weight: 700; color: var(--primary-dark); }
.mpc-link { font-size: 11.5px; color: var(--primary); }

@media (max-width: 640px) {
    .prod-item { width: 132px; }
    .msg-product-card { width: 100%; max-width: 240px; }
}

/* ===== 移动端补丁：必须放在基础规则之后（同特异性后者胜）===== */
@media (max-width: 768px) {
    /* 商品条全宽贴边：负 margin 跟随 .input-area 的窄屏 padding(12px) */
    .prod-bar { margin: 0 -12px 10px; padding: 8px 12px 6px; }
}

/* ============================================================
   需求「客服账号权限」：客服归属标注 + 只读订单状态
   （追加式样式 → 必须放文件末尾，同特异性后者胜）
   ============================================================ */

/* 会话项：昵称行 = 昵称 + 「接待客服」小标（昵称仍保留省略号行为） */
.conv-info .conv-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.conv-info .conv-name-row .conv-name { flex: 1 1 auto; min-width: 0; }
.conv-info .conv-name-row .conv-handler {
    flex: 0 0 auto; max-width: 110px;
    padding: 2px 7px; border-radius: 999px;
    background: rgba(122, 158, 126, .16);
    color: var(--primary-dark, #5d8462);
    font-size: 10px; font-weight: 600; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 消息头：坐席发送者姓名 + 角色徽标（仅坐席视角、非本人消息） */
.msg-name.is-staff {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--primary-dark, #5d8462);
}
.msg-name .msg-role {
    padding: 1px 5px; border-radius: 999px;
    background: rgba(122, 158, 126, .18);
    color: var(--primary-dark, #5d8462);
    font-size: 10px; font-weight: 700; line-height: 1.6;
    letter-spacing: .02em;
}

/* 订单详情：客服（只读）看到的当前状态 */
.order-st.readonly {
    display: inline-block;
    padding: 5px 12px; border-radius: 999px;
    background: var(--surface-3, #eee6dc);
    color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.2;
}
.order-st.readonly.st-pending    { background: #b98b4e; }
.order-st.readonly.st-processing { background: #5d8462; }
.order-st.readonly.st-shipped    { background: #4a7fb5; }
.order-st.readonly.st-cancelled  { background: #a8564f; }
.order-st.readonly.st-refunded   { background: #8a6fae; }

/* ===== 顾客黑名单模块 ===== */
.sidebar-blacklist-entry { padding: 8px 12px 0; }
.sidebar-blacklist-btn {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface-2, #f3ece3);
  color: var(--text-2, #7a6e64);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.sidebar-blacklist-btn:hover { background: #f6e3df; color: #c0392b; border-color: #f0c9c0; }

/* 黑名单管理弹窗 */
.bl-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.bl-search {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface-2, #f3ece3);
  color: var(--text);
  font-size: 13.5px;
}
.bl-search:focus { outline: none; border-color: var(--primary, #6c5ce7); }
.bl-count { font-size: 12.5px; color: var(--text-3, #9a8f85); white-space: nowrap; }
.bl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft, var(--border-light, #ece2d6));
  border-radius: var(--radius-md, 12px);
  background: var(--surface, #fff);
  margin-bottom: 10px;
}
.bl-info { min-width: 0; }
.bl-name { font-size: 14px; font-weight: 700; color: var(--text); }
.bl-code { font-size: 12px; color: var(--text-3, #9a8f85); font-weight: 500; }
.bl-meta { font-size: 12.5px; color: var(--text-2, #7a6e64); margin-top: 2px; word-break: break-all; }
.bl-reason-text { font-size: 12.5px; color: var(--text-2, #7a6e64); margin-top: 2px; }
.bl-unblock { flex: 0 0 auto; }

/* 会话列表「已拉黑」标 */
.conv-blocked-tag {
  margin-left: 8px;
  font-size: 11.5px; font-weight: 600;
  color: #c0392b;
  background: #fdecea;
  border: 1px solid #f5c6c0;
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
}

/* 信息面板拉黑按钮区 */
.info-block-actions { margin-top: 12px; }

/* 按钮：危险 / 幽灵 */
.btn-danger {
  background: linear-gradient(135deg, #e8543f, #c0392b);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md, 12px);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(192,57,43,.28);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(192,57,43,.34); }
.btn-danger:active { transform: translateY(0); }
.btn-ghost {
  background: var(--surface-2, #f3ece3);
  color: var(--text-2, #7a6e64);
  border: 1px solid var(--border, #ece2d6);
  padding: 8px 16px;
  border-radius: var(--radius-md, 12px);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-ghost:hover { background: #f6e3df; color: #c0392b; border-color: #f0c9c0; }

/* 拉黑原因弹窗 */
.bl-block-tip { font-size: 13.5px; color: var(--text-2, #7a6e64); margin: 0 0 10px; }
.bl-reason {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface-2, #f3ece3);
  color: var(--text);
  font-size: 13.5px;
  padding: 8px 12px;
  resize: vertical;
  font-family: var(--font);
}
.bl-reason:focus { outline: none; border-color: var(--primary, #6c5ce7); }
.bl-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ===== 用户运营中心入口（仅管理员，黑名单入口同款风格） ===== */
.sidebar-ops-entry { padding: 8px 12px 0; }
.sidebar-ops-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: var(--surface-2, #f3ece3);
  color: var(--text-2, #7a6e64);
  font-size: 13.5px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.sidebar-ops-btn:hover {
  background: rgba(122,158,126,.12);
  color: var(--primary-dark, #5d8462);
  border-color: var(--primary-light, #a3c0a7);
  transform: translateY(-1px);
}
.sidebar-ops-btn .ops-btn-icon { font-size: 15px; line-height: 1; }
