* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f6f8; color: #222; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: #1f3a5f; color: #fff; }
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar a { color: #dbe6f5; text-decoration: none; }
.topbar a:hover { color: #fff; }
.pull-form { margin: 0; }
.container { max-width: 1080px; margin: 24px auto; padding: 0 16px; }
.card { background: #fff; border: 1px solid #e3e6ea; border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; }
.card h3 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e8eaed; text-align: left; font-size: 14px; }
th { background: #f0f2f5; }
button, .btn { background: #1f3a5f; color: #fff; border: none; border-radius: 6px; padding: 6px 14px; cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #2a4f7e; }
.btn-secondary { background: #6b7280; }
input, select, textarea { padding: 6px 8px; border: 1px solid #cbd2d9; border-radius: 6px; font-size: 14px; width: 100%; max-width: 420px; }
textarea { min-height: 90px; }
label { display: block; margin: 10px 0 4px; font-size: 14px; color: #444; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #e8eef7; color: #1f3a5f; }
.tag-pending { background: #fff3cd; color: #856404; }
.tag-confirmed { background: #d4edda; color: #155724; }
.tag-reassigned { background: #d1ecf1; color: #0c5460; }
.tag-skipped { background: #e2e3e5; color: #383d41; }
.tag-alert { background: #f8d7da; color: #721c24; }
.muted { color: #888; font-size: 13px; }
.reason { color: #555; font-size: 13px; }
.transcript { white-space: pre-wrap; background: #fafbfc; border: 1px solid #eee; border-radius: 6px; padding: 10px; font-size: 13px; max-height: 320px; overflow: auto; }
.filters { margin: 0 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.filters a { padding: 4px 10px; border-radius: 12px; background: #e8eaed; color: #333; text-decoration: none; font-size: 13px; }
.filters a.active { background: #1f3a5f; color: #fff; }
.inline-form { display: inline; }

/* M3：登录页 / 用户芯片 / 模拟视角横幅（响应式大改由后续里程碑统一追加） */
.login-panel { max-width: 360px; margin: 48px auto; }
.error { color: #b91c1c; font-size: 14px; }
.user-chip { color: #e8eef7; font-size: 13px; margin-left: 12px; }
.btn-link { background: transparent; color: #e8eef7; text-decoration: underline; padding: 0 4px; }
.impersonate-banner { background: #b45309; color: #fff; padding: 8px 16px; font-size: 14px; }
.impersonate-banner .inline-form button { background: #fff; color: #b45309; margin-left: 8px; }

/* ============ M3：工作台 / 徽章 / tab / 时间线 / CSS 条形图 ============ */
.wb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wb-head h2 { margin: 8px 0; }
.wb-more { font-size: 13px; font-weight: normal; margin-left: 8px; }
.badge { display: inline-block; background: #b45309; color: #fff; border-radius: 14px; padding: 4px 12px; font-size: 13px; text-decoration: none; }
.badge:hover { background: #92400e; }
.wb-actions { display: flex; gap: 16px; margin: 12px 0 20px; align-items: center; }  /* C9（20260902-01）：周会导航行垂直居中对齐 */
.btn-big { flex: 1; display: block; text-align: center; background: #1f3a5f; color: #fff; border-radius: 10px; padding: 22px 12px; font-size: 18px; font-weight: 600; text-decoration: none; }
.btn-big:hover { background: #2a4f7e; }
.wb-refresh { float: right; }
.suggestion { border-top: 1px solid #eef0f2; padding: 8px 0; }
.suggestion p { margin: 4px 0; }
.reject-form input { width: auto; max-width: 240px; }
.reminder { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f0f2f5; }
.btn-check { background: #d1fae5; color: #065f46; border-radius: 50%; width: 26px; height: 26px; padding: 0; font-weight: 700; }
.btn-check:hover { background: #a7f3d0; }
.pipeline-summary span { margin-right: 4px; }
.user-roles { opacity: .75; font-size: 12px; margin-left: 4px; }

/* 分级徽章 */
.grade-badge { display: inline-block; min-width: 22px; text-align: center; border-radius: 6px; padding: 2px 7px; font-weight: 700; font-size: 13px; color: #fff; }
.grade-S { background: #b45309; }
.grade-A { background: #1f6f43; }
.grade-B { background: #1f3a5f; }
.grade-C { background: #6b7280; }

/* 提示横幅（预处理失败 / 表单错误） */
.banner-warn { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }

/* tab 页 */
.tabs { display: flex; gap: 8px; margin: 8px 0 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 16px; background: #e8eaed; color: #333; text-decoration: none; font-size: 14px; }
.tabs a.active { background: #1f3a5f; color: #fff; }

/* 时间线 */
.timeline-item { border-left: 3px solid #dbe3ee; padding: 4px 0 4px 14px; margin-bottom: 12px; }
.timeline-item p { margin: 4px 0; }

/* 纯 CSS 条形图（仪表盘） */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.bar-label { width: 72px; font-size: 13px; color: #444; flex: none; }
.bar-track { flex: 1; background: #eef0f2; border-radius: 4px; height: 16px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #1f3a5f; border-radius: 4px; }
.bar-value { width: 48px; text-align: right; font-size: 13px; flex: none; }

/* 行内表单组（详情页操作区 / admin） */
.inline-fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inline-fields input, .inline-fields select { width: auto; max-width: 240px; }
.status-form { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.status-form select { width: auto; }
.status-form label { margin: 0; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-head h2 { margin: 0; }
.btn-small { padding: 3px 10px; font-size: 13px; }
.input-inline { width: 140px; display: inline-block; }
.role-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.role-check { display: inline-flex; align-items: center; gap: 3px; margin: 0; font-size: 13px; }
.role-check input { width: auto; }
.radio-group label.radio { display: block; margin: 4px 0; }
.radio-group input[type=radio] { width: auto; }
.line-status { font-size: 13px; padding: 2px 8px; border-radius: 10px; background: #e8eaed; }
.line-进行中 { background: #dbeafe; color: #1d4ed8; }
.line-完成 { background: #d4edda; color: #155724; }
.filter-form select { width: auto; }
.confirm-alt { border-top: 1px solid #eef0f2; margin-top: 12px; padding-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ M3：响应式（≤480px，微信内打开可用） ============ */
@media (max-width: 480px) {
  /* topbar 纵向堆叠 */
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 14px; }
  .topbar nav { flex-wrap: wrap; gap: 12px; }
  .container { margin: 12px auto; padding: 0 10px; }
  /* 大按钮通栏 */
  .wb-actions { flex-direction: column; gap: 10px; }
  .btn-big { width: 100%; padding: 18px 12px; font-size: 17px; }
  /* 工作台格子单列 */
  .dash-grid { grid-template-columns: 1fr; }
  /* 表格转卡片：表头隐藏，行/单元格块级 */
  table, thead, tbody, tr, td, th { display: block; }
  thead { display: none; }
  tr { border: 1px solid #e3e6ea; border-radius: 8px; margin-bottom: 10px; padding: 8px 10px; }
  th, td { border-bottom: none; padding: 4px 0; }
  .card table tr { border: none; border-bottom: 1px solid #eef0f2; border-radius: 0; margin-bottom: 0; padding: 6px 0; }
  /* 表单控件 100% 宽 */
  input, select, textarea { width: 100%; max-width: 100%; }
  .inline-fields input, .inline-fields select, .status-form select,
  .filter-form select, .input-inline, .reject-form input { width: 100%; max-width: 100%; }
  .inline-fields, .status-form { flex-direction: column; align-items: stretch; }
  .bar-label { width: 60px; }
}

/* ============ FR-B1（20260823-02）：客户详情页概况卡 + 顶部动作区 ============ */
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; margin-top: 8px; }
.ov-item { margin: 4px 0; font-size: 14px; }
.ov-label { display: inline-block; min-width: 70px; color: #888; font-size: 13px; margin-right: 6px; }
.ov-gap { margin-left: 18px; }
.ov-todos { margin: 2px 0 4px; padding-left: 18px; }
.ov-todos li { margin: 2px 0; }
/* C1（20260902-01）：客户列表可排序列头（点按切换升/降，当前列带 ▲▼ 方向标识） */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
/* F8（20260902-03）：未排序时列头常驻灰色 ⇅ 提示「可排序」；排序后由 ▲▼ 覆盖（下方规则后定义胜出） */
th.sortable::after { content: ' ⇅'; color: #bbb; }
th.sortable.sort-asc::after { content: ' ▲'; color: inherit; }
th.sortable.sort-desc::after { content: ' ▼'; color: inherit; }
/* C2（20260902-01）：概况卡「关注点/诉求」分条列表 */
.focus-bullets { margin: 2px 0 4px; padding-left: 18px; font-size: 14px; }
.focus-bullets li { margin: 2px 0; }
.focus-more summary { cursor: pointer; color: #1f3a5f; font-size: 13px; }
/* F3（20260902-03）：关注点单条超长折叠（截断 + 展开全文） */
.focus-bullets details { display: inline; }
.focus-bullets details summary { display: inline; cursor: pointer; color: #1f3a5f; font-size: 13px; list-style: none; }
.focus-bullets details[open] summary { display: none; }
.focus-bullets details .fb-full { white-space: pre-wrap; }
/* F7（20260902-03）：待办候选勾选区统一 class（弃 inline style），左对齐 + 每条独占一行 */
.todo-cand { text-align: left; }
.todo-cand label { display: block; }
/* F12（20260903-01）：待办渲染处统一收口——列表/段落均左对齐（覆盖卡片居中场景） */
.todo-cand ul, .todo-cand p { text-align: left; }
/* CRM-18（20260903-01）：确认页待办候选逐条行——勾选+文案+责任人+截止 横排换行 */
.todo-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
            margin: 4px 0; text-align: left; }
.todo-row .todo-check { display: inline-flex; align-items: center; }
.todo-row .todo-text { flex: 1 1 220px; min-width: 160px; }
/* R2（20260903-02）：待办内容先展示，勾选确认添加后才展开改文案/责任人/截止 */
.todo-row .todo-content { flex: 1 1 auto; min-width: 140px; }
.todo-row .todo-detail { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; }
.todo-row .todo-detail[hidden] { display: none; }
/* C2（20260903-03）：待办候选 添加→确认→修改 流程——行首 bullet、只读整行、行尾按钮 */
.todo-row .todo-bullet { color: #7aa2f7; }
.todo-row .todo-summary { flex: 1 1 auto; min-width: 140px; color: #c7d3e3; }
/* CRM-09（20260903-01）：客户列表状态快捷筛选 chips */
.chip-row { margin: 8px 0; }
.chip { display: inline-block; padding: 2px 12px; border: 1px solid #3a4a5f;
        border-radius: 999px; font-size: 13px; color: #c7d3e3; }
.chip:hover { border-color: #7aa2f7; color: #7aa2f7; }
.chip-on { background: #2a3f5f; border-color: #7aa2f7; color: #7aa2f7; }
/* F13（20260903-01）：活动量大项组名（跟进/拜访/录音）在 colspan=2 单元格内居中 */
.activity-table th[colspan="2"] { text-align: center; }
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
details.card summary, .card details summary { cursor: pointer; }
@media (max-width: 480px) {
  .ov-grid { grid-template-columns: 1fr; }
  .ov-gap { margin-left: 0; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar .btn, .action-bar button { width: 100%; text-align: center; }
}
.req { color: #b91c1c; }
