/* YOBEL 客服助手 —— 冷灰钢底色 + 氩弧蓝操作色；状态色取自钨极端头色标（绿/金/红/灰） */
:root {
  --ink: #1f2a33;
  --ink-2: #4a5864;
  --ink-3: #7b8894;
  --line: #d6dce1;
  --line-2: #e6eaed;
  --paper: #eef1f3;
  --panel: #ffffff;
  --argon: #1f5fbf;
  --argon-ink: #174a96;
  --argon-wash: #e9f0fb;
  --tip-green: #2e8b57;
  --tip-green-wash: #e7f4ec;
  --tip-gold: #a9780a;
  --tip-gold-wash: #fbf3dd;
  --tip-red: #c0392b;
  --tip-red-wash: #fbeae8;
  --tip-grey: #8a949c;
  --num: "DIN Alternate", "Bahnschrift", "DIN", "Roboto Condensed", "Arial Narrow", sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --r-sm: 5px;
  --r-md: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--argon); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--argon); outline-offset: 2px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  height: 52px; padding: 0 20px;
  background: var(--ink); color: #dfe6eb;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: #fff; white-space: nowrap; }
.electrode { display: inline-flex; flex-direction: column; width: 6px; height: 22px; border-radius: 2px; overflow: hidden; background: #c9d1d7; }
.electrode i { display: block; height: 6px; }
.nav { display: flex; gap: 4px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.nav a {
  display: flex; align-items: center; padding: 0 12px; height: 100%;
  color: #b9c4cc; border-bottom: 2px solid transparent; white-space: nowrap;
}
.nav a:hover { color: #fff; text-decoration: none; }
.nav a.on { color: #fff; border-bottom-color: #8fb4f0; }
.nav .badge { margin-left: 6px; }
.topbar .spacer { flex: 1; }
.usermenu { position: relative; }
.usermenu > button { background: none; border: 0; color: #dfe6eb; cursor: pointer; font: inherit; padding: 6px 8px; border-radius: var(--r-sm); }
.usermenu > button:hover { background: rgba(255,255,255,.08); }
.menu { position: absolute; right: 0; top: 40px; min-width: 140px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 0; box-shadow: 0 8px 24px rgba(31,42,51,.16); }
.menu button { display: block; width: 100%; text-align: left; padding: 7px 14px; background: none; border: 0; font: inherit; cursor: pointer; color: var(--ink); }
.menu button:hover { background: var(--paper); }

/* ---------- 布局 ---------- */
.page { max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-body { padding: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--argon-ink); border-bottom-color: var(--argon); font-weight: 600; }

/* ---------- 表单 ---------- */
.field { display: block; }
.field > span.lb { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.field > .hint { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 7px 10px; transition: border-color .12s;
}
textarea { resize: vertical; line-height: 1.6; }
input:disabled, select:disabled, textarea:disabled { background: #f3f5f6; color: var(--ink-3); cursor: not-allowed; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--argon); box-shadow: 0 0 0 3px var(--argon-wash); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--argon); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 14px; font: inherit; color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--argon-wash); color: var(--argon-ink); font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; line-height: 1; white-space: nowrap;
  padding: 9px 14px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.btn:hover { border-color: #b7c1c9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--argon); border-color: var(--argon); color: #fff; }
.btn.primary:hover { background: var(--argon-ink); border-color: var(--argon-ink); }
.btn.danger { color: var(--tip-red); }
.btn.danger:hover { border-color: var(--tip-red); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--argon); padding: 6px 8px; }
.btn.ghost:hover { background: var(--argon-wash); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.kbd { font-family: var(--num); font-size: 11px; opacity: .75; }

/* ---------- 标签 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.green { background: var(--tip-green-wash); color: var(--tip-green); }
.badge.gold { background: var(--tip-gold-wash); color: var(--tip-gold); }
.badge.red { background: var(--tip-red-wash); color: var(--tip-red); }
.badge.blue { background: var(--argon-wash); color: var(--argon-ink); }
.badge.count { background: var(--tip-red); color: #fff; padding: 0 6px; font-family: var(--num); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl th { font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: #f8fafb; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f6f8fa; }
.tbl td.price, .tbl th.price { text-align: right; font-family: var(--num); white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: 13px; }

/* ---------- 回复助手 ---------- */
.assist { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
.assist .compose { position: sticky; top: 70px; }
.compose textarea.msg { min-height: 170px; font-size: 15px; }
.compose .actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.today { font-size: 12.5px; color: var(--ink-3); }
.today b { font-family: var(--num); font-weight: 600; color: var(--ink-2); font-size: 14px; }

.empty { padding: 42px 28px; text-align: center; color: var(--ink-3); }
.empty h3 { color: var(--ink-2); margin-bottom: 8px; }
.empty ul { display: inline-block; text-align: left; margin: 10px 0 0; padding-left: 18px; font-size: 13px; }

.thinking { padding: 28px 22px; color: var(--ink-2); }
.thinking .bar { height: 3px; border-radius: 2px; margin-top: 14px; background: linear-gradient(90deg, var(--argon) 0 30%, var(--line-2) 30%); background-size: 200% 100%; animation: arc 1.1s linear infinite; }
@keyframes arc { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.result-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.notice { border-radius: var(--r-sm); padding: 9px 12px; font-size: 13.5px; }
.notice.red { background: var(--tip-red-wash); color: #8e2a20; border-left: 4px solid var(--tip-red); }
.notice.gold { background: var(--tip-gold-wash); color: #6f4f05; border-left: 4px solid var(--tip-gold); }
.notice.blue { background: var(--argon-wash); color: var(--argon-ink); border-left: 4px solid var(--argon); }

details.adv { border-top: 1px solid var(--line-2); padding-top: 10px; }
details.adv > summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
details.adv > .stack { margin-top: 12px; }

/* 回复卡：左侧色条 = 钨极端头色标，表示把握程度 */
.reply { display: flex; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; overflow: hidden; }
.reply .tip { width: 7px; flex: none; background: var(--tip-grey); }
.reply.high .tip { background: var(--tip-green); }
.reply.medium .tip { background: var(--tip-gold); }
.reply.low .tip { background: var(--tip-red); }
.reply .body { flex: 1; padding: 12px 14px; min-width: 0; }
.reply textarea { border: 0; padding: 0; font-size: 15.5px; line-height: 1.7; resize: none; overflow: hidden; background: transparent; box-shadow: none !important; }
.reply .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.reply .label { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.reveal { animation: reveal .28s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: #fff; }
.chip.used { border-color: #9dbbe9; background: var(--argon-wash); color: var(--argon-ink); }

.order-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: #fbfcfd; }
.order-card .meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; margin-top: 8px; font-size: 13px; }
.order-card .meta span { color: var(--ink-3); margin-right: 6px; }

.section-title { font-size: 13px; color: var(--ink-3); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

/* ---------- 列表 / 问答 ---------- */
.list-item { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .q { font-weight: 600; }
.list-item .a { color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; }
.list-item.draft { background: #fffdf6; }

/* ---------- 进度 ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--argon); transition: width .3s; }

/* ---------- 微信客服 ---------- */
.wx { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.wx .customers { max-height: 70vh; overflow-y: auto; }
.wx .customer { padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.wx .customer:hover { background: #f6f8fa; }
.wx .customer.on { background: var(--argon-wash); }
.timeline { max-height: 60vh; overflow-y: auto; padding: 14px 16px; background: #f7f9fa; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.bubble.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.bubble.out { align-self: flex-end; background: var(--argon-wash); }
.bubble.servicer { align-self: flex-end; background: var(--tip-green-wash); }
.bubble.event { align-self: center; background: none; color: var(--ink-3); font-size: 12px; padding: 0; }
.bubble .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.status-cell { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: #fff; }
.status-cell b { display: block; font-size: 15px; }
.status-cell.ok b { color: var(--tip-green); }
.status-cell.bad b { color: var(--tip-red); }
.copyline { display: flex; gap: 8px; align-items: center; }
.copyline code { flex: 1; font-family: var(--num); background: var(--paper); padding: 7px 10px; border-radius: var(--r-sm); overflow-x: auto; white-space: nowrap; }

/* ---------- 弹窗 / 提示 ---------- */
.mask { position: fixed; inset: 0; background: rgba(31,42,51,.42); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 640px; background: #fff; border-radius: 10px; box-shadow: 0 18px 48px rgba(31,42,51,.28); }
.modal.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-head .x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); padding: 2px 6px; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.toasts { position: fixed; top: 64px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: var(--r-sm); font-size: 13.5px; box-shadow: 0 6px 18px rgba(31,42,51,.25); max-width: 360px; }
.toast.err { background: var(--tip-red); }
.toast.ok { background: var(--tip-green); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 380px; }
.login .brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login .tips { display: flex; gap: 5px; margin: 14px 0 22px; }
.login .tips i { width: 30px; height: 5px; border-radius: 2px; }

/* ---------- 导入映射 ---------- */
.map-table th select { min-width: 120px; font-size: 12.5px; padding: 4px 6px; font-weight: 400; }
.map-table td { font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 960px) {
  .assist, .wx { grid-template-columns: 1fr; }
  .assist .compose { position: static; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand .name { display: none; }
  .page { padding: 12px 10px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 8px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
