/* Cosinee 管理后台 & 坐席工作台样式（参照春松客服布局） */
:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --sidebar-bg: #001529;
  --sidebar-active: #1890ff;
  --header-h: 50px;
  --sidebar-w: 220px;
  --border: #e8e8e8;
  --text-muted: #999;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f2f5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== 后台布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: rgba(255,255,255,.85);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.admin-logo {
  height: 56px;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #1677ff, #69b1ff);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.admin-user-footer {
  flex-shrink: 0;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.15);
}
.admin-user-meta .name { font-size: 13px; font-weight: 600; color: #fff; }
.admin-user-meta .email { font-size: 11px; color: rgba(255,255,255,.5); }

.admin-header-right { display: flex; align-items: center; gap: 12px; }
.admin-header-title { font-size: 16px; font-weight: 600; }

/* ===== 头像 ===== */
.user-avatar-wrap { position: relative; display: inline-block; flex-shrink: 0; overflow: visible; }
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-status {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-sizing: border-box;
  z-index: 1;
}
.avatar-status.on { background: #52c41a; }
.avatar-status.off { background: #999; }

.msg-avatar-cell { flex-shrink: 0; align-self: flex-end; }
.msg-row .user-avatar-wrap { overflow: visible; }
.msg-row .user-avatar { box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ===== 座席卡片列表 ===== */
.agent-card-list { display: flex; flex-direction: column; }
.agent-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.agent-card:hover { background: #fafafa; }
.agent-card-info { flex: 1; min-width: 0; }
.agent-card-info .name { font-weight: 600; font-size: 15px; }
.agent-card-info .email { font-size: 13px; color: #888; margin-top: 2px; }
.agent-card-actions { display: flex; gap: 8px; align-items: center; }

/* ===== 复制框 ===== */
.copy-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 8px;
}
.copy-field input, .copy-field textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 13px;
  font-family: ui-monospace, monospace;
  background: #fafafa;
}
.copy-field textarea { min-height: 100px; resize: vertical; }
.code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 14px;
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  position: relative;
}
.code-block .copy-btn-float {
  position: absolute;
  top: 8px; right: 8px;
}

.cosinee-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.78);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all .25s;
  pointer-events: none;
}
.cosinee-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.channel-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  background: linear-gradient(180deg, #f8faff, #fff);
}
.channel-preview .site-name { font-size: 18px; font-weight: 600; margin: 12px 0 4px; }
.channel-preview .welcome { color: #666; font-size: 14px; }

.transfer-agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
}
.transfer-agent-item:hover { border-color: var(--primary); background: #f0f5ff; }

.hidden { display: none !important; }

.admin-nav { list-style: none; padding: 8px 0; flex: 1; overflow-y: auto; min-height: 0; }

.admin-nav .nav-group {
  padding: 12px 20px 6px;
  font-size: 12px;
  color: rgba(255,255,255,.45);
}

.admin-nav a {
  display: block;
  padding: 10px 20px 10px 24px;
  color: rgba(255,255,255,.75);
  border-left: 3px solid transparent;
  transition: all .2s;
}

.admin-nav a:hover, .admin-nav a.active {
  background: rgba(255,255,255,.08);
  color: #fff;
  border-left-color: var(--sidebar-active);
}

.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}

.admin-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-content { padding: 20px 24px; flex: 1; min-width: 0; }

.page-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #1a1a1a;
}

/* ===== 统计卡片 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
}

.stat-icon.blue { background: linear-gradient(135deg, #1677ff, #69b1ff); }
.stat-icon.green { background: linear-gradient(135deg, #52c41a, #95de64); }
.stat-icon.orange { background: linear-gradient(135deg, #fa8c16, #ffc069); }
.stat-icon.pink { background: linear-gradient(135deg, #eb2f96, #ff85c0); }

.stat-value { font-size: 28px; font-weight: 600; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.chart-panel { margin-top: 20px; }
.chart-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chart-toolbar button {
  padding: 6px 14px; border: 1px solid var(--border); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-muted);
}
.chart-toolbar button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chart-wrap { position: relative; height: 320px; }
.chart-legend { display: flex; gap: 20px; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-sub { height: 220px; }

/* ===== 表格 ===== */
.panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden;
}

.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.panel-header h3 { font-size: 15px; font-weight: 600; }

.panel-body { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; table-layout: auto; min-width: 1100px; }
.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.data-table th { background: #fafafa; font-weight: 600; color: #666; font-size: 13px; white-space: nowrap; }
.data-table tr:hover td { background: #fafafa; }
.data-table .col-compact { width: 1%; white-space: nowrap; }
.data-table .col-visitor { min-width: 120px; max-width: 220px; }
.data-table .col-visitor .visitor-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
.data-table .col-visitor .visitor-name {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: break-all;
  line-height: 1.4;
}
.data-table .col-msg {
  min-width: 200px;
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
}
.data-table .col-time { white-space: nowrap; min-width: 140px; }
.data-table .col-actions { white-space: nowrap; width: 1%; }
.data-table .col-actions .btn { margin: 2px 0; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  line-height: 1.5;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-default { background: #fff; border-color: #d9d9d9; color: #333; }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ===== 表单 ===== */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; color: #555; font-size: 13px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.1); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-orange { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.badge-gray { background: #f5f5f5; color: #999; border: 1px solid #d9d9d9; }
.badge-blue { background: #e6f4ff; color: #1677ff; border: 1px solid #91caff; }

/* ===== 坐席工作台 ===== */
.agent-layout { display: flex; height: 100vh; overflow: hidden; }

.agent-sidebar {
  width: 280px;
  background: #2c3e50;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.agent-sidebar-header {
  padding: 12px 14px;
  background: #243342;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.agent-user-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.agent-role-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.9);
  white-space: nowrap;
  align-self: flex-start;
}
.agent-user-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.agent-nav-btn {
  font-size: 11px;
  padding: 6px 4px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px;
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-nav-btn:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.55);
  color: #fff;
}
.agent-nav-admin {
  background: rgba(22,119,255,.35);
  border-color: rgba(145,202,255,.6);
}
.agent-nav-admin:hover {
  background: rgba(22,119,255,.55);
}
.agent-logout-btn { font-family: inherit; }

.agent-online-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(134,239,172,.95);
  background: rgba(34,197,94,.18);
  border: 1px solid rgba(74,222,128,.35);
}

.agent-switch-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.agent-switch-box label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,.55);
  margin-bottom: 6px;
}
.agent-switch-box select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.2);
  color: #fff;
  font-size: 12px;
}
.agent-switch-box select option { color: #333; }

.view-as-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: linear-gradient(90deg, #fff7e6, #fffbe6);
  border-bottom: 1px solid #ffe58f;
  color: #ad6800;
  font-size: 13px;
  flex-shrink: 0;
}

.status-btn {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.3);
  background: transparent;
  color: rgba(255,255,255,.7);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.status-btn.active[data-status="ready"] { background: var(--success); border-color: var(--success); color: #fff; }
.status-btn.active[data-status="busy"] { background: var(--warning); border-color: var(--warning); color: #fff; }
.status-btn.active[data-status="notready"] { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.45); color: rgba(255,255,255,.92); }

.session-list { flex: 1; overflow-y: auto; }
.session-list.session-list-loading { opacity: 0.88; }

.session-item {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.session-item:hover, .session-item.active { background: rgba(255,255,255,.1); }
.session-item.pinned {
  background: rgba(250,173,20,.08);
  border-left: 3px solid #faad14;
  padding-left: 9px;
}
.session-item-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-right: 4px;
}
.session-item-body { flex: 1; min-width: 0; }
.session-item .name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.session-item .name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
  flex-shrink: 1;
  min-width: 0;
}
.session-item .sess-status {
  font-size: 11px;
  opacity: .65;
  font-weight: normal;
}
.session-item .pin-tag {
  font-size: 11px;
  line-height: 1;
  opacity: .9;
}
.session-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  background: rgba(20, 30, 40, .92);
  padding: 3px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.session-item:hover .session-actions,
.session-item.active .session-actions {
  opacity: 1;
  pointer-events: auto;
}
.sess-act-icon {
  border: none;
  background: transparent;
  color: rgba(255,255,255,.85);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sess-act-icon:hover { background: rgba(255,255,255,.15); }
.sess-act-claim {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  border: none;
  background: #1677ff;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.sess-act-claim:hover { background: #4096ff; }
.sess-act-del:hover { background: rgba(255,77,79,.4); color: #fff; }
.session-item .preview {
  font-size: 12px;
  color: rgba(255,255,255,.55);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
}
.session-item .meta { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 4px; display: flex; justify-content: space-between; }

.agent-chat-area { flex: 1; display: flex; flex-direction: column; background: #f5f5f5; min-width: 0; overflow: hidden; }

.chat-header {
  min-height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
  flex-shrink: 0;
}
.chat-header-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.chat-header-text { flex: 1; min-width: 0; }
.chat-header-title {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1.35;
}
.chat-header-title .text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(240px, 36vw);
  display: inline-block;
  vertical-align: bottom;
}
.chat-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: #f5f5f5;
  border-radius: 4px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #595959;
}
.meta-chip.meta-memo {
  max-width: 280px;
  background: #fff7e6;
  color: #ad6800;
  border: 1px solid #ffe7ba;
}
.meta-chip.meta-memo-empty {
  background: #fafafa;
  color: #bfbfbf;
  border: 1px dashed #e8e8e8;
}
.meta-chip.meta-live {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}
.chat-header .actions { display: flex; gap: 8px; flex-shrink: 0; align-self: center; }
.text-ellipsis { min-width: 0; }
.msg-name .text-ellipsis {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.info-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  cursor: pointer;
  color: #666;
}
.info-mono:hover { color: var(--primary); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  min-height: 0;
}

.msg-row { display: flex; margin-bottom: 16px; gap: 10px; }
.msg-row.out { flex-direction: row-reverse; }

.msg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #ddd;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
}
.msg-row.out .msg-avatar { background: var(--primary); color: #fff; }

.msg-body { max-width: min(68%, 480px); min-width: 0; }
.msg-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg-row.out .msg-meta { flex-direction: row-reverse; }
.msg-time { color: #bbb; font-size: 11px; white-space: nowrap; }
.msg-name { font-weight: 500; color: #666; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #eee;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 14px;
}
.msg-row.out .msg-bubble {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  border-radius: 12px 12px 4px 12px;
}
.msg-row.recalled .msg-bubble {
  background: #f5f5f5 !important;
  color: #999 !important;
  border-color: #eee !important;
  box-shadow: none;
}
.msg-recalled-hint {
  font-style: italic;
  font-size: 13px;
  color: #999;
}
.msg-recall-btn {
  margin-left: auto;
  padding: 0 6px;
  border: none;
  background: transparent;
  color: #999;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.msg-row:hover .msg-recall-btn { opacity: 1; }
.msg-recall-btn:hover { color: var(--danger); }
.msg-meta { position: relative; }
.msg-row:not(.out) .msg-bubble {
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.chat-date-sep {
  text-align: center;
  margin: 16px 0;
  font-size: 12px;
  color: #999;
}
.chat-date-sep::before, .chat-date-sep::after {
  content: '';
  display: inline-block;
  width: 60px;
  height: 1px;
  background: #e0e0e0;
  vertical-align: middle;
  margin: 0 10px;
}

.session-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.session-tabs.scope-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.session-tabs.scope-tabs::-webkit-scrollbar { display: none; }
.session-tabs.scope-tabs .session-tab {
  flex: 1 0 auto;
  min-width: 4.5em;
  padding: 9px 10px;
  font-size: 12px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.session-tabs.scope-tabs .session-tab.active {
  border-bottom-color: #1677ff;
  background: rgba(22,119,255,.15);
}
.session-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-size: 13px;
}
.session-tab.active { color: #fff; background: rgba(255,255,255,.1); font-weight: 600; }

.assign-tabs { gap: 4px; border-bottom: none; }
.assign-tabs .session-tab { flex: 1; padding: 6px 4px; font-size: 12px; border-radius: 4px; }
.sess-agent {
  font-size: 11px;
  color: rgba(255,255,255,.65);
  margin-left: 2px;
}

.tab-pills { display: flex; gap: 6px; }
.tab-pill {
  padding: 5px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.tab-pill.active { background: #1677ff; color: #fff; border-color: #1677ff; }

.session-item .online-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.session-item .online-dot.on { background: #52c41a; }
.session-item .online-dot.off { background: #999; }
.session-item .online-dot.left { background: #666; }

.history-item {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  font-size: 13px;
}
.history-item:hover { background: #f5f5f5; }
.history-item .h-time { font-size: 11px; color: #999; margin-top: 4px; }

.chat-readonly .chat-input-area { display: none !important; }

.msg-bubble img { max-width: 240px; max-height: 200px; border-radius: 8px; cursor: pointer; display: block; }
.msg-bubble video.chat-video { max-width: 280px; max-height: 220px; border-radius: 8px; display: block; background: #000; }

.chat-input-area { background: #fff; border-top: 1px solid var(--border); flex-shrink: 0; }

.chat-toolbar {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  gap: 4px;
  align-items: center;
}

.tool-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-btn:hover { background: #f0f0f0; color: var(--primary); }

.emoji-picker-panel {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 8px;
  z-index: 100;
  width: 320px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  padding: 8px 10px;
}
.emoji-picker-panel.show { display: block; }
.chat-toolbar { position: relative; }
.emoji-group-label { font-size: 11px; color: #999; margin: 6px 0 4px; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 2px; }
.emoji-item {
  width: 32px; height: 32px;
  border: none; background: transparent;
  border-radius: 4px; cursor: pointer;
  font-size: 20px; line-height: 32px;
  padding: 0;
}
.emoji-item:hover { background: #f0f5ff; }

.visitor-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.visitor-header-brand h2 { margin: 0; }
.site-logo-slot { flex-shrink: 0; line-height: 0; }
.agent-brand-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-brand-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.quick-reply-panel {
  display: none;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  max-height: 200px;
  overflow-y: auto;
  background: #fafbfc;
}
.quick-reply-panel.show { display: block; }
.qr-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.qr-panel-title { font-size: 12px; color: #888; font-weight: 600; }
.qr-add-btn {
  border: 1px dashed #adc6ff;
  background: #f0f5ff;
  color: var(--primary);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.qr-add-btn:hover { background: #d6e4ff; }
.qr-group-label {
  font-size: 11px;
  color: #999;
  margin: 6px 0 4px;
}
.qr-empty { font-size: 12px; color: #bbb; padding: 8px 0; }
.qr-panel-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.quick-reply-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #f0f5ff;
  border: 1px solid #adc6ff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--primary);
  position: relative;
}
.quick-reply-item:hover { background: #d6e4ff; }
.qr-item-actions { display: inline-flex; gap: 2px; margin-left: 2px; }
.qr-mini {
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}
.qr-mini:hover { color: var(--primary); }

/* 悬停提示 */
.has-tip { position: relative; }
.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: rgba(0,0,0,.82);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  border-radius: 6px;
  white-space: normal;
  max-width: 220px;
  width: max-content;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 200;
  font-weight: normal;
}
.has-tip:hover::after, .has-tip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.chat-toolbar .has-tip::after { bottom: calc(100% + 6px); }
.quick-reply-item.has-tip::after {
  bottom: calc(100% + 6px);
  left: 0;
  transform: none;
  text-align: left;
  max-width: 280px;
}

.chat-input-row {
  display: flex;
  padding: 10px 12px;
  gap: 10px;
  align-items: flex-end;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-input-row textarea {
  flex: 1;
  min-width: 0;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 10px;
  resize: none;
  height: 72px;
  font-size: 14px;
  font-family: inherit;
}
.chat-input-row .btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  align-self: flex-end;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--primary); }

.chat-load-more {
  text-align: center;
  padding: 8px 0 12px;
}
.session-search {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.session-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.15);
  color: #fff;
  font-size: 13px;
}
.session-search input::placeholder { color: rgba(255,255,255,.45); }
.agent-avatar-click { cursor: pointer; }
.sensitive-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #fff1f0;
  border: 1px solid #ffccc7;
  border-radius: 16px;
  font-size: 13px;
  color: #cf1322;
}
.sensitive-tag button {
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.sensitive-tag button:hover { color: #cf1322; }

.agent-info-panel {
  width: 300px;
  background: #fff;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  min-width: 0;
}

.info-section { padding: 16px; border-bottom: 1px solid #f0f0f0; }
.info-section h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.info-row { display: flex; margin-bottom: 8px; font-size: 13px; }
.info-row .label { width: 70px; color: var(--text-muted); flex-shrink: 0; }
.info-row .value { flex: 1; word-break: break-all; }
.info-edit { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.info-edit:focus { border-color: var(--primary); outline: none; }
.info-textarea { min-height: 72px; resize: vertical; }
.info-save-btn { margin-top: 8px; }
.transfer-agent-item.offline { opacity: .55; }
.transfer-agent-item .status-tag { font-size: 11px; margin-left: auto; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }

/* ===== 访客聊天窗口（企业级） ===== */
.visitor-page {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(160deg, #eef2f8 0%, #e4eaf3 100%);
}

.visitor-wrap {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 8px 40px rgba(15, 23, 42, .12);
  overflow: hidden;
}

.visitor-header {
  background: linear-gradient(135deg, #1677ff, #0958d9);
  color: #fff;
  padding: 14px 16px 12px;
  position: relative;
  flex-shrink: 0;
}

.vh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vh-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 16px;
  padding: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: rgba(255,255,255,.85);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  line-height: 1;
}
.lang-btn.active {
  background: rgba(255,255,255,.95);
  color: #1677ff;
}

.visitor-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.vh-titles { min-width: 0; }
.visitor-header h2, #siteTitle {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vh-status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.vh-status-line .sub {
  font-size: 12px;
  opacity: .92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  flex-shrink: 0;
}
.vh-dot.on { background: #52c41a; box-shadow: 0 0 0 2px rgba(82,196,26,.35); }
.vh-dot.idle { background: #faad14; }
.vh-dot.wait { background: #faad14; animation: vh-pulse 1.2s infinite; }
.vh-dot.off { background: #999; }

@keyframes vh-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.vh-menu-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vh-menu-btn:hover { background: rgba(255,255,255,.28); }

.vh-dropdown {
  position: absolute;
  right: 12px;
  top: calc(100% - 4px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 8px;
  z-index: 50;
  min-width: 180px;
}
.vh-dropdown.hidden { display: none; }
.vh-dropdown button {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
}
.vh-dropdown button:hover { background: #f5f7fa; }
.vh-menu-tip {
  margin: 4px 12px 8px;
  font-size: 11px;
  color: #999;
}
.vh-menu-id {
  margin: 4px 12px 0;
  font-size: 11px;
  color: #666;
  font-family: ui-monospace, monospace;
}

.visitor-archive-picker {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.visitor-archive-picker.hidden { display: none; }
.visitor-archive-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  width: min(100%, 360px);
  max-height: 70vh;
  overflow: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.visitor-archive-card h3 { margin: 0 0 12px; font-size: 16px; }
.visitor-archive-list { list-style: none; margin: 0 0 16px; padding: 0; }
.visitor-archive-item {
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.visitor-archive-item:hover { border-color: var(--primary); background: #f0f5ff; }
.visitor-archive-item .sub { font-size: 12px; color: #888; }
.chat-archive-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff8e6;
  border: 1px solid #ffe58f;
  border-radius: 10px;
  font-size: 12px;
  color: #8c6d1f;
}

.visitor-start {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 24px 40px;
}

.start-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 0;
}

.start-logo { margin-bottom: 20px; line-height: 0; }

.start-hero h3 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #1a1a1a;
  font-weight: 600;
}

.start-hero p {
  margin: 0;
  color: #888;
  font-size: 14px;
  line-height: 1.6;
  max-width: 280px;
}

.start-form {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.start-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 12px;
  box-sizing: border-box;
  transition: border-color .2s, box-shadow .2s;
}
.start-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,.12);
}

.btn-block {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  border-radius: 10px;
}

.visitor-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #999;
  text-align: center;
}

.visitor-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f7f9fc;
}

.visitor-chat.hidden { display: none !important; }

.visitor-chat .chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  background: #f7f9fc;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.chat-msgs-spacer {
  flex: 0 0 0;
  min-height: 0;
  pointer-events: none;
}
.chat-msgs-spacer.active {
  flex: 1 1 auto;
}

.visitor-chat .chat-input-area {
  flex-shrink: 0;
}

.visitor-chat .chat-toolbar {
  position: relative;
  padding: 6px 12px 0;
  background: #fff;
}

.chat-system-msg {
  text-align: center;
  margin: 12px auto;
  padding: 6px 14px;
  font-size: 12px;
  color: #888;
  background: rgba(0,0,0,.04);
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.tool-btn.tool-icon {
  color: #666;
  padding: 0;
}
.tool-btn.tool-icon svg { display: block; }

.btn-send {
  min-width: 72px;
  padding: 10px 18px;
  border-radius: 8px;
}

.visitor-chat .chat-input-row {
  padding: 8px 12px 12px;
  gap: 8px;
  background: #fff;
  border-top: 1px solid #eef1f5;
}
.visitor-chat .chat-input-row textarea {
  min-height: 40px;
  height: 40px;
  max-height: 120px;
  border-radius: 20px;
  border-color: #e0e6ed;
  padding: 9px 14px;
  resize: none;
  background: #f7f9fc;
}
.visitor-chat .chat-input-row .btn-send {
  min-width: 64px;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  font-size: 14px;
}

.visitor-chat .msg-row.out .msg-bubble {
  background: var(--brand-color, var(--primary));
  border-color: transparent;
  border-radius: 16px 16px 4px 16px;
}

.visitor-chat .msg-row:not(.out) .msg-bubble {
  background: #fff;
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.session-item.has-new { animation: session-flash .8s ease; }
@keyframes session-flash {
  0% { background: rgba(255,255,255,.25); }
  100% { background: transparent; }
}

/* 旧版兼容 */
.visitor-header .sub { font-size: 13px; opacity: .85; }

/* ===== 登录页 ===== */
body.login-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #001529 0%, #003a70 50%, #1677ff 100%);
}

.login-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-shell {
  display: flex;
  width: min(100%, 860px);
  min-height: 420px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.28);
  background: #fff;
}

.login-brand {
  flex: 1;
  padding: 48px 40px;
  background: linear-gradient(160deg, #001529 0%, #1677ff 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-size: 28px;
  margin-bottom: 12px;
  font-weight: 700;
}

.login-brand p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,.75);
  max-width: 260px;
}

.login-card {
  flex: 1;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #fff;
}

.login-card h2 {
  font-size: 22px;
  margin-bottom: 28px;
  color: #1f1f1f;
}

.login-card .form-row {
  margin-bottom: 18px;
}

.login-card .form-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #666;
}

.login-card .form-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color .2s;
}

.login-card .form-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22,119,255,.12);
}

.login-submit {
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  border-radius: 8px;
}

.login-err {
  color: #ff4d4f;
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

@media (max-width: 720px) {
  .login-shell {
    flex-direction: column;
    min-height: auto;
  }
  .login-brand {
    padding: 32px 24px;
  }
  .login-card {
    padding: 32px 24px 40px;
  }
}

/* 旧版兼容 */
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card .subtitle { color: #888; margin-bottom: 28px; font-size: 14px; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal {
  background: #fff;
  border-radius: 8px;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: right; display: flex; gap: 8px; justify-content: flex-end; }

.user-avatar { object-fit: cover; }
.user-avatar-img { border-radius: 50%; display: block; box-shadow: 0 2px 8px rgba(0,0,0,.12); }

.page-hero {
  background: linear-gradient(135deg, #1677ff 0%, #0958d9 55%, #003a8c 100%);
  border-radius: 16px; padding: 28px 32px; color: #fff; margin-bottom: 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  box-shadow: 0 8px 24px rgba(22,119,255,.25);
}
.page-hero h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.page-hero p { opacity: .88; font-size: 14px; max-width: 520px; line-height: 1.6; }
.page-hero .hero-stat { text-align: center; min-width: 72px; }
.page-hero .hero-stat b { display: block; font-size: 28px; font-weight: 700; }
.page-hero .hero-stat span { font-size: 12px; opacity: .75; }

.admin-tabs { display: flex; gap: 4px; background: #fff; padding: 6px; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 20px; width: fit-content; }
.admin-tab { padding: 10px 20px; border: none; background: transparent; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: #666; transition: all .2s; }
.admin-tab:hover { color: var(--primary); background: #f0f5ff; }
.admin-tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding: 20px; }
.agent-card-v2 { background: #fff; border: 1px solid #eef0f4; border-radius: 14px; padding: 20px;
  transition: box-shadow .2s, transform .2s; position: relative; overflow: hidden; }
.agent-card-v2::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), #69b1ff); }
.agent-card-v2:hover { box-shadow: 0 8px 24px rgba(22,119,255,.12); transform: translateY(-2px); }
.agent-card-v2 .card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.agent-card-v2 .card-name { font-size: 17px; font-weight: 700; color: #1a1a1a; }
.agent-card-v2 .card-sub { font-size: 13px; color: #888; margin-top: 4px; }
.agent-card-v2 .card-greeting { font-size: 13px; color: #555; background: #f8faff; border-radius: 8px;
  padding: 10px 12px; margin: 12px 0; border-left: 3px solid var(--primary); line-height: 1.5; }
.agent-card-v2 .card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.agent-card-v2 .card-link { font-size: 12px; color: #888; word-break: break-all; background: #fafafa;
  border-radius: 6px; padding: 8px 10px; margin-bottom: 12px; font-family: ui-monospace, monospace; }
.agent-card-v2 .card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.brand-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 960px) { .brand-layout { grid-template-columns: 1fr; } }
.brand-preview-box { border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.brand-locale-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.brand-locale-tab {
  padding: 6px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fafafa;
  color: #555;
  font-size: 13px;
  cursor: pointer;
}
.brand-locale-tab:hover { border-color: var(--primary); color: var(--primary); }
.brand-locale-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.brand-locale-hint {
  font-size: 12px;
  color: #999;
  margin: -8px 0 16px;
  line-height: 1.5;
}
.brand-preview-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f5f7fa;
  border-bottom: 1px solid #eee;
  font-size: 12px;
  color: #666;
}
.brand-preview-lang .brand-locale-tab { padding: 4px 10px; font-size: 12px; }
.brand-preview-header { padding: 20px 24px; color: #fff; display: flex; align-items: center; gap: 14px; }
.brand-preview-body { padding: 24px; background: #fff; }
.brand-preview-body h3 { font-size: 20px; margin-bottom: 8px; }
.brand-preview-body p { color: #666; line-height: 1.6; }
.logo-upload-row { display: flex; align-items: center; gap: 16px; }
.avatar-upload-row { display: flex; align-items: flex-start; gap: 16px; }
.avatar-upload-row label { align-self: flex-start; padding-top: 8px; }
.avatar-upload-body { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; }
.avatar-upload-body input[type="file"] { display: block; margin-bottom: 8px; font-size: 13px; }
.avatar-upload-body input:not([type="file"]) { width: 100%; }
.qr-table { width: 100%; border-collapse: collapse; }
.qr-table th, .qr-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.qr-table th { background: #fafafa; font-size: 13px; color: #666; font-weight: 600; }
.qr-table tr:hover td { background: #fafcff; }
.qr-content { color: #555; font-size: 13px; max-width: 360px; }
.panel { border-radius: 12px; }

.hidden { display: none !important; }
