:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --navy: #0f172a;
  --navy-2: #16213a;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --line: #e5e9f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --field: #ffffff;
  --soft: #f8fafc;
  --soft-2: #f1f5f9;
  --line-2: #edf0f6;
  --hover: #fafbfe;
  --ink: #0f172a;
  --ink-3: #475569;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  --danger: #dc2626;
  --purple: #7c3aed;
  --cyan: #0891b2;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
svg.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---------------- 登录 ---------------- */
.login-page {
  height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--card);
}
.login-left {
  background: radial-gradient(1200px 600px at 10% 0%, #1e3a8a 0%, #0f172a 55%, #0b1220 100%);
  color: #fff;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-left::after {
  content: "";
  position: absolute; width: 520px; height: 520px; right: -180px; bottom: -220px;
  background: radial-gradient(circle, rgba(37, 99, 235, .55), transparent 65%);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 56px; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 14px;
  display: block;
  box-shadow: 0 8px 22px rgba(29, 78, 216, .45), 0 2px 6px rgba(15, 23, 42, .25);
  object-fit: contain;
}
.logo-mark.sm { width: 36px; height: 36px; border-radius: 10px; }
.logo-name { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.logo-sub { font-size: 10px; letter-spacing: 2px; color: var(--text-3); }
.login-left h1 { font-size: 38px; line-height: 1.35; margin: 0 0 18px; font-weight: 700; letter-spacing: 1px; }
.login-desc { color: #cbd5e1; font-size: 14px; margin: 0 0 44px; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; position: relative; z-index: 1; }
.login-points li { display: flex; align-items: center; gap: 12px; color: #cbd5e1; font-size: 13px; }
.login-points span {
  font-size: 11px; color: #93c5fd; border: 1px solid rgba(147, 197, 253, .4);
  border-radius: 6px; padding: 3px 7px; font-weight: 600;
}
.login-right { display: grid; place-items: center; padding: 40px; background: var(--soft); }
.login-card { width: 380px; background: var(--card); border-radius: 16px; padding: 36px 34px; box-shadow: var(--shadow-lg); }
.login-card h2 { margin: 0 0 6px; font-size: 22px; }
.login-tip { color: var(--text-2); font-size: 12px; margin: 0 0 26px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.field-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; display: block; }
input, select, textarea {
  width: 100%; padding: 9px 11px; font-size: 13px; font-family: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; background: var(--field); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
.login-error { color: var(--red); font-size: 12px; min-height: 18px; margin-bottom: 6px; }
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-size: 13px;
  font-family: inherit; cursor: pointer; transition: all .15s; background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .28); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: #cbd5e1; background: var(--soft); }
.btn-danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14px; font-weight: 600; letter-spacing: 2px; }
.btn-text { background: none; border: none; color: var(--text-3); font-size: 11px; cursor: pointer; padding: 0; }
.btn-text:hover { color: #cbd5e1; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn .spinner {
  width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary .spinner { border-color: #fff; border-top-color: transparent; }
.login-version {
  display: flex; align-items: center; gap: 4px;
  margin-top: 26px; border-top: 1px dashed var(--line); padding-top: 16px;
  font-size: 11.5px; color: var(--text-3);
}
.login-version .ver-badge { margin-left: 2px; background: #e8f0fe; color: #2563eb; }
body[data-mode="dark"] .login-version .ver-badge { background: rgba(59,130,246,.16); color: #93c5fd; }

/* ---------------- 应用外壳 ---------------- */
.app { height: 100vh; display: grid; grid-template-columns: 228px 1fr; }
.sidebar {
  background: linear-gradient(180deg, var(--sb-bg, #0f172a) 0%, var(--sb-bg2, #111c33) 100%);
  color: var(--sb-text, #cbd5e1); display: flex; flex-direction: column; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-text .logo-name { color: var(--sb-text-h, #fff); }
.brand-text .logo-sub { font-size: 9px; letter-spacing: 1px; color: var(--sb-muted, #94a3b8); }
/* 版本号小标签 */
.ver-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  padding: 2px 5px;
  margin-left: 6px;
  border-radius: 4px;
  letter-spacing: .5px;
  vertical-align: middle;
  transform: translateY(-1px);
}
/* login 页：深色标签（白底上） */
.login-brand .ver-badge {
  background: #e8f0fe;
  color: #2563eb;
}
/* sidebar：浅色标签（深色侧边栏上） */
.brand .ver-badge {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.55);
}
/* 窄屏隐藏（跟 logo-sub 一起） */
@media (max-width: 900px) {
  .brand-text .ver-badge { display: none; }
}
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group-title { font-size: 10px; color: var(--sb-muted, #64748b); letter-spacing: 1.5px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--sb-text, #cbd5e1); cursor: pointer; user-select: none; margin-bottom: 2px; font-size: 13px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--sb-text-h, #fff); }
.nav-item.active { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--sb-text-h, #fff); border-left-color: var(--primary); }
.nav-item .ico { width: 15px; height: 15px; opacity: .85; }
.nav-item .nav-badge {
  margin-left: auto; background: #ef4444; color: #fff; font-size: 10px; border-radius: 9px;
  padding: 1px 6px; line-height: 15px;
}
.sidebar-foot { padding: 10px 18px 14px; border-top: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; gap: 6px; }
.storage-tip { font-size: 10px; color: var(--sb-muted, #64748b); }

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  height: 56px; flex: 0 0 56px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 20px; position: relative; z-index: 30;
}
.search-wrap { position: relative; flex: 1; max-width: 560px; }
.search-wrap .ico { position: absolute; left: 11px; top: 9px; color: var(--text-3); }
.search-wrap input { padding-left: 34px; height: 34px; background: var(--soft); border-color: var(--line-2); }
.search-wrap input:focus { background: var(--card); }
.search-panel {
  position: absolute; top: 42px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 460px; overflow-y: auto; padding: 6px; z-index: 40;
}
.sp-group-title { font-size: 10px; color: var(--text-3); padding: 8px 10px 4px; letter-spacing: 1px; }
.sp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sp-item:hover { background: var(--primary-soft); }
.sp-item.locked { cursor: default; background: #fff7ed; }
.sp-item.locked:hover { background: #fff7ed; }
.sp-icon {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 600; flex: 0 0 auto;
}
.sp-icon.warn { background: #fff7ed; color: #c2410c; }
.sp-main { flex: 1; min-width: 0; }
.sp-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-sub { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 12px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px; border-radius: 8px; cursor: pointer; position: relative; }
.user-chip:hover { background: var(--soft); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#3b82f6,#7c3aed);
  color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.user-dept { font-size: 10px; color: var(--text-3); }
.chev { width: 12px; height: 12px; color: var(--text-3); }
.user-menu {
  position: absolute; right: 0; top: 44px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; z-index: 40;
}
.user-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 10px;
  font-size: 12px; color: var(--text); border-radius: 6px; cursor: pointer; font-family: inherit;
}
.user-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.user-menu-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 10px; font-size: 12px; color: var(--text); border-radius: 6px; cursor: pointer;
}
.user-menu-switch:hover { background: var(--primary-soft); }
.user-menu-switch input { display: none; }
.user-menu-switch .sw {
  width: 34px; height: 19px; border-radius: 10px; background: var(--soft-2);
  border: 1px solid var(--line); position: relative; flex: none; transition: all .18s;
}
.user-menu-switch .sw::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: all .18s;
}
.user-menu-switch input:checked + .sw { background: var(--primary); border-color: var(--primary); }
.user-menu-switch input:checked + .sw::after { transform: translateX(15px); }

/* ---------------- 暗色模式 ---------------- */
html[data-theme="dark"] {
  --text: #e2e8f0;
  --text-2: #9fb0c7;
  --text-3: #74869e;
  --line: #26324a;
  --line-2: #1e2a3d;
  --bg: #0b1220;
  --card: #121c2d;
  --field: #0f1828;
  --soft: #16202f;
  --soft-2: #1b2739;
  --hover: #172233;
  --ink: #f1f5f9;
  --ink-3: #cbd5e1;
  --primary-soft: #17233a;
  --navy: #08101d;
  --navy-2: #0d1828;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .data th { background: var(--soft); color: var(--text-2); }
html[data-theme="dark"] .data td { border-color: var(--line-2); }
html[data-theme="dark"] .data tr:hover td { background: var(--hover); }
html[data-theme="dark"] input, html[data-theme="dark"] textarea, html[data-theme="dark"] select {
  background: var(--field); color: var(--text); border-color: var(--line);
}
html[data-theme="dark"] .user-menu-switch .sw::after { background: #cbd5e1; }

/* ---------------- 组织选择 ---------------- */
.org-chip { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; cursor: pointer; position: relative; border: 1px solid var(--line); background: var(--card); }
.org-chip:hover { border-color: var(--primary); }
.org-icon { font-size: 14px; line-height: 1; }
.org-meta { line-height: 1.25; }
.org-name { font-size: 12px; font-weight: 600; color: var(--ink); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-sub { font-size: 10px; color: var(--text-3); }
.org-menu { position: absolute; right: 0; top: 40px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; z-index: 40; max-height: 320px; overflow-y: auto; }
.org-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: none; padding: 9px 10px; font-size: 12px; color: var(--text); border-radius: 6px; cursor: pointer; font-family: inherit; }
.org-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.org-menu button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* 登录后选组织的弹层 */
#orgPicker { display: grid; place-items: center; }
.org-list { display: grid; gap: 10px; margin-top: 18px; }
.org-item { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: all .15s; background: var(--card); }
.org-item:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,.12); transform: translateY(-1px); }
.org-item .org-title { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; align-items: center; }
.org-item .org-plan { font-size: 10px; padding: 1px 8px; background: var(--soft); border-radius: 10px; color: var(--text-2); }
.org-item .org-meta2 { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.tabbar {
  height: 38px; flex: 0 0 38px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: stretch; padding: 0 12px; gap: 2px;
}
.tabs { display: flex; overflow-x: auto; gap: 2px; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12px; color: var(--text-2);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; max-width: 220px;
}
.tab:hover { color: var(--text); background: var(--soft); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.tab-title { overflow: hidden; text-overflow: ellipsis; }
.tab .tab-close { width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: var(--text-3); }
.tab .tab-close:hover { background: var(--line); color: var(--red); }
.tab .tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.tabbar-actions { margin-left: auto; display: flex; align-items: center; }
.tab-tool { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 0 8px; font-size: 14px; }

.content { flex: 1; overflow: auto; min-width: 0; padding: 16px 20px 40px; }

/* ---------------- 通用组件 ---------------- */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.page-title { font-size: 19px; font-weight: 700; margin: 0; }
.page-sub { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 13px; font-weight: 600; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }

/* ===== 显示列设置 ===== */
.tbl-colbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 8px 16px 0;
}
.colcfg-hint { font-size: 12px; color: var(--text-3); margin-bottom: 10px; line-height: 1.6; }
.colcfg-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; max-height: 380px; overflow: auto; }
.colcfg-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center;
  gap: 8px; padding: 7px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; font-size: 13px; color: var(--text); background: var(--card);
}
.colcfg-item input { margin: 0; width: 14px; height: 14px; }
.colcfg-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.colcfg-item.locked { cursor: not-allowed; opacity: .7; background: var(--soft); }
.colcfg-lock { font-size: 11px; color: #b45309; white-space: nowrap; }
.colcfg-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.colcfg-actions .spacer { flex: 1; }
body[data-mode="dark"] .colcfg-lock { color: #fbbf24; }
@media (max-width: 640px) { .colcfg-list { grid-template-columns: 1fr; } }

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--soft); border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar .fld { display: flex; align-items: center; gap: 6px; }
.toolbar label { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.toolbar input, .toolbar select { height: 30px; padding: 4px 8px; font-size: 12px; border-radius: 7px; width: auto; min-width: 96px; }
.toolbar input.search { min-width: 190px; }
.toolbar .spacer { flex: 1; }
.filter-tag {
  font-size: 11px; background: var(--primary-soft); color: var(--primary); border-radius: 5px;
  padding: 4px 9px; display: inline-flex; align-items: center; gap: 6px;
}

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data thead th {
  background: var(--soft); color: var(--text-2); font-weight: 600; text-align: left; padding: 9px 12px;
  white-space: nowrap; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
table.data tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr:hover { background: var(--hover); }
table.data tbody tr.clickable { cursor: pointer; }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.link { color: var(--primary); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
.muted { color: var(--text-3); }
.small { font-size: 11px; }
.sub-text { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; display: inline-block; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid transparent; white-space: nowrap; line-height: 17px;
}
.badge.gray { background: var(--soft-2); color: var(--ink-3); border-color: var(--line); }
.badge.blue { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.badge.cyan { background: #ecfeff; color: #0e7490; border-color: #cffafe; }
.badge.orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge.gold { background: #fefce8; color: #a16207; border-color: #fde68a; }
.badge.green { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.badge.red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge.purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: #bfdbfe; box-shadow: 0 4px 14px rgba(37,99,235,.12); }
.kpi-label { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 8px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 11px; color: var(--text-3); margin-top: 8px; }

.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.dash-col { display: grid; gap: 16px; align-content: start; }

.empty { text-align: center; padding: 46px 18px; color: var(--text-3); }
.empty-ico { width: 46px; height: 46px; border-radius: 50%; background: var(--soft-2); display: grid; place-items: center; margin: 0 auto 10px; color: var(--text-3); font-size: 20px; }
.empty-title { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }

.list-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--hover); }
.avatar-sm {
  width: 26px; height: 26px; border-radius: 50%; background: #e0e7ff; color: #3730a3;
  display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: 0 0 auto;
}
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 12.5px; font-weight: 500; }
.list-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.list-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 66px; font-size: 11.5px; color: var(--text-2); flex: 0 0 auto; }
.bar-track { flex: 1; height: 8px; border-radius: 5px; background: var(--soft-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg,#60a5fa,#2563eb); }
.bar-val { width: 34px; text-align: right; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------------- 客户档案 ---------------- */
.detail-hero {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; align-items: flex-start; gap: 18px; margin-bottom: 14px; flex-wrap: wrap;
}
.detail-logo {
  width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg,#e0e7ff,#c7d2fe);
  color: #3730a3; display: grid; place-items: center; font-size: 20px; font-weight: 700; flex: 0 0 auto;
}
.detail-head-main { flex: 1; min-width: 0; }
.detail-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.detail-meta span { white-space: nowrap; }
.detail-meta b { font-weight: 600; color: var(--text); }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.detail-tabs { display: flex; gap: 6px; padding: 6px; margin-bottom: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.detail-tabs::-webkit-scrollbar { display: none; }
.dtab { padding: 7px 14px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; user-select: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s; }
.dtab:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.dtab.active { color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgba(37,99,235,.22); }
.dtab.active:hover { color: #fff; }
.dtab .cnt { font-size: 11px; color: var(--text-3); margin-left: 5px; }
.dtab.active .cnt { color: rgba(255,255,255,.82); }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; }
.info-cell { background: var(--card); padding: 12px 14px; }
.info-cell .k { font-size: 11px; color: var(--text-3); margin-bottom: 5px; }
.info-cell .v { font-size: 12.5px; color: var(--text); word-break: break-all; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px; background: var(--line-2); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -22px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: #dbeafe; border: 2px solid var(--card); box-shadow: 0 0 0 1px #dbeafe; }
.tl-dot.green { background: #bbf7d0; box-shadow: 0 0 0 1px #bbf7d0; }
.tl-dot.orange { background: #fed7aa; box-shadow: 0 0 0 1px #fed7aa; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-title { font-size: 12.5px; font-weight: 600; }
.tl-time { font-size: 11px; color: var(--text-3); margin-left: auto; }
.tl-body { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.7; white-space: pre-wrap; }

/* ---------------- 表单 / 弹窗 ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 100; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(1px); }
.modal {
  position: relative; margin: 6vh auto; background: var(--card); border-radius: 14px; width: 560px;
  max-width: calc(100vw - 40px); max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(15,23,42,.3); animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal.wide { width: 860px; }
.modal.narrow { width: 440px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-head .x { margin-left: auto; width: 26px; height: 26px; border-radius: 50%; border: none; background: none; cursor: pointer; color: var(--text-3); font-size: 16px; }
.modal-head .x:hover { background: var(--soft-2); color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.modal-foot .left { margin-right: auto; font-size: 11.5px; color: var(--text-3); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item { min-width: 0; }
/* 客户档案编辑表单：按分组（基础信息/经营信息/备注…）分块 */
.form-zone { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-zone .full { grid-column: 1 / -1; }
.form-zone-title { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--text); border-left: 3px solid var(--primary); padding-left: 8px; margin: 4px 0 2px; }
.form-item .label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.form-item .label .req { color: var(--red); }
.form-item input, .form-item select, .form-item textarea { font-size: 12.5px; }
.help { font-size: 11px; color: var(--text-3); margin-top: 5px; }

.dup-box { margin-top: 8px; font-size: 12px; border-radius: 8px; padding: 9px 11px; line-height: 1.6; display: none; }
.dup-box.show { display: block; }
.dup-box.checking { background: var(--soft); color: var(--text-2); border: 1px dashed #cbd5e1; }
.dup-box.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.dup-box.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.dup-box.danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.dup-list { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.dup-line { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }

.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #0f172a; color: #fff; font-size: 12.5px; padding: 9px 16px; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15,23,42,.28); animation: drop .2s ease-out; max-width: 420px;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0 } to { transform: none; opacity: 1 } }

.seg { display: inline-flex; background: var(--soft-2); padding: 3px; border-radius: 8px; gap: 2px; }
.seg button {
  border: none; background: none; font-size: 12px; padding: 5px 12px; border-radius: 6px;
  cursor: pointer; color: var(--text-2); font-family: inherit;
}
.seg button.active { background: var(--card); color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(15,23,42,.1); }

.pager { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.pager .spacer { flex: 1; }
.pager-info { white-space: nowrap; }
.pager-size-group { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pager-label { color: var(--text-3); font-size: 12px; }
.pager-size { border: 1px solid var(--line); border-radius: 6px; padding: 3px 26px 3px 8px; font-size: 12px; background: var(--card); color: var(--text-2); cursor: pointer; min-width: 60px; }
.pager-size:hover { border-color: var(--primary); color: var(--primary); }
.pager-nav { display: inline-flex; align-items: center; gap: 6px; }
.pager button { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.pager button:hover:not([disabled]) { border-color: var(--primary); color: var(--primary); }
.pager button[disabled] { opacity: .45; cursor: not-allowed; }
.pager-page { color: var(--text-3); min-width: 48px; text-align: center; }

/* 登录选择组织 modal 里的卡片 */
.org-card { display: block; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; background: var(--card); color: var(--ink); font-family: inherit; font-size: inherit; transition: all .15s; }
.org-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,102,204,.1); }
.org-card:last-child { margin-bottom: 0; }

.role-matrix table { width: 100%; border-collapse: collapse; font-size: 12px; }
.role-matrix th, .role-matrix td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.role-matrix th { background: var(--soft); font-weight: 600; color: var(--text-2); }

.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.check-item input { width: auto; }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .app { grid-template-columns: 200px 1fr; }
  .detail-head-main { flex: 1 1 200px; }
  .detail-actions { flex: 1 1 100%; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .form-zone { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .toolbar input.search { min-width: 140px; }
}
@media (max-width: 860px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 168px 1fr; }
  .brand-text .logo-sub { display: none; }
  .user-meta { display: none; }
  .search-wrap { max-width: none; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ---------------- AI 输入 / 语音 ---------------- */
.ai-field textarea { width: 100%; }
.ai-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-btn {
  border: 1px solid #c7d2fe; background: #eef2ff; color: #4338ca; border-radius: 20px;
  font-size: 11px; padding: 3px 10px; cursor: pointer; font-family: inherit; transition: all .15s;
}
.ai-btn:hover { background: #e0e7ff; border-color: #a5b4fc; }
.ai-btn.on { background: #4338ca; color: #fff; border-color: #4338ca; }
.ai-btn.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--card); display: inline-block; margin-right: 5px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.ai-tip { font-size: 10.5px; color: var(--text-3); flex: 1 1 140px; line-height: 1.5; }

/* 手机端语音按钮：加大触控区域（44px+）、字号放大 */
@media (max-width: 768px) {
  .ai-btn { font-size: 14px; padding: 10px 16px; min-height: 44px; border-radius: 12px; line-height: 1.2; }
  .ai-btn.ai-voi { font-size: 14.5px; padding: 11px 18px; background: linear-gradient(135deg, #eef2ff, #dbeafe); border-color: #a5b4fc; font-weight: 600; }
  .ai-btn.ai-voi:active { transform: scale(.97); }
  .ai-tools { gap: 10px; }
  .ai-tip { font-size: 11px; flex: 1 1 100%; margin-top: 4px; }
}

/* ---------------- 附件 ---------------- */
.attach-box { border: 1px dashed var(--line); border-radius: 8px; padding: 9px 10px; background: var(--soft); }
/* 通用浅色提示盒 / 头像变体（深色模式见文末覆写） */
.soft-box { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12.5px; line-height: 1.7; }
.warn-box { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 8px 11px; font-size: 12px; line-height: 1.6; }
.avatar-sm.red { background: #fee2e2; color: #b91c1c; }
.avatar-sm.amber { background: #fef3c7; color: #b45309; }
.avatar-sm.gray { background: #e2e8f0; color: #475569; }
.text-risk { color: #b91c1c; }
.text-warn { color: #c2410c; }
.text-ok { color: #15803d; }

/* ===== 联系记录卡片式排版 ===== */
.fu-list { display: flex; flex-direction: column; gap: 10px; }
.fu-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); transition: box-shadow .15s; }
.fu-item:hover { box-shadow: 0 2px 10px rgba(15, 23, 42, .06); }
.fu-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fu-contact { font-weight: 600; font-size: 13px; }
.fu-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.fu-head .btn { padding: 2px 8px; }
.fu-content { font-size: 13px; line-height: 1.8; color: var(--ink); margin-top: 8px; white-space: pre-wrap; word-break: break-word; }
.fu-next { margin-top: 8px; font-size: 12px; color: var(--text-2); border-left: 2px solid var(--line); padding-left: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.fu-item .attach-inline { margin-top: 8px; }

/* ===== 变更记录 diff ===== */
.chg-row { margin: 2px 0; word-break: break-word; }
.chg-old { color: #b91c1c; text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, .45); }
.chg-arrow { margin: 0 6px; color: var(--text-3); }
.attach-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attach-list:empty { display: none; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; max-width: 230px;
}
.attach-chip a { color: var(--primary); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip a:hover { text-decoration: underline; }
.attach-chip .x { border: none; background: none; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 0; line-height: 1; }
.attach-inline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------------- AI 画像卡片 ---------------- */
.ai-head { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ai-meter { height: 7px; background: var(--soft-2); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.ai-meter-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #34d399, #2563eb); }
.ai-advice { background: var(--soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; line-height: 1.7; }
.ai-advice .k { font-size: 11px; color: var(--primary); font-weight: 600; margin-right: 8px; }
.ai-block { margin-top: 12px; }
.ai-block .k { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.ai-list { margin: 0; padding-left: 16px; font-size: 12px; line-height: 1.75; color: var(--text-2); }
.ai-list li.risk-high { color: #b91c1c; }
.ai-list li.risk-mid { color: #b45309; }
.ai-list li.risk-low { color: var(--text-2); }
.ai-plan { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.9; color: var(--text-2); }
.ai-plan li .badge { margin-right: 6px; }

.advice-cell { min-width: 220px; }
.advice-text { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; display: block; margin-top: 4px; }
.advice-risk { font-size: 10.5px; color: #b91c1c; margin-top: 2px; }

/* ---------------- 批量导入 ---------------- */
.import-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.import-tip { background: var(--soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; font-size: 11.5px; color: var(--text-2); line-height: 1.7; }
.import-preview { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* ---------------- 数据大屏 ---------------- */
.trend { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 6px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar { width: 100%; max-width: 44px; min-height: 4px; border-radius: 5px; background: linear-gradient(180deg, #93c5fd, #2563eb); }
.trend-val { font-size: 11px; color: var(--text-2); margin-top: 5px; font-variant-numeric: tabular-nums; }
.trend-label { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }
.empty-cell { text-align: center; color: var(--text-3); padding: 20px 0 !important; }

/* ---------------- 权限配置 ---------------- */
.perm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.perm-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--card); }
.perm-card h4 { margin: 0 0 4px; font-size: 13px; }
.perm-card .desc { font-size: 11px; color: var(--text-3); margin-bottom: 12px; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line-2); font-size: 12px; }
.perm-row .name { flex: 1; }
.perm-row .name small { display: block; color: var(--text-3); font-size: 10.5px; margin-top: 2px; }
/* 全局页面水印层：覆盖所有内容（含弹窗），只展示不拦截点击 */
.crm-watermark { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; background-repeat: repeat; display: none; }

/* 水印管理：深浅滑块 */
input[type="range"]#wmDepth { accent-color: var(--primary); height: 4px; }

.perm-row select { width: 150px; font-size: 11.5px; padding: 5px 8px; }

/* 权限配置：左侧菜单可见权限树 */
.perm-menu { margin-top: 2px; }
.perm-menu-group { border-top: 1px dashed var(--line-2); padding: 8px 0 4px; }
.perm-menu-group:first-child { border-top: 0; }
.perm-menu-head { font-size: 12.5px; font-weight: 600; }
.perm-menu-head .small { font-size: 10.5px; font-weight: 400; color: var(--text-3); }
.perm-menu-items { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-left: 20px; margin-top: 6px; }
.perm-menu-item { font-size: 11.5px; color: var(--text-2); }
.perm-menu-item.off { opacity: .45; }
.perm-menu-tip { font-size: 10.5px; color: var(--text-3); padding-left: 20px; margin-top: 5px; line-height: 1.6; }
@media (max-width: 1100px) { .perm-grid { grid-template-columns: 1fr; } }

/* ---------------- 默认跟踪曲线 ---------------- */
.tracking-grid { display: grid; grid-template-columns: 1fr; gap: 2px; }
.track-row { display: grid; grid-template-columns: 200px 140px 1fr; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.track-level { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.track-input { display: flex; align-items: center; gap: 6px; }
.track-input input[type="number"] { width: 70px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 768px) {
  .track-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ============================================================
 *  拜访记录卡片网格
 * ============================================================ */
.visit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.visit-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 8px;
}
.visit-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,.12); }
.vc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vc-date { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.vc-cust { font-size: 13.5px; font-weight: 600; color: var(--text); }
.vc-body { font-size: 12.5px; color: var(--text); line-height: 1.7; }
.vc-target { color: var(--text-2); font-size: 12px; margin-bottom: 2px; }
.vc-summary { color: var(--text); margin-bottom: 2px; }
.vc-next { color: var(--text-2); font-size: 12px; border-left: 2px solid var(--line); padding-left: 6px; }
.vc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line-2); }
@media (max-width: 900px) { .visit-grid { grid-template-columns: 1fr; } }

/* ============================================================
 *  移动端 H5 响应式覆盖（兼容手机浏览器 + 企业微信内打开）
 *  断点：<= 768px（手机竖屏）、<= 1024px（平板）
 * ============================================================ */

/* ---- 登录页：移动端单栏 ---- */
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { padding: 24px 16px; align-content: center; }
  .login-card { width: 100%; max-width: 360px; padding: 26px 22px; border-radius: 14px; }
}

/* ---- 主应用：移动端侧边栏折叠为顶部汉堡菜单 ---- */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0; width: 240px;
    z-index: 100; transition: left .22s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .main { grid-template-rows: auto auto 1fr; margin-left: 0; }
  .topbar { padding: 8px 10px; gap: 8px; flex-wrap: wrap; }
  .search-wrap { order: 3; width: 100%; }
  .search-wrap input { height: 36px; font-size: 15px; }
  .top-actions .btn-primary { display: none; }
  .user-chip .user-meta { display: none; }
  .user-chip { padding: 2px; }
  /* 汉堡按钮 */
  .burger-btn {
    display: grid; place-items: center;
    width: 36px; height: 36px; font-size: 18px; color: var(--text);
    cursor: pointer; border-radius: 8px; background: var(--soft-2);
    border: 1px solid var(--line); flex-shrink: 0;
  }
  .burger-btn:active { background: var(--line); }
}

/* ---- Tabbar 移动端：页签横向滚动 ---- */
@media (max-width: 768px) {
  .tabbar { padding: 6px 8px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { padding: 6px 14px; font-size: 12.5px; white-space: nowrap; }
  .tabbar-actions { display: none; }
}

/* ---- KPI 卡片 / Dashboard ---- */
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-val { font-size: 22px; }
  .dash-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .dash-col { grid-template-columns: 1fr; }
}

/* ---- 客户详情 ---- */
@media (max-width: 768px) {
  .detail-hero { flex-direction: column; gap: 12px; padding: 14px; }
  .detail-head-main .detail-name { font-size: 15px; }
  .detail-meta { flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; }
  .detail-actions { flex-wrap: wrap; }
  .detail-tabs { overflow-x: auto; scrollbar-width: none; }
  .detail-tabs::-webkit-scrollbar { display: none; }
  .detail-tabs .dtab { padding: 8px 12px; font-size: 12px; white-space: nowrap; }

  /* 联系记录时间线：左侧竖线堆叠为上方 */
  .timeline .tl-item { flex-direction: column; gap: 6px; padding: 10px 12px; }
  .timeline .tl-side {
    position: relative; left: 0; top: 0; width: 100%;
    border-left: none; border-bottom: 2px solid var(--line); padding: 0 0 6px 0;
    flex-direction: row; flex-wrap: wrap; gap: 4px 10px;
  }
  .timeline .tl-side-day { font-size: 13px; font-weight: 700; color: var(--primary); }
  .timeline .tl-side-time { font-size: 11px; color: var(--text-3); }
  .timeline .tl-side-name { font-size: 11.5px; color: var(--text-2); }
  .timeline .tl-dot { display: none; }
  .timeline .tl-body { padding: 0; margin-left: 0; }
}

/* ---- 表格：移动端转卡片 ---- */
@media (max-width: 768px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card .table-wrap { border-radius: 0; border-left: none; border-right: none; }
  /* 让表格首列 sticky，方便扫查 */
  .card table.data thead th:first-child,
  .card table.data tbody td:first-child {
    position: sticky; left: 0; background: var(--card); z-index: 1;
  }
  .card table.data thead th:first-child { background: var(--soft); }
}

/* ---- Modal：移动端全宽 ---- */
@media (max-width: 768px) {
  .modal { width: 100vw !important; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .modal .modal-body { max-height: calc(100vh - 130px); }
  .modal .modal-head { padding: 14px 16px; }
  .modal .modal-foot { padding: 12px 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-item.full { grid-column: 1 / -1; }
}

/* ---- Segmented 移动端 ---- */
@media (max-width: 768px) {
  .seg { flex-wrap: wrap; gap: 6px; }
  .seg button { flex: 1 1 40%; font-size: 12px; padding: 8px 4px; }
}

/* ---- List row 移动端紧凑 ---- */
@media (max-width: 768px) {
  .list-row { padding: 10px 12px; gap: 10px; }
  .page-head { flex-direction: column; gap: 10px; align-items: flex-start; }
  .page-head-actions { width: 100%; }
  .card { border-radius: 8px; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }
}

/* ---- 拜访记录卡片视图覆盖（手机端） ---- */
@media (max-width: 768px) {
  .visit-card { padding: 12px; margin-bottom: 10px; }
  .visit-card .vc-head { font-size: 13px; }
  .visit-card .vc-summary { font-size: 12.5px; }
}

/* ---- 企业微信内：隐藏顶部 storage 提示 ---- */
@media (max-width: 768px) {
  .sidebar-foot .storage-tip { display: none; }
}

/* ---- Service Worker：离线提示 ---- */
body.offline::after {
  content: "当前离线，数据保存在本机";
  position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  padding: 6px 14px; border-radius: 20px; font-size: 11px; z-index: 9999;
}

/* ===== 可排序/可拖拽表格 ===== */
table.data thead th {
  position: relative;
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
  padding-right: 6px;
}
table.data thead th .col-label { display: inline-flex; align-items: center; gap: 6px; }
table.data thead th .sort-arrow {
  font-size: 12px; color: var(--text-3); transition: color .15s;
  display: inline-block; line-height: 1; font-weight: 700;
}
table.data thead th .sort-arrow.active { color: var(--primary); }

/* 列宽拖拽手柄 */
table.data thead th .col-resize {
  position: absolute; top: 0; right: -3px; width: 8px; height: 100%;
  cursor: col-resize; z-index: 5;
}
table.data thead th .col-resize:hover,
table.data thead th .col-resize:active { background: rgba(37, 99, 235, .2); }

/* 列拖拽高亮 */
table.data thead th.dragging { opacity: .5; }
table.data thead th.drag-over {
  background: rgba(37, 99, 235, .08);
  box-shadow: inset 0 -3px 0 #2563eb;
}

/* ===== 行号/序号列（固定第一列，不可拖拽） ===== */
table.data thead th.idx-col {
  width: 48px; min-width: 48px; max-width: 48px;
  text-align: center; font-weight: 600;
  cursor: default;            /* 不可拖所以cursor不用grabbing */
  user-select: none;
  background: var(--soft) !important;
}
table.data thead th.idx-col .col-resize { display: none; }
table.data thead th.idx-col .sort-arrow { display: none; }
table.data td.idx {
  text-align: center;
  color: var(--text-3, #94a3b8);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  width: 48px;
}

/* 操作列固定（吸右）：表格超宽横向滚动时，操作按钮始终贴在可视区右侧，不会被推到屏幕外 */
table.data thead th.actions,
table.data tbody td.actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 12px -10px rgba(15, 23, 42, .22);
}
table.data thead th.actions { background: var(--soft); z-index: 3; }
table.data tbody tr:hover td.actions { background: var(--hover); }

/* 固定列宽模式：所有列都声明宽度时启用。
 * table-layout:fixed 后列宽严格按设定值，表格总宽超过容器时由 .table-wrap 横向滚动；
 * 单元格内超长文本（如 AI 阶段长徽标）截断显示，不再把其他列挤成窄条。 */
table.data.tbl-fixed { table-layout: fixed; width: 100%; }
table.data.tbl-fixed th, table.data.tbl-fixed td { overflow: hidden; }
table.data.tbl-fixed th .col-label {
  display: inline-flex; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
table.data.tbl-fixed td .badge {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle; white-space: nowrap;
}
table.data.tbl-fixed td .ellipsis { max-width: 100%; }

/* 表格容器水平滚动（列宽超过时）
 * 1) max-width:100% + 父级 min-width:0 保证列拖宽后由容器内部滚动，而不是把整页撑出边界被裁掉；
 * 2) 自定义滚动条样式，避免 macOS 覆盖式滚动条自动隐藏导致用户看不到"还可以横向滚动"。 */
.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: #c3cbd8 transparent;
}
.table-wrap table { min-width: 100%; }
.table-wrap::-webkit-scrollbar { height: 12px; }
.table-wrap::-webkit-scrollbar-track { background: var(--soft-2); border-radius: 8px; }
.table-wrap::-webkit-scrollbar-thumb {
  background: #b6c1d1; border-radius: 8px; border: 2px solid var(--soft-2);
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
/* 深色主题下滚动条颜色 */
[data-theme="dark"] .table-wrap { scrollbar-color: #475569 transparent; }
[data-theme="dark"] .table-wrap::-webkit-scrollbar-track { background: var(--soft-2); }
[data-theme="dark"] .table-wrap::-webkit-scrollbar-thumb { background: #475569; border-color: var(--soft-2); }
[data-theme="dark"] .table-wrap::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ===== 外观模式：仅浅色 / 深色两种（深色覆盖见文件末尾） ===== */
.theme-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 768px) { .theme-mode-grid { grid-template-columns: 1fr; } }
/* 页签拖动换序 */
.tab.tab-dragging { opacity: .5; cursor: grabbing; }

/* ===== 今日任务提醒（四象限） ===== */
.today-card { margin-bottom: 14px; }
.tt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tt-col {
  background: var(--soft); border: 1px solid var(--line, #e6ebf2); border-radius: 10px;
  padding: 10px 10px 6px; min-height: 120px;
}
.tt-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.tt-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tt-title { font-size: 12px; font-weight: 700; color: var(--ink); }
.tt-count { margin-left: auto; font-size: 12px; font-weight: 700; }
.tt-sub { font-size: 10px; color: var(--text-3); margin-bottom: 8px; }
.tt-item {
  background: var(--card); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px; margin-bottom: 8px;
}
.tt-item-title { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.tt-item-cust { font-size: 11px; color: var(--primary); cursor: pointer; margin-top: 2px; }
.tt-item-cust:hover { text-decoration: underline; }
.tt-item-reason { font-size: 10.5px; color: #b45309; margin-top: 3px; line-height: 1.4; }
.tt-item-action { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.tt-item-btns { display: flex; gap: 6px; margin-top: 6px; }
.tt-none { font-size: 11px; color: #cbd5e1; padding: 12px 0; text-align: center; }
.tt-more { font-size: 10.5px; color: var(--text-3); text-align: center; padding: 2px 0 6px; }
@media (max-width: 1200px) { .tt-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .tt-grid { grid-template-columns: 1fr; } }


/* ===== AI 跟进教练（工作台顶部显眼卡片） ===== */
.coach-card {
  margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line, #e6ebf2));
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 5%, var(--card)) 0%, var(--card) 58%);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
}
.coach-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.coach-stat { background: var(--card); border: 1px solid var(--line, #e6ebf2); border-radius: 10px; padding: 10px 13px; }
.coach-stat.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.coach-stat.clickable:hover { border-color: var(--primary); box-shadow: 0 3px 12px rgba(37, 99, 235, .12); }
.coach-stat .l { font-size: 12px; color: var(--text-2); }
.coach-stat .v { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 2px 0 1px; }
.coach-stat .s { font-size: 11px; color: var(--text-3); }
.coach-verdict {
  margin: 12px 0; font-size: 13px; color: var(--ink-3); line-height: 1.8;
  background: var(--card); border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 8px 12px;
}
.coach-grid { display: grid; grid-template-columns: 1.1fr 1.1fr 1.2fr; gap: 12px; }
.coach-panel { background: var(--card); border: 1px solid var(--line, #e6ebf2); border-radius: 10px; padding: 12px; }
.coach-k { font-size: 11px; font-weight: 700; color: var(--primary); letter-spacing: .5px; margin-bottom: 8px; }
.coach-k.good { color: #15803d; }
.coach-k.bad { color: #b91c1c; }
.coach-tone { font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.coach-p { font-size: 12.5px; color: var(--ink-3); line-height: 1.75; }
.coach-tips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.coach-tip { font-size: 11px; background: var(--soft-2); color: var(--ink-3); border-radius: 999px; padding: 3px 9px; }
.coach-meter { height: 7px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin: 6px 0 8px; }
.coach-meter > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--card))); }
.coach-rhythm { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-2); }
.coach-rhythm .lvl { font-weight: 600; color: var(--ink-3); min-width: 60px; }
.coach-rhythm .meta { color: var(--text-3); margin-left: auto; font-size: 11px; }
.coach-rhythm .st { font-size: 10.5px; border-radius: 999px; padding: 1px 7px; font-weight: 600; min-width: 48px; text-align: center; }
.st.ok { background: #dcfce7; color: #15803d; }
.st.slow { background: #fee2e2; color: #b91c1c; }
.st.dense { background: #fef3c7; color: #b45309; }
.st.nodata { background: var(--soft-2); color: var(--text-2); }
.coach-note { font-size: 11.5px; color: var(--text-2); line-height: 1.7; margin-top: 8px; }
.coach-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.coach-list { background: var(--card); border: 1px solid var(--line, #e6ebf2); border-radius: 10px; padding: 10px 13px; }
.coach-list ul { margin: 0; padding-left: 16px; }
.coach-list li { font-size: 12.5px; color: var(--ink-3); line-height: 1.95; }
.coach-next { margin-top: 12px; background: var(--card); border: 1px solid var(--line, #e6ebf2); border-radius: 10px; padding: 10px 13px; }
.coach-next-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.coach-next-item { border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 10px; cursor: pointer; background: var(--soft); }
.coach-next-item:hover { border-color: var(--primary); }
.coach-next-item .t { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.coach-next-item .r { font-size: 11px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.coach-next-item .r.act { color: var(--ink-3); }
@media (max-width: 1200px) {
  .coach-stats { grid-template-columns: repeat(3, 1fr); }
  .coach-grid { grid-template-columns: 1fr 1fr; }
  .coach-next-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .coach-stats { grid-template-columns: 1fr 1fr; }
  .coach-grid, .coach-two { grid-template-columns: 1fr; }
}

/* ============================================================
 *  深色模式（data-mode="dark"）
 *  只保留浅色 / 深色两种；主色仍是深蓝，黄 / 绿 / 红只做语义区分
 * ============================================================ */
body[data-mode="dark"] {
  color-scheme: dark;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-soft: color-mix(in srgb, var(--primary) 20%, #141a24);
  --bg: #0b0f17;
  --card: #151a24;
  --field: #1b2230;
  --soft: #1a2230;
  --soft-2: #212a39;
  --line: #2a3140;
  --line-2: #232b3a;
  --hover: #1c2431;
  --ink: #e8ecf4;
  --ink-3: #b6c0d0;
  --text: #e8ecf4;
  --text-2: #a6b0c2;
  --text-3: #7c8798;
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
}

body[data-mode="dark"] .login-card,
body[data-mode="dark"] .login-page { background: var(--card); }
body[data-mode="dark"] .login-right { background: var(--bg); }

/* 浅色语义标签在深色下改为半透明暗底，避免刺眼 */
body[data-mode="dark"] .badge.gray { background: #222b3a; color: #c2ccda; border-color: #303a4b; }
body[data-mode="dark"] .badge.blue { background: rgba(37, 99, 235, .18); color: #93c5fd; border-color: rgba(59, 130, 246, .35); }
body[data-mode="dark"] .badge.cyan { background: rgba(8, 145, 178, .18); color: #67e8f9; border-color: rgba(6, 182, 212, .35); }
body[data-mode="dark"] .badge.orange { background: rgba(245, 158, 11, .16); color: #fcd34d; border-color: rgba(245, 158, 11, .35); }
body[data-mode="dark"] .badge.gold { background: rgba(202, 138, 4, .18); color: #fde68a; border-color: rgba(202, 138, 4, .4); }
body[data-mode="dark"] .badge.green { background: rgba(22, 163, 74, .18); color: #86efac; border-color: rgba(34, 197, 94, .35); }
body[data-mode="dark"] .badge.red { background: rgba(220, 38, 38, .18); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
body[data-mode="dark"] .badge.purple { background: rgba(124, 58, 237, .2); color: #c4b5fd; border-color: rgba(139, 92, 246, .35); }

body[data-mode="dark"] .btn-danger { background: rgba(220, 38, 38, .15); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
body[data-mode="dark"] .btn-ghost:hover { border-color: var(--line); background: var(--soft); }
body[data-mode="dark"] .user-chip:hover { background: var(--soft); }
body[data-mode="dark"] .tab .tab-close:hover { background: var(--soft-2); }

body[data-mode="dark"] .avatar-sm { background: rgba(59, 130, 246, .22); color: #bfdbfe; }
body[data-mode="dark"] .detail-logo { background: linear-gradient(135deg, #1e3a5f, #27467a); color: #bfdbfe; }

body[data-mode="dark"] .ai-btn { background: rgba(124, 58, 237, .16); border-color: rgba(139, 92, 246, .4); color: #c4b5fd; }
body[data-mode="dark"] .ai-btn:hover { background: rgba(124, 58, 237, .26); border-color: rgba(139, 92, 246, .55); }
body[data-mode="dark"] .ai-btn.on { background: #4338ca; color: #fff; border-color: #4338ca; }

body[data-mode="dark"] .st.ok { background: rgba(22, 163, 74, .2); color: #86efac; }
body[data-mode="dark"] .st.slow { background: rgba(220, 38, 38, .2); color: #fca5a5; }
body[data-mode="dark"] .st.dense { background: rgba(245, 158, 11, .2); color: #fcd34d; }
body[data-mode="dark"] .st.nodata { background: var(--soft-2); color: var(--text-2); }

body[data-mode="dark"] .dup-box.ok { background: rgba(22, 163, 74, .15); color: #86efac; border-color: rgba(34, 197, 94, .4); }
body[data-mode="dark"] .dup-box.warn { background: rgba(245, 158, 11, .15); color: #fcd34d; border-color: rgba(245, 158, 11, .4); }
body[data-mode="dark"] .dup-box.danger { background: rgba(220, 38, 38, .15); color: #fca5a5; border-color: rgba(239, 68, 68, .4); }

body[data-mode="dark"] .tl-dot { border-color: var(--card); }
body[data-mode="dark"] .sp-item.locked,
body[data-mode="dark"] .sp-item.locked:hover { background: rgba(245, 158, 11, .13); }
body[data-mode="dark"] .sp-icon.warn { background: rgba(245, 158, 11, .16); color: #fcd34d; }
body[data-mode="dark"] .dup-box.checking { border-color: var(--line); }
body[data-mode="dark"] .warn-box { background: rgba(245, 158, 11, .13); border-color: rgba(245, 158, 11, .4); color: #fcd34d; }
body[data-mode="dark"] .avatar-sm.red { background: rgba(220, 38, 38, .2); color: #fca5a5; }
body[data-mode="dark"] .avatar-sm.amber { background: rgba(245, 158, 11, .2); color: #fcd34d; }
body[data-mode="dark"] .avatar-sm.gray { background: var(--soft-2); color: var(--text-2); }
body[data-mode="dark"] .text-risk { color: #fca5a5; }
body[data-mode="dark"] .text-warn { color: #fcd34d; }
body[data-mode="dark"] .text-ok { color: #86efac; }
body[data-mode="dark"] .fu-item:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
body[data-mode="dark"] .chg-old { color: #fca5a5; text-decoration-color: rgba(252, 165, 165, .4); }
body[data-mode="dark"] .tt-item-reason { color: #fcd34d; }
body[data-mode="dark"] .tt-none { color: var(--text-3); }
body[data-mode="dark"] .ai-list li.risk-high { color: #fca5a5; }
body[data-mode="dark"] .ai-list li.risk-mid { color: #fcd34d; }
body[data-mode="dark"] .advice-risk { color: #fca5a5; }
body[data-mode="dark"] .kpi.clickable:hover { border-color: rgba(59, 130, 246, .5); }
body[data-mode="dark"].offline::after { background: rgba(245, 158, 11, .16); border-color: rgba(245, 158, 11, .45); color: #fcd34d; }
body[data-mode="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
body[data-mode="dark"] ::-webkit-scrollbar-thumb { background: #2f3a4c; border-radius: 6px; }
body[data-mode="dark"] ::-webkit-scrollbar-track { background: transparent; }

/* ================= AI 客户分析面板（统一排版） ================= */
.aip { display: flex; flex-direction: column; gap: 10px; }
.aip-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.aip-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; line-height: 1; white-space: nowrap;
  background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.aip-chip.green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.aip-chip.blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.aip-chip.orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.aip-chip.purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.aip-chip.red, .aip-chip.aip-risk-critical, .aip-chip.aip-risk-high { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.aip-chip.aip-risk-medium { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.aip-chip.aip-risk-low { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

.aip-meter { height: 4px; border-radius: 2px; background: #f1f5f9; overflow: hidden; }
.aip-meter i { display: block; height: 100%; border-radius: 2px; background: #2563eb; transition: width .3s ease; }

.aip-lead { padding: 10px 12px; border-left: 3px solid #2563eb; border-radius: 6px;
  background: #f8fafc; font-size: 13px; line-height: 1.65; color: #1f2937; }

.aip-sec { padding: 12px 14px; border: 1px solid #eef0f3; border-radius: 10px; background: #fff; }
.aip-sec-h { display: flex; align-items: center; gap: 7px; margin-bottom: 8px;
  font-size: 12.5px; font-weight: 600; color: #374151; }
.aip-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.aip-dot.red { background: #ef4444; } .aip-dot.green { background: #10b981; }
.aip-dot.orange { background: #f59e0b; } .aip-dot.purple { background: #8b5cf6; }
.aip-dot.blue { background: #3b82f6; }

.aip-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.aip-list li { position: relative; padding-left: 12px; font-size: 12.8px; line-height: 1.6; color: #374151; }
.aip-list li:before { content: ''; position: absolute; left: 2px; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: #cbd5e1; }

.aip-risks { display: flex; flex-direction: column; gap: 8px; }
.aip-risk-item { padding: 9px 11px; border-left: 3px solid #f59e0b; border-radius: 8px; background: #fffdf7; }
.aip-risk-item.lvl-critical, .aip-risk-item.lvl-high { border-left-color: #ef4444; background: #fff8f8; }
.aip-risk-item.lvl-low { border-left-color: #10b981; background: #f7fdfa; }
.aip-risk-t { margin-bottom: 3px; font-size: 12.8px; font-weight: 600; color: #1f2937; }
.aip-risk-d { font-size: 12.5px; line-height: 1.6; color: #4b5563; }

.aip-act { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px dashed #f0f1f3; }
.aip-act:first-child { padding-top: 0; }
.aip-act:last-child { padding-bottom: 0; border-bottom: 0; }
.aip-p { flex: none; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600;
  line-height: 20px; color: #fff; background: #6b7280; }
.aip-p.p1 { background: #ef4444; } .aip-p.p2 { background: #f59e0b; } .aip-p.p3 { background: #3b82f6; }
.aip-act-b { min-width: 0; }
.aip-act-t { font-size: 12.8px; font-weight: 500; line-height: 1.55; color: #1f2937; }
.aip-act-r { margin-top: 2px; font-size: 12px; line-height: 1.55; color: #9ca3af; }

.aip-kvs { display: flex; flex-direction: column; gap: 7px; }
.aip-kv { display: flex; gap: 10px; font-size: 12.5px; line-height: 1.6; }
.aip-k { flex: none; width: 64px; color: #9ca3af; }
.aip-v { min-width: 0; color: #374151; }
.aip-text { font-size: 12.8px; line-height: 1.65; color: #374151; }
.aip-empty { font-size: 12.5px; color: #9ca3af; }
.aip-meta { font-size: 11.5px; color: #9ca3af; }

body[data-mode="dark"] .aip-chip { background: #232b38; color: #b6c2d2; border-color: #2f3a4c; }
body[data-mode="dark"] .aip-chip.green, body[data-mode="dark"] .aip-chip.aip-risk-low { background: rgba(16,185,129,.14); color: #6ee7b7; border-color: rgba(16,185,129,.35); }
body[data-mode="dark"] .aip-chip.blue { background: rgba(59,130,246,.14); color: #93c5fd; border-color: rgba(59,130,246,.35); }
body[data-mode="dark"] .aip-chip.orange { background: rgba(245,158,11,.14); color: #fcd34d; border-color: rgba(245,158,11,.35); }
body[data-mode="dark"] .aip-chip.purple { background: rgba(139,92,246,.14); color: #c4b5fd; border-color: rgba(139,92,246,.35); }
body[data-mode="dark"] .aip-chip.red,
body[data-mode="dark"] .aip-chip.aip-risk-critical,
body[data-mode="dark"] .aip-chip.aip-risk-high,
body[data-mode="dark"] .aip-chip.aip-risk-medium { background: rgba(239,68,68,.14); color: #fca5a5; border-color: rgba(239,68,68,.35); }
body[data-mode="dark"] .aip-meter { background: #232b38; }
body[data-mode="dark"] .aip-lead { background: #1b222d; color: #d3dbe7; border-left-color: #3b82f6; }
body[data-mode="dark"] .aip-sec { background: #1b222d; border-color: #2a3341; }
body[data-mode="dark"] .aip-sec-h { color: #b6c2d2; }
body[data-mode="dark"] .aip-list li, body[data-mode="dark"] .aip-text, body[data-mode="dark"] .aip-v,
body[data-mode="dark"] .aip-act-t, body[data-mode="dark"] .aip-risk-d { color: #c3cdda; }
body[data-mode="dark"] .aip-risk-t { color: #e6ecf4; }
body[data-mode="dark"] .aip-risk-item { background: #202834; }
body[data-mode="dark"] .aip-act { border-bottom-color: #262f3c; }
body[data-mode="dark"] .aip-k, body[data-mode="dark"] .aip-act-r,
body[data-mode="dark"] .aip-meta, body[data-mode="dark"] .aip-empty { color: #7d8b9e; }

@media (max-width: 560px) {
  .aip-sec { padding: 10px 11px; }
  .aip-k { width: 56px; }
}


/* ===== 顶栏今日 Token 消耗 ===== */
.token-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-2, #f1f5f9); border: 1px solid var(--line, #e2e8f0);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2, #475569);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: all .15s;
}
.token-chip:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
body[data-mode="dark"] .token-chip { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: #c3cdda; }

/* ===== 打印模板：设计器 / 预览 / 管理 ===== */
.modal.print-modal { width: min(1080px, 94vw); }
.modal.print-modal .modal-body { max-height: 78vh; overflow: auto; }
.pt-form { display: flex; gap: 16px; margin-bottom: 12px; }
.pt-form .fld { display: flex; align-items: center; gap: 8px; }
.pt-form .fld input[type=text] { width: 220px; }
.pt-zone { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.pt-zone-h { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.pt-zone-h select { margin-left: auto; width: auto; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; align-items: center; }
.pt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-2, #f8fafc); font-size: 12px; }
.pt-chip.dragging { opacity: .5; }
.pt-handle { cursor: grab; color: var(--ink-4); font-weight: 700; user-select: none; padding: 0 2px; }
.pt-name { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.pt-btext { width: 130px; font-size: 12px; padding: 3px 6px; }
.pt-chip input[type=checkbox] { margin: 0; }
.pt-del { cursor: pointer; color: var(--ink-4); font-style: normal; padding: 0 4px; font-size: 14px; }
.pt-del:hover { color: #dc2626; }
.pt-cols .pt-chip { padding-right: 10px; }
.pt-savebar { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.pt-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pt-toolbar .spacer, .pt-mgr-row .spacer { flex: 1; }
.pt-sel { width: auto; min-width: 180px; }
.pt-frame { width: 100%; height: 62vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pt-mgr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.pt-mgr-row.def { border-color: var(--primary, #2563eb); background: rgba(37, 99, 235, .04); }
.pt-mgr-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
body[data-mode="dark"] .pt-chip, body[data-mode="dark"] .pt-zone { background: rgba(255,255,255,.04); }
body[data-mode="dark"] .pt-frame { background: #fff; }

/* ===== 自定义模块 · 客户档案自定义 ===== */
.cust-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.cust-layout-rail { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; background: var(--bg-2); min-height: 200px; }
.cust-layout-rail-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cust-layout-canvas { display: flex; flex-direction: column; gap: 14px; }
.layout-zone { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.layout-zone-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.layout-zone-title { font-size: 13px; font-weight: 700; color: var(--text); }
.layout-zone-hint { font-size: 11px; color: var(--text-3); }
.layout-zone-body { padding: 12px; min-height: 60px; }
/* 布局里的字段 chip —— 比普通 pt-chip 更突出 */
.cust-field.pt-chip { padding: 6px 10px; margin-bottom: 6px; background: var(--card); border-color: var(--line); font-size: 12px; }
.cust-field.pt-chip:last-child { margin-bottom: 0; }
.cust-field.dragging { opacity: .4; transform: scale(1.02); }
.cust-size-sm { border-left: 3px solid #60a5fa; }    /* 蓝 */
.cust-size-md { border-left: 3px solid #34d399; }    /* 绿 */
.cust-size-lg { border-left: 3px solid #f59e0b; }    /* 橙 */
.pt-size-select { font-size: 11px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); cursor: pointer; margin-left: auto; }
.pt-del[data-remove] { margin-left: 2px; }

/* ===== 客户详情页 · 按布局渲染的网格 ===== */
.cust-layout-card { margin-bottom: 14px; }
.cust-detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; }
.cust-detail-cell { background: var(--card); padding: 12px 14px; min-height: 56px; display: flex; flex-direction: column; justify-content: center; }
.cust-detail-cell .k { font-size: 11px; color: var(--text-3); margin-bottom: 5px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cust-detail-cell .v { font-size: 13px; color: var(--text); word-break: break-word; line-height: 1.5; }
.cust-detail-cell.cust-size-sm { grid-column: span 1; }  /* 小栏位：1 列 */
.cust-detail-cell.cust-size-md { grid-column: span 2; }  /* 长栏位：2 列 */
.cust-detail-cell.cust-size-lg { grid-column: span 4; }  /* 高栏位：全宽 + 多行 */
.cust-detail-cell.cust-size-lg .v { white-space: pre-wrap; font-size: 12.5px; line-height: 1.75; }
/* 只读单元格灰显 */
.cust-detail-cell.ro { background: var(--bg-2, #f8fafc); }
.cust-detail-cell.ro .v { color: var(--text-3); }
.ro-tag { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #fef3c7; color: #b45309; font-weight: 600; }

body[data-mode="dark"] .cust-detail-cell.ro { background: rgba(255,255,255,.04); }
body[data-mode="dark"] .ro-tag { background: rgba(245,158,11,.2); color: #fbbf24; }

/* 响应式 */
@media (max-width: 980px) {
  .cust-layout { grid-template-columns: 1fr; }
  .cust-detail-grid { grid-template-columns: repeat(2, 1fr); }
  .cust-detail-cell.cust-size-md { grid-column: span 2; }
  .cust-detail-cell.cust-size-lg { grid-column: span 2; }
}
@media (max-width: 560px) {
  .cust-detail-grid { grid-template-columns: 1fr; }
  .cust-detail-cell.cust-size-sm,
  .cust-detail-cell.cust-size-md,
  .cust-detail-cell.cust-size-lg { grid-column: span 1; }
}

/* ===== 业务员能力雷达 ===== */
.radar-wrap { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.radar-chart-box { flex: 0 0 auto; }
.radar-svg { display: block; }
.radar-label { font-size: 11.5px; fill: var(--ink-3, #64748b); font-weight: 600; }
.radar-score { font-size: 10.5px; fill: var(--ink-4, #94a3b8); }
.radar-side { flex: 1; min-width: 220px; }
.radar-k { font-size: 12px; font-weight: 700; margin: 10px 0 6px; }
.radar-k:first-child { margin-top: 0; }
.radar-k.good { color: #16a34a; }
.radar-k.bad { color: #dc2626; }
.radar-list { margin: 0; padding-left: 18px; }
.radar-list li { font-size: 12.5px; line-height: 1.7; color: var(--ink-2, #334155); margin-bottom: 3px; }
.radar-p { font-size: 12.5px; color: var(--ink-4, #94a3b8); }
.radar-meta { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-4, #94a3b8); }
body[data-mode="dark"] .radar-label { fill: #9fb0c5; }
body[data-mode="dark"] .radar-score { fill: #7d8b9e; }
body[data-mode="dark"] .radar-list li { color: #c3cdda; }
@media (max-width: 560px) { .radar-wrap { justify-content: center; } }

/* ===== 目标管理：工作台置顶看板 ===== */
.target-board { margin-bottom: 14px; }
.tg-user-select { height: 28px; font-size: 11.5px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); max-width: 150px; }
.target-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tcard { position: relative; border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 12px 13px; background: var(--card); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.tcard:hover { box-shadow: 0 6px 18px rgba(15,23,42,.1); transform: translateY(-2px); }
.tcard.st-green { border-left-color: #16a34a; }
.tcard.st-yellow { border-left-color: #f59e0b; }
.tcard.st-red { border-left-color: #dc2626; }
.tcard.st-gray { border-left-color: #94a3b8; opacity: .8; }
.tcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tcard-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.4; }
.tcard-rank { flex: 0 0 auto; font-size: 10.5px; color: var(--primary); background: var(--primary-soft); border-radius: 10px; padding: 2px 7px; white-space: nowrap; }
.tcard-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 10px; }
.tcard-rate { font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.tcard-rate span { font-size: 14px; font-weight: 600; margin-left: 1px; }
.tcard.st-green .tcard-rate { color: #16a34a; }
.tcard.st-yellow .tcard-rate { color: #d97706; }
.tcard.st-red .tcard-rate { color: #dc2626; }
.tcard.st-gray .tcard-rate { color: #94a3b8; }
.tcard-nums { text-align: right; font-size: 11px; color: var(--text-3); line-height: 1.7; }
.tcard-nums .tn .l { color: var(--text-3); margin-right: 4px; }
.tcard-nums .tn b, .tcard-nums .tn { color: var(--text-2); font-variant-numeric: tabular-nums; }
.tcard-bar { height: 6px; border-radius: 4px; background: var(--soft-2); margin-top: 10px; overflow: hidden; }
.tcard-bar span { display: block; height: 100%; border-radius: 4px; background: currentColor; opacity: .85; transition: width .4s; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 10.5px; color: var(--text-3); }
.tcard-st { font-weight: 600; }
.tcard.st-green .tcard-st { color: #16a34a; }
.tcard.st-yellow .tcard-st { color: #d97706; }
.tcard.st-red .tcard-st { color: #dc2626; }
.tcard.st-gray .tcard-st { color: #94a3b8; }
.tcard-warn { margin-top: 8px; padding: 5px 8px; border-radius: 6px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 10.5px; line-height: 1.5; }

/* ===== 目标管理：配置页 ===== */
.tg-rate { font-weight: 600; font-variant-numeric: tabular-nums; }
.tg-rate.green { color: #16a34a; }
.tg-rate.yellow { color: #d97706; }
.tg-rate.red { color: #dc2626; }
.tg-rate.gray { color: #94a3b8; }
.tg-settings { display: flex; flex-direction: column; gap: 12px; }
.tg-switch { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.6; cursor: pointer; }
.tg-switch input { width: auto; margin-top: 2px; }
.tg-role-grid, .tg-member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; background: var(--bg-2, #f8fafc); }

/* ===== 目标管理：卡片下钻弹窗 ===== */
.tbd-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tbd-kpi { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--bg-2, #f8fafc); }
.tbd-kpi .l { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.tbd-kpi .v { font-size: 19px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tbd-kpi .v.st-green { color: #16a34a; }
.tbd-kpi .v.st-yellow { color: #d97706; }
.tbd-kpi .v.st-red { color: #dc2626; }
.tbd-sec-title { font-size: 12.5px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.tbd-scroll { max-height: 260px; overflow-y: auto; }

body[data-mode="dark"] .tcard-warn { background: rgba(245,158,11,.13); border-color: rgba(245,158,11,.4); color: #fcd34d; }
body[data-mode="dark"] .tbd-kpi, body[data-mode="dark"] .tg-role-grid, body[data-mode="dark"] .tg-member-grid { background: rgba(255,255,255,.04); }
body[data-mode="dark"] .tcard.st-gray { opacity: .7; }

@media (max-width: 980px) {
  .target-cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .tg-role-grid, .tg-member-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .target-cards { grid-template-columns: 1fr; }
  .tbd-top { grid-template-columns: 1fr; }
  .tg-role-grid, .tg-member-grid { grid-template-columns: 1fr; }
  .card-head-actions { flex-wrap: wrap; }
}

/* ============================================================
 *  v2 · UI 统一规范 & 全端响应式（移动优先）
 *  基调：扁平、克制、统一；纯 CSS 重排，横竖屏旋转无需刷新
 *  断点：≤479 手机窄屏 | 480–767 手机 | 768–1023 平板/折叠展开
 *        1024–1279 折叠宽屏 | ≥1280 PC
 * ============================================================ */

/* ---------- 1. 设计令牌（字体 / 间距 / 圆角 / 触控 / 阴影） ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
  --fs-display: 22px;
  --fs-h1: 19px;
  --fs-h2: 15px;
  --fs-h3: 13.5px;
  --fs-body: 13px;
  --fs-sm: 12px;
  --fs-xs: 11px;
  --fs-2xs: 10px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);
  --sidebar-w: 228px;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
}

/* 移动端浏览器地址栏高度变化时保持稳定 */
.app, .login-page { height: 100vh; }
@supports (height: 100dvh) {
  .app, .login-page { height: 100dvh; }
}

/* ---------- 2. 扁平化：去渐变 / 去立体阴影 / 去位移悬停 ---------- */
.sidebar { background: #0f172a; }
body[data-mode="dark"] .sidebar { background: #0b0f17; }
.login-left { background: #0f172a; }
.login-left::after { display: none; }
.logo-mark { box-shadow: none; }

.card, .kpi, .detail-hero, .visit-card, .fu-item, .coach-card,
.login-card, .search-panel, .user-menu, .org-menu, .tcard,
.cust-layout-rail, .layout-zone, .perm-card, .aip-sec, .tbd-kpi {
  box-shadow: none;
}
.login-card { border: 1px solid var(--line); }

.avatar, .user-avatar { background: var(--primary); }
.detail-logo { background: var(--primary-soft); color: var(--primary); }
.bar-fill, .ai-meter-fill, .coach-meter > div, .aip-meter i,
.trend-bar, .ai-meter-fill, .coach-meter > div { background: var(--primary); background-image: none; }

.tcard:hover, .org-item:hover, .kpi.clickable:hover, .coach-stat.clickable:hover { transform: none; }
.tcard:hover { border-color: var(--primary); box-shadow: none; }
.btn-primary { box-shadow: none; }
.btn-primary:hover { background: var(--primary-dark); filter: none; }

/* ---------- 3. 统一字号阶梯 ---------- */
.page-title { font-size: var(--fs-h1); line-height: 1.35; }
.page-sub { font-size: var(--fs-sm); line-height: 1.6; }
.card-title { font-size: var(--fs-h3); }
.modal-title { font-size: var(--fs-h2); }
.kpi-value, .tcard-rate, .trend-val, .tg-rate { font-variant-numeric: tabular-nums; }
.small, .help, .sub-text, .list-sub { font-size: var(--fs-xs); }

/* ---------- 4. 统一间距 ---------- */
.content { padding: var(--sp-4) var(--sp-5) var(--sp-7); }
.page-head { margin-bottom: var(--sp-3); gap: var(--sp-3); }
.card-head { padding: var(--sp-3) var(--sp-4); }
.card-body { padding: var(--sp-4); }
.card-body.tight { padding: 0; }
.toolbar { padding: var(--sp-3) var(--sp-4); }
.pager { padding: var(--sp-2) var(--sp-4); }

/* ---------- 5. 统一组件：按钮 / 输入 / 弹窗 / 分页 ---------- */
.btn { min-height: 34px; border-radius: var(--radius-sm); padding: 7px 14px; font-size: var(--fs-body); font-weight: 500; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: var(--fs-sm); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: #cbd5e1; background: var(--soft); }
input, select, textarea { border-radius: var(--radius-sm); }
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
.modal { border-radius: var(--radius-lg); }
.pager button { border-radius: var(--radius-xs); }

/* ---------- 6. 文本溢出与图表等比缩放 ---------- */
img { max-width: 100%; }
.radar-svg, .trend { max-width: 100%; }
.radar-svg { height: auto; }
.tl-body, .fu-content, .vc-body, .vc-summary, .vc-target, .coach-p,
.aip-lead, .aip-risk-d, .aip-act-t, .ai-advice, .warn-box, .soft-box,
.list-sub, .page-sub, .help, .dup-line, .advice-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ellipsis { max-width: 100%; }

/* 登录页授权到期预警 / 后台入口 */
.license-notice {
  font-size: 12px; line-height: 1.6; border-radius: var(--radius-sm);
  padding: 9px 11px; margin: 0 0 14px; border: 1px solid transparent;
  overflow-wrap: anywhere;
}
.license-notice.warn { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.license-notice.err { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.login-backend-link { color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.login-backend-link:hover { text-decoration: underline; }

/* ---------- 7. 移动端抽屉 / 汉堡（默认隐藏，窄屏启用） ---------- */
.burger-btn {
  display: none; place-items: center; width: 40px; height: 40px;
  flex: 0 0 auto; font-size: 19px; color: var(--text); cursor: pointer;
  border-radius: var(--radius-sm); background: var(--soft-2); border: 1px solid var(--line);
}
.burger-btn:active { background: var(--line); }
.nav-mask { display: none; position: fixed; inset: 0; z-index: 110; background: rgba(15, 23, 42, .45); }
.nav-mask.show { display: block; }
body.nav-open { overflow: hidden; }

/* ============================================================
 *  8. 手机（≤767）：竖屏优先 + 横屏同套规则
 * ============================================================ */
@media (max-width: 767px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: min(82vw, 300px); z-index: 120;
    transform: translateX(-100%); transition: transform .24s ease;
    box-shadow: none;
  }
  .sidebar.open { transform: none; }
  .brand { padding: 14px 16px 12px; }
  .nav { padding: 8px; }
  .nav-item { min-height: var(--tap); padding: 11px 12px; font-size: 14px; }
  .nav-group-title { padding: 12px 10px 6px; }
  .sidebar-foot { padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }

  .main { min-width: 0; }
  .topbar {
    height: auto; flex: 0 0 auto; flex-wrap: wrap; gap: 8px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 8px;
  }
  .burger-btn {
    display: grid; width: 40px; height: 40px;
  }
  .burger-btn:active { background: var(--line); }
  .search-wrap { order: 3; flex: 1 1 100%; max-width: none; }
  .search-wrap input { height: 42px; font-size: 16px; }
  .top-actions { gap: 8px; }
  .org-chip { padding: 4px 7px; gap: 5px; }
  .org-name { max-width: 82px; font-size: 11px; }
  .org-sub, .user-dept { display: none; }
  .token-chip { padding: 5px 9px; font-size: 11px; }
  .user-chip { padding: 2px; }
  .user-chip .user-meta { display: none; }

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

  /* 登录页：短屏可滚动，避免按钮被裁出视口 */
  .login-page { height: auto; min-height: 100vh; overflow-y: auto; }
  @supports (min-height: 100dvh) { .login-page { min-height: 100dvh; } }
  .login-right { align-content: center; }
  .login-card { max-width: 420px; }

  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head-actions { width: 100%; justify-content: flex-start; }
  .page-head-actions .btn { flex: 1 1 auto; justify-content: center; }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 22px; }
  .dash-grid, .dash-col { grid-template-columns: 1fr; gap: 10px; }

  /* 目标看板：窄屏单列 */
  .target-cards { grid-template-columns: 1fr; gap: 10px; }
  .tcard { padding: 12px; }
  .visit-grid { grid-template-columns: 1fr; }
  .coach-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .coach-grid, .coach-two, .coach-next-grid { grid-template-columns: 1fr; }
  .tt-grid { grid-template-columns: 1fr; }

  .detail-hero { flex-direction: column; padding: 14px; gap: 10px; }
  .detail-logo { width: 44px; height: 44px; font-size: 17px; }
  .detail-name { font-size: 17px; }
  .detail-meta { gap: 6px 12px; font-size: 11.5px; }
  .detail-meta span { white-space: normal; }
  .detail-actions { width: 100%; justify-content: flex-start; }
  .detail-actions .btn { flex: 1 1 auto; justify-content: center; }
  .detail-tabs { overflow-x: auto; scrollbar-width: none; }
  .detail-tabs::-webkit-scrollbar { display: none; }

  .info-grid { grid-template-columns: 1fr; }
  .cust-detail-grid { grid-template-columns: 1fr; }
  .cust-detail-cell, .cust-detail-cell.cust-size-sm,
  .cust-detail-cell.cust-size-md, .cust-detail-cell.cust-size-lg { grid-column: span 1; }
  .cust-detail-cell { min-height: 48px; padding: 10px 12px; }

  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid .full, .form-item.full { grid-column: 1 / -1; }

  /* 弹窗：撑满可用宽度但保留边距，宽屏限制最大宽度 */
  .modal {
    width: calc(100vw - 24px) !important; max-width: 560px; height: auto;
    margin: 5vh auto; max-height: 90vh; border-radius: var(--radius-lg);
  }
  .modal.wide, .modal.narrow { width: calc(100vw - 24px) !important; max-width: 560px; }
  .modal .modal-body { max-height: calc(90vh - 132px); }
  .modal-head { padding: 12px 14px; }
  .modal-head .x { width: 32px; height: 32px; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .modal-foot .left { flex-basis: 100%; margin: 0 0 4px; }
  .modal-foot .btn { min-height: 40px; }

  /* 触控友好：输入 / 按钮达到可点击尺寸 */
  .btn { min-height: 40px; font-size: 13.5px; }
  .btn-sm { min-height: 34px; padding: 6px 11px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 40px; font-size: 16px; }
  textarea { min-height: 96px; }
  .field > span, .field-label, .form-item .label { font-size: 12px; }

  /* 查询筛选区：两列流式，关键词占整行 */
  .toolbar { padding: 10px 12px; gap: 8px; }
  .toolbar .fld { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar .fld:has(input.search) { flex: 1 1 100%; }
  .toolbar .fld label { font-size: 11.5px; }
  .toolbar .fld input, .toolbar .fld select { width: 100%; min-width: 0; min-height: 38px; font-size: 16px; }
  .toolbar input.search { width: 100%; }
  .toolbar .spacer { display: none; }
  .tbl-colbar { padding: 6px 12px 0; }

  .pager { gap: 8px; padding: 10px 12px; }
  .pager .spacer { display: none; }
  .pager-info { flex: 1 1 100%; }
  .pager-nav { margin-left: auto; }
  .pager button { min-height: 36px; }

  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 0; min-height: 36px; font-size: 12.5px; }

  .search-panel { max-height: 60vh; }
  .toast { max-width: calc(100vw - 28px); }

  /* 布局画布 / 自定义配置 */
  .cust-layout { grid-template-columns: 1fr; }
  .cust-layout-rail { padding: 10px; }
  .cust-layout-canvas { gap: 10px; }
  .layout-zone-head { flex-wrap: wrap; gap: 4px 8px; padding: 9px 12px; }
  .layout-zone-body { padding: 10px; }
  .cust-field.pt-chip { width: 100%; }
  .cust-zoom-bar { margin-bottom: 8px; }
}

/* ---------- 9. 手机窄屏（≤479）：单列与紧凑排版 ---------- */
@media (max-width: 479px) {
  .target-cards { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-chip { display: none; }
  .org-chip .org-meta { display: none; }
  .tcard-rate { font-size: 24px; }
  .colcfg-list { grid-template-columns: 1fr; }
  .tg-role-grid, .tg-member-grid { grid-template-columns: 1fr; }
  .tbd-top { grid-template-columns: 1fr; }
  .card-head-actions { flex-wrap: wrap; }
}

/* ---------- 10. 表格：手机转为卡片式，其它宽度横向滚动 ---------- */
@media (max-width: 640px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data.cards-ready { display: block; width: 100%; min-width: 0; }
  table.data.cards-ready thead { display: none; }
  table.data.cards-ready tbody { display: block; }
  table.data.cards-ready tbody tr {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius-sm); margin-bottom: 10px; padding: 3px 2px;
  }
  table.data.cards-ready tbody tr:hover { background: var(--card); }
  table.data.cards-ready tbody tr.clickable:active { background: var(--soft); }
  table.data.cards-ready tbody td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 7px 10px; border: 0; text-align: left; vertical-align: top;
  }
  table.data.cards-ready tbody td.idx { display: none; }
  /* 卡片化模式下取消操作列的吸右固定，保持普通行内展示 */
  table.data.cards-ready tbody td.actions {
    position: static; right: auto; z-index: auto;
    background: transparent; box-shadow: none;
    justify-content: flex-end;
  }
  table.data.cards-ready tbody td::before {
    content: attr(data-label);
    flex: 0 0 84px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.65;
  }
  table.data.cards-ready tbody td[colspan] { display: block; }
  table.data.cards-ready tbody td[colspan]::before { display: none; }
  table.data.cards-ready tbody td.actions { flex-wrap: wrap; justify-content: flex-end; }
  table.data.cards-ready tbody td.actions::before { flex: 1 1 auto; text-align: left; }
  table.data.cards-ready tbody td.num { text-align: right; }
  table.data.cards-ready tbody td > * { min-width: 0; }
  .card table.data.cards-ready thead th:first-child,
  .card table.data.cards-ready tbody td:first-child { position: static; background: transparent; }
}

/* ---------- 11. 平板 / 折叠屏展开（768–1023） ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  .app { grid-template-columns: 188px 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
  .target-cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .content { padding: 14px 16px 32px; }
  .cust-layout { grid-template-columns: 200px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 14px; gap: 10px; }
  .org-chip .org-meta { display: none; }
}

/* ---------- 12. 折叠宽屏 / 小型笔记本（1024–1279） ---------- */
@media (min-width: 1024px) and (max-width: 1279px) {
  .app { grid-template-columns: 210px 1fr; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1.35fr 1fr; }
  .content { padding: 16px 18px 40px; }
}

/* ---------- 13. 手机横屏（低高度）：压缩纵向占用，横向多列 ---------- */
@media (orientation: landscape) and (max-width: 900px) and (max-height: 520px) {
  /* 手机横屏：侧栏同样收进抽屉，把宽度留给内容 */
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(52vw, 300px); z-index: 120;
    transform: translateX(-100%); transition: transform .24s ease;
  }
  .sidebar.open { transform: none; }
  .burger-btn { display: grid; }
  .topbar { flex-wrap: nowrap; height: 48px; flex: 0 0 48px; padding: 4px 12px; }
  .search-wrap { order: 0; flex: 1 1 auto; max-width: 320px; }
  .top-actions .btn-primary { display: none; }
  .token-chip, .org-chip { display: none; }
  .content { padding: 10px 14px 24px; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .target-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabbar { height: 34px; flex: 0 0 34px; }
  .modal { max-height: 94vh; margin: 3vh auto; }
  /* 登录页横屏：压缩纵向留白并允许滚动 */
  .login-page { height: auto; min-height: 100vh; overflow-y: auto; }
  .login-right { padding: 12px 16px; align-content: start; }
  .login-card { padding: 18px 20px; }
}

/* ---------- 14. 布局画布缩放条 ---------- */
.cust-zoom-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cust-zoom-bar .btn-sm { min-width: 54px; justify-content: center; padding: 4px 10px; }
.cust-layout-canvas { zoom: var(--cz, 1); }

/* ---------- 15. 降低动效（尊重系统“减少动态效果”） ---------- */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .modal, .toast, .tabs, .tcard, .btn { transition: none !important; animation: none !important; }
}

/* ---------- 16. 全局字号档位（仅本人生效，持久保存） ---------- */
/* 只缩放主应用内容，弹窗/遮罩保持 100%，避免大字号下弹层被裁切或点不中 */
:root { --ui-scale: 1; }
#app { zoom: var(--ui-scale, 1); }
.font-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.font-level {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer; text-align: left;
}
.font-level:hover { border-color: var(--primary); }
.font-level.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft, rgba(37,99,235,.15)); }
.font-level .fl-name { font-weight: 600; font-size: 14px; }
.font-level .fl-demo { color: var(--text-2); line-height: 1.4; }

/* ---------- 17. 授权信息卡片 ---------- */
.lic-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lic-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 14px; font-size: 13px; border-bottom: 1px dashed var(--border);
}
.lic-row:last-child { border-bottom: 0; }
.lic-row span { color: var(--text-2); }
.lic-row b { font-weight: 600; text-align: right; word-break: break-all; }

/* 大字号下避免弹窗/表格溢出：容器内部滚动 */
body[data-font="lg"] .modal, body[data-font="xl"] .modal { max-height: 92vh; }

/* ============================================================
 *  18. 手机版专用界面（html.device-mobile，按设备识别而非窗口宽度）
 *      PC 端与窄窗口完全不受影响；手机端隐藏侧栏/页签，改用底部大按钮导航。
 * ============================================================ */
html.device-mobile,
html.device-mobile body { height: 100%; height: -webkit-fill-available; }
html.device-mobile body {
  overflow: hidden; background: var(--card);
  overscroll-behavior: none; -webkit-overflow-scrolling: touch;
}

html.device-mobile .sidebar,
html.device-mobile .tabbar,
html.device-mobile .burger-btn,
html.device-mobile .nav-mask { display: none !important; }

/* 整屏铺满：固定定位 + dvh，避免 iOS 主屏模式顶部被状态栏盖住、底部露出空白 */
html.device-mobile .app {
  display: block;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0; padding: 0;
  grid-template-columns: none;
  background: var(--bg);
  overflow: hidden;
}
html.device-mobile .main {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0; overflow: hidden;
  background: var(--bg);
}

/* 顶部精简栏：隐藏电脑版 topbar，改用手机专用栏（组织名 + 头像） */
html.device-mobile .topbar { display: none !important; }
html.device-mobile .org-menu,
html.device-mobile .user-menu { position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); right: 12px; left: auto; width: min(78vw, 320px); }

.m-topbar {
  display: none; flex: 0 0 auto; align-items: center; gap: 8px;
  min-height: 52px;
  padding: max(6px, env(safe-area-inset-top, 0px)) 12px 6px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
html.device-mobile .m-topbar { display: flex; }
.m-top-org {
  flex: 0 1 auto; min-width: 0; height: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: transparent; color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.m-top-org .ico { width: 14px; height: 14px; color: var(--text-3); }
.m-top-org .m-org-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 64vw; }
.m-top-user {
  margin-left: auto; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--soft);
  display: grid; place-items: center; cursor: pointer;
}
.m-top-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 700;
}

html.device-mobile .content {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  padding: 12px 12px calc(66px + env(safe-area-inset-bottom, 0px));
}

/* 底部导航 */
.m-tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 140;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
html.device-mobile .m-tabbar { display: flex; }
.m-tab {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: 0; background: transparent; color: var(--text-3);
  font-size: 11px; font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.m-tab .ico { width: 22px; height: 22px; }
.m-tab.active { color: var(--primary); font-weight: 600; }
.m-tab:active { background: var(--soft); }

/* 返回按钮（客户详情页） */
.m-back {
  display: none; position: fixed; z-index: 145;
  left: 12px; bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 22px; line-height: 1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .12); cursor: pointer;
}
.m-back.show { display: grid; place-items: center; }

/* 新建客户悬浮按钮 */
.m-fab {
  display: none; position: fixed; z-index: 145;
  right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--primary); color: #fff;
  font-size: 26px; line-height: 1; font-weight: 300;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .38); cursor: pointer;
}
html.device-mobile .m-fab { display: grid; place-items: center; }
.m-fab:active { transform: scale(.94); }

/* ---- 手机版登录页 ---- */
html.device-mobile .login-page {
  height: 100vh; height: 100dvh;
  min-height: 100vh; min-height: 100dvh;
  display: block;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(1200px 620px at 8% 0%, #1e3a8a 0%, #0f172a 52%, #0b1220 100%);
}
html.device-mobile .login-left { display: none; }
html.device-mobile .login-right {
  display: flex; align-items: flex-start; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  background: transparent;
  padding: max(24px, env(safe-area-inset-top, 0px)) 18px calc(20px + env(safe-area-inset-bottom, 0px));
}
html.device-mobile .login-card {
  width: 100%; max-width: 420px; padding: 26px 22px 22px;
  border-radius: 18px; border: 0;
  background: var(--card); box-shadow: 0 16px 40px rgba(2, 6, 23, .35);
}
html.device-mobile .login-card h2 { font-size: 20px; }
.m-login-brand { display: none; }
html.device-mobile .m-login-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
html.device-mobile .m-login-brand .logo-name { font-size: 16px; }
html.device-mobile .m-login-brand .logo-sub { font-size: 10px; letter-spacing: .12em; }
html.device-mobile .login-card .field input { height: 48px; font-size: 16px; border-radius: 10px; }
html.device-mobile .login-card .field select { height: 48px; font-size: 16px; border-radius: 10px; }
html.device-mobile .login-card .btn-block { height: 48px; font-size: 16px; margin-top: 6px; border-radius: 10px; }

/* ---- 手机版通用列表组件 ---- */
.m-hello { padding: 4px 2px 12px; }
.m-hello .a { font-size: 20px; font-weight: 700; color: var(--ink); }
.m-hello .b { margin-top: 4px; font-size: 12px; color: var(--text-3); }

.m-search { position: relative; margin: 0 0 12px; }
.m-search input {
  width: 100%; height: 42px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  padding: 0 16px; font-size: 15px; color: var(--text);
}
.m-search input:focus { outline: 0; border-color: var(--primary); }
.m-search-result {
  position: absolute; left: 0; right: 0; top: 48px; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); max-height: 56vh; overflow-y: auto;
}

.m-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.m-kpi {
  text-align: left; padding: 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card);
  font-family: inherit; cursor: pointer;
}
.m-kpi:active { background: var(--soft); }
.m-kpi .v { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.m-kpi .l { margin-top: 4px; font-size: 13px; color: var(--text); font-weight: 600; }
.m-kpi .s { margin-top: 2px; font-size: 11px; color: var(--text-3); }
.m-kpi.warn { border-color: #fde68a; background: #fffbeb; }
.m-kpi.warn .v { color: #b45309; }

.m-sec { margin-bottom: 16px; }
.m-sec-head {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.m-sec-head .n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 11px;
  display: inline-grid; place-items: center;
}

/* 手机端工作台：我的目标 */
.m-tg-list { display: flex; flex-direction: column; gap: 8px; }
.m-tg {
  display: block; width: 100%; padding: 12px 14px; text-align: left; font-family: inherit;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-tg:active { background: var(--soft); }
.m-tg-top { display: flex; align-items: center; gap: 8px; }
.m-tg-name { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-tg-badge { flex: 0 0 auto; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--soft-2); color: var(--text-2); }
.m-tg.st-green .m-tg-badge { background: #ecfdf5; color: #15803d; }
.m-tg.st-yellow .m-tg-badge { background: #fffbeb; color: #b45309; }
.m-tg.st-red .m-tg-badge { background: #fef2f2; color: #b91c1c; }
.m-tg-mid { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 8px 0 6px; }
.m-tg-mid b { font-size: 20px; line-height: 1; color: var(--ink); }
.m-tg-mid b i { font-style: normal; font-size: 12px; font-weight: 600; }
.m-tg-mid span { font-size: 11.5px; color: var(--text-3); }
.m-tg-bar { position: relative; height: 6px; border-radius: 999px; background: var(--soft-2); overflow: hidden; }
.m-tg-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg,#3b82f6,#6366f1); }
.m-tg.st-green .m-tg-bar i { background: linear-gradient(90deg,#22c55e,#16a34a); }
.m-tg.st-red .m-tg-bar i { background: linear-gradient(90deg,#f87171,#dc2626); }
.m-tg-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.m-tg-warn { margin-top: 6px; font-size: 11px; color: #b45309; }
html[data-theme="dark"] .m-tg.st-green .m-tg-badge { background: rgba(34,197,94,.16); color: #86efac; }
html[data-theme="dark"] .m-tg.st-yellow .m-tg-badge { background: rgba(245,158,11,.16); color: #fcd34d; }
html[data-theme="dark"] .m-tg.st-red .m-tg-badge { background: rgba(239,68,68,.16); color: #fca5a5; }
html[data-theme="dark"] .m-tg-warn { color: #fcd34d; }

.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px; border-radius: 14px; text-align: left;
  border: 1px solid var(--line); background: var(--card);
  font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.m-row:active { background: var(--soft); }
.m-row.tall { align-items: flex-start; }
.m-row.plain { border-color: transparent; background: transparent; padding: 10px 4px; }
.m-row .m-dot {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 15px; font-weight: 700;
}
.m-row .m-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-row .m-main .t {
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-row .m-main .s {
  font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-row .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.m-row .m-end { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.m-row .m-end.dim { color: var(--text-3); }
.m-row .m-arrow { flex: 0 0 auto; color: var(--text-3); font-size: 18px; }

.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; background: var(--soft-2); color: var(--text-2);
}
.pill.warn { background: #fffbeb; color: #b45309; }
.pill.risk { background: #fef2f2; color: #b91c1c; }
.pill.on { background: var(--primary-soft); color: var(--primary); }

.m-empty { padding: 28px 0; text-align: center; color: var(--text-3); font-size: 13px; }

.m-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.m-quick button {
  height: 48px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer;
}
.m-quick button:active { background: var(--soft); }

/* 客户列表页头 */
.m-list-head { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-bottom: 6px; }
.m-seg { display: flex; gap: 6px; margin-bottom: 10px; }
.m-seg button {
  flex: 1 1 0; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.m-seg button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.m-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.m-chips::-webkit-scrollbar { display: none; }
.m-chips button {
  flex: 0 0 auto; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.m-chips button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.m-count { font-size: 12px; color: var(--text-3); padding: 0 2px 6px; }

/* 手机版信息卡片（公海 / 拜访等一列多行结构） */
.m-card {
  margin: 0 0 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.m-card:active { background: var(--soft); }
.m-card-top { display: flex; align-items: flex-start; gap: 10px; }
.m-card-title {
  flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600;
  color: var(--ink); line-height: 1.4; word-break: break-word;
}
.m-card-top > .btn, .m-card-top > .badge { flex: 0 0 auto; }
.m-card-sub { margin-top: 4px; font-size: 12px; color: var(--text-3); line-height: 1.5; word-break: break-word; }
.m-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.m-card-kv {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--text-3);
}
.m-card-kv span { flex: 0 0 auto; }
.m-card-kv b {
  flex: 1 1 auto; min-width: 0; font-weight: 500; color: var(--ink-3);
  text-align: right; word-break: break-word;
}
.m-card-act { margin-top: 10px; display: flex; justify-content: flex-end; gap: 8px; }
.m-card-act .btn { min-height: 34px; }
.m-filter-select {
  flex: 0 0 auto; height: 32px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; color: var(--text-2); font-family: inherit;
}

/* 我的 */
.m-profile { display: flex; align-items: center; gap: 14px; padding: 18px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.m-avatar {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 20px; font-weight: 700;
}
.m-profile .n { font-size: 17px; font-weight: 700; color: var(--ink); }
.m-profile .s { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.m-group { margin-top: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.m-group-title { padding: 12px 14px 6px; font-size: 12px; color: var(--text-3); }
.m-cell {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 50px; padding: 12px 14px; border: 0; border-top: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-size: 14.5px; font-family: inherit; text-align: left; cursor: pointer;
}
.m-cell:active { background: var(--soft); }
.m-cell.danger { color: #dc2626; justify-content: center; font-weight: 600; }
.m-cell .m-end { font-size: 12.5px; color: var(--text-3); }
.m-cell .m-arrow { color: var(--text-3); }
.m-foot { padding: 22px 0 8px; text-align: center; font-size: 11px; color: var(--text-3); }

.m-license .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.m-license .row:last-of-type { border-bottom: 0; }
.m-license .row span { color: var(--text-3); }
.m-license .row b { font-weight: 600; color: var(--ink); text-align: right; }
.m-license .btn-block { margin-top: 14px; }

/* 手机版弹窗改为底部上滑面板，更好点按 */
html.device-mobile .modal-root { z-index: 300; }
html.device-mobile .modal {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto;
  width: 100% !important; max-width: none !important;
  margin: 0 !important; border-radius: 18px 18px 0 0 !important;
  max-height: 92vh; animation: m-sheet .18s ease-out;
}
@keyframes m-sheet { from { transform: translateY(24px); opacity: .6 } to { transform: none; opacity: 1 } }
html.device-mobile .modal-body { max-height: calc(92vh - 150px); }
html.device-mobile .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }
html.device-mobile .modal-foot .btn { flex: 1 1 0; }
html.device-mobile .form-grid { grid-template-columns: 1fr; }
html.device-mobile .toast { bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important; }

/* ---- 手机版：标题栏 / 工具栏 / 详情头 对齐修正 ---- */
html.device-mobile .card { border-radius: 14px; }
html.device-mobile .card-head {
  flex-wrap: wrap; align-items: flex-start;
  padding: 12px 14px; gap: 8px;
}
html.device-mobile .card-title { font-size: 14px; line-height: 1.4; flex: 1 1 auto; min-width: 0; }
html.device-mobile .card-head-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
html.device-mobile .card-head-actions .btn { min-height: 32px; }

html.device-mobile .toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; overflow: visible;
}
html.device-mobile .toolbar .fld { flex: 1 1 100%; min-width: 0; }
html.device-mobile .toolbar .fld label { display: block; margin-bottom: 4px; font-size: 11.5px; color: var(--text-3); }
html.device-mobile .toolbar .spacer { display: none; }
html.device-mobile .toolbar > span { display: none; }
html.device-mobile .toolbar input,
html.device-mobile .toolbar select { width: 100%; min-width: 0; height: 38px; }
html.device-mobile .toolbar > .btn { flex: 0 0 auto; }

/* 详情页头部 */
html.device-mobile .detail-hero {
  flex-direction: row; flex-wrap: wrap; align-items: flex-start;
  padding: 14px; gap: 10px 12px; border-radius: 16px;
}
html.device-mobile .detail-logo { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; font-size: 17px; }
html.device-mobile .detail-head-main { flex: 1 1 60%; min-width: 0; }
html.device-mobile .detail-name { font-size: 17px; gap: 6px; line-height: 1.35; }
html.device-mobile .detail-meta { gap: 6px 14px; margin-top: 6px; font-size: 11.5px; }
html.device-mobile .detail-meta span { white-space: normal; }
html.device-mobile .detail-actions {
  flex: 0 0 100%; width: 100%; order: 3;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; padding-top: 4px;
}
html.device-mobile .detail-actions .btn {
  width: 100%; min-width: 0; min-height: 38px;
  justify-content: center; padding: 0 6px; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html.device-mobile .detail-actions .btn:only-child { grid-column: 1 / -1; }
html.device-mobile .detail-tabs {
  flex-wrap: wrap; overflow: visible; white-space: normal;
  padding: 5px; margin-bottom: 12px;
}
html.device-mobile .dtab { padding: 8px 11px; flex: 0 0 auto; }

/* 多列信息网格改为单列上下结构 */
html.device-mobile .info-grid { grid-template-columns: 1fr; }
html.device-mobile .cust-detail-grid { grid-template-columns: 1fr; }
html.device-mobile .form-grid { grid-template-columns: 1fr; }

/* ---- 手机版：表格 → App 卡片（一列多行） ---- */
html.device-mobile .table-wrap { overflow: visible; }
html.device-mobile table.data {
  display: block; width: 100%; border-collapse: separate;
  font-size: 13px;
}
html.device-mobile table.data thead { display: none; }
html.device-mobile table.data tbody { display: block; }
html.device-mobile table.data tbody tr {
  display: block; margin: 0 0 10px; padding: 12px 12px 8px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
html.device-mobile table.data tbody tr.clickable:active { background: var(--soft); }
html.device-mobile table.data tbody tr:last-child { margin-bottom: 0; }
html.device-mobile table.data tbody td {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 5px 0; border: 0; line-height: 1.5;
  text-align: right; white-space: normal; word-break: break-word;
}
html.device-mobile table.data tbody td::before {
  content: attr(data-label);
  flex: 0 0 78px; text-align: left;
  color: var(--text-3); font-size: 12px;
}
html.device-mobile table.data tbody td:not([data-label])::before,
html.device-mobile table.data tbody td[data-label=""]::before { display: none; }
html.device-mobile table.data tbody td.idx { display: none; }
html.device-mobile table.data tbody td.num { text-align: right; }
/* 首个内容列做卡片标题 */
html.device-mobile table.data tbody td:first-child:not(.idx),
html.device-mobile table.data tbody td.idx + td {
  display: block; padding: 0 0 8px;
  font-size: 15px; font-weight: 600; color: var(--ink);
  text-align: left; line-height: 1.4;
}
html.device-mobile table.data tbody td:first-child:not(.idx)::before,
html.device-mobile table.data tbody td.idx + td::before { display: none; }
/* 操作列铺满一行、按钮右对齐 */
html.device-mobile table.data tbody td.actions {
  display: block; padding-top: 8px; margin-top: 4px;
  border-top: 1px dashed var(--line); text-align: right; white-space: normal;
}
html.device-mobile table.data tbody td.actions::before { display: none; }
html.device-mobile table.data tbody td.actions .btn { margin: 3px 0 3px 6px; }
/* 空数据整行 */
html.device-mobile table.data tbody td[data-full] {
  display: block; padding: 6px 0; text-align: center; border: 0;
}
html.device-mobile table.data tbody td[data-full]::before { display: none; }

/* 分页条在手机上居中换行 */
html.device-mobile .pager { flex-wrap: wrap; justify-content: center; gap: 6px; }
html.device-mobile .pager .pages { flex-wrap: wrap; justify-content: center; }

body[data-font="xl"] .tbl-wrap { overflow-x: auto; }


/* 授权模块标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; line-height: 1.6; background: #e2e8f0; color: #475569; }
.tag.tag-ok { background: #dcfce7; color: #166534; }
.tag.tag-off { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }

/* ===== 报价（客户档案） ===== */
.quote-sum { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 14px; margin-bottom: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--text-2); }
.quote-sum b { color: var(--text); font-weight: 600; }
.quote-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--card); }
.quote-card:last-child { margin-bottom: 0; }
.quote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quote-no { font-size: 13px; color: var(--text-2); font-family: ui-monospace, Menlo, monospace; letter-spacing: .3px; }
.quote-title { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--text); }
.quote-amount { text-align: right; font-size: 20px; font-weight: 700; color: #b45309; white-space: nowrap; }
.quote-amount-lb { display: block; font-size: 11px; font-weight: 400; color: var(--text-3); }
.quote-kv { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.quote-kv b { color: var(--text-2); font-weight: 500; }
.quote-pays { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.quote-pay { display: grid; grid-template-columns: 52px 54px 110px 1fr; gap: 8px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.qp-idx { color: var(--text-3); }
.qp-ratio { color: #1d4ed8; }
.qp-amt { font-weight: 600; color: var(--text); }
.qp-note { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.quote-pay-sum { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.quote-line { margin-top: 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.quote-k { display: inline-block; min-width: 62px; color: var(--text-3); }
.quote-ops { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.quote-ops .small { margin-left: auto; }

/* 报价表单：分期明细行 */
.pay-row { display: grid; grid-template-columns: 58px 82px 118px 1fr 30px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-row input { width: 100%; }
.pay-idx { font-size: 12px; color: var(--text-3); }
.pay-del { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--text-3); border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1; }
.pay-del:hover { color: #e34d59; border-color: #e34d59; }
.pay-add { margin-top: 4px; }

html.device-mobile .quote-head { flex-direction: column; gap: 6px; }
html.device-mobile .quote-amount { text-align: left; font-size: 18px; }
html.device-mobile .quote-amount-lb { display: inline; margin-left: 6px; }
html.device-mobile .quote-pay { grid-template-columns: 46px 44px 1fr; }
html.device-mobile .qp-note { grid-column: 1 / -1; }
html.device-mobile .pay-row { grid-template-columns: 44px 1fr 1fr 30px; }
html.device-mobile .pay-row input[data-pay-note] { grid-column: 1 / 4; }
html.device-mobile .quote-ops .small { margin-left: 0; width: 100%; }

/* ---------------- 站内消息 ---------------- */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-dot {
  display: inline-block; margin-left: 5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #dc2626; color: #fff; font-size: 10px; line-height: 16px;
  text-align: center; font-weight: 600;
}
.notif-panel {
  position: absolute; right: 0; top: 40px; width: 340px; max-height: 420px; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 45;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600;
}
.notif-item { padding: 9px 12px; border-bottom: 1px dashed var(--line-2); cursor: pointer; }
.notif-item:hover { background: var(--primary-soft); }
.notif-item.unread { background: #f8fbff; }
.notif-item.unread .notif-text { font-weight: 600; }
.notif-text { font-size: 12px; color: var(--text); line-height: 1.6; word-break: break-all; }
.notif-time { font-size: 10.5px; color: var(--text-3); margin-top: 3px; }
.notif-empty { padding: 24px 12px; text-align: center; font-size: 12px; color: var(--text-3); }
.notif-foot { padding: 8px 12px; text-align: right; }
html.device-mobile .notif-panel { position: fixed; top: 56px; right: 12px; width: min(88vw, 360px); }

/* ---------------- 审批留痕时间轴 ---------------- */
.ap-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.ap-timeline { border-left: 2px solid var(--line); padding-left: 14px; }
.ap-step { position: relative; padding: 0 0 12px; }
.ap-dot { position: absolute; left: -20px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.ap-dot.green { background: #16a34a; }
.ap-dot.red { background: var(--danger); }
.ap-dot.orange { background: #f59e0b; }
.ap-line1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.ap-comment { margin-top: 4px; font-size: 11.5px; color: var(--text-2); background: var(--soft); padding: 6px 8px; border-radius: 6px; }

/* ---------------- 拜访审核流程模板编辑器 ---------------- */
.flow-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.flow-card.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.flow-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px dashed var(--line-2); }
.flow-name {
  flex: 1; min-width: 200px; font-size: 13px; font-weight: 600; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
  font-family: inherit;
}
.flow-nodes { padding: 10px 0 4px; }
.flow-node {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px;
  border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: 8px; background: var(--soft);
}
.fn-idx {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; margin-top: 4px;
}
.fn-main { flex: 1; display: grid; gap: 6px; }
.fn-line { display: flex; gap: 8px; flex-wrap: wrap; }
.fn-line input, .fn-line select, .fn-main > input {
  flex: 1; min-width: 150px; padding: 6px 9px; font-size: 12px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--card); color: var(--text); font-family: inherit;
}
.fn-ops { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: none; }
.flow-foot { display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); flex-wrap: wrap; }
html.device-mobile .flow-node { flex-direction: column; }
html.device-mobile .fn-ops { width: 100%; }

/* 手机版顶栏消息入口 */
.m-top-bell {
  margin-left: auto; height: 32px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--text-2); font-family: inherit; font-size: 12px; cursor: pointer;
}
.m-top-bell + .m-top-user { margin-left: 6px; }

/* ================= 客户复盘：四卡片布局 ================= */
.rv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rv-head-l { display: flex; align-items: baseline; gap: 10px; }
.rv-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); }
.rv-flow { font-size: 11.5px; color: var(--text-3); }
.rv-head-actions { display: flex; align-items: center; gap: 10px; }

.rv-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 16px; background: var(--card); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.rv-card:last-child { margin-bottom: 0; }
.rv-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; font-size: 13px; font-weight: 700; border-bottom: 1px solid rgba(0,0,0,.06); }
.rv-card-t { letter-spacing: .3px; }
.rv-card-b { padding: 14px 16px 16px; }
.rv-count { font-size: 11.5px; font-weight: 500; color: var(--text-3); }

.rv-risk { background: #fff2f2; border-color: #f6cccc; }
.rv-risk .rv-card-h { background: #ffe4e4; color: #b91c1c; }
.rv-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: #ef4444; color: #fff; }
.rv-tag-critical { background: #b91c1c; }
.rv-tag-high { background: #ef4444; }
.rv-tag-medium { background: #f59e0b; }
.rv-tag-low { background: #64748b; }
.rv-risk-row { display: flex; gap: 11px; padding: 10px 0; border-bottom: 1px dashed #f0d0d0; }
.rv-risk-row:last-of-type { border-bottom: 0; }
.rv-risk-ic { flex: none; width: 18px; height: 18px; border-radius: 50%; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; margin-top: 2px; }
.rv-risk-txt { flex: 1; min-width: 0; }
.rv-risk-t { font-size: 13px; font-weight: 700; color: #7f1d1d; margin-bottom: 3px; line-height: 1.6; word-break: break-word; }
.rv-risk-d { font-size: 12.5px; line-height: 1.8; color: #4b1d1d; word-break: break-word; }
.rv-sum { margin-top: 12px; padding: 11px 13px; border-radius: 8px; background: #fff; border: 1px solid #f3c9c9; font-size: 12.5px; line-height: 1.8; color: #7f1d1d; word-break: break-word; }
.rv-sum > span { display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 20px; background: #b91c1c; color: #fff; font-size: 11px; font-weight: 700; }

.rv-act { background: #fff9e8; border-color: #f3ddb0; }
.rv-act .rv-card-h { background: #fff1d2; color: #b45309; }

.rv-task { background: #fff; border: 1px solid #f0e2c6; border-left: 4px solid #f59e0b; border-radius: 9px; padding: 12px 14px; margin-bottom: 12px; }
.rv-task:last-child { margin-bottom: 0; }
.rv-task-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rv-p { flex: none; width: 26px; height: 20px; border-radius: 20px; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.rv-p1 { background: #ef4444; }
.rv-p2 { background: #f97316; }
.rv-p3 { background: #3b82f6; }
.rv-meta { font-size: 11.5px; color: var(--text-2); background: #f8fafc; border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-check { font-size: 11.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; margin-left: auto; flex: none; white-space: nowrap; }
.rv-task-goal { font-size: 13px; font-weight: 600; line-height: 1.8; color: var(--text); word-break: break-word; overflow-wrap: anywhere; }
.rv-task-exp { font-size: 12px; line-height: 1.8; color: var(--text-2); margin-top: 8px; word-break: break-word; }
.rv-script { position: relative; margin-top: 8px; padding: 9px 10px; padding-right: 88px; background: #f3f4f6; border-radius: 8px; }
.rv-script-t { font-size: 12px; line-height: 1.75; color: #374151; white-space: pre-wrap; }
.rv-copy { position: absolute; top: 6px; right: 6px; }
.rv-task.done { opacity: .6; }
.rv-task.done .rv-task-goal { text-decoration: line-through; color: var(--text-3); }

.rv-snap { background: #f0f7ff; border-color: #cfe3fb; }
.rv-snap .rv-card-h { background: #e2efff; color: #1d4ed8; }
.rv-kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.rv-kv { min-width: 0; background: #fff; border: 1px solid #dbeafe; border-radius: 8px; padding: 9px 12px; }
.rv-kv .k { display: block; font-size: 11px; color: var(--text-3); }
.rv-kv .v { display: block; font-size: 14px; font-weight: 700; color: #1e3a8a; margin-top: 3px; word-break: break-word; }
.rv-line { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dashed #d5e5fb; font-size: 12.5px; line-height: 1.8; color: #1e3a8a; word-break: break-word; }
.rv-line:first-of-type { border-top: 0; }
.rv-line-k { flex: none; width: 64px; color: var(--text-3); font-weight: 600; }

.rv-deep { background: #f8f8f8; border-color: #e5e7eb; }
.rv-deep-sum { cursor: pointer; padding: 11px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-2); list-style: none; display: flex; align-items: center; gap: 8px; }
.rv-deep-sum::-webkit-details-marker { display: none; }
.rv-deep-sum::before { content: '▸'; font-size: 11px; color: var(--text-3); transition: transform .15s; }
.rv-deep[open] .rv-deep-sum::before { transform: rotate(90deg); }
.rv-deep[open] .rv-deep-sum { border-bottom: 1px solid var(--line); }
.rv-lead { font-size: 12.5px; line-height: 1.8; color: var(--text); background: #fff; border-left: 3px solid #9ca3af; border-radius: 6px; padding: 9px 11px; margin-bottom: 10px; }
.rv-block { margin-bottom: 10px; }
.rv-block-t { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.rv-text { font-size: 12px; line-height: 1.75; color: var(--text-2); }
.rv-ul { margin: 0; padding-left: 18px; }
.rv-ul li { font-size: 12px; line-height: 1.8; color: var(--text-2); }
.rv-meta { font-size: 10.5px; color: var(--text-3); padding-top: 8px; border-top: 1px dashed var(--line-2); margin-top: 4px; }
.rv-empty { font-size: 12px; color: var(--text-3); padding: 10px 0; text-align: center; }
.rv-kw { background: #fef3c7; color: #b45309; font-weight: 700; padding: 0 2px; border-radius: 3px; }

/* 客户复盘：头部页签 + 分页内容 */
.rv-tabs {
  display: flex; gap: 4px; margin-bottom: 14px; padding: 4px;
  background: var(--soft-2); border-radius: 12px; overflow-x: auto;
  scrollbar-width: none;
}
.rv-tabs::-webkit-scrollbar { display: none; }
.rv-tab {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: transparent; border-radius: 9px; cursor: pointer;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  font-family: inherit; white-space: nowrap; transition: all .16s;
}
.rv-tab:hover { color: var(--primary); background: rgba(37,99,235,.06); }
.rv-tab.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.rv-tab-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--line); color: var(--text-2);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.rv-tab.active .rv-tab-n { background: var(--primary-soft); color: var(--primary); }
.rv-panel { display: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.rv-panel.active { display: block; }
.rv-panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- AI 复盘访谈：分析过渡动画 + 三轮问答 ---------- */
.rvi-mask {
  position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(15,23,42,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.rvi-load {
  width: min(420px, 100%); background: var(--card); border-radius: 16px;
  padding: 30px 26px 22px; text-align: center; box-shadow: 0 24px 60px rgba(15,23,42,.3);
}
.rvi-orb { position: relative; width: 62px; height: 62px; margin: 0 auto 18px; }
.rvi-orb i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--primary); animation: rvi-spin 1s linear infinite; }
.rvi-orb i:nth-child(2) { inset: 8px; border-top-color: #60a5fa; animation-duration: 1.4s; animation-direction: reverse; }
.rvi-orb i:nth-child(3) { inset: 16px; border-top-color: #93c5fd; animation-duration: 1.8s; }
@keyframes rvi-spin { to { transform: rotate(360deg); } }
.rvi-load-t { font-size: 15px; font-weight: 700; color: var(--ink); }
.rvi-load-s { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.7; min-height: 38px; }
.rvi-bar { height: 4px; border-radius: 2px; background: var(--soft-2); overflow: hidden; margin: 16px 0 10px; }
.rvi-bar i { display: block; height: 100%; width: 40%; border-radius: 2px; background: linear-gradient(90deg, var(--primary), #60a5fa); animation: rvi-bar 1.3s ease-in-out infinite; }
@keyframes rvi-bar { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }
.rvi-note { font-size: 11px; color: var(--text-3); }

.rvi-ask { align-items: flex-start; overflow-y: auto; transition: opacity .18s, transform .18s; }
.rvi-card {
  width: min(760px, 100%); margin: auto; background: var(--card);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(15,23,42,.3); overflow: hidden;
}
.rvi-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; }
.rvi-card-t { font-size: 16px; font-weight: 700; color: var(--ink); }
.rvi-card-s { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.rvi-dots { display: flex; gap: 6px; padding-top: 6px; }
.rvi-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.rvi-dots i.on { background: var(--primary); }
.rvi-prog { height: 3px; background: var(--soft-2); }
.rvi-prog i { display: block; height: 100%; background: var(--primary); transition: width .3s; }
.rvi-body { padding: 6px 22px 4px; max-height: min(62vh, 560px); overflow-y: auto; }
.rvi-q { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.rvi-q:last-child { border-bottom: 0; }
.rvi-q-t { display: flex; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.7; margin-bottom: 10px; }
.rvi-q-t b { flex: none; color: var(--primary); }
.rvi-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rvi-opt {
  text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--soft); color: var(--text); font-size: 12.5px; line-height: 1.6;
  cursor: pointer; font-family: inherit; transition: all .14s;
}
.rvi-opt:hover { border-color: #93c5fd; background: #f8fbff; }
.rvi-opt.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.rvi-card-tip {
  display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 6px;
  background: #fffbeb; border: 1px solid #fde68a; color: #b45309; font-size: 11.5px;
}
.rvi-opt-unknown { grid-column: 1 / -1; border-style: dashed; background: transparent; color: var(--text-2); font-size: 12px; }
.rvi-opt-unknown.active { border-color: #94a3b8; background: var(--soft-2); color: var(--text); box-shadow: none; }

/* ---------- 系统管理 · 版本日志 ---------- */
.vlog { position: relative; padding-left: 18px; }
.vlog::before { content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.vlog-date { position: relative; margin: 16px 0 10px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.vlog-date:first-child { margin-top: 0; }
.vlog-date span { background: var(--bg); padding-right: 10px; }
.vlog-item { position: relative; margin-bottom: 12px; }
.vlog-dot { position: absolute; left: -17px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.vlog-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.vlog-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.vlog-v { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.vlog-time { margin-left: auto; font-size: 11px; color: var(--text-3); }
.vlog-list { margin: 0; padding-left: 18px; }
.vlog-list li { font-size: 12.5px; line-height: 1.9; color: var(--text-2); }

/* ---------- 客户管理 · 客户总结 ---------- */
.sum-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.sum-kpi { background: var(--soft); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; }
.sum-kpi .v { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.sum-kpi .v small { font-size: 11px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.sum-kpi .l { font-size: 11.5px; color: var(--text-2); margin-top: 4px; }
.sum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.sum-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--card); min-width: 0; overflow: hidden; }
.sum-block-t { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.sum-block-t::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--text-3); }
.sum-block.good .sum-block-t::before { background: var(--green); }
.sum-block.warn .sum-block-t::before { background: var(--orange); }
.sum-block.risk .sum-block-t::before { background: var(--red); }
.sum-block.plan .sum-block-t::before { background: var(--primary); }
.sum-block ul { margin: 0; padding-left: 16px; min-width: 0; }
.sum-block li { font-size: 12.5px; line-height: 1.9; color: var(--text-2); word-break: break-word; overflow-wrap: anywhere; }
.sum-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.sum-row:last-child { border-bottom: 0; }
.sum-row:hover { background: var(--hover); }
.sum-row.active { background: var(--primary-soft); }
.sum-row-ic { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--soft-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-2); }
.sum-row-main { flex: 1; min-width: 0; }
.sum-row-t { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sum-row-s { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.sum-row-time { font-size: 11px; color: var(--text-3); }
.sum-sub { font-size: 12.5px; font-weight: 700; color: var(--text); margin: 14px 0 8px; }
.sum-tip { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--soft); border: 1px dashed var(--line); font-size: 12px; color: var(--text-2); line-height: 1.7; }
.sum-viz { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.sum-viz-col { min-width: 0; }
.sum-bars { display: flex; flex-direction: column; gap: 6px; }
.sum-bar-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2); }
.sum-bar-l { width: 74px; flex: none; text-align: right; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--soft-2); overflow: hidden; }
.sum-bar-track i { display: block; height: 100%; border-radius: 4px; transition: width .3s; }
.sum-bar-v { width: 34px; flex: none; text-align: right; font-weight: 600; color: var(--text); }
.sum-table th, .sum-table td { font-size: 12px; white-space: nowrap; }
.sum-cust { display: flex; flex-direction: column; gap: 8px; }
.sum-cust-row { border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--card); }
.sum-cust-row.good { border-left-color: var(--green); background: rgba(22,163,74,.04); }
.sum-cust-row.bad { border-left-color: var(--red); background: rgba(220,38,38,.04); }
.sum-cust-row.normal { border-left-color: var(--primary); }
.sum-cust-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.sum-cust-h b { color: var(--ink); }
.sum-cust-n { margin-left: auto; font-size: 11px; color: var(--text-3); }
.sum-cust-a { font-size: 12px; color: var(--text-2); line-height: 1.8; margin-top: 4px; }
.sum-cust-next { font-size: 11.5px; color: var(--primary); line-height: 1.8; margin-top: 2px; }
.sum-list { margin: 0; padding-left: 16px; }
.sum-list li { font-size: 12px; line-height: 1.9; color: var(--text-2); word-break: break-word; }
.sum-list.bad li::marker { color: var(--red); }
@media (max-width: 720px) {
  .sum-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sum-grid { grid-template-columns: 1fr; }
}
.rvi-card-f { display: flex; align-items: center; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.rvi-pick { font-size: 12px; color: var(--text-2); margin-right: auto; }
.rvi-pick b { color: var(--primary); font-size: 14px; }
@media (max-width: 720px) {
  .rvi-mask { padding: 0; }
  .rvi-card { width: 100%; min-height: 100%; border-radius: 0; }
  .rvi-card-h, .rvi-body { padding-left: 16px; padding-right: 16px; }
  .rvi-body { max-height: none; }
  .rvi-card-f { position: sticky; bottom: 0; background: var(--card); padding-left: 16px; padding-right: 16px; }
  .rvi-opts { grid-template-columns: 1fr; }
  .rvi-opt { padding: 12px; font-size: 13px; }
}

@media (max-width: 720px) {
  .rv-head { align-items: flex-start; }
  .rv-head-actions { width: 100%; justify-content: space-between; }
  .rv-task-h { gap: 6px; }
  .rv-tabs { gap: 2px; padding: 3px; }
  .rv-tab { padding: 8px 10px; font-size: 12.5px; gap: 4px; }
  .rv-tab-n { min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
  .rv-panel { padding: 12px; }
  .rv-script { padding-right: 10px; padding-top: 34px; }
  .rv-script .rv-copy { top: 6px; right: auto; left: 8px; }
  .rv-line { flex-direction: column; gap: 2px; }
}

/* ================= 行程月历 ================= */
.sc-seg { margin-bottom: 12px; }
.sc-seg button { display: inline-flex; align-items: center; gap: 6px; }
.sc-seg-n { font-size: 11px; padding: 0 6px; border-radius: 10px; background: rgba(15,23,42,.07); }
.sc-seg button.active .sc-seg-n { background: rgba(255,255,255,.25); }

.sc-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sc-month { display: flex; align-items: center; gap: 4px; }
.sc-month-t { font-size: 14px; font-weight: 700; min-width: 100px; text-align: center; }
.sc-legend { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.sc-lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sc-dot.visit { background: #3b82f6; }
.sc-dot.busy { background: #94a3b8; }
.sc-dot.trip { background: #f59e0b; }
.sc-dot.co { background: #10b981; }
.sc-dot.assist { background: #8b5cf6; }

.sc-wrap { overflow-x: auto; }
.sc-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 760px; }
.sc-wd { padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-2); background: #f8fafc; }
.sc-day { min-height: 106px; padding: 6px; background: var(--card); display: flex; flex-direction: column; gap: 4px; }
.sc-day.sc-out { background: #fafafa; }
.sc-day.today { background: #eff6ff; }
.sc-day-n { font-size: 12px; font-weight: 600; color: var(--text-2); width: 20px; height: 20px; display: grid; place-items: center; }
.sc-day.today .sc-day-n { background: #3b82f6; color: #fff; border-radius: 50%; }
.sc-evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sc-ev { font-size: 11px; line-height: 1.4; padding: 2px 5px; border-radius: 5px; border: 1px solid transparent; white-space: normal; word-break: break-word; cursor: pointer; }
.sc-ev .sc-slot { font-weight: 700; margin-right: 3px; }
.sc-visit { background: #e8f1ff; color: #1d4ed8; border-color: #cfe3fb; }
.sc-busy { background: #eef1f5; color: #475569; border-color: #e2e8f0; }
.sc-trip { background: #fff3e0; color: #b45309; border-color: #f7ddb6; }
.sc-co { background: #e7f8f0; color: #047857; border-color: #c6eedc; }
.sc-assist { background: #f3ecff; color: #6d28d9; border-color: #e0d3fb; }
.sc-ev:hover { filter: brightness(.96); }
.sc-more { border: 0; background: none; padding: 0 2px; font-size: 10.5px; color: var(--text-3); cursor: pointer; text-align: left; }

.sc-tip { position: fixed; z-index: 9999; max-width: 290px; padding: 8px 10px; border-radius: 8px; background: #111827; color: #f8fafc; font-size: 11.5px; line-height: 1.65; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }
.sc-tip-h { font-weight: 700; margin-bottom: 3px; }
.sc-tip-b { color: #cbd5e1; }

.sc-detail-row { font-size: 12.5px; line-height: 1.85; color: var(--text-2); }
.sc-detail-t { margin-bottom: 8px; }
.sc-detail-t .sc-ev { display: inline-block; font-size: 12.5px; padding: 4px 10px; }
.sc-day-list { display: flex; flex-direction: column; gap: 8px; }
.sc-day-row { display: flex; align-items: center; gap: 8px; }
.sc-day-row .sc-slot { flex: none; width: 30px; font-size: 11px; color: var(--text-3); }

@media (max-width: 768px) {
  .sc-grid { min-width: 640px; }
  .sc-day { min-height: 88px; }
  .sc-legend { width: 100%; margin-left: 0; }
}

/* ===== 工作台顶部：左「行程月历」+ 右「目标看板」===== */
.dash-top { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.dash-top-cal, .dash-top-target { min-width: 0; }
.dash-top-target .target-board { margin-bottom: 0; }
.dcal-card { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.dcal-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.1); transform: translateY(-1px); }
.dcal-go { font-size: 11.5px; color: var(--primary); white-space: nowrap; }
.dcal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 2px; }
.dcal-wd span { text-align: center; font-size: 11px; color: var(--text-3); padding-bottom: 4px; }
.dcal-d { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 34px; border-radius: 7px; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dcal-d.is-out { visibility: hidden; }
.dcal-d.is-today { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.dcal-dots { display: flex; gap: 2px; height: 5px; }
.dcal-dots b { width: 5px; height: 5px; border-radius: 50%; display: block; }
.dcal-dots b.v { background: #3b82f6; }
.dcal-dots b.b { background: #94a3b8; }
.dcal-dots b.t { background: #f59e0b; }
.dcal-dots b.a { background: #8b5cf6; }
.dcal-legend { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--text-2); }
.dcal-lg { display: inline-flex; align-items: center; gap: 5px; }
.dcal-lg i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dcal-lg i.v { background: #3b82f6; }
.dcal-lg i.b { background: #94a3b8; }
.dcal-lg i.t { background: #f59e0b; }
.dcal-lg i.a { background: #8b5cf6; }

/* 有行程的日期整格高亮：出差 < 请假 < 拜访（同日多类型时以拜访为主色） */
.dcal-d.has-t { background: rgba(245,158,11,.16); box-shadow: inset 0 0 0 1px rgba(245,158,11,.36); color: #b45309; font-weight: 700; }
.dcal-d.has-b { background: rgba(148,163,184,.2); box-shadow: inset 0 0 0 1px rgba(148,163,184,.34); color: var(--text); font-weight: 600; }
.dcal-d.has-a { background: rgba(139,92,246,.16); box-shadow: inset 0 0 0 1px rgba(139,92,246,.36); color: #6d28d9; font-weight: 700; }
.dcal-d.has-v { background: rgba(59,130,246,.15); box-shadow: inset 0 0 0 1px rgba(59,130,246,.32); color: #1d4ed8; font-weight: 700; }
.dcal-d.is-today { box-shadow: inset 0 0 0 1.5px var(--primary); }
html[data-theme="dark"] .dcal-d.has-t { background: rgba(245,158,11,.26); box-shadow: inset 0 0 0 1px rgba(251,191,36,.55); color: #fcd34d; }
html[data-theme="dark"] .dcal-d.has-b { background: rgba(148,163,184,.24); box-shadow: inset 0 0 0 1px rgba(148,163,184,.5); color: #e2e8f0; }
html[data-theme="dark"] .dcal-d.has-a { background: rgba(139,92,246,.26); box-shadow: inset 0 0 0 1px rgba(167,139,250,.55); color: #c4b5fd; }
html[data-theme="dark"] .dcal-d.has-v { background: rgba(59,130,246,.28); box-shadow: inset 0 0 0 1px rgba(96,165,250,.55); color: #93c5fd; }

@media (max-width: 900px) {
  .dash-top { grid-template-columns: 1fr; gap: 12px; }
  .dcal-d { height: 32px; }
}

/* ===== 手机版：行程月历 ===== */
.m-cal { padding: 10px 10px 8px; }
.m-cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.m-cal-nav { width: 34px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); font-size: 18px; line-height: 1; font-family: inherit; cursor: pointer; }
.m-cal-title { flex: 1 1 auto; text-align: center; font-size: 14px; font-weight: 600; color: var(--ink); }
.m-cal-today { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--primary); font-size: 12px; font-family: inherit; cursor: pointer; }
.m-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 2px; }
.m-cal-wd span { text-align: center; font-size: 11px; color: var(--text-3); padding: 2px 0 4px; }
.m-cal-d { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 13px; font-family: inherit; cursor: pointer; }
.m-cal-d.is-out { visibility: hidden; }
.m-cal-d.is-today .n { color: var(--primary); font-weight: 700; }
.m-cal-d.is-sel { background: var(--primary); }
.m-cal-d.is-sel .n { color: #fff; font-weight: 700; }
.m-cal-dots { display: flex; align-items: center; gap: 2px; height: 4px; }
.m-cal-dots b { width: 4px; height: 4px; border-radius: 50%; display: block; }
.m-cal-dots b.v { background: #3b82f6; }
.m-cal-dots b.b { background: #94a3b8; }
.m-cal-dots b.t { background: #f59e0b; }
.m-cal-dots b.g { background: #10b981; }
.m-cal-dots b.a { background: #8b5cf6; }
.m-cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--text-3); }
.m-cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.m-cal-legend i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.m-cal-legend i.v { background: #3b82f6; }
.m-cal-legend i.b { background: #94a3b8; }
.m-cal-legend i.t { background: #f59e0b; }
.m-cal-legend i.g { background: #10b981; }
.m-cal-legend i.a { background: #8b5cf6; }
.m-cal-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-family: inherit; cursor: pointer; }
.m-cal-row:active { background: var(--soft); }
.m-cal-slot { flex: none; width: 38px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--soft-2); font-size: 11px; color: var(--text-3); }
.m-cal-ev { flex: 1 1 auto; min-width: 0; font-size: 13px; line-height: 1.5; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-cal-ev.visit { color: #1d4ed8; }
.m-cal-ev.busy { color: #475569; }
.m-cal-ev.trip { color: #b45309; }
.m-cal-ev.co { color: #047857; }
.m-cal-ev.assist { color: #6d28d9; }
.m-cal-detail .m-card-kv:last-child { border-bottom: 0; }

/* ===== 手机版：工作台行程月历入口 ===== */
.m-cal-entry { display: flex; align-items: center; gap: 12px; width: 100%; margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, rgba(37,99,235,.1), rgba(16,185,129,.08)); font-family: inherit; text-align: left; cursor: pointer; }
.m-cal-entry:active { opacity: .85; }
.m-cal-entry .m-cal-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1; }
.m-cal-entry .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-cal-entry .t { font-size: 14px; font-weight: 600; color: var(--ink); }
.m-cal-entry .s { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-cal-entry .go { flex: none; font-size: 20px; color: var(--text-3); line-height: 1; }

/* ================= 暗色模式：全站反白与深色文字统一修正 ================= */
/* 站内消息 */
html[data-theme="dark"] .notif-item.unread { background: rgba(37,99,235,.18); }
html[data-theme="dark"] .notif-item:hover { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .notif-item.unread:hover { background: rgba(37,99,235,.26); }

/* 琥珀 / 警告类 */
html[data-theme="dark"] .badge.orange,
html[data-theme="dark"] .aip-chip.orange,
html[data-theme="dark"] .sp-item.locked,
html[data-theme="dark"] .sp-icon.warn,
html[data-theme="dark"] .warn-box,
html[data-theme="dark"] .license-notice.warn,
html[data-theme="dark"] .m-kpi.warn,
html[data-theme="dark"] .pill.warn,
html[data-theme="dark"] .tcard-warn,
html[data-theme="dark"] .dup-box.warn,
html[data-theme="dark"] .st.dense,
html[data-theme="dark"] .avatar-sm.amber,
html[data-theme="dark"] .aip-chip.aip-risk-medium,
html[data-theme="dark"] .ro-tag,
html[data-theme="dark"] .sc-trip,
html[data-theme="dark"] .rv-act,
html[data-theme="dark"] .rv-kw {
  background: rgba(245,158,11,.16);
  border-color: rgba(245,158,11,.36);
  color: #fcd34d;
}
html[data-theme="dark"] .rv-act .rv-card-h { background: rgba(245,158,11,.24); color: #fcd34d; }

/* 红色 / 风险类 */
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .badge.red,
html[data-theme="dark"] .aip-chip.red,
html[data-theme="dark"] .aip-chip.aip-risk-critical,
html[data-theme="dark"] .aip-chip.aip-risk-high,
html[data-theme="dark"] .dup-box.danger,
html[data-theme="dark"] .license-notice.err,
html[data-theme="dark"] .pill.risk,
html[data-theme="dark"] .st.slow,
html[data-theme="dark"] .avatar-sm.red,
html[data-theme="dark"] .rv-risk,
html[data-theme="dark"] .aip-risk-item.lvl-critical,
html[data-theme="dark"] .aip-risk-item.lvl-high {
  background: rgba(239,68,68,.15);
  border-color: rgba(239,68,68,.35);
  color: #fca5a5;
}
html[data-theme="dark"] .rv-risk .rv-card-h { background: rgba(239,68,68,.24); color: #fca5a5; }

/* 绿色 / 通过类 */
html[data-theme="dark"] .badge.green,
html[data-theme="dark"] .dup-box.ok,
html[data-theme="dark"] .aip-risk-item.lvl-low { background: rgba(16,185,129,.15); border-color: rgba(16,185,129,.35); color: #6ee7b7; }

/* 紫色 / 金色 */
html[data-theme="dark"] .badge.purple,
html[data-theme="dark"] .aip-chip.purple { background: rgba(139,92,246,.18); border-color: rgba(139,92,246,.38); color: #c4b5fd; }
html[data-theme="dark"] .badge.gold { background: rgba(234,179,8,.16); border-color: rgba(234,179,8,.36); color: #fde047; }

/* 白底内容块 */
html[data-theme="dark"] .aip-sec,
html[data-theme="dark"] .rv-sum,
html[data-theme="dark"] .rv-task,
html[data-theme="dark"] .rv-kv,
html[data-theme="dark"] .rv-lead,
html[data-theme="dark"] .rv-deep { background: var(--card); border-color: var(--line); color: var(--text); }
html[data-theme="dark"] .rv-script,
html[data-theme="dark"] .rv-meta,
html[data-theme="dark"] .aip-meter,
html[data-theme="dark"] .tag.tag-off,
html[data-theme="dark"] .sc-wd,
html[data-theme="dark"] .sc-busy { background: var(--soft-2); color: var(--text-2); border-color: var(--line); }
html[data-theme="dark"] .sc-assist { background: rgba(139,92,246,.2); color: #c4b5fd; border-color: rgba(139,92,246,.42); }
html[data-theme="dark"] .sc-day.sc-out { background: var(--bg); }
html[data-theme="dark"] .aip-risk-item { background: var(--card); border-color: var(--line); }
html[data-theme="dark"] .rv-snap { background: rgba(37,99,235,.12); border-color: rgba(37,99,235,.3); }
html[data-theme="dark"] .rvi-opt:hover { background: var(--hover); border-color: var(--primary); }

/* 深色文字兜底 */
html[data-theme="dark"] .aip-sec,
html[data-theme="dark"] .aip-sec * { color: var(--text); }
html[data-theme="dark"] .rv-sum { color: var(--text); }
html[data-theme="dark"] .rv-lead { color: var(--text); }

/* ================= 登录页：可配置背景图 ================= */
.login-left.has-login-bg { background-size: cover; background-position: center; background-repeat: no-repeat; }
.login-left.has-login-bg::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(8,15,30,.62), rgba(8,15,30,.88));
}
.login-left.has-login-bg > * { position: relative; z-index: 1; }

/* ================= 月历：有行程的日期更醒目 ================= */
.m-cal-dots { gap: 3px; height: 5px; }
.m-cal-dots b { width: 5px; height: 5px; }
.m-cal-legend { font-size: 11.5px; color: var(--text-2); }
.m-cal-legend i { width: 7px; height: 7px; }

/* 有行程的日期给出整格浅色底，一眼可见（同日多类型时以拜访优先） */
.m-cal-d:has(b.g) { background: rgba(16,185,129,.16); box-shadow: inset 0 0 0 1px rgba(16,185,129,.32); }
.m-cal-d:has(b.t) { background: rgba(245,158,11,.16); box-shadow: inset 0 0 0 1px rgba(245,158,11,.32); }
.m-cal-d:has(b.b) { background: rgba(148,163,184,.18); box-shadow: inset 0 0 0 1px rgba(148,163,184,.3); }
.m-cal-d:has(b.v) { background: rgba(59,130,246,.14); box-shadow: inset 0 0 0 1px rgba(59,130,246,.28); }
.m-cal-d:has(b) .n { font-weight: 700; }

/* 选中态优先于行程底色 */
.m-cal-d.is-sel:has(b),
.m-cal-d.is-sel { background: var(--primary); box-shadow: none; }
.m-cal-d.is-sel .n { color: #fff; }

html[data-theme="dark"] .m-cal-d:has(b.g) { background: rgba(16,185,129,.26); box-shadow: inset 0 0 0 1px rgba(52,211,153,.5); }
html[data-theme="dark"] .m-cal-d:has(b.t) { background: rgba(245,158,11,.26); box-shadow: inset 0 0 0 1px rgba(251,191,36,.5); }
html[data-theme="dark"] .m-cal-d:has(b.b) { background: rgba(148,163,184,.24); box-shadow: inset 0 0 0 1px rgba(148,163,184,.45); }
html[data-theme="dark"] .m-cal-d:has(b.v) { background: rgba(59,130,246,.26); box-shadow: inset 0 0 0 1px rgba(96,165,250,.5); }

/* ================= 拜访日期选择器 ================= */
.date-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer; }
.date-btn:hover { border-color: var(--primary); }
.date-ico { font-size: 12px; color: var(--primary); }

.dp-mask { position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.5); display: grid; place-items: center; padding: 20px; }
.dp-panel { width: 820px; max-width: 96vw; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 16px; box-shadow: 0 24px 60px rgba(15,23,42,.28); padding: 16px 18px 14px; }
.dp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dp-nav { width: 34px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); font-size: 18px; line-height: 1; font-family: inherit; cursor: pointer; }
.dp-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.dp-today { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--primary); font-size: 12px; font-family: inherit; cursor: pointer; }
.dp-gap { flex: 1 1 auto; }
.dp-legend { display: flex; gap: 10px; font-size: 11px; color: var(--text-2); }
.dp-legend span { display: inline-flex; align-items: center; gap: 4px; }
.dp-legend i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dp-legend i.v { background: #3b82f6; }
.dp-legend i.b { background: #94a3b8; }
.dp-legend i.t { background: #f59e0b; }
.dp-legend i.a { background: #8b5cf6; }
.dp-x { width: 28px; height: 28px; border-radius: 50%; border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 15px; }
.dp-x:hover { background: var(--soft-2); color: var(--text); }
.dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 6px; }
.dp-wd span { text-align: center; font-size: 11px; color: var(--text-3); padding-bottom: 2px; }
.dp-d { position: relative; min-height: 80px; padding: 6px 6px 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text-2); font-family: inherit; text-align: left; display: flex; flex-direction: column; gap: 4px; cursor: pointer; overflow: hidden; }
.dp-d:hover { border-color: var(--primary); background: var(--soft); }
.dp-d.is-out { visibility: hidden; }
.dp-d.is-today .dp-n { color: var(--primary); font-weight: 800; }
.dp-d.is-sel { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.22); }
.dp-n { font-size: 13px; font-weight: 600; }
.dp-evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dp-ev { font-style: normal; font-size: 10.5px; line-height: 1.3; padding: 2px 5px; border-radius: 5px; white-space: normal; word-break: break-word; }
.dp-ev.visit { background: #e8f1ff; color: #1d4ed8; }
.dp-ev.busy { background: #eef1f5; color: #475569; }
.dp-ev.trip { background: #fff3e0; color: #b45309; }
.dp-ev.assist { background: #f3ecff; color: #6d28d9; }
.dp-more { font-style: normal; font-size: 10px; color: var(--text-3); }
.dp-foot { margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.dp-tip { position: fixed; z-index: 300; max-width: 290px; padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(15,23,42,.18); font-size: 12px; color: var(--text); pointer-events: none; }
.dp-tip-item + .dp-tip-item { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.dp-tip-h { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.dp-tip-h i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dp-tip-h i.visit { background: #3b82f6; }
.dp-tip-h i.busy { background: #94a3b8; }
.dp-tip-h i.trip { background: #f59e0b; }
.dp-tip-h i.assist { background: #8b5cf6; }
.dp-tip-b { color: var(--text-2); line-height: 1.7; margin-top: 3px; }
html[data-theme="dark"] .dp-ev.visit { background: rgba(59,130,246,.24); color: #93c5fd; }
html[data-theme="dark"] .dp-ev.busy { background: rgba(148,163,184,.2); color: #cbd5e1; }
html[data-theme="dark"] .dp-ev.trip { background: rgba(245,158,11,.22); color: #fcd34d; }
html[data-theme="dark"] .dp-ev.assist { background: rgba(139,92,246,.24); color: #c4b5fd; }

/* ================= 项目管理 ================= */
.pj-seg { margin: 0 0 14px; }
.pj-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.pj-search { flex: 1 1 auto; max-width: 320px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); font-size: 13px; font-family: inherit; }
.pj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.pj-item { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; transition: .15s; }
.pj-item:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(37,99,235,.1); transform: translateY(-1px); }
.pj-item-top { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.pj-item-name { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.pj-item-sub { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.pj-item-bar { position: relative; height: 6px; margin: 10px 0 6px; border-radius: 999px; background: var(--soft-2); overflow: hidden; }
.pj-item-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #6366f1); }
.pj-item-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-3); }
.pj-empty { padding: 22px 10px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.pj-empty.big { padding: 60px 20px; border: 1px dashed var(--line); border-radius: 12px; }

.pj-gantt { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.pj-head { display: flex; background: var(--soft); border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--text-2); }
.pj-row { display: flex; border-bottom: 1px solid var(--line); min-height: 38px; }
.pj-row:last-child { border-bottom: 0; }
.pj-lab { width: 190px; flex: 0 0 190px; padding: 9px 10px; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid var(--line); }
.pj-head .pj-lab { font-weight: 600; color: var(--text-2); }
.pj-sub { display: block; font-size: 10.5px; color: var(--text-3); }
.pj-track { position: relative; flex: 1 1 auto; min-width: 0; }
.pj-months { height: 30px; }
.pj-months span { position: absolute; top: 0; bottom: 0; padding: 6px 8px; font-size: 10.5px; color: var(--text-3); border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.pj-bar { position: absolute; top: 50%; transform: translateY(-50%); height: 18px; border-radius: 5px; background: #93c5fd; overflow: hidden; display: flex; align-items: center; }
.pj-bar .pj-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #2563eb; opacity: .85; }
.pj-bar.green { background: #86efac; } .pj-bar.green .pj-fill { background: #16a34a; }
.pj-bar.red { background: #fca5a5; } .pj-bar.red .pj-fill { background: #dc2626; }
.pj-bar.orange { background: #fcd34d; } .pj-bar.orange .pj-fill { background: #d97706; }
.pj-bar.gray { background: #cbd5e1; } .pj-bar.gray .pj-fill { background: #64748b; }
.pj-pct { position: relative; z-index: 1; margin-left: auto; padding: 0 5px; font-size: 9.5px; color: #0f172a; font-weight: 700; }
.pj-today { position: absolute; top: 0; bottom: 0; width: 1px; background: #ef4444; opacity: .8; }
.pj-head .pj-today { display: none; }

.pj-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pj-kpi { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pj-kpi .k { font-size: 11.5px; color: var(--text-2); }
.pj-kpi .v { margin-top: 4px; font-size: 22px; font-weight: 800; color: var(--ink); }
.pj-kpi .v.blue { color: #2563eb; } .pj-kpi .v.red { color: #dc2626; } .pj-kpi .v.green { color: #16a34a; }
.pj-card { margin-top: 14px; }
.pj-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pj-detail-title { font-size: 17px; font-weight: 800; color: var(--ink); }
.pj-detail-actions { margin-left: auto; display: flex; gap: 8px; }
.pj-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: 12.5px; color: var(--text-2); }
.pj-meta b { color: var(--ink); }
.pj-meta a { color: var(--primary); text-decoration: none; }
.pj-desc { margin-top: 10px; padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--soft); border-radius: 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.pj-ph { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.pj-ph:last-child { border-bottom: 0; }
.pj-ph-main { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.pj-ph-main b { color: var(--ink); }
.pj-ph-date, .pj-ph-own, .pj-ph-remark { font-size: 11.5px; color: var(--text-3); }
.pj-ph-right { display: flex; align-items: center; gap: 8px; }
.pj-ph-bar { width: 110px; height: 6px; border-radius: 999px; background: var(--soft-2); overflow: hidden; }
.pj-ph-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); }
.pj-ph-pct { width: 36px; font-size: 11.5px; color: var(--text-2); text-align: right; }

html[data-theme="dark"] .pj-bar { background: rgba(59,130,246,.35); }
html[data-theme="dark"] .pj-bar.green { background: rgba(34,197,94,.32); }
html[data-theme="dark"] .pj-bar.red { background: rgba(239,68,68,.32); }
html[data-theme="dark"] .pj-bar.orange { background: rgba(245,158,11,.32); }
html[data-theme="dark"] .pj-bar.gray { background: rgba(148,163,184,.3); }
html[data-theme="dark"] .pj-pct { color: #e2e8f0; }

@media (max-width: 980px) {
  .pj-list { grid-template-columns: 1fr; }
  .pj-lab { width: 140px; flex-basis: 140px; }
}
@media (max-width: 560px) {
  .pj-toolbar { flex-wrap: wrap; }
  .pj-search { max-width: none; width: 100%; }
  .pj-lab { width: 110px; flex-basis: 110px; font-size: 11px; }
  .pj-ph-right { width: 100%; justify-content: flex-end; }
}

/* ================= 项目管理 v2（WBS / 基线 / 风险 / 健康度） ================= */
.pj2-toolbar { flex-wrap: wrap; align-items: center; gap: 8px; }
.pj2-toolbar .pj-search { flex: 1 1 200px; width: auto; min-width: 170px; max-width: 320px; }
.pj2-toolbar select { flex: 0 0 auto; width: auto; max-width: 150px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); font-size: 12.5px; font-family: inherit; }
.pj2-toolbar .seg, .pj2-toolbar .btn { flex: 0 0 auto; }
.pj2-toolbar .pj2-mode { margin-left: auto; }
.pj2-mode button, .pj2-zoom button { min-width: 46px; }
.pj2-empty { padding: 22px 10px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.pj2-empty.big { padding: 56px 20px; border: 1px dashed var(--line); border-radius: 12px; }

/* 健康度 */
.pj2-hchip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--soft-2); color: var(--text-2); white-space: nowrap; }
.pj2-hchip i { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.pj2-hchip.green { background: rgba(22,163,74,.12); color: #15803d; }
.pj2-hchip.green i { background: #16a34a; }
.pj2-hchip.amber { background: rgba(217,119,6,.14); color: #b45309; }
.pj2-hchip.amber i { background: #d97706; }
.pj2-hchip.red { background: rgba(220,38,38,.12); color: #b91c1c; }
.pj2-hchip.red i { background: #dc2626; }

/* 列表卡片 */
.pj2-code { margin-top: 2px; font-size: 11px; color: var(--text-3); letter-spacing: .2px; }
.pj2-cardline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.pj2-vs { font-size: 11px; color: var(--text-3); }
.pj2-vs.down { color: #b91c1c; }
.pj2-vs.up { color: #15803d; }
.pj2-card-tag { padding: 1px 7px; border-radius: 6px; background: var(--soft-2); font-size: 11px; color: var(--text-2); }
.pj2-card-tag.danger { background: rgba(220,38,38,.1); color: #b91c1c; }
.pj2-cardfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--text-3); }

/* 表格 */
.pj2-table { width: 100%; }
.pj2-table tbody tr { cursor: pointer; }
.pj2-table tbody tr:hover { background: var(--soft); }
.pj2-code-cell { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--text-2); }
.pj2-tname { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.pj2-tsub { margin-top: 2px; font-size: 11px; color: var(--text-3); }
.pj2-tprog { display: flex; align-items: center; gap: 6px; }
.pj2-tprog span { position: relative; width: 76px; height: 6px; border-radius: 999px; background: var(--soft-2); overflow: hidden; }
.pj2-tprog span i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg,#3b82f6,#6366f1); }
.pj2-tprog b { font-size: 11px; color: var(--text-2); }
.pj2-td-red { color: #dc2626; font-weight: 600; }
.pj2-ops { white-space: nowrap; }
.pj2-depcell, .pj2-respcell { max-width: 190px; font-size: 11.5px; color: var(--text-2); }
.pj2-mstag { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: rgba(99,102,241,.12); color: #4f46e5; font-size: 10px; font-weight: 600; }
.pj2-mini th, .pj2-mini td { font-size: 12px; padding: 8px 10px; }
.pj2-toolbar2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }

/* 总控 */
.pj2-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.pj2-hrow { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.pj2-hname { width: 78px; flex: 0 0 78px; }
.pj2-hbar { position: relative; flex: 1 1 auto; height: 8px; border-radius: 999px; background: var(--soft-2); overflow: hidden; }
.pj2-hbar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }
.pj2-hbar i.green { background: #16a34a; }
.pj2-hbar i.amber { background: #d97706; }
.pj2-hbar i.red { background: #dc2626; }
.pj2-hrow b { width: 26px; text-align: right; font-size: 12.5px; color: var(--ink); }
.pj2-hrow em { width: 40px; font-style: normal; text-align: right; font-size: 11px; color: var(--text-3); }
.pj2-health-note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--text-3); line-height: 1.7; }

/* 详情 */
.pj2-dhead-main { min-width: 0; }
.pj2-dtitle { font-size: 17px; font-weight: 800; color: var(--ink); line-height: 1.35; }
.pj2-dsub { margin-top: 3px; font-size: 11.5px; color: var(--text-3); }
.pj2-dmeta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: 12px; color: var(--text-2); }
.pj2-dmeta b { color: var(--ink); }
.pj2-dmeta b.red { color: #dc2626; } .pj2-dmeta b.green { color: #16a34a; }
.pj2-tabs { display: flex; gap: 6px; margin: 12px 0 2px; padding: 5px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.pj2-tabs::-webkit-scrollbar { display: none; }
.pj2-tabs button { padding: 7px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text-2); font-size: 12.5px; font-family: inherit; cursor: pointer; white-space: nowrap; transition: color .15s, background .15s, border-color .15s, box-shadow .15s; }
.pj2-tabs button:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.pj2-tabs button.active { color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgba(37,99,235,.22); }
.pj2-tabs button.active::after { content: none; }
.pj2-tabs button em { margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--soft-2); font-style: normal; font-size: 10.5px; color: var(--text-2); }
.pj2-tabs button.active em { background: rgba(255,255,255,.24); color: #fff; }
.pj2-kpis6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.pj2-info { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px 18px; }
.pj2-info > div { min-width: 0; }
.pj2-info > div.full { grid-column: 1 / -1; }
.pj2-info span { display: block; font-size: 11px; color: var(--text-3); }
.pj2-info b { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.6; word-break: break-word; }
.pj2-info a { color: var(--primary); text-decoration: none; }
.pj2-chip { display: inline-block; margin: 0 6px 4px 0; padding: 1px 8px; border-radius: 999px; background: var(--soft-2); font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.pj2-chip.sm { font-size: 10.5px; }
.pj2-baseline { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px 18px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid #6366f1; border-radius: 10px; background: var(--card); }
.pj2-baseline span { display: block; font-size: 11px; color: var(--text-3); }
.pj2-baseline b { display: block; margin-top: 3px; font-size: 12.5px; color: var(--ink); }
.pj2-baseline b.red { color: #dc2626; } .pj2-baseline b.green { color: #16a34a; }
.pj2-subhead { margin-top: 4px; border-top: 1px dashed var(--line); }
.pj2-msrow { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px dashed var(--line); font-size: 12px; }
.pj2-msrow:last-child { border-bottom: 0; }
.pj2-msrow i { width: 9px; height: 9px; flex: 0 0 9px; transform: rotate(45deg); background: #cbd5e1; }
.pj2-msrow i.done { background: #16a34a; }
.pj2-msrow b { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.pj2-msrow span { font-size: 11px; color: var(--text-3); }
.pj2-msrow em { font-style: normal; font-size: 11px; }
.pj2-msrow em.green { color: #16a34a; } .pj2-msrow em.red { color: #dc2626; }

/* 计划甘特 */
.pj2-planbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px; }
.pj2-planbar-right { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.pj2-legend { display: inline-flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-3); }
.pj2-legend i { display: inline-block; margin-right: 4px; vertical-align: middle; }
.pj2-legend i.bar { width: 18px; height: 7px; border-radius: 3px; background: #3b82f6; }
.pj2-legend i.base { width: 18px; height: 4px; border-radius: 2px; background: #94a3b8; }
.pj2-legend i.ms { width: 8px; height: 8px; transform: rotate(45deg); background: #6366f1; }
.pj2-legend i.dep { width: 18px; height: 0; border-top: 1.5px dashed #94a3b8; }
.pj2-blbar { margin-bottom: 8px; padding: 7px 12px; border-left: 3px solid #6366f1; background: var(--soft); border-radius: 8px; font-size: 11.5px; color: var(--text-2); }
.pj2-gantt { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.pj2-ghead { display: flex; background: var(--soft); border-bottom: 1px solid var(--line); }
.pj2-glab { width: 220px; flex: 0 0 220px; display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 11.5px; color: var(--text-2); border-right: 1px solid var(--line); overflow: hidden; }
.pj2-ghead .pj2-glab { height: 32px; font-weight: 600; }
.pj2-gtrack { position: relative; flex: 1 1 auto; min-width: 0; }
.pj2-gticks { height: 32px; }
.pj2-gticks span { position: absolute; top: 0; bottom: 0; padding: 8px 8px; font-size: 10.5px; color: var(--text-3); border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.pj2-gbody { position: relative; }
.pj2-grow { display: flex; height: 36px; border-bottom: 1px solid var(--line); }
.pj2-grow:last-child { border-bottom: 0; }
.pj2-grow.phase { background: var(--soft); }
.pj2-grow.task { cursor: pointer; }
.pj2-grow.task:hover { background: var(--soft); }
.pj2-grow .pj2-glab { height: 100%; }
.pj2-grow.phase .pj2-glab b { font-size: 12px; font-weight: 700; color: var(--ink); }
.pj2-grow.phase .pj2-glab em { font-style: normal; font-size: 10.5px; color: var(--text-3); }
.pj2-indent { width: 12px; flex: 0 0 12px; border-left: 1px solid var(--line); height: 100%; margin-right: 4px; }
.pj2-gname { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj2-gown { flex: 0 0 auto; max-width: 62px; font-size: 10.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj2-bar { position: absolute; top: 50%; transform: translateY(-50%); height: 16px; border-radius: 5px; background: #93c5fd; overflow: hidden; display: flex; align-items: center; }
.pj2-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #2563eb; opacity: .85; }
.pj2-bar.green { background: #86efac; } .pj2-bar.green i { background: #16a34a; }
.pj2-bar.red { background: #fca5a5; } .pj2-bar.red i { background: #dc2626; }
.pj2-bar.orange { background: #fcd34d; } .pj2-bar.orange i { background: #d97706; }
.pj2-bar.gray { background: #cbd5e1; } .pj2-bar.gray i { background: #64748b; }
.pj2-bar b { position: relative; z-index: 1; margin-left: auto; padding: 0 5px; font-size: 9.5px; font-weight: 700; color: #0f172a; }
.pj2-bbar { position: absolute; bottom: 3px; height: 3px; border-radius: 2px; background: #94a3b8; opacity: .75; }
.pj2-msmark { position: absolute; top: 50%; width: 11px; height: 11px; margin-left: -5px; transform: translateY(-50%) rotate(45deg); background: #6366f1; border-radius: 2px; box-shadow: 0 0 0 2px var(--card); }
.pj2-msmark.done { background: #16a34a; }
.pj2-msmark.late { background: #dc2626; }
.pj2-today { position: absolute; top: 0; bottom: 0; width: 1px; background: #ef4444; opacity: .75; pointer-events: none; }
.pj2-links { position: absolute; left: 220px; right: 0; top: 0; bottom: 0; width: calc(100% - 220px); height: 100%; pointer-events: none; overflow: visible; }
.pj2-links path { fill: none; stroke: #94a3b8; stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .9; }
html[data-theme="dark"] .pj2-links path { stroke: #64748b; }

/* 里程碑卡片 / 活动 */
.pj2-msgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.pj2-mscard { padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid #6366f1; border-radius: 10px; background: var(--card); }
.pj2-mscard.done { border-left-color: #16a34a; }
.pj2-mscard.late { border-left-color: #dc2626; }
.pj2-mscard-top { display: flex; align-items: center; gap: 8px; }
.pj2-mscard-top i { width: 9px; height: 9px; flex: 0 0 9px; transform: rotate(45deg); background: #6366f1; }
.pj2-mscard.done .pj2-mscard-top i { background: #16a34a; }
.pj2-mscard.late .pj2-mscard-top i { background: #dc2626; }
.pj2-mscard-top b { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj2-mscard-sub { margin: 6px 0 8px; font-size: 11.5px; color: var(--text-3); }
.pj2-mscard-ops { display: flex; gap: 6px; justify-content: flex-end; }
.pj2-timeline { position: relative; padding-left: 16px; }
.pj2-timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.pj2-act { position: relative; padding: 6px 0 10px; }
.pj2-act > i { position: absolute; left: -15px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.pj2-act b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.pj2-act span { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }

/* 成员编辑 */
.pj2-members { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.pj2-members table { width: 100%; border-collapse: collapse; }
.pj2-members th, .pj2-members td { padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12px; text-align: left; }
.pj2-members th { position: sticky; top: 0; background: var(--soft); font-weight: 600; color: var(--text-2); }
.pj2-members select, .pj2-members input { height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--text); font-size: 12px; font-family: inherit; }
.pj2-members input { width: 78px; }
.pj2-chk { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text); cursor: pointer; }

/* 手机端 */
.pj2-mkpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.pj2-mkpis > div { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-align: center; }
.pj2-mkpis span { display: block; font-size: 11px; color: var(--text-3); }
.pj2-mkpis b { display: block; margin-top: 3px; font-size: 17px; color: var(--ink); }
.pj2-mkpis b.green { color: #16a34a; } .pj2-mkpis b.red { color: #dc2626; }
.pj2-hreason { margin: 8px 0; padding: 8px 12px; border-left: 3px solid #d97706; border-radius: 8px; background: var(--soft); font-size: 11.5px; color: var(--text-2); line-height: 1.6; }
.pj2-mtask { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.pj2-mtask:last-child { border-bottom: 0; }
.pj2-mtask-top { display: flex; align-items: center; gap: 8px; }
.pj2-mtask-top b { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--ink); }
.pj2-mtask-sub { margin: 3px 0 6px; font-size: 11px; color: var(--text-3); }

@media (max-width: 980px) {
  .pj2-grid2 { grid-template-columns: 1fr; }
  .pj2-kpis6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .pj2-info { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pj2-baseline { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pj2-glab { width: 160px; flex-basis: 160px; }
  .pj2-links { left: 160px; width: calc(100% - 160px); }
}
@media (max-width: 560px) {
  .pj2-kpis6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pj2-info { grid-template-columns: 1fr; }
  .pj2-baseline { grid-template-columns: 1fr; }
  .pj2-glab { width: 118px; flex-basis: 118px; font-size: 11px; }
  .pj2-links { left: 118px; width: calc(100% - 118px); }
  .pj2-gname { font-size: 11px; }
  .pj2-gown { display: none; }
  .pj2-legend { display: none; }
  .pj2-tabs { padding: 4px; gap: 5px; }
  .pj2-tabs button { padding: 6px 10px; font-size: 12px; }
  .pj2-toolbar .pj-search { flex: 1 1 100%; max-width: none; }
  .pj2-toolbar select { flex: 1 1 calc(50% - 4px); max-width: none; }
  .pj2-toolbar .pj2-mode { margin-left: 0; }
  .pj2-toolbar .btn-primary { flex: 1 1 auto; }
  .pj2-planbar-right { width: 100%; justify-content: flex-end; }
  .pj2-msgrid { grid-template-columns: 1fr; }
  .pj2-depcell, .pj2-respcell { max-width: 120px; }
}
html[data-theme="dark"] .pj2-bar { background: rgba(59,130,246,.35); }
html[data-theme="dark"] .pj2-bar.green { background: rgba(34,197,94,.32); }
html[data-theme="dark"] .pj2-bar.red { background: rgba(239,68,68,.32); }
html[data-theme="dark"] .pj2-bar.orange { background: rgba(245,158,11,.32); }
html[data-theme="dark"] .pj2-bar.gray { background: rgba(148,163,184,.3); }
html[data-theme="dark"] .pj2-bar b { color: #e2e8f0; }
html[data-theme="dark"] .pj2-hchip.green { background: rgba(34,197,94,.16); color: #86efac; }
html[data-theme="dark"] .pj2-hchip.amber { background: rgba(245,158,11,.18); color: #fcd34d; }
html[data-theme="dark"] .pj2-hchip.red { background: rgba(239,68,68,.16); color: #fca5a5; }
html[data-theme="dark"] .pj2-msmark { box-shadow: 0 0 0 2px var(--card); }

/* ================= 客户档案 · 项目摘要卡 ================= */
.cust-pj-list { display: flex; flex-direction: column; gap: 12px; }
.cust-pj { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; transition: .15s; }
.cust-pj:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(37,99,235,.1); transform: translateY(-1px); }
.cust-pj-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.cust-pj-name { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.cust-pj-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cust-pj-tag { padding: 1px 8px; border-radius: 999px; background: var(--soft-2); font-size: 11px; color: var(--text-2); }
.cust-pj-prog { margin-top: 10px; }
.cust-pj-prog-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.cust-pj-prog-top span { font-size: 11.5px; color: var(--text-2); }
.cust-pj-prog-top b { font-size: 15px; color: var(--ink); }
.cust-pj-prog-top em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--text-3); }
.cust-pj-prog-top em.down { color: #b91c1c; }
.cust-pj-prog-top em.up { color: #15803d; }
.cust-pj-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--soft-2); }
.cust-pj-bar span { display: block; height: 100%; }
.cust-pj-bar .done { background: linear-gradient(90deg, #22c55e, #16a34a); }
.cust-pj-bar .doing { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.cust-pj-bar .todo { background: #e2e8f0; }
.cust-pj-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--text-3); }
.cust-pj-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.cust-pj-legend i.done { background: #16a34a; }
.cust-pj-legend i.doing { background: #2563eb; }
.cust-pj-legend i.todo { background: #cbd5e1; }
html[data-theme="dark"] .cust-pj-bar .todo { background: rgba(148,163,184,.3); }
html[data-theme="dark"] .cust-pj-legend i.todo { background: rgba(148,163,184,.55); }

/* 阶段流程条：一个阶段一段箭头，段下标注阶段名 */
.cust-pj-flow { display: flex; align-items: flex-start; gap: 4px; margin-top: 10px; padding-bottom: 2px; overflow-x: auto; }
.cust-pj-node { flex: 1 0 88px; min-width: 88px; }
.cust-pj-seg {
  height: 28px; display: flex; align-items: center; justify-content: center;
  padding: 0 12px 0 18px; font-size: 11px; font-weight: 600;
  background: #e2e8f0; color: #64748b;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.cust-pj-node:first-child .cust-pj-seg {
  padding-left: 12px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}
.cust-pj-node.done .cust-pj-seg { background: linear-gradient(90deg, #22c55e, #16a34a); color: #fff; }
.cust-pj-node.doing .cust-pj-seg { background: linear-gradient(90deg, #60a5fa, #2563eb); color: #fff; position: relative; }
.cust-pj-node.todo .cust-pj-seg { background: #e2e8f0; color: #64748b; }
.cust-pj-cap {
  margin-top: 6px; padding: 0 2px; font-size: 11px; line-height: 1.3; color: var(--text-2);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html[data-theme="dark"] .cust-pj-node.todo .cust-pj-seg { background: rgba(148,163,184,.3); color: #cbd5e1; }
html[data-theme="dark"] .cust-pj-cap { color: var(--text-2); }
.cust-pj-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin-top: 12px; }
.cust-pj-i { min-width: 0; }
.cust-pj-i span { display: block; font-size: 11px; color: var(--text-3); }
.cust-pj-i b { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-pj-i b.red { color: #dc2626; }
.cust-pj-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--text-3); }
.cust-pj-go { color: var(--primary); font-weight: 600; white-space: nowrap; }
@media (max-width: 760px) {
  .cust-pj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cust-pj-head { flex-direction: column; }
  .cust-pj-tags { justify-content: flex-start; }
}
@media (max-width: 420px) {
  .cust-pj-grid { grid-template-columns: 1fr; }
  .cust-pj-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ================= 项目模板（系统管理） ================= */
.tpl-phases { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.tpl-phase { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--soft); }
.tpl-phase-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.tpl-phase-head input[data-ph-name] { flex: 1 1 200px; width: auto; min-width: 150px; height: 34px; }
.tpl-range { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.tpl-range input { width: 62px; height: 32px; padding: 0 6px; text-align: center; }
.tpl-phase textarea { width: 100%; min-height: 52px; font-size: 12.5px; }
.tpl-phase-head .btn { flex: 0 0 auto; }
.tpl-preview { display: flex; flex-direction: column; gap: 10px; }
.tpl-pv-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tpl-pv-row b { flex: 0 0 150px; font-size: 12.5px; color: var(--ink); }
.tpl-pv-flow { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tpl-pv-chip { padding: 4px 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; }
.tpl-pv-chip em { margin-left: 6px; font-style: normal; font-size: 10.5px; opacity: .8; }
.tpl-pv-flow i { font-style: normal; color: var(--text-3); }
@media (max-width: 760px) {
  .tpl-pv-row b { flex: 0 0 100%; }
  .tpl-range { width: 100%; }
  .tpl-range input { width: 56px; }
}

/* ================= 项目阶段执行（当前阶段 / 实际投入） ================= */
.pj2-abar { position: absolute; bottom: 2px; height: 4px; border-radius: 2px; background: #f59e0b; min-width: 2px; z-index: 3; }
.pj2-legend i.actual { background: #f59e0b; }
.pj2-curphase { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); font-size: 12px; font-family: inherit; width: auto; max-width: 160px; }
.pj-ph.current { background: var(--primary-soft); border-radius: 8px; }
.pj2-curdot { margin-left: 8px; padding: 1px 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 10px; font-weight: 600; }
.pj2-chip.ok { background: #ecfdf5; color: #15803d; }
.pj2-chip.danger { background: #fef2f2; color: #b91c1c; }
html[data-theme="dark"] .pj2-chip.ok { background: rgba(34,197,94,.16); color: #86efac; }
html[data-theme="dark"] .pj2-chip.danger { background: rgba(239,68,68,.16); color: #fca5a5; }
@media (max-width: 560px) {
  .pj2-curphase { max-width: 110px; }
  .pj-ph.current { padding: 6px; }
}

/* ================= 一级/二级导航 + 侧边栏收起 ================= */
.nav-group { margin-bottom: 2px; }
.nav-group-btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; background: transparent; border: 0; border-radius: 8px;
  color: var(--sb-text, #cbd5e1); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.nav-group-btn:hover { background: rgba(255,255,255,.08); color: var(--sb-text-h, #fff); }
.nav-group-btn .ico { width: 15px; height: 15px; flex: 0 0 auto; opacity: .85; }
.nav-group-btn .ng-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-btn .ng-arrow { width: 13px; height: 13px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .55; transition: transform .18s; }
.nav-group.open .ng-arrow { transform: rotate(90deg); }
.nav-sub { display: none; padding: 2px 0 4px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub .nav-item {
  padding-left: 34px; margin-left: 6px; border-left: 1px solid rgba(255,255,255,.09);
  border-radius: 0 8px 8px 0;
}
.nav-sub .nav-item .ico { width: 14px; height: 14px; opacity: .8; }

.sb-toggle {
  margin-top: 8px; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06);
  color: var(--sb-text, #cbd5e1); display: grid; place-items: center; cursor: pointer; align-self: flex-start;
}
.sb-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }

@media (min-width: 981px) {
  html:not(.device-mobile) .app.sb-collapsed { grid-template-columns: 64px 1fr; }
}
.app.sb-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app.sb-collapsed .brand-text,
.app.sb-collapsed .nav-group-btn .ng-label,
.app.sb-collapsed .nav-group-btn .ng-arrow,
.app.sb-collapsed .nav-item span,
.app.sb-collapsed .nav-badge,
.app.sb-collapsed .storage-tip,
.app.sb-collapsed #btnResetDemo { display: none; }
.app.sb-collapsed .nav-group-btn { justify-content: center; padding: 10px 0; }
.app.sb-collapsed .nav-sub { display: none !important; }
.app.sb-collapsed .sidebar-foot { align-items: center; padding-left: 0; padding-right: 0; }
.app.sb-collapsed .sb-toggle { align-self: center; transform: rotate(180deg); }
.app.sb-collapsed .nav-group.open .nav-group-btn { background: rgba(255,255,255,.06); }
html.device-mobile .sb-toggle { display: none; }
@media (max-width: 980px) { .sb-toggle { display: none; } }

/* ==================== 营销看板 ==================== */
.mkt-dashboard { margin-top: 12px; }
.mkt-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.mkt-kpi-card { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.mkt-kpi-name { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.mkt-kpi-val { font-size: 24px; font-weight: 700; line-height: 1.2; }
.mkt-kpi-unit { font-size: 12px; font-weight: 400; color: var(--text-2); margin-left: 4px; }
.mkt-kpi-target { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.mkt-kpi-bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.mkt-kpi-bar i { display: block; height: 100%; border-radius: 2px; transition: width .4s; }
.mkt-kpi-bar i.green { background: var(--green, #22c55e); }
.mkt-kpi-bar i.blue { background: var(--primary); }
.mkt-kpi-bar i.orange { background: var(--orange, #f59e0b); }
.mkt-kpi-bar i.red { background: var(--red, #ef4444); }
.mkt-kpi-rate { font-size: 12px; font-weight: 600; margin-top: 4px; text-align: right; }
.mkt-kpi-rate.green { color: var(--green, #22c55e); }
.mkt-kpi-rate.blue { color: var(--primary); }
.mkt-kpi-rate.orange { color: var(--orange, #f59e0b); }
.mkt-kpi-rate.red { color: var(--red, #ef4444); }
.mkt-kpi-val.green { color: var(--green, #22c55e); }
.mkt-kpi-val.blue { color: var(--primary); }
.mkt-kpi-val.orange { color: var(--orange, #f59e0b); }
.mkt-kpi-val.red { color: var(--red, #ef4444); }

/* 预算执行 */
.mkt-budget-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.mkt-budget-item { display: flex; flex-direction: column; gap: 2px; }
.mkt-budget-item span { font-size: 11px; color: var(--text-3); }
.mkt-budget-item b { font-size: 16px; }
.mkt-budget-item b.green { color: var(--green, #22c55e); }
.mkt-budget-item b.orange { color: var(--orange, #f59e0b); }
.mkt-budget-item b.red { color: var(--red, #ef4444); }
.mkt-budget-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.mkt-budget-bar i { display: block; height: 100%; border-radius: 3px; transition: width .4s; }
.mkt-budget-bar i.green { background: var(--green, #22c55e); }
.mkt-budget-bar i.orange { background: var(--orange, #f59e0b); }
.mkt-budget-bar i.red { background: var(--red, #ef4444); }

/* ROI */
.mkt-roi-row { display: flex; gap: 16px; flex-wrap: wrap; }
.mkt-roi-item { display: flex; flex-direction: column; gap: 2px; }
.mkt-roi-item span { font-size: 11px; color: var(--text-3); }
.mkt-roi-item b { font-size: 16px; }
.mkt-roi-item b.green { color: var(--green, #22c55e); }
.mkt-roi-item b.blue { color: var(--primary); }
.mkt-roi-item b.red { color: var(--red, #ef4444); }

/* AI 顾问 */
.mkt-ai-card { border-color: var(--primary); }
.mkt-ai-section { margin-bottom: 12px; }
.mkt-ai-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.mkt-ai-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 13px; line-height: 1.5; }
.mkt-ai-num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; flex-shrink: 0; margin-top: 1px; }
.mkt-ai-item.danger { color: var(--red, #ef4444); }
.mkt-ai-llm-text { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.8; margin-bottom: 12px; }

/* 营销表单字段 */
.mkt-fields { background: var(--primary-soft, #f0f4ff); border: 1px solid var(--primary); border-radius: 10px; padding: 14px; }
.mkt-fields-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.mkt-kpi-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.mkt-kpi-row input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; font-family: inherit; }
.mkt-kpi-row input:last-of-type { flex: 0 0 60px; }

/* 移动端营销摘要 */
.mkt-m-obj { font-size: 13px; font-weight: 500; margin-bottom: 6px; line-height: 1.5; }
.mkt-m-info { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.mkt-m-kpis { margin-bottom: 10px; }
.mkt-m-kpi { margin-bottom: 8px; }
.mkt-m-kpi-name { font-size: 12px; color: var(--text-2); }
.mkt-m-kpi-val { font-size: 14px; font-weight: 600; margin-left: 8px; }
.mkt-m-kpi-val.green { color: var(--green, #22c55e); }
.mkt-m-kpi-val.blue { color: var(--primary); }
.mkt-m-kpi-val.orange { color: var(--orange, #f59e0b); }
.mkt-m-kpi-val.red { color: var(--red, #ef4444); }
.mkt-m-kpi-rate { font-size: 12px; font-weight: 600; margin-left: 8px; }
.mkt-m-kpi-rate.green { color: var(--green, #22c55e); }
.mkt-m-kpi-rate.blue { color: var(--primary); }
.mkt-m-kpi-rate.orange { color: var(--orange, #f59e0b); }
.mkt-m-kpi-rate.red { color: var(--red, #ef4444); }
.mkt-m-budget { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.mkt-m-roi { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.mkt-m-roi b.green { color: var(--green, #22c55e); }
.mkt-m-roi b.red { color: var(--red, #ef4444); }
.mkt-m-advice { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.mkt-m-advice-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.mkt-m-advice-item { font-size: 12px; line-height: 1.6; color: var(--text-2); }
