/* ============================================================
   电商客户分层与满意度预警系统 — 前端样式 v7（独立风格版）
   风格定位：现代电商运营台（借鉴 Shopify 深色侧栏 / 电商数据看板）
   - 深墨蓝侧栏 + 天青主色 #0EA5E9 + 冷灰内容底
   - KPI 卡带彩色图标圆钮（一眼扫读）
   - 订单跟进"流水线"进度条（借鉴电商后台订单履约视图）
   - 桌面侧栏可折叠、图表一键下载 PNG、复制视图链接、更新时戳
   响应式：≥992 桌面增强 / ≤991 平板 / ≤767 手机抽屉 / ≤400 超小屏
   ============================================================ */
html { font-size: 16px; }
@media (min-width: 768px) {
  html { font-size: clamp(16px, 0.55vw + 12.8px, 21px); }
}
:root {
  --bg: #F5F7FA;              /* 冷灰内容底 */
  --bg-soft: #EFF2F6;
  --surface: #FFFFFF;
  --surface-glass: rgba(255,255,255,.8);
  --ink: #111827;             /* 墨黑主文字 */
  --ink-2: #4B5563;
  --ink-3: #8A94A6;
  --nav-bg: #0E1A2B;          /* 深墨蓝侧栏 */
  --nav-ink: #AEB9C8;
  --nav-ink-hover: #E8EEF6;
  --nav-line: rgba(255,255,255,.07);
  --primary: #0EA5E9;         /* 天青主色 */
  --primary-dark: #0284C7;
  --primary-soft: #E0F2FE;
  --primary-soft2: #F0F9FF;
  --accent: #F59E0B;          /* 琥珀强调 */
  --accent-soft: #FEF3C7;
  --line: #EDF0F4;
  --danger: #EF4444;          /* 红：高风险/差评 */
  --danger-soft: #FEE2E2;
  --success: #10B981;         /* 绿：低风险/已处理 */
  --success-soft: #D1FAE5;
  --warn: #F59E0B;
  --warn-soft: #FEF3C7;
  --c1: #0EA5E9; --c2: #8B5CF6; --c3: #10B981; --c4: #F59E0B; --c5: #EF4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 12px rgba(15,23,42,.05);
  --shadow-md: 0 12px 36px rgba(15,23,42,.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 0.875rem; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #C9D2E0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #AAB6C8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录（左右分栏 · 墨蓝→天青渐变） ---------- */
.login-wrap { min-height: 100vh; display: flex; background: #fff; }
.login-brand { flex: 1.1; position: relative; overflow: hidden;
  background: linear-gradient(140deg, #0E1A2B 0%, #16324F 48%, #0EA5E9 135%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px 56px 36px; }
.brand-deco { position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); }
.brand-deco.d1 { width: 420px; height: 420px; top: -140px; right: -100px; }
.brand-deco.d2 { width: 260px; height: 260px; bottom: -80px; left: -60px; background: rgba(255,255,255,.05); }
.brand-deco.d3 { width: 120px; height: 120px; top: 40%; right: 18%; background: rgba(56,189,248,.16); }
.brand-inner { position: relative; z-index: 2; max-width: 480px; }
.brand-logo { width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #38BDF8, #0EA5E9);
  box-shadow: 0 8px 24px rgba(14,165,233,.35);
  display: flex; align-items: center; justify-content: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 2rem; font-weight: 700; line-height: 1.3;
  letter-spacing: .5px; margin-bottom: 14px; }
.brand-sub { font-size: 0.9375rem; opacity: .82; line-height: 1.7; margin-bottom: 44px; }
.brand-feats { display: flex; flex-direction: column; gap: 18px; }
.feat { display: flex; align-items: center; gap: 12px; font-size: 0.875rem; opacity: .94; }
.feat svg { width: 20px; height: 20px; flex-shrink: 0; opacity: .85; }
.brand-foot { position: relative; z-index: 2; font-size: 0.75rem; opacity: .65; }
.login-side { flex: 1; display: flex; align-items: center; justify-content: center;
  background: #fff; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box h2 { font-size: 1.5rem; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.form-sub { font-size: 0.875rem; color: var(--ink-3); margin-bottom: 32px; }
.form-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.8125rem; color: var(--ink-2); margin-bottom: 8px; }
.pwd-box { position: relative; }
.pwd-box .ipt { padding-right: 44px; }
.pwd-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--ink-3); line-height: 1; padding: 4px;
  display: flex; align-items: center; justify-content: center; }
.pwd-toggle:hover { color: var(--ink); }
.remember { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--ink-2); margin: 0 0 14px; cursor: pointer; user-select: none; }
.ipt { width: 100%; padding: 10px 14px; border: 1.5px solid #E4E8EE; border-radius: 8px;
  font-size: 0.875rem; background: #fff; color: var(--ink); transition: all .15s ease; }
.ipt:hover { border-color: #CBD4E0; }
.ipt:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,.14); }
input.ipt { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
select.ipt { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
  linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.btn { padding: 8px 18px; border: none; border-radius: 8px; background: var(--bg-soft);
  cursor: pointer; font-size: 0.875rem; color: var(--ink); transition: all .15s ease; font-weight: 500; }
.btn:hover { background: #E3E8F0; color: var(--ink); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, #0EA5E9, #0284C7); color: #fff;
  box-shadow: 0 2px 10px rgba(14,165,233,.32); }
.btn.primary:hover { background: linear-gradient(135deg, #0284C7, #0369A1); box-shadow: 0 4px 14px rgba(14,165,233,.4); }
.btn.block { width: 100%; padding: 12px; font-size: 0.9375rem; }
.btn.sm { padding: 5px 12px; font-size: 0.8125rem; border-radius: 6px; }
.btn.danger { color: var(--danger); background: var(--danger-soft); }
.btn.danger:hover { background: #FECACA; color: var(--danger); }
.err { color: var(--danger); font-size: 0.8125rem; margin-top: 10px; text-align: center; min-height: 18px; }

.login-box .btn.block { padding: 13px; font-size: 0.9375rem; border-radius: 10px; height: 46px;
  letter-spacing: 4px; font-weight: 500; margin-top: 8px; }
.login-box .ipt { padding: 12px 14px; border-radius: 10px; border-width: 1.5px; }
.login-box .field label { font-size: 0.8125rem; color: var(--ink); font-weight: 500; }

@media (max-width: 900px) {
  .login-brand { display: none; }
  .login-side { flex: 1; }
}

/* ---------- 主布局 · 深墨蓝侧栏 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--nav-bg); color: var(--nav-ink); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20;
  transition: width .22s cubic-bezier(.4,0,.2,1); }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; color: #fff;
  border-bottom: 1px solid var(--nav-line); white-space: nowrap; overflow: hidden; }
.sidebar .brand .logo { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #38BDF8, #0EA5E9);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1rem;
  box-shadow: 0 4px 14px rgba(14,165,233,.4); }
.sidebar .brand .t { font-size: 0.875rem; font-weight: 650; letter-spacing: .2px; }
.sidebar .brand .s { font-size: 0.625rem; color: #64748B; margin-top: 1px; }
.sidebar nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  margin-bottom: 2px; border-radius: 10px; cursor: pointer; color: var(--nav-ink); font-size: 0.875rem;
  transition: all .15s ease; white-space: nowrap; }
.nav-item svg { width: 18px; height: 18px; opacity: .7; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--nav-ink-hover); }
.nav-item.active { background: rgba(14,165,233,.16); color: #7DD3FC; font-weight: 550; }
.nav-item.active::before { content:""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: #38BDF8; }
.nav-item.active svg { opacity: 1; }
.sidebar .foot { padding: 15px 20px; font-size: 0.6875rem; color: #5B6B7F;
  border-top: 1px solid var(--nav-line); white-space: nowrap; overflow: hidden; }
.sidebar .foot .drawer-logout { display: none; }
/* 桌面端折叠态：只显示图标 */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand { padding: 20px 14px; justify-content: center; }
.sidebar.collapsed .brand > div:last-child { display: none; }
.sidebar.collapsed nav { padding: 12px 8px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; gap: 0; }
.sidebar.collapsed .nav-item .nav-txt { display: none; }
.sidebar.collapsed .nav-item.active::before { left: -8px; }
.sidebar.collapsed .foot { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 15;
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: var(--surface-glass); }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .title { font-size: 1rem; font-weight: 650; color: var(--ink); }
.topbar .crumb { font-size: 0.75rem; color: var(--ink-3); margin-top: 2px; }
.upd-time { font-size: 0.6875rem; color: var(--ink-3); margin-left: 6px;
  display: inline-flex; align-items: center; gap: 4px; }
.upd-time::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.topbar .right { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2);
  transition: all .15s ease; position: relative; font-size: 15px; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft2); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 1.5px solid #fff; }
.notify-wrap { position: relative; }
.notify-drop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 300px; max-height: 400px; overflow-y: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.16); }
.notify-drop .n-head { padding: 12px 14px; font-size: 0.8125rem; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--bg-soft); }
.notify-drop .n-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  font-size: 0.8125rem; color: var(--ink-2); cursor: pointer; border-bottom: 1px solid var(--bg-soft); }
.notify-drop .n-item:last-child { border-bottom: none; }
.notify-drop .n-item:hover { background: var(--primary-soft2); }
.notify-drop .n-item b { color: var(--ink); font-weight: 600; margin-left: auto; white-space: nowrap; }
.notify-drop .n-item .n-sub { font-size: 0.6875rem; color: var(--ink-3); }
.notify-drop .n-empty { padding: 20px; text-align: center; font-size: 0.75rem; color: var(--ink-3); }
.userbox { display: flex; align-items: center; gap: 11px; padding-left: 12px; border-left: 1px solid var(--line); }
.userbox .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 650; }
.userbox .meta .uname { font-size: 0.8125rem; color: var(--ink-2); font-weight: 550; }
.userbox .meta .role { font-size: 0.6875rem; color: var(--primary); }

/* ---------- 个人中心下拉面板 ---------- */
.userbox { position: relative; }
.profile-drop { position: absolute; right: 0; top: calc(100% + 10px); width: 320px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-md);
  border: 1px solid var(--line); overflow: hidden; z-index: 70;
  opacity: 0; transform: translateY(-6px) scale(.97); pointer-events: none; transition: all .18s ease; }
.profile-drop.open { opacity: 1; transform: none; pointer-events: auto; }
.profile-drop .pd-head { display: flex; align-items: center; gap: 13px; padding: 16px 18px;
  background: linear-gradient(135deg, var(--primary-soft), var(--primary-soft2));
  border-bottom: 1px solid var(--line); }
.profile-drop .pd-avatar { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #38BDF8, #0EA5E9); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.1875rem; font-weight: 600; }
.profile-drop .pd-meta .pd-name { font-size: 1rem; font-weight: 650; color: var(--ink); }
.profile-drop .pd-meta .pd-role { font-size: 0.75rem; color: var(--primary-dark); margin-top: 2px; }
.profile-drop .pd-info { padding: 12px 18px; display: grid; grid-template-columns: 1fr; gap: 8px 12px; }
.profile-drop .pd-row { display: flex; align-items: baseline; gap: 6px; font-size: 0.8125rem; flex-wrap: nowrap; }
.profile-drop .pd-row .pd-k { color: var(--ink-3); flex-shrink: 0; font-size: 0.75rem; white-space: nowrap; }
.profile-drop .pd-row .pd-v { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-drop .pd-actions { padding: 6px; border-top: 1px solid var(--line); display: grid;
  grid-template-columns: 1fr; gap: 6px; }
.profile-drop .pd-actions .more-item { display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 8px; border: none; background: none; border-radius: 9px; cursor: pointer;
  font-size: 0.875rem; color: var(--ink); transition: all .15s ease; text-align: center; }
.profile-drop .pd-actions .more-item:hover { background: var(--bg-soft); }
.profile-drop .pd-actions .more-item.danger { color: var(--danger); }
.profile-drop .pd-actions .more-item.danger:hover { background: var(--danger-soft); }

.content { padding: 24px 28px; max-width: 1440px; width: 100%; margin: 0 auto; min-height: calc(100vh - 140px); }

/* ---------- 通用 ---------- */
.page-head { margin-bottom: 20px; }
.page-head h2 { font-size: 1.25rem; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
.page-head p { color: var(--ink-3); font-size: 0.8125rem; margin-top: 4px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow); transition: box-shadow .2s ease; min-height: 200px;
  border: 1px solid rgba(237,240,244,.6); }
@media (min-width: 769px) {
  .card { padding: 28px 32px; min-height: 320px; }
}
.card:hover { box-shadow: 0 4px 16px rgba(15,23,42,.07); }
.card-title { font-size: 0.9375rem; font-weight: 650; color: var(--ink); margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px; }
.card-title::before { content:""; width: 3px; height: 15px; border-radius: 3px; background: var(--primary); }
.card-title .t { flex: 1; min-width: 0; }
.chart { width: 100%; height: 280px; }
.chart.tall { height: 330px; }
/* 图表卡标题右侧：下载 PNG 按钮（分享能力） */
.chart-dl { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-3);
  transition: all .15s ease; flex-shrink: 0; }
.chart-dl:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft2); }

/* ---------- KPI 卡（带彩色图标圆钮） ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(237,240,244,.6); padding: 18px 20px; transition: transform .15s ease, box-shadow .2s ease; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.08); }
.k-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.k-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.k-ico svg { width: 19px; height: 19px; }
.k-ico.c1 { background: var(--primary-soft); color: var(--primary-dark); }
.k-ico.c2 { background: #F1EBFF; color: #7C3AED; }
.k-ico.c3 { background: var(--warn-soft); color: #B45309; }
.k-ico.c4 { background: var(--danger-soft); color: var(--danger); }
.k-label { font-size: 0.78rem; color: var(--ink-2); font-weight: 550; }
.k-value { font-size: 1.6rem; font-weight: 750; color: var(--ink); line-height: 1.1; letter-spacing: -.3px; }
.k-sub { font-size: 0.75rem; color: var(--ink-3); margin-top: 6px; }

/* 口径折叠说明 */
.scope-note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.scope-note summary { cursor: pointer; font-size: 0.8375rem; font-weight: 600; color: var(--ink-2); }
.scope-note ul { margin: 10px 0 2px 20px; }
.scope-note li { font-size: 0.8rem; color: var(--ink-2); line-height: 1.8; }

/* 结论洞察条 */
.insight-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.insight-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 15px; box-shadow: var(--shadow); }
.insight-item .i-title { font-size: 0.75rem; color: var(--ink-3); margin-bottom: 5px; }
.insight-item .i-value { font-size: 1.05rem; font-weight: 750; color: var(--primary-dark); }
.insight-item .i-sub { font-size: 0.725rem; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

/* 网格 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* 筛选条 */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar label { font-size: 0.8125rem; color: var(--ink-2); }
.filter-bar .ipt { width: auto; padding: 8px 12px; }
.filter-bar .btn.sm { height: 34px; }

/* ---------- 风险跟进"流水线"（借鉴电商订单履约视图） ---------- */
.pipeline { margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow); }
.pipeline .pl-bar { height: 6px; border-radius: 3px; background: #E8EDF3; overflow: hidden;
  display: flex; margin-bottom: 12px; }
.pipeline .pl-bar i { display: block; height: 100%; }
.pipeline .pl-items { display: flex; gap: 8px 22px; flex-wrap: wrap; }
.pl-item { display: flex; align-items: center; gap: 7px; font-size: 0.8125rem; color: var(--ink-2); }
.pl-item .pl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pl-item b { font-size: 0.95rem; color: var(--ink); margin-left: 2px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.8375rem; }
.tbl th, .tbl td { padding: 14px 16px; text-align: left; font-size: 0.875rem; white-space: nowrap;
  border-bottom: 1px solid #F2F4F8; }
.tbl th { color: var(--ink-3); font-weight: 550; font-size: min(0.75rem, 13px); border-bottom: 1px solid var(--line);
  letter-spacing: .3px; background: #FAFBFC; text-transform: uppercase; }
.tbl th:first-child { border-radius: 8px 0 0 0; }
.tbl th:last-child { border-radius: 0 8px 0 0; }
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover { background: #F7F9FC; }
.tbl tbody tr:last-child td { border-bottom: none; }
.mini-tbl { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.mini-tbl th, .mini-tbl td { padding: 10px 12px; border-bottom: 1px solid #F2F4F8; text-align: center; }
.mini-tbl th { color: var(--ink-3); font-weight: 550; font-size: min(0.75rem, 13px); background: #FAFBFC;
  letter-spacing: .3px; }
.mini-tbl td:first-child { text-align: left; }
.mini-tbl tbody tr:hover { background: #F7F9FC; }
.mini-tbl tbody tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 550; white-space: nowrap; }
.tag.high { background: var(--danger-soft); color: var(--danger); }
.tag.mid { background: var(--warn-soft); color: #B45309; }
.tag.low { background: var(--success-soft); color: #047857; }
.tag.blue { background: var(--primary-soft); color: var(--primary-dark); }

/* 分页：页码按钮组 + 跳转输入（桌面/平板），手机端紧凑版 */
.pager { display: flex; justify-content: center; align-items: center; padding: 16px 4px 0; }
.pager .pg-stack { display: flex; flex-direction: row; align-items: center; gap: 22px;
  flex-wrap: wrap; justify-content: center; width: 100%; }
.pager .pg-pages { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pager .pg-pages button { min-width: 34px; height: 34px; padding: 0 6px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; cursor: pointer; color: var(--ink-2); font-size: 0.8125rem;
  transition: all .15s; }
.pager .pg-pages button:hover:not(:disabled):not(.on) { color: var(--primary); border-color: var(--primary); }
.pager .pg-pages button.on { background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 3px 10px rgba(14,165,233,.25); }
.pager .pg-pages button:disabled { opacity: .4; cursor: not-allowed; }
.pager .pg-pages .dots { color: var(--ink-3); padding: 0 2px; font-size: 0.8125rem; }
.pager .pg-jump { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 0.75rem; white-space: nowrap; }
.pager .pg-jump input { width: 52px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  text-align: center; font-size: 0.8125rem; }
.pager .pg-jump input:focus { outline: none; border-color: var(--primary); }
.pager .pg-jump button { min-width: 56px; height: 34px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 0.75rem; cursor: pointer; }
.pager .pg-jump button:hover { background: var(--primary-dark); }
/* 手机端紧凑分页：桌面默认隐藏，手机端显示（上一页 下一页 第X/Y页 确定） */
.pager .pg-mobile { display: none; }
@media (max-width: 767px) {
  .pager .pg-pages, .pager .pg-jump { display: none; }
  .pager .pg-mobile { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
  .pager .pg-mobile button { min-width: 58px; height: 34px; border: 1px solid var(--line);
    border-radius: 8px; background: #fff; color: var(--ink); font-size: 0.75rem; cursor: pointer; }
  .pager .pg-mobile button:disabled { opacity: .4; cursor: not-allowed; }
  .pager .pg-mobile .pg-cur { font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap;
    display: flex; align-items: center; gap: 4px; }
  .pager .pg-mobile .pg-inp { width: 42px; height: 30px; border: 1px solid var(--line);
    border-radius: 8px; text-align: center; font-size: 0.8125rem; }
  .pager .pg-mobile .pg-inp:focus { outline: none; border-color: var(--primary); }
  .pager .pg-mobile .pg-ok { background: var(--primary); color: #fff; border: none; min-width: 50px; }
  .pager .pg-mobile .pg-ok:hover { background: var(--primary-dark); }
}

/* 电商组件 */
.scope-note { background: var(--surface); }
.seg-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.seg-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px 16px;
  background: var(--surface); box-shadow: var(--shadow); }
.seg-card .seg-name { font-weight: 650; font-size: 0.925rem; margin-bottom: 6px; }
.seg-card .seg-num { font-size: 1.35rem; font-weight: 750; color: var(--primary-dark); }
.seg-card .seg-meta { color: var(--ink-3); font-size: 0.78rem; margin: 6px 0; line-height: 1.7; }
.seg-card .seg-strat { font-size: 0.8rem; color: var(--ink-2); background: var(--bg-soft); border-radius: 8px;
  padding: 8px 10px; margin-top: 8px; line-height: 1.6; }
.stat-strip { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 12px 16px; background: var(--bg-soft); border-radius: var(--radius-sm); }
.stat-strip .pl-bar { flex: 1 1 100%; height: 6px; border-radius: 3px; background: #E8EDF3; overflow: hidden;
  display: flex; margin-bottom: 2px; }
.stat-strip .pl-bar i { display: block; height: 100%; }
.stat-strip .pl-items { display: flex; align-items: center; gap: 8px 28px; flex-wrap: wrap; }
.stat-item { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--ink-2); }
.stat-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.stat-item b { font-size: 0.95rem; color: var(--ink); margin-left: 2px; }
.cm { display: grid; grid-template-columns: 80px 90px 90px; gap: 8px; align-items: center; font-size: 0.8375rem; }
.cm .cell { background: #FAFBFC; border-radius: 8px; padding: 12px; text-align: center; }
.cm .cell.hit { background: var(--success-soft); }
.cm .cell.miss { background: var(--warn-soft); }
.metric-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 10px; }
.metric-row .m b { font-size: 1.15rem; }
.metric-row .m span { display: block; color: var(--ink-3); font-size: 0.75rem; margin-top: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; }
.form-grid .field label { font-size: 0.78rem; }
.small-note { color: var(--ink-3); font-size: 0.76rem; margin: 6px 0 12px; line-height: 1.6; }
.fill-note { color: var(--ink-3); font-size: 0.765rem; margin-top: 10px; line-height: 1.6; }
.load-tip { text-align: center; color: var(--ink-3); font-size: 0.8125rem; padding: 18px 0; }
.note-cell { white-space: normal; max-width: 180px; color: var(--ink-2); font-size: 0.78rem; }
.note-input { width: 100%; min-width: 120px; padding: 5px 9px; border: 1px dashed var(--line);
  border-radius: 7px; font-size: 0.78rem; color: var(--ink-2); background: #fff; }
.note-input:focus { outline: none; border: 1.5px solid var(--primary); border-style: solid;
  box-shadow: 0 0 0 2px rgba(14,165,233,.12); color: var(--ink); }
.note-input::placeholder { color: #A8B3C1; }
.status-select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.78rem;
  background: #fff; color: var(--ink-2); }
.status-select.st-done { background: var(--success-soft); color: #047857; border-color: #A7F3D0; }
.status-select.st-contact { background: var(--warn-soft); color: #B45309; border-color: #FDE68A; }

/* Toast */
.toast-wrap { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { padding: 14px 24px; border-radius: 12px; color: #fff; font-size: 0.9375rem; box-shadow: var(--shadow-md);
  animation: slideIn .25s ease; min-width: 320px; max-width: 90vw; display: flex; align-items: center; gap: 10px; }
.toast .t-ico { width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.toast.success { background: linear-gradient(135deg, #10B981, #059669); }
.toast.error { background: linear-gradient(135deg, #EF4444, #DC2626); }
.toast.info { background: linear-gradient(135deg, #0EA5E9, #0284C7); }
@keyframes slideIn { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.46); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  animation: fadeIn .18s ease; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-mask.align-top { align-items: flex-start; padding: 24px 0; }
.modal-mask.align-top .modal { margin: auto; }
.modal { width: 500px; max-width: 92vw; background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow-md); animation: pop .22s ease;
  max-height: 90vh; display: flex; flex-direction: column; }
.modal .m-head { padding: 20px 24px 12px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); }
.modal .m-head h3 { font-size: 1rem; color: var(--ink); font-weight: 650; }
.modal .m-close { cursor: pointer; color: var(--ink-3); font-size: 1.375rem; border: none; background: none;
  width: 32px; height: 32px; border-radius: 8px; transition: .15s; }
.modal .m-close:hover { background: var(--bg-soft); color: var(--ink); }
.modal .m-body { padding: 18px 24px; overflow-y: auto; min-height: 0; flex: 1; }

.help-body { font-size: 0.8125rem; }
.help-role { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-role-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg-soft); }
.hr-t { font-weight: 600; color: var(--ink); margin-bottom: 8px; font-size: 0.8125rem;
  padding-left: 9px; border-left: 3px solid var(--line); }
.hr-t.hr-t-user { border-left-color: #059669; }
.hr-t.hr-t-admin { border-left-color: #7C3AED; }
.hr-t.hr-t-note { border-left-color: var(--primary); }
.help-role-card ol, .help-tips ul { padding-left: 18px; margin: 0; }
.help-role-card li, .help-tips li { color: var(--ink-2); line-height: 1.9; }
.hr-goal { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line);
  color: var(--primary-dark); font-size: 0.75rem; }
.help-tips { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view { animation: viewIn .25s ease; }

/* ============================================================
   响应式适配：≥992 桌面增强 / ≤991 平板 / ≤767 手机 / ≤400 超小屏
   ============================================================ */
.menu-btn { display: inline-flex; }
.menu-mask { display: none; }

/* 桌面增强（≥992px） */
@media (min-width: 992px) {
  .tbl tbody tr:nth-child(even), .mini-tbl tbody tr:nth-child(even) { background: #FAFBFD; }
  .tbl tbody tr:hover, .mini-tbl tbody tr:hover { background: var(--primary-soft2); }
  #risk-table th:nth-child(12), #risk-table td:nth-child(12) { width: 26%; }
}

/* 平板（≤991px） */
@media (max-width: 991px) {
  .sidebar { width: 200px; }
  .sidebar.collapsed { width: 60px; }
  .content { padding: 18px 20px; }
  .topbar { padding: 0 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .seg-grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .insight-strip { grid-template-columns: 1fr 1fr; }
  .filter-bar .ipt { flex: 1 1 140px; width: auto; }
}

/* 手机（≤767px） */
@media (max-width: 767px) {
  .topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .topbar .title { font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .crumb, .topbar .upd-time { display: none; }
  .topbar { height: 56px; padding: 0 12px; }
  .topbar .right { gap: 6px; }
  /* 手机端顶栏精简：只保留 汉堡 + 标题 + 头像/更多，刷新/复制/待办移出视觉焦点 */
  #btn-refresh, #btn-copy, .notify-wrap { display: none; }
  .userbox { gap: 6px; padding-left: 8px; }
  .userbox .meta { display: none; }
  .userbox .avatar { width: 30px; height: 30px; }
  .icon-btn { width: 32px; height: 32px; }
  .profile-drop { width: 280px; right: -10px; }
  .toast-wrap { top: 16px; }
  .toast { min-width: auto; width: auto; max-width: 90vw; padding: 12px 20px; font-size: 0.875rem; }

  /* 侧边栏 → 抽屉式（深色，从左侧滑入） */
  .sidebar, .sidebar.collapsed { position: fixed; top: 0; left: -260px; height: 100vh; z-index: 90;
    width: 250px; transition: left .26s cubic-bezier(.4,0,.2,1); box-shadow: none; }
  .sidebar.open { left: 0; box-shadow: 0 8px 40px rgba(15,23,42,.35); }
  .sidebar.collapsed .brand { padding: 20px 18px; justify-content: flex-start; }
  .sidebar.collapsed .brand > div:last-child { display: block; }
  .sidebar.collapsed nav { padding: 12px 10px; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 11px 14px; gap: 12px; }
  .sidebar.collapsed .nav-item .nav-txt { display: inline; }
  .sidebar.collapsed .nav-item.active::before { left: -10px; }
  /* 手机抽屉底部：显示退出登录入口（桌面端保持隐藏） */
  .sidebar .foot .drawer-logout { display: block; margin-bottom: 6px; padding: 9px 14px;
    width: 100%; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.06);
    color: #E2E8F0; font-size: 0.8125rem; cursor: pointer; text-align: center; }
  .sidebar .foot .drawer-logout:hover { background: rgba(255,255,255,.12); color: #fff; }
  .sidebar .foot .drawer-logout:active { transform: scale(.98); }
  .sidebar.collapsed .foot { display: block; }
  .layout { display: block; }
  .menu-mask { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45);
    z-index: 80; opacity: 0; pointer-events: none; transition: opacity .26s ease; }
  .menu-mask.show { opacity: 1; pointer-events: auto; }
  .main { width: 100%; }
  .content { padding: 14px 12px; }

  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .k-head { margin-bottom: 8px; }
  .k-ico { width: 32px; height: 32px; border-radius: 9px; }
  .k-ico svg { width: 16px; height: 16px; }
  .k-value { font-size: 1.3rem; }
  .insight-strip { grid-template-columns: 1fr; gap: 10px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px 14px; border-radius: 16px; }
  .card-title { font-size: 0.875rem; margin-bottom: 14px; }
  .chart { height: 240px; }
  .chart.tall { height: 280px; }
  .filter-bar { gap: 8px 10px; }
  .filter-bar label { flex: 0 0 66px; font-size: 0.78rem; line-height: 34px; }
  .filter-bar .ipt { flex: 1 1 calc(100% - 80px); width: auto; min-width: 0; }
  .filter-bar .btn.sm { flex: 1 1 46%; }
  /* 风险统计区手机端紧凑两列 */
  .stat-strip { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .stat-strip .pl-bar { margin-bottom: 0; }
  .stat-strip .pl-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; }
  .pipeline { padding: 12px; }
  .pl-items { gap: 8px 14px; }
  .pager { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .metric-row { gap: 14px 20px; }
  .cm { grid-template-columns: 70px 78px 78px; }
  .scope-note ul { margin-left: 16px; }

  /* 主表 → 手机端卡片式（data-label 行内标签） */
  .card:has(.tbl) { overflow-x: visible; padding: 10px; }
  .tbl thead { display: none; }
  .tbl tbody { display: block; }
  .tbl tbody tr { display: block; background: #fff; border: 1px solid var(--line);
    border-radius: 14px; margin: 0 0 10px; padding: 4px 14px; box-shadow: var(--shadow); }
  .tbl tbody tr:last-child { margin-bottom: 0; }
  .tbl td { display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #F4F6FA; padding: 9px 2px; font-size: 0.8125rem;
    white-space: normal; text-align: right; }
  .tbl td:last-child { border-bottom: none; }
  .tbl td::before { content: attr(data-label); color: var(--ink-3); font-size: 0.75rem;
    font-weight: 550; margin-right: 14px; flex-shrink: 0; }
  .tbl td.note-cell { white-space: normal; max-width: none; text-align: right; }
  .tbl td.note-cell .note-input { min-width: 0; width: 56%; text-align: left; }
  .tbl td .status-select { max-width: 120px; }
  .tbl tbody tr:hover { background: #fff; }

  .mini-tbl { display: block; overflow-x: auto; white-space: nowrap; min-width: 0; }

  .modal { width: 94vw !important; max-width: 94vw; border-radius: 16px; }
  .modal .m-body { padding: 14px 16px; }
  .modal .m-head { padding: 16px 16px 10px; }
  .help-role { grid-template-columns: 1fr; gap: 12px; }
  .login-wrap { padding: 16px; }
  .err { margin-top: 8px; }
  #cust-id { width: 100% !important; }
}

/* 超小屏（≤400px）：隐藏复制链接按钮 */
@media (max-width: 400px) {
  #btn-copy { display: none; }
  .userbox { border-left: none; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px; }
  .chart { height: 210px; }
  .chart.tall { height: 240px; }
  .card { padding: 14px 12px; }
}
@media (max-width: 360px) {
  .kpis { grid-template-columns: 1fr; gap: 10px; }
}

/* 本轮落地增强：看板待办条 / 分层执行清单 / 判断提示 */
.todo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.todo-item { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.todo-item.warn { border-left-color: var(--danger); }
.todo-item.soft { border-left-color: var(--accent); }
.todo-item.tip { border-left-color: var(--success); }
.todo-item .ti-title { font-size: .75rem; color: var(--ink-3); }
.todo-item b { font-size: 1.15rem; color: var(--ink); }
.todo-item .ti-sub { font-size: .725rem; color: var(--ink-2); line-height: 1.5; }
.seg-actions { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.sa-title { font-size: .75rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.sa-row { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; color: var(--ink-2);
  line-height: 1.6; padding: 3px 0; }
.sa-p { flex: 0 0 auto; padding: 1px 8px; border-radius: 6px; font-size: .7rem; white-space: nowrap; }
.sa-p.p-high { background: var(--danger-soft); color: var(--danger); }
.sa-p.p-mid { background: var(--warn-soft); color: #B45309; }
.sa-p.p-low { background: var(--bg-soft); color: var(--ink-3); }
.sa-target { flex: 0 0 auto; color: var(--ink-3); }
.sa-act { flex: 1; }
.explain-list { margin-top: 10px; background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; }
@media (max-width: 767px) {
  .todo-strip { grid-template-columns: 1fr; gap: 10px; }
  .sa-row { flex-wrap: wrap; }
}
