:root {
  --bg: #f5f6f9;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;

  /* 品牌蓝：链接、选中态、焦点 */
  --accent: #2563eb;
  --accent-soft: #eff5ff;
  --accent-ink: #1d4ed8;

  /* 暖橙金：主按钮、强调渐变 */
  --brand-orange: #e8541f;
  --brand-gold: #f5a623;
  --brand-grad: linear-gradient(135deg, #e8541f 0%, #f59e0b 58%, #f5b731 100%);

  /* 深蓝侧栏 */
  --navy: #131f4b;
  --navy-2: #1d2f66;

  /* WhatsApp 通道本色（保留） */
  --wa: #128c7e;
  --wa-soft: #e6f6f1;

  --warn: #b54708;
  --warn-soft: #fef0c7;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --blue-soft: #e8f0fe;
  --blue-ink: #1d4ed8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px -12px rgba(16,24,40,.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 500px at 12% 0%, #fde8d4 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 100%, #dbe6ff 0%, transparent 55%),
    #f4f6f8;
}
.login-card {
  width: 100%; max-width: 396px; background: #fff; border-radius: 20px; padding: 34px 32px 28px;
  box-shadow: 0 30px 80px -40px rgba(16,24,40,.4), 0 1px 0 rgba(16,24,40,.04);
  border: 1px solid rgba(16,24,40,.05);
}
.brand-row { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.brand-mark {
  width: 42px; height: 42px; flex: 0 0 42px; display: block;
}
.brand-mark img {
  width: 100%; height: 100%; display: block; object-fit: cover;
}
.brand-name { font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.login-title { font-size: 21px; font-weight: 650; margin: 0 0 6px; }
.login-desc { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: #475467; margin-bottom: 6px; font-weight: 550; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.textarea { resize: vertical; min-height: 82px; line-height: 1.6; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 14px;
  background: #fff; color: var(--ink); font-weight: 550; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(232,84,31,.55); }
.btn.primary:hover { filter: brightness(.96); box-shadow: 0 8px 18px -8px rgba(232,84,31,.65); }
.btn.ghost { border-color: var(--line); color: #344054; }
.btn.ghost:hover { background: #f9fafb; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.btn.wa { background: var(--wa); color: #fff; }
.btn.wa:hover { background: #0f7a6d; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; padding: 10px 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.login-hint b { color: #344054; font-weight: 600; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 232px; flex: 0 0 232; padding: 18px 14px; color: #c7d0ea;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side .brand-row { padding: 4px 8px 18px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side .brand-name { color: #fff; font-size: 15px; }
.side .brand-sub { color: #93a0c4; font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; color: #aab4d4; padding: 9px 11px; border-radius: 9px; font-size: 13.5px;
}
.nav button .ico { width: 18px; text-align: center; opacity: .85; font-size: 15px; }
.nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav button.active { background: var(--brand-grad); color: #fff; font-weight: 600; box-shadow: 0 6px 14px -8px rgba(232,84,31,.6); }
.nav button.active .ico { opacity: 1; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.me-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #2a3c78; color: #dbe3ff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 30px;
}
.me-name { font-size: 12.5px; color: #fff; line-height: 1.3; }
.me-role { font-size: 11px; color: #93a0c4; }
.side-links { display: flex; gap: 6px; padding: 8px 8px 0; }
.side-links button {
  background: transparent; border: 1px solid rgba(255,255,255,.16); color: #aab4d4;
  font-size: 11.5px; padding: 5px 9px; border-radius: 7px;
}
.side-links button:hover { color: #fff; border-color: rgba(255,255,255,.35); }

.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 650; margin: 0 0 4px; letter-spacing: -.2px; }
.page-sub { color: var(--muted); font-size: 12.5px; margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / stats ---------- */
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.stat .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.7px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat.warn .value { color: var(--warn); }
.two-col { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title h3 { font-size: 14px; font-weight: 650; margin: 0; }
.card-title .hint { font-size: 11.5px; color: var(--muted); }

.funnel { display: flex; flex-direction: column; gap: 9px; }
.funnel-row { display: grid; grid-template-columns: 78px 1fr 34px; align-items: center; gap: 10px; font-size: 12.5px; }
.funnel-row .name { color: #475467; }
.bar { height: 8px; border-radius: 999px; background: #f1f3f6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #2563eb); }
.funnel-row .num { text-align: right; color: #344054; font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 600; color: #475467; font-size: 11.5px; letter-spacing: .3px;
  text-transform: uppercase; background: #fbfcfd; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid #f1f3f6; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #fafcfb; }
.cell-company { font-weight: 600; color: #101828; }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 26px; display: block; margin-bottom: 8px; opacity: .5; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 550; white-space: nowrap; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #f2f4f7; color: #475467; font-size: 11px; margin-right: 4px; }
.stage-lead { background: #f2f4f7; color: #475467; }
.stage-contacted { background: #eef4ff; color: #3538cd; }
.stage-inquiry { background: #fff6e6; color: #b54708; }
.stage-quoted { background: #f4ecff; color: #6941c6; }
.stage-sample { background: #e6f0ff; color: #1d4ed8; }
.stage-negotiation { background: #fdeef5; color: #c11574; }
.stage-won { background: #e7f7ef; color: #067647; }
.stage-lost { background: #feeceb; color: #b42318; }
.owner-chip { font-size: 11.5px; color: #475467; }
.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.row-actions { text-align: right; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap .input { padding-left: 32px; }
.search-wrap .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 13px; }
.toolbar .select { width: auto; min-width: 108px; padding-right: 26px; }

/* ---------- drawer ---------- */
.drawer-back {
  position: fixed; inset: 0; background: rgba(16,24,40,.34); backdrop-filter: blur(1.5px);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40;
}
.drawer-back.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw); background: #fff; z-index: 41;
  transform: translateX(102%); transition: transform .22s cubic-bezier(.3,.7,.3,1);
  display: flex; flex-direction: column; box-shadow: -20px 0 50px -30px rgba(16,24,40,.5);
}
.drawer.show { transform: none; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h2 { font-size: 16.5px; margin: 0 0 3px; font-weight: 650; }
.drawer-head .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.drawer-close { margin-left: auto; background: none; border: 0; font-size: 20px; color: #98a2b3; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.drawer-close:hover { background: #f2f4f7; color: #344054; }
.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; padding: 10px 12px; font-size: 13px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.section-label { font-size: 11.5px; font-weight: 600; color: #667085; letter-spacing: .4px; text-transform: uppercase; margin: 4px 0 10px; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: #eef1f4; }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -19px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
}
.tl-item.msg::before { border-color: var(--accent); }
.tl-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.tl-body { margin-top: 4px; font-size: 13px; color: #344054; white-space: pre-wrap; word-break: break-word; }
.tl-item.in .tl-body { background: var(--accent-soft); padding: 8px 11px; border-radius: 10px; }
.tl-item.out .tl-body { background: #f8fafc; padding: 8px 11px; border-radius: 10px; border: 1px solid #eef1f4; }

.quick-box { background: #f7f9fe; border: 1px solid #e3e8f5; border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }

/* ---------- whatsapp ---------- */
.wa-layout { display: grid; grid-template-columns: 316px minmax(0, 1fr) 278px; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; height: calc(100vh - 150px); min-height: 480px; }
.inbox-layout { height: calc(100vh - 64px); min-height: 420px; }
.wa-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #fdfdff; }
.wa-side { border-left: 1px solid var(--line); min-height: 0; background: #fafbfe; overflow: hidden; }
.wa-side .side-scroll { height: 100%; overflow-y: auto; padding: 0 0 16px; }
.wa-side .side-empty { color: #98a2b3; font-size: 12px; text-align: center; padding: 28px 16px; }
/* 客户信息卡 */
.cust-card { background: #fff; border-bottom: 10px solid #f3f5f9; padding: 16px 16px 14px; }
.cust-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cust-avatar { width: 52px; height: 52px; font-size: 18px; flex: 0 0 auto; }
.cust-head { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cust-name { font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-rows { display: flex; flex-direction: column; gap: 1px; }
.cust-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed #eef1f5; }
.cust-row:last-child { border-bottom: none; }
.cust-ico { width: 18px; flex: 0 0 auto; text-align: center; font-size: 13px; }
.cust-label { flex: 0 0 44px; color: #98a2b3; font-weight: 600; }
.cust-val { flex: 1; min-width: 0; color: #344054; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }

/* 客户行业模块 */
.cust-industry { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef1f5; }
.cust-industry-title { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.cust-industry-input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  font-size: 12.5px; outline: none; background: #fff;
}
.cust-industry-input:focus { border-color: var(--wa); box-shadow: 0 0 0 3px rgba(18,140,126,.12); }
.cust-industry-input[readonly] { background: #f7f8fa; color: #667085; cursor: default; }
.cust-industry-hint { font-size: 10.5px; color: #98a2b3; margin-top: 6px; }

/* 客户备注模块 */
.cust-remark { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef1f5; }
.cust-remark-title { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.cust-remark-body {
  font-size: 12px; line-height: 1.6; color: #1d4ed8; word-break: break-word; white-space: pre-wrap;
  background: var(--accent-soft); border: 1px solid #dbe6fe; border-radius: 9px; padding: 8px 10px;
}
.cust-remark-none { font-size: 11.5px; color: #98a2b3; border: 1px dashed #d5dbe4; border-radius: 9px; padding: 8px 10px; }

.side-card { background: #fff; border-bottom: 10px solid #f3f5f9; padding: 14px 16px; }
.side-card-title { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.side-qr-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.side-qr { display: flex; align-items: center; gap: 6px; }
.side-qr-use { flex: 1; text-align: left; font-size: 12px; color: var(--ink); background: #f4f7ff; border: 1px solid #e6edfb; border-radius: 8px; padding: 7px 10px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-qr-use:hover { background: var(--accent-soft); border-color: #c9dcff; }
.side-qr-del, .side-asset-del { border: 0; background: none; color: #b8c0cc; cursor: pointer; font-size: 15px; padding: 2px 4px; }
.side-qr-del:hover, .side-asset-del:hover { color: #e11d48; }
.side-asset-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.side-asset { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.side-asset a { flex: 1; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-asset a:hover { color: #1d4ed8; }
.side-upload-btn { width: 100%; justify-content: center; cursor: pointer; }
@media (max-width: 1180px) {
  .wa-layout { grid-template-columns: 248px minmax(0, 1fr) 228px; }
}
@media (max-width: 700px) {
  .wa-layout { grid-template-columns: 1fr; height: auto; }
  .wa-side { display: none; }
}
.wa-list-tabs { padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fdfdff; }
.wa-list-tabs .inbox-tabs { margin-bottom: 0; gap: 6px; flex-wrap: nowrap; }
.wa-list-tabs .inbox-tab { flex: 1 1 0; padding: 8px 6px; justify-content: center; display: inline-flex; align-items: center; white-space: nowrap; }
.wa-list-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.wa-list-body { overflow-y: auto; flex: 1; }
.conv { padding: 11px 14px; border-bottom: 1px solid #f2f4f7; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.conv:hover { background: #f4f7ff; }
.conv.active { background: var(--accent-soft); }
.conv .avatar { background: #dbe7ff; color: #1d4ed8; }
.conv .avatar.small { width: 34px; height: 34px; flex: 0 0 34px; font-size: 12px; }
.conv-main { min-width: 0; flex: 1; }
.conv-name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.conv-name .time { font-size: 10.5px; color: #98a2b3; font-weight: 400; white-space: nowrap; }
.conv-prev { font-size: 11.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread { background: var(--accent); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 6px; margin-left: 6px; }

/* WhatsApp 风格未读：圆形数字角标 + 未读会话加粗 */
.conv-name .conv-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv.has-unread .conv-name .nm { font-weight: 700; color: var(--ink); }
.conv.has-unread .conv-prev { color: var(--ink); font-weight: 500; }
.unread-badge {
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 1;
}
/* 更多操作按钮 */
.card-more {
  width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px;
  background: transparent; color: #98a2b3; font-size: 15px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.card-more:hover { background: #e7edfb; color: var(--accent); }
.pin-flag { font-size: 11px; line-height: 1; }
.conv.is-pinned { background: #f7f9ff; }
/* 浮动操作菜单 */
.card-menu {
  position: fixed; z-index: 1200; min-width: 224px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16,24,40,.16); padding: 6px;
}
.cm-tags { padding: 4px 6px 8px; }
.cm-tags-title { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.cm-tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: #344054; background: #f2f4f7; border: 1px solid #e4e7ec; border-radius: 999px; padding: 3px 8px 3px 10px; }
.cm-tag button { border: 0; background: none; color: #98a2b3; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.cm-tag button:hover { color: #e11d48; }
.cm-tag-add { width: 26px; height: 26px; flex: 0 0 26px; border: 1px dashed #b8c0cc; background: #fff; color: #667085; border-radius: 999px; cursor: pointer; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.cm-tag-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cm-tag-input-wrap { margin-top: 8px; }
.cm-tag-input-wrap .input { font-size: 12px; padding: 7px 10px; }
.cm-divider { height: 1px; background: var(--line); margin: 2px 2px 6px; }
.cm-item {
  width: 100%; border: none; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--ink);
  cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.cm-item:hover { background: var(--accent-soft); color: var(--accent); }
.cm-item.danger { color: var(--danger); }
.cm-item.danger:hover { background: var(--danger-soft); }

/* 菜单内客户分层快捷标签 */
.cm-tier { padding: 4px 6px 8px; }
.cm-tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cm-tier-tag {
  border: 1px solid color-mix(in srgb, var(--tc) 35%, #fff); background: #fff;
  color: var(--tc); border-radius: 999px; padding: 5px 4px; font-size: 11.5px;
  font-weight: 700; cursor: pointer; text-align: center; line-height: 1;
}
.cm-tier-tag:hover { background: color-mix(in srgb, var(--tc) 12%, #fff); }
.cm-tier-tag.on { background: var(--tc); color: #fff; }
.cm-tier-tag.neg { --tc: #f97316; }
.cm-tier-tag.locked { cursor: not-allowed; opacity: .65; }
.cm-tier-hint { font-size: 10.5px; color: #98a2b3; margin-top: 7px; }

.wa-panel { display: flex; flex-direction: column; min-height: 0; }
.wa-panel-head { padding: 11px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wa-panel-head .info { flex: 1 1 180px; min-width: 0; }
.wa-panel-head .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-panel-head .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-body { flex: 1; overflow-y: auto; padding: 18px 16px; background: #f4f6fb; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble-row { display: flex; }
.bubble-row.out { justify-content: flex-end; }
.bubble {
  max-width: min(72%, 520px); padding: 9px 12px; border-radius: 14px; background: #fff; font-size: 13px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05); white-space: pre-wrap; word-break: break-word;
}
.bubble-row.out .bubble { background: #d9fdd3; border-bottom-right-radius: 4px; }
.bubble-row.in .bubble { border-bottom-left-radius: 4px; }
.bubble-meta { font-size: 10.5px; color: #98a2b3; margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.bubble-row.out .bubble-meta { justify-content: flex-end; }
.msg-failed { color: var(--danger); }
.ticks { font-size: 11px; color: #98a2b3; letter-spacing: -1.5px; line-height: 1; }
.ticks.tick-read { color: #53bdeb; }
/* 发送中：气泡保持正常，只在下方显示一个很小的转圈提示 */
.msg-pending { color: #98a2b3; font-size: 10px; display: inline-flex; align-items: center; gap: 4px; font-style: normal; }
.msg-pending::before {
  content: ''; width: 8px; height: 8px; border: 1.5px solid #cbd2dc; border-top-color: #6b7684;
  border-radius: 50%; animation: ms-spin .7s linear infinite;
}
@keyframes ms-spin { to { transform: rotate(360deg); } }
.wa-compose { border-top: 1px solid var(--line); padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.composer-box {
  border: 1px solid var(--line); border-radius: 14px; background: #fbfcfd;
  transition: border-color .15s, box-shadow .15s; overflow: hidden;
}
.composer-box:focus-within { border-color: var(--wa); box-shadow: 0 0 0 3px rgba(18,140,126,.10); background: #fff; }
.composer-input {
  width: 100%; border: none; outline: none; background: transparent; resize: none;
  padding: 11px 14px 4px; min-height: 52px; max-height: 150px; font-size: 14px; line-height: 1.5;
}
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; }
.composer-tools { display: flex; gap: 2px; }
.ct-btn {
  width: 36px; height: 36px; border: none; background: transparent; border-radius: 9px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #667085; transition: background .15s, color .15s;
}
.ct-btn:hover { background: #e9f3f1; color: var(--wa); }
.ct-btn:active { background: #d8e9e6; }
.ct-ico { width: 21px; height: 21px; }
.composer-send { min-width: 72px; border-radius: 10px; }

/* 待发图片预览条 */
.img-preview { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: #fafbfc; border-radius: 12px; padding: 8px 10px; }
.img-preview img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.imgpv-doc { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; }
.imgpv-doc .doc-ico { width: 46px; height: 46px; font-size: 13px; }
.imgpv-info { flex: 1; min-width: 0; }
.imgpv-name { font-size: 13px; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imgpv-cancel { flex: 0 0 auto; width: 26px; height: 26px; border: none; background: #eef0f3; border-radius: 50%; cursor: pointer; font-size: 15px; color: #667085; }
.imgpv-cancel:hover { background: #e2e6ea; color: #d92d20; }

/* 图片气泡 */
.bubble-media { padding: 4px; overflow: hidden; min-width: 150px; }
.bubble-media img { display: block; max-width: 260px; max-height: 300px; border-radius: 9px; object-fit: cover; }
.media-cap { padding: 6px 8px 2px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* 文档气泡（报价单 PDF） */
.bubble-doc { display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 300px; }
.doc-ico {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 9px; background: #d64545; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-cap { font-size: 12px; color: #4b5563; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

/* 语音气泡 */
.bubble-audio { min-width: 210px; max-width: 300px; }
.audio-head { display: flex; align-items: center; gap: 8px; }
.audio-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(18,140,126,.14); display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.audio-tag { font-size: 12px; font-weight: 600; color: #0f766e; }
.audio-transcript {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(15,23,42,.08);
  font-size: 13px; color: #1f2937; white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}
.audio-pending { margin-top: 8px; font-size: 12px; color: #94a3b8; }
.bubble.out .audio-ico { background: rgba(255,255,255,.22); }
.bubble.out .audio-tag { color: #ecfeff; }
.bubble.out .audio-transcript { border-top-color: rgba(255,255,255,.25); color: #fff; }
.bubble.out .audio-pending { color: rgba(255,255,255,.75); }

/* 拖入图片高亮 */
.wa-panel.drag-over { outline: 2px dashed var(--wa); outline-offset: -6px; background: rgba(18,140,126,.06); }
.wa-panel.drag-over::after {
  content: "松开鼠标，载入文件";
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18,140,126,.10); color: var(--wa);
  font-size: 18px; font-weight: 700; pointer-events: none;
}
.wa-panel { position: relative; }

/* 图片目录弹层 */
.img-catalog-overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,.42); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.img-catalog {
  width: min(680px, 94vw); max-height: 82vh; background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 48px rgba(16,24,40,.28);
}
.ic-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px;
}
.ic-close { width: 30px; height: 30px; border: none; background: #f1f3f6; border-radius: 50%; cursor: pointer; font-size: 17px; color: #667085; }
.ic-close:hover { background: #e4e7eb; color: #d92d20; }
.ic-grid {
  padding: 16px 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  overflow-y: auto; align-content: start;
}
.ic-cell {
  border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; cursor: pointer;
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ic-cell:hover { border-color: var(--wa); box-shadow: 0 0 0 3px rgba(18,140,126,.12); }
.ic-cell img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.ic-empty { grid-column: 1 / -1; text-align: center; color: #667085; padding: 40px 0; line-height: 1.8; }
.notice {
  font-size: 11.5px; color: #667085; background: #fbfaf5; border: 1px solid #f2ecd8;
  padding: 8px 11px; border-radius: 9px; margin-bottom: 12px; line-height: 1.6;
}
.notice.warn { background: #fefcf3; border-color: #f7e6b0; color: #8a5a06; }
.notice.ok { background: #f2fbf7; border-color: #cdeee0; color: #0a6b57; }
.chat-empty { display: grid; place-items: center; height: 100%; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- settings ---------- */
.settings-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.kv { display: grid; grid-template-columns: 118px 1fr; gap: 8px 12px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { color: #344054; word-break: break-all; }
.code-line { font-family: Consolas, "Courier New", monospace; background: #f8fafc; border: 1px solid #eef1f4; padding: 7px 10px; border-radius: 8px; font-size: 11.5px; word-break: break-all; }
.steps { margin: 0; padding-left: 18px; font-size: 12.5px; color: #475467; line-height: 1.85; }
.steps li::marker { color: var(--accent); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(16,24,40,.36); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal { width: min(520px, 96vw); background: #fff; border-radius: 16px; padding: 22px 24px; box-shadow: 0 30px 70px -30px rgba(16,24,40,.5); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 4px; font-size: 16px; }
.modal .desc { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- 客户合并 ---------- */
.merge-section { margin-top: 14px; }
.merge-section-title { font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 8px; }
.merge-empty { font-size: 12.5px; color: var(--muted); background: #f8fafc; border-radius: 10px; padding: 12px; }
.merge-pair { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.merge-pair-cust { display: flex; flex-direction: column; gap: 8px; }
.merge-keep { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; border-radius: 8px; padding: 6px 8px; transition: background .15s; }
.merge-keep:hover { background: #f1f5f9; }
.merge-keep input { margin-top: 4px; }
.merge-cust { flex: 1; min-width: 0; }
.merge-cust-name { font-size: 13px; font-weight: 600; color: #1f2937; }
.merge-cust-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.merge-pair-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-left: 26px; }
.merge-manual { display: flex; flex-direction: column; gap: 8px; }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  background: #101828; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 12.5px;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); max-width: 360px; animation: pop .18s ease-out;
}
.toast.err { background: #912018; }
.toast.ok { background: #0a6b57; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- utility ---------- */
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .side { width: 64px; flex: 0 0 64px; padding: 12px 8px; }
  .side .brand-name, .side .brand-sub, .nav button span.lbl, .me-name, .me-role, .side-links { display: none; }
  .nav button { justify-content: center; padding: 11px 0; }
  .nav button .ico { font-size: 17px; }
  .main { padding: 16px 14px 30px; }
}

/* ---------- 扫码登录 / 自动翻译 ---------- */
.qr-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr-img { width: 216px; height: 216px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 8px; }
.qr-tip { flex: 1; min-width: 190px; }
.qr-idle { text-align: center; padding: 16px 8px; }
.qr-connected { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.qr-wait { display: flex; gap: 12px; align-items: center; padding: 18px 6px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: qrspin .9s linear infinite; }
@keyframes qrspin { to { transform: rotate(360deg); } }
.switch-row { padding: 5px 0; }
.switch-row label { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13.5px; }
.tr-test-out { margin-top: 8px; min-height: 22px; line-height: 1.7; }
.bubble-tr { margin-top: 5px; padding-top: 5px; border-top: 1px dashed rgba(0,0,0,.14); font-size: 12.5px; color: #4b5575; line-height: 1.55; max-width: 78%; }
.tr-tag { display: inline-block; background: var(--accent-soft); color: #1d4ed8; border-radius: 4px; padding: 0 5px; margin-right: 5px; font-size: 11px; }

/* ---------- inbox 收件箱 ---------- */
.inbox-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.inbox-tab {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; color: #344054; min-height: 38px;
}
.inbox-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.inbox-tab .tab-n {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  background: rgba(16,24,40,.08); border-radius: 999px; font-size: 11px; margin-left: 6px;
}
.inbox-tab.active .tab-n { background: rgba(255,255,255,.25); color: #fff; }
.inbox-tip { font-size: 11.5px; color: var(--muted); margin-left: auto; }

.conv-owner { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.owner-dot { width: 7px; height: 7px; border-radius: 50%; background: #c3ccd2; flex: none; }
.owner-dot.p { background: #d97706; }
.owner-dot.m { background: var(--accent); }
.conv-remark {
  font-size: 11px; color: #1d4ed8; margin-top: 5px; padding: 4px 8px;
  background: var(--accent-soft); border: 1px solid #dbe6fe; border-radius: 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px;
  font-size: 10.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.chip.pool { background: #fff4e0; color: #b45309; border-color: #f3ddba; }
.chip.notice { background: #eaf2ff; color: #1d4ed8; border-color: #d2e0fb; }
.chip.unread { background: #e6f0ff; color: #1d4ed8; border-color: #cfe0ff; }
.chip.wait { background: #fef3c7; color: #92610a; border-color: #f6e3a2; }
.chip.over { background: #fee4e2; color: #b42318; border-color: #fecdd3; }

/* 客户信息小标签（左侧卡片） */
.itag {
  display: inline-flex; align-items: center; border-radius: 6px; padding: 1px 6px;
  font-size: 10px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.itag.country { background: #f0f4ff; color: #3550a8; border-color: #dde6fb; }
.itag.lang { background: #f3f0ff; color: #6a3fb5; border-color: #e4dcfb; }
.itag.tag { background: #f4f6f8; color: #475467; border-color: #e3e8ef; }
.itag.stage { color: #fff; }
.itag.st-stlead { background: #64748b; }
.itag.st-contacted { background: #0ea5e9; }
.itag.st-inquiry { background: #f59e0b; }
.itag.st-quoted { background: #8b5cf6; }
.itag.st-sample { background: #14b8a6; }
.itag.st-negotiation { background: #f97316; }
.itag.st-won { background: #16a34a; }
.itag.st-lost { background: #ef4444; }

.inbox-scroll { flex: 1; overflow-y: auto; padding: 16px; background: #f4f6fb; min-height: 0; }

.tf-strip { flex: none; }
.tf-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 16px; background: #f7f9fe; border-bottom: 1px solid var(--line);
  font-size: 12px; color: #344054;
}
.tf-note { color: #8a5a06; background: #fef6e3; border: 1px solid #f3e4bd; border-radius: 8px; padding: 2px 8px; }

.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center;
  background: #e5484d; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700;
}

.modal-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.mb12 { margin-bottom: 12px; }

@media (max-width: 700px) {
  .inbox-layout { height: auto; }
  .inbox-layout .wa-list { display: flex; border-right: 0; border-bottom: 1px solid var(--line); max-height: 320px; }
  .inbox-layout .chat-empty { min-height: 200px; height: auto; }
  .inbox-tip { margin-left: 0; width: 100%; }
}

/* ================= 报价单：编辑器 ================= */
.modal:has(#q-items) { width: min(1080px, 96vw); }
.q-block {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.q-seller-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 8px; }
.q-seller-grid .field { margin-bottom: 0; }
.q-seller-bank { grid-column: 1 / -1; }

/* 产品卡片 */
.q-item-card {
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px;
  background: #fff; overflow: hidden;
}
.qic-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.qic-no { font-weight: 600; font-size: 13px; color: var(--ink); }
.qic-body { display: flex; gap: 16px; padding: 14px; align-items: flex-start; }
.qic-img {
  position: relative;
  width: 132px; flex: 0 0 132px; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.qic-img .q-img {
  width: 132px; height: 132px; object-fit: contain; border: 1px solid var(--line);
  border-radius: 10px; background: #fff;
}
.qic-img.drag-over {
  outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 10px;
  background: rgba(37, 99, 235, .08);
}
.qic-img.drag-over::after {
  content: '松开以放入图片'; position: absolute; font-size: 11px; color: var(--accent); font-weight: 600;
}
.q-img-add {
  width: 132px; height: 40px; border: 1px dashed #9ca3af; background: #fff; border-radius: 10px;
  color: var(--muted); font-size: 13px;
}
.q-img-add:hover { border-color: var(--accent); color: var(--accent); }
.q-img-rm {
  border: none; background: none; color: var(--danger); font-size: 12px; cursor: pointer;
}
.qic-fields { flex: 1; min-width: 0; }
.qic-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.qic-line label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.qic-line .qic-span2 { grid-column: span 2; }
.qic-line .input { width: 100%; padding: 8px 10px; }
.q-amount { background: #f3f4f6; font-weight: 600; color: var(--ink); }
.q-del {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  color: var(--danger); font-size: 12.5px; padding: 4px 12px;
}
.q-del:hover { background: var(--danger-soft); }

/* 包装汇总 */
.q-pack-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #f8fafc;
}
.q-pack-summary div { display: flex; flex-direction: column; gap: 4px; }
.q-pack-summary span { font-size: 11.5px; color: var(--muted); }
.q-pack-summary b { font-size: 16px; color: var(--accent-ink); }

.q-meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.q-total { font-size: 15px; }
.q-total b { color: var(--accent-ink); font-size: 18px; }

/* ================= 报价单：预览浮层 ================= */
.quote-overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(16,24,40,.55);
  display: flex; flex-direction: column; align-items: center; padding: 22px;
}
.quote-toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.quote-scroll { overflow-y: auto; width: 100%; display: flex; justify-content: center; }
.quote-sheet {
  width: 794px; max-width: 100%; background: #fff; color: #1f2937;
  border-radius: 6px; padding: 40px 40px; box-shadow: 0 24px 60px -24px rgba(0,0,0,.5);
  margin-bottom: 24px;
}

/* ---------- A4 单据内容 ---------- */
.qs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.qs-brand { display: flex; gap: 12px; align-items: flex-start; }
.qs-brand img { width: 52px; height: 52px; object-fit: contain; }
.qs-company { font-size: 17px; font-weight: 700; }
.qs-addr { font-size: 12px; color: #6b7280; margin-top: 2px; }
.qs-title {
  font-size: 22px; font-weight: 800; text-align: right; line-height: 1.25;
  color: #111827; letter-spacing: 1px;
}
.qs-meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 22px 0 14px; padding: 12px 14px; background: #f3f4f6; border-radius: 10px; font-size: 12.5px;
}
.qs-beneficiary {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px;
}
.qs-beneficiary b { font-size: 12.5px; display: block; margin-bottom: 6px; }
.qs-beneficiary div { font-size: 12.5px; }
.qs-light { color: #6b7280; font-size: 12px !important; line-height: 1.6; margin-top: 4px; }
.qs-spec-line { font-size: 11.5px; color: #6b7280; margin-top: 2px; }

.qs-table { width: 100%; border-collapse: collapse; }
.qs-table th, .qs-table td {
  border: 1px solid #d1d5db; padding: 8px 9px; font-size: 12px;
}
.qs-table th { background: #f9fafb; font-weight: 600; text-align: left; }
.qs-table .c { text-align: center; white-space: nowrap; }
.qs-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qs-img-cell { width: 44px; min-width: 44px; }
.qs-pimg { width: 40px; height: 40px; object-fit: contain; display: block; margin: 0 auto; }

/* 合并后的统一宽表：紧凑显示，每个产品一行，强制在 A4 内排下 */
.qs-unified { table-layout: auto; }
.qs-unified th, .qs-unified td { padding: 4px 4px; font-size: 10px; }
.qs-unified th { font-size: 9.5px; white-space: normal; text-align: center; line-height: 1.25; }
.qs-unified td:nth-child(3) { white-space: normal; min-width: 84px; }
.qs-unified tfoot td { background: #f3f4f6; font-size: 10px; white-space: normal; }
.qs-total { text-align: right; font-size: 14px; margin: 14px 2px 16px; }
.qs-total b { font-size: 17px; color: #111827; }
.qs-terms { font-size: 12.5px; line-height: 1.9; }
.qs-note { font-size: 12.5px; line-height: 1.7; margin-top: 10px; color: #374151; }
.qs-sign { margin-top: 34px; }
.qs-sign-line { width: 240px; border-top: 1px solid #6b7280; margin-bottom: 6px; }
.qs-sign-name { font-size: 12.5px; font-weight: 600; }
.qs-sign div:last-child { font-size: 11.5px; color: #6b7280; margin-top: 2px; }

@media (max-width: 700px) {
  .q-seller-grid, .q-meta-grid, .q-pack-summary, .qs-meta { grid-template-columns: 1fr; }
  .qic-body { flex-direction: column; }
  .qic-img { width: 100%; flex-basis: auto; }
  .quote-sheet { padding: 28px 22px; }
}

/* ---------- 打印：只输出 A4 单据 ---------- */
@media print {
  body * { visibility: hidden; }
  #quote-sheet, #quote-sheet * { visibility: visible; }
  #quote-sheet {
    position: absolute; left: 0; top: 0; width: 100%;
    margin: 0; border-radius: 0; box-shadow: none;
  }
}

/* ================= 销售员客户生命周期（圆形标签） ================= */
/* 顶部圆形统计 */
.sum-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 20px; }
.sum-card { display: flex; flex-direction: column; align-items: center; gap: 8px; border: none; background: none; cursor: pointer; }
.sum-circle {
  width: 58px; height: 58px; border-radius: 50%; background: var(--tc); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800;
  transition: transform .12s, box-shadow .15s;
}
.sum-card:hover .sum-circle { transform: translateY(-2px); box-shadow: 0 8px 18px color-mix(in srgb, var(--tc) 35%, transparent); }
.sum-card.active .sum-circle { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 20%, transparent); }
.sum-label { font-size: 12px; font-weight: 600; color: #475467; }

/* 客户卡片 */
.lc-list { display: flex; flex-direction: column; gap: 14px; }
.lc-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.lc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.lc-avatar { width: 46px; height: 46px; flex: 0 0 auto; }
.lc-id { flex: 1; min-width: 0; }
.lc-name { font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-sub { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-amount { font-weight: 700; color: #0f766e; font-size: 14px; }

/* 圆形步进器 */
.lc-stepper { display: flex; align-items: center; flex-wrap: nowrap; }
.lc-circle {
  width: 56px; height: 56px; flex: 0 0 auto; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--tc); font-size: 13px; font-weight: 800; line-height: 1.1;
  display: flex; align-items: center; justify-content: center; text-align: center;
  transition: transform .12s, box-shadow .15s;
}
.lc-circle.now { background: var(--tc); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--tc) 35%, transparent); }
.lc-circle.past { background: color-mix(in srgb, var(--tc) 16%, #fff); color: var(--tc); border-color: color-mix(in srgb, var(--tc) 40%, #fff); }
.lc-circle.future { background: #fff; color: #b3bcc8; border-color: #dde2e8; }
.lc-circle:hover { transform: scale(1.08); z-index: 2; }
/* 只读视图：不响应悬停 */
.lc-stepper.ro .lc-circle { cursor: default; }
.lc-stepper.ro .lc-circle:hover { transform: none; }
.lc-stepper.ro .lc-neg { cursor: default; }
.lc-gap { flex: 1 1 auto; min-width: 30px; position: relative; height: 2px; background: #e3e8ef; margin: 0 6px; display: flex; align-items: center; justify-content: center; }
.lc-neg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  border: 1px solid #f0c9a8; background: #fff; color: #c2611f; border-radius: 999px;
  padding: 2px 10px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.lc-neg.on { background: #f97316; color: #fff; border-color: #f97316; box-shadow: 0 0 0 4px rgba(249,115,22,.18); }

/* 行业自定义 */
.lc-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.lc-foot-label { font-size: 12px; font-weight: 700; color: #667085; flex: 0 0 auto; }

/* 只读行业：醒目徽章（非输入框） */
.lc-ind-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff; font-size: 13px; font-weight: 800; line-height: 1;
  padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(15,118,110,.32);
}
.lc-ind-ico { font-size: 14px; line-height: 1; }
.lc-ind-none {
  display: inline-flex; align-items: center;
  border: 1px dashed #c2c9d2; color: #98a2b3; background: #f8fafc;
  font-size: 12px; font-weight: 700; padding: 7px 13px; border-radius: 999px;
}

/* 客户备注（只读展示） */
.lc-remark {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 16px;
  background: var(--accent-soft); border: 1px solid #dbe6fe; border-radius: 10px;
  padding: 9px 12px;
}
.lc-remark-ico { font-size: 13px; line-height: 1.5; flex: 0 0 auto; }
.lc-remark-text {
  font-size: 12.5px; line-height: 1.55; color: #1d4ed8; font-weight: 500;
  word-break: break-word; white-space: pre-wrap;
}
@media (max-width: 1200px) {
  .lc-circle { width: 48px; height: 48px; font-size: 12px; }
  .lc-neg { font-size: 10px; padding: 2px 7px; }
}

/* 顶部加载进度条 */
#top-loading {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  z-index: 9999; border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px rgba(14, 165, 233, .55);
  transition: width .28s ease;
}
#top-loading.show { width: 72%; }
#top-loading.done {
  width: 100%; opacity: 0;
  transition: width .18s ease, opacity .32s ease .1s;
}

/* ---------- 全局细节打磨 ---------- */
/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: #c4ccda transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #c9d0dc; border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #a9b3c4; background-clip: content-box; }

/* 键盘焦点可见性（无障碍，鼠标点击不显示） */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* 可交互元素统一平滑反馈 */
.btn { transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .08s ease, color .16s ease; }
.btn:active { transform: translateY(1px); }
.conv { transition: background .15s ease, box-shadow .15s ease; }
.sum-card { transition: transform .14s ease, box-shadow .14s ease; }
.sum-card:hover { transform: translateY(-2px); }
.side-card { transition: box-shadow .16s ease; }
.sum-card:hover { transform: translateY(-2px); }
