/* ==========================================================================
   客资后台 全局样式
   ========================================================================== */
:root {
  --kz-primary: #3b7bf6;
  --kz-primary-dark: #2f66d4;
  --kz-side-bg: #1f2a3c;
  --kz-side-bg-2: #18212f;
  --kz-side-text: #b9c4d4;
  --kz-side-active: #3b7bf6;
  --kz-bg: #f2f4f8;
  --kz-card: #ffffff;
  --kz-border: #e4e9f2;
  --kz-text: #1f2d3d;
  --kz-text-2: #5e6d82;
  --kz-text-3: #97a3b6;
  --kz-radius: 8px;
  --kz-shadow: 0 2px 12px rgba(31, 45, 61, .06);
  --kz-header-h: 56px;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--kz-text);
  background: var(--kz-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--kz-primary); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c8d2e0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aab8cc; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- 登录页 ------------------------------- */
.login-page {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1b3b6f 0%, #2b5ea8 40%, #3b7bf6 100%);
  position: relative; overflow: hidden;
}
.login-page::before, .login-page::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.login-page::before { width: 620px; height: 620px; top: -240px; right: -160px; }
.login-page::after { width: 480px; height: 480px; bottom: -220px; left: -120px; }

/* 登录页：登录框 + 下面那行 ICP 备案号（竖着排，备案号在登录框正下方居中） */
.login-wrap {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  max-width: 94vw;
}
.login-icp { font-size: 12.5px; letter-spacing: .5px; }
.login-icp a { color: rgba(255, 255, 255, .75); text-decoration: none; }
.login-icp a:hover { color: #fff; text-decoration: underline; }

.login-box {
  position: relative; z-index: 2;
  width: 940px; max-width: 94vw; min-height: 480px;
  display: flex; border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(8, 24, 54, .38);
  background: #fff;
}
.login-intro {
  flex: 1.15;
  background: linear-gradient(160deg, #234b8f, #3b7bf6 70%, #5b96ff);
  color: #fff; padding: 54px 44px; display: flex; flex-direction: column;
}
.login-intro h1 { font-size: 30px; margin: 0 0 14px; letter-spacing: 1px; font-weight: 600; }
.login-intro p.sub { font-size: 14px; opacity: .9; line-height: 1.9; margin: 0 0 34px; }
.login-intro .feat { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; font-size: 13.5px; }
.login-intro .feat i {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, .22); display: grid; place-items: center;
  font-size: 12px; font-style: normal;
}
.login-intro .foot { margin-top: auto; font-size: 12px; opacity: .65; }

.login-form-wrap { flex: 1; padding: 58px 46px; display: flex; flex-direction: column; justify-content: center; }
.login-form-wrap h2 { margin: 0 0 6px; font-size: 22px; }
.login-form-wrap .tip { color: var(--kz-text-3); font-size: 13px; margin-bottom: 28px; }
.login-form-wrap .el-form-item { margin-bottom: 22px; }
.login-form-wrap .el-input__wrapper { padding: 6px 12px; }
.login-form-wrap .el-input__inner { height: 26px; }
.login-submit { width: 100%; height: 42px; font-size: 15px; letter-spacing: 4px; }
.login-hint {
  margin-top: 22px; padding: 12px 14px; background: #f5f8ff;
  border: 1px dashed #c5d8fb; border-radius: 8px; font-size: 12.5px;
  color: #4a6ba8; line-height: 1.9;
}
.login-hint b { color: #2f66d4; }

/* ------------------------------- 布局 ------------------------------- */
.layout { height: 100%; display: flex; }
.side {
  width: 220px; flex: none; background: var(--kz-side-bg);
  display: flex; flex-direction: column; transition: width .22s ease;
}
.side.collapsed { width: 64px; }
.side-logo {
  height: var(--kz-header-h); flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; color: #fff; background: var(--kz-side-bg-2); overflow: hidden;
}
.side-logo .mark {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3b7bf6, #5b96ff);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.side-logo .txt { font-size: 15.5px; font-weight: 600; letter-spacing: .5px; white-space: nowrap; }
.side-menu { flex: 1; overflow-y: auto; padding: 10px 0; }
.side-menu::-webkit-scrollbar { width: 5px; }
.side-menu::-webkit-scrollbar-thumb { background: #33415a; }
.side-group-title {
  padding: 14px 20px 6px; font-size: 11.5px; color: #5f6f88; letter-spacing: 1px;
  white-space: nowrap;
}
.side.collapsed .side-group-title { opacity: 0; height: 14px; padding: 6px 0; }
.menu-item {
  display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 18px;
  color: var(--kz-side-text); cursor: pointer; position: relative; white-space: nowrap;
  transition: background .15s, color .15s;
}
.menu-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-item.active { background: var(--kz-side-active); color: #fff; }
.menu-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #9dc0ff;
}
.menu-item .ico { flex: none; width: 18px; height: 18px; display: grid; place-items: center; font-size: 16px; }
.menu-item .badge {
  margin-left: auto; background: #f56c6c; color: #fff; font-size: 11px;
  border-radius: 9px; padding: 1px 6px; line-height: 15px;
}
.side.collapsed .menu-item { justify-content: center; padding: 0; }
.side.collapsed .menu-item .label, .side.collapsed .side-logo .txt { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  height: var(--kz-header-h); flex: none; background: #fff; display: flex; align-items: center;
  padding: 0 18px; gap: 14px; box-shadow: 0 1px 4px rgba(31, 45, 61, .07); z-index: 10;
}
.header .collapse-btn {
  width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center;
  cursor: pointer; color: var(--kz-text-2); font-size: 18px;
}
.header .collapse-btn:hover { background: #f2f5fa; color: var(--kz-primary); }
.header .crumb { font-size: 14px; color: var(--kz-text-2); }
.header .crumb b { color: var(--kz-text); font-weight: 600; }
.header .spacer { flex: 1; }
.header .hint-btn { color: var(--kz-text-2); cursor: pointer; display: flex; align-items: center; gap: 5px; font-size: 13px; }
.header .hint-btn:hover { color: var(--kz-primary); }
.header .user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 10px; border-radius: 20px; }
.header .user-chip:hover { background: #f2f5fa; }
.header .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #3b7bf6, #6fa2ff);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600;
}
.header .gold-tag {
  background: #fff8e6; color: #d99a00; border: 1px solid #ffe3a3;
  padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600;
}

.tags-nav {
  flex: none; height: 40px; background: #fff; border-top: 1px solid var(--kz-border);
  display: flex; align-items: center; gap: 6px; padding: 0 14px; overflow-x: auto;
}
.tags-nav::-webkit-scrollbar { height: 0; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 1px solid var(--kz-border); border-radius: 4px; background: #fff;
  font-size: 12.5px; color: var(--kz-text-2); cursor: pointer; white-space: nowrap;
}
.tag-chip.active { background: var(--kz-primary); border-color: var(--kz-primary); color: #fff; }
.tag-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #c2ccda; }
.tag-chip.active .dot { background: #fff; }

.page { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }

/* ------------------------------- 卡片 / 通用 ------------------------------- */
.card {
  background: var(--kz-card); border-radius: var(--kz-radius);
  box-shadow: var(--kz-shadow); padding: 16px; margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-title {
  font-size: 15px; font-weight: 600; margin: 0 0 14px; display: flex;
  align-items: center; justify-content: space-between; gap: 10px;
}
.card-title .left { display: flex; align-items: center; gap: 8px; }
.card-title .bar { width: 3px; height: 15px; background: var(--kz-primary); border-radius: 2px; }
.card-title .sub { font-size: 12.5px; color: var(--kz-text-3); font-weight: 400; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* 宽度按控件类型分开给：输入框 / 下拉 168px 够用，但日期区间（尤其带秒的
   datetimerange）168px 会把两段日期挤成省略号，看着就像「排版乱了」。 */
.filter-bar .el-input, .filter-bar .el-select { width: 168px; }
.filter-bar .el-date-editor { width: 240px; }
.filter-bar .el-date-editor.wide, .filter-bar .wide { width: 380px; }
/* 自动补全（所在地 / 意向门店 / 内容创作者）：外壳定宽，里面的 input 撑满，
   否则外壳和内层 input 宽度不一致，右边会多出一条空白。 */
.filter-bar .el-autocomplete { width: 180px; }
.filter-bar .el-autocomplete .el-input { width: 100%; }
.filter-bar .actions { margin-left: auto; display: flex; gap: 8px; }

.notice-banner {
  background: #fff9e9; border: 1px solid #ffe3a3; border-radius: var(--kz-radius);
  padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #8a6412; line-height: 1.9;
  display: flex; gap: 10px; align-items: flex-start;
}
.notice-banner .close { margin-left: auto; cursor: pointer; color: #b99248; flex: none; }

/* ------------------------------- 统计卡 ------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat-card {
  background: #fff; border-radius: var(--kz-radius); padding: 18px; box-shadow: var(--kz-shadow);
  position: relative; overflow: hidden;
}
.stat-card .lbl { font-size: 13px; color: var(--kz-text-3); margin-bottom: 10px; }
.stat-card .num { font-size: 27px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.stat-card .foot { font-size: 12px; color: var(--kz-text-3); margin-top: 9px; }
.stat-card .icon {
  position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; font-size: 20px;
}
.stat-card .up { color: #f56c6c; }
.stat-card .down { color: #67c23a; }

/* ------------------------------- 图表 ------------------------------- */
.chart-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .chart-row { grid-template-columns: 1fr; } }
.legend-list { display: flex; flex-direction: column; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-item .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item .nm { color: var(--kz-text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-item .vl { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; border-radius: 3px; background: #eef2f8; overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }

/* ------------------------------- 表格 ------------------------------- */
.el-table th.el-table__cell { background: #f7f9fc !important; color: var(--kz-text-2); font-weight: 600; }
.el-table .cell { line-height: 1.6; }
.cell-main { font-weight: 600; color: var(--kz-text); }
/* 被禁用的账号：名字标红，一眼看出来这个号现在用不了。
   注意只改颜色，不加删除线 —— 用户要的是「红色」，删除线看着像已删除。 */
.user-disabled { color: #f56c6c !important; }
.cell-sub { font-size: 12px; color: var(--kz-text-3); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-cell { cursor: pointer; }
.phone-cell:hover { color: var(--kz-primary); text-decoration: underline; }
/* 平台脱敏号（*******3854）：灰色 + 不给「点击拨号」的暗示，只提示去来客按尾号查 */
.masked-phone { color: #a2adbd; letter-spacing: .5px; }
/* 本地推账户的余额：有钱就绿色加粗，没钱走 text-muted */
.balance-ok { color: #17a673; font-weight: 600; }
.remark-cell { color: var(--kz-text-2); font-size: 12.5px; }
/* 内容链接：这条客资来自哪个抖音内容（短视频 / 直播间）。
   只有一个词（看视频 / 看直播），带个小的「新窗口」箭头，一眼知道点了会跳走。 */
.content-link { color: var(--kz-primary); cursor: pointer; text-decoration: none; white-space: nowrap; }
.content-link:hover { text-decoration: underline; }
.content-link::after { content: ' \2197'; font-size: 11px; }

.pagination-wrap { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ------------------------------- 其他 ------------------------------- */
.intent-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.empty-hint { text-align: center; color: var(--kz-text-3); padding: 40px 0; font-size: 13px; }
.remark-timeline { max-height: 380px; overflow-y: auto; padding-right: 6px; }
.remark-item { padding: 10px 0; border-bottom: 1px dashed var(--kz-border); }
.remark-item:last-child { border-bottom: none; }
.remark-item .top { display: flex; gap: 10px; font-size: 12px; color: var(--kz-text-3); margin-bottom: 5px; }
.remark-item .top b { color: var(--kz-text-2); font-weight: 600; }
.remark-item .txt { font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.remark-item.latest .txt { color: var(--kz-primary); font-weight: 500; }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--kz-border); border-radius: 6px; overflow: hidden; }
.detail-grid .it { padding: 10px 14px; border-bottom: 1px solid var(--kz-border); border-right: 1px solid var(--kz-border); font-size: 13px; }
.detail-grid .it .k { color: var(--kz-text-3); font-size: 12px; margin-bottom: 4px; }
.detail-grid .it .v { word-break: break-all; }
.detail-grid .it.full { grid-column: 1 / -1; border-right: none; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr 1fr; } }

.chat-box { max-height: 420px; overflow-y: auto; background: #f7f9fc; border-radius: 8px; padding: 14px; }
.chat-msg { margin-bottom: 12px; display: flex; }
.chat-msg .who { font-size: 12px; color: var(--kz-text-3); margin-bottom: 4px; }
.chat-msg .bubble { background: #fff; border: 1px solid var(--kz-border); padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.7; max-width: 78%; white-space: pre-wrap; word-break: break-word; }
.chat-msg.is-customer { justify-content: flex-end; }
.chat-msg.is-customer .bubble { background: #e8f1ff; border-color: #c5d8fb; }
.chat-plain { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.9; }

/* 完整聊天记录：客户在左、客服在右，跟微信/来客里的观感一致 */
.chat-thread { max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.chat-line { margin-bottom: 10px; }
.chat-meta { font-size: 11.5px; color: #97a3b6; margin-bottom: 3px; }
.chat-body {
  display: inline-block; max-width: 82%; padding: 7px 11px; border-radius: 8px;
  font-size: 13px; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
}
.chat-in .chat-body { background: #f1f3f7; color: #2c3e50; }
.chat-out { text-align: right; }
.chat-out .chat-body { background: #dff0d8; color: #24451f; text-align: left; }

/* 平台摘要（问 / 答一行一句）：跟完整对话分开摆，别让人误以为那就是聊天记录 */
.chat-sum { background: #f8fafd; border: 1px solid var(--kz-border); border-radius: 8px; padding: 10px 12px; }
.chat-sum-line { font-size: 13px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.chat-sum-line.q { color: #475569; }
.chat-sum-line.a { color: #1f2937; font-weight: 500; }
/* 「完整聊天记录还没收到」的说明块 */
.chat-empty {
  background: #fffbf2; border: 1px dashed #e6c891; border-radius: 8px;
  padding: 11px 13px; font-size: 12.5px; color: #7a5a22; line-height: 1.9;
}
.chat-empty b { color: #b3651c; }
.chat-empty .mono { font-family: Consolas, Monaco, monospace; background: #fdf0d8; padding: 0 4px; border-radius: 3px; }

.upload-area { border: 1px dashed #c5d2e4; border-radius: 10px; padding: 34px; text-align: center; background: #fafcff; cursor: pointer; transition: .2s; }
.upload-area:hover { border-color: var(--kz-primary); background: #f3f8ff; }
.upload-area .big { font-size: 34px; color: #9db8e6; }
.upload-area .t1 { font-size: 14px; margin: 10px 0 5px; }
.upload-area .t2 { font-size: 12.5px; color: var(--kz-text-3); }

.map-list { font-size: 13px; line-height: 2.1; }
.map-list .k { color: var(--kz-text-3); display: inline-block; min-width: 74px; }
.skip-list { max-height: 220px; overflow-y: auto; font-size: 12.5px; color: #b88230; line-height: 1.9; }

.code-block { background: #1f2a3c; color: #cfe0ff; padding: 12px 14px; border-radius: 8px; font-family: Consolas, Monaco, monospace; font-size: 12.5px; line-height: 1.8; overflow-x: auto; }

/* 表单字段的「从哪来」说明 */
.field-hint {
  margin-top: 6px; padding: 8px 11px; background: #f6f9ff; border-left: 3px solid #a9c5f5;
  border-radius: 0 6px 6px 0; font-size: 12.5px; color: #5b6b82; line-height: 1.85; width: 100%;
}
.field-hint b { color: #2f66d4; }
.field-hint .warn { color: #c4562f; }
.field-hint .mono { font-family: Consolas, Monaco, monospace; background: #eef3fc; padding: 0 4px; border-radius: 3px; }
.field-hint.hint-danger { background: #fff5f2; border-left-color: #f0a58a; }
.field-hint.hint-danger b { color: #c4562f; }

/* 「各账户的计划ID」：一个广告账号一行，左边账户ID右边计划ID输入框 */
.acct-plan-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.acct-plan-id {
  flex: 0 0 auto; min-width: 178px; font-size: 12.5px; color: #33475f;
  background: #f2f5fa; border: 1px solid #e2e8f2; border-radius: 4px;
  padding: 5px 8px; white-space: nowrap;
}
/* 手机上账户ID占太宽，换行显示 */
@media (max-width: 820px) {
  .acct-plan-row { flex-wrap: wrap; }
  .acct-plan-id { min-width: 0; width: 100%; }
}

/* 数据源警示条：模拟数据源时常驻显示 */
.source-warn {
  display: flex; gap: 11px; align-items: flex-start;
  background: #fff4f0; border: 1px solid #ffcdb8; border-left: 4px solid #f56c6c;
  border-radius: var(--kz-radius); padding: 13px 16px; margin-bottom: 16px;
  font-size: 13px; color: #a83b1c; line-height: 1.85;
}
.source-warn b { color: #c0392b; }.mono { font-family: Consolas, Monaco, monospace; font-size: 12.5px; }
.text-muted { color: var(--kz-text-3); }
.text-primary { color: var(--kz-primary); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0 !important; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.mb16 { margin-bottom: 16px; }
/* 小号说明文字（地推授权页的扫描窗口提示等） */
.tip-text { font-size: 12.5px; color: var(--kz-text-3); line-height: 1.9; }
/* 列表里那种「不严重但要提一下」的红字（扫描错误提示等） */
.warn-soft { color: #b3651c; }
/* 「授权通告」页顶部的标签栏，跟卡片之间留一点距离 */
.notice-tabs { margin-bottom: 2px; }
/* 商家授权卡片（来客客资中心页）：橙色描边，一眼看出「这里要你操作」 */
.auth-box {
  background: #fffdf7; border: 1px solid #f0d9a8; border-left: 3px solid #e6a23c;
  border-radius: 8px; padding: 12px 14px;
}
.flex { display: flex; } .flex-1 { flex: 1; } .items-center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.fade-enter-active, .fade-leave-active { transition: opacity .18s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
