/* ============================================================
   星领寰宇 · 外贸客户及订单管理系统
   设计系统：藏青 + 金 + 墨绿（沿用《需求说明书》视觉规范）
   ============================================================ */
:root {
  --ink: #1E2A32;
  --ink-soft: #4A5A66;
  --muted: #7A8792;
  --navy: #17324F;
  --navy-2: #24466B;
  --navy-soft: #E7EDF4;
  --gold: #C98A2D;
  --gold-soft: #F5EBDD;
  --teal: #2E6B58;
  --teal-soft: #E3EFE9;
  --rose: #B4473A;
  --rose-soft: #F6E6E3;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --line: #DCE3EB;
  --line-soft: #EDF1F6;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(23,50,79,.05), 0 4px 16px rgba(23,50,79,.06);
  --shadow-lg: 0 8px 40px rgba(23,50,79,.16);
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Noto Serif SC", "Songti SC", serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { color: var(--gold); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #C7D2DE; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #A9B8C8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局 ---------------- */
#app { height: 100%; }
.layout { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: var(--navy); color: #D8E2EC;
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar .brand {
  padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar .brand h1 {
  font-family: var(--serif); font-size: 15.5px; margin: 0; color: #fff; letter-spacing: .5px;
}
.sidebar .brand p {
  margin: 4px 0 0; font-size: 10.5px; color: #8FA7BE; letter-spacing: 1.6px; text-transform: uppercase;
}
.sidebar .nav { flex: 1; overflow-y: auto; padding: 10px 0 20px; }
.sidebar .nav-group {
  padding: 14px 18px 6px; font-size: 10px; letter-spacing: 1.4px;
  color: #6E88A1; text-transform: uppercase;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8.5px 18px; cursor: pointer;
  font-size: 13px; color: #C6D4E1; border-left: 2.5px solid transparent; transition: .14s;
}
.sidebar .nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-item.active {
  background: rgba(201,138,45,.14); color: #fff; border-left-color: var(--gold); font-weight: 600;
}
.sidebar .nav-item .ico { width: 16px; text-align: center; opacity: .85; font-size: 13px; }
.sidebar .nav-item .badge {
  margin-left: auto; background: var(--rose); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 9px; font-weight: 600;
}
.sidebar .foot {
  padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.09); font-size: 11.5px; color: #8FA7BE;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  height: 54px; flex: 0 0 54px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 20px; gap: 14px;
}
.topbar h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--navy); font-family: var(--serif); }
.topbar .sub { font-size: 11.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.content { flex: 1; overflow-y: auto; padding: 18px 20px 60px; }

/* ---------------- 通用块 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head > * { min-width: 0; }   /* 允许标题/描述收缩，不被长文本撑破卡片 */
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--navy); min-width: 0; }
.card-head .desc { font-size: 11.5px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 10px 12px; }

.grid { display: grid; gap: 14px; }
/* 关键：grid 子项默认 min-width:auto，会被内部宽表格撑破容器。
   统一写成 minmax(0,1fr) + min-width:0，让宽内容在 .table-wrap 里横向滚动。 */
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid > * { min-width: 0; }
@media (max-width: 1280px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .g2,.g3,.g4,.g5 { grid-template-columns: minmax(0, 1fr); } }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------- KPI 卡 ---------------- */
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--navy-2);
}
.kpi.gold::before { background: var(--gold); }
.kpi.teal::before { background: var(--teal); }
.kpi.rose::before { background: var(--rose); }
.kpi .label { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.kpi .value {
  font-size: 23px; font-weight: 700; color: var(--navy); font-family: var(--serif);
  line-height: 1.15; word-break: break-all;
}
.kpi .value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi .foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.up { color: var(--rose); font-weight: 600; }
.down { color: var(--teal); font-weight: 600; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 6.5px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft); cursor: pointer;
  font-size: 12.5px; transition: .14s; white-space: nowrap; font-weight: 500;
}
.btn:hover { border-color: var(--navy-2); color: var(--navy); background: #FAFCFE; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { background: #B87A22; border-color: #B87A22; color: #fff; }
.btn.danger { color: var(--rose); border-color: #E8C9C4; }
.btn.danger:hover { background: var(--rose-soft); border-color: var(--rose); color: var(--rose); }
.btn.sm { padding: 4px 9px; font-size: 11.5px; }
.btn.lg { padding: 9px 20px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--navy-soft); }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: 12px; color: #3A4A5C; margin-bottom: 5px; font-weight: 600; letter-spacing: .2px;
}
.field label .req { color: var(--rose); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); outline: none; transition: .14s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(36,70,107,.10);
}
.textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
.select { cursor: pointer; }
.input[disabled], .input[readonly] { background: #F7F9FC; color: var(--muted); }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* 价值分层图例（客户表单） */
.tier-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tier-lg {
  flex: 1 1 220px; min-width: 0; box-sizing: border-box;
  font-size: 10.5px; line-height: 1.45; color: var(--ink-soft);
  background: var(--bg); border: 1px solid var(--line);
  border-left-width: 3px; border-radius: 6px; padding: 5px 8px;
}
.tier-lg b { display: inline-block; margin-right: 4px; color: var(--ink); }
.tier-lg.tA { border-left-color: var(--teal); }
.tier-lg.tB { border-left-color: var(--gold); }
.tier-lg.tC { border-left-color: #B6C0CC; }
.tier-lg.tD { border-left-color: var(--rose); }
@media (max-width: 900px) {
  .tier-lg { flex-basis: 100%; }
}

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tb th {
  text-align: left; padding: 9px 11px; background: #F8FAFC; color: var(--ink-soft);
  font-weight: 600; font-size: 11.5px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.tb td { padding: 9px 11px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tb tbody tr:hover { background: #FAFCFE; }
table.tb tbody tr.clickable { cursor: pointer; }
table.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb .nowrap { white-space: nowrap; }
table.tb tfoot td { padding: 9px 11px; background: #F8FAFC; font-weight: 700; border-top: 1px solid var(--line); }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.empty .big { font-size: 30px; opacity: .25; display: block; margin-bottom: 8px; }

/* ---------------- 徽标 ---------------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px;
  background: var(--navy-soft); color: var(--navy); margin: 1px 3px 1px 0; white-space: nowrap;
}
.tag.gold { background: var(--gold-soft); color: #8F5F14; }
.tag.teal { background: var(--teal-soft); color: var(--teal); }
.tag.rose { background: var(--rose-soft); color: var(--rose); }
.tag.gray { background: #EEF2F6; color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.pill {
  display: inline-block; padding: 2.5px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid transparent;
}
.pill.a { background: var(--teal-soft); color: var(--teal); }
.pill.b { background: var(--gold-soft); color: #8F5F14; }
.pill.c { background: #EEF2F6; color: var(--muted); }
.pill.high { background: var(--teal-soft); color: var(--teal); }
.pill.mid { background: var(--gold-soft); color: #8F5F14; }
.pill.low { background: var(--rose-soft); color: var(--rose); }

/* 订单状态 */
.st { padding: 2.5px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.st-待确认 { background: #EEF2F6; color: var(--muted); }
.st-已下单 { background: var(--navy-soft); color: var(--navy); }
.st-生产中 { background: var(--gold-soft); color: #8F5F14; }
.st-已发货 { background: #E4EDF8; color: #2F5F96; }
.st-已结清 { background: var(--teal-soft); color: var(--teal); }

/* ---------------- 进度条 ---------------- */
.bar { height: 8px; background: #EDF1F6; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy-2); border-radius: 6px; transition: width .4s; }
.bar.gold > i { background: var(--gold); }
.bar.teal > i { background: var(--teal); }
.bar.rose > i { background: var(--rose); }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(23,50,79,.45); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%;
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0 } }
.modal.xs { max-width: 420px; }
.modal.sm { max-width: 560px; }
.modal.md { max-width: 760px; }
.modal.lg { max-width: 1020px; }
.modal.xl { max-width: 1280px; }
.modal-head {
  padding: 15px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15px; color: var(--navy); font-family: var(--serif); }
.modal-head .spacer { flex: 1; }
.modal-head .x {
  cursor: pointer; color: var(--muted); font-size: 19px; line-height: 1; padding: 3px 7px; border-radius: 6px;
}
.modal-head .x:hover { background: #F1F5F9; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px;
  justify-content: flex-end; background: #FAFCFE;
}
.modal-foot .left { margin-right: auto; }

/* ---------------- Toast ---------------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 1200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--navy-2);
  border-radius: var(--radius-sm); padding: 11px 16px; box-shadow: var(--shadow-lg);
  font-size: 12.5px; max-width: 420px; animation: slideIn .2s ease; color: var(--ink);
}
.toast.ok { border-left-color: var(--teal); }
.toast.err { border-left-color: var(--rose); }
.toast.warn { border-left-color: var(--gold); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0 } }

/* ---------------- AI 识别面板 ---------------- */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 22px;
  text-align: center; color: var(--muted); cursor: pointer; transition: .16s; background: #FBFCFE;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--gold); background: var(--gold-soft); color: #8F5F14;
}
.dropzone .big { font-size: 26px; display: block; margin-bottom: 6px; opacity: .6; }
.dropzone .sub { font-size: 11px; margin-top: 5px; color: var(--muted); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumb {
  width: 78px; height: 78px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line);
  position: relative; background: #F1F5F9;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del {
  position: absolute; top: 2px; right: 2px; background: rgba(180,71,58,.9); color: #fff;
  width: 17px; height: 17px; border-radius: 50%; font-size: 11px; line-height: 17px; text-align: center;
  cursor: pointer;
}
.thumb .name {
  position: absolute; bottom: 0; left: 0; right: 0; background: rgba(23,50,79,.78); color: #fff;
  font-size: 9px; padding: 2px 3px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-loading {
  display: flex; align-items: center; gap: 10px; padding: 16px; color: var(--navy);
  background: var(--navy-soft); border-radius: var(--radius-sm); font-size: 12.5px;
}
.spinner {
  width: 17px; height: 17px; border: 2px solid rgba(23,50,79,.2); border-top-color: var(--navy);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------------- 时间线 ---------------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--navy-2);
}
.tl-item.gold::before { border-color: var(--gold); }
.tl-item .tl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.tl-item .tl-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-item .tl-body { font-size: 12.5px; color: var(--ink-soft); line-height: 1.65; white-space: pre-wrap; }

/* ---------------- 标签页 ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs .tab {
  padding: 8.5px 15px; cursor: pointer; font-size: 12.5px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tabs .tab:hover { color: var(--navy); }
.tabs .tab.active { color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(201,138,45,.10), transparent 42%),
    radial-gradient(circle at 85% 80%, rgba(46,107,88,.10), transparent 42%),
    linear-gradient(135deg, #17324F 0%, #1E3E60 48%, #24466B 100%);
}
.login-card {
  width: 100%; max-width: 396px; background: #fff; border-radius: 14px; padding: 34px 32px 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,.32);
}
.login-card .logo { text-align: center; margin-bottom: 22px; }
.login-card .logo .mark {
  width: 50px; height: 50px; border-radius: 13px; background: var(--navy); color: var(--gold);
  font-family: var(--serif); font-size: 23px; font-weight: 700; line-height: 50px; margin: 0 auto 12px;
}
.login-card .logo h1 { margin: 0; font-size: 17.5px; color: var(--navy); font-family: var(--serif); letter-spacing: .5px; }
.login-card .logo p { margin: 5px 0 0; font-size: 10.5px; color: var(--muted); letter-spacing: 1.4px; text-transform: uppercase; }
.login-err {
  background: var(--rose-soft); color: var(--rose); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 12.5px; margin-bottom: 13px;
}
.login-tip {
  margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line-soft);
  font-size: 11px; color: var(--muted); line-height: 1.75;
}

/* ---------------- 其他 ---------------- */
.chart { width: 100%; height: 288px; }
.chart.sm { height: 216px; }
.chart.lg { height: 360px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input, .filters .select { width: auto; min-width: 118px; padding: 6px 9px; font-size: 12.5px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 4px 2px; font-size: 12px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.sec-title {
  font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted);
  margin: 4px 0 10px; font-weight: 600;
}
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.split > * { min-width: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.tip-box {
  background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 10px 13px;
  border-radius: 6px; font-size: 12px; color: #7A5210; line-height: 1.7;
}
.tip-box.info { background: var(--navy-soft); border-left-color: var(--navy-2); color: #21456B; }
.warn-box {
  background: var(--rose-soft); border-left: 3px solid var(--rose); padding: 10px 13px;
  border-radius: 6px; font-size: 12px; color: #8C3225; line-height: 1.7;
}
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.center { text-align: center; }
.right { text-align: right; }
.mb0 { margin-bottom: 0 } .mt8 { margin-top: 8px } .mt12 { margin-top: 12px } .mt16 { margin-top: 16px }
.flex1 { flex: 1 }
.pointer { cursor: pointer }
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #FAFCFE; }

/* ==================== AI 通用样式（结果 / 抽屉 / 助手菜单 / 工具箱） ==================== */
.aihub .form { display: flex; flex-direction: column; gap: 11px; }
.frow { display: grid; grid-template-columns: 130px 1fr; align-items: start; gap: 10px; }
.frow > label { font-size: 12.8px; color: #4A6480; padding-top: 8px; font-weight: 600; }
.custpick { position: relative; }
.custpick .picked { padding: 8px 10px; background: #F2F6FA; border-radius: 8px; font-weight: 600; color: var(--navy); font-size: 13px; }
.custlist { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(23,50,79,.14); max-height: 260px; overflow-y: auto; }
.custitem { padding: 8px 11px; font-size: 12.8px; border-bottom: 1px solid var(--line-soft); }
.custitem:hover { background: #F2F6FA; }

/* 结果区 */
.result .blk { margin-bottom: 16px; }
.result .blk-title { font-weight: 700; color: var(--navy); font-size: 13.5px; margin-bottom: 7px; padding-left: 9px; border-left: 3px solid var(--gold); }
.result ul { margin: 0; padding-left: 20px; }
.result li { line-height: 1.8; font-size: 13px; color: #34506B; }
.blk-p { line-height: 1.8; font-size: 13.2px; color: #34506B; margin: 4px 0 12px; }
.blk-p.strong { font-weight: 700; color: var(--navy); font-size: 13.8px; }
.blk-body { margin: 4px 0 12px; }
.bodytext { white-space: pre-wrap; word-break: break-word; background: #F8FAFC; border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.75; color: #2B4358; font-family: inherit; margin: 0; }
.bodytext.small { font-size: 12.5px; }
.notice { background: #FFF8E8; border: 1px solid #EBD9A8; color: #7A5B12; border-radius: 8px; padding: 11px 13px; font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.alert.err { background: #FDF0EF; border: 1px solid #EBC5C1; color: #A03B32; border-radius: 8px; padding: 10px 13px; font-size: 13px; }
.funnel { display: flex; flex-direction: column; gap: 5px; }
.fstep { display: flex; align-items: center; gap: 10px; }
.fstep .fbar { height: 18px; background: linear-gradient(90deg, var(--navy), #2C5482); border-radius: 4px; min-width: 6px; }
.fstep .flabel { font-size: 12.5px; color: #34506B; }
.fstep .flabel b { color: var(--navy); }
.round { border: 1px solid var(--line-soft); border-radius: 9px; padding: 11px 13px; margin-bottom: 9px; background: #FDFEFF; }

/* AI 助手菜单 */
.aimenu { position: relative; display: inline-block; }
.aimenu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(23,50,79,.16); padding: 6px; }
.aimenu-item { padding: 8px 10px; border-radius: 7px; }
.aimenu-item:hover { background: #F2F6FA; }

/* AI 侧边抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(23,50,79,.32); z-index: 900; display: flex; justify-content: flex-end; }
.drawer { width: 620px; max-width: 94vw; height: 100%; background: #F6F9FC; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(23,50,79,.2); animation: slideIn .22s ease; }
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; background: #fff; border-bottom: 1px solid var(--line-soft); }
.drawer-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.drawer-head .x { font-size: 22px; color: #8FA7BE; cursor: pointer; line-height: 1; padding: 0 4px; }
.drawer-head .x:hover { color: var(--rose); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 28px; }
.drawer-body .result { background: #fff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 16px; }

/* AI 工具箱 */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 13px; }
.tool-card { position: relative; background: #fff; border: 1px solid var(--line-soft); border-radius: 12px; padding: 16px 16px 40px; transition: all .18s; }
.tool-card:hover { border-color: var(--gold); box-shadow: 0 8px 22px rgba(23,50,79,.10); transform: translateY(-2px); }
.tc-ico { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--navy), #2C5482); color: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 19px; margin-bottom: 10px; }
.tc-name { font-weight: 700; color: var(--navy); font-size: 14px; margin-bottom: 5px; }
.tc-desc { font-size: 12.3px; color: #6B8299; line-height: 1.65; }
.tc-go { position: absolute; left: 16px; bottom: 13px; font-size: 12.5px; color: var(--gold); font-weight: 600; }
@media (max-width: 980px) { .frow { grid-template-columns: 1fr; gap: 4px; } .frow > label { padding-top: 0; } }

/* ============================================================
   移动端适配（手机 / 平板）
   ------------------------------------------------------------
   断点：
     ≤900px  抽屉式侧边栏 + 移动端布局（手机横竖屏 / iPad 竖屏）
     ≤480px  小屏微调
   五条硬规则（新增页面/组件时必须一并满足）：
     1. 交互元素触控热区 ≥ 38px（主按钮 44px）
     2. 表单控件字号 = 16px —— 否则 iOS Safari 聚焦时会把页面放大
     3. 宽内容（表格 / 图表 / 标签页）横向滚动，不挤压变形
     4. 用 dvh + env(safe-area-inset-*) 适配移动浏览器地址栏与刘海屏
     5. 任何元素不得造成页面横向溢出（body 不出现左右滚动条）
   ============================================================ */

/* 汉堡按钮与抽屉遮罩：桌面端不显示 */
.hamburger { display: none; }
.sidebar-mask { display: none; }

@media (max-width: 900px) {
  /* ---------------- 侧边栏 -> 抽屉 ---------------- */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: 264px; flex: none;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    padding-bottom: env(safe-area-inset-bottom);
    will-change: transform;
  }
  .sidebar.open { transform: none; box-shadow: 6px 0 34px rgba(23, 50, 79, .3); }
  .sidebar .brand { padding: 14px 18px 12px; }
  .sidebar .nav-item { padding: 11.5px 18px; font-size: 14px; }   /* 加大触控热区 */
  .sidebar .nav-group { padding: 13px 18px 5px; }
  .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 999;
    background: rgba(23, 50, 79, .5);
    animation: fade .18s ease;
    overscroll-behavior: contain;
  }

  .main { width: 100%; min-width: 0; }

  /* ---------------- 顶栏 ---------------- */
  .hamburger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 36px; height: 36px; padding: 0 8px; margin-right: 2px; flex: none;
    background: transparent; border: none; cursor: pointer; border-radius: 8px;
  }
  .hamburger span { display: block; height: 2px; width: 100%; background: var(--navy); border-radius: 2px; }
  .hamburger:active { background: var(--navy-soft); }

  .topbar { height: 50px; flex: 0 0 50px; padding: 0 12px; gap: 8px; }
  .topbar h2 { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .sub { display: none; }      /* 副标题在手机上让位给标题 */
  .topbar .tag { display: none; }      /* 顶栏标签收起，避免换行撑高 */

  .content { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }

  /* ---------------- 卡片 ---------------- */
  .card { border-radius: 9px; margin-bottom: 12px; }
  .card-head { padding: 11px 12px; flex-wrap: wrap; row-gap: 6px; }
  .card-head h3 { font-size: 13px; }
  .card-body { padding: 12px; }
  .card-body.tight { padding: 8px; }

  /* ---------------- KPI ---------------- */
  .kpi { padding: 12px 13px; }
  .kpi .value { font-size: 20px; }
  .kpi .label { font-size: 11px; margin-bottom: 4px; }
  /* KPI 卡在手机上保持两列，比单列省一半翻屏（不支持的浏览器自动回退单列） */
  .grid.g2:has(> .kpi), .grid.g3:has(> .kpi), .grid.g4:has(> .kpi), .grid.g5:has(> .kpi) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* ---------------- 按钮：加大触控热区 ---------------- */
  .btn { padding: 8px 13px; min-height: 38px; }
  .btn.sm { padding: 6px 10px; min-height: 32px; }
  .btn.lg { padding: 10px 18px; min-height: 44px; }

  /* ---------------- 表单：16px 防 iOS 聚焦放大 ---------------- */
  .input, .select, .textarea, .filters .input, .filters .select { font-size: 16px; }
  .input, .select, .textarea { padding: 9px 11px; }
  .textarea { min-height: 84px; }
  .field label { font-size: 12.5px; }

  /* ---------------- 筛选区：铺满整行 ---------------- */
  .filters { gap: 8px; }
  /* 页面里用内联 min-width 写死的搜索框，这里统一让位 */
  .filters .input, .filters .select {
    min-width: 0 !important; width: 100% !important; flex: 1 1 100%;
  }
  .filters .btn { flex: 1 1 auto; justify-content: center; }

  /* ---------------- 表格：横向滚动 ---------------- */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  table.tb { font-size: 12px; }
  table.tb th, table.tb td { padding: 9px 10px; }
  table.tb th { font-size: 11px; }
  .empty { padding: 30px 14px; }

  /* ---------------- 弹窗：底部全屏抽屉式 ---------------- */
  .mask { padding: 0; align-items: flex-end; }
  .modal, .modal.xs, .modal.sm, .modal.md, .modal.lg, .modal.xl {
    max-width: 100%; width: 100%; max-height: 94vh; border-radius: 14px 14px 0 0;
  }
  .modal-head { padding: 13px 14px; }
  .modal-head h3 { font-size: 14.5px; }
  .modal-head .x { font-size: 22px; padding: 2px 8px; }   /* 加大关闭热区 */
  .modal-body { padding: 14px; }
  .modal-foot {
    padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
    flex-wrap: wrap; gap: 8px;
  }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .modal-foot .left { margin-right: 0; flex: 1 1 100%; }

  /* ---------------- AI 抽屉：整屏 ---------------- */
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-head { padding: 13px 14px; flex-wrap: wrap; row-gap: 8px; }
  .drawer-head .x { font-size: 26px; padding: 0 6px; }
  .drawer-body { padding: 13px 14px calc(24px + env(safe-area-inset-bottom)); }
  .drawer-body .result { padding: 13px; }

  /* ---------------- AI 助手菜单 ---------------- */
  .aimenu-list { width: min(86vw, 300px); }
  .aimenu-item { padding: 10px; }

  /* ---------------- 图表：降低高度，避免占满整屏 ---------------- */
  .chart { height: 236px; }
  .chart.sm { height: 196px; }
  .chart.lg { height: 272px; }

  /* ---------------- 标签页：横向滚动 ---------------- */
  .tabs {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; flex-wrap: nowrap;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { white-space: nowrap; flex: none; padding: 9px 13px; }

  /* ---------------- 分页器 ---------------- */
  .pager { justify-content: center; flex-wrap: wrap; gap: 6px; }
  .pager .btn { min-height: 34px; }

  /* ---------------- 键值列表 ---------------- */
  .kv { grid-template-columns: 84px 1fr; gap: 6px 10px; }

  /* ---------------- Toast ---------------- */
  .toasts { top: 10px; left: 10px; right: 10px; }
  .toast { max-width: none; }

  /* ---------------- 登录页 ---------------- */
  .login-wrap { padding: 16px; min-height: 100dvh; }
  .login-card { padding: 26px 20px 22px; border-radius: 12px; }

  /* ---------------- AI 识别面板 ---------------- */
  .dropzone { padding: 18px 12px; }
  .thumb { width: 70px; height: 70px; }

  /* ---------------- 版式细节 ---------------- */
  .list-row { padding: 11px 10px; }
  .sec-title { font-size: 11.5px; margin-bottom: 8px; }
  .bodytext { font-size: 12.5px; padding: 11px 12px; }
}

/* ---------------- 小屏微调（≤480px） ---------------- */
@media (max-width: 480px) {
  .kpi .value { font-size: 18.5px; }
  .kpi .value small { font-size: 11px; }
  .topbar h2 { font-size: 14px; }
  .content { padding: 10px 10px calc(20px + env(safe-area-inset-bottom)); }
  .card-body { padding: 11px; }
  .modal-body { padding: 12px; }
  .sidebar { width: 76vw; }
  .frow > label { font-size: 12.5px; }
}


/* ============================================================
   数据导入向导（importdata.js）
   ============================================================ */
.imp-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.imp-step {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px;
  border-radius: 20px; font-size: 12px; color: var(--muted);
  background: #F3F6FA; border: 1px solid var(--line-soft);
}
.imp-step .n {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  background: #E3E9F1; color: var(--ink-soft); flex: none;
}
.imp-step.on { background: var(--navy-soft); border-color: #C9D7E6; color: var(--navy); font-weight: 600; }
.imp-step.on .n { background: var(--navy); color: #fff; }
.imp-step.done { color: var(--teal); background: var(--teal-soft); border-color: #CFE3DA; }
.imp-step.done .n { background: var(--teal); color: #fff; }

.imp-modes { display: flex; gap: 8px; margin-bottom: 12px; }
.imp-drop {
  border: 1.5px dashed #C6D3E1; border-radius: 10px; padding: 26px 16px; text-align: center;
  color: var(--ink-soft); font-size: 13px; cursor: pointer; background: #FBFCFE;
  transition: border-color .15s, background .15s;
}
.imp-drop:hover { border-color: var(--navy-2); background: #F7FAFD; }

.imp-bar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 11px 12px; background: #F8FAFC; border: 1px solid var(--line-soft); border-radius: 8px;
}
.imp-bar .spacer { flex: 1; }

.imp-kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.imp-kpi {
  flex: 1 1 92px; min-width: 0; background: #F8FAFC; border: 1px solid var(--line-soft);
  border-radius: 9px; padding: 10px 12px;
}
.imp-kpi b { display: block; font-size: 19px; line-height: 1.25; color: var(--ink); font-variant-numeric: tabular-nums; }
.imp-kpi span { font-size: 11.5px; color: var(--muted); }
.imp-kpi.ok { background: var(--teal-soft); border-color: #CFE3DA; }
.imp-kpi.ok b { color: var(--teal); }
.imp-kpi.gold { background: var(--gold-soft); border-color: #EBDCC2; }
.imp-kpi.gold b { color: #8F5F14; }
.imp-kpi.bad { background: var(--rose-soft); border-color: #EFD3CE; }
.imp-kpi.bad b { color: var(--rose); }

.imp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.dup-item {
  padding: 9px 11px; border: 1px solid var(--line-soft); border-radius: 8px;
  background: #FBFCFE; margin-bottom: 8px;
}
.dup-detail { margin-top: 8px; }
.dup-detail table.tb { min-width: 520px; }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--navy); cursor: pointer; }

@media (max-width: 900px) {
  .imp-bar { gap: 8px; }
  .imp-bar .field { min-width: 0 !important; width: 100%; }
  .imp-bar .spacer { display: none; }
  .imp-kpi { flex: 1 1 calc(33.333% - 8px); }
}
@media (max-width: 480px) {
  .imp-kpi { flex: 1 1 calc(50% - 6px); }
  .imp-kpi b { font-size: 17px; }
  .imp-step { font-size: 11.5px; padding: 4px 9px 4px 6px; }
  .imp-tabs .btn { flex: 1 1 auto; }
}

/* ============================================================
   AI 助手悬浮窗（全局）
   ------------------------------------------------------------
   移动端约定：按钮热区 ≥ 38px、输入框 16px 防 iOS 缩放、
   面板用 dvh 与 safe-area，不产生横向溢出。
   ============================================================ */
.aiw { position: fixed; right: 18px; bottom: 18px; z-index: 60; }

/* ---------- 悬浮按钮 ---------- */
.aiw-fab {
  display: inline-flex; align-items: center; gap: 7px;
  height: 44px; padding: 0 16px 0 13px; border: 0; cursor: pointer;
  border-radius: 999px; color: #fff;
  background: linear-gradient(135deg, #17324F, #2A5580 60%, #C98A2D 160%);
  box-shadow: 0 6px 20px rgba(23, 50, 79, .34), 0 1px 0 rgba(255,255,255,.18) inset;
  font-size: 13.5px; font-weight: 600; letter-spacing: .3px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.aiw-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(23,50,79,.42); }
.aiw-fab:active { transform: translateY(0); }
.aiw-fab-ico { font-size: 15px; color: var(--gold, #C98A2D); }

/* ---------- 面板 ---------- */
.aiw-panel {
  width: 400px; height: min(640px, calc(100dvh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card, #fff); border-radius: 14px;
  border: 1px solid var(--line, #E3E8EF);
  box-shadow: 0 18px 48px rgba(16, 32, 51, .22);
}
.aiw-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line, #E3E8EF);
  background: linear-gradient(180deg, rgba(23,50,79,.05), transparent);
}
.aiw-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #2E7D6B;
  box-shadow: 0 0 0 3px rgba(46,125,107,.16);
}
.aiw-mini {
  min-width: 30px; height: 30px; padding: 0 8px; cursor: pointer;
  border: 1px solid var(--line, #E3E8EF); background: #fff; border-radius: 8px;
  color: #52657A; font-size: 12px;
}
.aiw-mini:hover { border-color: var(--gold, #C98A2D); color: var(--gold, #C98A2D); }

/* ---------- 消息区 ---------- */
.aiw-body { flex: 1; overflow-y: auto; padding: 14px 12px 6px; }
.aiw-empty { padding: 6px 2px 12px; }
.aiw-hi { font-size: 14.5px; font-weight: 600; color: var(--ink, #17324F); }
.aiw-quicks { display: flex; flex-direction: column; gap: 7px; }
.aiw-quick {
  text-align: left; cursor: pointer; padding: 9px 11px; min-height: 38px;
  border: 1px dashed var(--line, #D8DFE8); border-radius: 9px;
  background: #FAFBFD; color: #33506E; font-size: 12.5px; line-height: 1.45;
}
.aiw-quick:hover { border-style: solid; border-color: var(--gold, #C98A2D); background: #FFFBF4; }

.aiw-msg { margin-bottom: 12px; display: flex; flex-direction: column; }
.aiw-msg.user { align-items: flex-end; }
.aiw-bubble {
  max-width: 92%; padding: 9px 12px; border-radius: 11px;
  font-size: 13px; line-height: 1.62; word-break: break-word;
  background: #F4F7FA; color: #22364B;
}
.aiw-msg.user .aiw-bubble { background: #17324F; color: #fff; }
.aiw-bubble.err { background: #FDF3F1; color: #8C3225; }
.aiw-text code {
  background: rgba(23,50,79,.07); padding: 1px 4px; border-radius: 4px; font-size: 12px;
}
.aiw-acts { margin-top: 3px; }
.aiw-acts a { color: #8FA0B3; }
.aiw-acts a:hover { color: var(--gold, #C98A2D); }

/* 询数过程 */
.aiw-steps { margin-top: 4px; }
.aiw-steps > a { color: #8FA0B3; }
.aiw-step-list {
  margin-top: 5px; border-left: 2px solid rgba(201,138,45,.35);
  padding-left: 8px; display: flex; flex-direction: column; gap: 4px;
}
.aiw-step { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #52657A; }
.aiw-step.bad { color: #8C3225; }
.aiw-step-n {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  background: rgba(201,138,45,.14); color: #A06F1F;
  font-size: 10px; display: inline-flex; align-items: center; justify-content: center;
}

/* 打字动画 */
.aiw-bubble.typing { display: inline-flex; align-items: center; gap: 5px; color: #6B7C8F; }
.aiw-bubble.typing span {
  width: 5px; height: 5px; border-radius: 50%; background: #B6C2CE;
  animation: aiwBlink 1.1s infinite ease-in-out;
}
.aiw-bubble.typing span:nth-child(2) { animation-delay: .16s; }
.aiw-bubble.typing span:nth-child(3) { animation-delay: .32s; margin-right: 4px; }
@keyframes aiwBlink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

/* ---------- 输入区 ---------- */
.aiw-foot {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line, #E3E8EF); background: #FCFDFE;
}
.aiw-input {
  flex: 1; min-width: 0; resize: none; max-height: 110px;
  padding: 9px 11px; border: 1px solid var(--line, #D8DFE8); border-radius: 10px;
  font-size: 16px;         /* 16px 防 iOS 聚焦缩放 */
  line-height: 1.5; font-family: inherit; background: #fff; color: #22364B;
}
.aiw-input:focus { outline: none; border-color: var(--gold, #C98A2D); box-shadow: 0 0 0 3px rgba(201,138,45,.12); }

/* ---------- 窄屏：面板铺满，按钮只留图标 ---------- */
@media (max-width: 640px) {
  .aiw { right: 12px; bottom: 12px; left: 12px; }
  .aiw-fab { margin-left: auto; height: 46px; padding: 0 15px; }
  .aiw-panel {
    width: 100%; height: min(72dvh, 560px); border-radius: 13px;
  }
  .aiw-bubble { max-width: 100%; }
}
@media (max-width: 380px) {
  .aiw-fab-txt { display: none; }
  .aiw-fab { width: 46px; padding: 0; justify-content: center; }
}

/* ==================== 可搜索下拉（UiSelectSearch） ==================== */
.sls { position: relative; }
.sls-face { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sls-face.sls-ph { color: var(--muted); }
.sls-input { background: #fff; }
.sls-drop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--line, #e3e8ef); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(23, 50, 79, .16);
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
}
.sls-it { padding: 7px 12px; cursor: pointer; border-bottom: 1px solid #f2f5f9; }
.sls-it:last-of-type { border-bottom: 0; }
.sls-it.hi { background: #f2f7fd; }
.sls-it.sel .sls-label { color: var(--gold, #C98A2D); font-weight: 700; }
.sls-label { font-size: 13.5px; color: var(--ink, #233); line-height: 1.45; }
.sls-none, .sls-more { padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.sls-more { border-top: 1px dashed #e6ebf2; }

/* ============================================================
   WhatsApp 工作台（#/whatsapp）
   三栏：会话 / 聊天 / 客户档案
   移动端铁律：热区≥38px、表单 16px、宽内容横滚、min-width:0、零横向溢出
   ============================================================ */
.wa-wrap { display: grid; grid-template-columns: 330px minmax(0, 1fr) 302px; gap: 12px;
  height: calc(100dvh - 128px); min-height: 460px; align-items: stretch; }
.wa-wrap.no-profile { grid-template-columns: 330px minmax(0, 1fr); }
.wa-list, .wa-chat, .wa-profile { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }

/* ---------- 左侧头部 ---------- */
.wa-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); flex: 0 0 auto; }
.wa-head h3 { margin: 0; font-size: 15px; color: var(--navy); letter-spacing: .2px; }
.wa-badge { background: var(--rose); color: #fff; border-radius: 999px; font-size: 11px; line-height: 17px;
  min-width: 17px; padding: 0 6px; text-align: center; font-weight: 700; }
.wa-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.wa-dot.on { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.wa-dot.off { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* ---------- 列表侧 ---------- */
.wa-side { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 10px; overflow: hidden; }

.wa-cfg { border: 1px dashed var(--gold); background: #FFFCF6; border-radius: var(--radius-sm); padding: 10px;
  display: grid; gap: 7px; margin-bottom: 9px; flex: 0 0 auto; max-height: 46%; overflow-y: auto; }
.wa-cfg-tip { margin: 0; font-size: 11.5px; color: var(--ink-soft); line-height: 1.7; word-break: break-all; }
.wa-cfg-tip code { display: inline-block; background: var(--navy-soft); color: var(--navy); padding: 2px 6px;
  border-radius: 4px; font-size: 11px; margin-top: 2px; cursor: pointer; max-width: 100%; word-break: break-all; }
.wa-cfg-tip code:hover { background: var(--gold-soft); }
.wa-cfg input { font-size: 16px; padding: 7px 10px; min-height: 38px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); width: 100%; min-width: 0; }

.wa-search { font-size: 16px; padding: 7px 12px; min-height: 38px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); width: 100%; min-width: 0; }
.wa-tabs { display: flex; gap: 4px; margin: 8px 0; overflow-x: auto; flex: 0 0 auto; padding-bottom: 1px; }
.wa-tabs::-webkit-scrollbar { height: 0; }
.wa-tab { flex: 1 0 auto; font-size: 12px; padding: 6px 9px; min-height: 32px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; color: var(--ink-soft); cursor: pointer; white-space: nowrap; }
.wa-tab:hover { border-color: var(--navy-2); color: var(--navy); }
.wa-tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.wa-tab-n { display: inline-block; margin-left: 4px; background: var(--rose); color: #fff; border-radius: 999px;
  font-size: 10px; line-height: 15px; min-width: 15px; padding: 0 4px; text-align: center; }

.wa-items { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.wa-items li { display: flex; gap: 9px; padding: 9px 7px; border-bottom: 1px solid var(--line-soft);
  cursor: pointer; border-radius: var(--radius-sm); min-width: 0; }
.wa-items li:hover { background: var(--bg); }
.wa-items li.on { background: var(--navy-soft); }
.wa-ava { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: var(--navy-soft);
  color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.wa-ava.big { width: 44px; height: 44px; flex: 0 0 44px; font-size: 18px; }
.wa-item-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wa-item-top { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.wa-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.wa-time { font-size: 10.5px; color: var(--muted); flex: 0 0 auto; }
.wa-item-mid { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wa-item-bot { display: flex; gap: 5px; align-items: center; min-width: 0; }
.wa-owner { font-size: 10.5px; color: var(--muted); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-unread { background: var(--rose); color: #fff; border-radius: 999px; font-size: 10.5px; line-height: 16px;
  min-width: 16px; padding: 0 5px; text-align: center; font-weight: 700; flex: 0 0 auto; }
.wa-note-tag { display: inline-block; font-size: 9.5px; background: var(--gold-soft); color: var(--gold);
  border-radius: 3px; padding: 0 4px; margin-right: 3px; }
.chip { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; flex: 0 0 auto; }
.chip.green { background: var(--teal-soft); color: var(--teal); border-color: #CFE3DA; }
.chip.gray { background: var(--bg); color: var(--muted); border-color: var(--line); }
.chip.warn { background: var(--gold-soft); color: var(--gold); border-color: #EBD9BF; }
.chip.gold { background: var(--gold-soft); color: var(--gold); border-color: #EBD9BF; font-weight: 700; }

/* ---------- 聊天头 ---------- */
.wa-chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft); flex: 0 0 auto; flex-wrap: wrap; }
.wa-chat-title { min-width: 0; }
.wa-chat-title strong { color: var(--navy); font-size: 14.5px; }
.wa-chat-title .desc { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.wa-chat-title .ok { color: var(--teal); }
.wa-chat-title .warn { color: var(--gold); }
.wa-stage { color: var(--gold); font-weight: 600; }
.wa-back { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
  width: 38px; height: 38px; font-size: 20px; line-height: 1; color: var(--navy); cursor: pointer; flex: 0 0 auto; }

.wa-bind { display: flex; gap: 8px; padding: 8px 14px; background: var(--gold-soft); border-bottom: 1px solid var(--line-soft); flex: 0 0 auto; }
.wa-bind input { flex: 1; min-width: 0; font-size: 16px; padding: 7px 10px; min-height: 38px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* ---------- 消息流 ---------- */
.wa-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; background: var(--bg);
  display: flex; flex-direction: column; gap: 10px; }
.wa-row { display: flex; min-width: 0; }
.wa-row.in { justify-content: flex-start; }
.wa-row.out { justify-content: flex-end; }
.wa-row.note { justify-content: center; }
.wa-msg { max-width: min(78%, 560px); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.wa-msg.in { background: #fff; border: 1px solid var(--line-soft); border-top-left-radius: 4px; }
.wa-msg.out { background: var(--teal-soft); border: 1px solid #CFE3DA; border-top-right-radius: 4px; }
.wa-text { word-break: break-word; white-space: pre-wrap; font-size: 13px; line-height: 1.55; }
.wa-meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; text-align: right; }
.wa-tr-btn { color: var(--gold); cursor: pointer; font-size: 10.5px; text-decoration: underline dotted; }
.wa-media { margin-bottom: 5px; }
.wa-img { max-width: 100%; max-height: 230px; border-radius: 8px; display: block; cursor: zoom-in; object-fit: contain; }
.wa-file { color: var(--navy); font-size: 12.5px; text-decoration: underline; }
.wa-muted { color: var(--muted); font-size: 11.5px; }
.wa-trans { margin-top: 6px; padding: 6px 8px; background: #FFFDF7; border-left: 2px solid var(--gold);
  font-size: 12.5px; color: var(--ink-soft); border-radius: 0 6px 6px 0; word-break: break-word; }
.wa-trans-tag { display: inline-block; background: var(--gold); color: #fff; font-size: 9.5px;
  padding: 0 4px; border-radius: 3px; margin-right: 5px; }

/* ---------- 内部备注 ---------- */
.wa-note { max-width: 84%; background: #FBF3E3; border: 1px dashed var(--gold); border-radius: 10px;
  padding: 8px 12px; font-size: 12.5px; min-width: 0; }
.wa-note-head { font-size: 10.5px; color: var(--gold); font-weight: 700; margin-bottom: 3px; }

/* ---------- AI 摘要卡 ---------- */
.wa-sum { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  box-shadow: var(--shadow); flex: 0 0 auto; }
.wa-sum-head { display: flex; align-items: center; gap: 8px; }
.wa-sum-head strong { color: var(--navy); font-size: 13px; }
.wa-sum-head .x { cursor: pointer; color: var(--muted); font-size: 17px; line-height: 1; }
.wa-sum-score { font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 700; }
.wa-sum-score.hot { background: var(--rose-soft); color: var(--rose); }
.wa-sum-score.mid { background: var(--gold-soft); color: var(--gold); }
.wa-sum-score.cold { background: var(--bg); color: var(--muted); }
.wa-sum-line { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.wa-sum-line b { color: var(--navy); }
.wa-sum-line.warn b { color: var(--rose); }
.wa-sum-draft { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 7px; }
.wa-draft-text { background: var(--bg); border-radius: 6px; padding: 7px 9px; font-size: 12.5px;
  color: var(--ink); margin: 4px 0 6px; line-height: 1.55; }
.wa-draft-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 逐条 AI ---------- */
.wa-ai { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 5px; }
.wa-ai-head { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--gold);
  cursor: pointer; min-height: 24px; align-items: center; }
.wa-ai-head span:first-child { font-weight: 700; }
.wa-ai-body { font-size: 12px; color: var(--ink-soft); margin-top: 4px; display: grid; gap: 3px; }
.wa-ai-body p { margin: 0; }
.wa-ai-body b { color: var(--navy); }
.wa-ai-none { margin-top: 4px; font-size: 10.5px; color: var(--gold); cursor: pointer; }

/* ---------- 快捷回复面板 ---------- */
.wa-qr { flex: 0 0 auto; border-top: 1px solid var(--line-soft); background: #fff; padding: 9px 12px;
  max-height: 44%; overflow-y: auto; display: grid; gap: 7px; }
.wa-qr-head { display: flex; align-items: center; gap: 6px; }
.wa-qr-head strong { font-size: 12.5px; color: var(--navy); }
.wa-qr-form { display: grid; gap: 6px; background: var(--bg); border-radius: var(--radius-sm); padding: 8px; }
.wa-qr-form input, .wa-qr-form textarea { width: 100%; min-width: 0; font-size: 16px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--sans); }
.wa-qr-form-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wa-qr-form-row input, .wa-qr-form-row select { flex: 1; min-width: 90px; }
.wa-qr-list { display: grid; gap: 5px; }
.wa-qr-item { position: relative; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 7px 9px; cursor: pointer; }
.wa-qr-item:hover { border-color: var(--navy-2); background: var(--bg); }
.wa-qr-title { font-size: 12px; font-weight: 700; color: var(--navy); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.wa-qr-body { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-qr-del { position: absolute; right: 8px; top: 6px; font-size: 10.5px; color: var(--muted); }
.wa-qr-del:hover { color: var(--rose); }

/* ---------- 输入区 ---------- */
.wa-composer { flex: 0 0 auto; border-top: 1px solid var(--line-soft); padding: 8px 12px 10px; background: #fff; }
.wa-composer-top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.wa-mode { font-size: 12px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer; min-height: 30px; }
.wa-mode.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.wa-mode.note.on { background: var(--gold); border-color: var(--gold); }
.wa-input-row { display: flex; gap: 8px; align-items: flex-end; }
.wa-input-row textarea { flex: 1; min-width: 0; font-size: 16px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); resize: none; font-family: var(--sans); line-height: 1.5; }
.wa-send { flex: 0 0 auto; min-height: 38px; }
.wa-send.note { background: var(--gold); border-color: var(--gold); }
.wa-closed { font-size: 11.5px; color: var(--gold); margin-top: 5px; }

.wa-empty-tip { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.wa-empty-tip.big { display: flex; align-items: center; justify-content: center; height: 100%; margin: 0; }
.wa-big-ico { font-size: 44px; color: var(--line); line-height: 1; margin-bottom: 10px; }

/* ---------- 右侧档案 ---------- */
.wa-profile { padding: 12px; overflow-y: auto; gap: 8px; }
.wa-prof-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.wa-prof-title { min-width: 0; }
.wa-prof-title strong { display: block; color: var(--navy); font-size: 14px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.wa-prof-title .desc { font-size: 11.5px; color: var(--muted); }
.wa-prof-body { display: grid; gap: 7px; }
.wa-prof-row { display: flex; gap: 8px; align-items: center; }
.wa-prof-row label { flex: 0 0 38px; font-size: 11.5px; color: var(--muted); }
.wa-sel { flex: 1; min-width: 0; font-size: 14px; padding: 5px 8px; min-height: 34px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
.wa-prof-owner { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; }
.wa-prof-owner span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-prof-tags { flex: 1; display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.wa-stat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  background: var(--navy-soft); border-radius: 8px; padding: 8px 4px; text-align: center; margin-top: 3px; }
.wa-stat b { display: block; font-size: 14px; color: var(--navy); font-family: var(--serif); }
.wa-stat span { font-size: 10px; color: var(--muted); }
.wa-sec { border-top: 1px solid var(--line-soft); padding-top: 8px; margin-top: 3px; display: grid; gap: 5px; }
.wa-sec-head { font-size: 11.5px; font-weight: 700; color: var(--navy); }
.wa-line { display: flex; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.wa-line-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-line-r { flex: 0 0 auto; color: var(--navy); font-weight: 600; }
.wa-follow { font-size: 11.5px; color: var(--ink-soft); }
.wa-follow-top { color: var(--muted); font-size: 10.5px; }
.wa-follow-txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.wa-tofollow input { width: 100%; min-width: 0; font-size: 16px; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); }
.wa-tofollow select { flex: 1; }
.wa-link { font-size: 11.5px; color: var(--navy); cursor: pointer; text-decoration: underline dotted; }

/* ---------- 响应式 ---------- */
@media (max-width: 1240px) {
  .wa-wrap { grid-template-columns: 300px minmax(0, 1fr); }
  .wa-profile { position: fixed; top: 0; right: 0; bottom: 0; width: 320px; z-index: 70;
    box-shadow: var(--shadow-lg); border-radius: 0; }
}
@media (max-width: 860px) {
  .wa-wrap, .wa-wrap.no-profile { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 108px); }
  .wa-list.hide, .wa-chat.hide { display: none; }
  .wa-back { display: inline-flex; align-items: center; justify-content: center; }
  .wa-profile { width: min(86vw, 340px); }
  .wa-msg { max-width: 88%; }
  .wa-note { max-width: 94%; }
  .wa-chat-head { padding: 8px 10px; gap: 6px; }
  .wa-body { padding: 10px; }
  .wa-composer { padding: 7px 9px 8px; }
}

/* 未接线提示条 */
.wa-setup { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--gold-soft); border: 1px solid #EBD9BF; border-radius: var(--radius-sm);
  padding: 6px 10px; margin-bottom: 8px; font-size: 11.5px; color: var(--gold); cursor: pointer;
  min-height: 34px; flex: 0 0 auto; }
.wa-setup:hover { background: #F1E2C9; }
.wa-setup-a { font-weight: 700; }

/* ============================================================
   WhatsApp 自动跟进中心（三期）—— 待办 / 模板 / 规则 / 群发 / 时效
   ============================================================ */
.wg { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wg-head h2 { margin: 0; font-size: 17px; color: var(--navy); letter-spacing: .3px; }
.wg-sub { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }

.chip.ok { background: var(--teal-soft); color: var(--teal); border-color: #CFE3DA; }
.chip.bad { background: var(--rose-soft); color: var(--rose); border-color: #EBD3CE; }
.chip.sel { cursor: pointer; background: var(--bg); color: var(--muted); border-color: var(--line); }
.chip.sel.on { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 700; }

.wg-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.wg-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.wg-card b { display: block; font-size: 21px; color: var(--navy); line-height: 1.1; }
.wg-card span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.wg-card i { display: block; font-size: 10.5px; color: var(--gold); font-style: normal; margin-top: 2px; }
.wg-card.warn b { color: var(--rose); }

.wg-tip { background: var(--gold-soft); border: 1px solid #EBD9BF; color: var(--gold);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 11.5px; }
.wg-tip.ok { background: var(--teal-soft); border-color: #CFE3DA; color: var(--teal); }
.wg-tip a { cursor: pointer; font-weight: 700; text-decoration: underline; }

.wg-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.wg-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px;
  font-size: 13px; color: var(--ink-soft); cursor: pointer; min-height: 38px; font-family: var(--sans); }
.wg-tab.on { color: var(--navy); font-weight: 700; border-bottom-color: var(--gold); }
.wg-tab em { font-style: normal; margin-left: 5px; background: var(--rose); color: #fff;
  border-radius: 999px; font-size: 10px; padding: 0 6px; font-weight: 700; }

.wg-sec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 9px; border-bottom: 1px solid var(--line-soft); margin-bottom: 9px; }
.wg-sec-head strong { font-size: 14px; color: var(--navy); }
.wg-sub-head { font-size: 12.5px; color: var(--navy); font-weight: 700; margin: 10px 0 4px; }
.wg-muted { font-size: 11px; color: var(--muted); }
.wg-note { background: var(--navy-soft); border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 11.5px; color: var(--ink-soft); line-height: 1.65; margin-bottom: 10px; }

/* 待办卡片 */
.wg-jobs { display: flex; flex-direction: column; gap: 9px; }
.wg-job { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 10px 12px; background: #FCFDFE; min-width: 0; }
.wg-job-main { flex: 1 1 auto; min-width: 0; }
.wg-job-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.wg-job-top strong { font-size: 13.5px; color: var(--navy); }
.wg-job-msg { margin: 6px 0 5px; font-size: 12.5px; color: var(--ink); line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; background: var(--bg);
  border-left: 3px solid var(--gold); border-radius: 0 5px 5px 0; padding: 7px 10px; }
.wg-job-foot { font-size: 11px; }
.wg-job-act { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.wg-job-act .btn { min-width: 74px; }

.wg-empty { text-align: center; padding: 42px 12px; color: var(--muted); }
.wg-empty-ico { font-size: 30px; color: var(--teal); margin-bottom: 8px; }
.wg-empty-cell { text-align: center; color: var(--muted); padding: 26px 0; }
.wg-bad { color: var(--rose); font-weight: 700; }

.wg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wg-body { max-width: 340px; font-size: 11.5px; color: var(--ink-soft);
  white-space: pre-wrap; word-break: break-word; }

/* 群发进度 */
.wg-bc-bar { height: 8px; background: var(--navy-soft); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.wg-bc-bar.sm { height: 6px; margin: 4px 0; }
.wg-bc-bar i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .3s; }
.wg-bc-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-soft); margin-bottom: 8px; }
.wg-bc-nums .ok b { color: var(--teal); }
.wg-bc-nums .bad b { color: var(--rose); }
.wg-bc-detail { border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 10px; background: #FCFDFE; }

/* 表单 */
.wg-form { display: flex; flex-direction: column; gap: 9px; }
.wg-form label { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }
.wg-form input, .wg-form select, .wg-form textarea {
  font-size: 16px; padding: 8px 10px; min-height: 38px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-family: var(--sans); width: 100%; box-sizing: border-box; }
.wg-form textarea { resize: vertical; }
.wg-form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.wg-form-row > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wg-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.wg-chips .chip { font-size: 11.5px; padding: 4px 10px; min-height: 30px; line-height: 20px; }
.wg-preview { font-size: 12.5px; color: var(--navy); }
.wg-sample { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .wg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wg-form-row { grid-template-columns: minmax(0, 1fr); }
  .wg-job { flex-direction: column; }
  .wg-job-act { flex-direction: row; width: 100%; }
  .wg-job-act .btn { flex: 1 1 0; }
}
.wg-head-act { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   订单跟单（v1.13.0）—— 倒计时 / 关键节点 / 厂家进度 / 批量删除
   ============================================================ */
.od-due { display: inline-flex; flex-direction: column; gap: 1px; border-radius: 6px;
  padding: 3px 8px; font-size: 12px; line-height: 1.35; border: 1px solid var(--line-soft);
  background: var(--bg); color: var(--ink-soft); white-space: nowrap; }
.od-due b { font-size: 12.5px; font-weight: 700; }
.od-due .small { font-size: 10.5px; color: var(--muted); }
.due-overdue { background: var(--rose-soft); border-color: #EBD3CE; color: var(--rose); }
.due-today, .due-urgent { background: var(--gold-soft); border-color: #EBD9BF; color: var(--gold); }
.due-soon { background: var(--navy-soft); border-color: var(--line); color: var(--navy); }
.due-normal { background: var(--teal-soft); border-color: #CFE3DA; color: var(--teal); }
.due-none, .due-done { opacity: .72; }
.due-overdue .small, .due-today .small, .due-urgent .small { color: inherit; opacity: .8; }

.od-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line-soft); border-left: 4px solid var(--teal);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px;
  background: var(--teal-soft); }
.od-banner.due-overdue { background: var(--rose-soft); border-left-color: var(--rose); }
.od-banner.due-today, .od-banner.due-urgent { background: var(--gold-soft); border-left-color: var(--gold); }
.od-banner.due-soon { background: var(--navy-soft); border-left-color: var(--navy); }
.od-banner-ico { font-size: 22px; line-height: 1; color: inherit; }
.od-banner-main { min-width: 0; flex: 1 1 240px; }
.od-banner-main strong { font-size: 14px; color: var(--navy); }
.od-banner.due-overdue .od-banner-main strong { color: var(--rose); }
.od-banner-main .small { color: var(--ink-soft); margin-top: 2px; }

.od-batch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--gold-soft); border: 1px solid #EBD9BF; color: var(--navy);
  border-radius: var(--radius-sm); padding: 7px 12px; font-size: 12.5px; margin-bottom: 10px; }
.od-batch .spacer { flex: 1 1 auto; }

/* 关键时间节点 */
.ms-list { display: flex; flex-direction: column; gap: 0; }
.ms-row { display: flex; gap: 12px; align-items: flex-start; position: relative;
  padding: 10px 4px 10px 0; border-bottom: 1px dashed var(--line-soft); min-width: 0; }
.ms-row:last-child { border-bottom: 0; }
.ms-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; margin-top: 5px;
  background: #fff; border: 2px solid var(--teal); }
.ms-row.due-overdue .ms-dot { border-color: var(--rose); background: var(--rose-soft); }
.ms-row.due-today .ms-dot, .ms-row.due-urgent .ms-dot { border-color: var(--gold); background: var(--gold-soft); }
.ms-row.ms-done .ms-dot { border-color: var(--teal); background: var(--teal); }
.ms-main { flex: 1 1 auto; min-width: 0; }
.ms-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ms-top strong { font-size: 13.5px; color: var(--navy); }
.ms-row.ms-done .ms-top strong { color: var(--muted); text-decoration: line-through; }
.ms-act { flex: 0 0 auto; }
.ms-add { display: grid; grid-template-columns: minmax(0, 2fr) 150px minmax(0, 1.4fr) auto;
  gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* 下游厂家生产进度 */
.od-prog { width: 140px; height: 8px; border-radius: 999px; background: var(--navy-soft); overflow: hidden; }
.od-prog i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .3s; }
.sup-group { border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 10px; background: #FCFDFE; min-width: 0; }
.sup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.sup-head strong { font-size: 13.5px; color: var(--navy); }
.sup-head .spacer { flex: 1 1 auto; }
.sup-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px; margin-bottom: 9px; }
.row-done { background: var(--teal-soft); }
.input.sm, .select.sm { min-height: 32px; padding: 4px 8px; font-size: 13px; width: 100%; box-sizing: border-box; }

@media (max-width: 900px) {
  .ms-add { grid-template-columns: minmax(0, 1fr); }
  .ms-add .btn { min-height: 38px; }
  .sup-fields { grid-template-columns: minmax(0, 1fr); }
  .od-prog { width: 90px; }
  /* 移动端表单 16px，避免 iOS 聚焦缩放 */
  .input.sm, .select.sm { font-size: 16px; min-height: 38px; }
  .ms-act .btn { min-height: 38px; }
}

/* ============================================================
   客户档案补全（v1.12.0）—— 表单画像区 / 列表列 / 详情档案卡
   ============================================================ */
.cf-sec { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }
.cf-sec-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cf-sec-head b { font-size: 13px; color: var(--navy); }
.cf-sec-head span { font-size: 11px; color: var(--muted); }
.grid.g3 > .field.wide { grid-column: 1 / -1; }

.filter-date { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.filter-date .input { width: 140px !important; min-width: 0 !important; flex: 0 0 auto; padding: 6px 9px; font-size: 12.5px; }

.cols-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; }
.cols-item { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 4px 6px;
  font-size: 13px; color: var(--ink); cursor: pointer; border-radius: 6px; min-width: 0; }
.cols-item:hover { background: var(--bg); }
.cols-item input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--navy); }
.cols-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pf-cell { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pf-group { margin-bottom: 16px; }
.pf-group:last-child { margin-bottom: 0; }
.pf-group-title { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .5px;
  border-left: 3px solid var(--gold); padding-left: 8px; margin-bottom: 10px; }
.pf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.pf-item { min-width: 0; }
.pf-item.wide { grid-column: span 2; }
.pf-label { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.pf-value { font-size: 13px; color: var(--ink); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; }
.pf-value.empty { color: var(--muted); opacity: .6; }

@media (max-width: 1280px) {
  .pf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid.g3 > .field.wide { grid-column: auto; }
  .cols-grid, .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-item.wide { grid-column: 1 / -1; }
  .filter-date { flex: 1 1 100%; }
  .filter-date .input { width: 100% !important; flex: 1 1 120px; font-size: 16px; }
  .pf-cell { max-width: 140px; }
}

/* ============================================================
   AI 客户背景调查（v1.14.0）—— 独立板块
   布局：左材料输入 / 右逐条研判；窄屏自动堆叠为单列
   ============================================================ */
.rs-page { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rs-page .card { min-width: 0; }
.rs-intro-body { display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-width: 0; }
.rs-intro-ico { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px;
  background: var(--navy); color: var(--gold); font-size: 22px; line-height: 38px; text-align: center; }
.rs-intro-body > div:nth-child(2) { min-width: 0; }
.rs-intro-body b { color: var(--navy); font-size: 14px; }
.rs-intro-body p { margin: 4px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.7; }

.rs-layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 14px; align-items: start; min-width: 0; }
.rs-left, .rs-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rs-text { min-height: 150px; resize: vertical; }

.rs-drop { border: 1.5px dashed var(--line); border-radius: var(--radius); background: #FAFCFE;
  padding: 16px 12px; text-align: center; cursor: pointer; font-size: 12.5px;
  color: var(--ink-soft); line-height: 1.7; transition: .15s; }
.rs-drop:hover, .rs-drop.over { border-color: var(--gold); background: var(--gold-soft); }
.rs-drop .big { font-size: 24px; display: block; opacity: .6; margin-bottom: 4px; }
.rs-drop .sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.rs-check { display: inline-flex; align-items: center; gap: 7px; min-height: 32px;
  font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.rs-check input { width: 16px; height: 16px; accent-color: var(--navy); flex: 0 0 auto; }
.rs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-chips .chip.sel { cursor: pointer; min-height: 30px; padding: 5px 11px; font-size: 12px; }
.rs-picked { display: inline-flex; align-items: center; gap: 10px; background: var(--navy-soft);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px; min-width: 0; }
.rs-picked a { color: var(--rose); white-space: nowrap; }
.rs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.rs-loading { display: flex; align-items: center; gap: 10px; margin-top: 12px;
  font-size: 12.5px; color: var(--navy); background: var(--navy-soft);
  border-radius: var(--radius-sm); padding: 10px 12px; }
.rs-alert { margin-top: 12px; line-height: 1.7; }

.rs-history-mini { padding-top: 6px; }
.rs-hrow { display: flex; align-items: center; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--line-soft); min-width: 0; }
.rs-hrow:last-child { border-bottom: 0; }
.rs-hname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.rs-hrow .del, .thumb .del { cursor: pointer; color: var(--rose); font-size: 15px; padding: 0 4px; }

.rs-blank .empty { padding: 42px 24px; }
.rs-blank .big { font-size: 34px; color: var(--gold); }
.rs-steps { display: grid; gap: 8px; text-align: left; max-width: 420px; margin: 0 auto; font-size: 12.5px; color: var(--ink-soft); }
.rs-steps b { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; margin-right: 8px; }

.rs-subject { display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 15px; font-weight: 700; color: var(--navy); min-width: 0; word-break: break-word; }
.rs-sum { margin: 8px 0 6px; font-size: 13px; line-height: 1.75; color: var(--ink); }
.rs-risk { font-size: 12px; color: var(--rose); line-height: 1.7; }
.rs-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px;
  padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--muted); }
.rs-done { background: var(--teal-soft); color: var(--teal); border: 1px solid #CFE3DA;
  border-radius: var(--radius); padding: 10px 14px; font-size: 12.5px; }
.rs-done a { margin-left: 12px; font-weight: 700; }

.rs-tabbody { padding-top: 0; min-width: 0; }
.rs-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.rs-group { margin-top: 14px; min-width: 0; }
.rs-group-head { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .4px;
  border-left: 3px solid var(--gold); padding-left: 8px; margin-bottom: 9px; }
.rs-group-head span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.rs-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: 8px; background: var(--card); transition: .15s; min-width: 0; }
.rs-field.on { border-color: var(--gold); background: #FFFDF8; box-shadow: inset 3px 0 0 var(--gold); }
.rs-field.low { border-style: dashed; }
.rs-frow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rs-fcheck { display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  cursor: pointer; min-height: 30px; min-width: 0; }
.rs-fcheck input { width: 16px; height: 16px; accent-color: var(--gold); flex: 0 0 auto; }
.rs-fcheck b { font-size: 12.5px; color: var(--ink); }
.rs-fvalue { width: 100%; margin-top: 6px; font-size: 12.5px; }
.rs-fbasis { margin-top: 7px; padding: 8px 10px; background: var(--bg); border-radius: 6px;
  font-size: 11.5px; color: var(--ink-soft); line-height: 1.75; word-break: break-word; }

.rs-block-title { font-size: 12.5px; font-weight: 700; color: var(--navy); margin: 14px 0 8px;
  border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.rs-section { margin-bottom: 14px; min-width: 0; }
.rs-point { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px; line-height: 1.7; }
.rs-point-text { flex: 1 1 240px; min-width: 0; }
.rs-point-basis { flex: 1 1 100%; font-size: 11px; color: var(--muted); }
.rs-finding { font-size: 12.5px; line-height: 1.8; padding: 5px 0; }

.rs-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rs-channel { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; min-width: 0; }
.rs-ch-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 7px; }
.rs-ch-head b { color: var(--navy); font-size: 12.5px; }
.rs-ch-line { font-size: 11.5px; color: var(--ink-soft); line-height: 1.7; word-break: break-word; }
.rs-ch-link { display: inline-block; margin-top: 6px; font-size: 11.5px; }
.rs-chdict { display: grid; gap: 6px; font-size: 11.5px; color: var(--ink-soft); line-height: 1.6; }
.rs-chdict b { color: var(--navy); }
.rs-question { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 12.5px; line-height: 1.7; }
.rs-qnum { flex: 0 0 22px; width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: var(--navy-soft); color: var(--navy); font-size: 11px; font-weight: 700; }

.rs-applybar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); }
.rs-applybar > div { min-width: 0; }
.rs-custlist { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.rs-custitem { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.rs-custitem:hover { background: var(--bg); }
.rs-skip { margin-top: 9px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.rs-dup { margin-top: 14px; }
.rs-duprow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }

@media (max-width: 1180px) {
  .rs-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .rs-intro-body { align-items: flex-start; flex-wrap: wrap; padding: 12px; }
  .rs-intro-body .spacer { display: none; }
  .rs-layout { gap: 12px; }
  .rs-page .input, .rs-page .textarea, .rs-page .select { font-size: 16px; }
  .rs-page .btn { min-height: 38px; }
  .rs-page .btn.sm { min-height: 38px; }
  .rs-chips .chip.sel { min-height: 38px; padding: 8px 12px; font-size: 13px; }
  .rs-check { min-height: 38px; font-size: 13px; }
  .rs-fcheck { min-height: 38px; }
  .rs-fvalue { font-size: 16px; }
  .rs-drop { padding: 18px 12px; }
  .rs-channels { grid-template-columns: minmax(0, 1fr); }
  .rs-applybar > .btn, .rs-applybar .btn { flex: 1 1 100%; }
  .rs-toolbar .btn { flex: 1 1 auto; }
  .rs-subject { font-size: 14px; }
  .rs-blank .empty { padding: 28px 14px; }
}

/* ============================================================
   运营分析看板（v1.14.0）+ 建档完整度条 + 关键信息标记
   ============================================================ */

/* 周期选择器 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 6px 14px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; font-weight: 600; }

/* KPI 行 */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-row .kpi { margin: 0; }
.kpi.primary::before { background: var(--navy); }
.kpi.ok::before { background: var(--teal); }

/* 看板 Tab（与全局 .tabs 共存，支持 button.on 写法） */
.tabs button { border: none; background: none; padding: 9px 14px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--navy); }
.tabs button.on { color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }

/* 图表框 */
.chart-box { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 4px; min-width: 0; }
.chart-title { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }

/* 投放花费登记 */
.spend-form { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }
.sf-title { font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.cac { color: var(--rose); font-weight: 700; }

/* 关键信息星标 */
.key-star { color: var(--gold); font-style: normal; font-size: 11px; margin-left: 3px; vertical-align: middle; }

/* 建档完整度条 */
.comp-bar { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.comp-bar.ok { border-color: #CFE3DA; }
.comp-bar.mid { border-color: #EBD9BF; }
.comp-bar.low { border-color: #EBD3CE; }
.comp-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.comp-title { font-size: 13px; font-weight: 700; color: var(--navy); }
.comp-pct { font-size: 18px; font-weight: 800; }
.comp-bar.ok .comp-pct { color: var(--teal); }
.comp-bar.mid .comp-pct { color: var(--gold); }
.comp-bar.low .comp-pct { color: var(--rose); }
.comp-sub { font-size: 11.5px; color: var(--muted); }
.comp-track { height: 8px; background: #E4EAF0; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.comp-track i { display: block; height: 100%; border-radius: 999px; background: var(--navy); transition: width .25s; }
.comp-bar.ok .comp-track i { background: var(--teal); }
.comp-bar.mid .comp-track i { background: var(--gold); }
.comp-bar.low .comp-track i { background: var(--rose); }
.comp-miss { font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.comp-miss .chip { margin: 0; }

/* 移动端：KPI 两列、图表堆叠 */
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row .kpi .value { font-size: 19px; }
}
