/* 沿用原管理系统的紫色侧栏、卡片、表格和登录页视觉规范。 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --primary: #4f46e5; --primary-2: #6366f1; --primary-dark: #4338ca; --bg: #f1f5f9; --card: #fff; --text: #0f172a; --muted: #64748b; --border: #e2e8f0; --red: #dc2626; --green: #059669; --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04); --shadow-lg: 0 10px 30px rgba(15,23,42,.12); }
body { font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button { cursor: pointer; font-family: inherit; border: 0; border-radius: 9px; padding: 8px 15px; font-size: 13px; background: #eef2fb; color: var(--text); }
button:hover { background: #e2e9f9; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 10px; outline: none; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
textarea { min-height: 42px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e1b4b, #312e81 45%, #4f46e5); }
.login-card { width: 460px; max-width: calc(100vw - 36px); max-height: calc(100vh - 24px); overflow-y: auto; background: var(--card); border-radius: 20px; padding: 32px 30px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; }.logo-icon { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; }
.login-logo .logo-icon { width: 62px; height: 62px; border-radius: 18px; font-size: 28px; box-shadow: 0 8px 20px rgba(79,70,229,.35); }.login-card h1 { margin: 14px 0 4px; text-align: center; font-size: 21px; }.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }.login-card form { display: grid; gap: 14px; }
.btn-login { width: 100%; margin-top: 8px; padding: 12px; background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 4px 14px rgba(79,70,229,.30); }.btn-login:hover { background: linear-gradient(135deg, #5458ee, #4338ca); }
.layout { display: flex; min-height: 100vh; }.sidebar { width: 216px; background: linear-gradient(180deg, #1e1b4b, #312e81); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 10; }.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; color: #fff; }.sidebar .brand .logo-icon { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }.sidebar .brand b { font-size: 15px; letter-spacing: .5px; }.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 10px; }.nav-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 13px; margin-bottom: 3px; text-align: left; background: transparent; color: #c7d2fe; }.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }.nav-item.active { background: linear-gradient(135deg, rgba(129,140,248,.30), rgba(99,102,241,.30)); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(129,140,248,.35); }.nav-item .ico { width: 20px; text-align: center; }.sidebar .foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.10); color: #a5b4fc; font-size: 12px; }
.main { flex: 1; margin-left: 216px; padding: 20px 26px 46px; min-width: 0; }.topbar, .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.topbar { margin-bottom: 20px; }.topbar h2 { font-size: 20px; }.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }.user-chip { display: flex; align-items: center; gap: 10px; }.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff; font-weight: 600; }.name { font-weight: 600; }.role { font-size: 12px; color: var(--muted); }.chip-btn { background: #fff; border: 1.5px solid var(--border); color: var(--muted); box-shadow: var(--shadow); }.chip-btn.danger:hover { color: var(--red); border-color: var(--red); }
.panel { background: var(--card); border-radius: 16px; padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }.panel h2 { font-size: 16px; margin-bottom: 14px; }.panel h3 { font-size: 15px; margin-bottom: 14px; }.profile-panel { margin-top: 20px; }.create-panel, .assignment-panel, .process-panel { margin: 20px 0; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); align-items: end; gap: 14px; margin-bottom: 20px; }.inline-form button, form > button { align-self: end; background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; } form { display: grid; gap: 14px; }
.personal-info-table { max-width: 760px; min-width: 0; }.personal-info-table th { width: 190px; color: var(--muted); background: #f8fafc; text-align: left; }.personal-password-form { max-width: 520px; }.personal-password-form > div { display: flex; justify-content: flex-start; }
.users-list-actions, .user-action-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }.user-action-options { flex-direction: column; }.user-actions-dialog { max-height: 90vh; overflow: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; } th { background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 500; } th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #f1f5f9; font-size: 13px; } tr:hover td { background: #f8faff; }.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }.cards article { background: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }.cards strong { display: block; font-size: 24px; color: var(--primary); margin-top: 4px; }.error { color: var(--red); min-height: 1.2em; }
@media (max-width: 760px) { .sidebar { position: static; width: 100%; }.layout { display: block; }.sidebar nav { display: flex; overflow-x: auto; }.nav-item { min-width: max-content; }.sidebar .foot { display: none; }.main { margin-left: 0; padding: 18px; }.topbar { align-items: flex-start; flex-direction: column; }.user-chip { width: 100%; }.inline-form { grid-template-columns: 1fr; } table { min-width: 680px; } #content { overflow-x: auto; } }

/* 通知铃铛与红点角标（需求反馈 3） */
.topbar-right { display: flex; align-items: center; gap: 14px; position: relative; }
.bell { position: relative; background: #fff; border: 1.5px solid var(--border); color: var(--muted); width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; padding: 0; }
.bell:hover { background: #f1f5f9; }
.bell-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; box-shadow: 0 0 0 2px #fff; }
.notif-item.read { opacity: .62; }
.permission-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.permission-toggle input { width: auto; }
.notif-panel { position: absolute; top: 52px; right: 0; width: 320px; max-height: 60vh; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 50; padding: 8px; }
.notif-head { font-size: 12px; color: var(--muted); padding: 6px 8px 8px; border-bottom: 1px solid var(--border); }
.notif-item { width: 100%; text-align: left; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; margin-top: 6px; display: block; color: var(--text); }
.notif-item:hover { background: #eef2fb; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.notif-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* 看板图表（需求反馈 6） */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 16px; }
.chart-card { background: #f8fafc; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.chart-card.chart-wide { grid-column: 1 / -1; }
.chart-card h3 { font-size: 14px; margin-bottom: 8px; }
.bc-svg { width: 100%; min-width: 480px; height: auto; }
.bc-label { font-size: 11px; fill: var(--muted); }
.bc-val { font-size: 11px; fill: var(--text); font-weight: 600; }
.bc-center { font-size: 12px; fill: #fff; font-weight: 600; text-anchor: middle; }
.bc-bar-clickable { cursor: pointer; outline: none; }
.bc-bar-clickable:hover, .bc-bar-clickable:focus { filter: brightness(.88); stroke: #312e81; stroke-width: 2; }
.funnel-stage { transition: filter .14s ease, opacity .14s ease; }
.chart-hint { margin-top: 4px; font-size: 11px; }
.muted { color: var(--muted); font-size: 13px; }
.period-switch { display: flex; gap: 6px; }.period-switch .period { border: 1px solid var(--border); background: #fff; color: var(--muted); }.period-switch .period.active { border-color: var(--primary); background: var(--primary); color: #fff; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

/* 线索详情和分配使用遮罩弹窗，避免内容追加到表格下方。 */
#app:has(#process-panel:not(:empty))::after, #app:has(#assignment-panel:not(:empty))::after, #app:has(#analytics-detail-panel:not(:empty))::after, #app:has(#dashboard-detail-panel:not(:empty))::after, #app:has(#profile-editor:not(:empty))::after, #app:has(#task-action-panel:not(:empty))::after { content: ''; position: fixed; inset: 0; z-index: 30; background: rgba(15,23,42,.48); }
#process-panel:not(:empty), #assignment-panel:not(:empty), #analytics-detail-panel:not(:empty), #dashboard-detail-panel:not(:empty), #profile-editor:not(:empty), #task-action-panel:not(:empty) { position: fixed; z-index: 31; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(900px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; padding: 20px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); }
.user-permission-dialog { margin-top: 18px; scroll-margin-top: 18px; }
.user-permission-dialog .permission-matrix input:disabled { cursor: not-allowed; opacity: .55; }
.permission-matrix { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 16px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; }
.permission-matrix legend { padding: 0 6px; color: var(--text); font-weight: 600; }
.permission-matrix .muted { grid-column: 1 / -1; }
.chart-download { margin-top: 8px; font-size: 12px; padding: 6px 10px; }

/* 导航按工作流程分组，默认收起低频业务模块，避免所有入口争抢同一层级。 */
.nav-group { margin: 2px 0 8px; }
.nav-group summary { padding: 9px 13px 6px; color: #a5b4fc; font-size: 11px; font-weight: 700; letter-spacing: .08em; list-style: none; cursor: pointer; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '⌄'; float: right; opacity: .7; }
.nav-group:not([open]) summary::after { content: '›'; }
.nav-group .nav-item { margin: 1px 0; padding: 9px 12px; font-size: 13px; }
.dashboard-cards { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.dashboard-cards article { border-top: 3px solid #c7d2fe; padding: 14px 16px; }
.dashboard-cards article:first-child, .dashboard-cards article:nth-child(2) { border-top-color: var(--primary); }
.section-heading { margin: 24px 0 10px; font-size: 14px; }
.dashboard-primary { grid-template-columns: minmax(300px, .8fr) minmax(0, 1.5fr); }
.dashboard-range { display: flex; align-items: end; gap: 12px; max-width: 520px; margin: 18px 0 4px; }
.dashboard-range label { flex: 1; }
.dashboard-range button { background: var(--primary); color: #fff; }
.dashboard-overview .period-switch { flex-wrap: wrap; justify-content: flex-end; }
.table-scroll { overflow-x: auto; }
.table-scroll thead th { position: sticky; top: 0; z-index: 2; background: #f8fafc; box-shadow: 0 1px 0 var(--border); }
.table-scroll td { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 9px; font-size: 12px; white-space: nowrap; background: #f1f5f9; color: #475569; }
.priority-high, .status-pending_assignment, .status-pending_acceptance { background: #fff1f2; color: #be123c; }
.priority-normal, .status-assigned, .status-accepted { background: #eff6ff; color: #1d4ed8; }
.priority-low, .status-following_up { background: #fffbeb; color: #b45309; }
.status-dealt, .status-completed { background: #ecfdf5; color: #047857; }
.status-invalid, .status-returned { background: #f1f5f9; color: #64748b; }
.dashboard-cards article, .chart-card { transition: transform .16s ease, box-shadow .16s ease; }
.dashboard-cards article:hover, .chart-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.dashboard-cards article { position: relative; padding-bottom: 34px; }
.dashboard-detail { position: absolute; top: 12px; right: 12px; padding: 4px 8px; font-size: 11px; }
.chart-card { position: relative; padding-bottom: 42px; }
.chart-card > .dashboard-detail { top: auto; bottom: 10px; right: 12px; }
#field-editor:not(:empty) { position: fixed; z-index: 31; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(760px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; padding: 20px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); }
#app:has(#field-editor:not(:empty))::after { content: ''; position: fixed; inset: 0; z-index: 30; background: rgba(15,23,42,.48); }
/* 表头筛选行（全系统统一 .table-filter-row，由 data-table.js 组件渲染；默认收起，.dt-open 时展开）。 */
.dt .table-filter-row { display: none; }
.dt.dt-open .table-filter-row { display: table-row; }
.table-scroll .static-table-filter-row { display: none; }
.table-scroll.static-table-filter-open .static-table-filter-row { display: table-row; }
.static-table-toolbar { margin: 0 0 8px; }
.table-filter-row th { padding: 6px 5px; background: #fff; position: sticky; top: var(--dt-head-h, 41px); z-index: 2; }
.table-filter-row input, .table-filter-row select { min-width: 82px; padding: 7px 8px; border-radius: 7px; font-size: 12px; }
.table-filter-row button { padding: 7px 9px; margin: 2px; white-space: nowrap; font-size: 12px; }
/* 统一表格工具条：筛选开关 + 生效条件 chips + 页面自定义工具。 */
.dt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 6px; }
.dt-toolbar label { display: flex; align-items: center; gap: 6px; }
.dt-toolbar select, .dt-toolbar input { width: auto; }
.dt-toolbar .lead-summary { margin-top: 0; }
.dt-filter-toggle { background: #fff; border: 1.5px solid var(--border); color: var(--muted); padding: 6px 12px; font-size: 12px; }
.dt-filter-toggle::after { content: '▾'; margin-left: 6px; }
.dt.dt-open .dt-filter-toggle { border-color: var(--primary); color: var(--primary); }
.dt.dt-open .dt-filter-toggle::after { content: '▴'; }
.dt-filter-count { display: inline-block; min-width: 16px; height: 16px; margin-left: 5px; padding: 0 4px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
/* 生效筛选列的表头高亮圆点。 */
th.has-filter { color: var(--primary); }
th.has-filter::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: var(--primary); vertical-align: middle; }
th.has-filter .dt-sort { color: var(--primary); }
.dt-sort { background: none; padding: 0; font: inherit; color: inherit; }
.dt-sort:hover { background: none; color: var(--primary); }
/* 已选筛选条件回显 chips：点 ✕ 移除单个条件。 */
.dt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; }
.dt-chip { padding: 3px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; }
.dt-chip:hover { background: #dbeafe; }
.dt-clear-all { padding: 3px 10px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-size: 12px; }
.dt-clear-all:hover { background: #e2e8f0; }
/* 「线索内容」列：企微/快速录入的原文摘要，超长省略，悬停看全文。 */
.lead-content-cell { min-width: 190px; max-width: 320px; white-space: normal !important; color: var(--muted); }
.lead-content-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-table-attachment { display: inline-flex; flex-direction: column; align-items: center; vertical-align: top; gap: 3px; margin: 6px 6px 0 0; color: var(--muted); font-size: 11px; text-decoration: none; }
.lead-table-attachment-image { display: block; width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--border); border-radius: 5px; background: #f8fafc; }
/* 意向数据跟进表：电话/微信小号显示在姓名下方。 */
.intent-followup-table td small { display: block; color: var(--muted); margin-top: 3px; }
.public-pool-table { min-width: 920px; }
.public-pool-table td small { display: block; color: var(--muted); margin-top: 3px; }
.public-pool-panel .field-required-note { margin: 12px 0; }
/* 线索池汇总行：状态统计胶囊，可点击快速筛选。 */
.lead-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; margin-top: 4px; font-size: 12px; color: var(--muted); }
.lead-summary-total { font-weight: 600; }
.lead-summary-chip { padding: 3px 10px; border-radius: 999px; background: #f1f5f9; font-size: 12px; color: var(--text); }
.lead-summary-chip:hover { background: #e2e8f0; }
/* 汇总胶囊当前生效项高亮。 */
.lead-summary-chip.active { background: var(--primary); color: #fff; }
/* 请求加载态：旧内容降透明度并禁止点击，提示正在刷新。 */
.lead-pool.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }
/* 分页：每页条数与页码跳转输入框。 */
.pagination select, .pagination input[type="number"] { padding: 5px 8px; border-radius: 7px; font-size: 12px; width: auto; }
.pagination input[type="number"] { width: 64px; }
/* 手机卡片上的原文摘要。 */
.lead-card-preview { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); }
.pagination button:not(:disabled) { background: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }
.required-mark { color: var(--red); font-weight: 700; margin-left: 3px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); align-items: end; gap: 12px; }
.settings-grid .setting-switch { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.settings-grid .setting-switch input, .field-required { width: auto; }
.lead-card-list { display: none; }
.lead-card { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.lead-card-head, .lead-card-tags, .lead-card-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lead-card-head h3 { font-size: 16px; margin: 0 0 3px; color: var(--text); }
.lead-card-head p { color: var(--muted); font-size: 14px; }
.lead-card-tags { justify-content: flex-start; flex-wrap: wrap; margin: 12px 0; font-size: 13px; }
.lead-card-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.lead-card-details div { min-width: 0; }
.lead-card-details dt { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.lead-card-details dd { overflow-wrap: anywhere; font-size: 14px; }
.lead-card-actions { justify-content: flex-start; padding-top: 10px; border-top: 1px solid #f1f5f9; }
.lead-card-actions button:last-child:not(:first-child) { background: var(--primary); color: #fff; }
.empty-state { grid-column: 1 / -1; padding: 28px; text-align: center; color: var(--muted); background: #f8fafc; border-radius: 12px; }
@media (max-width: 1200px) {
  .main { padding: 16px clamp(12px, 1.6vw, 20px) 32px; }
  .panel { padding: clamp(12px, 1.4vw, 18px); }
}
@media (max-width: 860px) {
  /* 手机端默认显示卡片；点开“筛选”时切换到表格视图以便逐列筛选。 */
  .lead-table-view { display: none; }
  .dt.dt-open .lead-table-view { display: block; }
  .dt.dt-open .lead-card-list { display: none; }
  .lead-card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .lead-card-list { grid-template-columns: minmax(0, 1fr); }
  .lead-card { padding: 14px; }
  .lead-card-details { gap: 10px 8px; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) { .dashboard-primary { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .nav-group { display: contents; }.nav-group summary { display: none; }.dashboard-range { flex-wrap: wrap; }.dashboard-range label { min-width: 130px; } }

/* 让后台在窄桌面、平板和手机上都保持可用。 */
[hidden] { display: none !important; }
#app, .layout, .main, #content { min-width: 0; }
/* 表格统一由 .table-scroll 容器横向滚动，避免 table 自身再产生第二层滚动条。 */
#content table { display: table; width: 100%; overflow: visible; }
#content .table-scroll table { width: max-content; min-width: 100%; }
.config-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.config-section-heading { margin-bottom: 12px; }
.config-section-heading h3 { margin-bottom: 4px; color: var(--text); }
.config-section-heading .muted { margin: 0; line-height: 1.6; }
.user-subsection { margin: 0 0 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.user-subsection > summary { position: relative; padding: 14px 44px 14px 16px; list-style: none; cursor: pointer; color: var(--text); font-weight: 600; }
.user-subsection > summary::-webkit-details-marker { display: none; }
.user-subsection > summary::after { content: '+'; position: absolute; right: 17px; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 20px; font-weight: 400; }
.user-subsection[open] > summary::after { content: '−'; }
.user-subsection > .muted { padding: 0 16px 12px; line-height: 1.6; }
.user-subsection[open] > summary { border-bottom: 1px solid var(--border); }
.user-subsection-body { padding: 2px 16px 16px; overflow-x: auto; }
.user-subsection-body > .panel { margin: 12px 0 0; padding: 14px; box-shadow: none; border: 1px solid var(--border); }
.user-subsection-body > .panel h2 { margin-bottom: 8px; }
.user-subsection-body > form, .user-subsection-body > fieldset { margin-top: 12px; }
.user-subsection-body table { min-width: 620px; }
.nav-subgroup { margin: 2px 0 5px; }
.nav-subgroup > summary { display: flex; align-items: center; gap: 9px; padding: 9px 13px; list-style: none; cursor: pointer; color: #c7d2fe; font-size: 13px; font-weight: 600; }
.nav-subgroup > summary::-webkit-details-marker { display: none; }
.nav-subgroup > summary::after { content: '⌄'; margin-left: auto; opacity: .7; }
.nav-subgroup:not([open]) > summary::after { content: '›'; }
.nav-subgroup > summary:hover { color: #fff; }
.nav-subitem { padding-left: 29px; font-size: 12px; }
.nav-subitem .ico { width: 14px; font-size: 10px; }
/* 导航层级：一级栏目最醒目，二级入口次之，三级功能入口更轻；各项留出清晰点击间距。 */
.sidebar nav > .nav-group { margin-bottom: 9px; }
.sidebar nav > .nav-group > summary { padding: 7px 13px 6px; font-size: 15px; letter-spacing: 0; }
.sidebar nav > .nav-group > .nav-item { margin: 1px 0; padding: 8px 13px; font-size: 14px; }
.nav-subgroup { margin: 2px 0 4px; padding: 0; border: 0; }
.nav-subgroup > summary { padding: 7px 13px; font-size: 14px; }
.nav-subgroup > .nav-subitem { margin: 1px 0; padding: 6px 10px 6px 32px; font-size: 12px; }
.nav-subgroup > .nav-subitem .ico { width: 12px; }
.nav-item .ico, .nav-subgroup > summary .ico { display: inline-flex; flex: 0 0 20px; width: 20px; align-items: center; justify-content: center; }
.nav-icon { display: block; width: 17px; height: 17px; }
.nav-subitem .nav-icon { width: 14px; height: 14px; }
@media (max-width: 1100px) {
  .sidebar { width: 190px; }
  .main { margin-left: 190px; padding: 18px 20px 38px; }
  .panel { padding: 18px; }
  .dashboard-primary { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: relative; width: 100%; max-height: 45vh; }
  .sidebar nav { display: flex; flex-wrap: nowrap; gap: 5px; overflow-x: auto; }
  .nav-group { display: contents; }
  .nav-group summary { display: none; }
  .nav-group .nav-item, .nav-item { flex: 0 0 auto; min-width: max-content; margin: 0; }
  .nav-subgroup { flex: 0 0 auto; margin: 0; padding: 0; border: 0; }
  .nav-subgroup > summary { white-space: nowrap; padding: 8px 10px; }
  .nav-subgroup > .nav-subitem { flex: 0 0 auto; }
  .main { width: 100%; margin: 0; padding: 14px 12px 28px; }
  .topbar { align-items: stretch; gap: 10px; }
  .topbar-right { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .user-chip { min-width: 0; flex: 1; flex-wrap: wrap; }
  .panel { padding: 15px 12px; border-radius: 12px; }
  .panel-title { align-items: flex-start; flex-wrap: wrap; }
  .inline-form { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
  .dashboard-range { flex-wrap: wrap; }
  .dashboard-range label { min-width: min(100%, 180px); }
  #process-panel:not(:empty), #assignment-panel:not(:empty), #analytics-detail-panel:not(:empty), #dashboard-detail-panel:not(:empty), #profile-editor:not(:empty), #task-action-panel:not(:empty), #field-editor:not(:empty) {
    top: 50%; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 14px 10px;
  }
}
@media (max-width: 440px) {
  .topbar h2 { font-size: 18px; }
  .user-chip { gap: 7px; }
  .user-chip .name, .user-chip .role { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .period-switch { justify-content: flex-start !important; }
  .cards, .dashboard-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cards article { padding: 12px; }
  .cards strong { font-size: 19px; }
}

/* 修复大表格的双层纵向滚动；长表只随页面滚动，外层保留横向查看能力。 */
.table-scroll { max-height: none; overflow-x: auto; overflow-y: visible; }
.table-scroll thead th { top: 0; }

/* 线索录入表单按字段类型分组，长文本独占一行，避免挤成窄条。 */
.inline-form label:has(textarea) { grid-column: 1 / -1; }
.inline-form textarea { min-height: 110px; }
.required-hint { grid-column: 1 / -1; color: var(--red); font-size: 12px; }
.field-required-note { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: #fff8e9; color: #8a5a00; font-size: 12px; line-height: 1.6; }
.custom-channel[hidden] { display: none !important; }

/* 人员账号创建表单分为岗位信息、权限和可折叠教学薪酬区。 */
.user-create-form { display: grid; gap: 16px; }
.user-form-group { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.user-form-group legend { padding: 0 6px; font-weight: 700; color: var(--text); }
.user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.user-form-group .permission-matrix { border: 0; padding: 0; }
.users-list-controls, .users-list-table { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; margin: 12px 0; }
.users-list-controls .panel-title { margin-bottom: 12px; }
.users-list-controls h3 { margin-bottom: 4px; }
.bulk-user-table { max-height: none; }
.wecom-inline-editor { display: flex; min-width: 190px; gap: 4px; }
.wecom-inline-editor input { min-width: 105px; max-width: 180px; }
.user-permission-summary { min-width: 220px; max-width: 320px; white-space: normal; line-height: 1.45; }
.audit-filters { max-width: 560px !important; white-space: normal !important; overflow-wrap: anywhere; line-height: 1.55; }
.lead-inline-editor { width: 100%; min-width: 92px; box-sizing: border-box; padding: 5px 6px; border: 2px solid; border-radius: 5px; background: #fff; cursor: text; }
.lead-editor-owner { border-color: #3182ce; background: #f0f7ff; }
.lead-editor-manager { border-color: #805ad5; background: #f7f2ff; }
.lead-editor-owner:hover,.lead-editor-owner:focus { border-color: #1558a6; background: #fff; outline: 2px solid #bfdbfe; }
.lead-editor-manager:hover,.lead-editor-manager:focus { border-color: #553c9a; background: #fff; outline: 2px solid #ddd6fe; }
.inline-save-state { display: block; color: var(--muted); font-size: 10px; min-height: 12px; }
.readonly-inline-field { padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; font-weight: 400; }
.lead-editable-cell { background: #fff; }
.lead-focus-row td { animation: lead-focus-highlight 1.2s ease-in-out 3; }
@keyframes lead-focus-highlight { 50% { background-color: #fff2b8; } }
.lead-detail-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px; margin: 12px 0 18px; border-radius: 10px; background: #f5f6ff; color: #30344b; }
.field-change-history { margin-top: 16px; }
.module-search-form { display: flex; align-items: end; gap: 8px; }
.module-search-form label { min-width: 180px; }

/* 页面内轻提示与原生 dialog：替代阻塞式 alert/prompt，并支持 Escape 关闭。 */
#toast-region { position: fixed; z-index: 1000; top: 18px; right: 18px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; background: #ecfdf5; color: #047857; box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out; }
.toast-error { background: #fff1f2; color: #be123c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
body.modal-open { overflow: hidden; }
.app-confirm-dialog { width: min(460px, calc(100vw - 28px)); margin: auto; padding: 22px; border: 0; border-radius: 14px; box-shadow: var(--shadow-lg); }
.app-confirm-dialog::backdrop { background: rgba(15,23,42,.5); }
.app-confirm-dialog form { display: grid; gap: 14px; }
.app-confirm-dialog h3 { margin: 0; }
.password-input-wrap { display: flex; gap: 8px; align-items: stretch; }
.password-input-wrap input { flex: 1; min-width: 0; }
.password-visibility { flex: 0 0 auto; padding: 8px 12px; color: var(--primary); background: #eff6ff; }
.login-help { margin: 16px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.password-visibility { display: grid; place-items: center; width: 34px; min-width: 34px; padding: 5px; color: var(--muted); }
.password-visibility svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-visibility:hover { color: var(--primary); }
.app-confirm-dialog p { line-height: 1.6; }
.app-confirm-dialog form > div { display: flex; justify-content: flex-end; gap: 8px; }
.app-confirm-dialog .primary { background: var(--primary); color: #fff; }
.app-confirm-dialog .cancel { background: #f1f5f9; }
.wecom-preview-dialog { width: min(520px, calc(100vw - 28px)); max-height: 90vh; overflow: auto; }
.wecom-preview-dialog > .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wecom-phone-preview { width: min(360px, 100%); min-height: 440px; margin: 16px auto; border: 8px solid #202938; border-radius: 28px; background: #f2f4f7; overflow: hidden; box-shadow: 0 12px 32px rgba(15,23,42,.18); }
.wecom-phone-top { display: flex; justify-content: space-between; padding: 12px 18px 8px; background: #fff; color: #253044; font-size: 12px; font-weight: 700; }
.wecom-chat-header { padding: 12px 16px; border-top: 1px solid #f1f3f6; background: #fff; color: #202938; font-size: 14px; font-weight: 650; }
.wecom-message-row { display: flex; align-items: flex-start; gap: 9px; padding: 22px 12px; }
.wecom-app-avatar { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 8px; background: #1d76e8; color: #fff; font-weight: 700; }
.wecom-message-content { min-width: 0; flex: 1; }
.wecom-app-title { display: flex; justify-content: space-between; gap: 8px; margin: 1px 0 7px; color: #697386; font-size: 11px; }
.wecom-app-title time { white-space: nowrap; }
.wecom-message-bubble { padding: 13px 14px; border: 1px solid #e6e9ee; border-radius: 4px 12px 12px 12px; background: #fff; color: #202938; font-size: 14px; line-height: 1.65; box-shadow: 0 2px 5px rgba(15,23,42,.04); }
.wecom-message-bubble strong { font-size: 15px; }
.wecom-message-bubble p { margin: 6px 0 0; }
.wecom-message-cta { margin-top: 10px; padding: 7px 12px; border-radius: 4px; background: #1d76e8; color: #fff; font-size: 12px; }
.task-lead-detail .panel-title { align-items: flex-start; }
.task-lead-detail .panel-title h3, .task-lead-detail .panel-title p { margin-top: 0; }
.task-lead-detail table { width: 100%; }
.task-lead-detail th { width: 112px; text-align: left; color: var(--muted); }
.task-lead-detail td { overflow-wrap: anywhere; }
.task-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.task-sales-fields { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.task-sales-fields h4 { margin: 0 0 6px; }
.task-sales-fields .muted { line-height: 1.6; }
.wecom-phone-bottom { margin: 12px; padding: 11px; border-radius: 8px; background: rgba(255,255,255,.7); color: #7b8493; text-align: center; font-size: 11px; }
.notif-panel[hidden], .bell-badge[hidden] { display: none; }
.page-loading { display: flex; align-items: center; gap: 10px; min-height: 110px; color: var(--muted); }
.loading-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 16px 0 0 #a5b4fc, 32px 0 0 #c7d2fe; margin-right: 32px; animation: loading-pulse .9s ease-in-out infinite alternate; }
@keyframes loading-pulse { to { opacity: .35; transform: scale(.82); } }
.chart-card { overflow-x: auto; }
.bc-svg { min-width: 520px; }
@media (max-width: 560px) {
  .user-form-grid { grid-template-columns: minmax(0, 1fr); }
  .users-list-controls, .users-list-table { padding: 12px 9px; }
  .module-search-form { width: 100%; flex-wrap: wrap; }
  .module-search-form label { flex: 1 1 100%; }
  #toast-region { top: 8px; right: 8px; }
}


.priority-high { background: #fff1f2; color: #be123c; }
.priority-normal { background: #eff6ff; color: #1d4ed8; }
.priority-low { background: #fffbeb; color: #b45309; }
\n
/* 字段列表拖拽排序 */
#content table tbody tr[data-field-key] { cursor: grab; }
#content table tbody tr[data-field-key].dragging { opacity: .5; background: #eef2fb; }
#content table tbody tr[data-field-key]:active { cursor: grabbing; }
.field-move-up, .field-move-down { padding: 3px 9px; font-size: 13px; line-height: 1; margin-left: 4px; background: #eef2fb; }
.field-move-up:hover, .field-move-down:hover { background: #e2e9f9; }
.claim-lead { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; margin-left: 6px; }
.claim-lead:hover { background: linear-gradient(135deg, #5458ee, #4338ca); }


.template-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.template-actions .upload-template { display: inline-flex; align-items: center; gap: 8px; width: auto; color: var(--text); font-weight: 500; background: #eef2fb; border-radius: 9px; padding: 8px 12px; cursor: pointer; }
.template-actions .upload-template input { width: auto; }
.template-actions button { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; }
.template-actions button:hover { background: linear-gradient(135deg, #5458ee, #4338ca); }
.nav-alert { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
#ratio-form.ratio-grid { display: grid; grid-template-columns: repeat(3, minmax(90px, 130px)) auto; align-items: end; justify-content: start; gap: 8px; }
#ratio-form.ratio-grid label { gap: 3px; }
#ratio-form.ratio-grid input { padding: 6px 8px; }
.default-channel-table { min-width: 620px; }
.default-channel-table form { display: block; }
.default-channel-table input, .default-channel-table select { min-width: 115px; }
.priority-table { min-width: 540px; }
.priority-table form { display: block; }
.priority-table input { min-width: 100px; max-width: 140px; }
.lead-entry-compact[open] { width: min(94vw, 640px); max-height: min(90vh, 820px); overflow-y: auto; margin: auto; padding: 24px; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(15, 23, 42, .24); }
.lead-entry-compact::backdrop { background: rgba(15, 23, 42, .55); }
.lead-entry-compact .panel-title { margin-bottom: 18px; }
.feedback-submit-form { max-width: 720px; margin: 18px 0 28px; }
.lead-feedback-form { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.lead-feedback-result { margin-top: 14px; padding: 14px; border-left: 3px solid #6366f1; border-radius: 8px; background: #f5f6ff; }
.lead-feedback-result h4 { margin: 0 0 8px; }
.lead-feedback-result p { margin: 6px 0; }
.task-feedback-disclosure { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.task-feedback-disclosure h4 { margin: 0 0 10px; color: #4f46e5; }
.task-feedback-unavailable { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: #f1f5f9; }
.lead-attachment-gallery { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 16px; }
.lead-attachment-gallery figure { margin: 0; width: min(220px, 42vw); }
.lead-attachment-gallery img { display: block; width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.lead-attachment-gallery figcaption { margin-top: 4px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.employee-feedback-table { min-width: 760px; }
.employee-feedback-table .feedback-content { white-space: normal; min-width: 200px; max-width: 380px; overflow-wrap: anywhere; }
#employee-feedback-editor:not(:empty) { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .48); }
#employee-feedback-editor:not(:empty) > .process-panel { width: min(620px, 100%); max-height: 88vh; overflow-y: auto; margin: 0; background: #fff; }
@media (max-width: 760px) { #ratio-form.ratio-grid { grid-template-columns: repeat(3, minmax(75px, 1fr)); } #ratio-form.ratio-grid button { grid-column: 1 / -1; } }

/* 值班按周网格批量排班 */
.week-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.week-nav #duty-week-label { font-weight: 600; }
.week-nav select { width: auto; margin-left: 6px; }
.duty-grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.duty-grid th, .duty-grid td { border: 1px solid var(--border); padding: 8px 6px; text-align: center; }
.duty-grid thead th { background: #f4f7fd; vertical-align: top; }
.duty-grid tbody td:first-child, .duty-grid thead th:first-child { text-align: left; white-space: nowrap; }
.duty-grid .duty-date { font-weight: 400; color: var(--muted); font-size: 12px; margin: 2px 0; }
.duty-grid .all-day-head { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.duty-grid .all-day-head input { width: auto; margin-left: 4px; vertical-align: middle; }

/* 筛选行显隐统一由 .dt-open 控制（见上方 .dt 规则），各表格宽度按内容自适应、超出时横向滚动。 */
.intent-followup-table td small { display: block; color: var(--muted); margin-top: 3px; }
