/* =========================================================
   平安寿险 · 智能展业助手 —— 高端 UI 样式
   玻璃拟态 / 渐变 / 明暗主题 / 平滑动画
   ========================================================= */

/* 注册 CSS 自定义属性，使 conic-gradient 的 --p 可被 transition 驱动（仪表盘圆环填充动画） */
@property --p {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

:root {
  --bg: #f4f6fb;
  --bg-grad-1: #e8edff;
  --bg-grad-2: #fde8f0;
  --bg-grad-3: #e6f7ff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(20, 30, 80, 0.08);
  --text: #1a2240;
  --text-soft: #5a6485;
  --text-faint: #8b94b3;
  --primary: #2b3a8f;       /* 信任蓝 */
  --primary-soft: #4f5fd6;
  --accent: #ff7a18;        /* 平安橙 · 新鲜感 */
  --accent-soft: #ffb070;
  --good: #1faa6b;
  --warn: #e8893b;
  --bad: #e0526b;
  --shadow: 0 18px 50px -20px rgba(30, 40, 100, 0.35);
  --radius: 20px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  --bg: #0c1024;
  --bg-grad-1: #141a3a;
  --bg-grad-2: #2a1530;
  --bg-grad-3: #0e2236;
  --surface: rgba(28, 34, 64, 0.62);
  --surface-solid: #161c34;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef1ff;
  --text-soft: #aab2d8;
  --text-faint: #767fa6;
  --primary: #6b7bff;
  --primary-soft: #8a96ff;
  --accent: #ff8a33;
  --accent-soft: #ffb070;
  --good: #34d399;
  --warn: #fbbf6b;
  --bad: #f8719a;
  --shadow: 0 22px 60px -22px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
}

/* 动态渐变背景 */
.bg-blobs { position: fixed; inset: 0; z-index: -2; overflow: hidden; }
.bg-blobs span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55;
  animation: float 16s ease-in-out infinite;
}
.bg-blobs span:nth-child(1){ width: 460px; height: 460px; background: var(--bg-grad-1); top: -120px; left: -80px; }
.bg-blobs span:nth-child(2){ width: 380px; height: 380px; background: var(--bg-grad-2); bottom: -100px; right: -60px; animation-delay: -5s; }
.bg-blobs span:nth-child(3){ width: 320px; height: 320px; background: var(--bg-grad-3); top: 40%; left: 55%; animation-delay: -9s; }
@keyframes float { 0%,100%{ transform: translate(0,0) scale(1);} 50%{ transform: translate(30px,-40px) scale(1.08);} }

/* 轻量粒子画布 */
#particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5; }

/* ---------- 布局 ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 22px 26px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: var(--shadow);
}
.brand h1 { font-size: 19px; letter-spacing: .5px; }
.brand p { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* 按钮 */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px; transition: transform .2s, box-shadow .2s, background .2s;
  backdrop-filter: blur(12px);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  color: #fff; border: none;
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff; border: none;
}
.btn-ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(224,82,107,.3); }
.btn.danger:hover { background: var(--bad); color: #fff; }

/* 主题切换 */
.theme-toggle {
  width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 20px; display: grid; place-items: center;
  backdrop-filter: blur(12px); transition: transform .2s;
}
.theme-toggle:hover { transform: rotate(18deg) scale(1.05); }

/* ---------- 检索区 ---------- */
.search-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); backdrop-filter: blur(20px); margin-bottom: 22px;
}
.search-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 240px; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); font-size: 15px;
  outline: none; transition: border .2s, box-shadow .2s;
}
.search-input:focus { border-color: var(--primary-soft); box-shadow: 0 0 0 4px rgba(79,95,214,.15); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-solid); color: var(--text-soft); cursor: pointer; font-size: 13px;
  transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--primary-soft); transform: translateY(-1px); }
.chip.active { background: linear-gradient(135deg, var(--primary), var(--primary-soft)); color: #fff; border: none; }

/* ---------- 流程步骤 ---------- */
.steps { display: flex; gap: 10px; margin: 6px 0 22px; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--border); backdrop-filter: blur(12px); opacity: .5; transition: all .35s;
}
.step.active { opacity: 1; border-color: var(--primary-soft); box-shadow: var(--shadow); }
.step.done { opacity: 1; }
.step .num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; flex: none;
}
.step.active .num { background: linear-gradient(135deg, var(--accent), var(--accent-soft)); }
.step .label { font-size: 13px; color: var(--text-soft); }
.step.active .label, .step.done .label { color: var(--text); }

/* ---------- 内容网格 ---------- */
.grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
@media (max-width: 920px){ .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
  animation: rise .5s cubic-bezier(.16,1,.3,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* 卡片错落入场：同网格内第 2/3/4 张延迟依次递增，视觉层次感 */
.grid > .card:nth-child(1) { animation-delay: 0ms; }
.grid > .card:nth-child(2) { animation-delay: 80ms; }
.grid > .card:nth-child(3) { animation-delay: 160ms; }
.grid > .card:nth-child(4) { animation-delay: 240ms; }

.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-title .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.card-title h2 { font-size: 16px; }
.card-title .sub { font-size: 12px; color: var(--text-faint); margin-left: auto; }

/* 客户基本信息 */
.cust-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avatar {
  width: 64px; height: 64px; border-radius: 18px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 26px; font-weight: 800;
}
.cust-head .name { font-size: 22px; font-weight: 700; }
.cust-head .meta { font-size: 13px; color: var(--text-soft); margin-top: 3px; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.kv .item .k { font-size: 12px; color: var(--text-faint); }
.kv .item .v { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* 画像 */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.tag {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(79,95,214,.12); color: var(--primary-soft); border: 1px solid rgba(79,95,214,.2);
}
.tag.hot { background: rgba(255,122,24,.14); color: var(--accent); border-color: rgba(255,122,24,.25); }
.tag.ok { background: rgba(31,170,107,.14); color: var(--good); border-color: rgba(31,170,107,.25); }

.sentence { font-size: 14px; line-height: 1.7; color: var(--text-soft); padding: 14px; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border); }

.gauge-wrap { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.gauge { --p: 0; width: 92px; height: 92px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p)*1%), rgba(120,130,170,.18) 0);
  display: grid; place-items: center; position: relative; transition: --p 1s; }
.gauge::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface-solid); }
.gauge .val { position: relative; font-size: 20px; font-weight: 800; }
.gauge-info .label { font-size: 13px; color: var(--text-faint); }
.gauge-info .state { font-size: 17px; font-weight: 700; margin-top: 2px; }

/* 现有保障表 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--text-faint); font-weight: 600; font-size: 12px; }
.tbl td .cat { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; background: rgba(79,95,214,.12); color: var(--primary-soft); }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; }
.badge.ok { background: rgba(31,170,107,.14); color: var(--good); }
.badge.paid { background: rgba(120,130,170,.16); color: var(--text-soft); }
.empty { text-align: center; color: var(--text-faint); padding: 24px; font-size: 14px; }

/* 缺口条 */
.gap-row { margin-bottom: 14px; }
.gap-row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.gap-row .top .cat { font-weight: 600; }
.gap-row .top .num { color: var(--text-soft); }
.bar { height: 9px; border-radius: 999px; background: rgba(120,130,170,.18); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-soft)); transition: width 1s cubic-bezier(.16,1,.3,1); }
.bar.miss > i { background: linear-gradient(90deg, var(--accent), var(--bad)); }

/* 推荐卡 */
.rec { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; background: var(--surface-solid); transition: transform .25s, box-shadow .25s; }
.rec:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.rec .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rec .pname { font-size: 15.5px; font-weight: 700; }
.rec .cat { font-size: 12px; color: var(--accent); font-weight: 700; }
.rec .score { font-size: 12px; color: var(--text-faint); }
.rec .reasons { margin-top: 10px; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.rec .reasons li { font-size: 13px; color: var(--text-soft); padding-left: 18px; position: relative; line-height: 1.5; }
.rec .reasons li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }
.rec .plan { margin-top: 12px; display: flex; gap: 18px; font-size: 13px; }
.rec .plan b { color: var(--primary-soft); }

/* 条款依据（IMA 知识库引用） */
.clause { margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(99,102,241,.10), rgba(168,85,247,.08));
  border: 1px solid rgba(99,102,241,.22); }
.clause-h { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .3px; }
.clause-row { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; line-height: 1.5; padding-left: 2px; }
.clause-row::before { content: "› "; color: var(--accent); font-weight: 700; }
.clause-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.clause-item { padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); font-size: 13px; color: var(--text-soft); line-height: 1.55; }
.clause-item b { color: var(--primary-soft); font-size: 14px; }
.ci-cat { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; font-size: 11px;
  background: rgba(99,102,241,.14); color: var(--accent); }

/* 建议书 */
.proposal {
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 34px 38px; box-shadow: var(--shadow); margin-top: 22px; line-height: 1.7;
}
.proposal .ph { text-align: center; border-bottom: 2px solid var(--primary-soft); padding-bottom: 18px; margin-bottom: 22px; }
.proposal .ph .t { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.proposal .ph .s { font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.proposal section { margin-bottom: 22px; }
.proposal h3 { font-size: 15px; color: var(--primary-soft); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.proposal h3::before { content: ""; width: 4px; height: 16px; background: var(--accent); border-radius: 2px; }
.proposal p, .proposal li { font-size: 13.5px; color: var(--text); }
.proposal ul { padding-left: 20px; }
.proposal .kv2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.proposal .kv2 .b { padding: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.proposal .kv2 .b .k { font-size: 12px; color: var(--text-faint); }
.proposal .kv2 .b .v { font-size: 16px; font-weight: 700; margin-top: 3px; }
.proposal .sign { margin-top: 26px; display: flex; justify-content: space-between; font-size: 13px; color: var(--text-soft); border-top: 1px dashed var(--border); padding-top: 16px; }
  .note { font-size: 12px; color: var(--text-faint); margin-top: 10px; }

  /* 客户跟进记录 */
  .fu-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px;
    background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
  .fu-form .field { margin-bottom: 0; }
  .fu-actions { display: flex; gap: 8px; padding-bottom: 2px; }
  .fu-list { display: flex; flex-direction: column; gap: 10px; }
  .fu-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-solid); transition: transform .2s, box-shadow .2s; }
  .fu-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  .fu-tag { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: rgba(79,95,214,.12); color: var(--primary-soft); }
  .fu-tag.拜访, .fu-tag.加保 { background: rgba(255,122,24,.14); color: var(--accent); }
  .fu-tag.续保, .fu-tag.生日 { background: rgba(31,170,107,.14); color: var(--good); }
  .fu-main { flex: 1; min-width: 0; }
  .fu-top { display: flex; align-items: center; gap: 8px; }
  .fu-date { font-size: 12px; color: var(--text-faint); }
  .fu-note { font-size: 13.5px; color: var(--text); margin-top: 4px; line-height: 1.55; }
  .fu-del { flex: none; }

  /* 提醒视图导出工具栏 */
  .rem-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
  .rem-tools .btn { font-size: 13px; padding: 8px 14px; }

/* ---------- 视图切换过渡 ---------- */
[id$="View"], section[id$="View"] {
  animation: viewIn .4s cubic-bezier(.16,1,.3,1) both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* 空态 */
.placeholder { text-align: center; padding: 80px 20px; color: var(--text-faint); }
.placeholder .ico { font-size: 54px; margin-bottom: 14px; }
.placeholder h3 { color: var(--text-soft); font-size: 18px; margin-bottom: 8px; }

/* 视图切换 Tab */
.tabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); cursor: pointer; font-size: 14.5px; font-weight: 600;
  backdrop-filter: blur(12px); transition: all .25s;
  position: relative; overflow: hidden;
}
.tab::after {
  content: ''; position: absolute; bottom: 0; left: 50%; height: 3px; width: 70%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px; transform: translateX(-50%) scaleX(0);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.tab:hover { transform: translateY(-2px); color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-soft)); color: #fff; border: none; box-shadow: var(--shadow); }
.tab.active::after { transform: translateX(-50%) scaleX(1); }

/* 团队成员卡 */
.fmember-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.fmember { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-solid); }
.fm-head { display: flex; align-items: center; gap: 8px; }
.fm-head b { font-size: 15px; }
.fm-role { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(79,95,214,.14); color: var(--primary-soft); }
.fm-age { font-size: 12px; color: var(--text-faint); margin-left: auto; }
.fm-state { font-size: 14px; font-weight: 700; margin: 8px 0; }
.fm-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.fm-tags .tag { font-size: 11px; padding: 3px 8px; }

/* 团队 KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.kpi .k { font-size: 13px; color: var(--text-faint); }
.kpi .v { font-size: 26px; font-weight: 800; margin-top: 6px; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ================= 业绩目标达成（团队看板头条） ================= */
.goal-card { margin-bottom: 20px; border: 1px solid var(--border); background: var(--surface); }
.goal-hero { text-align: center; padding: 4px 0 16px; }
.goal-val { font-size: 42px; font-weight: 900; letter-spacing: .5px; line-height: 1.1;
  background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.goal-sub { font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.goal-bar-wrap { margin: 6px 0 16px; }
.goal-bar { height: 16px; border-radius: 999px; background: rgba(120,130,170,.18); overflow: hidden; }
.goal-bar > i { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width 1.1s cubic-bezier(.16,1,.3,1); }
.goal-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13.5px; }
.goal-pct b { color: var(--accent); font-size: 16px; }
.goal-diff.warn { color: var(--warn); font-weight: 600; }
.goal-diff.good { color: var(--good); font-weight: 600; }
.goal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.goal-stats .gs { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border); text-align: center; }
.goal-stats .gs .k { font-size: 12px; color: var(--text-faint); }
.goal-stats .gs .v { font-size: 18px; font-weight: 800; margin-top: 4px; }
.goal-top { border-top: 1px dashed var(--border); padding-top: 14px; }
.goal-top .gt-title { font-size: 13px; color: var(--text-soft); font-weight: 700; margin-bottom: 8px; }
.goal-top .gt-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.goal-top .gt-row:last-child { border-bottom: none; }
.goal-top .gt-name { color: var(--text); }
.goal-top .gt-prem { color: var(--primary-soft); font-weight: 700; }
@media (max-width: 480px){ .goal-stats { grid-template-columns: 1fr; } .goal-val { font-size: 32px; } }

/* 看板条形图 */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-row .bl { width: 64px; font-size: 13px; color: var(--text-soft); flex: none; text-align: right; }
.bar-row .bn { width: 76px; font-size: 12.5px; color: var(--text-faint); flex: none; }
.bar-row .bar { flex: 1; height: 12px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10,15,40,.45); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 50;
  opacity: 0; visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.modal-mask.show { opacity: 1; visibility: visible; }
.modal {
  width: min(520px, 92vw); max-height: 86vh; overflow: auto;
  background: var(--surface-solid); border-radius: var(--radius); padding: 26px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transform: scale(.88) translateY(14px);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.modal-mask.show .modal { transform: scale(1) translateY(0); }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 5px; }
.field input, .field select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14px; outline: none; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.hidden { display: none !important; }

/* 登录用户徽标 */
.user-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(10px); font-size: 13px;
}
.user-badge .ub-name { font-weight: 700; color: var(--text); }
.user-badge .ub-role {
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: #fff;
}
.user-badge .mini-btn { padding: 3px 8px; font-size: 12px; }

/* ---------- 登录 / 注册体验增强 ---------- */
.login-modal { text-align: left; }
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 24px rgba(255,122,24,.35);
}
/* 密码输入框 + 眼睛切换 */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; border: none; cursor: pointer; color: var(--text-faint);
  border-radius: 8px; transition: color .2s, background .2s;
}
.pw-toggle:hover { color: var(--text); background: var(--surface); }
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle .eye-off { display: none; }
.pw-toggle.on .eye-open { display: none; }
.pw-toggle.on .eye-off { display: block; }
/* 内联错误提示 */
.form-err {
  display: none; margin: 4px 0 0; padding: 8px 11px; border-radius: 10px;
  background: rgba(224,82,107,.1); border: 1px solid rgba(224,82,107,.3);
  color: var(--bad); font-size: 12.5px; line-height: 1.5; animation: errIn .25s ease;
}
.form-err.show { display: block; }
@keyframes errIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
/* 演示账号快捷填充 */
.demo-quick { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--text-faint); flex-wrap: wrap; }
.chip-btn {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); cursor: pointer; font-size: 12.5px;
  transition: all .2s;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
/* 按钮 loading 态 */
.btn { position: relative; justify-content: center; }
.btn.loading { opacity: .7; pointer-events: none; }
.btn.loading .btn-label { visibility: hidden; }
.btn.loading::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 视图切换淡入 */
.view-anim { animation: viewIn .3s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
/* 成功 toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-solid); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 14px; z-index: 80; opacity: 0; visibility: hidden;
  transition: opacity .3s, transform .3s, visibility .3s; display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(52,211,153,.45); }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }

/* 登录弹窗 */
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 16px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  box-shadow: var(--shadow);
}

/* 行内小按钮（编辑 / 删除） */
.mini-btn { font-size: 12px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--primary-soft); cursor: pointer; transition: background .2s, color .2s; }
.mini-btn:hover { background: var(--primary-soft); color: #fff; }
.mini-btn.danger { color: var(--bad); border-color: rgba(224,82,107,.3); }
.mini-btn.danger:hover { background: var(--bad); color: #fff; }

/* 数据管理弹窗 */
.data-actions { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.data-actions .btn { justify-content: flex-start; }
.modal .note { margin-bottom: 4px; line-height: 1.6; }

/* 客户列表筛选条 */
.cust-filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.cust-filter .cf-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.cust-filter .seg { padding: 7px 13px; font-size: 12.5px; }
.cf-select {
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-solid); color: var(--text); font-size: 13px; outline: none; cursor: pointer;
}
.cf-select:focus { border-color: var(--primary-soft); box-shadow: 0 0 0 4px rgba(79,95,214,.15); }

/* 展业话术（结构化多段剧本） */
.pitch-card {
  margin-top: 12px; padding: 14px 15px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,122,24,.10), rgba(255,138,51,.06));
  border: 1px solid rgba(255,122,24,.22); font-size: 13px; line-height: 1.62; color: var(--text-soft);
}
.pitch-h {
  display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent);
  font-size: 13.5px; margin-bottom: 10px;
}
.pitch-tag {
  margin-left: auto; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: rgba(255,122,24,.16); color: #d9660a; border: 1px solid rgba(255,122,24,.3);
}
.pitch-row { display: flex; gap: 10px; padding: 7px 0; border-top: 1px dashed rgba(255,122,24,.18); }
.pitch-row:first-of-type { border-top: none; }
.pitch-row .ph {
  flex: 0 0 34px; font-size: 11px; font-weight: 700; color: #d9660a;
  background: rgba(255,122,24,.12); border-radius: 7px; height: fit-content;
  padding: 3px 0; text-align: center; line-height: 1.2;
}
.pitch-row p { margin: 0; flex: 1; }
.pitch-row.pitch-close p { color: var(--text); font-weight: 600; }

/* 高潜待跟进磁贴 */
.hot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.hot-card {
  padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-solid); cursor: pointer; transition: transform .22s, box-shadow .22s, border-color .22s;
}
.hot-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.hc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hc-top b { font-size: 15px; }
.hc-adeq { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.hc-adeq.bad { background: rgba(224,82,107,.14); color: var(--bad); }
.hc-gap { font-size: 13px; color: var(--text); margin: 8px 0 6px; font-weight: 600; }
.hc-fu { font-size: 12px; color: var(--text-faint); }

/* 建议书历史列表 */
.ph-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-solid); margin-bottom: 10px; transition: transform .2s, box-shadow .2s;
}
.ph-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ph-name { font-size: 15px; font-weight: 700; }
.ph-time { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.ph-actions { display: flex; gap: 8px; flex: none; }

/* 打印 */
@media print {
  .bg-blobs, #particles, .topbar, .search-card, .steps, .grid, .modal-mask, .note { display: none !important; }
  body { background: #fff; }
  .app { max-width: 100%; padding: 0; }
  .proposal { box-shadow: none; border: none; }
}

/* ============ 响应式 / 移动端适配（代理人主力用手机） ============ */
@media (max-width: 768px) {
  .app { padding: 14px 14px 48px; }
  .topbar { flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; padding: 9px 10px; font-size: 13px; }
  .theme-toggle { width: 42px; height: 42px; }
  .brand h1 { font-size: 16px; }
  .brand p { font-size: 11px; }
  .brand .logo { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }

  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; white-space: nowrap; padding: 10px 14px; font-size: 13.5px; }

  .grid { gap: 14px; }
  .card { padding: 16px; }
  .kv { grid-template-columns: 1fr; gap: 10px; }
  .cust-head { gap: 12px; }
  .avatar { width: 52px; height: 52px; font-size: 22px; border-radius: 14px; }

  .search-row { flex-direction: column; align-items: stretch; }
  .search-input { min-width: 0; width: 100%; }

  .steps { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 4px; scrollbar-width: none; }
  .steps::-webkit-scrollbar { display: none; }
  .step { flex: none; min-width: 116px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 16px; }
  .kpi .v { font-size: 22px; }

  .rem-seg { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .rem-seg::-webkit-scrollbar { display: none; }
  .seg { flex: none; white-space: nowrap; }

  .modal { padding: 18px; width: 95vw !important; max-height: 90vh; }
  .field { margin-bottom: 10px; }
  /* 弹窗内横向 flex 行（如客户表单的多列）在小屏降为单列 */
  #custForm > div[style*="display:flex"],
  #policyForm > div[style*="display:flex"],
  #productForm > div[style*="display:flex"] { flex-direction: column !important; gap: 0 !important; }

  .proposal { padding: 20px 16px; }
  .proposal .kv2 { grid-template-columns: 1fr; }
  .fmember-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .bar-row { flex-wrap: wrap; }
  .bar-row .bl, .bar-row .bn { width: auto; text-align: left; }
}

@media (max-width: 480px) {
  .topbar-actions .btn { font-size: 12px; padding: 8px 8px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .rem-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .rem-actions { width: 100%; }
  .rem-actions .mini-btn { width: 100%; justify-content: center; }
  .cust-head .name { font-size: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; justify-content: center; }
}

/* ============ 全局搜索（顶栏） ============ */
.global-search { position: relative; flex: 1; max-width: 340px; }
.gs-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-solid); color: var(--text);
  font-size: 14px; outline: none; transition: border .2s, box-shadow .2s;
}
.gs-input:focus { border-color: var(--primary-soft); box-shadow: 0 0 0 4px rgba(79,95,214,.15); }
.gs-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 380px; overflow: auto; padding: 8px;
}
.gs-group { font-size: 11px; color: var(--text-faint); font-weight: 700; padding: 8px 8px 4px; letter-spacing: .3px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.gs-item:hover { background: var(--surface); }
.gs-item .gs-name { font-size: 14px; font-weight: 600; }
.gs-item .gs-meta { font-size: 12px; color: var(--text-faint); margin-left: auto; padding-left: 10px; }
.gs-item .gs-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.gs-empty { padding: 16px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ============ 缺口瀑布图 ============ */
.gap-waterfall { width: 100%; margin-bottom: 6px; }
.gap-waterfall svg { width: 100%; height: auto; display: block; overflow: visible; }
.gap-waterfall .gw-bar-base { fill: rgba(120,130,170,.10); }
.gap-waterfall .gw-got { fill: url(#gwGot); transition: height .9s cubic-bezier(.16,1,.3,1), y .9s cubic-bezier(.16,1,.3,1); }
.gap-waterfall .gw-gap { fill: url(#gwGap); transition: height .9s cubic-bezier(.16,1,.3,1), y .9s cubic-bezier(.16,1,.3,1); }
.gap-waterfall .gw-need { stroke: var(--text-faint); stroke-dasharray: 3 3; stroke-width: 1; }
.gap-waterfall .gw-label { font-size: 11px; fill: var(--text-soft); }
.gap-waterfall .gw-val { font-size: 10px; font-weight: 700; }

/* ============ 家庭保障结构树 ============ */
.family-tree { width: 100%; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.family-tree svg { display: block; min-width: 320px; height: auto; }
.family-tree .ft-node { fill: var(--surface-solid); }
.family-tree .ft-name { font-size: 13px; font-weight: 700; fill: var(--text); }
.family-tree .ft-role { font-size: 10.5px; fill: var(--text-faint); }
.family-tree .ft-link { fill: none; stroke: var(--primary-soft); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ftDraw 1s ease forwards; }
@keyframes ftDraw { to { stroke-dashoffset: 0; } }
.family-tree .ft-node-g { opacity: 0; transform: translateY(10px); animation: ftNodeIn .5s ease forwards; }
@keyframes ftNodeIn { to { opacity: 1; transform: none; } }

/* ============ 移动端增强（<=768px） ============ */
@media (max-width: 768px) {
  .topbar { align-items: flex-start; }
  .brand { order: 1; flex: 0 0 auto; }
  .topbar-actions { order: 2; flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; }
  .global-search { order: 3; flex: 1 1 100%; max-width: none; margin-top: 4px; }
  .gs-results { position: fixed; left: 10px; right: 10px; top: auto; }
  .gap-waterfall svg { max-height: 260px; }
}
@media (max-width: 480px) {
  .global-search { margin-top: 2px; }
  .gs-input { padding: 9px 12px; font-size: 13px; }
}
