/* ================================
   天基系统 · 全局样式
   CMB 品牌色：主红 #C7000B / 深红 #8a000a / 金 #D4A64B
================================ */

:root {
  --cmb-red: #c7000b;
  --cmb-red-dark: #8a000a;
  --cmb-red-light: #fff0f1;
  --cmb-gold: #d4a64b;
  --cmb-gold-soft: #f6e8c8;

  --sidebar-bg: #1a1d29;
  --sidebar-bg-light: #242836;
  --sidebar-text: #c5c9d4;
  --sidebar-text-dim: #7a8090;
  --sidebar-active: #c7000b;

  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e6e8ef;
  --border-soft: #f0f2f7;
  --text: #1f2433;
  --text-sub: #5a6077;
  --text-dim: #8b90a3;

  --success: #1fb87b;
  --warn: #ff9a1f;
  --danger: #e5484d;
  --info: #2e7bff;

  /* 中国金融行业惯例：涨红跌绿 */
  --up: #e5484d;
  --up-bg: #fdecec;
  --down: #1fb87b;
  --down-bg: #e7f6ee;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 8px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 8px 24px rgba(17, 24, 39, 0.1);

  --header-h: 58px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ================================
   顶部导航
================================ */
.app-header {
  height: var(--header-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}

.header-left { display: flex; align-items: center; gap: 36px; }

.brand { display: flex; align-items: center; gap: 10px; padding-right: 20px; border-right: 1px solid var(--border); }
.brand-logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--cmb-red) 0%, var(--cmb-red-dark) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; box-shadow: 0 2px 6px rgba(199, 0, 11, 0.3);
}
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: 2px; color: var(--cmb-red); }
.brand-sub { font-size: 11px; color: var(--text-dim); letter-spacing: 0.5px; }

.top-nav { display: flex; gap: 4px; }
.top-nav-item {
  padding: 8px 14px; border-radius: 6px; font-size: 13px; color: var(--text-sub);
  display: flex; align-items: center; gap: 6px; transition: 0.2s;
}
.top-nav-item i { font-size: 13px; }
.top-nav-item:hover { background: var(--cmb-red-light); color: var(--cmb-red); }
.top-nav-item.active { background: var(--cmb-red-light); color: var(--cmb-red); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 18px; }

.search-box {
  position: relative; display: flex; align-items: center;
  background: #f4f6fa; border-radius: 8px; padding: 0 12px; height: 34px; width: 320px;
  transition: 0.2s;
}
.search-box:focus-within { background: #fff; box-shadow: 0 0 0 2px rgba(199, 0, 11, 0.15); }
.search-box i { color: var(--text-dim); margin-right: 8px; }
.search-box input { flex: 1; border: none; background: transparent; outline: none; font-size: 13px; }
.search-box kbd {
  font-size: 11px; background: #fff; border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px; color: var(--text-dim);
}

.header-icons { display: flex; gap: 6px; }
.hi-item {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sub); cursor: pointer; position: relative; transition: 0.2s;
}
.hi-item:hover { background: #f4f6fa; color: var(--cmb-red); }
.hi-item .badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--cmb-red); color: #fff; font-size: 10px;
  border-radius: 9px; min-width: 16px; height: 16px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

.user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.user:hover { background: #f4f6fa; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-dim); }

/* ================================
   侧边栏
================================ */
.app-body {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 16px 0 0;
  display: flex; flex-direction: column;
  position: sticky; top: var(--header-h); align-self: flex-start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #3a3f50; border-radius: 3px; }

.sb-section { padding: 6px 0; }
.sb-section-title {
  padding: 10px 20px 6px; font-size: 11px; letter-spacing: 1.5px;
  color: var(--sidebar-text-dim); text-transform: uppercase;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--sidebar-text); font-size: 13px;
  border-left: 3px solid transparent; position: relative; transition: 0.15s;
}
.sb-item i { width: 16px; text-align: center; font-size: 14px; }
.sb-item:hover { background: var(--sidebar-bg-light); color: #fff; }
.sb-item.active {
  background: linear-gradient(90deg, rgba(199, 0, 11, 0.25), transparent);
  color: #fff; border-left-color: var(--cmb-red);
  font-weight: 600;
}
.sb-tag {
  margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  font-weight: 700; letter-spacing: 0.5px;
}
.sb-tag.hot { background: var(--cmb-red); color: #fff; }
.sb-tag.new { background: var(--cmb-gold); color: #3c2a00; }

.sb-footer { margin-top: auto; padding: 16px; }
.sb-footer-card {
  background: linear-gradient(135deg, rgba(212, 166, 75, 0.15), rgba(199, 0, 11, 0.15));
  border: 1px solid rgba(212, 166, 75, 0.3);
  border-radius: 10px; padding: 12px; display: flex; gap: 10px; align-items: center;
  cursor: pointer; transition: 0.2s;
}
.sb-footer-card:hover { transform: translateY(-2px); }
.sb-fc-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, var(--cmb-gold), #a97f28);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.sb-fc-title { font-size: 12px; font-weight: 600; color: #fff; }
.sb-fc-sub { font-size: 11px; color: var(--sidebar-text-dim); margin-top: 2px; }

/* ================================
   主内容
================================ */
.main-content {
  flex: 1; padding: 20px 24px; overflow-x: hidden;
}

.breadcrumb {
  font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.breadcrumb i { font-size: 10px; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ================================
   通用：卡片 / 按钮 / 标签
================================ */
.card {
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 20px;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--cmb-red); }
.card-sub { font-size: 12px; color: var(--text-dim); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; font-size: 13px;
  transition: 0.2s; font-weight: 500;
}
.btn-primary { background: var(--cmb-red); color: #fff; }
.btn-primary:hover { background: var(--cmb-red-dark); }
.btn-ghost { background: #f4f6fa; color: var(--text-sub); }
.btn-ghost:hover { background: #eaecf2; color: var(--text); }
.btn-outline { background: transparent; color: var(--cmb-red); border: 1px solid var(--cmb-red); }
.btn-outline:hover { background: var(--cmb-red-light); }
.btn-gold { background: var(--cmb-gold); color: #3c2a00; }
.btn-gold:hover { background: #c2932f; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px;
  background: #f4f6fa; color: var(--text-sub); font-weight: 500;
}
.tag-red { background: #fdecec; color: var(--danger); }
.tag-green { background: #e7f6ee; color: var(--success); }
.tag-gold { background: var(--cmb-gold-soft); color: #8c6d1f; }
.tag-blue { background: #e8f0ff; color: var(--info); }
.tag-purple { background: #f2ebff; color: #7b3ff2; }
.tag-cmb { background: var(--cmb-red-light); color: var(--cmb-red); }

/* ================================
   工作台 - KPI卡
================================ */
.kpi-card {
  background: linear-gradient(135deg, #fff 0%, #fafbfd 100%);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px;
  position: relative; overflow: hidden; transition: 0.25s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card .kpi-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff;
  position: absolute; top: 18px; right: 18px;
}
.kpi-label { font-size: 12px; color: var(--text-dim); }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -0.5px; }
.kpi-unit { font-size: 13px; color: var(--text-sub); font-weight: 500; margin-left: 3px; }
.kpi-delta { font-size: 11px; margin-top: 6px; display: flex; gap: 4px; align-items: center; }
.kpi-delta.up { color: var(--up); }
.kpi-delta.down { color: var(--down); }
.kpi-delta.flat { color: var(--text-dim); }

/* 涨跌通用 tag */
.tag-up   { background: var(--up-bg);   color: var(--up); }
.tag-down { background: var(--down-bg); color: var(--down); }

.kpi-card.red .kpi-icon { background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark)); }
.kpi-card.gold .kpi-icon { background: linear-gradient(135deg, var(--cmb-gold), #a97f28); }
.kpi-card.blue .kpi-icon { background: linear-gradient(135deg, #4a90ff, #1a5fd4); }
.kpi-card.green .kpi-icon { background: linear-gradient(135deg, #2bd289, #119a5f); }

/* 快捷入口 */
.quick-entries { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.qe-item {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 16px 12px; text-align: center; cursor: pointer;
  transition: 0.2s;
}
.qe-item:hover { border-color: var(--cmb-red); transform: translateY(-3px); box-shadow: var(--shadow); }
.qe-icon {
  width: 44px; height: 44px; border-radius: 10px;
  margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.qe-label { font-size: 13px; font-weight: 600; }
.qe-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* 待办列表 */
.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item {
  display: flex; gap: 12px; padding: 10px 12px; border-radius: 8px;
  background: #fafbfd; border-left: 3px solid var(--cmb-red); align-items: center;
}
.todo-icon {
  width: 32px; height: 32px; border-radius: 8px; background: #fff;
  display: flex; align-items: center; justify-content: center; color: var(--cmb-red);
}
.todo-title { font-size: 13px; font-weight: 600; }
.todo-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.todo-time { margin-left: auto; font-size: 11px; color: var(--text-dim); }

/* ================================
   通用表格
================================ */
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-weight: 600; font-size: 12px; color: var(--text-sub);
  background: #fafbfd; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; font-size: 13px; border-bottom: 1px solid var(--border-soft); }
.table tr:hover td { background: #fafbfd; }

/* ================================
   基金健诊
================================ */
.fd-header {
  background: linear-gradient(135deg, var(--cmb-red) 0%, var(--cmb-red-dark) 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.fd-header::before {
  content: ""; position: absolute; right: -50px; top: -50px;
  width: 200px; height: 200px; background: rgba(255, 255, 255, 0.08); border-radius: 50%;
}
.fd-header::after {
  content: ""; position: absolute; right: 60px; bottom: -80px;
  width: 160px; height: 160px; background: rgba(212, 166, 75, 0.15); border-radius: 50%;
}
.fd-search-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; position: relative; z-index: 1; }
.fd-search-input {
  flex: 1; max-width: 520px; height: 40px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.95); padding: 0 14px; border: none; outline: none;
  font-size: 14px;
}

.fd-summary { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; }
.fd-score-card {
  text-align: center; padding: 20px;
  background: linear-gradient(180deg, #fff7e6 0%, #fff 60%);
  border-radius: 12px; border: 1px solid var(--cmb-gold-soft);
}
.fd-score-num { font-size: 54px; font-weight: 800; color: var(--cmb-red); line-height: 1; }
.fd-score-label { font-size: 13px; color: var(--text-sub); margin-top: 6px; }
.fd-score-level { display: inline-block; margin-top: 10px; padding: 3px 12px; border-radius: 10px;
  background: var(--cmb-gold-soft); color: #8c6d1f; font-weight: 600; font-size: 12px; }

.fd-dim-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.fd-dim-row:last-child { border-bottom: none; }
.fd-dim-name { font-size: 13px; color: var(--text-sub); display: flex; align-items: center; gap: 6px; }
.fd-dim-bar { flex: 1; height: 6px; background: #eef1f6; border-radius: 3px; margin: 0 12px; overflow: hidden; }
.fd-dim-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--cmb-gold), var(--cmb-red)); }
.fd-dim-val { font-size: 13px; font-weight: 600; min-width: 44px; text-align: right; }

.fd-advice {
  background: linear-gradient(135deg, #fff 0%, var(--cmb-red-light) 100%);
  border-left: 4px solid var(--cmb-red); padding: 14px 16px; border-radius: 10px;
}
.fd-advice-title { font-size: 13px; font-weight: 700; color: var(--cmb-red); display: flex; align-items: center; gap: 6px; }
.fd-advice-body { font-size: 13px; color: var(--text-sub); margin-top: 6px; line-height: 1.7; }
.fd-advice-actions { margin-top: 10px; display: flex; gap: 8px; }

/* 健诊 · 客户列表项 */
.fd-cust-item {
  padding: 12px; border-radius: 10px; border: 1px solid var(--border-soft);
  margin-bottom: 8px; cursor: pointer; transition: 0.15s; background: #fff;
}
.fd-cust-item:hover { border-color: var(--cmb-red); background: var(--cmb-red-light); }
.fd-cust-item.active {
  border-color: var(--cmb-red); background: var(--cmb-red-light);
  box-shadow: 0 2px 8px rgba(199, 0, 11, 0.15);
}

.fd-holding-card { padding: 16px; transition: 0.2s; border-left: 3px solid transparent; }
.fd-holding-card:hover { border-left-color: var(--cmb-red); box-shadow: var(--shadow); }

/* ================================
   STEP 1 · 产品池 Tab + 卡片
================================ */
.product-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin: 12px 0 16px;
}
.product-tab {
  padding: 9px 18px; cursor: pointer; border-bottom: 2px solid transparent;
  color: var(--text-sub); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px; transition: 0.15s;
}
.product-tab:hover { color: var(--cmb-red); }
.product-tab.active {
  color: var(--cmb-red); border-bottom-color: var(--cmb-red); font-weight: 700;
}
.product-tab .pt-count {
  background: #f0f2f7; color: var(--text-sub); font-size: 11px;
  padding: 1px 7px; border-radius: 8px; font-weight: 600;
}
.product-tab.active .pt-count { background: var(--cmb-red); color: #fff; }

.product-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  max-height: 380px; overflow-y: auto; padding-right: 4px;
}
@media (max-width: 1500px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .product-grid { grid-template-columns: minmax(0, 1fr); } }
.product-grid::-webkit-scrollbar { width: 4px; }
.product-grid::-webkit-scrollbar-thumb { background: #cfd3de; border-radius: 3px; }

/* 允许卡片在栅格中收窄，避免内部「近1年/今年以来/规模」行被挤出换行 */
.product-grid > .product-card { min-width: 0; }

.product-card {
  background: #fff; border: 1.5px solid var(--border-soft); border-radius: 10px;
  padding: 14px; cursor: pointer; transition: 0.2s; position: relative;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.product-card:hover {
  border-color: var(--cmb-red); transform: translateY(-2px); box-shadow: var(--shadow);
}
.product-card.active {
  border-color: var(--cmb-red);
  background: linear-gradient(135deg, var(--cmb-red-light) 0%, #fff 60%);
  box-shadow: 0 0 0 3px rgba(199, 0, 11, 0.12);
}
.product-card.active::after {
  content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  position: absolute; top: 0; right: 0;
  width: 26px; height: 26px;
  background: var(--cmb-red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; border-radius: 0 9px 0 10px;
}

.pc-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.pc-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark));
  color: #fff; font-weight: 700; letter-spacing: 0.5px; flex-shrink: 0;
}
.pc-tag.gold { background: linear-gradient(135deg, var(--cmb-gold), #a97f28); color: #fff; }
.pc-tag.gray { background: #f0f2f7; color: var(--text-sub); }
.pc-stars { color: var(--cmb-gold); font-size: 11px; letter-spacing: 1px; }

/* 名称/代码区：在窄卡片内可正确省略号，需允许横向收缩 */
.product-card > div:nth-child(2) { min-width: 0; width: 100%; }

.pc-name {
  font-size: 14px; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pc-meta {
  font-size: 11px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 三列业绩指标：等分 + 可收缩，禁止整列被撑开导致换行 */
.pc-perf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 8px;
  padding: 8px 0; margin-top: 2px;
  border-top: 1px dashed var(--border-soft);
  align-items: start;
}
.pc-perf-item {
  min-width: 0;
  text-align: center;
}
.pc-perf-item .pp-label {
  font-size: 11px; color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-perf-item .pp-val {
  font-size: clamp(13px, 2.4vw, 16px);
  font-weight: 700; line-height: 1.15; margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-desc {
  font-size: 12px; color: var(--text-sub); line-height: 1.5;
  background: #fafbfd; padding: 6px 8px; border-radius: 6px;
}

/* ================================
   客户筛选
================================ */
.cf-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.cf-filter-group { margin-bottom: 18px; }
.cf-filter-title { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; font-weight: 600; letter-spacing: 0.5px; }
.cf-filter-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-chip {
  padding: 4px 10px; border-radius: 14px; background: #f4f6fa;
  font-size: 12px; cursor: pointer; transition: 0.15s; user-select: none;
  border: 1px solid transparent;
}
.cf-chip:hover { background: #eaecf2; }
.cf-chip.active { background: var(--cmb-red-light); color: var(--cmb-red); border-color: var(--cmb-red); font-weight: 600; }

.customer-row-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #eaecf2;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-sub); font-weight: 600; margin-right: 8px; font-size: 13px;
}

/* ================================
   营销话术
================================ */
.ms-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.ms-profile-card {
  padding: 14px; border-radius: 10px; margin-bottom: 10px;
  border: 1px solid var(--border); cursor: pointer; transition: 0.2s;
}
.ms-profile-card:hover { border-color: var(--cmb-red); }
.ms-profile-card.active { background: var(--cmb-red-light); border-color: var(--cmb-red); }
.ms-profile-head { display: flex; gap: 10px; align-items: center; }
.ms-profile-avatar {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.ms-profile-name { font-size: 13px; font-weight: 600; }
.ms-profile-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.chat-box {
  background: #f7f8fc; border-radius: 12px; padding: 16px;
  max-height: 500px; overflow-y: auto;
}
.chat-msg { display: flex; gap: 10px; margin-bottom: 16px; }
.chat-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px;
}
.chat-avatar.ai { background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark)); }
.chat-avatar.user { background: linear-gradient(135deg, var(--cmb-gold), #a97f28); }
.chat-bubble {
  background: #fff; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; line-height: 1.7; max-width: 86%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.chat-msg.me { flex-direction: row-reverse; }
.chat-msg.me .chat-bubble { background: var(--cmb-red); color: #fff; }

.script-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  margin-bottom: 10px; transition: 0.2s;
}
.script-card:hover { border-color: var(--cmb-red); box-shadow: var(--shadow); }
.script-card-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.script-card-tag { font-size: 11px; color: var(--cmb-red); font-weight: 600; }
.script-card-body { font-size: 13px; color: var(--text); line-height: 1.7; }

/* ================================
   市场温度计
================================ */
.thermo-hero {
  display: grid; grid-template-columns: 280px 1fr; gap: 20px;
  background: linear-gradient(135deg, #fff 0%, #fffaf0 100%);
  border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--cmb-gold-soft);
}
.thermo-gauge-wrap { text-align: center; }
.thermo-temp {
  font-size: 60px; font-weight: 800; line-height: 1;
  background: linear-gradient(90deg, #2bd289, var(--cmb-gold), var(--cmb-red));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.thermo-state { font-size: 14px; color: var(--text-sub); margin-top: 8px; }
.thermo-badge {
  display: inline-block; margin-top: 10px; padding: 5px 16px; border-radius: 16px;
  background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark)); color: #fff;
  font-weight: 600; font-size: 13px;
}

.thermo-dim-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.thermo-dim-item {
  background: #fff; border-radius: 10px; padding: 12px;
  border: 1px solid var(--border);
}
.thermo-dim-item .name { font-size: 12px; color: var(--text-dim); }
.thermo-dim-item .value { font-size: 18px; font-weight: 700; margin-top: 4px; }
.thermo-dim-item .trend { font-size: 11px; margin-top: 2px; }

/* ================================
   存量产品业绩跟踪 · 表格
================================ */
.fpt-layout { display: flex; flex-direction: column; gap: 14px; }

.fpt-card { padding: 20px 22px; }
.fpt-hero {
  background: linear-gradient(135deg, #fff 0%, #fff8f6 45%, #fafbfd 100%);
  border: 1px solid var(--border-soft);
}
.fpt-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap;
}
.fpt-kicker {
  font-size: 11px; letter-spacing: 1.2px; color: var(--text-dim);
  text-transform: uppercase; display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.fpt-kicker i { color: var(--cmb-red); font-size: 12px; text-transform: none; }
.fpt-title {
  margin: 0; font-size: 20px; font-weight: 700; color: var(--text);
  letter-spacing: 0.5px;
}
.fpt-meta { margin-top: 6px; font-size: 13px; color: var(--text-sub); }
.fpt-meta b { color: var(--cmb-red); font-weight: 600; }

.fpt-toolbar { margin-bottom: 0; }
.fpt-tb-meta { font-size: 12px; color: var(--text-dim); }

.fpt-table-card { padding: 0; overflow: hidden; }
.fpt-cat-tabs-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px 12px;
  background: linear-gradient(180deg, #fafbfd 0%, #fff 100%);
  border-bottom: 1px solid var(--border-soft);
}
.fpt-tabs-label {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  letter-spacing: 1px; flex-shrink: 0;
}
.fpt-cat-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; flex: 1; min-width: 0;
}
.fpt-cat-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-sub);
  background: #fff; border: 1px solid var(--border);
  cursor: pointer; transition: 0.15s; font-family: inherit;
}
.fpt-cat-tab:hover {
  border-color: var(--cmb-red); color: var(--cmb-red); background: var(--cmb-red-light);
}
.fpt-cat-tab.active {
  background: linear-gradient(135deg, var(--cmb-red) 0%, var(--cmb-red-dark) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(199, 0, 11, 0.25);
}
.fpt-tab-count {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.06); color: inherit;
}
.fpt-cat-tab.active .fpt-tab-count {
  background: rgba(255, 255, 255, 0.25);
}

.fpt-th-cat-col.is-hidden { display: none; }

.fpt-col-cat-chip {
  width: 88px; text-align: left !important; white-space: nowrap;
}
.fpt-cat-chip {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: #fff;
}
.fpt-cat-chip[data-cat="权益"] { background: linear-gradient(90deg, #c42b36, var(--cmb-red-dark)); }
.fpt-cat-chip[data-cat="固收+"] { background: linear-gradient(90deg, #5c6bc0, #3949ab); }
.fpt-cat-chip[data-cat="债券"] { background: linear-gradient(90deg, #00897b, #00695c); }

.fpt-table-scroll {
  overflow: auto;
  max-height: min(68vh, 760px);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.fpt-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
.fpt-table thead th {
  background: linear-gradient(180deg, #a01018 0%, var(--cmb-red-dark) 100%);
  color: #fff; font-weight: 600; text-align: center;
  padding: 12px 8px; border-bottom: none;
  position: sticky; top: 0; z-index: 3;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(138, 0, 10, 0.25);
}
.fpt-table thead th.fpt-col-name,
.fpt-table tbody td.fpt-col-name { text-align: left; }
.fpt-table thead th.fpt-col-cat-chip { text-align: left; }
.fpt-table thead th.fpt-col-mgr,
.fpt-table tbody td.fpt-col-mgr { text-align: left; max-width: 140px; }
.fpt-th-sub {
  display: block; font-size: 10px; font-weight: 400; opacity: 0.9; margin-top: 2px;
}
.fpt-table tbody td {
  padding: 10px 8px; border-bottom: 1px solid var(--border-soft);
  vertical-align: middle; text-align: center;
  background: #fff;
}
.fpt-table tbody tr:nth-child(even) td { background: #fafbfd; }
.fpt-table tbody tr:hover td { background: #fff5f4 !important; }

.fpt-col-idx { width: 48px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.fpt-table thead th.fpt-col-remark,
.fpt-table tbody td.fpt-col-remark {
  text-align: left;
  min-width: 160px;
  max-width: 280px;
  vertical-align: top;
  position: sticky;
  right: 0;
  z-index: 1;
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.04);
}
.fpt-table thead th.fpt-col-remark {
  z-index: 4;
  background: linear-gradient(180deg, #8a0b12 0%, #6d080e 100%);
}
.fpt-table tbody td.fpt-col-remark {
  background: #fff;
}
.fpt-table tbody tr:nth-child(even) td.fpt-col-remark { background: #fafbfd; }
.fpt-table tbody tr:hover td.fpt-col-remark { background: #fff5f4 !important; }

.fpt-remark-input {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  padding: 8px 10px;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #fff;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.fpt-remark-input:focus {
  outline: none;
  border-color: var(--cmb-red);
  box-shadow: 0 0 0 2px rgba(199, 0, 11, 0.12);
}
.fpt-remark-input::placeholder { color: var(--text-dim); opacity: 0.75; }

.fpt-code {
  font-family: ui-monospace, "Consolas", monospace; font-size: 12px;
  background: #eef1f6; padding: 3px 8px; border-radius: 5px; color: var(--text);
}
.fpt-nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }

.fpt-num.fpt-pct-up { color: var(--up); font-weight: 600; }
.fpt-num.fpt-pct-down { color: var(--down); font-weight: 600; }
.fpt-num.fpt-pct-flat { color: var(--text-sub); }

.fpt-footnote {
  margin: 0;
  padding: 12px 18px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  background: #f7f8fc;
  border-top: 1px solid var(--border-soft);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.fpt-footnote i { color: var(--cmb-gold); margin-top: 3px; flex-shrink: 0; }

.fpt-table-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.fpt-table-scroll::-webkit-scrollbar-thumb { background: #c5cad8; border-radius: 4px; }

/* 加载 / 刷新状态 */
.fpt-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fpt-loading-hint { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.fpt-spin { color: var(--cmb-red); }
.fpt-cache-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 10px;
  background: var(--bg-card, #f5f5f5); color: var(--text-dim, #999);
  border: 1px solid var(--border, #e0e0e0);
  cursor: default; vertical-align: middle; margin-left: 6px;
}

/* 数据过期自动更新横幅 */
.fpt-stale-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #795548;
  font-size: 13px;
  line-height: 1.5;
}
.fpt-stale-banner b { color: #5d4037; }
.fpt-stale-banner .fa-rotate { color: #f9a825; flex-shrink: 0; }

/* 服务不可用：使用浏览器缓存快照时的提示（非报错） */
.fpt-offline-banner {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 10px;
  padding: 12px 18px; margin-bottom: 8px; border-radius: 8px; line-height: 1.55;
  font-size: 13px; color: #1a3764;
  background: linear-gradient(90deg, #e8f0ff 0%, #fafbfd 100%);
  border: 1px solid #b8cae8;
}
.fpt-offline-banner i.fa-plug-circle-xmark { color: #3d6fad; flex-shrink: 0; margin-top: 2px; }
.fpt-offline-banner code { font-size: 12px; }

/* ================================
   热点资讯
================================ */
.news-hero {
  background: linear-gradient(135deg, var(--cmb-red), var(--cmb-red-dark));
  color: #fff; border-radius: var(--radius-lg); padding: 28px 24px;
  position: relative; overflow: hidden;
}
.news-hero-tag { display: inline-block; padding: 3px 10px; border-radius: 4px;
  background: var(--cmb-gold); color: #3c2a00; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.news-hero h2 { font-size: 22px; margin: 10px 0 6px; }
.news-hero-meta { font-size: 12px; opacity: 0.85; }

.news-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.news-tab {
  padding: 8px 14px; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent;
  color: var(--text-sub);
}
.news-tab.active { color: var(--cmb-red); border-color: var(--cmb-red); font-weight: 600; }

.news-card {
  background: #fff; border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 16px; margin-bottom: 12px; transition: 0.2s;
  display: grid; grid-template-columns: 1fr 120px; gap: 16px;
}
.news-card:hover { border-color: var(--cmb-red); box-shadow: var(--shadow); }
.news-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.news-card p { margin: 0; font-size: 13px; color: var(--text-sub); line-height: 1.6; }
.news-card-meta {
  margin-top: 10px; font-size: 11px; color: var(--text-dim);
  display: flex; gap: 12px; align-items: center;
}
.news-card-thumb {
  border-radius: 8px; background: linear-gradient(135deg, var(--cmb-red-light), var(--cmb-gold-soft));
  display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--cmb-red);
}

/* ================================
   模态 / Toast
================================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: var(--radius-lg); max-width: 560px; width: 90%;
  padding: 22px; box-shadow: var(--shadow-lg);
}
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal-footer { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; top: 72px; right: 24px; background: #fff;
  border-left: 4px solid var(--success); box-shadow: var(--shadow-lg);
  padding: 12px 18px; border-radius: 8px; font-size: 13px;
  animation: slideIn 0.25s ease; z-index: 999;
  display: flex; align-items: center; gap: 8px;
}
.toast.error { border-color: var(--danger); }
.toast i { color: var(--success); }
.toast.error i { color: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 图表容器 */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { max-width: 100%; }

/* 分段进度 */
.progress-mini { height: 6px; background: #eef1f6; border-radius: 3px; overflow: hidden; }
.progress-mini > span { display: block; height: 100%; background: var(--cmb-red); }

/* 选中高亮文字 */
::selection { background: var(--cmb-red); color: #fff; }

/* 迷你滚动条 */
.main-content ::-webkit-scrollbar { width: 6px; height: 6px; }
.main-content ::-webkit-scrollbar-thumb { background: #cfd3de; border-radius: 3px; }
.main-content ::-webkit-scrollbar-thumb:hover { background: #a9aebc; }

/* 空状态 */
.empty-state {
  text-align: center; padding: 40px; color: var(--text-dim);
}
.empty-state i { font-size: 40px; color: #cfd3de; margin-bottom: 12px; }

/* 工具条 */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; padding: 12px 16px; border-radius: 10px; margin-bottom: 14px;
  box-shadow: var(--shadow); gap: 12px; flex-wrap: wrap;
}
.toolbar .tb-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.toolbar input.tb-input {
  height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; min-width: 220px;
}
.toolbar input.tb-input:focus { border-color: var(--cmb-red); }
.toolbar select {
  height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; background: #fff;
}
